]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-19733, directory name need to be cleaned before saving into database"
authordongsheng <dongsheng>
Wed, 8 Jul 2009 07:45:51 +0000 (07:45 +0000)
committerdongsheng <dongsheng>
Wed, 8 Jul 2009 07:45:51 +0000 (07:45 +0000)
repository/filesystem/repository.class.php

index c0dc2396259fc2f549606d90ee872743e266606a..2d54ff86095dbdc20a4d6960b240e6ffa31500bf 100644 (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/';