From 49108c230b4d3a4aac74f2139ccc23019be23e38 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 14 Dec 2015 17:58:39 -0800 Subject: regenerate the item body for linked photo items that now have no body to provide legal activities when going to other networks. Remove the signature since the signed text was an empty string and we've just replaced it with content that will not verify. --- include/items.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 8c2e7deb2..4d49a5191 100755 --- a/include/items.php +++ b/include/items.php @@ -3950,6 +3950,16 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { return '' . "\r\n"; + // since November 2015 linked photo items don't or at least may not have a body. Recreate one. + + if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO) && (! trim($item['body']))) { + $j = json_decode($item['object'],true); + if($j) { + $item['body'] = $j['bbcode']; + $item['sig'] = ''; + } + } + if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) $body = fix_private_photos($item['body'],$owner['uid'],$item,$cid); else -- cgit v1.2.3 From 2924b9182e787d0266e433169b1db1c3fdd359a7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 15 Dec 2015 15:01:54 -0800 Subject: revise the photo activity a bit so that we always have a valid activity body. Several network connectors can get empty posts or posts that don't contain any reference whatsoever to the actual photo. Since this can cause duplicate images on our own site, just provide the activity summary and any included body text to the activity by default. Provide a function to enhance this activity with an actual photo which can be applied on demand for any network connectors that desire it. Otherwise they'll just get a link to the photo in the activity statement - which is better than an empty post. Have applied this "add actual photo to the post" function to both Diaspora and RSS feeds. Also provide the album as the activity target. --- include/items.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 4d49a5191..7343f7165 100755 --- a/include/items.php +++ b/include/items.php @@ -3950,15 +3950,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { return '' . "\r\n"; - // since November 2015 linked photo items don't or at least may not have a body. Recreate one. - - if(($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO) && (! trim($item['body']))) { - $j = json_decode($item['object'],true); - if($j) { - $item['body'] = $j['bbcode']; - $item['sig'] = ''; - } - } + create_export_photo_body($item); if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid']) $body = fix_private_photos($item['body'],$owner['uid'],$item,$cid); -- cgit v1.2.3 From 1b9722c65ac2169cadcf78376aaaf9d82721c9cd Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 17 Dec 2015 18:16:46 -0800 Subject: loop detection --- include/items.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 7343f7165..44f9633a9 100755 --- a/include/items.php +++ b/include/items.php @@ -3335,7 +3335,6 @@ function start_delivery_chain($channel, $item, $item_id, $parent) { if((! $private) && $new_public_policy) $private = 1; - $item_wall = 1; $item_origin = 1; $item_uplink = 0; @@ -3386,8 +3385,13 @@ function start_delivery_chain($channel, $item, $item_id, $parent) { if($r) proc_run('php','include/notifier.php','tgroup',$item_id); - else + else { logger('start_delivery_chain: failed to update item'); + // reset the source xchan to prevent loops + $r = q("update item set source_xchan = '' where id = %d", + intval($item_id) + ); + } } /** -- cgit v1.2.3