fixed error message when empty site full or short name
This commit is contained in:
@@ -78,6 +78,9 @@ if ($data = data_submitted()) {
|
||||
} else {
|
||||
error(get_string('confirmsesskeybad', 'error'));
|
||||
}
|
||||
//reload site
|
||||
$SITE = get_record('course', 'id', $SITE->id);
|
||||
$COURSE = clone($SITE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ $ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themes
|
||||
|
||||
// "frontpage" settingpage
|
||||
$temp = new admin_settingpage('frontpage', get_string('frontpage','admin'));
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_sitesettext('fullname', get_string('fullsitename'), '', ''));
|
||||
$temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename'), '', ''));
|
||||
$temp->add(new admin_setting_special_frontpagedesc());
|
||||
$temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) )
|
||||
$temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
|
||||
|
||||
+11
-2
@@ -1663,10 +1663,10 @@ class admin_setting_sitesettext extends admin_setting_configtext {
|
||||
|
||||
var $id;
|
||||
|
||||
function admin_setting_sitesettext($name, $visiblename, $description, $defaultsetting, $paramtype=PARAM_RAW) {
|
||||
function admin_setting_sitesettext($name, $visiblename, $description, $defaultsetting) {
|
||||
|
||||
$this->id = SITEID;
|
||||
parent::admin_setting_configtext($name, $visiblename, $description, $defaultsetting, $paramtype);
|
||||
parent::admin_setting_configtext($name, $visiblename, $description, $defaultsetting);
|
||||
|
||||
}
|
||||
|
||||
@@ -1675,7 +1675,16 @@ class admin_setting_sitesettext extends admin_setting_configtext {
|
||||
return (isset($site->{$this->name}) ? $site->{$this->name} : NULL);
|
||||
}
|
||||
|
||||
function validate($data) {
|
||||
$cleaned = clean_param($data, PARAM_NOTAGS);
|
||||
if ($cleaned == '') {
|
||||
return false; // can not be empty
|
||||
}
|
||||
return ("$data" == "$cleaned"); // implicit conversion to string is needed to do exact comparison
|
||||
}
|
||||
|
||||
function write_setting($data) {
|
||||
$data = trim($data);
|
||||
if (!$this->validate($data)) {
|
||||
return get_string('validateerror', 'admin') . $this->visiblename . '<br />';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user