Merge branch 'MDL-81035-main' of https://github.com/HuongNV13/moodle

This commit is contained in:
Ilya Tregubov 2024-03-12 10:40:26 +08:00
commit 5c0ad525b0

View File

@ -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);
}
}