aggregate channels
This commit is contained in:
parent
8e94e79c7b
commit
017db29947
@ -2063,6 +2063,12 @@ function tag_deliver($uid,$item_id) {
|
|||||||
logger('tag_deliver: tag permission denied for ' . $u[0]['channel_address']);
|
logger('tag_deliver: tag permission denied for ' . $u[0]['channel_address']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$union = check_item_source($uid,$item);
|
||||||
|
if($union)
|
||||||
|
logger('check_item_source returns true');
|
||||||
|
|
||||||
|
|
||||||
// This might be a followup by the original post author to a tagged forum
|
// This might be a followup by the original post author to a tagged forum
|
||||||
// If so setup a second delivery chain
|
// If so setup a second delivery chain
|
||||||
|
|
||||||
@ -2129,43 +2135,45 @@ function tag_deliver($uid,$item_id) {
|
|||||||
intval(ITEM_MENTIONSME),
|
intval(ITEM_MENTIONSME),
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
// At this point we've determined that the person receiving this post was mentioned in it.
|
// At this point we've determined that the person receiving this post was mentioned in it or it is a union.
|
||||||
// Now let's check if this mention was inside a reshare so we don't spam a forum
|
// Now let's check if this mention was inside a reshare so we don't spam a forum
|
||||||
|
|
||||||
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']);
|
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']);
|
||||||
|
|
||||||
$pattern = '/@\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'],'/') . '\[\/zrl\]/';
|
$pattern = '/@\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($u[0]['channel_name'],'/') . '\[\/zrl\]/';
|
||||||
|
|
||||||
if(! preg_match($pattern,$body,$matches)) {
|
if(! preg_match($pattern,$body,$matches)) {
|
||||||
logger('tag_deliver: mention was in a reshare - ignoring');
|
logger('tag_deliver: mention was in a reshare - ignoring');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// All good.
|
// All good.
|
||||||
// Send a notification
|
// Send a notification
|
||||||
|
|
||||||
require_once('include/enotify.php');
|
require_once('include/enotify.php');
|
||||||
notification(array(
|
notification(array(
|
||||||
'to_xchan' => $u[0]['channel_hash'],
|
'to_xchan' => $u[0]['channel_hash'],
|
||||||
'from_xchan' => $item['author_xchan'],
|
'from_xchan' => $item['author_xchan'],
|
||||||
'type' => NOTIFY_TAGSELF,
|
'type' => NOTIFY_TAGSELF,
|
||||||
'item' => $item,
|
'item' => $item,
|
||||||
'link' => $i[0]['llink'],
|
'link' => $i[0]['llink'],
|
||||||
'verb' => ACTIVITY_TAG,
|
'verb' => ACTIVITY_TAG,
|
||||||
'otype' => 'item'
|
'otype' => 'item'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
if(! perm_is_allowed($uid,$item['author_xchan'],'tag_deliver')) {
|
if(! perm_is_allowed($uid,$item['author_xchan'],'tag_deliver')) {
|
||||||
logger('tag_delivery denied for uid ' . $uid . ' and xchan ' . $item['author_xchan']);
|
logger('tag_delivery denied for uid ' . $uid . ' and xchan ' . $item['author_xchan']);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((! $mention) && (! $union))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
// tgroup delivery - setup a second delivery chain
|
// tgroup delivery - setup a second delivery chain
|
||||||
// prevent delivery looping - only proceed
|
// prevent delivery looping - only proceed
|
||||||
@ -2273,6 +2281,58 @@ function tgroup_check($uid,$item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function check_item_source($uid,$item)
|
||||||
|
* @param $uid
|
||||||
|
* @param $item
|
||||||
|
*
|
||||||
|
* @description
|
||||||
|
* Checks to see if this item owner is referenced as a source for this channel and if the post
|
||||||
|
* matches the rules for inclusion in this channel. Returns true if we should create a second delivery
|
||||||
|
* chain and false if none of the rules apply, or if the item is private.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function check_item_source($uid,$item) {
|
||||||
|
|
||||||
|
if($item['item_private'])
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
|
$r = q("select * from source where src_channel_id = %d and src_xchan = '%s' limit 1",
|
||||||
|
intval($uid),
|
||||||
|
dbesc($item['owner_xchan'])
|
||||||
|
);
|
||||||
|
|
||||||
|
if(! $r)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if($r[0]['src_channel_xchan'] === $item['owner_xchan'])
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(! $r[0]['src_patt'])
|
||||||
|
return true;
|
||||||
|
|
||||||
|
$tags = ((count($items['term'])) ? $items['term'] : false);
|
||||||
|
|
||||||
|
$words = explode("\n",$r[0]['src_patt']);
|
||||||
|
if($words) {
|
||||||
|
foreach($words as $word) {
|
||||||
|
if(substr($word,0,1) === '#' && $tags) {
|
||||||
|
foreach($tags as $t)
|
||||||
|
if($t['type'] == TERM_HASHTAG && substr($t,1) === $word)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(stristr($item['body'],$word) !== false)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function mail_store($arr) {
|
function mail_store($arr) {
|
||||||
|
|
||||||
if(! $arr['channel_id']) {
|
if(! $arr['channel_id']) {
|
||||||
|
Reference in New Issue
Block a user