X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fpeoplesearch.php;h=65d970dd159a7fea183763d9fd8488fdde4cb2ab;hb=b4e649fe906a793cd5e62d6390065ea5d41c40db;hp=3c672c9400450051eb1964c189ca099094ca51d7;hpb=4a4efc3b0a453a0e345f4ec5bd8e970130589ae6;p=quix0rs-gnu-social.git diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index 3c672c9400..65d970dd15 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -60,16 +60,10 @@ class PeoplesearchAction extends SearchAction function showResults($q, $page) { - $profile = new Profile(); - - # lcase it for comparison - $q = strtolower($q); - $search_engine = $profile->getSearchEngine('identica_people'); - $search_engine->set_sort_mode('chron'); - # Ask for an extra to see if there's more. + // Ask for an extra to see if there's more. $search_engine->limit((($page-1)*PROFILES_PER_PAGE), PROFILES_PER_PAGE + 1); if (false === $search_engine->query($q)) { $cnt = 0; @@ -81,33 +75,15 @@ class PeoplesearchAction extends SearchAction $terms = preg_split('/[\s,]+/', $q); $results = new PeopleSearchResults($profile, $terms, $this); $results->show(); - } else { - $this->element('p', 'error', _('No results')); - } - - $profile->free(); - - $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, + $profile->free(); + $this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q)); - } -} -class PeopleSearchResults extends ProfileList -{ - var $terms = null; - var $pattern = null; - - function __construct($profile, $terms, $action) - { - parent::__construct($profile, $terms, $action); - $this->terms = array_map('preg_quote', - array_map('htmlspecialchars', $terms)); - $this->pattern = '/('.implode('|',$terms).')/i'; - } - - function highlight($text) - { - return preg_replace($this->pattern, '\\1', htmlspecialchars($text)); + } else { + $this->element('p', 'error', _('No results.')); + $this->searchSuggestions($q); + $profile->free(); + } } }