$o = '';
- $r = q("select `term` from `search` WHERE `uid` = %d",
+ $r = q("select `id`,`term` from `search` WHERE `uid` = %d",
intval(local_user())
);
$o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n";
$o .= '<ul id="saved-search-ul">' . "\r\n";
foreach($r as $rr) {
- $o .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+ $o .= '<li class="saved-search-li clear"><a href="search/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="search/?f=&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
}
- $o .= '</ul></div>' . "\r\n";
+ $o .= '</ul><div class="clear"></div></div>' . "\r\n";
}
return $o;
$a->page['aside'] .= search_saved_searches();
}
+ else
+ unset($_SESSION['theme']);
+
}
notice( t('Public access denied.') . EOL);
return;
}
+
+ nav_set_selected('search');
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
- if(x($_SESSION,'theme'))
- unset($_SESSION['theme']);
-
$o = '<div id="live-search"></div>' . "\r\n";
- $o .= '<h3>' . t('Search') . '</h3>';
+ $o .= '<h3>' . t('Search This Site') . '</h3>';
if(x($a->data,'search'))
$search = notags(trim($a->data['search']));
// Only public wall posts can be shown
// OR your own posts if you are a logged in member
- $s_bool = "AND MATCH (`item`.`body`) AGAINST ( '%s' IN BOOLEAN MODE )";
- $s_regx = "AND `item`.`body` REGEXP '%s' ";
+ $s_regx = sprintf("AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' )",
+ dbesc(preg_quote($search)), dbesc('\\]' . preg_quote($search) . '\\['));
- if(mb_strlen($search) >= 3)
- $search_alg = $s_bool;
- else
- $search_alg = $s_regx;
+ $search_alg = $s_regx;
$r = q("SELECT COUNT(*) AS `total`
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` LEFT JOIN `user` ON `user`.`uid` = `item`.`uid`
OR `item`.`uid` = %d )
AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
$search_alg ",
- intval(local_user()),
- dbesc($search)
+ intval(local_user())
);
if(count($r))
$search_alg
ORDER BY `received` DESC LIMIT %d , %d ",
intval(local_user()),
- dbesc($search),
intval($a->pager['start']),
intval($a->pager['itemspage'])