From 58aaa8e97e2ace2c8c804a069b109a8e2319ef30 Mon Sep 17 00:00:00 2001 From: ashleyholman Date: Fri, 18 Sep 2009 03:52:50 +0000 Subject: [PATCH] MDL-15897: Changed admin_setting_configtext.validate() check to not treat all strings as custom regex's (since PARAM_* constants are now strings). Instead require them to have '/' at the beginning and end of the pattern. The only setting that appears to use a custom regex is scorm/apidebugmask - now updated to contain surrounding slashes. --- lib/adminlib.php | 3 ++- mod/scorm/settings.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/adminlib.php b/lib/adminlib.php index 3c9fd6befa..b8014159a0 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1508,7 +1508,8 @@ class admin_setting_configtext extends admin_setting { * @return mixed true if ok string if error found */ public function validate($data) { - if (is_string($this->paramtype)) { + // allow paramtype to be a custom regex if it is the form of /pattern/ + if (preg_match('#^/.*/$#', $this->paramtype)) { if (preg_match($this->paramtype, $data)) { return true; } else { diff --git a/mod/scorm/settings.php b/mod/scorm/settings.php index 5212f3a2e1..b7078c9068 100644 --- a/mod/scorm/settings.php +++ b/mod/scorm/settings.php @@ -56,6 +56,6 @@ $settings->add(new admin_setting_configcheckbox('scorm/allowtypeimsrepository', $settings->add(new admin_setting_configcheckbox('scorm/allowapidebug', get_string('allowapidebug', 'scorm'), '', 0)); -$settings->add(new admin_setting_configtext('scorm/apidebugmask', get_string('apidebugmask', 'scorm'), '', '.*')); +$settings->add(new admin_setting_configtext('scorm/apidebugmask', get_string('apidebugmask', 'scorm'), '', '/.*/')); -?> \ No newline at end of file +?> -- 2.39.5