diff options
author | friendica <info@friendica.com> | 2013-07-01 19:41:11 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-07-01 19:41:11 -0700 |
commit | b86253c655f974920c4d3de0915611a7e66c7336 (patch) | |
tree | 36baed8163b3b1e625c5a8409e9a01be123e3759 /include | |
parent | 822a4a028718b81119ab51e47145b2ddf87b775c (diff) | |
download | volse-hubzilla-b86253c655f974920c4d3de0915611a7e66c7336.tar.gz volse-hubzilla-b86253c655f974920c4d3de0915611a7e66c7336.tar.bz2 volse-hubzilla-b86253c655f974920c4d3de0915611a7e66c7336.zip |
issue #65
Diffstat (limited to 'include')
-rwxr-xr-x | include/text.php | 2 | ||||
-rw-r--r-- | include/zot.php | 66 |
2 files changed, 66 insertions, 2 deletions
diff --git a/include/text.php b/include/text.php index 6ab1d3c8b..db29697f9 100755 --- a/include/text.php +++ b/include/text.php @@ -850,7 +850,6 @@ function smilies($s, $sample = false) { ':like', ':dislike', 'red#', - '~friendika', '~friendica' ); @@ -889,7 +888,6 @@ function smilies($s, $sample = false) { '<img class="smiley" src="' . $a->get_baseurl() . '/images/like.gif" alt=":like" />', '<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />', '<img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red#" /></a>', - '<a href="http://project.friendika.com">~friendika <img class="smiley" src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>', '<a href="http://friendica.com">~friendica <img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>' ); diff --git a/include/zot.php b/include/zot.php index be0760a05..f10a02d47 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1036,6 +1036,10 @@ function process_delivery($sender,$arr,$deliveries,$relay) { } if($arr['item_restrict'] & ITEM_DELETED) { + + // remove_community_tag is a no-op if this isn't a community tag activity + remove_community_tag($sender,$arr,$channel['channel_id']); + $item_id = delete_imported_item($sender,$arr,$channel['channel_id']); $result[] = array($d['hash'],'deleted'); @@ -1116,6 +1120,68 @@ function process_delivery($sender,$arr,$deliveries,$relay) { } +function remove_community_tag($sender,$arr,$uid) { + + if(! (activity_match($arr['verb'],ACTIVITY_TAG) && ($arr['obj_type'] == ACTIVITY_OBJ_TAGTERM))) + return; + + logger('remove_community_tag: invoked'); + + + if(! get_pconfig($uid,'system','blocktags')) { + logger('remove_community tag: permission denied.'); + return; + } + + $r = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($arr['mid']), + intval($uid) + ); + if(! $r) { + logger('remove_community_tag: no item'); + return; + } + + if(($sender['hash'] != $r[0]['owner_xchan']) && ($sender['hash'] != $r[0]['author_xchan'])) { + logger('remove_community_tag: sender not authorised.'); + return; + } + + $i = $r[0]; + + if($i['target']) + $i['target'] = json_decode($i['target'],true); + if($i['object']) + $i['object'] = json_decode($i['object'],true); + + if(! ($i['target'] && $i['object'])) { + logger('remove_community_tag: no target/object'); + return; + } + + $message_id = $i['target']['id']; + + $r = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($message_id), + intval($uid) + ); + if(! $r) { + logger('remove_community_tag: no parent message'); + return; + } + + $x = q("delete from term where uid = %d and oid = %d and otype = %d and type = %d and term = '%s' and url = '%s' limit 1", + intval($uid), + intval($r[0]['id']), + intval(TERM_OBJ_POST), + intval(TERM_HASHTAG), + dbesc($i['object']['title']), + dbesc(get_rel_link($i['object']['link'],'alternate')) + ); + + return; +} + function update_imported_item($sender,$item,$uid) { item_store_update($item); |