From f11bf08a7ba18bd5d76d38891bea0e7dd52edc96 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Jan 2022 07:35:20 +0000 Subject: [PATCH] Use the $request variable --- src/Module/Api/Friendica/Group/Create.php | 2 +- src/Module/Api/Friendica/Group/Show.php | 2 +- src/Module/Api/Friendica/Notification/Seen.php | 4 ++-- src/Module/Api/Friendica/Photo.php | 6 +++--- src/Module/Api/Friendica/Photo/Create.php | 12 ++++++------ src/Module/Api/Friendica/Photo/Update.php | 16 ++++++++-------- .../Api/Twitter/Account/UpdateProfileImage.php | 2 +- src/Module/Api/Twitter/Friendships/Show.php | 4 ++-- src/Module/Api/Twitter/Lists/Create.php | 2 +- src/Module/Api/Twitter/Lists/Destroy.php | 2 +- src/Module/Api/Twitter/Lists/Update.php | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Module/Api/Friendica/Group/Create.php b/src/Module/Api/Friendica/Group/Create.php index be85146f4..15394fec4 100644 --- a/src/Module/Api/Friendica/Group/Create.php +++ b/src/Module/Api/Friendica/Group/Create.php @@ -37,7 +37,7 @@ class Create extends BaseApi $uid = BaseApi::getCurrentUserID(); // params - $name = $_REQUEST['name'] ?? ''; + $name = $request['name'] ?? ''; $json = json_decode($_POST['json'], true); $users = $json['user']; diff --git a/src/Module/Api/Friendica/Group/Show.php b/src/Module/Api/Friendica/Group/Show.php index 3ec2b7625..b2ce4ea06 100644 --- a/src/Module/Api/Friendica/Group/Show.php +++ b/src/Module/Api/Friendica/Group/Show.php @@ -39,7 +39,7 @@ class Show extends BaseApi $type = $this->parameters['extension'] ?? ''; // params - $gid = $_REQUEST['gid'] ?? 0; + $gid = $request['gid'] ?? 0; // get data of the specified group id or all groups if not specified if ($gid != 0) { diff --git a/src/Module/Api/Friendica/Notification/Seen.php b/src/Module/Api/Friendica/Notification/Seen.php index e29337262..30637d78c 100644 --- a/src/Module/Api/Friendica/Notification/Seen.php +++ b/src/Module/Api/Friendica/Notification/Seen.php @@ -47,7 +47,7 @@ class Seen extends BaseApi throw new BadRequestException('Invalid argument count'); } - $id = intval($_REQUEST['id'] ?? 0); + $id = intval($request['id'] ?? 0); try { $Notify = DI::notify()->selectOneById($id); @@ -65,7 +65,7 @@ class Seen extends BaseApi if ($Notify->otype === Notification\ObjectType::ITEM) { $item = Post::selectFirstForUser($uid, [], ['id' => $Notify->iid, 'uid' => $uid]); if (DBA::isResult($item)) { - $include_entities = strtolower(($_REQUEST['include_entities'] ?? 'false') == 'true'); + $include_entities = strtolower(($request['include_entities'] ?? 'false') == 'true'); // we found the item, return it to the user $ret = [DI::twitterStatus()->createFromUriId($item['uri-id'], $item['uid'], $include_entities)->toArray()]; diff --git a/src/Module/Api/Friendica/Photo.php b/src/Module/Api/Friendica/Photo.php index 4334bafeb..6e5b02c4f 100644 --- a/src/Module/Api/Friendica/Photo.php +++ b/src/Module/Api/Friendica/Photo.php @@ -50,12 +50,12 @@ class Photo extends BaseApi $uid = BaseApi::getCurrentUserID(); $type = $this->parameters['extension'] ?? ''; - if (empty($_REQUEST['photo_id'])) { + if (empty($request['photo_id'])) { throw new HTTPException\BadRequestException('No photo id.'); } - $scale = (!empty($_REQUEST['scale']) ? intval($_REQUEST['scale']) : false); - $photo_id = $_REQUEST['photo_id']; + $scale = (!empty($request['scale']) ? intval($request['scale']) : false); + $photo_id = $request['photo_id']; // prepare json/xml output with data from database for the requested photo $data = ['photo' => $this->friendicaPhoto->createFromId($photo_id, $scale, $uid, $type)]; diff --git a/src/Module/Api/Friendica/Photo/Create.php b/src/Module/Api/Friendica/Photo/Create.php index 0455321d0..460bff40f 100644 --- a/src/Module/Api/Friendica/Photo/Create.php +++ b/src/Module/Api/Friendica/Photo/Create.php @@ -55,12 +55,12 @@ class Create extends BaseApi $type = $this->parameters['extension'] ?? ''; // input params - $desc = $_REQUEST['desc'] ?? null; - $album = $_REQUEST['album'] ?? null; - $allow_cid = $_REQUEST['allow_cid'] ?? null; - $deny_cid = $_REQUEST['deny_cid' ] ?? null; - $allow_gid = $_REQUEST['allow_gid'] ?? null; - $deny_gid = $_REQUEST['deny_gid' ] ?? null; + $desc = $request['desc'] ?? null; + $album = $request['album'] ?? null; + $allow_cid = $request['allow_cid'] ?? null; + $deny_cid = $request['deny_cid' ] ?? null; + $allow_gid = $request['allow_gid'] ?? null; + $deny_gid = $request['deny_gid' ] ?? null; // do several checks on input parameters // we do not allow calls without album string diff --git a/src/Module/Api/Friendica/Photo/Update.php b/src/Module/Api/Friendica/Photo/Update.php index b964ad023..24c07be8e 100644 --- a/src/Module/Api/Friendica/Photo/Update.php +++ b/src/Module/Api/Friendica/Photo/Update.php @@ -55,14 +55,14 @@ class Update extends BaseApi $type = $this->parameters['extension'] ?? ''; // input params - $photo_id = $_REQUEST['photo_id'] ?? null; - $desc = $_REQUEST['desc'] ?? null; - $album = $_REQUEST['album'] ?? null; - $album_new = $_REQUEST['album_new'] ?? null; - $allow_cid = $_REQUEST['allow_cid'] ?? null; - $deny_cid = $_REQUEST['deny_cid' ] ?? null; - $allow_gid = $_REQUEST['allow_gid'] ?? null; - $deny_gid = $_REQUEST['deny_gid' ] ?? null; + $photo_id = $request['photo_id'] ?? null; + $desc = $request['desc'] ?? null; + $album = $request['album'] ?? null; + $album_new = $request['album_new'] ?? null; + $allow_cid = $request['allow_cid'] ?? null; + $deny_cid = $request['deny_cid' ] ?? null; + $allow_gid = $request['allow_gid'] ?? null; + $deny_gid = $request['deny_gid' ] ?? null; // do several checks on input parameters // we do not allow calls without album string diff --git a/src/Module/Api/Twitter/Account/UpdateProfileImage.php b/src/Module/Api/Twitter/Account/UpdateProfileImage.php index 15ca6cf92..422ed4416 100644 --- a/src/Module/Api/Twitter/Account/UpdateProfileImage.php +++ b/src/Module/Api/Twitter/Account/UpdateProfileImage.php @@ -57,7 +57,7 @@ class UpdateProfileImage extends BaseApi } // output for client - $skip_status = $_REQUEST['skip_status'] ?? false; + $skip_status = $request['skip_status'] ?? false; $user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray(); diff --git a/src/Module/Api/Twitter/Friendships/Show.php b/src/Module/Api/Twitter/Friendships/Show.php index 6db48506a..66605e726 100644 --- a/src/Module/Api/Twitter/Friendships/Show.php +++ b/src/Module/Api/Twitter/Friendships/Show.php @@ -38,9 +38,9 @@ class Show extends ContactEndpoint self::checkAllowedScope(self::SCOPE_READ); $uid = BaseApi::getCurrentUserID(); - $source_cid = BaseApi::getContactIDForSearchterm($_REQUEST['source_screen_name'] ?? '', '', $_REQUEST['source_id'] ?? 0, $uid); + $source_cid = BaseApi::getContactIDForSearchterm($request['source_screen_name'] ?? '', '', $request['source_id'] ?? 0, $uid); - $target_cid = BaseApi::getContactIDForSearchterm($_REQUEST['target_screen_name'] ?? '', '', $_REQUEST['target_id'] ?? 0, $uid); + $target_cid = BaseApi::getContactIDForSearchterm($request['target_screen_name'] ?? '', '', $request['target_id'] ?? 0, $uid); $source = Contact::getById($source_cid); if (empty($source)) { diff --git a/src/Module/Api/Twitter/Lists/Create.php b/src/Module/Api/Twitter/Lists/Create.php index 80071c30e..cbe150385 100644 --- a/src/Module/Api/Twitter/Lists/Create.php +++ b/src/Module/Api/Twitter/Lists/Create.php @@ -60,7 +60,7 @@ class Create extends BaseApi $uid = BaseApi::getCurrentUserID(); // params - $name = $_REQUEST['name'] ?? ''; + $name = $request['name'] ?? ''; if ($name == '') { throw new HTTPException\BadRequestException('group name not specified'); diff --git a/src/Module/Api/Twitter/Lists/Destroy.php b/src/Module/Api/Twitter/Lists/Destroy.php index 06ca9a73d..c0377e135 100644 --- a/src/Module/Api/Twitter/Lists/Destroy.php +++ b/src/Module/Api/Twitter/Lists/Destroy.php @@ -60,7 +60,7 @@ class Destroy extends BaseApi $uid = BaseApi::getCurrentUserID(); // params - $gid = $_REQUEST['list_id'] ?? 0; + $gid = $request['list_id'] ?? 0; // error if no gid specified if ($gid == 0) { diff --git a/src/Module/Api/Twitter/Lists/Update.php b/src/Module/Api/Twitter/Lists/Update.php index d670c3a6d..ba3886aaa 100644 --- a/src/Module/Api/Twitter/Lists/Update.php +++ b/src/Module/Api/Twitter/Lists/Update.php @@ -60,8 +60,8 @@ class Update extends BaseApi $uid = BaseApi::getCurrentUserID(); // params - $gid = $_REQUEST['list_id'] ?? 0; - $name = $_REQUEST['name'] ?? ''; + $gid = $request['list_id'] ?? 0; + $name = $request['name'] ?? ''; // error if no gid specified if ($gid == 0) {