MDL-7722 fixed wrong cleaning in backup paths

This commit is contained in:
skodak 2007-02-15 09:43:14 +00:00
parent 16fc208896
commit 348d6827b3
2 changed files with 6 additions and 7 deletions

View file

@ -7,10 +7,11 @@
//Sets a name/value pair in backup_config table //Sets a name/value pair in backup_config table
function backup_set_config($name, $value) { function backup_set_config($name, $value) {
if (get_field("backup_config", "name", "name", $name)) { if (get_field("backup_config", "name", "name", $name)) {
return set_field("backup_config", "value", $value, "name", $name); return set_field("backup_config", "value", addslashes($value), "name", $name);
} else { } else {
$config = new object();
$config->name = $name; $config->name = $name;
$config->value = $value; $config->value = addslashes($value);
return insert_record("backup_config", $config); return insert_record("backup_config", $config);
} }
} }

View file

@ -2153,7 +2153,7 @@ class admin_setting_special_backupsaveto extends admin_setting_configtext {
$name = 'backup_sche_destination'; $name = 'backup_sche_destination';
$visiblename = get_string('saveto'); $visiblename = get_string('saveto');
$description = get_string('backupsavetohelp'); $description = get_string('backupsavetohelp');
parent::admin_setting_configtext($name, $visiblename, $description, '', PARAM_PATH); parent::admin_setting_configtext($name, $visiblename, $description, '');
} }
function get_setting() { function get_setting() {
@ -2162,10 +2162,8 @@ class admin_setting_special_backupsaveto extends admin_setting_configtext {
} }
function write_setting($data) { function write_setting($data) {
$data = clean_param($data, PARAM_PATH); $data = trim($data);
if (!empty($data) and (substr($data,-1) == '/' or substr($data,-1) == '\\')) { if (!empty($data) and !is_dir($data)) {
return get_string('pathslasherror') . '<br />';
} else if (!empty($data) and !is_dir($data)) {
return get_string('pathnotexists') . '<br />'; return get_string('pathnotexists') . '<br />';
} }
return (backup_set_config($this->name, $data) ? '' : get_string('errorsetting', 'admin') . $this->visiblename . '<br />'); return (backup_set_config($this->name, $data) ? '' : get_string('errorsetting', 'admin') . $this->visiblename . '<br />');