MDL-11978 - Backport admin notification from MDL-11061 about bogus $CFG->wwwroot from 1.9 to 1.8 and 1.7.

This commit is contained in:
tjhunt
2008-04-23 10:38:10 +00:00
parent 5fe44967f8
commit 14bb4c1ad9
3 changed files with 13 additions and 1 deletions
+8 -1
View File
@@ -555,7 +555,14 @@
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
}
/// If no recently cron run
if (substr($CFG->wwwroot, -1) == '/') {
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
}
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
}
/// If no recently cron run
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
if (time() - $lastcron > 3600 * 24) {
$strinstallation = get_string('installation', 'install');
+2
View File
@@ -37,6 +37,8 @@ $string['cachetext'] = 'Text cache lifetime';
$string['cachetype'] = 'Cache Type';
$string['calendar_weekend'] = 'Weekend Days';
$string['calendarsettings'] = 'Calendar';
$string['cfgwwwrootwarning'] = 'You have defined &#36;CFG->wwwroot incorrectly in your config.php file. It does not match the URL you are using to access this page. Please correct it, or you will experience strange bugs like <a href=\'http://tracker.moodle.org/browse/MDL-11061\'>MDL-11061</a>.';
$string['cfgwwwrootslashwarning'] = 'You have defined &#36;CFG->wwwroot incorrectly in your config.php file. You have included a \'/\' character at the end. Please remove it, or you will experience strange bugs like <a href=\'http://tracker.moodle.org/browse/MDL-11061\'>MDL-11061</a>.';
$string['change'] = 'change';
$string['changesitelang'] = 'Change site language';
$string['choosefiletoedit'] = 'Choose file to edit from the box above';
+3
View File
@@ -270,6 +270,9 @@ function qualified_me() {
}
}
// TODO, this does not work in the situation described in MDL-11061, but
// I don't know how to fix it. Possibly believe $CFG->wwwroot ahead of what
// the server reports.
if (isset($_SERVER['HTTPS'])) {
$protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
} else if (isset($_SERVER['SERVER_PORT'])) { # Apache2 does not export $_SERVER['HTTPS']