X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FBaseSearch.php;h=bccfc94de594d9c0b6d42d8a78adf5bc5272203d;hb=53e38b03130ea798bba44db44ccb7f331dc4b91d;hp=ca940ae4ead916fd0258aa8026e0f98dcf0467da;hpb=e80d68ba53776bed047d897f52db7e25b35a479d;p=friendica.git diff --git a/src/Module/BaseSearch.php b/src/Module/BaseSearch.php index ca940ae4ea..bccfc94de5 100644 --- a/src/Module/BaseSearch.php +++ b/src/Module/BaseSearch.php @@ -1,6 +1,6 @@ t('Forum Search - %s', $search); } - $args = DI::args(); - $pager = new Pager($args->getQueryString()); + if (DI::mode()->isMobile()) { + $itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', + DI::config()->get('system', 'itemspage_network_mobile')); + } else { + $itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', + DI::config()->get('system', 'itemspage_network')); + } + + $pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage); if ($localSearch && empty($results)) { $pager->setItemsPerPage(80); @@ -109,69 +114,19 @@ class BaseSearch extends BaseModule protected static function printResult(ResultList $results, Pager $pager, $header = '') { if ($results->getTotal() == 0) { - info(DI::l10n()->t('No matches')); + notice(DI::l10n()->t('No matches')); return ''; } - $id = 0; $entries = []; foreach ($results->getResults() as $result) { // in case the result is a contact result, add a contact-specific entry if ($result instanceof ContactResult) { - - $alt_text = ''; - $location = ''; - $about = ''; - $accountType = ''; - $photo_menu = []; - - // If We already know this contact then don't show the "connect" button - if ($result->getCid() > 0 || $result->getPCid() > 0) { - $connLink = ""; - $connTxt = ""; - $contact = Model\Contact::getById( - ($result->getCid() > 0) ? $result->getCid() : $result->getPCid() - ); - - if (!empty($contact)) { - $photo_menu = Model\Contact::photoMenu($contact); - $details = Contact::getContactTemplateVars($contact); - $alt_text = $details['alt_text']; - $location = $contact['location']; - $about = $contact['about']; - $accountType = Model\Contact::getAccountType($contact); - } else { - $photo_menu = []; - } - } else { - $connLink = DI::baseUrl()->get() . '/follow/?url=' . $result->getUrl(); - $connTxt = DI::l10n()->t('Connect'); - - $photo_menu['profile'] = [DI::l10n()->t("View Profile"), Model\Contact::magicLink($result->getUrl())]; - $photo_menu['follow'] = [DI::l10n()->t("Connect/Follow"), $connLink]; + $contact = Model\Contact::getByURLForUser($result->getUrl(), local_user()); + if (!empty($contact)) { + $entries[] = Contact::getContactTemplateVars($contact); } - - $photo = str_replace("http:///photo/", Search::getGlobalDirectory() . "/photo/", $result->getPhoto()); - - $entry = [ - 'alt_text' => $alt_text, - 'url' => Model\Contact::magicLink($result->getUrl()), - 'itemurl' => $result->getItem(), - 'name' => $result->getName(), - 'thumb' => ProxyUtils::proxifyUrl($photo, false, ProxyUtils::SIZE_THUMB), - 'img_hover' => $result->getTags(), - 'conntxt' => $connTxt, - 'connlnk' => $connLink, - 'photo_menu' => $photo_menu, - 'details' => $location, - 'tags' => $result->getTags(), - 'about' => $about, - 'account_type' => $accountType, - 'network' => ContactSelector::networkToName($result->getNetwork(), $result->getUrl()), - 'id' => ++$id, - ]; - $entries[] = $entry; } }