From 5020f2184ca02cebc64f9c1cd7c93f50dd917ce6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 3 Nov 2011 21:15:10 -0700 Subject: Better fix for dc21cf36b606048dc24532407d39bc8f5b4211fa - let's just fix up the root album thumbnail when the proportions change so that we avoid this problem altogether. --- modules/gallery/helpers/graphics.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 3548faa1..06cab788 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -229,7 +229,6 @@ class graphics_Core { return db::build() ->from("items") ->and_open() - ->and_open() ->where("thumb_dirty", "=", 1) ->and_open() ->where("type", "<>", "album") @@ -239,8 +238,6 @@ class graphics_Core { ->where("resize_dirty", "=", 1) ->where("type", "=", "photo") ->close() - ->close() - ->where("id", "<>", 1) ->close(); } -- cgit v1.2.3 From eab12774fbe828b295c8ec0b440df8151df74fa1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 3 Nov 2011 21:24:35 -0700 Subject: In get_position() don't try to truncate the score if it's empty. Follow-on to ce43f29e2ceaac3d638061f81dc6037b5e0018d3 --- modules/search/helpers/search.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php index d6d67c29..ab6da802 100644 --- a/modules/search/helpers/search.php +++ b/modules/search/helpers/search.php @@ -112,22 +112,22 @@ class search_Core { static function get_position($item, $q) { $page_size = module::get_var("gallery", "page_size", 9); - $query = self::_build_query_base($q, array("{items}.id = " . $item->id)); - $db = Database::instance(); // 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; - $score = substr($score, 0, strlen($score) - 2); + if (strlen($score) > 7) { + $score = substr($score, 0, strlen($score) - 2); + } $data = $db->query(self::_build_query_base($q) . " HAVING `score` >= " . $score); - $data->seek($data->count() - 1); - while ($data->get("id") != $item->id && $data->prev()->valid()); + while ($data->get("id") != $item->id && $data->prev()->valid()) { + } - return $data->key() + 1; + return $data->key() + 1; } } -- cgit v1.2.3