From 81279dad9e073367dcb133967221d224a0b2e3c1 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 21 Sep 2023 12:16:17 -0400 Subject: [PATCH] Move System::jsonExit to BaseModule->jsonExit - This will ensure headers set in BaseModule->run will be carried in jsonExit scenarios - Deprecate jsonExit() method in Core\System --- src/BaseModule.php | 15 +++++++++++++++ src/Core/System.php | 12 +++++------- src/Module/AccountManagementControlDocument.php | 2 +- src/Module/ActivityPub/Featured.php | 2 +- src/Module/ActivityPub/Followers.php | 2 +- src/Module/ActivityPub/Following.php | 2 +- src/Module/ActivityPub/Inbox.php | 2 +- src/Module/ActivityPub/Objects.php | 2 +- src/Module/ActivityPub/Outbox.php | 4 ++-- src/Module/ActivityPub/Whoami.php | 2 +- src/Module/Api/Friendica/Statuses/Dislike.php | 2 +- src/Module/Api/Friendica/Statuses/DislikedBy.php | 2 +- src/Module/Api/Friendica/Statuses/Undislike.php | 2 +- src/Module/Api/Mastodon/Accounts.php | 2 +- src/Module/Api/Mastodon/Accounts/Block.php | 2 +- .../Api/Mastodon/Accounts/FeaturedTags.php | 2 +- src/Module/Api/Mastodon/Accounts/Follow.php | 2 +- src/Module/Api/Mastodon/Accounts/Followers.php | 2 +- src/Module/Api/Mastodon/Accounts/Following.php | 2 +- .../Api/Mastodon/Accounts/IdentityProofs.php | 2 +- src/Module/Api/Mastodon/Accounts/Lists.php | 2 +- src/Module/Api/Mastodon/Accounts/Mute.php | 2 +- src/Module/Api/Mastodon/Accounts/Note.php | 2 +- .../Api/Mastodon/Accounts/Relationships.php | 2 +- src/Module/Api/Mastodon/Accounts/Search.php | 2 +- src/Module/Api/Mastodon/Accounts/Statuses.php | 2 +- src/Module/Api/Mastodon/Accounts/Unblock.php | 2 +- src/Module/Api/Mastodon/Accounts/Unfollow.php | 2 +- src/Module/Api/Mastodon/Accounts/Unmute.php | 2 +- src/Module/Api/Mastodon/Announcements.php | 2 +- src/Module/Api/Mastodon/Apps.php | 4 ++-- .../Api/Mastodon/Apps/VerifyCredentials.php | 2 +- src/Module/Api/Mastodon/Blocks.php | 2 +- src/Module/Api/Mastodon/Bookmarks.php | 2 +- src/Module/Api/Mastodon/Conversations.php | 4 ++-- src/Module/Api/Mastodon/Conversations/Read.php | 2 +- src/Module/Api/Mastodon/CustomEmojis.php | 2 +- src/Module/Api/Mastodon/Directory.php | 2 +- src/Module/Api/Mastodon/Endorsements.php | 2 +- src/Module/Api/Mastodon/Favourited.php | 2 +- src/Module/Api/Mastodon/Filters.php | 2 +- src/Module/Api/Mastodon/FollowRequests.php | 4 ++-- src/Module/Api/Mastodon/FollowedTags.php | 2 +- src/Module/Api/Mastodon/Instance.php | 2 +- src/Module/Api/Mastodon/Instance/Peers.php | 2 +- src/Module/Api/Mastodon/Instance/Rules.php | 2 +- src/Module/Api/Mastodon/InstanceV2.php | 2 +- src/Module/Api/Mastodon/Lists.php | 6 +++--- src/Module/Api/Mastodon/Lists/Accounts.php | 2 +- src/Module/Api/Mastodon/Markers.php | 4 ++-- src/Module/Api/Mastodon/Media.php | 8 ++++---- src/Module/Api/Mastodon/Mutes.php | 2 +- src/Module/Api/Mastodon/Notifications.php | 6 +++--- src/Module/Api/Mastodon/Notifications/Clear.php | 2 +- .../Api/Mastodon/Notifications/Dismiss.php | 2 +- src/Module/Api/Mastodon/Polls.php | 2 +- src/Module/Api/Mastodon/Preferences.php | 2 +- src/Module/Api/Mastodon/Reports.php | 2 +- src/Module/Api/Mastodon/ScheduledStatuses.php | 6 +++--- src/Module/Api/Mastodon/Search.php | 2 +- src/Module/Api/Mastodon/Statuses.php | 12 ++++++------ src/Module/Api/Mastodon/Statuses/Bookmark.php | 2 +- src/Module/Api/Mastodon/Statuses/Card.php | 2 +- src/Module/Api/Mastodon/Statuses/Context.php | 2 +- src/Module/Api/Mastodon/Statuses/Favourite.php | 2 +- .../Api/Mastodon/Statuses/FavouritedBy.php | 2 +- src/Module/Api/Mastodon/Statuses/Mute.php | 2 +- src/Module/Api/Mastodon/Statuses/Pin.php | 2 +- src/Module/Api/Mastodon/Statuses/Reblog.php | 2 +- src/Module/Api/Mastodon/Statuses/RebloggedBy.php | 2 +- src/Module/Api/Mastodon/Statuses/Source.php | 2 +- src/Module/Api/Mastodon/Statuses/Unbookmark.php | 2 +- src/Module/Api/Mastodon/Statuses/Unfavourite.php | 2 +- src/Module/Api/Mastodon/Statuses/Unmute.php | 2 +- src/Module/Api/Mastodon/Statuses/Unpin.php | 2 +- src/Module/Api/Mastodon/Statuses/Unreblog.php | 2 +- src/Module/Api/Mastodon/Suggestions.php | 2 +- src/Module/Api/Mastodon/Tags.php | 2 +- src/Module/Api/Mastodon/Tags/Follow.php | 2 +- src/Module/Api/Mastodon/Tags/Unfollow.php | 2 +- src/Module/Api/Mastodon/Timelines/Direct.php | 2 +- src/Module/Api/Mastodon/Timelines/Home.php | 2 +- .../Api/Mastodon/Timelines/ListTimeline.php | 2 +- .../Api/Mastodon/Timelines/PublicTimeline.php | 2 +- src/Module/Api/Mastodon/Timelines/Tag.php | 2 +- src/Module/Api/Mastodon/Trends/Links.php | 2 +- src/Module/Api/Mastodon/Trends/Statuses.php | 2 +- src/Module/Api/Mastodon/Trends/Tags.php | 2 +- src/Module/Api/Twitter/Blocks/Ids.php | 2 +- src/Module/Api/Twitter/Followers/Ids.php | 2 +- src/Module/Api/Twitter/Friends/Ids.php | 2 +- src/Module/BaseNotifications.php | 2 +- src/Module/Calendar/Event/Get.php | 2 +- src/Module/Circle.php | 2 +- src/Module/Friendica.php | 4 ++-- src/Module/Hashtag.php | 4 ++-- src/Module/Item/Activity.php | 2 +- src/Module/Item/Follow.php | 2 +- src/Module/Item/Ignore.php | 2 +- src/Module/Item/Pin.php | 2 +- src/Module/Item/Star.php | 2 +- src/Module/Manifest.php | 2 +- src/Module/NoScrape.php | 4 ++-- src/Module/Notifications/Notification.php | 2 +- src/Module/Notifications/Ping.php | 2 +- src/Module/OAuth/Revoke.php | 2 +- src/Module/OAuth/Token.php | 2 +- src/Module/Owa.php | 2 +- src/Module/ParseUrl.php | 4 ++-- src/Module/Profile/Profile.php | 2 +- src/Module/Search/Acl.php | 2 +- src/Module/Search/Tags.php | 6 +++--- src/Module/Smilies.php | 2 +- src/Module/Statistics.php | 2 +- src/Module/ThemeDetails.php | 2 +- src/Module/User/PortableContacts.php | 2 +- src/Module/WellKnown/NodeInfo.php | 16 +++------------- src/Module/WellKnown/XSocialRelay.php | 2 +- src/Module/Xrd.php | 4 ++-- 119 files changed, 165 insertions(+), 162 deletions(-) diff --git a/src/BaseModule.php b/src/BaseModule.php index 5ebeec3c8..463954f00 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -495,4 +495,19 @@ abstract class BaseModule implements ICanHandleRequests $this->httpExit($content); } + + /** + * Display the response using JSON to encode the content + * + * @param mixed $content + * @param string $content_type + * @param int $options A combination of json_encode() binary flags + * @return void + * @throws HTTPException\InternalServerErrorException + * @see json_encode() + */ + public function jsonExit($content, string $content_type = 'application/json', int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) + { + $this->httpExit(json_encode($content, $options), ICanCreateResponses::TYPE_JSON, $content_type); + } } diff --git a/src/Core/System.php b/src/Core/System.php index 48a4ce614..6af4186a3 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -392,14 +392,12 @@ class System * @param mixed $content The input content * @param string $content_type Type of the input (Default: 'application/json') * @param integer $options JSON options - * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws InternalServerErrorException + * @deprecated since 2023.09 Use BaseModule->jsonExit instead */ - public static function jsonExit($content, $content_type = 'application/json', int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) { - DI::apiResponse()->setType(Response::TYPE_JSON, $content_type); - DI::apiResponse()->addContent(json_encode($content, $options)); - self::echoResponse(DI::apiResponse()->generate()); - - self::exit(); + public static function jsonExit($content, string $content_type = 'application/json', int $options = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) + { + self::httpExit(json_encode($content, $options), Response::TYPE_JSON, $content_type); } /** diff --git a/src/Module/AccountManagementControlDocument.php b/src/Module/AccountManagementControlDocument.php index 4f015e45b..19cb45822 100644 --- a/src/Module/AccountManagementControlDocument.php +++ b/src/Module/AccountManagementControlDocument.php @@ -79,6 +79,6 @@ class AccountManagementControlDocument extends BaseModule ], ]; - System::jsonExit($output); + $this->jsonExit($output); } } diff --git a/src/Module/ActivityPub/Featured.php b/src/Module/ActivityPub/Featured.php index 8e9709718..57934cf33 100644 --- a/src/Module/ActivityPub/Featured.php +++ b/src/Module/ActivityPub/Featured.php @@ -46,6 +46,6 @@ class Featured extends BaseModule $featured = ActivityPub\Transmitter::getFeatured($owner, $page); - System::jsonExit($featured, 'application/activity+json'); + $this->jsonExit($featured, 'application/activity+json'); } } diff --git a/src/Module/ActivityPub/Followers.php b/src/Module/ActivityPub/Followers.php index 1b9bdbb0f..8bcb2a899 100644 --- a/src/Module/ActivityPub/Followers.php +++ b/src/Module/ActivityPub/Followers.php @@ -49,6 +49,6 @@ class Followers extends BaseModule $followers = ActivityPub\Transmitter::getContacts($owner, [Contact::FOLLOWER, Contact::FRIEND], 'followers', $page, (string)HTTPSignature::getSigner('', $_SERVER)); - System::jsonExit($followers, 'application/activity+json'); + $this->jsonExit($followers, 'application/activity+json'); } } diff --git a/src/Module/ActivityPub/Following.php b/src/Module/ActivityPub/Following.php index ae2709611..1fc5eefd7 100644 --- a/src/Module/ActivityPub/Following.php +++ b/src/Module/ActivityPub/Following.php @@ -47,6 +47,6 @@ class Following extends BaseModule $following = ActivityPub\Transmitter::getContacts($owner, [Contact::SHARING, Contact::FRIEND], 'following', $page); - System::jsonExit($following, 'application/activity+json'); + $this->jsonExit($following, 'application/activity+json'); } } diff --git a/src/Module/ActivityPub/Inbox.php b/src/Module/ActivityPub/Inbox.php index 77085c119..10e4c9db0 100644 --- a/src/Module/ActivityPub/Inbox.php +++ b/src/Module/ActivityPub/Inbox.php @@ -66,7 +66,7 @@ class Inbox extends BaseApi $inbox = ActivityPub\ClientToServer::getPublicInbox($uid, $page, $request['max_id'] ?? null); } - System::jsonExit($inbox, 'application/activity+json'); + $this->jsonExit($inbox, 'application/activity+json'); } protected function post(array $request = []) diff --git a/src/Module/ActivityPub/Objects.php b/src/Module/ActivityPub/Objects.php index 34d460951..bbb008690 100644 --- a/src/Module/ActivityPub/Objects.php +++ b/src/Module/ActivityPub/Objects.php @@ -130,6 +130,6 @@ class Objects extends BaseModule // Relaxed CORS header for public items header('Access-Control-Allow-Origin: *'); - System::jsonExit($data, 'application/activity+json'); + $this->jsonExit($data, 'application/activity+json'); } } diff --git a/src/Module/ActivityPub/Outbox.php b/src/Module/ActivityPub/Outbox.php index 492971bba..3dc0f00e7 100644 --- a/src/Module/ActivityPub/Outbox.php +++ b/src/Module/ActivityPub/Outbox.php @@ -53,7 +53,7 @@ class Outbox extends BaseApi $outbox = ActivityPub\ClientToServer::getOutbox($owner, $uid, $page, $request['max_id'] ?? null, HTTPSignature::getSigner('', $_SERVER)); - System::jsonExit($outbox, 'application/activity+json'); + $this->jsonExit($outbox, 'application/activity+json'); } protected function post(array $request = []) @@ -79,6 +79,6 @@ class Outbox extends BaseApi throw new \Friendica\Network\HTTPException\BadRequestException(); } - System::jsonExit(ActivityPub\ClientToServer::processActivity($activity, $uid, self::getCurrentApplication() ?? [])); + $this->jsonExit(ActivityPub\ClientToServer::processActivity($activity, $uid, self::getCurrentApplication() ?? [])); } } diff --git a/src/Module/ActivityPub/Whoami.php b/src/Module/ActivityPub/Whoami.php index cac21744f..67128d99c 100644 --- a/src/Module/ActivityPub/Whoami.php +++ b/src/Module/ActivityPub/Whoami.php @@ -100,6 +100,6 @@ class Whoami extends BaseApi ]; $data['generator'] = ActivityPub\Transmitter::getService(); - System::jsonExit($data, 'application/activity+json'); + $this->jsonExit($data, 'application/activity+json'); } } diff --git a/src/Module/Api/Friendica/Statuses/Dislike.php b/src/Module/Api/Friendica/Statuses/Dislike.php index e9690d485..01bfeba90 100644 --- a/src/Module/Api/Friendica/Statuses/Dislike.php +++ b/src/Module/Api/Friendica/Statuses/Dislike.php @@ -49,6 +49,6 @@ class Dislike extends BaseApi Item::performActivity($item['id'], 'dislike', $uid); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Friendica/Statuses/DislikedBy.php b/src/Module/Api/Friendica/Statuses/DislikedBy.php index 81860bc40..bb7888483 100644 --- a/src/Module/Api/Friendica/Statuses/DislikedBy.php +++ b/src/Module/Api/Friendica/Statuses/DislikedBy.php @@ -57,6 +57,6 @@ class DislikedBy extends BaseApi $accounts[] = DI::mstdnAccount()->createFromContactId($activity['author-id'], $uid); } - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Friendica/Statuses/Undislike.php b/src/Module/Api/Friendica/Statuses/Undislike.php index 933d7a1ed..4ede1fd94 100644 --- a/src/Module/Api/Friendica/Statuses/Undislike.php +++ b/src/Module/Api/Friendica/Statuses/Undislike.php @@ -49,6 +49,6 @@ class Undislike extends BaseApi Item::performActivity($item['id'], 'undislike', $uid); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts.php b/src/Module/Api/Mastodon/Accounts.php index 72dac3749..bd215e387 100644 --- a/src/Module/Api/Mastodon/Accounts.php +++ b/src/Module/Api/Mastodon/Accounts.php @@ -58,6 +58,6 @@ class Accounts extends BaseApi } $account = DI::mstdnAccount()->createFromContactId($id, $uid); - System::jsonExit($account); + $this->jsonExit($account); } } diff --git a/src/Module/Api/Mastodon/Accounts/Block.php b/src/Module/Api/Mastodon/Accounts/Block.php index e13a8b2ff..c4afb74a3 100644 --- a/src/Module/Api/Mastodon/Accounts/Block.php +++ b/src/Module/Api/Mastodon/Accounts/Block.php @@ -52,6 +52,6 @@ class Block extends BaseApi } } - System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts/FeaturedTags.php b/src/Module/Api/Mastodon/Accounts/FeaturedTags.php index f8687ce9a..52c0c2831 100644 --- a/src/Module/Api/Mastodon/Accounts/FeaturedTags.php +++ b/src/Module/Api/Mastodon/Accounts/FeaturedTags.php @@ -36,6 +36,6 @@ class FeaturedTags extends BaseApi { self::checkAllowedScope(self::SCOPE_READ); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/Accounts/Follow.php b/src/Module/Api/Mastodon/Accounts/Follow.php index c19ac3647..ad290f5ab 100644 --- a/src/Module/Api/Mastodon/Accounts/Follow.php +++ b/src/Module/Api/Mastodon/Accounts/Follow.php @@ -54,6 +54,6 @@ class Follow extends BaseApi Contact::update(['notify_new_posts' => $request['notify']], ['id' => $result['cid']]); - System::jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($result['cid'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts/Followers.php b/src/Module/Api/Mastodon/Accounts/Followers.php index e73c48855..65c7ac42d 100644 --- a/src/Module/Api/Mastodon/Accounts/Followers.php +++ b/src/Module/Api/Mastodon/Accounts/Followers.php @@ -115,6 +115,6 @@ class Followers extends BaseApi } self::setLinkHeader(); - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Accounts/Following.php b/src/Module/Api/Mastodon/Accounts/Following.php index 2aa0cad05..5da678d9d 100644 --- a/src/Module/Api/Mastodon/Accounts/Following.php +++ b/src/Module/Api/Mastodon/Accounts/Following.php @@ -115,6 +115,6 @@ class Following extends BaseApi } self::setLinkHeader(); - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Accounts/IdentityProofs.php b/src/Module/Api/Mastodon/Accounts/IdentityProofs.php index 8e2e7292b..ac2f2ab55 100644 --- a/src/Module/Api/Mastodon/Accounts/IdentityProofs.php +++ b/src/Module/Api/Mastodon/Accounts/IdentityProofs.php @@ -36,6 +36,6 @@ class IdentityProofs extends BaseApi { self::checkAllowedScope(self::SCOPE_READ); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/Accounts/Lists.php b/src/Module/Api/Mastodon/Accounts/Lists.php index e34dd4137..d39f79081 100644 --- a/src/Module/Api/Mastodon/Accounts/Lists.php +++ b/src/Module/Api/Mastodon/Accounts/Lists.php @@ -60,6 +60,6 @@ class Lists extends BaseApi DBA::close($circles); } - System::jsonExit($lists); + $this->jsonExit($lists); } } diff --git a/src/Module/Api/Mastodon/Accounts/Mute.php b/src/Module/Api/Mastodon/Accounts/Mute.php index d5c708c77..f08e48154 100644 --- a/src/Module/Api/Mastodon/Accounts/Mute.php +++ b/src/Module/Api/Mastodon/Accounts/Mute.php @@ -42,6 +42,6 @@ class Mute extends BaseApi Contact\User::setIgnored($this->parameters['id'], $uid, true); - System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts/Note.php b/src/Module/Api/Mastodon/Accounts/Note.php index abf100f54..fc7e72247 100644 --- a/src/Module/Api/Mastodon/Accounts/Note.php +++ b/src/Module/Api/Mastodon/Accounts/Note.php @@ -52,6 +52,6 @@ class Note extends BaseApi Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]); - System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts/Relationships.php b/src/Module/Api/Mastodon/Accounts/Relationships.php index 074daa95d..531fcadd1 100644 --- a/src/Module/Api/Mastodon/Accounts/Relationships.php +++ b/src/Module/Api/Mastodon/Accounts/Relationships.php @@ -57,6 +57,6 @@ class Relationships extends BaseApi $relationships[] = DI::mstdnRelationship()->createFromContactId($id, $uid); } - System::jsonExit($relationships); + $this->jsonExit($relationships); } } diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php index 527616164..a4936092c 100644 --- a/src/Module/Api/Mastodon/Accounts/Search.php +++ b/src/Module/Api/Mastodon/Accounts/Search.php @@ -67,6 +67,6 @@ class Search extends BaseApi DBA::close($contacts); } - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index 4ee6ae66c..93b642cd6 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -122,6 +122,6 @@ class Statuses extends BaseApi } self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Accounts/Unblock.php b/src/Module/Api/Mastodon/Accounts/Unblock.php index c67186908..35b532012 100644 --- a/src/Module/Api/Mastodon/Accounts/Unblock.php +++ b/src/Module/Api/Mastodon/Accounts/Unblock.php @@ -42,6 +42,6 @@ class Unblock extends BaseApi Contact\User::setBlocked($this->parameters['id'], $uid, false); - System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts/Unfollow.php b/src/Module/Api/Mastodon/Accounts/Unfollow.php index b67e92f61..c4bc17200 100644 --- a/src/Module/Api/Mastodon/Accounts/Unfollow.php +++ b/src/Module/Api/Mastodon/Accounts/Unfollow.php @@ -49,6 +49,6 @@ class Unfollow extends BaseApi Contact::unfollow($contact); - System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Accounts/Unmute.php b/src/Module/Api/Mastodon/Accounts/Unmute.php index e3f903304..a2cf90820 100644 --- a/src/Module/Api/Mastodon/Accounts/Unmute.php +++ b/src/Module/Api/Mastodon/Accounts/Unmute.php @@ -42,6 +42,6 @@ class Unmute extends BaseApi Contact\User::setIgnored($this->parameters['id'], $uid, false); - System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Announcements.php b/src/Module/Api/Mastodon/Announcements.php index f04660948..8e0565947 100644 --- a/src/Module/Api/Mastodon/Announcements.php +++ b/src/Module/Api/Mastodon/Announcements.php @@ -37,6 +37,6 @@ class Announcements extends BaseApi self::checkAllowedScope(self::SCOPE_READ); // @todo Possibly use the message from the pageheader addon for this - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/Apps.php b/src/Module/Api/Mastodon/Apps.php index 40314a114..d51a8e7b0 100644 --- a/src/Module/Api/Mastodon/Apps.php +++ b/src/Module/Api/Mastodon/Apps.php @@ -66,7 +66,7 @@ class Apps extends BaseApi if (!empty($request['redirect_uris']) && is_array($request['redirect_uris'])) { $request['redirect_uris'] = $request['redirect_uris'][0]; - } + } } if (empty($request['client_name']) || empty($request['redirect_uris'])) { @@ -95,6 +95,6 @@ class Apps extends BaseApi DI::mstdnError()->InternalError(); } - System::jsonExit(DI::mstdnApplication()->createFromApplicationId(DBA::lastInsertId())->toArray()); + $this->jsonExit(DI::mstdnApplication()->createFromApplicationId(DBA::lastInsertId())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Apps/VerifyCredentials.php b/src/Module/Api/Mastodon/Apps/VerifyCredentials.php index ef9c775c1..c21e1e438 100644 --- a/src/Module/Api/Mastodon/Apps/VerifyCredentials.php +++ b/src/Module/Api/Mastodon/Apps/VerifyCredentials.php @@ -39,6 +39,6 @@ class VerifyCredentials extends BaseApi DI::mstdnError()->Unauthorized(); } - System::jsonExit(DI::mstdnApplication()->createFromApplicationId($application['id'])); + $this->jsonExit(DI::mstdnApplication()->createFromApplicationId($application['id'])); } } diff --git a/src/Module/Api/Mastodon/Blocks.php b/src/Module/Api/Mastodon/Blocks.php index 55e65b619..1495b7635 100644 --- a/src/Module/Api/Mastodon/Blocks.php +++ b/src/Module/Api/Mastodon/Blocks.php @@ -77,6 +77,6 @@ class Blocks extends BaseApi } self::setLinkHeader(); - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Bookmarks.php b/src/Module/Api/Mastodon/Bookmarks.php index 59cf7f54a..dab072b30 100644 --- a/src/Module/Api/Mastodon/Bookmarks.php +++ b/src/Module/Api/Mastodon/Bookmarks.php @@ -88,6 +88,6 @@ class Bookmarks extends BaseApi } self::setLinkHeader(); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Conversations.php b/src/Module/Api/Mastodon/Conversations.php index fa8804f54..abffff9ed 100644 --- a/src/Module/Api/Mastodon/Conversations.php +++ b/src/Module/Api/Mastodon/Conversations.php @@ -43,7 +43,7 @@ class Conversations extends BaseApi DBA::delete('conv', ['id' => $this->parameters['id'], 'uid' => $uid]); DBA::delete('mail', ['convid' => $this->parameters['id'], 'uid' => $uid]); - System::jsonExit([]); + $this->jsonExit([]); } /** @@ -95,6 +95,6 @@ class Conversations extends BaseApi } self::setLinkHeader(); - System::jsonExit($conversations); + $this->jsonExit($conversations); } } diff --git a/src/Module/Api/Mastodon/Conversations/Read.php b/src/Module/Api/Mastodon/Conversations/Read.php index c88daafd5..e8b101634 100644 --- a/src/Module/Api/Mastodon/Conversations/Read.php +++ b/src/Module/Api/Mastodon/Conversations/Read.php @@ -42,6 +42,6 @@ class Read extends BaseApi DBA::update('mail', ['seen' => true], ['convid' => $this->parameters['id'], 'uid' => $uid]); - System::jsonExit(DI::mstdnConversation()->createFromConvId($this->parameters['id'])->toArray()); + $this->jsonExit(DI::mstdnConversation()->createFromConvId($this->parameters['id'])->toArray()); } } diff --git a/src/Module/Api/Mastodon/CustomEmojis.php b/src/Module/Api/Mastodon/CustomEmojis.php index 650e96cea..96565587a 100644 --- a/src/Module/Api/Mastodon/CustomEmojis.php +++ b/src/Module/Api/Mastodon/CustomEmojis.php @@ -41,6 +41,6 @@ class CustomEmojis extends BaseApi { $emojis = DI::mstdnEmoji()->createCollectionFromSmilies(Smilies::getList()); - System::jsonExit($emojis->getArrayCopy()); + $this->jsonExit($emojis->getArrayCopy()); } } diff --git a/src/Module/Api/Mastodon/Directory.php b/src/Module/Api/Mastodon/Directory.php index 2e4726397..4270350bd 100644 --- a/src/Module/Api/Mastodon/Directory.php +++ b/src/Module/Api/Mastodon/Directory.php @@ -68,6 +68,6 @@ class Directory extends BaseApi } DBA::close($contacts); - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Endorsements.php b/src/Module/Api/Mastodon/Endorsements.php index 40b41985a..b09fbfae3 100644 --- a/src/Module/Api/Mastodon/Endorsements.php +++ b/src/Module/Api/Mastodon/Endorsements.php @@ -34,6 +34,6 @@ class Endorsements extends BaseApi */ protected function rawContent(array $request = []) { - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/Favourited.php b/src/Module/Api/Mastodon/Favourited.php index 7829f37d7..56beb93be 100644 --- a/src/Module/Api/Mastodon/Favourited.php +++ b/src/Module/Api/Mastodon/Favourited.php @@ -90,6 +90,6 @@ class Favourited extends BaseApi } self::setLinkHeader(); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Filters.php b/src/Module/Api/Mastodon/Filters.php index 25feb9d87..3af93d24c 100644 --- a/src/Module/Api/Mastodon/Filters.php +++ b/src/Module/Api/Mastodon/Filters.php @@ -45,6 +45,6 @@ class Filters extends BaseApi { self::checkAllowedScope(self::SCOPE_READ); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/FollowRequests.php b/src/Module/Api/Mastodon/FollowRequests.php index dfe3aadf3..78efa4819 100644 --- a/src/Module/Api/Mastodon/FollowRequests.php +++ b/src/Module/Api/Mastodon/FollowRequests.php @@ -79,7 +79,7 @@ class FollowRequests extends BaseApi throw new HTTPException\BadRequestException('Unexpected action parameter, expecting "authorize", "ignore" or "reject"'); } - System::jsonExit($relationship); + $this->jsonExit($relationship); } /** @@ -115,6 +115,6 @@ class FollowRequests extends BaseApi } self::setLinkHeader(); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Api/Mastodon/FollowedTags.php b/src/Module/Api/Mastodon/FollowedTags.php index 306f87323..905229006 100644 --- a/src/Module/Api/Mastodon/FollowedTags.php +++ b/src/Module/Api/Mastodon/FollowedTags.php @@ -77,6 +77,6 @@ class FollowedTags extends BaseApi } self::setLinkHeader(); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Api/Mastodon/Instance.php b/src/Module/Api/Mastodon/Instance.php index aaa0bbf50..bf968b638 100644 --- a/src/Module/Api/Mastodon/Instance.php +++ b/src/Module/Api/Mastodon/Instance.php @@ -59,6 +59,6 @@ class Instance extends BaseApi */ protected function rawContent(array $request = []) { - System::jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database, System::getRules())); + $this->jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database, System::getRules())); } } diff --git a/src/Module/Api/Mastodon/Instance/Peers.php b/src/Module/Api/Mastodon/Instance/Peers.php index b33f07b69..fba59e009 100644 --- a/src/Module/Api/Mastodon/Instance/Peers.php +++ b/src/Module/Api/Mastodon/Instance/Peers.php @@ -52,6 +52,6 @@ class Peers extends BaseApi } DBA::close($instances); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Api/Mastodon/Instance/Rules.php b/src/Module/Api/Mastodon/Instance/Rules.php index 61434479b..a48009f6a 100644 --- a/src/Module/Api/Mastodon/Instance/Rules.php +++ b/src/Module/Api/Mastodon/Instance/Rules.php @@ -38,6 +38,6 @@ class Rules extends BaseApi */ protected function rawContent(array $request = []) { - System::jsonExit(System::getRules()); + $this->jsonExit(System::getRules()); } } diff --git a/src/Module/Api/Mastodon/InstanceV2.php b/src/Module/Api/Mastodon/InstanceV2.php index bf5cbcfb5..64d095562 100644 --- a/src/Module/Api/Mastodon/InstanceV2.php +++ b/src/Module/Api/Mastodon/InstanceV2.php @@ -94,7 +94,7 @@ class InstanceV2 extends BaseApi $contact = $this->buildContactInfo(); $friendica_extensions = $this->buildFriendicaExtensionInfo(); $rules = System::getRules(); - System::jsonExit(new InstanceEntity( + $this->jsonExit(new InstanceEntity( $domain, $title, $version, diff --git a/src/Module/Api/Mastodon/Lists.php b/src/Module/Api/Mastodon/Lists.php index a007c80d3..296009cc0 100644 --- a/src/Module/Api/Mastodon/Lists.php +++ b/src/Module/Api/Mastodon/Lists.php @@ -48,7 +48,7 @@ class Lists extends BaseApi DI::mstdnError()->InternalError(); } - System::jsonExit([]); + $this->jsonExit([]); } protected function post(array $request = []) @@ -71,7 +71,7 @@ class Lists extends BaseApi DI::mstdnError()->InternalError(); } - System::jsonExit(DI::mstdnList()->createFromCircleId($id)); + $this->jsonExit(DI::mstdnList()->createFromCircleId($id)); } public function put(array $request = []) @@ -111,6 +111,6 @@ class Lists extends BaseApi $lists = DI::mstdnList()->createFromCircleId($id); } - System::jsonExit($lists); + $this->jsonExit($lists); } } diff --git a/src/Module/Api/Mastodon/Lists/Accounts.php b/src/Module/Api/Mastodon/Lists/Accounts.php index 465f22a26..2d202c34d 100644 --- a/src/Module/Api/Mastodon/Lists/Accounts.php +++ b/src/Module/Api/Mastodon/Lists/Accounts.php @@ -127,6 +127,6 @@ class Accounts extends BaseApi } self::setLinkHeader(); - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Markers.php b/src/Module/Api/Mastodon/Markers.php index a00b0f831..2f0a6b6b7 100644 --- a/src/Module/Api/Mastodon/Markers.php +++ b/src/Module/Api/Mastodon/Markers.php @@ -61,7 +61,7 @@ class Markers extends BaseApi $fields = ['last_read_id' => $last_read_id, 'version' => $version, 'updated_at' => DateTimeFormat::utcNow()]; DBA::update('application-marker', $fields, $condition, true); - System::jsonExit($this->fetchTimelines($application['id'], $uid)); + $this->jsonExit($this->fetchTimelines($application['id'], $uid)); } /** @@ -73,7 +73,7 @@ class Markers extends BaseApi $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); - System::jsonExit($this->fetchTimelines($application['id'], $uid)); + $this->jsonExit($this->fetchTimelines($application['id'], $uid)); } private function fetchTimelines(int $application_id, int $uid) diff --git a/src/Module/Api/Mastodon/Media.php b/src/Module/Api/Mastodon/Media.php index 921ebdaf7..3fe8dfa3d 100644 --- a/src/Module/Api/Mastodon/Media.php +++ b/src/Module/Api/Mastodon/Media.php @@ -58,7 +58,7 @@ class Media extends BaseApi Logger::info('Uploaded photo', ['media' => $media]); - System::jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id'])); + $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($media['id'])); } public function put(array $request = []) @@ -87,12 +87,12 @@ class Media extends BaseApi DI::mstdnError()->RecordNotFound(); } Post\Media::updateById(['description' => $request['description']], $this->parameters['id']); - System::jsonExit(DI::mstdnAttachment()->createFromId($this->parameters['id'])); + $this->jsonExit(DI::mstdnAttachment()->createFromId($this->parameters['id'])); } Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]); - System::jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id'])); + $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id'])); } /** @@ -112,6 +112,6 @@ class Media extends BaseApi DI::mstdnError()->RecordNotFound(); } - System::jsonExit(DI::mstdnAttachment()->createFromPhoto($id)); + $this->jsonExit(DI::mstdnAttachment()->createFromPhoto($id)); } } diff --git a/src/Module/Api/Mastodon/Mutes.php b/src/Module/Api/Mastodon/Mutes.php index 2190c397c..71c17cc51 100644 --- a/src/Module/Api/Mastodon/Mutes.php +++ b/src/Module/Api/Mastodon/Mutes.php @@ -85,6 +85,6 @@ class Mutes extends BaseApi } self::setLinkHeader(); - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Notifications.php b/src/Module/Api/Mastodon/Notifications.php index 70ef06898..94247b80b 100644 --- a/src/Module/Api/Mastodon/Notifications.php +++ b/src/Module/Api/Mastodon/Notifications.php @@ -48,7 +48,7 @@ class Notifications extends BaseApi $id = $this->parameters['id']; try { $notification = DI::notification()->selectOneForUser($uid, ['id' => $id]); - System::jsonExit(DI::mstdnNotification()->createFromNotification($notification, self::appSupportsQuotes())); + $this->jsonExit(DI::mstdnNotification()->createFromNotification($notification, self::appSupportsQuotes())); } catch (\Exception $e) { DI::mstdnError()->RecordNotFound(); } @@ -132,7 +132,7 @@ class Notifications extends BaseApi if ($request['summary']) { $count = DI::notification()->countForUser($uid, $condition); - System::jsonExit(['count' => $count]); + $this->jsonExit(['count' => $count]); } else { $mstdnNotifications = []; @@ -154,7 +154,7 @@ class Notifications extends BaseApi } self::setLinkHeader(); - System::jsonExit($mstdnNotifications); + $this->jsonExit($mstdnNotifications); } } } diff --git a/src/Module/Api/Mastodon/Notifications/Clear.php b/src/Module/Api/Mastodon/Notifications/Clear.php index 848bf46fb..cb2604337 100644 --- a/src/Module/Api/Mastodon/Notifications/Clear.php +++ b/src/Module/Api/Mastodon/Notifications/Clear.php @@ -37,6 +37,6 @@ class Clear extends BaseApi DI::notification()->setAllDismissedForUser($uid); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/Notifications/Dismiss.php b/src/Module/Api/Mastodon/Notifications/Dismiss.php index 2b774c59e..753c0ac5d 100644 --- a/src/Module/Api/Mastodon/Notifications/Dismiss.php +++ b/src/Module/Api/Mastodon/Notifications/Dismiss.php @@ -46,6 +46,6 @@ class Dismiss extends BaseApi $Notification->setDismissed(); DI::notification()->save($Notification); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/Polls.php b/src/Module/Api/Mastodon/Polls.php index 00ee47e5a..c43bdf510 100644 --- a/src/Module/Api/Mastodon/Polls.php +++ b/src/Module/Api/Mastodon/Polls.php @@ -42,6 +42,6 @@ class Polls extends BaseApi DI::mstdnError()->UnprocessableEntity(); } - System::jsonExit(DI::mstdnPoll()->createFromId($this->parameters['id'], $uid)); + $this->jsonExit(DI::mstdnPoll()->createFromId($this->parameters['id'], $uid)); } } diff --git a/src/Module/Api/Mastodon/Preferences.php b/src/Module/Api/Mastodon/Preferences.php index 4b7d1300f..d1f9d2d30 100644 --- a/src/Module/Api/Mastodon/Preferences.php +++ b/src/Module/Api/Mastodon/Preferences.php @@ -55,6 +55,6 @@ class Preferences extends BaseApi $preferences = new \Friendica\Object\Api\Mastodon\Preferences($visibility, $sensitive, $language, $media, $spoilers); - System::jsonExit($preferences); + $this->jsonExit($preferences); } } diff --git a/src/Module/Api/Mastodon/Reports.php b/src/Module/Api/Mastodon/Reports.php index 401d3da19..cc9193620 100644 --- a/src/Module/Api/Mastodon/Reports.php +++ b/src/Module/Api/Mastodon/Reports.php @@ -82,6 +82,6 @@ class Reports extends BaseApi $this->reportRepo->save($report); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/Api/Mastodon/ScheduledStatuses.php b/src/Module/Api/Mastodon/ScheduledStatuses.php index 8d2ce0086..6ac9430c6 100644 --- a/src/Module/Api/Mastodon/ScheduledStatuses.php +++ b/src/Module/Api/Mastodon/ScheduledStatuses.php @@ -56,7 +56,7 @@ class ScheduledStatuses extends BaseApi Post\Delayed::deleteById($this->parameters['id']); - System::jsonExit([]); + $this->jsonExit([]); } /** @@ -68,7 +68,7 @@ class ScheduledStatuses extends BaseApi $uid = self::getCurrentUserID(); if (isset($this->parameters['id'])) { - System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray()); + $this->jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray()); } $request = $this->getRequest([ @@ -109,6 +109,6 @@ class ScheduledStatuses extends BaseApi } self::setLinkHeader(); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 956e3d73b..e0f629527 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -91,7 +91,7 @@ class Search extends BaseApi $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']); } - System::jsonExit($result); + $this->jsonExit($result); } /** diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index a8f1dc1c6..b916f4b46 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -159,7 +159,7 @@ class Statuses extends BaseApi Item::updateDisplayCache($post['uri-id']); - System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, self::appSupportsQuotes())); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, self::appSupportsQuotes())); } protected function post(array $request = []) @@ -299,14 +299,14 @@ class Statuses extends BaseApi if (empty($id)) { DI::mstdnError()->InternalError(); } - System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray()); + $this->jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($id, $uid)->toArray()); } $id = Item::insert($item, true); if (!empty($id)) { $item = Post::selectFirst(['uri-id'], ['id' => $id]); if (!empty($item['uri-id'])) { - System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes())); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes())); } } @@ -331,7 +331,7 @@ class Statuses extends BaseApi DI::mstdnError()->RecordNotFound(); } - System::jsonExit([]); + $this->jsonExit([]); } /** @@ -345,7 +345,7 @@ class Statuses extends BaseApi DI::mstdnError()->UnprocessableEntity(); } - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), false)); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), false)); } private function getApp(): string @@ -422,7 +422,7 @@ class Statuses extends BaseApi if (preg_match("/\[url=[^\[\]]*\](.*)\[\/url\]\z/ism", $status, $matches)) { $status = preg_replace("/\[url=[^\[\]]*\].*\[\/url\]\z/ism", PageInfo::getFooterFromUrl($matches[1]), $status); } - + return $status; } } diff --git a/src/Module/Api/Mastodon/Statuses/Bookmark.php b/src/Module/Api/Mastodon/Statuses/Bookmark.php index 7f32c9a43..ff34a8529 100644 --- a/src/Module/Api/Mastodon/Statuses/Bookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Bookmark.php @@ -70,6 +70,6 @@ class Bookmark extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Card.php b/src/Module/Api/Mastodon/Statuses/Card.php index 3e973d9bb..193bb7b0c 100644 --- a/src/Module/Api/Mastodon/Statuses/Card.php +++ b/src/Module/Api/Mastodon/Statuses/Card.php @@ -49,6 +49,6 @@ class Card extends BaseApi $card = DI::mstdnCard()->createFromUriId($post['uri-id']); - System::jsonExit($card->toArray()); + $this->jsonExit($card->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Context.php b/src/Module/Api/Mastodon/Statuses/Context.php index c510fc9a8..3a73569f4 100644 --- a/src/Module/Api/Mastodon/Statuses/Context.php +++ b/src/Module/Api/Mastodon/Statuses/Context.php @@ -140,7 +140,7 @@ class Context extends BaseApi $statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, $display_quotes); } - System::jsonExit($statuses); + $this->jsonExit($statuses); } private static function getParents(int $id, array $parents, array $list = []) diff --git a/src/Module/Api/Mastodon/Statuses/Favourite.php b/src/Module/Api/Mastodon/Statuses/Favourite.php index 3543a3ba8..da698c72f 100644 --- a/src/Module/Api/Mastodon/Statuses/Favourite.php +++ b/src/Module/Api/Mastodon/Statuses/Favourite.php @@ -54,6 +54,6 @@ class Favourite extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/FavouritedBy.php b/src/Module/Api/Mastodon/Statuses/FavouritedBy.php index fcfb97d92..b6902a1c0 100644 --- a/src/Module/Api/Mastodon/Statuses/FavouritedBy.php +++ b/src/Module/Api/Mastodon/Statuses/FavouritedBy.php @@ -56,6 +56,6 @@ class FavouritedBy extends BaseApi $accounts[] = DI::mstdnAccount()->createFromContactId($activity['author-id'], $uid); } - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Statuses/Mute.php b/src/Module/Api/Mastodon/Statuses/Mute.php index a99cd6863..56c352b34 100644 --- a/src/Module/Api/Mastodon/Statuses/Mute.php +++ b/src/Module/Api/Mastodon/Statuses/Mute.php @@ -58,6 +58,6 @@ class Mute extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Pin.php b/src/Module/Api/Mastodon/Statuses/Pin.php index 5d9a18113..c95f02e9b 100644 --- a/src/Module/Api/Mastodon/Statuses/Pin.php +++ b/src/Module/Api/Mastodon/Statuses/Pin.php @@ -53,6 +53,6 @@ class Pin extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(),$isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(),$isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Reblog.php b/src/Module/Api/Mastodon/Statuses/Reblog.php index 98cbd417d..d0cf46b06 100644 --- a/src/Module/Api/Mastodon/Statuses/Reblog.php +++ b/src/Module/Api/Mastodon/Statuses/Reblog.php @@ -63,6 +63,6 @@ class Reblog extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/RebloggedBy.php b/src/Module/Api/Mastodon/Statuses/RebloggedBy.php index a12975a8b..ff0e1ba94 100644 --- a/src/Module/Api/Mastodon/Statuses/RebloggedBy.php +++ b/src/Module/Api/Mastodon/Statuses/RebloggedBy.php @@ -56,6 +56,6 @@ class RebloggedBy extends BaseApi $accounts[] = DI::mstdnAccount()->createFromContactId($activity['author-id'], $uid); } - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Statuses/Source.php b/src/Module/Api/Mastodon/Statuses/Source.php index 92e2c3dbb..db997b0a3 100644 --- a/src/Module/Api/Mastodon/Statuses/Source.php +++ b/src/Module/Api/Mastodon/Statuses/Source.php @@ -52,6 +52,6 @@ class Source extends BaseApi $source = DI::mstdnStatusSource()->createFromUriId($id, $uid); - System::jsonExit($source->toArray()); + $this->jsonExit($source->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unbookmark.php b/src/Module/Api/Mastodon/Statuses/Unbookmark.php index 556db2b4b..3bda450e4 100644 --- a/src/Module/Api/Mastodon/Statuses/Unbookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Unbookmark.php @@ -70,6 +70,6 @@ class Unbookmark extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unfavourite.php b/src/Module/Api/Mastodon/Statuses/Unfavourite.php index 99358be55..c41ed8d89 100644 --- a/src/Module/Api/Mastodon/Statuses/Unfavourite.php +++ b/src/Module/Api/Mastodon/Statuses/Unfavourite.php @@ -54,6 +54,6 @@ class Unfavourite extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unmute.php b/src/Module/Api/Mastodon/Statuses/Unmute.php index b6d9c2b19..3668cb945 100644 --- a/src/Module/Api/Mastodon/Statuses/Unmute.php +++ b/src/Module/Api/Mastodon/Statuses/Unmute.php @@ -58,6 +58,6 @@ class Unmute extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unpin.php b/src/Module/Api/Mastodon/Statuses/Unpin.php index 75b1d6fa5..fd23e3014 100644 --- a/src/Module/Api/Mastodon/Statuses/Unpin.php +++ b/src/Module/Api/Mastodon/Statuses/Unpin.php @@ -53,6 +53,6 @@ class Unpin extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unreblog.php b/src/Module/Api/Mastodon/Statuses/Unreblog.php index 6730e0fb5..3d1f7ea9a 100644 --- a/src/Module/Api/Mastodon/Statuses/Unreblog.php +++ b/src/Module/Api/Mastodon/Statuses/Unreblog.php @@ -69,6 +69,6 @@ class Unreblog extends BaseApi // Issue tracking the behavior of createFromUriId: https://github.com/friendica/friendica/issues/13350 $isReblog = $item['uri-id'] != $this->parameters['id']; - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); + $this->jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), $isReblog)->toArray()); } } diff --git a/src/Module/Api/Mastodon/Suggestions.php b/src/Module/Api/Mastodon/Suggestions.php index 9645d39a2..f18637b3d 100644 --- a/src/Module/Api/Mastodon/Suggestions.php +++ b/src/Module/Api/Mastodon/Suggestions.php @@ -54,6 +54,6 @@ class Suggestions extends BaseApi ]; } - System::jsonExit($accounts); + $this->jsonExit($accounts); } } diff --git a/src/Module/Api/Mastodon/Tags.php b/src/Module/Api/Mastodon/Tags.php index 229fd8e00..474bbe079 100644 --- a/src/Module/Api/Mastodon/Tags.php +++ b/src/Module/Api/Mastodon/Tags.php @@ -47,6 +47,6 @@ class Tags extends BaseApi $following = DBA::exists('search', ['uid' => $uid, 'term' => '#' . $tag]); $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => $tag], [], $following); - System::jsonExit($hashtag->toArray()); + $this->jsonExit($hashtag->toArray()); } } diff --git a/src/Module/Api/Mastodon/Tags/Follow.php b/src/Module/Api/Mastodon/Tags/Follow.php index 13137a75a..ec27ea733 100644 --- a/src/Module/Api/Mastodon/Tags/Follow.php +++ b/src/Module/Api/Mastodon/Tags/Follow.php @@ -46,6 +46,6 @@ class Follow extends BaseApi } $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], true); - System::jsonExit($hashtag->toArray()); + $this->jsonExit($hashtag->toArray()); } } diff --git a/src/Module/Api/Mastodon/Tags/Unfollow.php b/src/Module/Api/Mastodon/Tags/Unfollow.php index 06b08b7c3..02847f1fd 100644 --- a/src/Module/Api/Mastodon/Tags/Unfollow.php +++ b/src/Module/Api/Mastodon/Tags/Unfollow.php @@ -45,6 +45,6 @@ class Unfollow extends BaseApi DBA::delete('search', $term); $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], false); - System::jsonExit($hashtag->toArray()); + $this->jsonExit($hashtag->toArray()); } } diff --git a/src/Module/Api/Mastodon/Timelines/Direct.php b/src/Module/Api/Mastodon/Timelines/Direct.php index 82b96e698..e326bc7a1 100644 --- a/src/Module/Api/Mastodon/Timelines/Direct.php +++ b/src/Module/Api/Mastodon/Timelines/Direct.php @@ -86,6 +86,6 @@ class Direct extends BaseApi } self::setLinkHeader(); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php index 6d0b7a334..e9985508c 100644 --- a/src/Module/Api/Mastodon/Timelines/Home.php +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -101,6 +101,6 @@ class Home extends BaseApi self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php index 7f1d38c5c..fa4605128 100644 --- a/src/Module/Api/Mastodon/Timelines/ListTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -105,6 +105,6 @@ class ListTimeline extends BaseApi } self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php index fa93d90c8..057e2ec8d 100644 --- a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php @@ -102,6 +102,6 @@ class PublicTimeline extends BaseApi } self::setLinkHeader($request['friendica_order'] != TimelineOrderByTypes::ID); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php index 4943b51b0..5b3e82508 100644 --- a/src/Module/Api/Mastodon/Timelines/Tag.php +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -131,6 +131,6 @@ class Tag extends BaseApi } self::setLinkHeader(); - System::jsonExit($statuses); + $this->jsonExit($statuses); } } diff --git a/src/Module/Api/Mastodon/Trends/Links.php b/src/Module/Api/Mastodon/Trends/Links.php index bfb353147..9a14ebf1d 100644 --- a/src/Module/Api/Mastodon/Trends/Links.php +++ b/src/Module/Api/Mastodon/Trends/Links.php @@ -60,6 +60,6 @@ class Links extends BaseApi self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']); } - System::jsonExit($trending); + $this->jsonExit($trending); } } diff --git a/src/Module/Api/Mastodon/Trends/Statuses.php b/src/Module/Api/Mastodon/Trends/Statuses.php index 336f67155..0feb47cb7 100644 --- a/src/Module/Api/Mastodon/Trends/Statuses.php +++ b/src/Module/Api/Mastodon/Trends/Statuses.php @@ -67,6 +67,6 @@ class Statuses extends BaseApi self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']); } - System::jsonExit($trending); + $this->jsonExit($trending); } } diff --git a/src/Module/Api/Mastodon/Trends/Tags.php b/src/Module/Api/Mastodon/Trends/Tags.php index 2190a2e3c..b3a066703 100644 --- a/src/Module/Api/Mastodon/Trends/Tags.php +++ b/src/Module/Api/Mastodon/Trends/Tags.php @@ -60,6 +60,6 @@ class Tags extends BaseApi self::setLinkHeaderByOffsetLimit($request['offset'], $request['limit']); } - System::jsonExit($trending); + $this->jsonExit($trending); } } diff --git a/src/Module/Api/Twitter/Blocks/Ids.php b/src/Module/Api/Twitter/Blocks/Ids.php index 53a9118b5..e08dcf40f 100644 --- a/src/Module/Api/Twitter/Blocks/Ids.php +++ b/src/Module/Api/Twitter/Blocks/Ids.php @@ -83,6 +83,6 @@ class Ids extends ContactEndpoint self::setLinkHeader(); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Api/Twitter/Followers/Ids.php b/src/Module/Api/Twitter/Followers/Ids.php index 9f55eb833..21adc682b 100644 --- a/src/Module/Api/Twitter/Followers/Ids.php +++ b/src/Module/Api/Twitter/Followers/Ids.php @@ -114,6 +114,6 @@ class Ids extends ContactEndpoint self::setLinkHeader(); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Api/Twitter/Friends/Ids.php b/src/Module/Api/Twitter/Friends/Ids.php index 0f0523e12..e12d67aae 100644 --- a/src/Module/Api/Twitter/Friends/Ids.php +++ b/src/Module/Api/Twitter/Friends/Ids.php @@ -114,6 +114,6 @@ class Ids extends ContactEndpoint self::setLinkHeader(); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/BaseNotifications.php b/src/Module/BaseNotifications.php index 117530d25..390294483 100644 --- a/src/Module/BaseNotifications.php +++ b/src/Module/BaseNotifications.php @@ -121,7 +121,7 @@ abstract class BaseNotifications extends BaseModule 'page' => $pager->getPage(), ]; - System::jsonExit($notifications); + $this->jsonExit($notifications); } /** diff --git a/src/Module/Calendar/Event/Get.php b/src/Module/Calendar/Event/Get.php index 165c7e79e..25129be78 100644 --- a/src/Module/Calendar/Event/Get.php +++ b/src/Module/Calendar/Event/Get.php @@ -69,7 +69,7 @@ class Get extends \Friendica\BaseModule $events = Event::getListByDate($owner['uid'], $request['start'] ?? '', $request['end'] ?? ''); } - System::jsonExit($events ? self::map($events) : []); + $this->jsonExit($events ? self::map($events) : []); } private static function map(array $events): array diff --git a/src/Module/Circle.php b/src/Module/Circle.php index a51583ae9..e2b6f8977 100644 --- a/src/Module/Circle.php +++ b/src/Module/Circle.php @@ -132,7 +132,7 @@ class Circle extends BaseModule } DI::sysmsg()->addInfo($message); - System::jsonExit(['status' => 'OK', 'message' => $message]); + $this->jsonExit(['status' => 'OK', 'message' => $message]); } catch (\Exception $e) { DI::sysmsg()->addNotice($e->getMessage()); System::jsonError($e->getCode(), ['status' => 'error', 'message' => $e->getMessage()]); diff --git a/src/Module/Friendica.php b/src/Module/Friendica.php index fe4c846c9..10a07f6e6 100644 --- a/src/Module/Friendica.php +++ b/src/Module/Friendica.php @@ -142,7 +142,7 @@ class Friendica extends BaseModule $data = ActivityPub\Transmitter::getProfile(0); header('Access-Control-Allow-Origin: *'); header('Cache-Control: max-age=23200, stale-while-revalidate=23200'); - System::jsonExit($data, 'application/activity+json'); + $this->jsonExit($data, 'application/activity+json'); } catch (HTTPException\NotFoundException $e) { System::jsonError(404, ['error' => 'Record not found']); } @@ -200,6 +200,6 @@ class Friendica extends BaseModule 'no_scrape_url' => $this->baseUrl . '/noscrape', ]; - System::jsonExit($data); + $this->jsonExit($data); } } diff --git a/src/Module/Hashtag.php b/src/Module/Hashtag.php index 0c4c41c7e..3ba7b378e 100644 --- a/src/Module/Hashtag.php +++ b/src/Module/Hashtag.php @@ -36,7 +36,7 @@ class Hashtag extends BaseModule $result = []; if (empty($request['t'])) { - System::jsonExit($result); + $this->jsonExit($result); } $taglist = DBA::select( @@ -50,6 +50,6 @@ class Hashtag extends BaseModule } DBA::close($taglist); - System::jsonExit($result); + $this->jsonExit($result); } } diff --git a/src/Module/Item/Activity.php b/src/Module/Item/Activity.php index c9d192d24..2175f730e 100644 --- a/src/Module/Item/Activity.php +++ b/src/Module/Item/Activity.php @@ -89,6 +89,6 @@ class Activity extends BaseModule 'state' => 1, ]; - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Item/Follow.php b/src/Module/Item/Follow.php index 1b64ebcd4..bfd69dbfe 100644 --- a/src/Module/Item/Follow.php +++ b/src/Module/Item/Follow.php @@ -71,6 +71,6 @@ class Follow extends BaseModule 'state' => 1 ]; - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Item/Ignore.php b/src/Module/Item/Ignore.php index 4950ba069..b8883f972 100644 --- a/src/Module/Item/Ignore.php +++ b/src/Module/Item/Ignore.php @@ -82,6 +82,6 @@ class Ignore extends BaseModule 'state' => $ignored, ]; - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Item/Pin.php b/src/Module/Item/Pin.php index f3163a6b5..ecca24a7f 100644 --- a/src/Module/Item/Pin.php +++ b/src/Module/Item/Pin.php @@ -84,6 +84,6 @@ class Pin extends BaseModule 'state' => (int)$pinned, ]; - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Item/Star.php b/src/Module/Item/Star.php index 931d0cca2..c7dd244fd 100644 --- a/src/Module/Item/Star.php +++ b/src/Module/Item/Star.php @@ -91,6 +91,6 @@ class Star extends BaseModule 'state' => (int)$starred, ]; - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/Manifest.php b/src/Module/Manifest.php index e98c83a61..ed14bbbb7 100644 --- a/src/Module/Manifest.php +++ b/src/Module/Manifest.php @@ -133,6 +133,6 @@ class Manifest extends BaseModule $manifest['theme_color'] = $theme_color; } - Core\System::jsonExit($manifest, 'application/manifest+json'); + $this->jsonExit($manifest, 'application/manifest+json'); } } diff --git a/src/Module/NoScrape.php b/src/Module/NoScrape.php index f5c5c725e..8751b30be 100644 --- a/src/Module/NoScrape.php +++ b/src/Module/NoScrape.php @@ -71,7 +71,7 @@ class NoScrape extends BaseModule if (!$owner['net-publish']) { $json_info['hide'] = true; - System::jsonExit($json_info); + $this->jsonExit($json_info); } $keywords = $owner['pub_keywords'] ?? ''; @@ -107,6 +107,6 @@ class NoScrape extends BaseModule } } - System::jsonExit($json_info); + $this->jsonExit($json_info); } } diff --git a/src/Module/Notifications/Notification.php b/src/Module/Notifications/Notification.php index 70590c01f..a852a201c 100644 --- a/src/Module/Notifications/Notification.php +++ b/src/Module/Notifications/Notification.php @@ -116,7 +116,7 @@ class Notification extends BaseModule $success = false; } - System::jsonExit(['result' => (($success) ? 'success' : 'fail')]); + $this->jsonExit(['result' => (($success) ? 'success' : 'fail')]); } } diff --git a/src/Module/Notifications/Ping.php b/src/Module/Notifications/Ping.php index 3b44bbe91..85b9b4d69 100644 --- a/src/Module/Notifications/Ping.php +++ b/src/Module/Notifications/Ping.php @@ -305,7 +305,7 @@ class Ping extends BaseModule // JSONP support $this->httpExit($_GET['callback'] . '(' . json_encode(['result' => $data]) . ')', Response::TYPE_BLANK, 'application/javascript'); } else { - System::jsonExit(['result' => $data]); + $this->jsonExit(['result' => $data]); } } } diff --git a/src/Module/OAuth/Revoke.php b/src/Module/OAuth/Revoke.php index ccadfbeff..cde4c36c6 100644 --- a/src/Module/OAuth/Revoke.php +++ b/src/Module/OAuth/Revoke.php @@ -55,6 +55,6 @@ class Revoke extends BaseApi } DBA::delete('application-token', ['application-id' => $token['id']]); - System::jsonExit([]); + $this->jsonExit([]); } } diff --git a/src/Module/OAuth/Token.php b/src/Module/OAuth/Token.php index f5aec0802..61a7f2288 100644 --- a/src/Module/OAuth/Token.php +++ b/src/Module/OAuth/Token.php @@ -110,6 +110,6 @@ class Token extends BaseApi $object = new \Friendica\Object\Api\Mastodon\Token($token['access_token'], 'Bearer', $application['scopes'], $token['created_at'], $me); - System::jsonExit($object->toArray()); + $this->jsonExit($object->toArray()); } } diff --git a/src/Module/Owa.php b/src/Module/Owa.php index 69abd8e87..2e5197112 100644 --- a/src/Module/Owa.php +++ b/src/Module/Owa.php @@ -101,6 +101,6 @@ class Owa extends BaseModule } } } - System::jsonExit($ret, 'application/x-zot+json'); + $this->jsonExit($ret, 'application/x-zot+json'); } } diff --git a/src/Module/ParseUrl.php b/src/Module/ParseUrl.php index dfccafad4..7dbc22220 100644 --- a/src/Module/ParseUrl.php +++ b/src/Module/ParseUrl.php @@ -100,7 +100,7 @@ class ParseUrl extends BaseModule if ($arr['text']) { if ($format == 'json') { - System::jsonExit($arr['text']); + $this->jsonExit($arr['text']); } else { $this->httpExit($arr['text']); } @@ -133,7 +133,7 @@ class ParseUrl extends BaseModule $ret['success'] = true; } - System::jsonExit($ret); + $this->jsonExit($ret); } else { $this->httpExit(BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? '')); } diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php index 99262fcc5..023cc38a5 100644 --- a/src/Module/Profile/Profile.php +++ b/src/Module/Profile/Profile.php @@ -87,7 +87,7 @@ class Profile extends BaseProfile $data = ActivityPub\Transmitter::getProfile($user['uid'], ActivityPub::isAcceptedRequester($user['uid'])); header('Access-Control-Allow-Origin: *'); header('Cache-Control: max-age=23200, stale-while-revalidate=23200'); - System::jsonExit($data, 'application/activity+json'); + $this->jsonExit($data, 'application/activity+json'); } catch (HTTPException\NotFoundException $e) { System::jsonError(404, ['error' => 'Record not found']); } diff --git a/src/Module/Search/Acl.php b/src/Module/Search/Acl.php index 66e371dd1..857e2fdf9 100644 --- a/src/Module/Search/Acl.php +++ b/src/Module/Search/Acl.php @@ -80,7 +80,7 @@ class Acl extends BaseModule $o = $this->regularContactSearch($request, $type); } - System::jsonExit($o); + $this->jsonExit($o); } private function globalContactSearch(array $request): array diff --git a/src/Module/Search/Tags.php b/src/Module/Search/Tags.php index a2f68b734..12196f805 100644 --- a/src/Module/Search/Tags.php +++ b/src/Module/Search/Tags.php @@ -59,7 +59,7 @@ class Tags extends BaseModule $results = []; if (empty($tags)) { - System::jsonExit([ + $this->jsonExit([ 'total' => 0, 'items_page' => $perPage, 'page' => $page, @@ -74,7 +74,7 @@ class Tags extends BaseModule $totalCount = $this->database->count('owner-view', $condition); if ($totalCount === 0) { - System::jsonExit([ + $this->jsonExit([ 'total' => 0, 'items_page' => $perPage, 'page' => $page, @@ -97,7 +97,7 @@ class Tags extends BaseModule $this->database->close($searchStmt); - System::jsonExit([ + $this->jsonExit([ 'total' => $totalCount, 'items_page' => $perPage, 'page' => $page, diff --git a/src/Module/Smilies.php b/src/Module/Smilies.php index c496283a8..52acb1924 100644 --- a/src/Module/Smilies.php +++ b/src/Module/Smilies.php @@ -41,7 +41,7 @@ class Smilies extends BaseModule for ($i = 0; $i < count($smilies['texts']); $i++) { $results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]]; } - System::jsonExit($results); + $this->jsonExit($results); } } diff --git a/src/Module/Statistics.php b/src/Module/Statistics.php index dc2055782..d0d46a1ab 100644 --- a/src/Module/Statistics.php +++ b/src/Module/Statistics.php @@ -83,6 +83,6 @@ class Statistics extends BaseModule ], $services); $this->logger->debug("statistics.", ['statistics' => $statistics]); - System::jsonExit($statistics); + $this->jsonExit($statistics); } } diff --git a/src/Module/ThemeDetails.php b/src/Module/ThemeDetails.php index 1291d3309..fed86d1e8 100644 --- a/src/Module/ThemeDetails.php +++ b/src/Module/ThemeDetails.php @@ -41,7 +41,7 @@ class ThemeDetails extends BaseModule $version = $info['version'] ?? ''; $credits = $info['credits'] ?? ''; - System::jsonExit([ + $this->jsonExit([ 'img' => Theme::getScreenshot($theme), 'desc' => $description, 'version' => $version, diff --git a/src/Module/User/PortableContacts.php b/src/Module/User/PortableContacts.php index f3d02383e..b409bd1dc 100644 --- a/src/Module/User/PortableContacts.php +++ b/src/Module/User/PortableContacts.php @@ -268,6 +268,6 @@ class PortableContacts extends BaseModule $this->logger->info('End of poco'); - System::jsonExit($return); + $this->jsonExit($return); } } diff --git a/src/Module/WellKnown/NodeInfo.php b/src/Module/WellKnown/NodeInfo.php index 9ae641d41..07a2a7619 100644 --- a/src/Module/WellKnown/NodeInfo.php +++ b/src/Module/WellKnown/NodeInfo.php @@ -32,26 +32,16 @@ use Friendica\DI; class NodeInfo extends BaseModule { protected function rawContent(array $request = []) - { - self::printWellKnown(); - } - - /** - * Prints the well-known nodeinfo redirect - * - * @throws \Friendica\Network\HTTPException\NotFoundException - */ - private static function printWellKnown() { $nodeinfo = [ 'links' => [ ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0', - 'href' => DI::baseUrl() . '/nodeinfo/1.0'], + 'href' => DI::baseUrl() . '/nodeinfo/1.0'], ['rel' => 'http://nodeinfo.diaspora.software/ns/schema/2.0', - 'href' => DI::baseUrl() . '/nodeinfo/2.0'], + 'href' => DI::baseUrl() . '/nodeinfo/2.0'], ] ]; - System::jsonExit($nodeinfo); + $this->jsonExit($nodeinfo); } } diff --git a/src/Module/WellKnown/XSocialRelay.php b/src/Module/WellKnown/XSocialRelay.php index 22d1b08a4..4ed110391 100644 --- a/src/Module/WellKnown/XSocialRelay.php +++ b/src/Module/WellKnown/XSocialRelay.php @@ -77,6 +77,6 @@ class XSocialRelay extends BaseModule $relay['protocols']['diaspora'] = ['receive' => DI::baseUrl() . '/receive/public']; } - System::jsonExit($relay); + $this->jsonExit($relay); } } diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index 40358250e..097ec3c32 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -156,7 +156,7 @@ class Xrd extends BaseModule ] ]; header('Access-Control-Allow-Origin: *'); - System::jsonExit($json, 'application/jrd+json; charset=utf-8'); + $this->jsonExit($json, 'application/jrd+json; charset=utf-8'); } private function printJSON(string $alias, array $owner, array $avatar) @@ -233,7 +233,7 @@ class Xrd extends BaseModule ]; header('Access-Control-Allow-Origin: *'); - System::jsonExit($json, 'application/jrd+json; charset=utf-8'); + $this->jsonExit($json, 'application/jrd+json; charset=utf-8'); } private function printXML(string $alias, array $owner, array $avatar)