Subversion Repositories oidplus

Rev

Rev 941 | Rev 1008 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 941 Rev 1000
Line 498... Line 498...
498
                return false;
498
                return false;
499
        }
499
        }
500
 
500
 
501
        public function implementsFeature($id) {
501
        public function implementsFeature($id) {
502
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.1') return true; // oobeEntry, oobeRequested
502
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.1') return true; // oobeEntry, oobeRequested
-
 
503
                if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.8') return true; // getNotifications()
503
                return false;
504
                return false;
504
        }
505
        }
505
 
506
 
506
        public function oobeRequested(): bool {
507
        public function oobeRequested(): bool {
507
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.1
508
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.1
Line 534... Line 535...
534
                                OIDplus::config()->setValue('oobe_registration_done', '1');
535
                                OIDplus::config()->setValue('oobe_registration_done', '1');
535
                        }
536
                        }
536
                        return;
537
                        return;
537
                }
538
                }
538
 
539
 
539
                $testurl = 'https://www.google.com/';
-
 
540
                $ch = curl_init();
-
 
541
                if (ini_get('curl.cainfo') == '') curl_setopt($ch, CURLOPT_CAINFO, OIDplus::localpath() . 'vendor/cacert.pem');
-
 
542
                curl_setopt($ch, CURLOPT_URL, $testurl);
-
 
543
                curl_setopt($ch, CURLOPT_USERAGENT, 'ViaThinkSoft-OIDplus/2.0');
-
 
544
                curl_setopt($ch, CURLOPT_HEADER, TRUE);
-
 
545
                curl_setopt($ch, CURLOPT_NOBODY, TRUE);
-
 
546
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
-
 
547
                curl_exec($ch);
-
 
548
                $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
 
549
                curl_close($ch);
-
 
550
                if (!$httpCode) {
-
 
551
                        echo '<p><font color="red">';
-
 
552
                        echo _L('The "CURL" PHP extension cannot access HTTPS webpages. Therefore, you cannot use this feature. Please download <a href="https://curl.haxx.se/ca/cacert.pem">cacert.pem</a>, place it somewhere and then adjust the setting <code>curl.cainfo</code> in PHP.ini.').' ';
-
 
553
                        echo _L('Therefore, you <b>cannot</b> register your OIDplus instance now.');
-
 
554
                        echo '</font></p>';
-
 
555
                        if ($do_edits) {
-
 
556
                                OIDplus::config()->setValue('oobe_registration_done', '1');
-
 
557
                        }
-
 
558
                        return;
-
 
559
                }
-
 
560
 
-
 
561
                $pki_status = OIDplus::getPkiStatus();
540
                $pki_status = OIDplus::getPkiStatus();
562
 
541
 
563
                if (!$pki_status) {
542
                if (!$pki_status) {
564
                        echo '<p><font color="red">';
543
                        echo '<p><font color="red">';
565
                        echo _L('Your system could not generate a private/public key pair. (OpenSSL is probably missing on your system).').' ';
544
                        echo _L('Your system could not generate a private/public key pair. (OpenSSL is probably missing on your system).').' ';
Line 634... Line 613...
634
                echo '<p>'._L('<i>Privacy information:</i> This setting can always be changed in the administrator login / control panel.').'<br>';
613
                echo '<p>'._L('<i>Privacy information:</i> This setting can always be changed in the administrator login / control panel.').'<br>';
635
                echo _L('<a %1>Click here</a> for more information about privacy related topics.','href="../../../../res/OIDplus/privacy_documentation.html" target="_blank"');
614
                echo _L('<a %1>Click here</a> for more information about privacy related topics.','href="../../../../res/OIDplus/privacy_documentation.html" target="_blank"');
636
                echo '</p>';
615
                echo '</p>';
637
        }
616
        }
638
 
617
 
-
 
618
        public function getNotifications($user=null): array {
-
 
619
                // Interface 1.3.6.1.4.1.37476.2.5.2.3.8
-
 
620
                $notifications = array();
-
 
621
                if ((!$user || ($user == 'admin')) && OIDplus::authUtils()->isAdminLoggedIn()) {
-
 
622
                        if (!function_exists('curl_init')) {
-
 
623
                                $title = _L('System registration');
-
 
624
                                $notifications[] = array('ERR', _L('OIDplus plugin "%1" is enabled, but required PHP extension "%2" is not installed.', $title, 'php_curl'));
-
 
625
                        }
-
 
626
                }
-
 
627
                return $notifications;
-
 
628
        }
-
 
629
 
639
}
630
}