mirror of
https://github.com/friendica/friendica
synced 2025-04-26 01:10:15 +00:00
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:
parent
3b646644c0
commit
9fa812b35d
8 changed files with 33 additions and 15 deletions
|
@ -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]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue