diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-15 13:41:46 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-15 13:41:46 -0800 |
commit | 654b103355f1bda15246e651fa91f3c9e08c3901 (patch) | |
tree | a7e420db4e55c4244b891e87ba4dfc7cce217cf9 /modules/gallery/models | |
parent | 916da15cbb7f24a68be27ef4170be864d51027c4 (diff) |
Validate the model type.
Diffstat (limited to 'modules/gallery/models')
-rw-r--r-- | modules/gallery/models/item.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index e929f30d..395ba52c 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -26,7 +26,8 @@ class Item_Model extends ORM_MPTT { "title" => array("rules" => array("length[0,255]", "required")), "slug" => array("rules" => array("length[0,255]", "required")), "description" => array("rules" => array("length[0,65535]")), - "parent_id" => array("rules" => array("Item_Model::valid_parent")) + "parent_id" => array("rules" => array("Item_Model::valid_parent")), + "type" => array("rules" => array("Item_Model::valid_type")), ); /** @@ -737,6 +738,13 @@ class Item_Model extends ORM_MPTT { } /** + * Make sure that the type is valid. + */ + static function valid_type($value) { + return in_array($value, array("album", "photo", "movie")); + } + + /** * Make sure that the parent id refers to an album. */ static function valid_parent($value) { |