diff options
| author | 2023-04-07 00:13:49 +0200 | |
|---|---|---|
| committer | 2023-04-07 00:13:49 +0200 | |
| commit | 6c01e4e7d6c177ac345c826059e585bffdd1d517 (patch) | |
| tree | 45bd8ee233a306881ed81447a3f56ca224fed538 /app/Controllers/indexController.php | |
| parent | 2118448133e327294ad2b69ed8736bc29879103d (diff) | |
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
Diffstat (limited to 'app/Controllers/indexController.php')
| -rw-r--r-- | app/Controllers/indexController.php | 14 |
1 files changed, 7 insertions, 7 deletions
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); |
