diff options
author | Mario <mario@mariovavti.com> | 2022-11-05 09:50:55 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-11-05 09:50:55 +0000 |
commit | 7fc9c83986d0ca0707c408b77f2acfb954532c42 (patch) | |
tree | f65e899b792ef86f99539b06232e5baf2fe80714 /Zotlabs/Lib/Libzot.php | |
parent | 81b02d04b5c486ed5b23467b25e1441ed6d37da9 (diff) | |
parent | 5502f1cc63d87bed8198d360ae0e8e7c5fa58f44 (diff) | |
download | volse-hubzilla-7fc9c83986d0ca0707c408b77f2acfb954532c42.tar.gz volse-hubzilla-7fc9c83986d0ca0707c408b77f2acfb954532c42.tar.bz2 volse-hubzilla-7fc9c83986d0ca0707c408b77f2acfb954532c42.zip |
Merge branch 'dev'
Diffstat (limited to 'Zotlabs/Lib/Libzot.php')
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index cbb614429..b0d33e055 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -1172,10 +1172,14 @@ class Libzot { return; } if (is_array($AS->obj)) { - $arr = Activity::decode_note($AS); + $item = Activity::decode_note($AS); + if (!$item) { + logger('Could not decode activity: ' . print_r($AS, true)); + return; + } } else { - $arr = []; + $item = []; } logger($AS->debug(), LOGGER_DATA); @@ -1260,15 +1264,15 @@ class Libzot { if ($r) { $r = self::zot_record_preferred($r); - $arr['author_xchan'] = $r['hubloc_hash']; + $item['author_xchan'] = $r['hubloc_hash']; } - if (! $arr['author_xchan']) { + if (! $item['author_xchan']) { logger('No author!'); return; } - $arr['owner_xchan'] = $env['sender']; + $item['owner_xchan'] = $env['sender']; if(filter_var($env['sender'], FILTER_VALIDATE_URL)) { // in individual delivery, change owner if needed @@ -1277,67 +1281,67 @@ class Libzot { ); if ($s) { - $arr['owner_xchan'] = $s[0]['hubloc_hash']; + $item['owner_xchan'] = $s[0]['hubloc_hash']; } } - if (! $arr['owner_xchan']) { + if (! $item['owner_xchan']) { logger('No owner!'); return; } - if ($private && (!intval($arr['item_private']))) { - $arr['item_private'] = 1; + if ($private && (!intval($item['item_private']))) { + $item['item_private'] = 1; } - if ($arr['mid'] === $arr['parent_mid']) { + if ($item['mid'] === $item['parent_mid']) { if (is_array($AS->obj) && array_key_exists('commentPolicy', $AS->obj)) { $p = strstr($AS->obj['commentPolicy'], 'until='); if ($p !== false) { $comments_closed_at = datetime_convert('UTC', 'UTC', substr($p, 6)); - if ($comments_closed_at === $arr['created']) { - $arr['item_nocomment'] = 1; + if ($comments_closed_at === $item['created']) { + $item['item_nocomment'] = 1; } else { - $arr['comments_closed'] = $comments_closed_at; - $arr['comment_policy'] = trim(str_replace($p, '', $AS->obj['commentPolicy'])); + $item['comments_closed'] = $comments_closed_at; + $aritemr['comment_policy'] = trim(str_replace($p, '', $AS->obj['commentPolicy'])); } } else { - $arr['comment_policy'] = $AS->obj['commentPolicy']; + $item['comment_policy'] = $AS->obj['commentPolicy']; } } } if (isset($AS->meta['hubloc']) && $AS->meta['hubloc']) { - $arr['item_verified'] = true; + $item['item_verified'] = true; } - if (!array_key_exists('comment_policy', $arr)) { - $arr['comment_policy'] = 'authenticated'; + if (!array_key_exists('comment_policy', $item)) { + $item['comment_policy'] = 'authenticated'; } if (isset($AS->meta['signed_data']) && $AS->meta['signed_data']) { - IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false); + IConfig::Set($item, 'activitypub', 'signed_data', $AS->meta['signed_data'], false); } - logger('Activity received: ' . print_r($arr, true), LOGGER_DATA, LOG_DEBUG); + logger('Activity received: ' . print_r($item, true), LOGGER_DATA, LOG_DEBUG); logger('Activity recipients: ' . print_r($deliveries, true), LOGGER_DATA, LOG_DEBUG); $relay = (($env['type'] === 'response') ? true : false); - $result = self::process_delivery($env['sender'], $AS, $arr, $deliveries, $relay, false, $message_request); + $result = self::process_delivery($env['sender'], $AS, $item, $deliveries, $relay, false, $message_request); } elseif ($env['type'] === 'sync') { - // $arr = get_channelsync_elements($data); + // $item = get_channelsync_elements($data); - $arr = json_decode($data, true); + $item = json_decode($data, true); - logger('Channel sync received: ' . print_r($arr, true), LOGGER_DATA, LOG_DEBUG); + logger('Channel sync received: ' . print_r($item, true), LOGGER_DATA, LOG_DEBUG); logger('Channel sync recipients: ' . print_r($deliveries, true), LOGGER_DATA, LOG_DEBUG); if ($env['encoding'] === 'hz') { - $result = Libsync::process_channel_sync_delivery($env['sender'], $arr, $deliveries); + $result = Libsync::process_channel_sync_delivery($env['sender'], $item, $deliveries); } else { logger('sync packet type not supported.'); @@ -1920,7 +1924,7 @@ class Libzot { // preserve conversations with which you are involved from expiration - $stored = (($item_result && $item_result['item']) ? $item_result['item'] : false); + $stored = ((isset($item_result['item'])) ? $item_result['item'] : false); if ((is_array($stored)) && ($stored['id'] != $stored['parent']) && ($stored['author_xchan'] === $channel['channel_hash'])) { retain_item($stored['item']['parent']); |