From a74e3aea6f0bdde210c91622535af3e58aa1e9fd Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 9 Dec 2012 20:26:16 -0800 Subject: Eliminate the search context if we encounter an item that cannot be found in the search results. Fixes #1923. --- modules/gallery/helpers/item.php | 7 +++++++ modules/search/helpers/search.php | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index d8b660d9..b739e8bd 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -414,6 +414,13 @@ class item_Core { } } + /** + * Get rid of the display context callback + */ + static function clear_display_context_callback() { + Cache::instance()->delete("display_context_" . $sid = Session::instance()->id()); + } + /** * Call the display context callback for the given item */ diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php index b7fa21c4..64a13825 100644 --- a/modules/search/helpers/search.php +++ b/modules/search/helpers/search.php @@ -117,7 +117,14 @@ class search_Core { // Truncate the score by two decimal places as this resolves the issues // that arise due to in exact numeric conversions. - $score = $db->query($query)->current()->score; + $current = $db->query($query)->current(); + if (!$current) { + // We can't find this result in our result set - perhaps we've fallen out of context? Clear + // the context and try again. + item::clear_display_context_callback(); + url::redirect(url::current()); + } + $score = $current->score(); if (strlen($score) > 7) { $score = substr($score, 0, strlen($score) - 2); } -- cgit v1.2.3 From de101829d1f79742bec7a8e1afa01eb416dda211 Mon Sep 17 00:00:00 2001 From: Automatic Build Number Updater Date: Sun, 9 Dec 2012 21:27:28 -0700 Subject: Automated update of .build_number to 259 for branch master Last update: f457cd283cdfd9011d76ae96872e1f08bb219baf (1 commits ago) --- .build_number | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build_number b/.build_number index 8c992dcc..b228d1d7 100644 --- a/.build_number +++ b/.build_number @@ -3,4 +3,4 @@ ; process. You don't need to edit it. In fact.. ; ; DO NOT EDIT THIS FILE BY HAND! -build_number=258 +build_number=259 -- cgit v1.2.3 From 549630219f8f43abab68f1e63944facedfabe776 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Sun, 9 Dec 2012 10:01:43 +0100 Subject: bug fix: updated file_proxy.php to use legal_file helper instead of hard-coded list of movie file extensions. bug fix: updated uploader.php to use legal_file helper instead of hard-coded list of movie file extensions. Fixes #1926 --- modules/gallery/controllers/file_proxy.php | 4 ++-- modules/gallery/controllers/uploader.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 49aa9c5a..b9ff7df1 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -68,10 +68,10 @@ class File_Proxy_Controller extends Controller { $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 .flv, .mp4 or .m4v file would + // 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 (array("flv", "mp4", "m4v") as $ext) { + 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()) { diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php index 4ea55ff6..ecb0ca89 100644 --- a/modules/gallery/controllers/uploader.php +++ b/modules/gallery/controllers/uploader.php @@ -69,7 +69,7 @@ class 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", "m4v"))) { + in_array(strtolower($path_info["extension"]), legal_file::get_movie_extensions())) { $item->type = "movie"; $item->save(); log::success("content", t("Added a movie"), -- cgit v1.2.3 From 7c62c67d56e854f69a411dd56c48ef066f951c48 Mon Sep 17 00:00:00 2001 From: Automatic Build Number Updater Date: Mon, 10 Dec 2012 12:15:56 -0700 Subject: Automated update of .build_number to 260 for branch master Last update: de101829d1f79742bec7a8e1afa01eb416dda211 (1 commits ago) --- .build_number | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build_number b/.build_number index b228d1d7..0c4adaa9 100644 --- a/.build_number +++ b/.build_number @@ -3,4 +3,4 @@ ; process. You don't need to edit it. In fact.. ; ; DO NOT EDIT THIS FILE BY HAND! -build_number=259 +build_number=260 -- cgit v1.2.3