diff options
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r-- | modules/gallery/controllers/file_proxy.php | 4 | ||||
-rw-r--r-- | modules/gallery/controllers/flash_uploader.php | 4 | ||||
-rw-r--r-- | modules/gallery/controllers/quick.php | 30 |
3 files changed, 25 insertions, 13 deletions
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 32690fc0..bead9f3f 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -72,10 +72,10 @@ class File_Proxy_Controller extends Controller { // necessary, it's easily resurrected. // If we're looking for a .jpg then it's it's possible that we're requesting the thumbnail - // for a movie. In that case, the .flv or .mp4 file would have been converted to a .jpg. + // for a movie. In that case, the .flv, .mp4 or .m4v file would have been converted to a .jpg. // So try some alternate types: if (preg_match('/.jpg$/', $path)) { - foreach (array("flv", "mp4") as $ext) { + foreach (array("flv", "mp4", "m4v") as $ext) { $movie_path = preg_replace('/.jpg$/', ".$ext", $encoded_path); $item = ORM::factory("item")->where("relative_path_cache", "=", $movie_path)->find(); if ($item->loaded()) { diff --git a/modules/gallery/controllers/flash_uploader.php b/modules/gallery/controllers/flash_uploader.php index be3896cd..6bfdd851 100644 --- a/modules/gallery/controllers/flash_uploader.php +++ b/modules/gallery/controllers/flash_uploader.php @@ -51,7 +51,7 @@ class Flash_Uploader_Controller extends Controller { // Uploadify adds its own field to the form, so validate that separately. $file_validation = new Validation($_FILES); $file_validation->add_rules( - "Filedata", "upload::valid", "upload::required", "upload::type[gif,jpg,jpeg,png,flv,mp4]"); + "Filedata", "upload::valid", "upload::required", "upload::type[gif,jpg,jpeg,png,flv,mp4,m4v]"); if ($form->validate() && $file_validation->validate()) { $temp_filename = upload::save("Filedata"); @@ -64,7 +64,7 @@ class Flash_Uploader_Controller extends Controller { $path_info = @pathinfo($temp_filename); if (array_key_exists("extension", $path_info) && - in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) { + in_array(strtolower($path_info["extension"]), array("flv", "mp4", "m4v"))) { $item->type = "movie"; $item->save(); log::success("content", t("Added a movie"), diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index 7df5bf18..253a279b 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -46,13 +46,14 @@ class Quick_Controller extends Controller { graphics::generate($item); - $parent = $item->parent(); - // @todo: this is an inadequate way to regenerate the parent's thumbnail after rotation. - if ($parent->album_cover_item_id == $item->id) { - copy($item->thumb_path(), $parent->thumb_path()); - $parent->thumb_width = $item->thumb_width; - $parent->thumb_height = $item->thumb_height; - $parent->save(); + // @todo: this is an inadequate way to regenerate album cover thumbnails after rotation. + foreach (ORM::factory("item") + ->where("album_cover_item_id", "=", $item->id) + ->find_all() as $target) { + copy($item->thumb_path(), $target->thumb_path()); + $target->thumb_width = $item->thumb_width; + $target->thumb_height = $item->thumb_height; + $target->save(); } } @@ -109,10 +110,21 @@ class Quick_Controller extends Controller { } $parent = $item->parent(); - $item->delete(); + + if ($item->is_album()) { + // Album delete will trigger deletes for all children. Do this in a batch so that we can be + // smart about notifications, album cover updates, etc. + batch::start(); + $item->delete(); + batch::stop(); + } else { + $item->delete(); + } message::success($msg); - if (Input::instance()->get("page_type") == "collection") { + $from_id = Input::instance()->get("from_id"); + if (Input::instance()->get("page_type") == "collection" && + $from_id != $id /* deleted the item we were viewing */) { print json_encode(array("result" => "success", "reload" => 1)); } else { print json_encode(array("result" => "success", |