]> git.mxchange.org Git - friendica.git/commitdiff
Coding styles / "require_once" for removed file removed
authorMichael <heluecht@pirati.ca>
Sun, 16 Jan 2022 09:01:04 +0000 (09:01 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 16 Jan 2022 09:01:04 +0000 (09:01 +0000)
src/Factory/Api/Friendica/Photo.php
src/Module/Api/Friendica/Group/Create.php
src/Module/Api/Friendica/Group/Show.php
src/Module/Api/Friendica/Photo.php
src/Module/Api/Friendica/Photo/Update.php
src/Module/Api/Twitter/Account/UpdateProfileImage.php
tests/legacy/ApiTest.php

index 85470c880615731bc42e407b5dea3ae7fd81b693..9c0a48dea7d1dbfba87a1b0f40b3eff856cd4541 100644 (file)
@@ -152,4 +152,4 @@ class Photo extends BaseFactory
 
                return $data;
        }
-}
\ No newline at end of file
+}
index c57a20143a9e2364cc8b2e382caf2ae4926d9f6c..2742bae8c6a931e6036c77f5c4aa16bffd8d1080 100644 (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;
                        }
                }
 
index b2ce4ea0656ac82a7385bdfa8579ba8c940c4db9..f735e7c116813cb718c6dff04cf588b33e4fa834 100644 (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];
index 6e5b02c4fd886353fcca111dd828cfab1a11ac79..d0ea25b309cbf5b593d98cf2a99d59610878fd41 100644 (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
index 24c07be8e6eb66799db524514844c9166ff84b4b..a7ac91460eb8fbd6130b3b4ad6f78042c122cbb3 100644 (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);
index 422ed4416c91e5ced528b8f017b6e9c03a8793ca..909c4c29e7b4c022d71315b65aaa3f339bf87a8f 100644 (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();
        
index 597f432ff7a2bbb90f72d7521b7b44cfcc0728f5..904ae92f6c996a24647652879a14afea2dbded23 100644 (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.
  *