Use the $request variable

This commit is contained in:
Michael 2022-01-16 07:35:20 +00:00
parent 8ff2cc3976
commit f11bf08a7b
11 changed files with 28 additions and 28 deletions

View file

@ -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'];

View file

@ -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) {

View file

@ -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()];

View file

@ -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)];

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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)) {

View file

@ -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');

View file

@ -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) {

View file

@ -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) {