summaryrefslogtreecommitdiff
path: root/modules/gallery/models
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-04-06 06:08:17 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-04-06 06:08:17 -0700
commit50b0b73345b7b8aae070f5289dff8e0c2d278fde (patch)
tree758cb2f16b6584c4e07e273a25a5f6da10981a85 /modules/gallery/models
parent0dfc62051e7e3dac79489a6a2964c3e6b333b517 (diff)
parent2657d085863782f57279d507c1c2c0a15ccccc24 (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/models')
-rw-r--r--modules/gallery/models/item.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 6ede5109..1026264f 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.