aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-12-02 23:25:07 +0100
committerGravatar GitHub <noreply@github.com> 2021-12-02 23:25:07 +0100
commita2ab9cf83aaead96497a70a1430ce0424c0d8316 (patch)
tree015985aac14f6bd6800ec8cbeb5166e5f9479ea5 /app
parent4e00c2d3373af223380b9f8f168007bb8e42b6b9 (diff)
Minz request avoid custom methods (#4020)
Take advantage of PHP7+ null-coalescing operator `??` to make code more standard, shorter, and faster instead of custom function with no extra functionality. Allows code to be better tested and fix two PHPstan errors: ``` ------ ----------------------------------------- Line app/Controllers/configureController.php ------ ----------------------------------------- 410 Cannot unset offset 'rid' on string. ------ ----------------------------------------- ------ ------------------------------------ Line lib/Minz/FrontController.php ------ ------------------------------------ 70 Cannot unset offset 'c' on string. 71 Cannot unset offset 'a' on string. ------ ------------------------------------ ``` https://github.com/FreshRSS/FreshRSS/issues/4016
Diffstat (limited to 'app')
-rwxr-xr-xapp/Controllers/configureController.php4
-rwxr-xr-xapp/Controllers/feedController.php2
-rw-r--r--app/Models/Auth.php2
-rwxr-xr-xapp/views/entry/bookmark.phtml2
-rwxr-xr-xapp/views/helpers/logs_pagination.phtml2
-rw-r--r--app/views/index/global.phtml2
6 files changed, 7 insertions, 7 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index 79ddf8e17..e8d8fb546 100755
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -152,7 +152,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
Minz_View::appendScript(Minz_Url::display('/scripts/draggable.js?' . @filemtime(PUBLIC_PATH . '/scripts/draggable.js')));
if (Minz_Request::isPost()) {
- $params = Minz_Request::fetchPOST();
+ $params = $_POST;
FreshRSS_Context::$user_conf->sharing = $params['share'];
FreshRSS_Context::$user_conf->save();
invalidateHttpCache();
@@ -406,7 +406,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
foreach (FreshRSS_Context::$user_conf->queries as $key => $query) {
$queries[$key] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao);
}
- $params = Minz_Request::fetchGET();
+ $params = $_GET;
unset($params['rid']);
$params['url'] = Minz_Url::display(array('params' => $params));
$params['name'] = _t('conf.query.number', count($queries) + 1);
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index afb05f17e..c94b3216a 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -566,7 +566,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$url = Minz_Request::param('url');
$force = Minz_Request::param('force');
$maxFeeds = (int)Minz_Request::param('maxFeeds');
- $noCommit = Minz_Request::fetchPOST('noCommit', 0) == 1;
+ $noCommit = ($_POST['noCommit'] ?? 0) == 1;
if ($id == -1 && !$noCommit) { //Special request only to commit & refresh DB cache
$updated_feeds = 0;
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index 709a80f84..04bd4291f 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -223,7 +223,7 @@ class FreshRSS_Auth {
public static function isCsrfOk($token = null) {
$csrf = Minz_Session::param('csrf');
if ($token === null) {
- $token = Minz_Request::fetchPOST('_csrf');
+ $token = $_POST['_csrf'] ?? '';
}
return $token != '' && $token === $csrf;
}
diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml
index d85706669..e842f7465 100755
--- a/app/views/entry/bookmark.phtml
+++ b/app/views/entry/bookmark.phtml
@@ -4,7 +4,7 @@ header('Content-Type: application/json; charset=UTF-8');
$url = array(
'c' => Minz_Request::controllerName(),
'a' => Minz_Request::actionName(),
- 'params' => Minz_Request::fetchGET(),
+ 'params' => $_GET,
);
$url['params']['is_favorite'] = Minz_Request::param('is_favorite', true) ? '0' : '1';
diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml
index e74074173..fa69d0b44 100755
--- a/app/views/helpers/logs_pagination.phtml
+++ b/app/views/helpers/logs_pagination.phtml
@@ -1,7 +1,7 @@
<?php
$c = Minz_Request::controllerName();
$a = Minz_Request::actionName();
- $params = Minz_Request::fetchGET();
+ $params = $_GET;
?>
<?php if ($this->nbPage > 1) { ?>
diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml
index 4323e3849..5b7e886e8 100644
--- a/app/views/index/global.phtml
+++ b/app/views/index/global.phtml
@@ -11,7 +11,7 @@
<main id="stream" class="global<?= $class ?>">
<?php
- $params = Minz_Request::fetchGET();
+ $params = $_GET;
unset($params['c']);
unset($params['a']);
$url_base = array(