Unify request value handling

This commit is contained in:
Michael 2022-01-16 14:04:20 +00:00
parent 4319136421
commit 4724000d06
16 changed files with 105 additions and 73 deletions

View file

@ -37,7 +37,7 @@ class Create extends BaseApi
$uid = BaseApi::getCurrentUserID();
// params
$name = $request['name'] ?? '';
$name = $this->getRequestValue($request, 'name', '');
$json = json_decode($request['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 = $this->getRequestValue($request, 'gid', 0);
// get data of the specified group id or all groups if not specified
if ($gid != 0) {

View file

@ -38,8 +38,8 @@ class Update extends BaseApi
$uid = BaseApi::getCurrentUserID();
// params
$gid = $request['gid'] ?? 0;
$name = $request['name'] ?? '';
$gid = $this->getRequestValue($request, 'gid', 0);
$name = $this->getRequestValue($request, 'name', '');
$json = json_decode($request['json'], true);
$users = $json['user'];

View file

@ -54,13 +54,13 @@ class Create extends BaseApi
$uid = BaseApi::getCurrentUserID();
$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;
// input params
$desc = $this->getRequestValue($request, 'desc');
$album = $this->getRequestValue($request, 'album');
$allow_cid = $this->getRequestValue($request, 'allow_cid');
$deny_cid = $this->getRequestValue($request, 'deny_cid');
$allow_gid = $this->getRequestValue($request, 'allow_gid');
$deny_gid = $this->getRequestValue($request, 'deny_gid');
// 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 = $this->getRequestValue($request, 'photo_id');
$desc = $this->getRequestValue($request, 'desc');
$album = $this->getRequestValue($request, 'album');
$album_new = $this->getRequestValue($request, 'album_new');
$allow_cid = $this->getRequestValue($request, 'allow_cid');
$deny_cid = $this->getRequestValue($request, 'deny_cid');
$allow_gid = $this->getRequestValue($request, 'allow_gid');
$deny_gid = $this->getRequestValue($request, 'deny_gid');
// do several checks on input parameters
// we do not allow calls without album string