MDL-49401 moodlelib: PARAM_LOCALURL supports loginhttps
This commit is contained in:
committed by
Mr. Jenkins (CiBoT)
parent
b3f5865eab
commit
d031c2dcb9
+7
-1
@@ -1032,10 +1032,16 @@ function clean_param($param, $type) {
|
||||
// Allow http absolute, root relative and relative URLs within wwwroot.
|
||||
$param = clean_param($param, PARAM_URL);
|
||||
if (!empty($param)) {
|
||||
|
||||
// Simulate the HTTPS version of the site.
|
||||
$httpswwwroot = str_replace('http://', 'https://', $CFG->wwwroot);
|
||||
|
||||
if (preg_match(':^/:', $param)) {
|
||||
// Root-relative, ok!
|
||||
} else if (preg_match('/^'.preg_quote($CFG->wwwroot, '/').'/i', $param)) {
|
||||
} else if (preg_match('/^' . preg_quote($CFG->wwwroot, '/') . '/i', $param)) {
|
||||
// Absolute, and matches our wwwroot.
|
||||
} else if (!empty($CFG->loginhttps) && preg_match('/^' . preg_quote($httpswwwroot, '/') . '/i', $param)) {
|
||||
// Absolute, and matches our httpswwwroot.
|
||||
} else {
|
||||
// Relative - let's make sure there are no tricks.
|
||||
if (validateUrlSyntax('/' . $param, 's-u-P-a-p-f+q?r?')) {
|
||||
|
||||
Reference in New Issue
Block a user