MDL-81035 core: Fix redirect with sub-path
This commit is contained in:
+7
-1
@@ -958,7 +958,13 @@ function initialise_fullme() {
|
||||
throw new moodle_exception('requirecorrectaccess', 'error', '', null,
|
||||
'You called ' . $calledurl .', you should have called ' . $correcturl);
|
||||
}
|
||||
redirect($CFG->wwwroot . $rurl['fullpath'], get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 3);
|
||||
$rfullpath = $rurl['fullpath'];
|
||||
// Check that URL is under $CFG->wwwroot.
|
||||
if (strpos($rfullpath, $wwwroot['path']) === 0) {
|
||||
$rfullpath = substr($rurl['fullpath'], strlen($wwwroot['path']) - 1);
|
||||
$rfullpath = (new moodle_url($rfullpath))->out(false);
|
||||
}
|
||||
redirect($rfullpath, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user