X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsearch.php;h=8f89e72001078905eab52d6cf59a73eb10af8614;hb=7f04a2ab8b38cd7208dc4e9d507aef54cb400f24;hp=0790098a5373ae95333a383381f5be18ff01f9a9;hpb=81ac7c33da119dbe0f9c4185c795b965305beb9d;p=friendica.git diff --git a/mod/search.php b/mod/search.php index 0790098a53..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,9 +216,13 @@ function search_content(App $a) { } dba::close($terms); - $params = ['order' => ['id' => true]]; - $items = Item::selectForUser(local_user(), [], ['id' => $itemids], $params); - $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); @@ -223,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)) { @@ -251,4 +260,3 @@ function search_content(App $a) { return $o; } -