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.
This commit is contained in:
ashleyholman
2009-09-18 03:52:50 +00:00
parent fd4faf98fe
commit 58aaa8e97e
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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 {