From dd8d49d9cf72e7fc7ab2fc70eab3d8d5272358f8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Jan 2022 17:03:18 +0000 Subject: [PATCH] Replaced $_REQUEST --- src/Module/Api/Mastodon/Media.php | 2 +- .../Api/Twitter/DirectMessagesEndpoint.php | 2 +- src/Module/Api/Twitter/Search/Tweets.php | 21 +++++++++---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Module/Api/Mastodon/Media.php b/src/Module/Api/Mastodon/Media.php index d6fcba3e4..1253026fd 100644 --- a/src/Module/Api/Mastodon/Media.php +++ b/src/Module/Api/Mastodon/Media.php @@ -37,7 +37,7 @@ class Media extends BaseApi self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); - Logger::info('Photo post', ['request' => $_REQUEST, 'files' => $_FILES]); + Logger::info('Photo post', ['request' => $request, 'files' => $_FILES]); if (empty($_FILES['file'])) { DI::mstdnError()->UnprocessableEntity(); diff --git a/src/Module/Api/Twitter/DirectMessagesEndpoint.php b/src/Module/Api/Twitter/DirectMessagesEndpoint.php index c0c271dd7..28b867889 100644 --- a/src/Module/Api/Twitter/DirectMessagesEndpoint.php +++ b/src/Module/Api/Twitter/DirectMessagesEndpoint.php @@ -84,7 +84,7 @@ abstract class DirectMessagesEndpoint extends BaseApi $params['order'] = ['id']; } - $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $_REQUEST['user_id'] ?? 0, 0); + $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, 0); if (!empty($cid)) { $cdata = Contact::getPublicAndUserContactID($cid, $uid); if (!empty($cdata['user'])) { diff --git a/src/Module/Api/Twitter/Search/Tweets.php b/src/Module/Api/Twitter/Search/Tweets.php index 0d6b5c230..0aad5a434 100644 --- a/src/Module/Api/Twitter/Search/Tweets.php +++ b/src/Module/Api/Twitter/Search/Tweets.php @@ -41,27 +41,26 @@ class Tweets extends BaseApi BaseApi::checkAllowedScope(BaseApi::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); - if (empty($_REQUEST['q'])) { + if (empty($request['q'])) { throw new BadRequestException('q parameter is required.'); } - $searchTerm = trim(rawurldecode($_REQUEST['q'])); + $searchTerm = trim(rawurldecode($request['q'])); $data['status'] = []; $count = 15; - $exclude_replies = !empty($_REQUEST['exclude_replies']); - if (!empty($_REQUEST['rpp'])) { - $count = $_REQUEST['rpp']; - } elseif (!empty($_REQUEST['count'])) { - $count = $_REQUEST['count']; + $exclude_replies = !empty($request['exclude_replies']); + if (!empty($request['rpp'])) { + $count = $request['rpp']; + } elseif (!empty($request['count'])) { + $count = $request['count']; } - $since_id = $_REQUEST['since_id'] ?? 0; - $max_id = $_REQUEST['max_id'] ?? 0; - $page = $_REQUEST['page'] ?? 1; - + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); + $page = $this->getRequestValue($request, 'page', 1, 1); $include_entities = $this->getRequestValue($request, 'include_entities', false); $start = max(0, ($page - 1) * $count);