From 9e7161071153c7ec5e4df5711521cbcaabcbc353 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 11 Oct 2023 09:30:42 -0400 Subject: [PATCH] Make BaseApi->checkAllowedScope into an object method - It isn't called from static contexts anymore --- src/Module/ActivityPub/Inbox.php | 2 +- src/Module/ActivityPub/Outbox.php | 2 +- src/Module/ActivityPub/Whoami.php | 2 +- src/Module/Api/Friendica/Activity.php | 2 +- src/Module/Api/Friendica/Circle/Create.php | 2 +- src/Module/Api/Friendica/Circle/Delete.php | 2 +- src/Module/Api/Friendica/Circle/Show.php | 2 +- src/Module/Api/Friendica/Circle/Update.php | 2 +- src/Module/Api/Friendica/DirectMessages/Search.php | 2 +- src/Module/Api/Friendica/DirectMessages/Setseen.php | 2 +- src/Module/Api/Friendica/Events/Create.php | 2 +- src/Module/Api/Friendica/Events/Delete.php | 2 +- src/Module/Api/Friendica/Events/Index.php | 2 +- src/Module/Api/Friendica/Notification.php | 2 +- src/Module/Api/Friendica/Notification/Seen.php | 2 +- src/Module/Api/Friendica/Photo.php | 2 +- src/Module/Api/Friendica/Photo/Create.php | 2 +- src/Module/Api/Friendica/Photo/Lists.php | 2 +- src/Module/Api/Friendica/Photo/Update.php | 2 +- src/Module/Api/Friendica/Photoalbum/Delete.php | 2 +- src/Module/Api/Friendica/Photoalbum/Index.php | 2 +- src/Module/Api/Friendica/Photoalbum/Show.php | 2 +- src/Module/Api/Friendica/Photoalbum/Update.php | 2 +- src/Module/Api/Friendica/Profile/Show.php | 2 +- src/Module/Api/Friendica/Statuses/Dislike.php | 2 +- src/Module/Api/Friendica/Statuses/Undislike.php | 2 +- src/Module/Api/GNUSocial/Statusnet/Conversation.php | 2 +- src/Module/Api/Mastodon/Accounts/Block.php | 2 +- src/Module/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 +- src/Module/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 +- src/Module/Api/Mastodon/Accounts/Relationships.php | 2 +- src/Module/Api/Mastodon/Accounts/Search.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/Accounts/UpdateCredentials.php | 2 +- src/Module/Api/Mastodon/Accounts/VerifyCredentials.php | 2 +- src/Module/Api/Mastodon/Announcements.php | 2 +- src/Module/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/Favourited.php | 2 +- src/Module/Api/Mastodon/Filters.php | 4 ++-- src/Module/Api/Mastodon/FollowRequests.php | 4 ++-- src/Module/Api/Mastodon/FollowedTags.php | 2 +- src/Module/Api/Mastodon/Lists.php | 6 +++--- src/Module/Api/Mastodon/Lists/Accounts.php | 6 +++--- src/Module/Api/Mastodon/Markers.php | 4 ++-- src/Module/Api/Mastodon/Media.php | 6 +++--- src/Module/Api/Mastodon/Mutes.php | 2 +- src/Module/Api/Mastodon/Notifications.php | 2 +- src/Module/Api/Mastodon/Notifications/Clear.php | 2 +- src/Module/Api/Mastodon/Notifications/Dismiss.php | 2 +- src/Module/Api/Mastodon/Preferences.php | 2 +- src/Module/Api/Mastodon/PushSubscription.php | 8 ++++---- 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 | 6 +++--- src/Module/Api/Mastodon/Statuses/Bookmark.php | 2 +- src/Module/Api/Mastodon/Statuses/Favourite.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/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 +- src/Module/Api/Mastodon/Timelines/ListTimeline.php | 2 +- src/Module/Api/Mastodon/Timelines/Tag.php | 2 +- src/Module/Api/Twitter/Account/UpdateProfile.php | 2 +- src/Module/Api/Twitter/Account/UpdateProfileImage.php | 2 +- src/Module/Api/Twitter/Account/VerifyCredentials.php | 2 +- src/Module/Api/Twitter/Blocks/Ids.php | 2 +- src/Module/Api/Twitter/Blocks/Lists.php | 2 +- src/Module/Api/Twitter/ContactEndpoint.php | 2 +- src/Module/Api/Twitter/DirectMessages/All.php | 2 +- src/Module/Api/Twitter/DirectMessages/Conversation.php | 2 +- src/Module/Api/Twitter/DirectMessages/Destroy.php | 2 +- src/Module/Api/Twitter/DirectMessages/Inbox.php | 2 +- src/Module/Api/Twitter/DirectMessages/NewDM.php | 2 +- src/Module/Api/Twitter/DirectMessages/Sent.php | 2 +- src/Module/Api/Twitter/Favorites.php | 2 +- src/Module/Api/Twitter/Favorites/Create.php | 2 +- src/Module/Api/Twitter/Favorites/Destroy.php | 2 +- src/Module/Api/Twitter/Followers/Ids.php | 2 +- src/Module/Api/Twitter/Followers/Lists.php | 2 +- src/Module/Api/Twitter/Friends/Ids.php | 2 +- src/Module/Api/Twitter/Friends/Lists.php | 2 +- src/Module/Api/Twitter/Friendships/Destroy.php | 2 +- src/Module/Api/Twitter/Friendships/Incoming.php | 2 +- src/Module/Api/Twitter/Friendships/Show.php | 2 +- src/Module/Api/Twitter/Lists/Create.php | 2 +- src/Module/Api/Twitter/Lists/Destroy.php | 2 +- src/Module/Api/Twitter/Lists/Lists.php | 2 +- src/Module/Api/Twitter/Lists/Ownership.php | 2 +- src/Module/Api/Twitter/Lists/Statuses.php | 2 +- src/Module/Api/Twitter/Lists/Update.php | 2 +- src/Module/Api/Twitter/Media/Metadata/Create.php | 2 +- src/Module/Api/Twitter/Media/Upload.php | 2 +- src/Module/Api/Twitter/SavedSearches.php | 2 +- src/Module/Api/Twitter/Search/Tweets.php | 2 +- src/Module/Api/Twitter/Statuses/Destroy.php | 2 +- src/Module/Api/Twitter/Statuses/HomeTimeline.php | 2 +- src/Module/Api/Twitter/Statuses/Mentions.php | 2 +- .../Api/Twitter/Statuses/NetworkPublicTimeline.php | 2 +- src/Module/Api/Twitter/Statuses/PublicTimeline.php | 2 +- src/Module/Api/Twitter/Statuses/Retweet.php | 2 +- src/Module/Api/Twitter/Statuses/Show.php | 2 +- src/Module/Api/Twitter/Statuses/Update.php | 2 +- src/Module/Api/Twitter/Statuses/UserTimeline.php | 2 +- src/Module/Api/Twitter/Users/Lookup.php | 2 +- src/Module/Api/Twitter/Users/Search.php | 2 +- src/Module/Api/Twitter/Users/Show.php | 2 +- src/Module/BaseApi.php | 10 +++++----- 131 files changed, 152 insertions(+), 152 deletions(-) diff --git a/src/Module/ActivityPub/Inbox.php b/src/Module/ActivityPub/Inbox.php index 10e4c9db0..ee9d098da 100644 --- a/src/Module/ActivityPub/Inbox.php +++ b/src/Module/ActivityPub/Inbox.php @@ -45,7 +45,7 @@ class Inbox extends BaseApi protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $page = $request['page'] ?? null; diff --git a/src/Module/ActivityPub/Outbox.php b/src/Module/ActivityPub/Outbox.php index 3dc0f00e7..e637a8e55 100644 --- a/src/Module/ActivityPub/Outbox.php +++ b/src/Module/ActivityPub/Outbox.php @@ -58,7 +58,7 @@ class Outbox extends BaseApi protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $postdata = Network::postdata(); diff --git a/src/Module/ActivityPub/Whoami.php b/src/Module/ActivityPub/Whoami.php index 67128d99c..d78f6e83f 100644 --- a/src/Module/ActivityPub/Whoami.php +++ b/src/Module/ActivityPub/Whoami.php @@ -38,7 +38,7 @@ class Whoami extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $owner = User::getOwnerDataById($uid); diff --git a/src/Module/Api/Friendica/Activity.php b/src/Module/Api/Friendica/Activity.php index d8edfd1a3..e0935c8ef 100644 --- a/src/Module/Api/Friendica/Activity.php +++ b/src/Module/Api/Friendica/Activity.php @@ -44,7 +44,7 @@ class Activity extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Circle/Create.php b/src/Module/Api/Friendica/Circle/Create.php index 8998dbdd9..ab38950ae 100644 --- a/src/Module/Api/Friendica/Circle/Create.php +++ b/src/Module/Api/Friendica/Circle/Create.php @@ -34,7 +34,7 @@ class Create extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Friendica/Circle/Delete.php b/src/Module/Api/Friendica/Circle/Delete.php index 3bbe5bc7b..3e40ecf6d 100644 --- a/src/Module/Api/Friendica/Circle/Delete.php +++ b/src/Module/Api/Friendica/Circle/Delete.php @@ -34,7 +34,7 @@ class Delete extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Circle/Show.php b/src/Module/Api/Friendica/Circle/Show.php index c6936dbe3..c9e6f981d 100644 --- a/src/Module/Api/Friendica/Circle/Show.php +++ b/src/Module/Api/Friendica/Circle/Show.php @@ -35,7 +35,7 @@ class Show extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $type = $this->getRequestValue($this->parameters, 'extension', 'json'); diff --git a/src/Module/Api/Friendica/Circle/Update.php b/src/Module/Api/Friendica/Circle/Update.php index d43082c79..b44d14290 100644 --- a/src/Module/Api/Friendica/Circle/Update.php +++ b/src/Module/Api/Friendica/Circle/Update.php @@ -35,7 +35,7 @@ class Update extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Friendica/DirectMessages/Search.php b/src/Module/Api/Friendica/DirectMessages/Search.php index 04c7a405b..dd83e6185 100644 --- a/src/Module/Api/Friendica/DirectMessages/Search.php +++ b/src/Module/Api/Friendica/DirectMessages/Search.php @@ -54,7 +54,7 @@ class Search extends BaseApi protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/DirectMessages/Setseen.php b/src/Module/Api/Friendica/DirectMessages/Setseen.php index aa9fc0dac..eff809685 100644 --- a/src/Module/Api/Friendica/DirectMessages/Setseen.php +++ b/src/Module/Api/Friendica/DirectMessages/Setseen.php @@ -32,7 +32,7 @@ class Setseen extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Events/Create.php b/src/Module/Api/Friendica/Events/Create.php index edc1c5936..57bfe15b8 100644 --- a/src/Module/Api/Friendica/Events/Create.php +++ b/src/Module/Api/Friendica/Events/Create.php @@ -40,7 +40,7 @@ class Create extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Friendica/Events/Delete.php b/src/Module/Api/Friendica/Events/Delete.php index b148c94e3..94d040aa1 100644 --- a/src/Module/Api/Friendica/Events/Delete.php +++ b/src/Module/Api/Friendica/Events/Delete.php @@ -35,7 +35,7 @@ class Delete extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Events/Index.php b/src/Module/Api/Friendica/Events/Index.php index a0986d8b0..dd349205a 100644 --- a/src/Module/Api/Friendica/Events/Index.php +++ b/src/Module/Api/Friendica/Events/Index.php @@ -34,7 +34,7 @@ class Index extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Notification.php b/src/Module/Api/Friendica/Notification.php index f61d3451c..896b719d7 100644 --- a/src/Module/Api/Friendica/Notification.php +++ b/src/Module/Api/Friendica/Notification.php @@ -33,7 +33,7 @@ class Notification extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $Notifies = DI::notify()->selectAllForUser($uid, 50); diff --git a/src/Module/Api/Friendica/Notification/Seen.php b/src/Module/Api/Friendica/Notification/Seen.php index c0c50dbe7..5699b1588 100644 --- a/src/Module/Api/Friendica/Notification/Seen.php +++ b/src/Module/Api/Friendica/Notification/Seen.php @@ -40,7 +40,7 @@ class Seen extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); if (DI::args()->getArgc() !== 4) { diff --git a/src/Module/Api/Friendica/Photo.php b/src/Module/Api/Friendica/Photo.php index 3653a97fd..d9031a755 100644 --- a/src/Module/Api/Friendica/Photo.php +++ b/src/Module/Api/Friendica/Photo.php @@ -46,7 +46,7 @@ class Photo extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $type = $this->getRequestValue($this->parameters, 'extension', 'json'); diff --git a/src/Module/Api/Friendica/Photo/Create.php b/src/Module/Api/Friendica/Photo/Create.php index b08b37411..771a35c2c 100644 --- a/src/Module/Api/Friendica/Photo/Create.php +++ b/src/Module/Api/Friendica/Photo/Create.php @@ -50,7 +50,7 @@ class Create extends BaseApi protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); $type = $this->getRequestValue($this->parameters, 'extension', 'json'); diff --git a/src/Module/Api/Friendica/Photo/Lists.php b/src/Module/Api/Friendica/Photo/Lists.php index 8a0a4d7eb..b8ba72514 100644 --- a/src/Module/Api/Friendica/Photo/Lists.php +++ b/src/Module/Api/Friendica/Photo/Lists.php @@ -52,7 +52,7 @@ class Lists extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $type = $this->getRequestValue($this->parameters, 'extension', 'json'); diff --git a/src/Module/Api/Friendica/Photo/Update.php b/src/Module/Api/Friendica/Photo/Update.php index 1e40f752c..d9441bd19 100644 --- a/src/Module/Api/Friendica/Photo/Update.php +++ b/src/Module/Api/Friendica/Photo/Update.php @@ -50,7 +50,7 @@ class Update extends BaseApi protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); $type = $this->getRequestValue($this->parameters, 'extension', 'json'); diff --git a/src/Module/Api/Friendica/Photoalbum/Delete.php b/src/Module/Api/Friendica/Photoalbum/Delete.php index 023d96797..2058edff5 100644 --- a/src/Module/Api/Friendica/Photoalbum/Delete.php +++ b/src/Module/Api/Friendica/Photoalbum/Delete.php @@ -36,7 +36,7 @@ class Delete extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Photoalbum/Index.php b/src/Module/Api/Friendica/Photoalbum/Index.php index af294585e..12de0df41 100644 --- a/src/Module/Api/Friendica/Photoalbum/Index.php +++ b/src/Module/Api/Friendica/Photoalbum/Index.php @@ -33,7 +33,7 @@ class Index extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $albums = Photo::getAlbums($uid); diff --git a/src/Module/Api/Friendica/Photoalbum/Show.php b/src/Module/Api/Friendica/Photoalbum/Show.php index 8e6d77ae5..66cd56cf0 100644 --- a/src/Module/Api/Friendica/Photoalbum/Show.php +++ b/src/Module/Api/Friendica/Photoalbum/Show.php @@ -52,7 +52,7 @@ class Show extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $type = $this->getRequestValue($this->parameters, 'extension', 'json'); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Photoalbum/Update.php b/src/Module/Api/Friendica/Photoalbum/Update.php index cba99b436..2ea498c39 100644 --- a/src/Module/Api/Friendica/Photoalbum/Update.php +++ b/src/Module/Api/Friendica/Photoalbum/Update.php @@ -34,7 +34,7 @@ class Update extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Friendica/Profile/Show.php b/src/Module/Api/Friendica/Profile/Show.php index 6aa2e8b66..8e68421f4 100644 --- a/src/Module/Api/Friendica/Profile/Show.php +++ b/src/Module/Api/Friendica/Profile/Show.php @@ -36,7 +36,7 @@ class Show extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); // retrieve general information about profiles for user diff --git a/src/Module/Api/Friendica/Statuses/Dislike.php b/src/Module/Api/Friendica/Statuses/Dislike.php index 01bfeba90..5491bf189 100644 --- a/src/Module/Api/Friendica/Statuses/Dislike.php +++ b/src/Module/Api/Friendica/Statuses/Dislike.php @@ -35,7 +35,7 @@ class Dislike extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Friendica/Statuses/Undislike.php b/src/Module/Api/Friendica/Statuses/Undislike.php index 4ede1fd94..a646045e5 100644 --- a/src/Module/Api/Friendica/Statuses/Undislike.php +++ b/src/Module/Api/Friendica/Statuses/Undislike.php @@ -35,7 +35,7 @@ class Undislike extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/GNUSocial/Statusnet/Conversation.php b/src/Module/Api/GNUSocial/Statusnet/Conversation.php index 522b237b6..b7dff6f8c 100644 --- a/src/Module/Api/GNUSocial/Statusnet/Conversation.php +++ b/src/Module/Api/GNUSocial/Statusnet/Conversation.php @@ -37,7 +37,7 @@ class Conversation extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Mastodon/Accounts/Block.php b/src/Module/Api/Mastodon/Accounts/Block.php index c4afb74a3..1ddafda56 100644 --- a/src/Module/Api/Mastodon/Accounts/Block.php +++ b/src/Module/Api/Mastodon/Accounts/Block.php @@ -34,7 +34,7 @@ class Block extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/FeaturedTags.php b/src/Module/Api/Mastodon/Accounts/FeaturedTags.php index 52c0c2831..c57b63cf6 100644 --- a/src/Module/Api/Mastodon/Accounts/FeaturedTags.php +++ b/src/Module/Api/Mastodon/Accounts/FeaturedTags.php @@ -34,7 +34,7 @@ class FeaturedTags extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $this->jsonExit([]); } diff --git a/src/Module/Api/Mastodon/Accounts/Follow.php b/src/Module/Api/Mastodon/Accounts/Follow.php index ad290f5ab..a666f2f91 100644 --- a/src/Module/Api/Mastodon/Accounts/Follow.php +++ b/src/Module/Api/Mastodon/Accounts/Follow.php @@ -33,7 +33,7 @@ class Follow extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Followers.php b/src/Module/Api/Mastodon/Accounts/Followers.php index 65c7ac42d..e433943c8 100644 --- a/src/Module/Api/Mastodon/Accounts/Followers.php +++ b/src/Module/Api/Mastodon/Accounts/Followers.php @@ -37,7 +37,7 @@ class Followers extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Following.php b/src/Module/Api/Mastodon/Accounts/Following.php index 5da678d9d..3b19e1eed 100644 --- a/src/Module/Api/Mastodon/Accounts/Following.php +++ b/src/Module/Api/Mastodon/Accounts/Following.php @@ -37,7 +37,7 @@ class Following extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/IdentityProofs.php b/src/Module/Api/Mastodon/Accounts/IdentityProofs.php index ac2f2ab55..97ec4ecbd 100644 --- a/src/Module/Api/Mastodon/Accounts/IdentityProofs.php +++ b/src/Module/Api/Mastodon/Accounts/IdentityProofs.php @@ -34,7 +34,7 @@ class IdentityProofs extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $this->jsonExit([]); } diff --git a/src/Module/Api/Mastodon/Accounts/Lists.php b/src/Module/Api/Mastodon/Accounts/Lists.php index d39f79081..4a494838b 100644 --- a/src/Module/Api/Mastodon/Accounts/Lists.php +++ b/src/Module/Api/Mastodon/Accounts/Lists.php @@ -37,7 +37,7 @@ class Lists extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Mute.php b/src/Module/Api/Mastodon/Accounts/Mute.php index f08e48154..4169cb90f 100644 --- a/src/Module/Api/Mastodon/Accounts/Mute.php +++ b/src/Module/Api/Mastodon/Accounts/Mute.php @@ -33,7 +33,7 @@ class Mute extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Note.php b/src/Module/Api/Mastodon/Accounts/Note.php index fc7e72247..24df3b357 100644 --- a/src/Module/Api/Mastodon/Accounts/Note.php +++ b/src/Module/Api/Mastodon/Accounts/Note.php @@ -34,7 +34,7 @@ class Note extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Relationships.php b/src/Module/Api/Mastodon/Accounts/Relationships.php index 531fcadd1..4ae5b0669 100644 --- a/src/Module/Api/Mastodon/Accounts/Relationships.php +++ b/src/Module/Api/Mastodon/Accounts/Relationships.php @@ -36,7 +36,7 @@ class Relationships extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Accounts/Search.php b/src/Module/Api/Mastodon/Accounts/Search.php index a4936092c..70b42494f 100644 --- a/src/Module/Api/Mastodon/Accounts/Search.php +++ b/src/Module/Api/Mastodon/Accounts/Search.php @@ -38,7 +38,7 @@ class Search extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Accounts/Unblock.php b/src/Module/Api/Mastodon/Accounts/Unblock.php index 35b532012..8d8fb3e39 100644 --- a/src/Module/Api/Mastodon/Accounts/Unblock.php +++ b/src/Module/Api/Mastodon/Accounts/Unblock.php @@ -33,7 +33,7 @@ class Unblock extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Unfollow.php b/src/Module/Api/Mastodon/Accounts/Unfollow.php index c4bc17200..83676f25a 100644 --- a/src/Module/Api/Mastodon/Accounts/Unfollow.php +++ b/src/Module/Api/Mastodon/Accounts/Unfollow.php @@ -33,7 +33,7 @@ class Unfollow extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Unmute.php b/src/Module/Api/Mastodon/Accounts/Unmute.php index a2cf90820..7708e1472 100644 --- a/src/Module/Api/Mastodon/Accounts/Unmute.php +++ b/src/Module/Api/Mastodon/Accounts/Unmute.php @@ -33,7 +33,7 @@ class Unmute extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php b/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php index 170861461..69c992c48 100644 --- a/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php +++ b/src/Module/Api/Mastodon/Accounts/UpdateCredentials.php @@ -36,7 +36,7 @@ class UpdateCredentials extends BaseApi { protected function patch(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $owner = User::getOwnerDataById($uid); diff --git a/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php b/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php index d59549ae8..2e6d64ff6 100644 --- a/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php +++ b/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php @@ -37,7 +37,7 @@ class VerifyCredentials extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $self = User::getOwnerDataById($uid); diff --git a/src/Module/Api/Mastodon/Announcements.php b/src/Module/Api/Mastodon/Announcements.php index 8e0565947..10f6037e7 100644 --- a/src/Module/Api/Mastodon/Announcements.php +++ b/src/Module/Api/Mastodon/Announcements.php @@ -34,7 +34,7 @@ class Announcements extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); // @todo Possibly use the message from the pageheader addon for this $this->jsonExit([]); diff --git a/src/Module/Api/Mastodon/Apps/VerifyCredentials.php b/src/Module/Api/Mastodon/Apps/VerifyCredentials.php index c21e1e438..82e0016ef 100644 --- a/src/Module/Api/Mastodon/Apps/VerifyCredentials.php +++ b/src/Module/Api/Mastodon/Apps/VerifyCredentials.php @@ -32,7 +32,7 @@ class VerifyCredentials extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $application = self::getCurrentApplication(); if (empty($application['id'])) { diff --git a/src/Module/Api/Mastodon/Blocks.php b/src/Module/Api/Mastodon/Blocks.php index 1495b7635..f4256f165 100644 --- a/src/Module/Api/Mastodon/Blocks.php +++ b/src/Module/Api/Mastodon/Blocks.php @@ -36,7 +36,7 @@ class Blocks extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Bookmarks.php b/src/Module/Api/Mastodon/Bookmarks.php index dab072b30..fb4694055 100644 --- a/src/Module/Api/Mastodon/Bookmarks.php +++ b/src/Module/Api/Mastodon/Bookmarks.php @@ -39,7 +39,7 @@ class Bookmarks extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Conversations.php b/src/Module/Api/Mastodon/Conversations.php index abffff9ed..71239a0ff 100644 --- a/src/Module/Api/Mastodon/Conversations.php +++ b/src/Module/Api/Mastodon/Conversations.php @@ -33,7 +33,7 @@ class Conversations extends BaseApi { protected function delete(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (!empty($this->parameters['id'])) { @@ -51,7 +51,7 @@ class Conversations extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Conversations/Read.php b/src/Module/Api/Mastodon/Conversations/Read.php index e8b101634..5bb7b3526 100644 --- a/src/Module/Api/Mastodon/Conversations/Read.php +++ b/src/Module/Api/Mastodon/Conversations/Read.php @@ -33,7 +33,7 @@ class Read extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (!empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Favourited.php b/src/Module/Api/Mastodon/Favourited.php index 56beb93be..141099edd 100644 --- a/src/Module/Api/Mastodon/Favourited.php +++ b/src/Module/Api/Mastodon/Favourited.php @@ -41,7 +41,7 @@ class Favourited extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Filters.php b/src/Module/Api/Mastodon/Filters.php index 3af93d24c..5a40574a4 100644 --- a/src/Module/Api/Mastodon/Filters.php +++ b/src/Module/Api/Mastodon/Filters.php @@ -33,7 +33,7 @@ class Filters extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $this->response->unsupported(Router::POST, $request); } @@ -43,7 +43,7 @@ class Filters extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $this->jsonExit([]); } diff --git a/src/Module/Api/Mastodon/FollowRequests.php b/src/Module/Api/Mastodon/FollowRequests.php index 78efa4819..9947e8d48 100644 --- a/src/Module/Api/Mastodon/FollowRequests.php +++ b/src/Module/Api/Mastodon/FollowRequests.php @@ -44,7 +44,7 @@ class FollowRequests extends BaseApi */ protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_FOLLOW); + $this->checkAllowedScope(self::SCOPE_FOLLOW); $uid = self::getCurrentUserID(); $cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid); @@ -89,7 +89,7 @@ class FollowRequests extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/FollowedTags.php b/src/Module/Api/Mastodon/FollowedTags.php index 905229006..a327db727 100644 --- a/src/Module/Api/Mastodon/FollowedTags.php +++ b/src/Module/Api/Mastodon/FollowedTags.php @@ -32,7 +32,7 @@ class FollowedTags extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Lists.php b/src/Module/Api/Mastodon/Lists.php index 296009cc0..571927a16 100644 --- a/src/Module/Api/Mastodon/Lists.php +++ b/src/Module/Api/Mastodon/Lists.php @@ -33,7 +33,7 @@ class Lists extends BaseApi { protected function delete(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { @@ -53,7 +53,7 @@ class Lists extends BaseApi protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ @@ -93,7 +93,7 @@ class Lists extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Lists/Accounts.php b/src/Module/Api/Mastodon/Lists/Accounts.php index 2d202c34d..135701904 100644 --- a/src/Module/Api/Mastodon/Lists/Accounts.php +++ b/src/Module/Api/Mastodon/Lists/Accounts.php @@ -36,7 +36,7 @@ class Accounts extends BaseApi { protected function delete(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $request = $this->getRequest([ 'account_ids' => [], // Array of account IDs to remove from the list @@ -51,7 +51,7 @@ class Accounts extends BaseApi protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $request = $this->getRequest([ 'account_ids' => [], // Array of account IDs to add to the list @@ -69,7 +69,7 @@ class Accounts extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Markers.php b/src/Module/Api/Mastodon/Markers.php index 2f0a6b6b7..eb19acf8e 100644 --- a/src/Module/Api/Mastodon/Markers.php +++ b/src/Module/Api/Mastodon/Markers.php @@ -34,7 +34,7 @@ class Markers extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); @@ -69,7 +69,7 @@ class Markers extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); diff --git a/src/Module/Api/Mastodon/Media.php b/src/Module/Api/Mastodon/Media.php index 3fe8dfa3d..b2424f022 100644 --- a/src/Module/Api/Mastodon/Media.php +++ b/src/Module/Api/Mastodon/Media.php @@ -35,7 +35,7 @@ class Media extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ @@ -63,7 +63,7 @@ class Media extends BaseApi public function put(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ @@ -100,7 +100,7 @@ class Media extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Mutes.php b/src/Module/Api/Mastodon/Mutes.php index 71c17cc51..177b61877 100644 --- a/src/Module/Api/Mastodon/Mutes.php +++ b/src/Module/Api/Mastodon/Mutes.php @@ -36,7 +36,7 @@ class Mutes extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Notifications.php b/src/Module/Api/Mastodon/Notifications.php index 94247b80b..ee3a253b3 100644 --- a/src/Module/Api/Mastodon/Notifications.php +++ b/src/Module/Api/Mastodon/Notifications.php @@ -41,7 +41,7 @@ class Notifications extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (!empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Notifications/Clear.php b/src/Module/Api/Mastodon/Notifications/Clear.php index cb2604337..1f843f048 100644 --- a/src/Module/Api/Mastodon/Notifications/Clear.php +++ b/src/Module/Api/Mastodon/Notifications/Clear.php @@ -32,7 +32,7 @@ class Clear extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); DI::notification()->setAllDismissedForUser($uid); diff --git a/src/Module/Api/Mastodon/Notifications/Dismiss.php b/src/Module/Api/Mastodon/Notifications/Dismiss.php index 753c0ac5d..50d1be27b 100644 --- a/src/Module/Api/Mastodon/Notifications/Dismiss.php +++ b/src/Module/Api/Mastodon/Notifications/Dismiss.php @@ -34,7 +34,7 @@ class Dismiss extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Preferences.php b/src/Module/Api/Mastodon/Preferences.php index d1f9d2d30..7a8eb1175 100644 --- a/src/Module/Api/Mastodon/Preferences.php +++ b/src/Module/Api/Mastodon/Preferences.php @@ -36,7 +36,7 @@ class Preferences extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $user = User::getById($uid, ['language', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid']); diff --git a/src/Module/Api/Mastodon/PushSubscription.php b/src/Module/Api/Mastodon/PushSubscription.php index a80188013..a03d0250c 100644 --- a/src/Module/Api/Mastodon/PushSubscription.php +++ b/src/Module/Api/Mastodon/PushSubscription.php @@ -49,7 +49,7 @@ class PushSubscription extends BaseApi protected function post(array $request = []): void { - self::checkAllowedScope(self::SCOPE_PUSH); + $this->checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); @@ -83,7 +83,7 @@ class PushSubscription extends BaseApi public function put(array $request = []): void { - self::checkAllowedScope(self::SCOPE_PUSH); + $this->checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); @@ -122,7 +122,7 @@ class PushSubscription extends BaseApi protected function delete(array $request = []): void { - self::checkAllowedScope(self::SCOPE_PUSH); + $this->checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); @@ -139,7 +139,7 @@ class PushSubscription extends BaseApi protected function rawContent(array $request = []): void { - self::checkAllowedScope(self::SCOPE_PUSH); + $this->checkAllowedScope(self::SCOPE_PUSH); $uid = self::getCurrentUserID(); $application = self::getCurrentApplication(); diff --git a/src/Module/Api/Mastodon/Reports.php b/src/Module/Api/Mastodon/Reports.php index 2706aefe3..324fe49d8 100644 --- a/src/Module/Api/Mastodon/Reports.php +++ b/src/Module/Api/Mastodon/Reports.php @@ -51,7 +51,7 @@ class Reports extends BaseApi public function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $request = $this->getRequest([ 'account_id' => '', // ID of the account to report diff --git a/src/Module/Api/Mastodon/ScheduledStatuses.php b/src/Module/Api/Mastodon/ScheduledStatuses.php index 6ac9430c6..5204ab556 100644 --- a/src/Module/Api/Mastodon/ScheduledStatuses.php +++ b/src/Module/Api/Mastodon/ScheduledStatuses.php @@ -35,7 +35,7 @@ class ScheduledStatuses extends BaseApi { public function put(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $this->response->unsupported(Router::PUT, $request); @@ -43,7 +43,7 @@ class ScheduledStatuses extends BaseApi protected function delete(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { @@ -64,7 +64,7 @@ class ScheduledStatuses extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (isset($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index e0f629527..ec4527f00 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -43,7 +43,7 @@ class Search extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 0369d2026..749e0aa39 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -49,7 +49,7 @@ class Statuses extends BaseApi { public function put(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ @@ -164,7 +164,7 @@ class Statuses extends BaseApi protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ @@ -315,7 +315,7 @@ class Statuses extends BaseApi protected function delete(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Bookmark.php b/src/Module/Api/Mastodon/Statuses/Bookmark.php index ff34a8529..f2e5ff40d 100644 --- a/src/Module/Api/Mastodon/Statuses/Bookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Bookmark.php @@ -35,7 +35,7 @@ class Bookmark extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Favourite.php b/src/Module/Api/Mastodon/Statuses/Favourite.php index da698c72f..d8cf8054e 100644 --- a/src/Module/Api/Mastodon/Statuses/Favourite.php +++ b/src/Module/Api/Mastodon/Statuses/Favourite.php @@ -35,7 +35,7 @@ class Favourite extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Mute.php b/src/Module/Api/Mastodon/Statuses/Mute.php index 56c352b34..d282770df 100644 --- a/src/Module/Api/Mastodon/Statuses/Mute.php +++ b/src/Module/Api/Mastodon/Statuses/Mute.php @@ -35,7 +35,7 @@ class Mute extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Pin.php b/src/Module/Api/Mastodon/Statuses/Pin.php index c95f02e9b..d9f95132c 100644 --- a/src/Module/Api/Mastodon/Statuses/Pin.php +++ b/src/Module/Api/Mastodon/Statuses/Pin.php @@ -34,7 +34,7 @@ class Pin extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Reblog.php b/src/Module/Api/Mastodon/Statuses/Reblog.php index d0cf46b06..6c368b019 100644 --- a/src/Module/Api/Mastodon/Statuses/Reblog.php +++ b/src/Module/Api/Mastodon/Statuses/Reblog.php @@ -38,7 +38,7 @@ class Reblog extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Source.php b/src/Module/Api/Mastodon/Statuses/Source.php index db997b0a3..408df3aad 100644 --- a/src/Module/Api/Mastodon/Statuses/Source.php +++ b/src/Module/Api/Mastodon/Statuses/Source.php @@ -37,7 +37,7 @@ class Source extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Unbookmark.php b/src/Module/Api/Mastodon/Statuses/Unbookmark.php index 3bda450e4..36902fb21 100644 --- a/src/Module/Api/Mastodon/Statuses/Unbookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Unbookmark.php @@ -35,7 +35,7 @@ class Unbookmark extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Unfavourite.php b/src/Module/Api/Mastodon/Statuses/Unfavourite.php index c41ed8d89..c6a924b2a 100644 --- a/src/Module/Api/Mastodon/Statuses/Unfavourite.php +++ b/src/Module/Api/Mastodon/Statuses/Unfavourite.php @@ -35,7 +35,7 @@ class Unfavourite extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Unmute.php b/src/Module/Api/Mastodon/Statuses/Unmute.php index 3668cb945..edf14925d 100644 --- a/src/Module/Api/Mastodon/Statuses/Unmute.php +++ b/src/Module/Api/Mastodon/Statuses/Unmute.php @@ -35,7 +35,7 @@ class Unmute extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Unpin.php b/src/Module/Api/Mastodon/Statuses/Unpin.php index fd23e3014..0f5d44afa 100644 --- a/src/Module/Api/Mastodon/Statuses/Unpin.php +++ b/src/Module/Api/Mastodon/Statuses/Unpin.php @@ -34,7 +34,7 @@ class Unpin extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Statuses/Unreblog.php b/src/Module/Api/Mastodon/Statuses/Unreblog.php index 3d1f7ea9a..4f72eac25 100644 --- a/src/Module/Api/Mastodon/Statuses/Unreblog.php +++ b/src/Module/Api/Mastodon/Statuses/Unreblog.php @@ -37,7 +37,7 @@ class Unreblog extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Suggestions.php b/src/Module/Api/Mastodon/Suggestions.php index f18637b3d..7c5d53449 100644 --- a/src/Module/Api/Mastodon/Suggestions.php +++ b/src/Module/Api/Mastodon/Suggestions.php @@ -36,7 +36,7 @@ class Suggestions extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Tags.php b/src/Module/Api/Mastodon/Tags.php index 474bbe079..d636dd912 100644 --- a/src/Module/Api/Mastodon/Tags.php +++ b/src/Module/Api/Mastodon/Tags.php @@ -36,7 +36,7 @@ class Tags extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['hashtag'])) { diff --git a/src/Module/Api/Mastodon/Tags/Follow.php b/src/Module/Api/Mastodon/Tags/Follow.php index ec27ea733..a450b2248 100644 --- a/src/Module/Api/Mastodon/Tags/Follow.php +++ b/src/Module/Api/Mastodon/Tags/Follow.php @@ -33,7 +33,7 @@ class Follow extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['hashtag'])) { diff --git a/src/Module/Api/Mastodon/Tags/Unfollow.php b/src/Module/Api/Mastodon/Tags/Unfollow.php index 02847f1fd..b4a1a7e73 100644 --- a/src/Module/Api/Mastodon/Tags/Unfollow.php +++ b/src/Module/Api/Mastodon/Tags/Unfollow.php @@ -33,7 +33,7 @@ class Unfollow extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['hashtag'])) { diff --git a/src/Module/Api/Mastodon/Timelines/Direct.php b/src/Module/Api/Mastodon/Timelines/Direct.php index e326bc7a1..c1e710970 100644 --- a/src/Module/Api/Mastodon/Timelines/Direct.php +++ b/src/Module/Api/Mastodon/Timelines/Direct.php @@ -37,7 +37,7 @@ class Direct extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php index e9985508c..d92a87636 100644 --- a/src/Module/Api/Mastodon/Timelines/Home.php +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -41,7 +41,7 @@ class Home extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $request = $this->getRequest([ diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php index fa4605128..2834b63fc 100644 --- a/src/Module/Api/Mastodon/Timelines/ListTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -41,7 +41,7 @@ class ListTimeline extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php index 5b3e82508..9bbafd587 100644 --- a/src/Module/Api/Mastodon/Timelines/Tag.php +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -41,7 +41,7 @@ class Tag extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['hashtag'])) { diff --git a/src/Module/Api/Twitter/Account/UpdateProfile.php b/src/Module/Api/Twitter/Account/UpdateProfile.php index c58b8d24c..2dfd2fb24 100644 --- a/src/Module/Api/Twitter/Account/UpdateProfile.php +++ b/src/Module/Api/Twitter/Account/UpdateProfile.php @@ -34,7 +34,7 @@ class UpdateProfile extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); $api_user = DI::twitterUser()->createFromUserId($uid, true)->toArray(); diff --git a/src/Module/Api/Twitter/Account/UpdateProfileImage.php b/src/Module/Api/Twitter/Account/UpdateProfileImage.php index f6ac2d198..421963a48 100644 --- a/src/Module/Api/Twitter/Account/UpdateProfileImage.php +++ b/src/Module/Api/Twitter/Account/UpdateProfileImage.php @@ -35,7 +35,7 @@ class UpdateProfileImage extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // get mediadata from image or media (Twitter call api/account/update_profile_image provides image) diff --git a/src/Module/Api/Twitter/Account/VerifyCredentials.php b/src/Module/Api/Twitter/Account/VerifyCredentials.php index 738c08e5a..b6f608a83 100644 --- a/src/Module/Api/Twitter/Account/VerifyCredentials.php +++ b/src/Module/Api/Twitter/Account/VerifyCredentials.php @@ -34,7 +34,7 @@ class VerifyCredentials extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $skip_status = $this->getRequestValue($request, 'skip_status', false); diff --git a/src/Module/Api/Twitter/Blocks/Ids.php b/src/Module/Api/Twitter/Blocks/Ids.php index e08dcf40f..d4798b2f3 100644 --- a/src/Module/Api/Twitter/Blocks/Ids.php +++ b/src/Module/Api/Twitter/Blocks/Ids.php @@ -33,7 +33,7 @@ class Ids extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/Blocks/Lists.php b/src/Module/Api/Twitter/Blocks/Lists.php index ec5d71120..51d682ec1 100644 --- a/src/Module/Api/Twitter/Blocks/Lists.php +++ b/src/Module/Api/Twitter/Blocks/Lists.php @@ -33,7 +33,7 @@ class Lists extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/ContactEndpoint.php b/src/Module/Api/Twitter/ContactEndpoint.php index 1ff9c7833..948e4980e 100644 --- a/src/Module/Api/Twitter/ContactEndpoint.php +++ b/src/Module/Api/Twitter/ContactEndpoint.php @@ -42,7 +42,7 @@ abstract class ContactEndpoint extends BaseApi { parent::__construct($errorFactory, $app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); } /** diff --git a/src/Module/Api/Twitter/DirectMessages/All.php b/src/Module/Api/Twitter/DirectMessages/All.php index cfd43ed84..8df751677 100644 --- a/src/Module/Api/Twitter/DirectMessages/All.php +++ b/src/Module/Api/Twitter/DirectMessages/All.php @@ -31,7 +31,7 @@ class All extends DirectMessagesEndpoint { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $this->getMessages($request, $uid, []); diff --git a/src/Module/Api/Twitter/DirectMessages/Conversation.php b/src/Module/Api/Twitter/DirectMessages/Conversation.php index 91157e970..6b3e0a1d3 100644 --- a/src/Module/Api/Twitter/DirectMessages/Conversation.php +++ b/src/Module/Api/Twitter/DirectMessages/Conversation.php @@ -31,7 +31,7 @@ class Conversation extends DirectMessagesEndpoint { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $this->getMessages($request, $uid, ["`parent-uri` = ?", $this->getRequestValue($request, 'uri', '')]); diff --git a/src/Module/Api/Twitter/DirectMessages/Destroy.php b/src/Module/Api/Twitter/DirectMessages/Destroy.php index 7108263ba..06879a659 100644 --- a/src/Module/Api/Twitter/DirectMessages/Destroy.php +++ b/src/Module/Api/Twitter/DirectMessages/Destroy.php @@ -49,7 +49,7 @@ class Destroy extends BaseApi } protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); $id = $this->getRequestValue($request, 'id', 0); diff --git a/src/Module/Api/Twitter/DirectMessages/Inbox.php b/src/Module/Api/Twitter/DirectMessages/Inbox.php index 798cceb41..b163ca29b 100644 --- a/src/Module/Api/Twitter/DirectMessages/Inbox.php +++ b/src/Module/Api/Twitter/DirectMessages/Inbox.php @@ -34,7 +34,7 @@ class Inbox extends DirectMessagesEndpoint { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $pcid = Contact::getPublicIdByUserId($uid); diff --git a/src/Module/Api/Twitter/DirectMessages/NewDM.php b/src/Module/Api/Twitter/DirectMessages/NewDM.php index d111f98cb..f452560b6 100644 --- a/src/Module/Api/Twitter/DirectMessages/NewDM.php +++ b/src/Module/Api/Twitter/DirectMessages/NewDM.php @@ -56,7 +56,7 @@ class NewDM extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); if (empty($request['text']) || empty($request['screen_name']) && empty($request['user_id'])) { diff --git a/src/Module/Api/Twitter/DirectMessages/Sent.php b/src/Module/Api/Twitter/DirectMessages/Sent.php index 2db0d4834..03f62406b 100644 --- a/src/Module/Api/Twitter/DirectMessages/Sent.php +++ b/src/Module/Api/Twitter/DirectMessages/Sent.php @@ -34,7 +34,7 @@ class Sent extends DirectMessagesEndpoint { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $pcid = Contact::getPublicIdByUserId($uid); diff --git a/src/Module/Api/Twitter/Favorites.php b/src/Module/Api/Twitter/Favorites.php index 771e0ef48..fbb0a9641 100644 --- a/src/Module/Api/Twitter/Favorites.php +++ b/src/Module/Api/Twitter/Favorites.php @@ -38,7 +38,7 @@ class Favorites extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // in friendica starred item are private diff --git a/src/Module/Api/Twitter/Favorites/Create.php b/src/Module/Api/Twitter/Favorites/Create.php index 86a398804..28c4adced 100644 --- a/src/Module/Api/Twitter/Favorites/Create.php +++ b/src/Module/Api/Twitter/Favorites/Create.php @@ -34,7 +34,7 @@ class Create extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $id = $this->getRequestValue($request, 'id', 0); diff --git a/src/Module/Api/Twitter/Favorites/Destroy.php b/src/Module/Api/Twitter/Favorites/Destroy.php index e481f8a9f..0c7f9acae 100644 --- a/src/Module/Api/Twitter/Favorites/Destroy.php +++ b/src/Module/Api/Twitter/Favorites/Destroy.php @@ -34,7 +34,7 @@ class Destroy extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $id = $this->getRequestValue($request, 'id', 0); diff --git a/src/Module/Api/Twitter/Followers/Ids.php b/src/Module/Api/Twitter/Followers/Ids.php index 21adc682b..7b7104c70 100644 --- a/src/Module/Api/Twitter/Followers/Ids.php +++ b/src/Module/Api/Twitter/Followers/Ids.php @@ -34,7 +34,7 @@ class Ids extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/Followers/Lists.php b/src/Module/Api/Twitter/Followers/Lists.php index b4064fc27..48201134f 100644 --- a/src/Module/Api/Twitter/Followers/Lists.php +++ b/src/Module/Api/Twitter/Followers/Lists.php @@ -33,7 +33,7 @@ class Lists extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/Friends/Ids.php b/src/Module/Api/Twitter/Friends/Ids.php index e12d67aae..4b4a0e128 100644 --- a/src/Module/Api/Twitter/Friends/Ids.php +++ b/src/Module/Api/Twitter/Friends/Ids.php @@ -34,7 +34,7 @@ class Ids extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/Friends/Lists.php b/src/Module/Api/Twitter/Friends/Lists.php index 617d70e4d..216e299f3 100644 --- a/src/Module/Api/Twitter/Friends/Lists.php +++ b/src/Module/Api/Twitter/Friends/Lists.php @@ -33,7 +33,7 @@ class Lists extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/Friendships/Destroy.php b/src/Module/Api/Twitter/Friendships/Destroy.php index 05cc30488..2323c5003 100644 --- a/src/Module/Api/Twitter/Friendships/Destroy.php +++ b/src/Module/Api/Twitter/Friendships/Destroy.php @@ -54,7 +54,7 @@ class Destroy extends ContactEndpoint protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); $owner = User::getOwnerDataById($uid); diff --git a/src/Module/Api/Twitter/Friendships/Incoming.php b/src/Module/Api/Twitter/Friendships/Incoming.php index 62c372fa2..47980608c 100644 --- a/src/Module/Api/Twitter/Friendships/Incoming.php +++ b/src/Module/Api/Twitter/Friendships/Incoming.php @@ -32,7 +32,7 @@ class Incoming extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // Expected value for user_id parameter: public/user contact id diff --git a/src/Module/Api/Twitter/Friendships/Show.php b/src/Module/Api/Twitter/Friendships/Show.php index 6dd1c1d20..950cac488 100644 --- a/src/Module/Api/Twitter/Friendships/Show.php +++ b/src/Module/Api/Twitter/Friendships/Show.php @@ -35,7 +35,7 @@ class Show extends ContactEndpoint { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $source_cid = BaseApi::getContactIDForSearchterm($this->getRequestValue($request, 'source_screen_name', ''), '', $this->getRequestValue($request, 'source_id', 0), $uid); diff --git a/src/Module/Api/Twitter/Lists/Create.php b/src/Module/Api/Twitter/Lists/Create.php index ed4650adc..aa5f385e1 100644 --- a/src/Module/Api/Twitter/Lists/Create.php +++ b/src/Module/Api/Twitter/Lists/Create.php @@ -56,7 +56,7 @@ class Create extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Twitter/Lists/Destroy.php b/src/Module/Api/Twitter/Lists/Destroy.php index 0e13ac9b2..d0277bcb7 100644 --- a/src/Module/Api/Twitter/Lists/Destroy.php +++ b/src/Module/Api/Twitter/Lists/Destroy.php @@ -56,7 +56,7 @@ class Destroy extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Twitter/Lists/Lists.php b/src/Module/Api/Twitter/Lists/Lists.php index 8ebef3789..dbb7e820b 100644 --- a/src/Module/Api/Twitter/Lists/Lists.php +++ b/src/Module/Api/Twitter/Lists/Lists.php @@ -33,7 +33,7 @@ class Lists extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // This is a dummy endpoint diff --git a/src/Module/Api/Twitter/Lists/Ownership.php b/src/Module/Api/Twitter/Lists/Ownership.php index 11b85c51a..4cb7ba26a 100644 --- a/src/Module/Api/Twitter/Lists/Ownership.php +++ b/src/Module/Api/Twitter/Lists/Ownership.php @@ -53,7 +53,7 @@ class Ownership extends BaseApi } protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $circles = $this->dba->select('group', [], ['deleted' => false, 'uid' => $uid, 'cid' => null]); diff --git a/src/Module/Api/Twitter/Lists/Statuses.php b/src/Module/Api/Twitter/Lists/Statuses.php index 6e12f5908..4a7ada4b3 100644 --- a/src/Module/Api/Twitter/Lists/Statuses.php +++ b/src/Module/Api/Twitter/Lists/Statuses.php @@ -58,7 +58,7 @@ class Statuses extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); if (empty($request['list_id'])) { diff --git a/src/Module/Api/Twitter/Lists/Update.php b/src/Module/Api/Twitter/Lists/Update.php index 17fd4636b..59292fa16 100644 --- a/src/Module/Api/Twitter/Lists/Update.php +++ b/src/Module/Api/Twitter/Lists/Update.php @@ -56,7 +56,7 @@ class Update extends BaseApi protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); // params diff --git a/src/Module/Api/Twitter/Media/Metadata/Create.php b/src/Module/Api/Twitter/Media/Metadata/Create.php index be7963637..68ac12f0c 100644 --- a/src/Module/Api/Twitter/Media/Metadata/Create.php +++ b/src/Module/Api/Twitter/Media/Metadata/Create.php @@ -36,7 +36,7 @@ class Create extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); $postdata = Network::postdata(); diff --git a/src/Module/Api/Twitter/Media/Upload.php b/src/Module/Api/Twitter/Media/Upload.php index 0ea93f87b..d7400e68b 100644 --- a/src/Module/Api/Twitter/Media/Upload.php +++ b/src/Module/Api/Twitter/Media/Upload.php @@ -37,7 +37,7 @@ class Upload extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE); + $this->checkAllowedScope(BaseApi::SCOPE_WRITE); $uid = BaseApi::getCurrentUserID(); if (empty($_FILES['media'])) { diff --git a/src/Module/Api/Twitter/SavedSearches.php b/src/Module/Api/Twitter/SavedSearches.php index 8a6e5ced8..7a0d6fdb1 100644 --- a/src/Module/Api/Twitter/SavedSearches.php +++ b/src/Module/Api/Twitter/SavedSearches.php @@ -32,7 +32,7 @@ class SavedSearches extends BaseApi { protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); $terms = DBA::select('search', ['id', 'term'], ['uid' => $uid]); diff --git a/src/Module/Api/Twitter/Search/Tweets.php b/src/Module/Api/Twitter/Search/Tweets.php index ec13f00dc..9bf8ac282 100644 --- a/src/Module/Api/Twitter/Search/Tweets.php +++ b/src/Module/Api/Twitter/Search/Tweets.php @@ -38,7 +38,7 @@ class Tweets extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); if (empty($request['q'])) { diff --git a/src/Module/Api/Twitter/Statuses/Destroy.php b/src/Module/Api/Twitter/Statuses/Destroy.php index bde3ee678..8d86e0614 100644 --- a/src/Module/Api/Twitter/Statuses/Destroy.php +++ b/src/Module/Api/Twitter/Statuses/Destroy.php @@ -37,7 +37,7 @@ class Destroy extends BaseApi { protected function post(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $id = $this->getRequestValue($request, 'id', 0); diff --git a/src/Module/Api/Twitter/Statuses/HomeTimeline.php b/src/Module/Api/Twitter/Statuses/HomeTimeline.php index d7caea65d..22715a371 100644 --- a/src/Module/Api/Twitter/Statuses/HomeTimeline.php +++ b/src/Module/Api/Twitter/Statuses/HomeTimeline.php @@ -37,7 +37,7 @@ class HomeTimeline extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // get last network messages diff --git a/src/Module/Api/Twitter/Statuses/Mentions.php b/src/Module/Api/Twitter/Statuses/Mentions.php index 18d56f1a1..aaacb9f06 100644 --- a/src/Module/Api/Twitter/Statuses/Mentions.php +++ b/src/Module/Api/Twitter/Statuses/Mentions.php @@ -37,7 +37,7 @@ class Mentions extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // get last network messages diff --git a/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php b/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php index 1f4cbc1b4..6069bc96e 100644 --- a/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php +++ b/src/Module/Api/Twitter/Statuses/NetworkPublicTimeline.php @@ -35,7 +35,7 @@ class NetworkPublicTimeline extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $count = $this->getRequestValue($request, 'count', 20, 1, 100); diff --git a/src/Module/Api/Twitter/Statuses/PublicTimeline.php b/src/Module/Api/Twitter/Statuses/PublicTimeline.php index 49b9c986f..511e4465b 100644 --- a/src/Module/Api/Twitter/Statuses/PublicTimeline.php +++ b/src/Module/Api/Twitter/Statuses/PublicTimeline.php @@ -35,7 +35,7 @@ class PublicTimeline extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); // get last network messages diff --git a/src/Module/Api/Twitter/Statuses/Retweet.php b/src/Module/Api/Twitter/Statuses/Retweet.php index 6640f880c..e94632b65 100644 --- a/src/Module/Api/Twitter/Statuses/Retweet.php +++ b/src/Module/Api/Twitter/Statuses/Retweet.php @@ -41,7 +41,7 @@ class Retweet extends BaseApi { protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $id = $this->getRequestValue($request, 'id', 0); diff --git a/src/Module/Api/Twitter/Statuses/Show.php b/src/Module/Api/Twitter/Statuses/Show.php index 67a0b31af..4d37420a3 100644 --- a/src/Module/Api/Twitter/Statuses/Show.php +++ b/src/Module/Api/Twitter/Statuses/Show.php @@ -39,7 +39,7 @@ class Show extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $id = $this->getRequestValue($request, 'id', 0); diff --git a/src/Module/Api/Twitter/Statuses/Update.php b/src/Module/Api/Twitter/Statuses/Update.php index b3f0dd8a6..064eac08a 100644 --- a/src/Module/Api/Twitter/Statuses/Update.php +++ b/src/Module/Api/Twitter/Statuses/Update.php @@ -46,7 +46,7 @@ class Update extends BaseApi { public function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $owner = User::getOwnerDataById($uid); diff --git a/src/Module/Api/Twitter/Statuses/UserTimeline.php b/src/Module/Api/Twitter/Statuses/UserTimeline.php index 2c58fd6af..361c8dba2 100644 --- a/src/Module/Api/Twitter/Statuses/UserTimeline.php +++ b/src/Module/Api/Twitter/Statuses/UserTimeline.php @@ -38,7 +38,7 @@ class UserTimeline extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); Logger::info('api_statuses_user_timeline', ['api_user' => $uid, '_REQUEST' => $request]); diff --git a/src/Module/Api/Twitter/Users/Lookup.php b/src/Module/Api/Twitter/Users/Lookup.php index 960239f22..4c39ae92b 100644 --- a/src/Module/Api/Twitter/Users/Lookup.php +++ b/src/Module/Api/Twitter/Users/Lookup.php @@ -34,7 +34,7 @@ class Lookup extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $users = []; diff --git a/src/Module/Api/Twitter/Users/Search.php b/src/Module/Api/Twitter/Users/Search.php index 2ca30afac..6f26488e6 100644 --- a/src/Module/Api/Twitter/Users/Search.php +++ b/src/Module/Api/Twitter/Users/Search.php @@ -37,7 +37,7 @@ class Search extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); $userlist = []; diff --git a/src/Module/Api/Twitter/Users/Show.php b/src/Module/Api/Twitter/Users/Show.php index 158c3f18d..25e6012bf 100644 --- a/src/Module/Api/Twitter/Users/Show.php +++ b/src/Module/Api/Twitter/Users/Show.php @@ -34,7 +34,7 @@ class Show extends BaseApi { protected function rawContent(array $request = []) { - BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); + $this->checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); if (empty($this->parameters['id'])) { diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index d8bf65732..95eb8f042 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -97,7 +97,7 @@ class BaseApi extends BaseModule case Router::PATCH: case Router::POST: case Router::PUT: - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); if (!self::getCurrentUserID()) { throw new HTTPException\ForbiddenException($this->t('Permission denied.')); @@ -418,22 +418,22 @@ class BaseApi extends BaseModule * * @param string $scope the requested scope (read, write, follow, push) */ - public static function checkAllowedScope(string $scope) + public function checkAllowedScope(string $scope) { $token = self::getCurrentApplication(); if (empty($token)) { - Logger::notice('Empty application token'); + $this->logger->notice('Empty application token'); DI::mstdnError()->Forbidden(); } if (!isset($token[$scope])) { - Logger::warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]); + $this->logger->warning('The requested scope does not exist', ['scope' => $scope, 'application' => $token]); DI::mstdnError()->Forbidden(); } if (empty($token[$scope])) { - Logger::warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]); + $this->logger->warning('The requested scope is not allowed', ['scope' => $scope, 'application' => $token]); DI::mstdnError()->Forbidden(); } }