summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-02-14 14:40:34 -0500
committerBharat Mediratta <bharat@menalto.com>2013-02-14 14:43:03 -0500
commit72a6a8abafb90321ecd4e2101eac03f86c7c07dd (patch)
tree99f4cc5db90638b10b8748bd831c9fdff3192886 /modules
parentdb9810136381a6d74e82be10b4dbe7e4d2e344bf (diff)
Follow-on to 9dbe2e15ad9db3b2be53e46bc5f67d382fb4089d for #1999.
Fix an issue where siblings() by itself throws an error. The problem is that Theme_View::siblings() passes a null offset and limit to the callback which gets passed down to search::search_within_album, which creates its query in raw SQL and doesn't check for a null offset/limit. We want a reasonable limit on the size of the set here (and 1000 is probably wayyy too high so lower that to 100) so amend get_siblings to stop using default parameters and actually check the inputs. Author: Bharat Mediratta <bharat@menalto.com> Date: Sat Feb 9 14:53:34 2013 -0500 Extend siblings callbacks to take a $limit and an $offset for navigating large sibling sets. Useful for the thumbnav module since we don't want to iterate a thousand siblings to find the one we care about. Fixes #1999.
Diffstat (limited to 'modules')
-rw-r--r--modules/search/controllers/search.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php
index 25ccd81c..753d9b69 100644
--- a/modules/search/controllers/search.php
+++ b/modules/search/controllers/search.php
@@ -110,7 +110,13 @@ class Search_Controller extends Controller {
Breadcrumb::instance($item->title, $item->url())->set_last()));
}
- static function get_siblings($q, $album, $limit=1000, $offset=1) {
+ static function get_siblings($q, $album, $limit, $offset) {
+ if (!isset($limit)) {
+ $limit = 100;
+ }
+ if (!isset($offset)) {
+ $offset = 1;
+ }
$result = search::search_within_album(search::add_query_terms($q), $album, $limit, $offset);
return $result[1];
}