diff options
Diffstat (limited to 'Zotlabs/Lib')
| -rw-r--r-- | Zotlabs/Lib/Activity.php | 6 | ||||
| -rw-r--r-- | Zotlabs/Lib/Libsync.php | 15 | ||||
| -rw-r--r-- | Zotlabs/Lib/Libzot.php | 4 | ||||
| -rw-r--r-- | Zotlabs/Lib/Share.php | 8 | ||||
| -rw-r--r-- | Zotlabs/Lib/ThreadItem.php | 4 |
5 files changed, 11 insertions, 26 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index b6f38df20..22dbaad84 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -637,7 +637,9 @@ class Activity { $ret['tag'] = $t; } - if (str_contains($i['body'], '[/share]')) { + // TODO: Do not replace the if the owner is a forum. + // Receivers will not be able to fetch the original in that case. + if (str_contains($i['body'], '[/share]') && !$i['owner']['xchan_pubforum']) { preg_match_all('/\[share(.*?)\[\/share\]/ism', $i['body'], $all_shares, PREG_SET_ORDER); $quote_urls = []; @@ -2351,7 +2353,7 @@ class Activity { continue; } - $s['body'] = self::pasteQuote($s['body'], $quote); + $s['body'] = self::pasteQuote($s['body'] ?? EMPTY_STR, $quote); $s['term'] = $quote['term']; } } diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index c6b149738..63e78159e 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -199,8 +199,7 @@ class Libsync { dbesc($sender) ); - $mid = 'sync'; - + $mid = $arr['item'][0]['message_id'] ?? 'sync'; $DR = new DReport(z_root(), $sender, $d, $mid); @@ -306,15 +305,8 @@ class Libsync { if (array_key_exists('item', $arr) && $arr['item']) { sync_items($channel, $arr['item'], ((array_key_exists('relocate', $arr)) ? $arr['relocate'] : null)); - $mid = $arr['item'][0]['message_id'] . '#sync'; } - // deprecated, maintaining for a few months for upward compatibility - // this should sync webpages, but the logic is a bit subtle - - //if (array_key_exists('item_id', $arr) && $arr['item_id']) - // sync_items($channel, $arr['item_id']); - if (array_key_exists('menu', $arr) && $arr['menu']) sync_menus($channel, $arr['menu']); @@ -757,12 +749,11 @@ class Libsync { */ call_hooks('process_channel_sync_delivery', $addon); - $DR = new DReport(z_root(), $d, $d, $mid, 'channel sync processed'); - - $DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>'); + $DR->update('channel sync processed'); $result[] = $DR->get(); } + return $result; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index d2d696356..08a3f27c9 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -116,10 +116,6 @@ class Libzot { } if ($msg) { - $actors = get_hubloc_id_urls_by_x($channel['channel_hash']); - if ($encoding === 'activitystreams' && array_key_exists('actor', $msg) && is_string($msg['actor']) && in_array($msg['actor'], $actors)) { - $msg = JSalmon::sign($msg, $actors[0], $channel['channel_prvkey']); - } $data['data'] = $msg; } else { diff --git a/Zotlabs/Lib/Share.php b/Zotlabs/Lib/Share.php index 8abbfda80..0bcee5247 100644 --- a/Zotlabs/Lib/Share.php +++ b/Zotlabs/Lib/Share.php @@ -118,11 +118,8 @@ class Share { $photo_bb = $object['body']; } - if (strpos($this->item['body'], "[/share]") !== false) { - $pos = strpos($this->item['body'], "[share"); - $bb = substr($this->item['body'], $pos); - } else { - $bb = "[share author='".urlencode($this->item['author']['xchan_name']). + if (!str_contains($this->item['body'], '[/share]')) { + $bb .= "[share author='".urlencode($this->item['author']['xchan_name']). "' profile='" . $this->item['author']['xchan_url'] . "' avatar='" . $this->item['author']['xchan_photo_s'] . "' link='" . $this->item['plink'] . @@ -137,7 +134,6 @@ class Share { } return $bb; - } } diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 46fe6d815..ff27bba44 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -120,10 +120,10 @@ class ThreadItem { $locktype = 0; } - $shareable = ((local_channel() && $conv->get_profile_owner() == local_channel()) && (intval($item['item_private']) === 0)); + $shareable = ((local_channel() && $conv->get_profile_owner() == local_channel()) && (intval($item['item_private']) === 0) && !str_contains($item['body'], '[/share]')); // allow an exemption for sharing stuff from your private feeds - if($item['author']['xchan_network'] === 'rss') + if ($item['author']['xchan_network'] === 'rss') $shareable = true; $repeatable = ((local_channel() && $conv->get_profile_owner() == local_channel()) && intval($item['item_private']) === 0 && in_array($item['author']['xchan_network'], ['zot6', 'activitypub'])); |
