Fixing method signature

This commit is contained in:
Philipp Holzer 2019-05-20 19:19:57 +02:00
parent 2bb2bb19fd
commit 5e79d3fc82
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
2 changed files with 18 additions and 15 deletions

View File

@ -52,7 +52,7 @@ class Search extends BaseObject
}
$contactDetails = Contact::getDetailsByURL(defaults($user_data, 'url', ''), local_user());
$itemUrl = (($contactDetails["addr"] != "") ? $contactDetails["addr"] : defaults($user_data, 'url', ''));
$itemUrl = (($contactDetails["addr"] != "") ? $contactDetails["addr"] : defaults($user_data, 'url', ''));
$result = new ContactResult(
defaults($user_data, 'name', ''),
@ -75,6 +75,7 @@ class Search extends BaseObject
/**
* Search in the global directory for occurrences of the search string
*
* @see https://github.com/friendica/friendica-directory/blob/master/docs/Protocol.md#search
*
* @param string $search
@ -105,10 +106,10 @@ class Search extends BaseObject
$searchUrl .= '&page=' . $page;
}
$red = 0;
$resultJson = Network::fetchUrl($searchUrl, false,$red, 0, 'application/json');
$red = 0;
$resultJson = Network::fetchUrl($searchUrl, false, $red, 0, 'application/json');
$results = json_decode($resultJson, true);
$results = json_decode($resultJson, true);
$resultList = new ResultList(
defaults($results, 'page', 1),
@ -120,7 +121,9 @@ class Search extends BaseObject
foreach ($profiles as $profile) {
$contactDetails = Contact::getDetailsByURL(defaults($profile, 'profile_url', ''), local_user());
$itemUrl = (!empty($contactDetails['addr']) ? $contactDetails['addr'] : defaults($profile, 'profile_url', ''));
$itemUrl = (!empty($contactDetails['addr']) ?
$contactDetails['addr'] :
defaults($profile, 'profile_url', ''));
$result = new ContactResult(
defaults($profile, 'name', ''),
@ -189,8 +192,8 @@ class Search extends BaseObject
($type === self::TYPE_FORUM),
], [
'group_by' => ['nurl', 'updated'],
'limit' => [$start, $itemPage],
'order' => ['updated' => 'DESC']
'limit' => [$start, $itemPage],
'order' => ['updated' => 'DESC']
]);
if (!DBA::isResult($data)) {

View File

@ -48,15 +48,15 @@ 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 (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);
@ -66,7 +66,7 @@ class BaseSearchModule extends BaseModule
$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 +77,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
@ -93,7 +93,7 @@ class BaseSearchModule extends BaseModule
$a = self::getApp();
$id = 0;
$id = 0;
$entries = [];
foreach ($results->getResults() as $result) {