Merge branch 'MDL-46705-master' of git://github.com/dkns/moodle

This commit is contained in:
David Monllao 2015-09-16 09:44:37 +08:00
commit b3ec8cf95e

View File

@ -4001,10 +4001,14 @@ class admin_setting_sitesettext extends admin_setting_configtext {
* @return mixed true or message string
*/
public function validate($data) {
global $DB;
$cleaned = clean_param($data, PARAM_TEXT);
if ($cleaned === '') {
return get_string('required');
}
if ($this->name ==='shortname' && $DB->record_exists('course', array('shortname' => $data))) {
return get_string('shortnametaken', 'error', $data);
}
if ("$data" == "$cleaned") { // implicit conversion to string is needed to do exact comparison
return true;
} else {