moodlellib: MDL-19828 PARAM_LOCALURL should accept URLs like course/view.php?id=2

This commit is contained in:
tjhunt 2009-07-15 06:17:39 +00:00
parent a475c67308
commit 4bea5e8582
2 changed files with 2 additions and 1 deletions

View File

@ -529,7 +529,7 @@ function clean_param($param, $type) {
// absolute, and matches our wwwroot
} else {
// relative - let's make sure there are no tricks
if (validateUrlSyntax($param, 's-u-P-a-p-f+q?r?')) {
if (validateUrlSyntax('/' . $param, 's-u-P-a-p-f+q?r?')) {
// looks ok.
} else {
$param = '';

View File

@ -296,6 +296,7 @@ class moodlelib_test extends UnitTestCase {
$this->assertEqual(clean_param($CFG->wwwroot, PARAM_LOCALURL), $CFG->wwwroot);
$this->assertEqual(clean_param('/just/a/path', PARAM_LOCALURL), '/just/a/path');
$this->assertEqual(clean_param('funny:thing', PARAM_LOCALURL), '');
$this->assertEqual(clean_param('course/view.php?id=3', PARAM_LOCALURL), 'course/view.php?id=3');
}
function test_make_user_directory() {