From: skodak Date: Wed, 5 Jul 2006 07:44:20 +0000 (+0000) Subject: healthcenter fixes - new extra whitespace detection, fixed automatic slasharguments... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9bbb40d631530ae6a8a1633e234b7d42deb63779;p=moodle.git healthcenter fixes - new extra whitespace detection, fixed automatic slasharguments detection; merged from MOODLE_16_STABLE --- diff --git a/admin/health.php b/admin/health.php index e0ef7cab05..b2211d3963 100644 --- a/admin/health.php +++ b/admin/health.php @@ -1,7 +1,17 @@ ') { - return false; - } - fclose($fp); + global $extraws; + + if($extraws === '') { + return false; } return true; } @@ -236,11 +241,11 @@ class problem_000002 extends problem_base { return SEVERITY_SIGNIFICANT; } function description() { - return 'Your Moodle configuration file, config.php, contains some characters after the closing PHP tag (?>). This could cause Moodle to exhibit several kinds of problems and should be fixed.'; + return 'Your Moodle configuration file config.php or another library file, contains some characters after the closing PHP tag (?>). This causes Moodle to exhibit several kinds of problems (such as broken downloaded files) and must be fixed.'; } function solution() { global $CFG; - return 'You need to edit '.$CFG->dirroot.'/config.php and remove all characters (including spaces and returns) after the ending ?> tag. These two characters should be the very last in that file.'; + return 'You need to edit '.$CFG->dirroot.'/config.php and remove all characters (including spaces and returns) after the ending ?> tag. These two characters should be the very last in that file. The extra trailing whitespace may be also present in other PHP files that are included from lib/setup.php.'; } } @@ -463,13 +468,13 @@ class problem_000010 extends problem_base { function status() { global $CFG; $handle = @fopen($CFG->wwwroot.'/file.php?file=/testslasharguments', "r"); - $contents = trim(@fread($handle, 7)); + $contents = @trim(fread($handle, 10)); @fclose($handle); if ($contents != 'test -1') { return -1; } $handle = @fopen($CFG->wwwroot.'/file.php/testslasharguments', "r"); - $contents = trim(@fread($handle, 6)); + $contents = trim(@fread($handle, 10)); @fclose($handle); switch ($contents) { case 'test 1': return 1; diff --git a/lib/setup.php b/lib/setup.php index 120bf33e7a..2558bd1c8a 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -534,7 +534,7 @@ $CFG->os = PHP_OS; } if ($CFG->theme == 'standard' or $CFG->theme == 'standardwhite') { // Temporary measure to help with XHTML validation - if (empty($_SESSION['USER']->id)) { // Allow W3CValidator in as user called w3cvalidator (or guest) + if (isset($_SERVER['HTTP_USER_AGENT']) and empty($_SESSION['USER']->id)) { // Allow W3CValidator in as user called w3cvalidator (or guest) if ((strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) or (strpos($_SERVER['HTTP_USER_AGENT'], 'Cynthia') !== false )) { if ($USER = get_complete_user_data("username", "w3cvalidator")) { diff --git a/lib/weblib.php b/lib/weblib.php index da51dd0a4e..56a3d5b7b5 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1085,7 +1085,7 @@ function get_file_argument($scriptname) { // first try normal parameter (compatible method == no relative links!) $relativepath = optional_param('file', FALSE, PARAM_PATH); if ($relativepath === '/testslasharguments') { - echo 'test -1: Incorrect use - try "file.php/testslasharguments" instead'; //indicate fopen/fread works for health center + echo 'test -1 : Incorrect use - try "file.php/testslasharguments" instead'; //indicate fopen/fread works for health center die; } @@ -1096,7 +1096,7 @@ function get_file_argument($scriptname) { if (!strpos($path_info, $scriptname)) { $relativepath = clean_param(rawurldecode($path_info), PARAM_PATH); if ($relativepath === '/testslasharguments') { - echo 'test 1: Slasharguments test passed. Server confguration is compatible with file.php/1/pic.jpg slashargument setting.'; //indicate ok for health center + echo 'test 1 : Slasharguments test passed. Server confguration is compatible with file.php/1/pic.jpg slashargument setting.'; //indicate ok for health center die; } } @@ -1110,7 +1110,7 @@ function get_file_argument($scriptname) { $path_info = strip_querystring($arr[1]); $relativepath = clean_param(rawurldecode($path_info), PARAM_PATH); if ($relativepath === '/testslasharguments') { - echo 'test 2:Slasharguments test passed (compatibility hack). Server confguration may be compatible with file.php/1/pic.jpg slashargument setting'; //indicate ok for health center + echo 'test 2 : Slasharguments test passed (compatibility hack). Server confguration may be compatible with file.php/1/pic.jpg slashargument setting'; //indicate ok for health center die; } }