aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authormarijus <mario@localhost.localdomain>2014-02-05 14:48:42 +0100
committermarijus <mario@localhost.localdomain>2014-02-05 14:48:42 +0100
commit419e3b5024efec40c98e48c3bf213c4e60d39fae (patch)
treed3754aa1d251308eb6178fe4ab138463ceaaf135 /include/items.php
parentd7d2fff24b05bcb3ff3acc215e99f8f7d33d058d (diff)
parent0844110f7b154a0fb5102362fe732c2b091222d7 (diff)
downloadvolse-hubzilla-419e3b5024efec40c98e48c3bf213c4e60d39fae.tar.gz
volse-hubzilla-419e3b5024efec40c98e48c3bf213c4e60d39fae.tar.bz2
volse-hubzilla-419e3b5024efec40c98e48c3bf213c4e60d39fae.zip
Merge branch 'master' of https://github.com/friendica/red into upstream
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php29
1 files changed, 25 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index 2fe923303..860d714d1 100755
--- a/include/items.php
+++ b/include/items.php
@@ -822,7 +822,7 @@ function encode_item_xchan($xchan) {
function encode_item_terms($terms) {
$ret = array();
- $allowed_export_terms = array( TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY );
+ $allowed_export_terms = array( TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY, TERM_BOOKMARK );
if($terms) {
foreach($terms as $term) {
@@ -834,7 +834,7 @@ function encode_item_terms($terms) {
}
function termtype($t) {
- $types = array('unknown','hashtag','mention','category','private_category','file','search');
+ $types = array('unknown','hashtag','mention','category','private_category','file','search','thing','bookmark');
return(($types[$t]) ? $types[$t] : 'unknown');
}
@@ -865,6 +865,12 @@ function decode_tags($t) {
case 'search':
$tag['type'] = TERM_SEARCH;
break;
+ case 'thing':
+ $tag['type'] = TERM_THING;
+ break;
+ case 'bookmark':
+ $tag['type'] = TERM_BOOKMARK;
+ break;
default:
case 'unknown':
$tag['type'] = TERM_UNKNOWN;
@@ -2163,6 +2169,21 @@ function tag_deliver($uid,$item_id) {
$item = $i[0];
+
+ $terms = get_terms_oftype($item['term'],TERM_BOOKMARK);
+
+ if($terms && (! $i[0]['item_restrict'])) {
+ logger('tag_deliver: found bookmark');
+ if(perm_is_allowed($u[0]['channel_id'],$i[0]['author_xchan'],'bookmark') && ($i[0]['author_xchan'] != $u[0]['channel_hash'])) {
+ require_once('include/bookmarks.php');
+ require_once('include/Contact.php');
+ $s = channelx_by_hash($i[0]['author_xchan']);
+ foreach($terms as $t) {
+ bookmark_add($u[0],$s[0],$t,$i[0]['item_private']);
+ }
+ }
+ }
+
if(($item['source_xchan']) && ($item['item_flags'] & ITEM_UPLINK) && ($item['item_flags'] & ITEM_THREAD_TOP) && ($item['edited'] != $item['created'])) {
// this is an update to a post which was already processed by us and has a second delivery chain
// Just start the second delivery chain to deliver the updated post
@@ -2466,7 +2487,7 @@ function check_item_source($uid,$item) {
return false;
- $r = q("select * from source where src_channel_id = %d and src_xchan = '%s' limit 1",
+ $r = q("select * from source where src_channel_id = %d and ( src_xchan = '%s' || src_xchan = '*' ) limit 1",
intval($uid),
dbesc(($item['source_xchan']) ? $item['source_xchan'] : $item['owner_xchan'])
);
@@ -2502,7 +2523,7 @@ function check_item_source($uid,$item) {
foreach($words as $word) {
if(substr($word,0,1) === '#' && $tags) {
foreach($tags as $t)
- if($t['type'] == TERM_HASHTAG && substr($t,1) === $word)
+ if(($t['type'] == TERM_HASHTAG) && ((substr($t,1) === substr($word,1)) || (substr($word,1) === '*')))
return true;
}
if(stristr($text,$word) !== false)