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:
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user