From bac83b143a2fa5be94a063409b2da75475f30762 Mon Sep 17 00:00:00 2001 From: Mikhail Golenkov Date: Wed, 4 Mar 2020 13:03:44 +1100 Subject: [PATCH] Fix url parsing when Moodle is installed without subdir. --- bootstrap.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bootstrap.php b/bootstrap.php index 84f5b6b..50dbf40 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -69,7 +69,11 @@ if (is_callable('auth_outage_bootstrap_callback')) { // 3) Check for allowed scripts or IPs during outages. if (!empty($_SERVER['REQUEST_URI'])) { $rooturl = parse_url($CFG->wwwroot); - $url = $rooturl['path'].'/auth/outage/info.php'; + $path = ''; + if (array_key_exists('path', $rooturl) && !empty($rooturl['path'])) { + $path = $root['url']; + } + $url = $path.'/auth/outage/info.php'; $outageinfo = strpos($_SERVER['REQUEST_URI'], $url) === 0 ? true : false; } $allowed = !file_exists($CFG->dataroot.'/climaintenance.php') // Not in maintenance mode.