Coding styles / "require_once" for removed file removed

pull/11159/head
Michael 2022-01-16 09:01:04 +00:00
parent af18e2f2a9
commit 7c15d0160a
7 changed files with 13 additions and 17 deletions

View File

@ -152,4 +152,4 @@ class Photo extends BaseFactory
return $data;
}
}
}

View File

@ -37,8 +37,8 @@ class Create extends BaseApi
$uid = BaseApi::getCurrentUserID();
// params
$name = $request['name'] ?? '';
$json = json_decode($request['json'], true);
$name = $request['name'] ?? '';
$json = json_decode($request['json'], true);
$users = $json['user'];
// error if no name specified
@ -66,14 +66,14 @@ class Create extends BaseApi
// add members
$erroraddinguser = false;
$errorusers = [];
$errorusers = [];
foreach ($users as $user) {
$cid = $user['cid'];
if (DBA::exists('contact', ['id' => $cid, 'uid' => $uid])) {
Group::addMember($gid, $cid);
} else {
$erroraddinguser = true;
$errorusers[] = $cid;
$errorusers[] = $cid;
}
}

View File

@ -57,20 +57,18 @@ class Show extends BaseApi
$grps = [];
foreach ($groups as $rr) {
$members = Contact\Group::getById($rr['id']);
$users = [];
$users = [];
if ($type == 'xml') {
$user_element = 'users';
$k = 0;
$k = 0;
foreach ($members as $member) {
$user = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
$users[$k++.':user'] = $user;
$users[$k++.':user'] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
}
} else {
$user_element = 'user';
foreach ($members as $member) {
$user = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
$users[] = $user;
$users[] = DI::twitterUser()->createFromContactId($member['contact-id'], $uid, true)->toArray();
}
}
$grps[] = ['name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users];

View File

@ -54,7 +54,7 @@ class Photo extends BaseApi
throw new HTTPException\BadRequestException('No photo id.');
}
$scale = (!empty($request['scale']) ? intval($request['scale']) : false);
$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

View File

@ -118,14 +118,14 @@ class Update extends BaseApi
$result = false;
if (count($updated_fields) > 0) {
$nothingtodo = false;
$result = Photo::update($updated_fields, ['uid' => $uid, 'resource-id' => $photo_id, 'album' => $album]);
$result = Photo::update($updated_fields, ['uid' => $uid, 'resource-id' => $photo_id, 'album' => $album]);
} else {
$nothingtodo = true;
}
if (!empty($_FILES['media'])) {
$nothingtodo = false;
$photo = Photo::upload($uid, $_FILES['media'], $album, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc, $photo_id);
$photo = Photo::upload($uid, $_FILES['media'], $album, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc, $photo_id);
if (!empty($photo)) {
$data = ['photo' => $this->friendicaPhoto->createFromId($photo['resource_id'], null, $uid, $type)];
$this->response->exit('photo_update', $data, $this->parameters['extension'] ?? null);

View File

@ -57,7 +57,7 @@ class UpdateProfileImage extends BaseApi
}
// output for client
$skip_status = $request['skip_status'] ?? false;
$skip_status = filter_var($request['skip_status'] ?? false, FILTER_VALIDATE_BOOLEAN);
$user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();

View File

@ -32,8 +32,6 @@ use Friendica\Util\Arrays;
use Friendica\Util\DateTimeFormat;
use Monolog\Handler\TestHandler;
require_once __DIR__ . '/../../include/api.php';
/**
* Tests for the API functions.
*