diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/content.php | 3 | ||||
-rw-r--r-- | mod/network.php | 14 | ||||
-rw-r--r-- | mod/profile.php | 3 | ||||
-rw-r--r-- | mod/search.php | 22 |
4 files changed, 18 insertions, 24 deletions
diff --git a/mod/content.php b/mod/content.php index 369f2fce2..7799ee6ad 100644 --- a/mod/content.php +++ b/mod/content.php @@ -290,7 +290,8 @@ function content_content(&$a, $update = 0) { intval(TERM_OBJ_POST) ); - $items = conv_sort($items,$tags,$ordering); + $items = fetch_post_tags($items); + $items = conv_sort($items,$ordering); } else { $items = array(); diff --git a/mod/network.php b/mod/network.php index a136e12d6..21a43f9cb 100644 --- a/mod/network.php +++ b/mod/network.php @@ -664,19 +664,9 @@ function network_content(&$a, $update = 0) { dbesc($parents_str) ); - $tag_finder = array(); - if(count($items)) - foreach($items as $item) - if(! in_array($item['item_id'],$tag_finder)) - $tag_finder[] = $item['item_id']; - $tag_finder_str = implode(', ', $tag_finder); - - $tags = q("select * from term where oid in ( %s ) and otype = %d", - dbesc($tag_finder_str), - intval(TERM_OBJ_POST) - ); + $items = fetch_post_tags($items); - $items = conv_sort($items,$tags,$ordering); + $items = conv_sort($items,$ordering); } else { diff --git a/mod/profile.php b/mod/profile.php index b48e035af..c9406c464 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -291,7 +291,8 @@ function profile_content(&$a, $update = 0) { intval(TERM_OBJ_POST) ); - $items = conv_sort($items,$tags,'created'); + $items = fetch_post_tags($items); + $items = conv_sort($items,'created'); } else { $items = array(); 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 .= '<h2>Items tagged with: ' . $search . '</h2>'; else |