diff --git a/lib/javascript.php b/lib/javascript.php index 02ab49a7f876b..59965316bf2a0 100644 --- a/lib/javascript.php +++ b/lib/javascript.php @@ -46,7 +46,11 @@ // does not exist continue; } - if (strpos($jsfile, $CFG->dirroot . DIRECTORY_SEPARATOR) !== 0) { + if ($CFG->dirroot === '/') { + // Some shared hosting sites serve files directly from '/', + // this is NOT supported, but at least allow JS when showing + // errors and warnings. + } else if (strpos($jsfile, $CFG->dirroot . DIRECTORY_SEPARATOR) !== 0) { // hackers - not in dirroot continue; }