diff options
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/gallery.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/item.php | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 34671f1f..1686571c 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -23,7 +23,7 @@ class gallery_Core { * down for maintenance" page. */ static function maintenance_mode() { - $maintenance_mode = Kohana::config("gallery.maintenance_mode", false, false); + $maintenance_mode = Kohana::config("core.maintenance_mode", false, false); if (Router::$controller != "login" && !empty($maintenance_mode) && !user::active()->admin) { Router::$controller = "maintenance"; 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 |