]> git.mxchange.org Git - friendica.git/commitdiff
Replaced "filter_input" with the new request value function
authorMichael <heluecht@pirati.ca>
Sun, 16 Jan 2022 16:40:13 +0000 (16:40 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 16 Jan 2022 16:40:13 +0000 (16:40 +0000)
src/Module/Api/Twitter/Account/UpdateProfile.php
src/Module/Api/Twitter/Account/UpdateProfileImage.php
src/Module/Api/Twitter/Account/VerifyCredentials.php
src/Module/Api/Twitter/Blocks/Ids.php
src/Module/Api/Twitter/Blocks/Lists.php
src/Module/Api/Twitter/DirectMessages/Destroy.php
src/Module/Api/Twitter/Followers/Ids.php
src/Module/Api/Twitter/Followers/Lists.php
src/Module/Api/Twitter/Friends/Ids.php
src/Module/Api/Twitter/Friends/Lists.php
src/Module/Api/Twitter/Friendships/Incoming.php

index 70cac42a27e6d8868345cc2e21724e9006824e15..06ebf3db1ecd60844a2a12263745c9770768f1e8 100644 (file)
@@ -56,7 +56,7 @@ class UpdateProfile extends BaseApi
 
                Profile::publishUpdate($uid);
 
-               $skip_status = filter_var($request['skip_status'] ?? false, FILTER_VALIDATE_BOOLEAN);
+               $skip_status = $this->getRequestValue($request, 'skip_status', false);
 
                $user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
 
index 909c4c29e7b4c022d71315b65aaa3f339bf87a8f..02194316b2ab56d99159b97634ecb87856c969fc 100644 (file)
@@ -57,7 +57,7 @@ class UpdateProfileImage extends BaseApi
                }
        
                // output for client
-               $skip_status = filter_var($request['skip_status'] ?? false, FILTER_VALIDATE_BOOLEAN);
+               $skip_status = $this->getRequestValue($request, 'skip_status', false);
        
                $user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
        
index 181c20dfb7089245a9ceab3df23f533b17c07e6d..af9c2a6f7092daefef33acf18f7fc00b34508dd2 100644 (file)
@@ -37,7 +37,7 @@ class VerifyCredentials extends BaseApi
                BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
                $uid = BaseApi::getCurrentUserID();
 
-               $skip_status = filter_var($request['skip_status'] ?? false, FILTER_VALIDATE_BOOLEAN);
+               $skip_status = $this->getRequestValue($request, 'skip_status', false);
 
                $user_info = DI::twitterUser()->createFromUserId($uid, $skip_status)->toArray();
 
