From e7957e14489ce8eb3b69ebede928dfe441a4924d Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Jul 2012 19:28:02 -0700 Subject: create fetch_tags function, make search work again, change logo --- mod/search.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'mod/search.php') diff --git a/mod/search.php b/mod/search.php index 320ffddce..ec7e2ec3a 100644 --- a/mod/search.php +++ b/mod/search.php @@ -108,21 +108,20 @@ function search_content(&$a) { if(! $search) return $o; - if (get_config('system','use_fulltext_engine')) { - if($tag) - $sql_extra = sprintf(" AND MATCH (`item`.`tag`) AGAINST ('".'"%s"'."' in boolean mode) ", '#'.dbesc(protect_sprintf($search))); - else + if($tag) { + $sql_extra = sprintf(" AND `item`.`id` IN (select `oid` from term where otype = %d and type = %d and term = '%s') ", + intval(TERM_OBJ_POST), + intval(TERM_HASHTAG), + dbesc(protect_sprintf($search)) + ); + } + else { + if (get_config('system','use_fulltext_engine')) $sql_extra = sprintf(" AND MATCH (`item`.`body`) AGAINST ('".'"%s"'."' in boolean mode) ", dbesc(protect_sprintf($search))); - } else { - if($tag) - $sql_extra = sprintf(" AND `item`.`tag` REGEXP '%s' ", dbesc('\\]' . protect_sprintf(preg_quote($search)) . '\\[')); else $sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search)))); } - - - // Here is the way permissions work in the search module... // Only public posts can be shown // OR your own posts if you are a logged in member @@ -165,6 +164,9 @@ function search_content(&$a) { ); + + + if($tag) $o .= '

Items tagged with: ' . $search . '

'; else -- cgit v1.2.3