]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/BaseSearchModule.php
[frio] Add jotnet fields to compose page
[friendica.git] / src / Module / BaseSearchModule.php
index bba029db54cafdfb76826e55b555959bb6184216..ed39f071ca61c92c898aa1a702ccd638f04cfbf2 100644 (file)
@@ -48,15 +48,18 @@ class BaseSearchModule extends BaseModule
 
                if (strpos($search, '@') === 0) {
                        $search  = substr($search, 1);
-                       $type = Search::TYPE_PEOPLE;
+                       $type    = Search::TYPE_PEOPLE;
                        $header  = L10n::t('People Search - %s', $search);
-                       $results = Search::getContactsFromProbe($search);
+
+                       if (strrpos($search, '@') > 0) {
+                               $results = Search::getContactsFromProbe($search);
+                       }
                }
 
                if (strpos($search, '!') === 0) {
-                       $search    = substr($search, 1);
-                       $type = Search::TYPE_FORUM;
-                       $header    = L10n::t('Forum Search - %s', $search);
+                       $search = substr($search, 1);
+                       $type   = Search::TYPE_FORUM;
+                       $header = L10n::t('Forum Search - %s', $search);
                }
 
                $pager = new Pager($a->query_string);
@@ -64,9 +67,8 @@ class BaseSearchModule extends BaseModule
                if ($localSearch && empty($results)) {
                        $pager->setItemsPerPage(80);
                        $results = Search::getContactsFromLocalDirectory($search, $type, $pager->getStart(), $pager->getItemsPerPage());
-
                } elseif (strlen($config->get('system', 'directory')) && empty($results)) {
-                       $results = Search::getContactsFromGlobalDirectory($search, $pager->getPage(), $type);
+                       $results = Search::getContactsFromGlobalDirectory($search, $type, $pager->getPage());
                        $pager->setItemsPerPage($results->getItemsPage());
                }
 
@@ -77,8 +79,8 @@ class BaseSearchModule extends BaseModule
         * Prints a human readable search result
         *
         * @param ResultList $results
-        * @param Pager             $pager
-        * @param string            $header
+        * @param Pager      $pager
+        * @param string     $header
         *
         * @return string The result
         * @throws HTTPException\InternalServerErrorException
@@ -86,14 +88,14 @@ class BaseSearchModule extends BaseModule
         */
        protected static function printResult(ResultList $results, Pager $pager, $header = '')
        {
-               if (empty($results) || empty($results->getResults())) {
-                       info(L10n::t('No matches') . EOL);
+               if ($results->getTotal() == 0) {
+                       info(L10n::t('No matches'));
                        return '';
                }
 
                $a = self::getApp();
 
-               $id = 0;
+               $id      = 0;
                $entries = [];
                foreach ($results->getResults() as $result) {