aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-31 16:30:04 -0700
committerfriendica <info@friendica.com>2014-03-31 16:30:04 -0700
commit03c53502cb7770d9994776d9a2818c4621befb66 (patch)
tree70e3fb10379dfb3adc324aa289dca73e80bf4856 /include/items.php
parent57a9ba4574e61a803c0a732135fe457733901850 (diff)
parent421df717fecba69a952167ceb8cb4e58f0b4db39 (diff)
downloadvolse-hubzilla-03c53502cb7770d9994776d9a2818c4621befb66.tar.gz
volse-hubzilla-03c53502cb7770d9994776d9a2818c4621befb66.tar.bz2
volse-hubzilla-03c53502cb7770d9994776d9a2818c4621befb66.zip
Merge branch 'route'
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php
index cf2bdd4f3..ec324b6a3 100755
--- a/include/items.php
+++ b/include/items.php
@@ -81,6 +81,19 @@ function collect_recipients($item,&$private) {
$recipients = check_list_permissions($item['uid'],$recipients,'view_stream');
+ // remove any upstream recipients from our list.
+ // If it is ourself we'll add it back in a second.
+ // This should prevent complex delivery chains from getting overly complex by not
+ // sending to anybody who is on our list of those who sent it to us.
+
+ if($item['route']) {
+ $route = explode(',',$item['route']);
+ if(count($route)) {
+ $route = array_unique($route);
+ $recipients = array_diff($recipients,$route);
+ }
+ }
+
// add ourself just in case we have nomadic clones that need to get a copy.
$recipients[] = $item['author_xchan'];
@@ -141,6 +154,23 @@ function can_comment_on_post($observer_xchan,$item) {
}
+function add_source_route($iid,$hash) {
+ if((! $iid) || (! $route))
+ return;
+ $r = q("select route from item where id = %d limit 1",
+ intval($iid)
+ );
+ if($r) {
+ $new_route = (($r[0]['route']) ? $r[0]['route'] . ',' : '') . $hash;
+ q("update item set route = '%s' where id = %d limit 1",
+ (dbesc($new_route)),
+ intval($iid)
+ );
+ }
+}
+
+
+
/**
* @function red_zrl_callback
* preg_match function when fixing 'naked' links in mod item.php
@@ -636,6 +666,7 @@ function get_item_elements($x) {
$arr['app'] = (($x['app']) ? htmlspecialchars($x['app'], ENT_COMPAT,'UTF-8',false) : '');
+ $arr['route'] = (($x['route']) ? htmlspecialchars($x['route'], ENT_COMPAT,'UTF-8',false) : '');
$arr['mid'] = (($x['message_id']) ? htmlspecialchars($x['message_id'], ENT_COMPAT,'UTF-8',false) : '');
$arr['parent_mid'] = (($x['message_top']) ? htmlspecialchars($x['message_top'], ENT_COMPAT,'UTF-8',false) : '');
$arr['thr_parent'] = (($x['message_parent']) ? htmlspecialchars($x['message_parent'], ENT_COMPAT,'UTF-8',false) : '');
@@ -647,7 +678,7 @@ function get_item_elements($x) {
$arr['mimetype'] = (($x['mimetype']) ? htmlspecialchars($x['mimetype'], ENT_COMPAT,'UTF-8',false) : '');
$arr['obj_type'] = (($x['object_type']) ? htmlspecialchars($x['object_type'], ENT_COMPAT,'UTF-8',false) : '');
$arr['tgt_type'] = (($x['target_type']) ? htmlspecialchars($x['target_type'], ENT_COMPAT,'UTF-8',false) : '');
- $arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts');
+ $arr['comment_policy'] = (($x['comment_scope']) ? htmlspecialchars($x['comment_scope'], ENT_COMPAT,'UTF-8',false) : 'contacts');
$arr['sig'] = (($x['signature']) ? htmlspecialchars($x['signature'], ENT_COMPAT,'UTF-8',false) : '');
@@ -836,6 +867,7 @@ function encode_item($item) {
$x['location'] = $item['location'];
$x['longlat'] = $item['coord'];
$x['signature'] = $item['sig'];
+ $x['route'] = $item['route'];
$x['owner'] = encode_item_xchan($item['owner']);
$x['author'] = encode_item_xchan($item['author']);