Rev 380 | Rev 389 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 380 | Rev 386 | ||
---|---|---|---|
Line 727... | Line 727... | ||
727 | } else { |
727 | } else { |
728 | $out = false; |
728 | $out = false; |
729 | 729 | ||
730 | if (self::getPkiStatus(true)) { |
730 | if (self::getPkiStatus(true)) { |
731 | $pubKey = OIDplus::config()->getValue('oidplus_public_key'); |
731 | $pubKey = OIDplus::config()->getValue('oidplus_public_key'); |
- | 732 | $m = array(); |
|
732 | if (preg_match('@BEGIN PUBLIC KEY\-+(.+)\-+END PUBLIC KEY@ismU', $pubKey, $m)) { |
733 | if (preg_match('@BEGIN PUBLIC KEY\-+(.+)\-+END PUBLIC KEY@ismU', $pubKey, $m)) { |
733 | $out = smallhash(base64_decode($m[1])); |
734 | $out = smallhash(base64_decode($m[1])); |
734 | } |
735 | } |
735 | } |
736 | } |
736 | self::$system_id_cache = $out; |
737 | self::$system_id_cache = $out; |
Line 769... | Line 770... | ||
769 | // Save the key pair to database |
770 | // Save the key pair to database |
770 | OIDplus::config()->setValue('oidplus_private_key', $privKey); |
771 | OIDplus::config()->setValue('oidplus_private_key', $privKey); |
771 | OIDplus::config()->setValue('oidplus_public_key', $pubKey); |
772 | OIDplus::config()->setValue('oidplus_public_key', $pubKey); |
772 | 773 | ||
773 | // Log the new system ID |
774 | // Log the new system ID |
- | 775 | $m = array(); |
|
774 | if (preg_match('@BEGIN PUBLIC KEY\-+(.+)\-+END PUBLIC KEY@ismU', $pubKey, $m)) { |
776 | if (preg_match('@BEGIN PUBLIC KEY\-+(.+)\-+END PUBLIC KEY@ismU', $pubKey, $m)) { |
775 | $system_id = smallhash(base64_decode($m[1])); |
777 | $system_id = smallhash(base64_decode($m[1])); |
776 | OIDplus::logger()->log("[INFO]A!", "Your SystemID is now $system_id"); |
778 | OIDplus::logger()->log("[INFO]A!", "Your SystemID is now $system_id"); |
777 | } |
779 | } |
778 | } |
780 | } |
Line 826... | Line 828... | ||
826 | } |
828 | } |
827 | 829 | ||
828 | // Try to find out the SVN version using the shell |
830 | // Try to find out the SVN version using the shell |
829 | // We don't prioritize this method, because a failed shell access will flood the apache error log with STDERR messages |
831 | // We don't prioritize this method, because a failed shell access will flood the apache error log with STDERR messages |
830 | $output = @shell_exec('svnversion '.escapeshellarg(OIDplus::basePath())); |
832 | $output = @shell_exec('svnversion '.escapeshellarg(OIDplus::basePath())); |
- | 833 | $match = array(); |
|
831 | if (preg_match('/\d+/', $output, $match)) { |
834 | if (preg_match('/\d+/', $output, $match)) { |
832 | return 'svn-'.$match[0]; // do not translate |
835 | return 'svn-'.$match[0]; // do not translate |
833 | } |
836 | } |
834 | 837 | ||
835 | $output = @shell_exec('svn info '.escapeshellarg(OIDplus::basePath())); |
838 | $output = @shell_exec('svn info '.escapeshellarg(OIDplus::basePath())); |
Line 838... | Line 841... | ||
838 | } |
841 | } |
839 | } |
842 | } |
840 | 843 | ||
841 | if (file_exists(OIDplus::basePath().'/oidplus_version.txt')) { |
844 | if (file_exists(OIDplus::basePath().'/oidplus_version.txt')) { |
842 | $cont = file_get_contents(OIDplus::basePath().'/oidplus_version.txt'); |
845 | $cont = file_get_contents(OIDplus::basePath().'/oidplus_version.txt'); |
- | 846 | $m = array(); |
|
843 | if (preg_match('@Revision (\d+)@', $cont, $m)) // do not translate |
847 | if (preg_match('@Revision (\d+)@', $cont, $m)) // do not translate |
844 | return 'svn-'.$m[1]; // do not translate |
848 | return 'svn-'.$m[1]; // do not translate |
845 | } |
849 | } |
846 | 850 | ||
847 | return false; |
851 | return false; |
Line 907... | Line 911... | ||
907 | self::$sslAvailableCache = false; |
911 | self::$sslAvailableCache = false; |
908 | return false; |
912 | return false; |
909 | } |
913 | } |
910 | } else { |
914 | } else { |
911 | // This is our first check (or the browser didn't accept the SSL_CHECK cookie) |
915 | // This is our first check (or the browser didn't accept the SSL_CHECK cookie) |
- | 916 | $errno = -1; |
|
- | 917 | $errstr = ''; |
|
912 | if (@fsockopen($_SERVER['HTTP_HOST'], $ssl_port, $errno, $errstr, $timeout)) { |
918 | if (@fsockopen($_SERVER['HTTP_HOST'], $ssl_port, $errno, $errstr, $timeout)) { |
913 | // HTTPS detected. Redirect now, and remember that we had detected HTTPS |
919 | // HTTPS detected. Redirect now, and remember that we had detected HTTPS |
914 | setcookie('SSL_CHECK', '1', 0, $cookie_path, '', false, true); |
920 | setcookie('SSL_CHECK', '1', 0, $cookie_path, '', false, true); |
915 | $location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
921 | $location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
916 | header('Location:'.$location); |
922 | header('Location:'.$location); |