diff options
| author | 2023-04-07 00:13:49 +0200 | |
|---|---|---|
| committer | 2023-04-07 00:13:49 +0200 | |
| commit | 6c01e4e7d6c177ac345c826059e585bffdd1d517 (patch) | |
| tree | 45bd8ee233a306881ed81447a3f56ca224fed538 /app/views | |
| 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/views')
| -rwxr-xr-x | app/views/entry/bookmark.phtml | 2 | ||||
| -rw-r--r-- | app/views/helpers/feed/update.phtml | 10 | ||||
| -rw-r--r-- | app/views/helpers/javascript_vars.phtml | 2 | ||||
| -rw-r--r-- | app/views/index/normal.phtml | 2 | ||||
| -rw-r--r-- | app/views/index/reader.phtml | 2 | ||||
| -rw-r--r-- | app/views/subscription/add.phtml | 2 | ||||
| -rw-r--r-- | app/views/subscription/feed.phtml | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index bab937f6c..9c3fe2076 100755 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -8,7 +8,7 @@ $url = array( 'params' => $_GET, ); -$url['params']['is_favorite'] = Minz_Request::param('is_favorite', true) ? '0' : '1'; +$url['params']['is_favorite'] = (Minz_Request::paramTernary('is_favorite') ?? true) ? '0' : '1'; FreshRSS::loadStylesAndScripts(); echo json_encode(array( diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 0cd2ec0c3..d4f90d151 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -17,12 +17,12 @@ <?php } ?> <?php - $from = Minz_Request::param('from'); - if ($from === false) { + $from = Minz_Request::paramString('from'); + if ($from === '') { $url = _url('subscription', 'feed', 'id', $this->feed->id(), '#', 'slider'); } else { - $get = Minz_Request::param('get'); - if (!$get) { + $get = Minz_Request::paramString('get'); + if ($get === '') { $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from, '#', 'slider'); } else { $url = _url('subscription', 'feed', 'id', $this->feed->id(), 'from', $from, 'get', $get, '#', 'slider'); @@ -132,7 +132,7 @@ <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button> <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button> <?php - if ($from === false) { + if ($from === '') { $url = _url('feed', 'delete', 'id', $this->feed->id()); } else { $url = _url('feed', 'delete', 'id', $this->feed->id(), 'from', $from); diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 99437c7a6..e108f5a34 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -8,7 +8,7 @@ echo htmlspecialchars(json_encode(array( 'anonymous' => !FreshRSS_Auth::hasAccess(), 'auto_remove_article' => !!FreshRSS_Context::isAutoRemoveAvailable(), 'hide_posts' => !(FreshRSS_Context::$user_conf->display_posts || Minz_Request::actionName() === 'reader'), - 'display_order' => Minz_Request::param('order', FreshRSS_Context::$user_conf->sort_order), + 'display_order' => Minz_Request::paramString('order') ?: FreshRSS_Context::$user_conf->sort_order, 'display_categories' => FreshRSS_Context::$user_conf->display_categories, 'auto_mark_article' => !!$mark['article'], 'auto_mark_site' => !!$mark['site'], diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml index 847c307ab..02b336bf7 100644 --- a/app/views/index/normal.phtml +++ b/app/views/index/normal.phtml @@ -1,6 +1,6 @@ <?php /** @var FreshRSS_View $this */ -if (!Minz_Request::param('ajax')) { +if (!Minz_Request::paramBoolean('ajax')) { $this->partial('aside_feed'); $this->partial('nav_menu'); } diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml index 9dcd07435..dde501a92 100644 --- a/app/views/index/reader.phtml +++ b/app/views/index/reader.phtml @@ -1,6 +1,6 @@ <?php /** @var FreshRSS_View $this */ -if (!Minz_Request::param('ajax')) { +if (!Minz_Request::paramBoolean('ajax')) { $this->partial('aside_feed'); $this->partial('nav_menu'); } diff --git a/app/views/subscription/add.phtml b/app/views/subscription/add.phtml index 4e9da877f..afc904916 100644 --- a/app/views/subscription/add.phtml +++ b/app/views/subscription/add.phtml @@ -51,7 +51,7 @@ continue; } ?> - <option value="<?= $cat->id() ?>"<?= $cat->id() == ( Minz_Request::param('cat_id') ?: 1 ) ? ' selected="selected"' : '' ?>> + <option value="<?= $cat->id() ?>"<?= $cat->id() === (Minz_Request::paramInt('cat_id') ?: 1) ? ' selected="selected"' : '' ?>> <?= $cat->name() ?> </option> <?php } ?> diff --git a/app/views/subscription/feed.phtml b/app/views/subscription/feed.phtml index efe75068d..c93b7fc58 100644 --- a/app/views/subscription/feed.phtml +++ b/app/views/subscription/feed.phtml @@ -1,7 +1,7 @@ <?php /** @var FreshRSS_View $this */ ?> <?php -if (!Minz_Request::param('ajax')) { +if (!Minz_Request::paramBoolean('ajax')) { $this->partial('aside_subscription'); } |
