Make checksum code skippable
This commit is contained in:
		| @@ -9,10 +9,15 @@ if (IN_serendipity !== true) { | |||||||
|     die ("Don't hack!\n"); |     die ("Don't hack!\n"); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | echo "Creating checksums.\n"; | ||||||
|  |  | ||||||
| $basedir = realpath(dirname(__FILE__) . '/../') . '/'; | $basedir = realpath(dirname(__FILE__) . '/../') . '/'; | ||||||
| require_once $basedir . 'include/functions_installer.inc.php'; | require_once $basedir . 'include/functions_installer.inc.php'; | ||||||
| require_once $basedir . 'include/functions_images.inc.php'; | require_once $basedir . 'include/functions_images.inc.php'; | ||||||
|  |  | ||||||
|  | $conf = file_get_contents($basedir . 'serendipity_config.inc.php'); | ||||||
|  | preg_match('@\$serendipity\[\'version\'\]\s*=\s*\'(.+)\'@imsU', $conf, $vmatch); | ||||||
|  |  | ||||||
| // Find all the files in the serendipity directory and calculate their md5 sums | // Find all the files in the serendipity directory and calculate their md5 sums | ||||||
| $sums = array(); | $sums = array(); | ||||||
| $excludes = array( | $excludes = array( | ||||||
| @@ -21,6 +26,7 @@ $excludes = array( | |||||||
|     ); |     ); | ||||||
| $files = serendipity_traversePath($basedir, '', false); | $files = serendipity_traversePath($basedir, '', false); | ||||||
| foreach ($files as $fdata) { | foreach ($files as $fdata) { | ||||||
|  |     echo $fdata['relpath'] . "\n"; | ||||||
|     // Don't take checksums of directories |     // Don't take checksums of directories | ||||||
|     if ($fdata['directory']) { |     if ($fdata['directory']) { | ||||||
|         continue; |         continue; | ||||||
| @@ -48,7 +54,7 @@ if (!empty($sums)) { | |||||||
|     if (!$file) { |     if (!$file) { | ||||||
|         die('Unable to open output file!'); |         die('Unable to open output file!'); | ||||||
|     } |     } | ||||||
|     fwrite($file, '<?php' . "\n" . 'global $serendipity;' . "\n" . '$serendipity[\'checksums\'] = array (' . "\n"); |     fwrite($file, '<?php' . "\n" . 'global $serendipity;' . "\n" . '$serendipity[\'checksums_' . $vmatch[1] . '\'] = array (' . "\n"); | ||||||
|         foreach ($sums as $fname => $sum) { |         foreach ($sums as $fname => $sum) { | ||||||
|             fwrite($file, "'$fname' => '$sum',\n"); |             fwrite($file, "'$fname' => '$sum',\n"); | ||||||
|         } |         } | ||||||
|   | |||||||
							
								
								
									
										0
									
								
								checksums.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								checksums.inc.php
									
									
									
									
									
										Normal file
									
								
							| @@ -276,7 +276,7 @@ if (($showAbort && $serendipity['GET']['action'] == 'ignore') || $serendipity['G | |||||||
|                 echo serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, CHECKSUMS_PASS); |                 echo serendipity_upgraderResultDiagnose(S9Y_U_SUCCESS, CHECKSUMS_PASS); | ||||||
|             } else { |             } else { | ||||||
|                 foreach ($badsums as $rfile => $sum) { |                 foreach ($badsums as $rfile => $sum) { | ||||||
|                     echo serendipity_upgraderResultDiagnose(S9Y_U_ERROR, sprintf(CHECKSUM_FAILED, $rfile)); |                     echo serendipity_upgraderResultDiagnose(S9Y_U_WARNING, sprintf(CHECKSUM_FAILED, $rfile)) . "<br />\n"; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|      ?></td> |      ?></td> | ||||||
|   | |||||||
| @@ -887,6 +887,9 @@ function serendipity_getSessionLanguage() { | |||||||
|         return $serendipity['lang']; |         return $serendipity['lang']; | ||||||
|     } |     } | ||||||
| */ | */ | ||||||
|  |     if (isset($serendipity['lang']) && !isset($serendipity['languages'][$serendipity['lang']])) { | ||||||
|  |         $serendipity['lang'] = $serendipity['autolang']; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (isset($_REQUEST['user_language']) && (!empty($serendipity['languages'][$_REQUEST['user_language']])) && !headers_sent()) { |     if (isset($_REQUEST['user_language']) && (!empty($serendipity['languages'][$_REQUEST['user_language']])) && !headers_sent()) { | ||||||
|         serendipity_setCookie('serendipityLanguage', $_REQUEST['user_language'], false); |         serendipity_setCookie('serendipityLanguage', $_REQUEST['user_language'], false); | ||||||
|   | |||||||
| @@ -1273,12 +1273,26 @@ function serendipity_FTPChecksum($filename, $type = null) { | |||||||
|  *    relative path of the file, and values are the bad checksum |  *    relative path of the file, and values are the bad checksum | ||||||
|  */ |  */ | ||||||
| function serendipity_verifyFTPChecksums() { | function serendipity_verifyFTPChecksums() { | ||||||
|     // Load the checksums |     global $serendipity; | ||||||
|     require_once S9Y_INCLUDE_PATH . 'checksums.inc.php'; |  | ||||||
|     // Verify that every file in the checksum list was uploaded correctly |  | ||||||
|     $badsums = array(); |     $badsums = array(); | ||||||
|  |  | ||||||
|  |     // Load the checksums | ||||||
|  |     $f = S9Y_INCLUDE_PATH . 'checksums.inc.php'; | ||||||
|  |      | ||||||
|  |     if (!file_exists($f) || filesize($f) < 1) { | ||||||
|  |         return $badsums; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     require_once $f; | ||||||
|  |     // Verify that every file in the checksum list was uploaded correctly | ||||||
|     $basedir = realpath(dirname(__FILE__) . '/../'); |     $basedir = realpath(dirname(__FILE__) . '/../'); | ||||||
|     foreach ($serendipity['checksums'] as $prel => $sum) { |  | ||||||
|  |     if (!is_array($serendipity['checksums_' . $serendipity['version']])) { | ||||||
|  |         return $badsums; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     foreach ($serendipity['checksums_' . $serendipity['version']] as $prel => $sum) { | ||||||
|         $path = $basedir . '/' . $prel; |         $path = $basedir . '/' . $prel; | ||||||
|         // Don't take checksums of directories |         // Don't take checksums of directories | ||||||
|         if (is_dir($path)) { |         if (is_dir($path)) { | ||||||
|   | |||||||
| @@ -6,6 +6,10 @@ if (IN_serendipity !== true) { | |||||||
|     die ("Don't hack!"); |     die ("Don't hack!"); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | if (isset($serendipity['lang']) && !isset($serendipity['languages'][$serendipity['lang']])) { | ||||||
|  |     $serendipity['lang'] = $serendipity['autolang']; | ||||||
|  | } | ||||||
|  |  | ||||||
| if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) { | if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) { | ||||||
|     $charset = serendipity_getCharset(); |     $charset = serendipity_getCharset(); | ||||||
|  |  | ||||||
| @@ -21,6 +25,7 @@ if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Try and include preferred language from the configurated setting |     // Try and include preferred language from the configurated setting | ||||||
|  |  | ||||||
|     if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) { |     if (@include(S9Y_INCLUDE_PATH . 'lang/' . $charset . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) { | ||||||
|         // Only here can we truely say the language is loaded |         // Only here can we truely say the language is loaded | ||||||
|         define('serendipity_LANG_LOADED', true); |         define('serendipity_LANG_LOADED', true); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user