]> git.mxchange.org Git - friendica.git/commitdiff
Fix Issue 5252
authorMichael <heluecht@pirati.ca>
Thu, 21 Jun 2018 08:23:35 +0000 (08:23 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 21 Jun 2018 08:23:35 +0000 (08:23 +0000)
mod/search.php

index 0790098a5373ae95333a383381f5be18ff01f9a9..d64ce7d0e17eafe34edad6e7e7320ca7eba2d574 100644 (file)
@@ -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",
@@ -184,7 +184,7 @@ function search_content(App $a) {
                                break;
                }
 
-       if (! $search)
+       if (!$search)
                return $o;
 
        if (Config::get('system','only_tag_search'))
@@ -211,9 +211,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 = dba::inArray($items);
+               } else {
+                       $r = [];
+               }
        } else {
                logger("Start fulltext search for '".$search."'", LOGGER_DEBUG);
 
@@ -251,4 +255,3 @@ function search_content(App $a) {
 
        return $o;
 }
-