X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnoticesearch.php;h=96e4d777fa3aca01c86ea3a0d39285535e014ffd;hb=c3f2d195f934c4deff91d30640ec703cb576e55d;hp=c257ecec56ebf23b4b9dda4c357824a2f192790a;hpb=12aba8ba32119aa9d98304db0ee220b6f5de1dd0;p=quix0rs-gnu-social.git diff --git a/actions/noticesearch.php b/actions/noticesearch.php index c257ecec56..96e4d777fa 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -20,7 +20,6 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/searchaction.php'); -define('NOTICES_PER_PAGE', 20); # XXX common parent for people and content search? @@ -40,14 +39,19 @@ class NoticesearchAction extends SearchAction { # lcase it for comparison $q = strtolower($q); - $notice->whereAdd('MATCH(content) against (\''.addslashes($q).'\')'); - # Ask for an extra to see if there's more. - - $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); - - $cnt = $notice->find(); + $search_engine = $notice->getSearchEngine('identica_notices'); + $search_engine->set_sort_mode('chron'); + # Ask for an extra to see if there's more. + $search_engine->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); + + if (false === $search_engine->query($q)) { + $cnt = 0; + } + else { + $cnt = $notice->find(); + } if ($cnt > 0) { $terms = preg_split('/[\s,]+/', $q); common_element_start('ul', array('id' => 'notices')); @@ -87,6 +91,7 @@ class NoticesearchAction extends SearchAction { $profile = $notice->getProfile(); if (!$profile) { common_log_db_error($notice, 'SELECT', __FILE__); + $this->server_error(_('Notice without matching profile')); return; } # XXX: RDFa @@ -136,6 +141,8 @@ class NoticesearchAction extends SearchAction { 'onclick' => 'doreply("'.$profile->nickname.'"); return false', 'title' => _('reply'), 'class' => 'replybutton')); + common_hidden('posttoken', common_session_token()); + common_raw('→'); common_element_end('a'); common_element_end('p');