From a105caf833915d9fdaea62937210a1e99169799a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 8 Dec 2020 09:57:58 -0500 Subject: [PATCH 1/3] Use App\Arguments instead of App->args in theme/vier/theme - Address https://github.com/friendica/friendica/issues/9252#issuecomment-740069639 --- view/theme/vier/theme.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/view/theme/vier/theme.php b/view/theme/vier/theme.php index b57d7dc1c..4d11b1cd4 100644 --- a/view/theme/vier/theme.php +++ b/view/theme/vier/theme.php @@ -25,7 +25,10 @@ function vier_init(App $a) Renderer::setActiveTemplateEngine('smarty3'); - if (!empty($a->argv[0]) && ($a->argv[0] . ($a->argv[1] ?? '')) === ('profile' . ($a->user['nickname'] ?? '')) || $a->argv[0] === 'network' && local_user()) { + $args = DI::args(); + + if ($args->get(0) === 'profile' && $args->get(1) === ($a->user['nickname'] ?? '') || $args->get(0) === 'network' && local_user() + ) { vier_community_info(); DI::page()['htmlhead'] .= "\n"; @@ -77,7 +80,7 @@ EOT; // Hide the left menu bar /// @TODO maybe move this static array out where it should belong? - if (empty(DI::page()['aside']) && in_array($a->argv[0], ["community", "events", "help", "delegation", "notifications", + if (empty(DI::page()['aside']) && in_array($args->get(0), ["community", "events", "help", "delegation", "notifications", "probe", "webfinger", "login", "invite", "credits"])) { DI::page()['htmlhead'] .= ""; } From 99828c0feada6c59e0edaa0939af2f0632f505ac Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 8 Dec 2020 10:00:09 -0500 Subject: [PATCH 2/3] Suppress notice message when guid isn't supplied in Module\Admin\Item\Source - https://github.com/friendica/friendica/issues/9252#issuecomment-740052103 --- src/Module/Admin/Item/Source.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Admin/Item/Source.php b/src/Module/Admin/Item/Source.php index f736582fa..6e917eb16 100644 --- a/src/Module/Admin/Item/Source.php +++ b/src/Module/Admin/Item/Source.php @@ -33,7 +33,7 @@ class Source extends BaseAdmin { parent::content($parameters); - $guid = basename($_REQUEST['guid'] ?? '') ?: $parameters['guid']; + $guid = basename($_REQUEST['guid'] ?? $parameters['guid'] ?? ''); $source = ''; $item_uri = ''; From c7a2988454a9698af5fd215e7f5706e879e5873d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 8 Dec 2020 10:08:49 -0500 Subject: [PATCH 3/3] Check for the existence of array key before using it in Protocol\ActivityPub\Transmitter - Address https://github.com/friendica/friendica/issues/9252#issuecomment-739534960 --- src/Module/Objects.php | 4 ++++ src/Protocol/ActivityPub/Transmitter.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Module/Objects.php b/src/Module/Objects.php index 1658507d5..cbe2e53fe 100644 --- a/src/Module/Objects.php +++ b/src/Module/Objects.php @@ -103,6 +103,10 @@ class Objects extends BaseModule if (empty($parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) { $activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true); + if (empty($activity['type'])) { + throw new HTTPException\NotFoundException(); + } + $activity['type'] = $activity['type'] == 'Update' ? 'Create' : $activity['type']; // Only display "Create" activity objects here, no reshares or anything else diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 7f5f51c38..c1443bc33 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1003,10 +1003,10 @@ class Transmitter * @param integer $item_id * @param boolean $object_mode Is the activity item is used inside another object? * - * @return array of activity + * @return false|array * @throws \Exception */ - public static function createActivityFromItem($item_id, $object_mode = false) + public static function createActivityFromItem(int $item_id, bool $object_mode = false) { Logger::info('Fetching activity', ['item' => $item_id]); $item = Item::selectFirst([], ['id' => $item_id, 'parent-network' => Protocol::NATIVE_SUPPORT]);