X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsearch.php;h=8f89e72001078905eab52d6cf59a73eb10af8614;hb=7f04a2ab8b38cd7208dc4e9d507aef54cb400f24;hp=6580246e4a4122faba4f94aeb0a216dddffca44b;hpb=af39296f0640bc40e58f51ec47c4e5aa53a24316;p=friendica.git diff --git a/mod/search.php b/mod/search.php index 6580246e4a..8f89e72001 100644 --- a/mod/search.php +++ b/mod/search.php @@ -21,7 +21,7 @@ function search_saved_searches() { $o = ''; $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : ''); - if (! Feature::isEnabled(local_user(),'savedsearch')) + if (!Feature::isEnabled(local_user(),'savedsearch')) return $o; $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d", @@ -74,6 +74,11 @@ function search_init(App $a) { dba::delete('search', ['uid' => local_user(), 'term' => $search]); } + /// @todo Check if there is a case at all that "aside" is prefilled here + if (!isset($a->page['aside'])) { + $a->page['aside'] = ''; + } + $a->page['aside'] .= search_saved_searches(); } else { @@ -184,7 +189,7 @@ function search_content(App $a) { break; } - if (! $search) + if (!$search) return $o; if (Config::get('system','only_tag_search')) @@ -211,8 +216,13 @@ function search_content(App $a) { } dba::close($terms); - $items = Item::selectForUser(local_user(), [], ['id' => array_reverse($itemids)]); - $r = dba::inArray($items); + if (!empty($itemids)) { + $params = ['order' => ['id' => true]]; + $items = Item::selectForUser(local_user(), [], ['id' => $itemids], $params); + $r = Item::inArray($items); + } else { + $r = []; + } } else { logger("Start fulltext search for '".$search."'", LOGGER_DEBUG); @@ -222,7 +232,7 @@ function search_content(App $a) { $params = ['order' => ['id' => true], 'limit' => [$a->pager['start'], $a->pager['itemspage']]]; $items = Item::selectForUser(local_user(), [], $condition, $params); - $r = dba::inArray($items); + $r = Item::inArray($items); } if (!DBM::is_result($r)) { @@ -250,4 +260,3 @@ function search_content(App $a) { return $o; } -