diff options
Diffstat (limited to 'modules/gallery/models')
| -rw-r--r-- | modules/gallery/models/item.php | 15 | 
1 files changed, 14 insertions, 1 deletions
| diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 98a2c4df..903dadad 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -797,11 +797,19 @@ class Item_Model_Core extends ORM_MPTT {      if (strpos($this->name, "/") !== false) {        $v->add_error("name", "no_slashes");        return; -    } else if (rtrim($this->name, ".") !== $this->name) { +    } + +    if (rtrim($this->name, ".") !== $this->name) {        $v->add_error("name", "no_trailing_period");        return;      } +    // Do not accept files with double extensions, they can cause problems on some +    // versions of Apache. +    if (substr_count($this->name, ".") > 1) { +      $v->add_error("name", "illegal_data_file_extension"); +    } +      if ($this->is_movie() || $this->is_photo()) {        $ext = pathinfo($this->name, PATHINFO_EXTENSION); @@ -833,6 +841,11 @@ class Item_Model_Core extends ORM_MPTT {        $v->add_error("name", "conflict");        return;      } + +    if ($this->parent_id == 1 && Kohana::auto_load("{$this->slug}_Controller")) { +      $v->add_error("slug", "reserved"); +      return; +    }    }    /** | 
