From 265b1434b0cfb155cc82f5bae14632db1af05dab Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 18 Mar 2012 17:28:59 +0100 Subject: [PATCH] MDL-31703 allow serving of JavaScript from unsupported '/' dirroot --- lib/javascript.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/javascript.php b/lib/javascript.php index 8bf03676107..baae4c025bc 100644 --- a/lib/javascript.php +++ b/lib/javascript.php @@ -46,7 +46,11 @@ foreach ($files as $fsfile) { // 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; }