Rewrites:

- converted single-line if() block to multi-line and with curly braces
- "imported" SPL classes to have unified code style
- always initialize your variables ... :-/
- added some empty lines/spaces for better readability

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2019-02-19 01:56:41 +01:00
parent 3b646644c0
commit 9fa812b35d
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
8 changed files with 33 additions and 15 deletions

View file

@ -1528,8 +1528,10 @@ function api_search($type)
if (api_user() === false || $user_info === false) { throw new ForbiddenException(); }
if (empty($_REQUEST['q'])) { throw new BadRequestException('q parameter is required.'); }
if (empty($_REQUEST['q'])) {
throw new BadRequestException('q parameter is required.');
}
$searchTerm = trim(rawurldecode($_REQUEST['q']));
$data = [];
@ -4399,6 +4401,7 @@ function api_fr_photo_delete($type)
if (api_user() === false) {
throw new ForbiddenException();
}
// input params
$photo_id = defaults($_REQUEST, 'photo_id', null);
@ -4407,11 +4410,12 @@ function api_fr_photo_delete($type)
if ($photo_id == null) {
throw new BadRequestException("no photo_id specified");
}
// check if photo is existing in database
$r = Photo::exists(['resource-id' => $photo_id, 'uid' => api_user()]);
if (!$r) {
if (!Photo::exists(['resource-id' => $photo_id, 'uid' => api_user()])) {
throw new BadRequestException("photo not available");
}
// now we can perform on the deletion of the photo
$result = Photo::delete(['uid' => api_user(), 'resource-id' => $photo_id]);