X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseSearchModule.php;h=ed39f071ca61c92c898aa1a702ccd638f04cfbf2;hb=4d8ca5c9c212153c4f892d7b67a2e52a741d7f4d;hp=bba029db54cafdfb76826e55b555959bb6184216;hpb=2bb2bb19fd1c348ee18b0de6a67b032eea326a89;p=friendica.git diff --git a/src/Module/BaseSearchModule.php b/src/Module/BaseSearchModule.php index bba029db54..ed39f071ca 100644 --- a/src/Module/BaseSearchModule.php +++ b/src/Module/BaseSearchModule.php @@ -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) {