From a3173ccb5074d0da75ecc76fd069fa328e2a9cc4 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Jan 2022 15:03:01 +0000 Subject: [PATCH] Define reasonable min and max values --- src/Module/Api/GNUSocial/Statusnet/Conversation.php | 8 ++++---- src/Module/Api/Twitter/DirectMessagesEndpoint.php | 6 +++--- src/Module/Api/Twitter/Favorites.php | 4 ++-- src/Module/Api/Twitter/Lists/Statuses.php | 10 +++++----- src/Module/Api/Twitter/Statuses/HomeTimeline.php | 6 +++--- src/Module/Api/Twitter/Statuses/Mentions.php | 4 ++-- src/Module/Api/Twitter/Statuses/PublicTimeline.php | 6 +++--- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Module/Api/GNUSocial/Statusnet/Conversation.php b/src/Module/Api/GNUSocial/Statusnet/Conversation.php index 77fdc034ba..5edcc4099d 100644 --- a/src/Module/Api/GNUSocial/Statusnet/Conversation.php +++ b/src/Module/Api/GNUSocial/Statusnet/Conversation.php @@ -41,10 +41,10 @@ class Conversation extends BaseApi // params $id = $this->parameters['id'] ?? 0; - $since_id = $this->getRequestValue($request, 'since_id', 0); - $max_id = $this->getRequestValue($request, 'max_id', 0); - $count = $this->getRequestValue($request, 'count', 20); - $page = $this->getRequestValue($request, 'page', 1); + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); + $count = $this->getRequestValue($request, 'count', 20, 1, 100); + $page = $this->getRequestValue($request, 'page', 1, 1); $start = max(0, ($page - 1) * $count); diff --git a/src/Module/Api/Twitter/DirectMessagesEndpoint.php b/src/Module/Api/Twitter/DirectMessagesEndpoint.php index a1f519975c..c0c271dd76 100644 --- a/src/Module/Api/Twitter/DirectMessagesEndpoint.php +++ b/src/Module/Api/Twitter/DirectMessagesEndpoint.php @@ -60,9 +60,9 @@ abstract class DirectMessagesEndpoint extends BaseApi // params $count = $this->getRequestValue($request, 'count', 20, 1, 100); $page = $this->getRequestValue($request, 'page', 1, 1); - $since_id = $this->getRequestValue($request, 'since_id', 0, 1); - $max_id = $this->getRequestValue($request, 'max_id', 0, 1); - $min_id = $this->getRequestValue($request, 'min_id', 0, 1); + $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); $verbose = $this->getRequestValue($request, 'friendica_verbose', false); // pagination diff --git a/src/Module/Api/Twitter/Favorites.php b/src/Module/Api/Twitter/Favorites.php index 56aa26cda7..e88922af7d 100644 --- a/src/Module/Api/Twitter/Favorites.php +++ b/src/Module/Api/Twitter/Favorites.php @@ -47,8 +47,8 @@ class Favorites extends BaseApi // params $count = $this->getRequestValue($request, 'count', 20, 1, 100); $page = $this->getRequestValue($request, 'page', 1, 1); - $since_id = $this->getRequestValue($request, 'since_id', 0, 1); - $max_id = $this->getRequestValue($request, 'max_id', 0, 1); + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); $start = max(0, ($page - 1) * $count); diff --git a/src/Module/Api/Twitter/Lists/Statuses.php b/src/Module/Api/Twitter/Lists/Statuses.php index 268ad81941..87cb1b4ebd 100644 --- a/src/Module/Api/Twitter/Lists/Statuses.php +++ b/src/Module/Api/Twitter/Lists/Statuses.php @@ -65,12 +65,12 @@ class Statuses extends BaseApi } // params - $count = $this->getRequestValue($request, 'count', 20); - $page = $this->getRequestValue($request, 'page', 1); - $since_id = $this->getRequestValue($request, 'since_id', 0); - $max_id = $this->getRequestValue($request, 'max_id', 0); + $count = $this->getRequestValue($request, 'count', 20, 1, 100); + $page = $this->getRequestValue($request, 'page', 1, 1); + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); $exclude_replies = $this->getRequestValue($request, 'exclude_replies', false); - $conversation_id = $this->getRequestValue($request, 'conversation_id', 0); + $conversation_id = $this->getRequestValue($request, 'conversation_id', 0, 0); $start = max(0, ($page - 1) * $count); diff --git a/src/Module/Api/Twitter/Statuses/HomeTimeline.php b/src/Module/Api/Twitter/Statuses/HomeTimeline.php index c45342a523..41ce9b37e1 100644 --- a/src/Module/Api/Twitter/Statuses/HomeTimeline.php +++ b/src/Module/Api/Twitter/Statuses/HomeTimeline.php @@ -45,10 +45,10 @@ class HomeTimeline extends BaseApi // params $count = $this->getRequestValue($request, 'count', 20, 1, 100); $page = $this->getRequestValue($request, 'page', 1, 1); - $since_id = $this->getRequestValue($request, 'since_id', 0, 1); - $max_id = $this->getRequestValue($request, 'max_id', 0, 1); + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); $exclude_replies = $this->getRequestValue($request, 'exclude_replies', false); - $conversation_id = $this->getRequestValue($request, 'conversation_id', 0); + $conversation_id = $this->getRequestValue($request, 'conversation_id', 0, 0); $start = max(0, ($page - 1) * $count); diff --git a/src/Module/Api/Twitter/Statuses/Mentions.php b/src/Module/Api/Twitter/Statuses/Mentions.php index 954aca57b4..0ddabd9a4a 100644 --- a/src/Module/Api/Twitter/Statuses/Mentions.php +++ b/src/Module/Api/Twitter/Statuses/Mentions.php @@ -44,8 +44,8 @@ class Mentions extends BaseApi // params $count = $this->getRequestValue($request, 'count', 20, 1, 100); $page = $this->getRequestValue($request, 'page', 1, 1); - $since_id = $this->getRequestValue($request, 'since_id', 0, 1); - $max_id = $this->getRequestValue($request, 'max_id', 0, 1); + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); $start = max(0, ($page - 1) * $count); diff --git a/src/Module/Api/Twitter/Statuses/PublicTimeline.php b/src/Module/Api/Twitter/Statuses/PublicTimeline.php index 53950573be..2a71bfe965 100644 --- a/src/Module/Api/Twitter/Statuses/PublicTimeline.php +++ b/src/Module/Api/Twitter/Statuses/PublicTimeline.php @@ -43,10 +43,10 @@ class PublicTimeline extends BaseApi // params $count = $this->getRequestValue($request, 'count', 20, 1, 100); $page = $this->getRequestValue($request, 'page', 1, 1); - $since_id = $this->getRequestValue($request, 'since_id', 0, 1); - $max_id = $this->getRequestValue($request, 'max_id', 0, 1); + $since_id = $this->getRequestValue($request, 'since_id', 0, 0); + $max_id = $this->getRequestValue($request, 'max_id', 0, 0); $exclude_replies = $this->getRequestValue($request, 'exclude_replies', false); - $conversation_id = $this->getRequestValue($request, 'conversation_id', 0); + $conversation_id = $this->getRequestValue($request, 'conversation_id', 0, 0); $start = max(0, ($page - 1) * $count);