diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-04-07 07:29:46 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-04-07 07:29:46 -0700 |
commit | 6652b691936f5fcf2f12aab947eca6c3cfae0ccc (patch) | |
tree | 4fa69bc40394276a14ae1d59f991badf8f3b15b7 /modules/gallery/models | |
parent | 5679e30ef6c68272cce295bd593bc23c9ec1e1b3 (diff) | |
parent | 2657d085863782f57279d507c1c2c0a15ccccc24 (diff) |
Merge branch 'master' into bharat_dev
Diffstat (limited to 'modules/gallery/models')
-rw-r--r-- | modules/gallery/models/item.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 4a87a2ab..7fc37325 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -332,6 +332,12 @@ class Item_Model extends ORM_MPTT { $tmp = pathinfo($this->name, PATHINFO_FILENAME); $tmp = preg_replace("/[^A-Za-z0-9-_]+/", "-", $tmp); $this->slug = trim($tmp, "-"); + + // If the filename is all invalid characters, then the slug may be empty here. Pick a + // random value. + if (empty($this->slug)) { + $this->slug = (string)rand(1000, 9999); + } } // Get the width, height and mime type from our data file for photos and movies. |