aboutsummaryrefslogtreecommitdiffstats
path: root/include/taxonomy.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/taxonomy.php')
-rw-r--r--include/taxonomy.php37
1 files changed, 22 insertions, 15 deletions
diff --git a/include/taxonomy.php b/include/taxonomy.php
index 36490291d..e68b9659f 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -101,7 +101,7 @@ function format_term_for_display($term) {
// Tag cloud functions - need to be adpated to this database format
-function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $type = TERM_HASHTAG) {
+function tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags = 0, $restrict = 0, $type = TERM_HASHTAG) {
require_once('include/security.php');
@@ -111,8 +111,10 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
$sql_options = item_permissions_sql($uid);
$count = intval($count);
- if($flags)
- $sql_options .= " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") ";
+ if($flags) {
+ if($flags === 'wall')
+ $sql_options .= " and item_wall = 1 ";
+ }
if($authors) {
if(! is_array($authors))
@@ -122,10 +124,15 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
$sql_options .= " and author_xchan in (" . implode(',',$authors) . ") ";
}
+ if($owner) {
+ $sql_options .= " and owner_xchan = '" . dbesc($owner) . "' ";
+ }
+
+
// Fetch tags
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
where term.uid = %d and term.type = %d
- and otype = %d and item_restrict = %d
+ and otype = %d and item_type = %d and item_private = 0
$sql_options
group by term order by total desc %s",
intval($uid),
@@ -213,10 +220,10 @@ function dir_tagadelic($count = 0) {
}
-function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
+function tagblock($link,$uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
$o = '';
- $r = tagadelic($uid,$count,$authors,$flags,$restrict,$type);
+ $r = tagadelic($uid,$count,$authors,$owner, $flags,$restrict,$type);
if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
@@ -230,10 +237,10 @@ function tagblock($link,$uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$
}
-function wtagblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
+function wtagblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_HASHTAG) {
$o = '';
- $r = tagadelic($uid,$count,$authors,$flags,$restrict,$type);
+ $r = tagadelic($uid,$count,$authors,$owner, $flags,$restrict,$type);
if($r) {
$c = q("select channel_address from channel where channel_id = %d limit 1",
@@ -251,10 +258,10 @@ function wtagblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type
}
-function catblock($uid,$count = 0,$authors = '',$flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
+function catblock($uid,$count = 0,$authors = '',$owner = '', $flags = 0,$restrict = 0,$type = TERM_CATEGORY) {
$o = '';
- $r = tagadelic($uid,$count,$authors,$flags,$restrict,$type);
+ $r = tagadelic($uid,$count,$authors,$owner,$flags,$restrict,$type);
if($r) {
$c = q("select channel_address from channel where channel_id = %d limit 1",
@@ -334,7 +341,7 @@ function get_things($profile_hash,$uid) {
$sql_extra = (($profile_hash) ? " and obj_page = '" . $profile_hash . "' " : '');
- $r = q("select * from obj left join term on obj_obj = term_hash where term_hash != '' and uid = %d and obj_type = %d $sql_extra order by obj_verb, term",
+ $r = q("select * from obj where obj_channel = %d and obj_type = %d $sql_extra order by obj_verb, obj_term",
intval($uid),
intval(TERM_OBJ_THING)
);
@@ -350,8 +357,8 @@ function get_things($profile_hash,$uid) {
foreach($r as $rr) {
$rr['profile_name'] = '';
- if(! in_array($rr['term_hash'],$profile_hashes))
- $profile_hashes[] = $rr['term_hash'];
+ if(! in_array($rr['obj_obj'],$profile_hashes))
+ $profile_hashes[] = $rr['obj_obj'];
}
stringify_array_elms($profile_hashes);
if(! $profile_hash) {
@@ -383,7 +390,7 @@ function get_things($profile_hash,$uid) {
$l = q("select xchan_name, xchan_url from likes left join xchan on likee = xchan_hash where
target_type = '%s' and target_id = '%s' and channel_id = %d",
dbesc(ACTIVITY_OBJ_THING),
- dbesc($rr['term_hash']),
+ dbesc($rr['obj_obj']),
intval($uid)
);
@@ -393,7 +400,7 @@ function get_things($profile_hash,$uid) {
if(! $things[$rr['obj_verb']])
$things[$rr['obj_verb']] = array();
- $things[$rr['obj_verb']][] = array('term' => $rr['term'],'url' => $rr['url'],'img' => $rr['imgurl'], 'profile' => $rr['profile_name'],'term_hash' => $rr['term_hash'], 'likes' => $l,'like_count' => count($l),'like_label' => tt('Like','Likes',count($l),'noun'));
+ $things[$rr['obj_verb']][] = array('term' => $rr['obj_term'],'url' => $rr['obj_url'],'img' => $rr['obj_imgurl'], 'profile' => $rr['profile_name'],'term_hash' => $rr['obj_obj'], 'likes' => $l,'like_count' => count($l),'like_label' => tt('Like','Likes',count($l),'noun'));
}
$sorted_things = array();
if($things) {