index e411fc507fcefd7f6ce976db5549995648fa9741..d687b85a5c281d3cbbedc51298e90f9c3c96deb3 100644 (file)
@@ -37,17 +37,14 @@ class Ids extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $cursor        = filter_input(INPUT_GET, 'cursor'       , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $stringify_ids = filter_input(INPUT_GET, 'stringify_ids', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count         = filter_input(INPUT_GET, 'count'        , FILTER_VALIDATE_INT, ['options' => [
-                       'default'   => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $cursor        = $this->getRequestValue($request, 'cursor', -1);
+               $stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
+               $count         = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id = filter_input(INPUT_GET, 'since_id', FILTER_VALIDATE_INT);
-               $max_id   = filter_input(INPUT_GET, 'max_id'  , FILTER_VALIDATE_INT);
-               $min_id   = filter_input(INPUT_GET, 'min_id'  , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $params = ['order' => ['cid' => true], 'limit' => $count];
 
index da7b00f43c3089bbf7ee94977962aa2a9b8d5c2b..823336c087b7160e4375bf6d0169aa55a0745266 100644 (file)
@@ -37,18 +37,15 @@ class Lists extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $cursor                = filter_input(INPUT_GET, 'cursor'               , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $skip_status           = filter_input(INPUT_GET, 'skip_status'          , FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $include_user_entities = filter_input(INPUT_GET, 'include_user_entities', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count                 = filter_input(INPUT_GET, 'count'                , FILTER_VALIDATE_INT, ['options' => [
-                       'default'   => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $cursor                = $this->getRequestValue($request, 'cursor', -1);
+               $skip_status           = $this->getRequestValue($request, 'skip_status', false);
+               $include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
+               $count                 = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id = filter_input(INPUT_GET, 'since_id', FILTER_VALIDATE_INT);
-               $max_id   = filter_input(INPUT_GET, 'max_id'  , FILTER_VALIDATE_INT);
-               $min_id   = filter_input(INPUT_GET, 'min_id'  , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $params = ['order' => ['cid' => true], 'limit' => $count];
 
index 9f9c4de30362b6269c23847cf971119f058b990f..3100ff345ecaf0dd1eee759e6a812cf7e9857d30 100644 (file)
@@ -52,8 +52,8 @@ class Destroy extends BaseApi
                BaseApi::checkAllowedScope(BaseApi::SCOPE_WRITE);
                $uid = BaseApi::getCurrentUserID();
 
-               $id      = filter_var($request['id'] ?? 0,                    FILTER_VALIDATE_INT);
-               $verbose = filter_var($request['friendica_verbose'] ?? false, FILTER_VALIDATE_BOOLEAN);
+               $id      = $this->getRequestValue($request, 'id', 0);
+               $verbose = $this->getRequestValue($request, 'friendica_verbose', false);
 
                $parenturi = $request['friendica_parenturi'] ?? '';
 
index a618304b218c1365297385ea91c0975c99eac231..d03b547acd68dccd45ce91f0d9e48e55f6882943 100644 (file)
@@ -37,20 +37,17 @@ class Ids extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $contact_id    = filter_input(INPUT_GET, 'user_id'      , FILTER_VALIDATE_INT);
-               $screen_name   = filter_input(INPUT_GET, 'screen_name');
-               $profile_url   = filter_input(INPUT_GET, 'profile_url');
-               $cursor        = filter_input(INPUT_GET, 'cursor'       , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $stringify_ids = filter_input(INPUT_GET, 'stringify_ids', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count         = filter_input(INPUT_GET, 'count'        , FILTER_VALIDATE_INT, ['options' => [
-                       'default' => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $contact_id    = $this->getRequestValue($request, 'user_id', 0);
+               $screen_name   = $this->getRequestValue($request, 'screen_name', '');
+               $profile_url   = $this->getRequestValue($request, 'profile_url', '');
+               $cursor        = $this->getRequestValue($request, 'cursor', -1);
+               $stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
+               $count         = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id      = filter_input(INPUT_GET, 'since_id'     , FILTER_VALIDATE_INT);
-               $max_id        = filter_input(INPUT_GET, 'max_id'       , FILTER_VALIDATE_INT);
-               $min_id        = filter_input(INPUT_GET, 'min_id'       , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
 
index a60226d05fb49aaef433a316325f72a4fe184079..0aca285a193873131ff4fca87550c211ce29b0ca 100644 (file)
@@ -37,21 +37,18 @@ class Lists extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $contact_id            = filter_input(INPUT_GET, 'user_id'              , FILTER_VALIDATE_INT);
-               $screen_name           = filter_input(INPUT_GET, 'screen_name');
-               $profile_url           = filter_input(INPUT_GET, 'profile_url');
-               $cursor                = filter_input(INPUT_GET, 'cursor'               , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $skip_status           = filter_input(INPUT_GET, 'skip_status'          , FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $include_user_entities = filter_input(INPUT_GET, 'include_user_entities', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count                 = filter_input(INPUT_GET, 'count'                , FILTER_VALIDATE_INT, ['options' => [
-                       'default' => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $contact_id            = $this->getRequestValue($request, 'user_id', 0);
+               $screen_name           = $this->getRequestValue($request, 'screen_name', '');
+               $profile_url           = $this->getRequestValue($request, 'profile_url', '');
+               $cursor                = $this->getRequestValue($request, 'cursor', -1);
+               $skip_status           = $this->getRequestValue($request, 'skip_status', false);
+               $include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
+               $count                 = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id              = filter_input(INPUT_GET, 'since_id', FILTER_VALIDATE_INT);
-               $max_id                = filter_input(INPUT_GET, 'max_id'  , FILTER_VALIDATE_INT);
-               $min_id                = filter_input(INPUT_GET, 'min_id'  , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
 
index d810ceeb43033958b539ebef8e91f3b1ef272b3d..c874432e11ed12b40c2b0a69127424e4aeeac5bd 100644 (file)
@@ -37,20 +37,17 @@ class Ids extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $contact_id    = filter_input(INPUT_GET, 'user_id'      , FILTER_VALIDATE_INT);
-               $screen_name   = filter_input(INPUT_GET, 'screen_name');
-               $profile_url   = filter_input(INPUT_GET, 'profile_url');
-               $cursor        = filter_input(INPUT_GET, 'cursor'       , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $stringify_ids = filter_input(INPUT_GET, 'stringify_ids', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count         = filter_input(INPUT_GET, 'count'        , FILTER_VALIDATE_INT, ['options' => [
-                       'default' => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $contact_id    = $this->getRequestValue($request, 'user_id', 0);
+               $screen_name   = $this->getRequestValue($request, 'screen_name', '');
+               $profile_url   = $this->getRequestValue($request, 'profile_url', '');
+               $cursor        = $this->getRequestValue($request, 'cursor', -1);
+               $stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
+               $count         = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id      = filter_input(INPUT_GET, 'since_id'     , FILTER_VALIDATE_INT);
-               $max_id        = filter_input(INPUT_GET, 'max_id'       , FILTER_VALIDATE_INT);
-               $min_id        = filter_input(INPUT_GET, 'min_id'       , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
 
index dc2c26166d456c4675423ee30789d073737af1b1..65dcec8ec62bc055b345b07999d44199ef78008d 100644 (file)
@@ -37,21 +37,18 @@ class Lists extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $contact_id            = filter_input(INPUT_GET, 'user_id'              , FILTER_VALIDATE_INT);
-               $screen_name           = filter_input(INPUT_GET, 'screen_name');
-               $profile_url           = filter_input(INPUT_GET, 'profile_url');
-               $cursor                = filter_input(INPUT_GET, 'cursor'               , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $skip_status           = filter_input(INPUT_GET, 'skip_status'          , FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $include_user_entities = filter_input(INPUT_GET, 'include_user_entities', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count                 = filter_input(INPUT_GET, 'count'                , FILTER_VALIDATE_INT, ['options' => [
-                       'default' => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $contact_id            = $this->getRequestValue($request, 'user_id', 0);
+               $screen_name           = $this->getRequestValue($request, 'screen_name', '');
+               $profile_url           = $this->getRequestValue($request, 'profile_url', '');
+               $cursor                = $this->getRequestValue($request, 'cursor', -1);
+               $skip_status           = $this->getRequestValue($request, 'skip_status', false);
+               $include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
+               $count                 = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id              = filter_input(INPUT_GET, 'since_id', FILTER_VALIDATE_INT);
-               $max_id                = filter_input(INPUT_GET, 'max_id'  , FILTER_VALIDATE_INT);
-               $min_id                = filter_input(INPUT_GET, 'min_id'  , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
 
index 315ef00332bc48e57769e96cdf184beae13b3dcd..378159c3c27c71b511b4b822027012d838fa3221 100644 (file)
@@ -37,17 +37,14 @@ class Incoming extends ContactEndpoint
                $uid = BaseApi::getCurrentUserID();
 
                // Expected value for user_id parameter: public/user contact id
-               $cursor        = filter_input(INPUT_GET, 'cursor'       , FILTER_VALIDATE_INT, ['options' => ['default' => -1]]);
-               $stringify_ids = filter_input(INPUT_GET, 'stringify_ids', FILTER_VALIDATE_BOOLEAN, ['options' => ['default' => false]]);
-               $count         = filter_input(INPUT_GET, 'count'        , FILTER_VALIDATE_INT, ['options' => [
-                       'default'   => self::DEFAULT_COUNT,
-                       'min_range' => 1,
-                       'max_range' => self::MAX_COUNT,
-               ]]);
+               $cursor        = $this->getRequestValue($request, 'cursor', -1);
+               $stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
+               $count         = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
+
                // Friendica-specific
-               $since_id = filter_input(INPUT_GET, 'since_id', FILTER_VALIDATE_INT);
-               $max_id   = filter_input(INPUT_GET, 'max_id'  , FILTER_VALIDATE_INT);
-               $min_id   = filter_input(INPUT_GET, 'min_id'  , FILTER_VALIDATE_INT);
+               $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
+               $max_id   = $this->getRequestValue($request, 'max_id', 0, 0);
+               $min_id   = $this->getRequestValue($request, 'min_id', 0, 0);
 
                $params = ['order' => ['cid' => true], 'limit' => $count];