]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11061 - admin notifications about $CFG->wwwroot, which sometimes lead to obscure...
authortjhunt <tjhunt>
Wed, 17 Oct 2007 20:21:16 +0000 (20:21 +0000)
committertjhunt <tjhunt>
Wed, 17 Oct 2007 20:21:16 +0000 (20:21 +0000)
admin/index.php
lang/en_utf8/admin.php
lib/weblib.php

index 6d97e525a2debdfa3be37fa30a10f56389cea09e..0db307f38eb7b0785136caf788a5a195e9e58f6e 100644 (file)
         print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
     }
 
+    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) {
index 7b95eb5cab0d0b950907b712bc66d71b0ac78ab5..cdbddf4a88636eb079e0eb1e33abca321497a3b4 100644 (file)
@@ -36,6 +36,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';
index 209916bcc478c43fff24f046bfb2aa5acfe088a7..72b20cef1931f0c06a1f5189ccdb1dea3a48fb55 100644 (file)
@@ -271,6 +271,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']