diff options
| author | andyst <andy.st@gmail.com> | 2009-06-01 23:45:37 -0700 |
|---|---|---|
| committer | andyst <andy.st@gmail.com> | 2009-06-01 23:45:37 -0700 |
| commit | 02a840c84cada5a1c0cc0768f350424460310e5d (patch) | |
| tree | 6a35d4afddcf291327a4ff42245bca17328084ae /modules/gallery/helpers/item.php | |
| parent | d0845aadc629cf10b8eee490a651c039750a1430 (diff) | |
| parent | 3b6567f38c206f1302c7b22d94d5eae4b458311a (diff) | |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/item.php')
| -rw-r--r-- | modules/gallery/helpers/item.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 7daaf1e1..09870b45 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -19,6 +19,8 @@ */ class item_Core { static function move($source, $target) { + access::required("view", $source); + access::required("view", $target); access::required("edit", $source); access::required("edit", $target); @@ -47,6 +49,8 @@ class item_Core { static function make_album_cover($item) { $parent = $item->parent(); + access::required("view", $item); + access::required("view", $parent); access::required("edit", $parent); model_cache::clear("item", $parent->album_cover_item_id); @@ -61,6 +65,7 @@ class item_Core { } static function remove_album_cover($album) { + access::required("view", $album); access::required("edit", $album); @unlink($album->thumb_path()); @@ -102,4 +107,16 @@ class item_Core { $input->add_error("conflict", 1); } } + + /** + * Sanitize a filename into something presentable as an item title + * @param string $filename + * @return string title + */ + static function convert_filename_to_title($filename) { + $title = strtr($filename, "_", " "); + $title = preg_replace("/\..*?$/", "", $title); + $title = preg_replace("/ +/", " ", $title); + return $title; + } }
\ No newline at end of file |
