+ // No items will be shown if the member has a blocked profile wall.
+
+ if($tag) {
+ logger("Start tag search for '".$search."'", LOGGER_DEBUG);
+
+ $r = q("SELECT STRAIGHT_JOIN `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
+ `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`rel`,
+ `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
+ `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
+ FROM `term`
+ INNER JOIN `item` ON `item`.`id`=`term`.`oid`
+ INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
+ WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
+ AND (`term`.`uid` = 0 OR (`term`.`uid` = %d AND NOT `term`.`global`)) AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`term` = '%s'
+ ORDER BY term.created DESC LIMIT %d , %d ",
+ intval(local_user()), intval(TERM_OBJ_POST), intval(TERM_HASHTAG), dbesc(protect_sprintf($search)),
+ intval($a->pager['start']), intval($a->pager['itemspage']));
+ } 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 {
+ $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
+ }