From 4bea5e85828b2ef400dc31533945439fce40d4aa Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 15 Jul 2009 06:17:39 +0000 Subject: [PATCH] moodlellib: MDL-19828 PARAM_LOCALURL should accept URLs like course/view.php?id=2 --- lib/moodlelib.php | 2 +- lib/simpletest/testmoodlelib.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 7082105932..2578f61963 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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 = ''; diff --git a/lib/simpletest/testmoodlelib.php b/lib/simpletest/testmoodlelib.php index a571ef2a64..ab55d43d22 100644 --- a/lib/simpletest/testmoodlelib.php +++ b/lib/simpletest/testmoodlelib.php @@ -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() { -- 2.39.5