summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/graphics.php3
-rw-r--r--modules/search/helpers/search.php12
2 files changed, 6 insertions, 9 deletions
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();
}
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;
}
}