diff --git a/src/Factory/Api/Friendica/Photo.php b/src/Factory/Api/Friendica/Photo.php index 85470c8806..9c0a48dea7 100644 --- a/src/Factory/Api/Friendica/Photo.php +++ b/src/Factory/Api/Friendica/Photo.php @@ -152,4 +152,4 @@ class Photo extends BaseFactory return $data; } -} \ No newline at end of file +} diff --git a/src/Module/Api/Friendica/Group/Create.php b/src/Module/Api/Friendica/Group/Create.php index c57a20143a..2742bae8c6 100644 --- a/src/Module/Api/Friendica/Group/Create.php +++ b/src/Module/Api/Friendica/Group/Create.php @@ -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; } } diff --git a/src/Module/Api/Friendica/Group/Show.php b/src/Module/Api/Friendica/Group/Show.php index b2ce4ea065..f735e7c116 100644 --- a/src/Module/Api/Friendica/Group/Show.php +++ b/src/Module/Api/Friendica/Group/Show.php @@ -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]; diff --git a/src/Module/Api/Friendica/Photo.php b/src/Module/Api/Friendica/Photo.php index 6e5b02c4fd..d0ea25b309 100644 --- a/src/Module/Api/Friendica/Photo.php +++ b/src/Module/Api/Friendica/Photo.php @@ -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 diff --git a/src/Module/Api/Friendica/Photo/Update.php b/src/Module/Api/Friendica/Photo/Update.php index 24c07be8e6..a7ac91460e 100644 --- a/src/Module/Api/Friendica/Photo/Update.php +++ b/src/Module/Api/Friendica/Photo/Update.php @@ -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); diff --git a/src/Module/Api/Twitter/Account/UpdateProfileImage.php b/src/Module/Api/Twitter/Account/UpdateProfileImage.php index 422ed4416c..909c4c29e7 100644 --- a/src/Module/Api/Twitter/Account/UpdateProfileImage.php +++ b/src/Module/Api/Twitter/Account/UpdateProfileImage.php @@ -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(); diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 597f432ff7..904ae92f6c 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -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. *