"MDL-19733, directory name need to be cleaned before saving into database"

This commit is contained in:
dongsheng
2009-07-08 07:45:51 +00:00
parent 4d49202ffc
commit b2f8adf4e5
+8 -1
View File
@@ -14,7 +14,9 @@ class repository_filesystem extends repository {
global $CFG;
parent::__construct($repositoryid, $context, $options);
$this->root_path = $CFG->dataroot.'/repository/';
$this->root_path .= ($this->options['fs_path'] . '/');
if (!empty($options['fs_path'])) {
$this->root_path .= ($this->options['fs_path'] . '/');
}
if (!empty($options['ajax'])) {
if (!is_dir($this->root_path)) {
$created = mkdir($this->root_path, 0700);
@@ -118,6 +120,11 @@ class repository_filesystem extends repository {
}
public function type_config_form(&$mform) {
}
public function set_option($options = array()) {
$options['fs_path'] = clean_param($options['fs_path'], PARAM_PATH);
$ret = parent::set_option($options);
return $ret;
}
public function instance_config_form(&$mform) {
global $CFG;
$path = $CFG->dataroot . '/repository/';