From 251e9d5c8f727b886676e010481a6090ddac028c Mon Sep 17 00:00:00 2001 From: shadlaws Date: Tue, 26 Feb 2013 18:39:59 +0100 Subject: #2010 - Revise item::find_by_path to search for jpg-converted items. - added extra $var_subdir argument to item::find_by_path. - changed item::find_by_path to use $var_subdir to detect if we should look for a jpg-converted item or not (e.g. movie thumbs) - moved the album thumb detection to item::find_by_path to ensure it knows to look for an exact album match. - added more sanity checks to item::find_by_path (now has fewer false positive possibilities). - updated file_proxy to remove the need to guess different movie files. - updated File_Proxy_Controller - new sanity checks catch previously undetected bug. - added additional unit tests for item::find_by_path. --- modules/gallery/controllers/file_proxy.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'modules/gallery/controllers/file_proxy.php') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 7e5d0038..ac558a71 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -66,24 +66,8 @@ class File_Proxy_Controller extends Controller { throw $e; } - // If the last element is .album.jpg, pop that off since it's not a real item - $path = preg_replace("|/.album.jpg$|", "", $path); - - $item = item::find_by_path($path); - if (!$item->loaded()) { - // We didn't turn it up. 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 movie file would - // have been converted to a .jpg. So try some alternate types: - if (preg_match('/.jpg$/', $path)) { - foreach (legal_file::get_movie_extensions() as $ext) { - $movie_path = preg_replace('/.jpg$/', ".$ext", $path); - $item = item::find_by_path($movie_path); - if ($item->loaded()) { - break; - } - } - } - } + // Get the item model using the path and type (which corresponds to a var subdir) + $item = item::find_by_path($path, $type); if (!$item->loaded()) { $e = new Kohana_404_Exception(); -- cgit v1.2.3 From 74532b9c948c471115239fa1a0b54c10ccdbeb9c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 5 Mar 2013 13:20:12 -0500 Subject: Remove stray line of debug output. --- modules/gallery/controllers/file_proxy.php | 1 - 1 file changed, 1 deletion(-) (limited to 'modules/gallery/controllers/file_proxy.php') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index ac558a71..50f1aa26 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -146,7 +146,6 @@ class File_Proxy_Controller extends Controller { // going to buffer up whatever file we're proxying (and it may be very large). This may // affect embedding or systems with PHP's output_buffering enabled. while (ob_get_level()) { - Kohana_Log::add("error","".print_r(ob_get_level(),1)); if (!@ob_end_clean()) { // ob_end_clean() can return false if the buffer can't be removed for some reason // (zlib output compression buffers sometimes cause problems). -- cgit v1.2.3