if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/searchaction.php');
-define('NOTICES_PER_PAGE', 20);
# XXX common parent for people and content search?
# 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'));
$profile = $notice->getProfile();
if (!$profile) {
common_log_db_error($notice, 'SELECT', __FILE__);
+ $this->server_error(_('Notice without matching profile'));
return;
}
# XXX: RDFa
'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');