aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-07-15 21:43:42 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-07-15 21:43:42 -0700
commit070397ef1470972476df48b169f4d6ee844c5c1f (patch)
tree2e370916bc4a78839498d1de96b10bbcd9dc6f18 /include
parentb9fd8b46141cebbd5658819782f797cf14cef1fd (diff)
downloadvolse-hubzilla-070397ef1470972476df48b169f4d6ee844c5c1f.tar.gz
volse-hubzilla-070397ef1470972476df48b169f4d6ee844c5c1f.tar.bz2
volse-hubzilla-070397ef1470972476df48b169f4d6ee844c5c1f.zip
make tagadelic results (including categories in wall-to-wall posts) visible to wall visitors by checking ownership rather than authorship. It is doubtful the queries will scale on redmatrix so moved forward to hubzilla tree.
Diffstat (limited to 'include')
-rw-r--r--include/contact_widgets.php3
-rw-r--r--include/taxonomy.php19
-rw-r--r--include/widgets.php6
3 files changed, 17 insertions, 11 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index 2c41ea92e..a60b8b1c3 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -79,7 +79,8 @@ function categories_widget($baseurl,$selected = '') {
where item.uid = %d
and term.uid = item.uid
and term.type = %d
- and item.author_xchan = '%s'
+ and item.owner_xchan = '%s'
+ and item.item_wall = 1
$item_normal
order by term.term asc",
intval($a->profile['profile_uid']),
diff --git a/include/taxonomy.php b/include/taxonomy.php
index de2874f9d..b57cfc5c4 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');
@@ -124,6 +124,11 @@ 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
@@ -215,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">';
@@ -232,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",
@@ -253,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",
diff --git a/include/widgets.php b/include/widgets.php
index bafd9c7a2..c79d2a6c0 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -29,7 +29,7 @@ function widget_tagcloud($args) {
$type = TERM_CATEGORY;
// FIXME there exists no $authors variable
- $r = tagadelic($uid, $count, $authors, $flags, ITEM_TYPE_WEBPAGE, $type);
+ $r = tagadelic($uid, $count, $authors, $owner, $flags, ITEM_TYPE_WEBPAGE, $type);
if($r) {
$o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
@@ -392,7 +392,7 @@ function widget_tagcloud_wall($arr) {
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
if(feature_enabled($a->profile['profile_uid'], 'tagadelic'))
- return wtagblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], 'wall');
+ return wtagblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
return '';
}
@@ -407,7 +407,7 @@ function widget_catcloud_wall($arr) {
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
- return catblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], 'wall');
+ return catblock($a->profile['profile_uid'], $limit, '', $a->profile['channel_hash'], 'wall');
}