From 6c01e4e7d6c177ac345c826059e585bffdd1d517 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 7 Apr 2023 00:13:49 +0200 Subject: Use typed access to request parameters (#5267) * Use typed access to request parameters This was a big source of mixed datatypes in many places * Fix notifications * Fix bookmarkAction --- app/Controllers/indexController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'app/Controllers/indexController.php') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 42e241787..17aee3585 100644 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -26,10 +26,10 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { return; } - $id = Minz_Request::param('id'); - if ($id) { - $view = Minz_Request::param('a'); - $url_redirect = array('c' => 'subscription', 'a' => 'feed', 'params' => array('id' => $id, 'from' => $view)); + $id = Minz_Request::paramInt('id'); + if ($id !== 0) { + $view = Minz_Request::paramString('a'); + $url_redirect = array('c' => 'subscription', 'a' => 'feed', 'params' => array('id' => (string)$id, 'from' => $view)); Minz_Request::forward($url_redirect, true); return; } @@ -144,7 +144,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { public function rssAction(): void { $allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous; $token = FreshRSS_Context::$user_conf->token; - $token_param = Minz_Request::param('token', ''); + $token_param = Minz_Request::paramString('token'); $token_is_ok = ($token != '' && $token === $token_param); // Check if user has access. @@ -177,7 +177,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { public function opmlAction(): void { $allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous; $token = FreshRSS_Context::$user_conf->token; - $token_param = Minz_Request::param('token', ''); + $token_param = Minz_Request::paramString('token'); $token_is_ok = ($token != '' && $token === $token_param); // Check if user has access. @@ -316,7 +316,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController { $logs = FreshRSS_LogDAO::lines(); //TODO: ask only the necessary lines //gestion pagination - $page = intval(Minz_Request::param('page', 1)); + $page = Minz_Request::paramInt('page') ?: 1; $this->view->logsPaginator = new Minz_Paginator($logs); $this->view->logsPaginator->_nbItemsPerPage(50); $this->view->logsPaginator->_currentPage($page); -- cgit v1.2.3