intval(local_user())
);
- if(count($r)) {
+ if (dbm::is_result($r)) {
$saved = array();
- foreach($r as $rr) {
+ foreach ($r as $rr) {
$saved[] = array(
'id' => $rr['id'],
'term' => $rr['term'],
}
-function search_init(&$a) {
+function search_init(App $a) {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
intval(local_user()),
dbesc($search)
);
- if(! count($r)) {
+ if (! dbm::is_result($r)) {
q("INSERT INTO `search` (`uid`,`term`) VALUES ( %d, '%s')",
intval(local_user()),
dbesc($search)
-function search_post(&$a) {
+function search_post(App $a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
-function search_content(&$a) {
+function search_content(App $a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice( t('Public access denied.') . EOL);
} else {
logger("Start fulltext search for '".$search."'", LOGGER_DEBUG);
- if (get_config('system','use_fulltext_engine')) {
- $sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
- } else {
+ // Disabled until finally is decided how to proceed with this
+ //if (get_config('system','use_fulltext_engine')) {
+ // $sql_extra = sprintf(" AND MATCH (`item`.`body`, `item`.`title`) AGAINST ('%s' in boolean mode) ", dbesc(protect_sprintf($search)));
+ //} else {
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
- }
-
+ //}
$r = q("SELECT %s
FROM `item` %s
intval($a->pager['start']), intval($a->pager['itemspage']));
}
- if(! count($r)) {
+ if (! dbm::is_result($r)) {
info( t('No results.') . EOL);
return $o;
}