aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-07-07 22:36:27 +0200
committerGravatar GitHub <noreply@github.com> 2023-07-07 22:36:27 +0200
commitf8f163d054110f7e0ff6650fca146b474335f4bd (patch)
treedbd831e600bc76ca2830cd417bd52b712ff97309 /app/Controllers
parent7f9594b8c7d7799f2e5f89328bd5981410db8cf0 (diff)
Chore/processing of depreciations and updating code to php72 minimum (#5504)
* processing of depreciations and updating of code to php7.2 minimum * Autoformat many strange array indenting And revert a few unwanted changes --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers')
-rw-r--r--app/Controllers/authController.php18
-rw-r--r--app/Controllers/categoryController.php10
-rw-r--r--app/Controllers/configureController.php16
-rw-r--r--app/Controllers/entryController.php34
-rw-r--r--app/Controllers/errorController.php2
-rw-r--r--app/Controllers/extensionController.php24
-rw-r--r--app/Controllers/feedController.php69
-rw-r--r--app/Controllers/importExportController.php62
-rw-r--r--app/Controllers/indexController.php18
-rw-r--r--app/Controllers/statsController.php24
-rw-r--r--app/Controllers/subscriptionController.php14
-rw-r--r--app/Controllers/tagController.php12
-rw-r--r--app/Controllers/updateController.php44
-rw-r--r--app/Controllers/userController.php44
14 files changed, 203 insertions, 188 deletions
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php
index 0839656a5..8feebe9a3 100644
--- a/app/Controllers/authController.php
+++ b/app/Controllers/authController.php
@@ -61,23 +61,27 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
*
* It forwards to the correct login page (form) or main page if
* the user is already connected.
+ * @throws Minz_ConfigurationParamException
*/
public function loginAction(): void {
if (FreshRSS_Auth::hasAccess() && Minz_Request::paramString('u') === '') {
- Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true);
+ Minz_Request::forward(['c' => 'index', 'a' => 'index'], true);
}
$auth_type = FreshRSS_Context::$system_conf->auth_type;
FreshRSS_Context::initUser(Minz_User::INTERNAL_USER, false);
switch ($auth_type) {
case 'form':
- Minz_Request::forward(array('c' => 'auth', 'a' => 'formLogin'));
+ Minz_Request::forward(['c' => 'auth', 'a' => 'formLogin']);
break;
case 'http_auth':
- Minz_Error::error(403, array('error' => array(_t('feedback.access.denied'),
+ Minz_Error::error(403, [
+ 'error' => [
+ _t('feedback.access.denied'),
' [HTTP Remote-User=' . htmlspecialchars(httpAuthUser(false), ENT_NOQUOTES, 'UTF-8') .
' ; Remote IP address=' . ($_SERVER['REMOTE_ADDR'] ?? '') . ']'
- )), false);
+ ]
+ ], false);
break;
case 'none':
// It should not happen!
@@ -200,12 +204,12 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
Minz_Translate::init(FreshRSS_Context::$user_conf->language);
- Minz_Request::good(_t('feedback.auth.login.success'), [ 'c' => 'index', 'a' => 'index' ]);
+ Minz_Request::good(_t('feedback.auth.login.success'), ['c' => 'index', 'a' => 'index']);
} else {
Minz_Log::warning('Unsafe password mismatch for user ' . $username);
Minz_Request::bad(
_t('feedback.auth.login.invalid'),
- array('c' => 'auth', 'a' => 'login')
+ ['c' => 'auth', 'a' => 'login']
);
}
}
@@ -229,7 +233,7 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
*/
public function registerAction(): void {
if (FreshRSS_Auth::hasAccess()) {
- Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true);
+ Minz_Request::forward(['c' => 'index', 'a' => 'index'], true);
}
if (max_registrations_reached()) {
diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php
index 60685c566..630399bf4 100644
--- a/app/Controllers/categoryController.php
+++ b/app/Controllers/categoryController.php
@@ -30,7 +30,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
$catDAO = FreshRSS_Factory::createCategoryDao();
$tagDAO = FreshRSS_Factory::createTagDao();
- $url_redirect = array('c' => 'subscription', 'a' => 'add');
+ $url_redirect = ['c' => 'subscription', 'a' => 'add'];
$limits = FreshRSS_Context::$system_conf->limits;
$this->view->categories = $catDAO->listCategories(false) ?: [];
@@ -88,7 +88,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
*/
public function updateAction(): void {
$catDAO = FreshRSS_Factory::createCategoryDao();
- $url_redirect = array('c' => 'subscription', 'a' => 'index');
+ $url_redirect = ['c' => 'subscription', 'a' => 'index'];
if (Minz_Request::isPost()) {
invalidateHttpCache();
@@ -131,7 +131,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
public function deleteAction(): void {
$feedDAO = FreshRSS_Factory::createFeedDao();
$catDAO = FreshRSS_Factory::createCategoryDao();
- $url_redirect = array('c' => 'subscription', 'a' => 'index');
+ $url_redirect = ['c' => 'subscription', 'a' => 'index'];
if (Minz_Request::isPost()) {
invalidateHttpCache();
@@ -174,7 +174,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
*/
public function emptyAction(): void {
$feedDAO = FreshRSS_Factory::createFeedDao();
- $url_redirect = array('c' => 'subscription', 'a' => 'index');
+ $url_redirect = ['c' => 'subscription', 'a' => 'index'];
if (Minz_Request::isPost()) {
invalidateHttpCache();
@@ -214,7 +214,7 @@ class FreshRSS_category_Controller extends FreshRSS_ActionController {
*/
public function refreshOpmlAction(): void {
$catDAO = FreshRSS_Factory::createCategoryDao();
- $url_redirect = array('c' => 'subscription', 'a' => 'index');
+ $url_redirect = ['c' => 'subscription', 'a' => 'index'];
if (Minz_Request::isPost()) {
invalidateHttpCache();
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index 592e8c896..7981c00bb 100644
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -127,16 +127,16 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
FreshRSS_Context::$user_conf->auto_remove_article = Minz_Request::paramBoolean('auto_remove_article');
FreshRSS_Context::$user_conf->mark_updated_article_unread = Minz_Request::paramBoolean('mark_updated_article_unread');
FreshRSS_Context::$user_conf->sort_order = Minz_Request::paramString('sort_order') ?: 'DESC';
- FreshRSS_Context::$user_conf->mark_when = array(
+ FreshRSS_Context::$user_conf->mark_when = [
'article' => Minz_Request::paramBoolean('mark_open_article'),
'gone' => Minz_Request::paramBoolean('read_upon_gone'),
'max_n_unread' => Minz_Request::paramBoolean('enable_keep_max_n_unread') ? Minz_Request::paramInt('keep_max_n_unread') : false,
'reception' => Minz_Request::paramBoolean('mark_upon_reception'),
- 'same_title_in_feed' => Minz_Request::paramBoolean('enable_read_when_same_title_in_feed') ?
- Minz_Request::paramBoolean('read_when_same_title_in_feed') : false,
+ 'same_title_in_feed' =>
+ Minz_Request::paramBoolean('enable_read_when_same_title_in_feed') && Minz_Request::paramBoolean('read_when_same_title_in_feed'),
'scroll' => Minz_Request::paramBoolean('mark_scroll'),
'site' => Minz_Request::paramBoolean('mark_open_site'),
- );
+ ];
FreshRSS_Context::$user_conf->save();
invalidateHttpCache();
@@ -197,7 +197,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
FreshRSS_Context::$user_conf->save();
invalidateHttpCache();
- Minz_Request::good(_t('feedback.conf.shortcuts_updated'), array('c' => 'configure', 'a' => 'shortcut'));
+ Minz_Request::good(_t('feedback.conf.shortcuts_updated'), ['c' => 'configure', 'a' => 'shortcut']);
}
FreshRSS_View::prependTitle(_t('conf.shortcut.title') . ' · ');
@@ -313,7 +313,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'queries' ]);
} else {
- $this->view->queries = array();
+ $this->view->queries = [];
foreach (FreshRSS_Context::$user_conf->queries as $key => $query) {
$this->view->queries[intval($key)] = new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao);
}
@@ -419,13 +419,13 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController {
$category_dao = FreshRSS_Factory::createCategoryDao();
$feed_dao = FreshRSS_Factory::createFeedDao();
$tag_dao = FreshRSS_Factory::createTagDao();
- $queries = array();
+ $queries = [];
foreach (FreshRSS_Context::$user_conf->queries as $key => $query) {
$queries[$key] = (new FreshRSS_UserQuery($query, $feed_dao, $category_dao, $tag_dao))->toArray();
}
$params = $_GET;
unset($params['rid']);
- $params['url'] = Minz_Url::display(array('params' => $params));
+ $params['url'] = Minz_Url::display(['params' => $params]);
$params['name'] = _t('conf.query.number', count($queries) + 1);
$queries[] = (new FreshRSS_UserQuery($params, $feed_dao, $category_dao, $tag_dao))->toArray();
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
index ff995b12f..f334ce0a6 100644
--- a/app/Controllers/entryController.php
+++ b/app/Controllers/entryController.php
@@ -66,7 +66,7 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
if ($id == false) {
// id is false? It MUST be a POST request!
if (!Minz_Request::isPost()) {
- Minz_Request::bad(_t('feedback.access.not_found'), array('c' => 'index', 'a' => 'index'));
+ Minz_Request::bad(_t('feedback.access.not_found'), ['c' => 'index', 'a' => 'index']);
return;
}
@@ -104,11 +104,11 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
}
}
} else {
- $ids = is_array($id) ? $id : array($id);
+ $ids = is_array($id) ? $id : [$id];
$entryDAO->markRead($ids, $is_read);
$tagDAO = FreshRSS_Factory::createTagDao();
$tagsForEntries = $tagDAO->getTagsForEntries($ids) ?: [];
- $tags = array();
+ $tags = [];
foreach ($tagsForEntries as $line) {
$tags['t_' . $line['id_tag']][] = $line['id_entry'];
}
@@ -116,12 +116,14 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
}
if (!$this->ajax) {
- Minz_Request::good($is_read ? _t('feedback.sub.articles.marked_read') : _t('feedback.sub.articles.marked_unread'),
- array(
- 'c' => 'index',
- 'a' => 'index',
- 'params' => $params,
- ));
+ Minz_Request::good(
+ $is_read ? _t('feedback.sub.articles.marked_read') : _t('feedback.sub.articles.marked_unread'),
+ [
+ 'c' => 'index',
+ 'a' => 'index',
+ 'params' => $params,
+ ]
+ );
}
}
@@ -142,10 +144,10 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
}
if (!$this->ajax) {
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'index',
'a' => 'index',
- ), true);
+ ], true);
}
}
@@ -158,10 +160,10 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
* @todo call this action through web-cron when available
*/
public function optimizeAction(): void {
- $url_redirect = array(
+ $url_redirect = [
'c' => 'configure',
'a' => 'archiving',
- );
+ ];
if (!Minz_Request::isPost()) {
Minz_Request::forward($url_redirect, true);
@@ -207,9 +209,9 @@ class FreshRSS_entry_Controller extends FreshRSS_ActionController {
$databaseDAO->minorDbMaintenance();
invalidateHttpCache();
- Minz_Request::good(_t('feedback.sub.purge_completed', $nb_total), array(
+ Minz_Request::good(_t('feedback.sub.purge_completed', $nb_total), [
'c' => 'configure',
- 'a' => 'archiving'
- ));
+ 'a' => 'archiving',
+ ]);
}
}
diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php
index c5b727c05..fe56b13eb 100644
--- a/app/Controllers/errorController.php
+++ b/app/Controllers/errorController.php
@@ -15,7 +15,7 @@ class FreshRSS_error_Controller extends FreshRSS_ActionController {
*/
public function indexAction(): void {
$code_int = Minz_Session::param('error_code', 404);
- $error_logs = Minz_Session::param('error_logs', array());
+ $error_logs = Minz_Session::param('error_logs', []);
Minz_Session::_params([
'error_code' => false,
'error_logs' => false,
diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php
index 2543edac1..e93ec778f 100644
--- a/app/Controllers/extensionController.php
+++ b/app/Controllers/extensionController.php
@@ -20,12 +20,12 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController {
*/
public function indexAction(): void {
FreshRSS_View::prependTitle(_t('admin.extensions.title') . ' · ');
- $this->view->extension_list = array(
- 'system' => array(),
- 'user' => array(),
- );
+ $this->view->extension_list = [
+ 'system' => [],
+ 'user' => [],
+ ];
- $this->view->extensions_installed = array();
+ $this->view->extensions_installed = [];
$extensions = Minz_ExtensionManager::listExtensions();
foreach ($extensions as $ext) {
@@ -47,21 +47,21 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController {
// we ran into problems, simply ignore them
if ($json === false) {
Minz_Log::error('Could not fetch available extension from GitHub');
- return array();
+ return [];
}
// fetch the list as an array
- /** @var array<string,mixed> */
+ /** @var array<string,mixed> $list*/
$list = json_decode($json, true);
if (empty($list)) {
Minz_Log::warning('Failed to convert extension file list');
- return array();
+ return [];
}
// By now, all the needed data is kept in the main extension file.
// In the future we could fetch detail information from the extensions metadata.json, but I tend to stick with
// the current implementation for now, unless it becomes too much effort maintain the extension list manually
- /** @var array<string,array{'name':string,'author':string,'description':string,'version':string,'entrypoint':string,'type':'system'|'user','url':string,'method':string,'directory':string}> */
+ /** @var array<string,array{'name':string,'author':string,'description':string,'version':string,'entrypoint':string,'type':'system'|'user','url':string,'method':string,'directory':string}> $extensions*/
$extensions = $list['extensions'];
return $extensions;
@@ -112,7 +112,7 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController {
* - e: the extension name (urlencoded).
*/
public function enableAction(): void {
- $url_redirect = array('c' => 'extension', 'a' => 'index');
+ $url_redirect = ['c' => 'extension', 'a' => 'index'];
if (Minz_Request::isPost()) {
$ext_name = urldecode(Minz_Request::paramString('e'));
@@ -174,7 +174,7 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController {
* - e: the extension name (urlencoded).
*/
public function disableAction(): void {
- $url_redirect = array('c' => 'extension', 'a' => 'index');
+ $url_redirect = ['c' => 'extension', 'a' => 'index'];
if (Minz_Request::isPost()) {
$ext_name = urldecode(Minz_Request::paramString('e'));
@@ -240,7 +240,7 @@ class FreshRSS_extension_Controller extends FreshRSS_ActionController {
Minz_Error::error(403);
}
- $url_redirect = array('c' => 'extension', 'a' => 'index');
+ $url_redirect = ['c' => 'extension', 'a' => 'index'];
if (Minz_Request::isPost()) {
$ext_name = urldecode(Minz_Request::paramString('e'));
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 8c95a5c9c..e5685dddf 100644
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -54,7 +54,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$cat = $catDAO->searchById($cat_id);
}
if ($cat === null && $new_cat_name != '') {
- $new_cat_id = $catDAO->addCategory(array('name' => $new_cat_name));
+ $new_cat_id = $catDAO->addCategory(['name' => $new_cat_name]);
$cat_id = $new_cat_id > 0 ? $new_cat_id : $cat_id;
$cat = $catDAO->searchById($cat_id);
}
@@ -132,18 +132,18 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
if ($url === '') {
// No url, do nothing
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'subscription',
- 'a' => 'index'
- ), true);
+ 'a' => 'index',
+ ], true);
}
$feedDAO = FreshRSS_Factory::createFeedDao();
- $url_redirect = array(
+ $url_redirect = [
'c' => 'subscription',
'a' => 'add',
- 'params' => array(),
- );
+ 'params' => [],
+ ];
$limits = FreshRSS_Context::$system_conf->limits;
$this->view->feeds = $feedDAO->listFeeds();
@@ -302,11 +302,11 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
*/
public function truncateAction(): void {
$id = Minz_Request::paramInt('id');
- $url_redirect = array(
+ $url_redirect = [
'c' => 'subscription',
'a' => 'index',
- 'params' => array('id' => $id)
- );
+ 'params' => ['id' => $id],
+ ];
if (!Minz_Request::isPost()) {
Minz_Request::forward($url_redirect, true);
@@ -337,7 +337,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
// Create a list of feeds to actualize.
// If feed_id is set and valid, corresponding feed is added to the list but
// alone in order to automatize further process.
- $feeds = array();
+ $feeds = [];
if ($feed_id > 0 || $feed_url) {
$feed = $feed_id > 0 ? $feedDAO->searchById($feed_id) : $feedDAO->searchByUrl($feed_url);
if ($feed) {
@@ -455,9 +455,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$titlesAsRead = array_flip($feedDAO->listTitles($feed->id(), (int)$readWhenSameTitleInFeed));
}
- $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? (
- $feed->attributes('mark_updated_article_unread')
- ) : FreshRSS_Context::$user_conf->mark_updated_article_unread;
+ $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') ?? FreshRSS_Context::$user_conf->mark_updated_article_unread;
// For this feed, check existing GUIDs already in database.
$existingHashForGuids = $entryDAO->listHashForFeedGuids($feed->id(), $newGuids) ?: [];
@@ -555,7 +553,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
unset($entries);
- if (mt_rand(0, 30) === 1) { // Remove old entries once in 30.
+ if (rand(0, 30) === 1) { // Remove old entries once in 30.
if (!$entryDAO->inTransaction()) {
$entryDAO->beginTransaction();
}
@@ -590,7 +588,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
$feed->_url($selfUrl, false);
Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url(false));
- $feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));
+ $feedDAO->updateFeed($feed->id(), ['url' => $feed->url()]);
}
}
} elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently
@@ -602,7 +600,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
if ($simplePie != null) {
if ($feed->name(true) === '') {
//HTML to HTML-PRE //ENT_COMPAT except '&'
- $name = strtr(html_only_entity_decode($simplePie->get_title()), array('<' => '&lt;', '>' => '&gt;', '"' => '&quot;'));
+ $name = strtr(html_only_entity_decode($simplePie->get_title()), ['<' => '&lt;', '>' => '&gt;', '"' => '&quot;']);
$feed->_name($name);
$feedProperties['name'] = $feed->name(false);
}
@@ -661,7 +659,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$databaseDAO = FreshRSS_Factory::createDatabaseDAO();
$databaseDAO->minorDbMaintenance();
}
- return array($updated_feeds, reset($feeds), $nb_new_articles);
+ return [$updated_feeds, reset($feeds), $nb_new_articles];
}
/**
@@ -722,13 +720,18 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
return $updated_feeds;
}
+ /**
+ * @throws Minz_ConfigurationNamespaceException
+ * @throws JsonException
+ * @throws Minz_PDOConnectionException
+ */
public static function renameFeed(int $feed_id, string $feed_name): bool {
if ($feed_id <= 0 || $feed_name === '') {
return false;
}
FreshRSS_UserDAO::touch();
$feedDAO = FreshRSS_Factory::createFeedDao();
- return $feedDAO->updateFeed($feed_id, array('name' => $feed_name)) === 1;
+ return $feedDAO->updateFeed($feed_id, ['name' => $feed_name]) === 1;
}
public static function moveFeed(int $feed_id, int $cat_id, string $new_cat_name = ''): bool {
@@ -743,7 +746,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$cat_id = $cat === null ? 0 : $cat->id();
}
if ($cat_id <= 1 && $new_cat_name != '') {
- $cat_id = $catDAO->addCategory(array('name' => $new_cat_name));
+ $cat_id = $catDAO->addCategory(['name' => $new_cat_name]);
}
if ($cat_id <= 1) {
$catDAO->checkDefault();
@@ -751,7 +754,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
}
$feedDAO = FreshRSS_Factory::createFeedDao();
- return $feedDAO->updateFeed($feed_id, array('category' => $cat_id)) === 1;
+ return $feedDAO->updateFeed($feed_id, ['category' => $cat_id]) === 1;
}
/**
@@ -768,7 +771,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
*/
public function moveAction(): void {
if (!Minz_Request::isPost()) {
- Minz_Request::forward(array('c' => 'subscription'), true);
+ Minz_Request::forward(['c' => 'subscription'], true);
}
$feed_id = Minz_Request::paramInt('f_id');
@@ -815,14 +818,14 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
switch ($from) {
case 'stats':
- $redirect_url = array('c' => 'stats', 'a' => 'idle');
+ $redirect_url = ['c' => 'stats', 'a' => 'idle'];
break;
case 'normal':
$get = Minz_Request::paramString('get');
if ($get) {
- $redirect_url = array('c' => 'index', 'a' => 'normal', 'params' => array('get' => $get));
+ $redirect_url = ['c' => 'index', 'a' => 'normal', 'params' => ['get' => $get]];
} else {
- $redirect_url = array('c' => 'index', 'a' => 'normal');
+ $redirect_url = ['c' => 'index', 'a' => 'normal'];
}
break;
default:
@@ -853,15 +856,15 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$feedDAO = FreshRSS_Factory::createFeedDao();
$feed = $feedDAO->searchById($id);
if ($feed === null) {
- Minz_Request::bad(_t('feedback.sub.feed.not_found'), array());
+ Minz_Request::bad(_t('feedback.sub.feed.not_found'), []);
return;
}
$feed->clearCache();
- Minz_Request::good(_t('feedback.sub.feed.cache_cleared', $feed->name()), array(
- 'params' => array('get' => 'f_' . $feed->id())
- ));
+ Minz_Request::good(_t('feedback.sub.feed.cache_cleared', $feed->name()), [
+ 'params' => ['get' => 'f_' . $feed->id()],
+ ]);
}
/**
@@ -884,7 +887,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
$feed = $feedDAO->searchById($feed_id);
if ($feed === null) {
- Minz_Request::bad(_t('feedback.sub.feed.not_found'), array());
+ Minz_Request::bad(_t('feedback.sub.feed.not_found'), []);
return;
}
@@ -915,9 +918,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
Minz_ModelPdo::$usesSharedPdo = true;
//Give feedback to user.
- Minz_Request::good(_t('feedback.sub.feed.reloaded', $feed->name()), array(
- 'params' => array('get' => 'f_' . $feed->id())
- ));
+ Minz_Request::good(_t('feedback.sub.feed.reloaded', $feed->name()), [
+ 'params' => ['get' => 'f_' . $feed->id()]
+ ]);
}
/**
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index b6f7a4441..9c18b608f 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -70,15 +70,15 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$type_file = self::guessFileType($name);
- $list_files = array(
- 'opml' => array(),
- 'json_starred' => array(),
- 'json_feed' => array(),
- 'ttrss_starred' => array(),
- );
+ $list_files = [
+ 'opml' => [],
+ 'json_starred' => [],
+ 'json_feed' => [],
+ 'ttrss_starred' => [],
+ ];
// We try to list all files according to their type
- $list = array();
+ $list = [];
if ('zip' === $type_file && extension_loaded('zip')) {
$zip = new ZipArchive();
$result = $zip->open($path);
@@ -171,7 +171,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
*/
public function importAction(): void {
if (!Minz_Request::isPost()) {
- Minz_Request::forward(array('c' => 'importExport', 'a' => 'index'), true);
+ Minz_Request::forward(['c' => 'importExport', 'a' => 'index'], true);
}
$file = $_FILES['file'];
@@ -188,12 +188,16 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
try {
$error = !$this->importFile($file['name'], $file['tmp_name']);
} catch (FreshRSS_ZipMissing_Exception $zme) {
- Minz_Request::bad(_t('feedback.import_export.no_zip_extension'),
- array('c' => 'importExport', 'a' => 'index'));
+ Minz_Request::bad(
+ _t('feedback.import_export.no_zip_extension'),
+ ['c' => 'importExport', 'a' => 'index']
+ );
} catch (FreshRSS_Zip_Exception $ze) {
Minz_Log::warning('ZIP archive cannot be imported. Error code: ' . $ze->zipErrorCode());
- Minz_Request::bad(_t('feedback.import_export.zip_error'),
- array('c' => 'importExport', 'a' => 'index'));
+ Minz_Request::bad(
+ _t('feedback.import_export.zip_error'),
+ ['c' => 'importExport', 'a' => 'index']
+ );
}
// And finally, we get import status and redirect to the home page
@@ -245,7 +249,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$item['updated'] = isset($item['updated']) ? strtotime($item['updated']) : '';
$item['published'] = $item['updated'];
$item['content'] = ['content' => $item['content'] ?? ''];
- $item['categories'] = isset($item['tag_cache']) ? array($item['tag_cache']) : array();
+ $item['categories'] = isset($item['tag_cache']) ? [$item['tag_cache']] : [];
if (!empty($item['marked'])) {
$item['categories'][] = 'user/-/state/com.google/starred';
}
@@ -298,10 +302,10 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$mark_as_read = FreshRSS_Context::$user_conf->mark_when['reception'] ? 1 : 0;
$error = false;
- $article_to_feed = array();
+ $article_to_feed = [];
$nb_feeds = count($this->feedDAO->listFeeds());
- $newFeedGuids = array();
+ $newFeedGuids = [];
$limits = FreshRSS_Context::$system_conf->limits;
// First, we check feeds of articles are in DB (and add them if needed).
@@ -353,7 +357,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
if ($feed != null) {
$article_to_feed[$item['guid']] = $feed->id();
if (!isset($newFeedGuids['f_' . $feed->id()])) {
- $newFeedGuids['f_' . $feed->id()] = array();
+ $newFeedGuids['f_' . $feed->id()] = [];
}
$newFeedGuids['f_' . $feed->id()][] = safe_ascii($item['guid']);
}
@@ -361,22 +365,22 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$tagDAO = FreshRSS_Factory::createTagDao();
$labels = $tagDAO->listTags() ?: [];
- $knownLabels = array();
+ $knownLabels = [];
foreach ($labels as $label) {
$knownLabels[$label->name()]['id'] = $label->id();
- $knownLabels[$label->name()]['articles'] = array();
+ $knownLabels[$label->name()]['articles'] = [];
}
unset($labels);
// For each feed, check existing GUIDs already in database.
- $existingHashForGuids = array();
+ $existingHashForGuids = [];
foreach ($newFeedGuids as $feedId => $newGuids) {
$existingHashForGuids[$feedId] = $this->entryDAO->listHashForFeedGuids((int)substr($feedId, 2), $newGuids);
}
unset($newFeedGuids);
// Then, articles are imported.
- $newGuids = array();
+ $newGuids = [];
$this->entryDAO->beginTransaction();
foreach ($items as $item) {
if (empty($item['guid']) || empty($article_to_feed[$item['guid']])) {
@@ -388,8 +392,8 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
$author = $item['author'] ?? '';
$is_starred = null; // null is used to preserve the current state if that item exists and is already starred
$is_read = null;
- $tags = empty($item['categories']) ? array() : $item['categories'];
- $labels = array();
+ $tags = empty($item['categories']) ? [] : $item['categories'];
+ $labels = [];
for ($i = count($tags) - 1; $i >= 0; $i--) {
$tag = trim($tags[$i]);
if (strpos($tag, 'user/-/') !== false) {
@@ -480,15 +484,15 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController {
foreach ($labels as $labelName) {
if (empty($knownLabels[$labelName]['id'])) {
- $labelId = $tagDAO->addTag(array('name' => $labelName));
+ $labelId = $tagDAO->addTag(['name' => $labelName]);
$knownLabels[$labelName]['id'] = $labelId;
- $knownLabels[$labelName]['articles'] = array();
+ $knownLabels[$labelName]['articles'] = [];
}
- $knownLabels[$labelName]['articles'][] = array(
- //'id' => $entry->id(), //ID changes after commitNewEntries()
- 'id_feed' => $entry->feedId(),
- 'guid' => $entry->guid(),
- );
+ $knownLabels[$labelName]['articles'][] = [
+ //'id' => $entry->id(), //ID changes after commitNewEntries()
+ 'id_feed' => $entry->feedId(),
+ 'guid' => $entry->guid(),
+ ];
}
$error |= ($ok === false);
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 0e680934a..cad2e9f85 100644
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -10,10 +10,10 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
*/
public function indexAction(): void {
$preferred_output = FreshRSS_Context::$user_conf->view_mode;
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'index',
- 'a' => $preferred_output
- ));
+ 'a' => $preferred_output,
+ ]);
}
/**
@@ -22,14 +22,14 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
public function normalAction(): void {
$allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous;
if (!FreshRSS_Auth::hasAccess() && !$allow_anonymous) {
- Minz_Request::forward(array('c' => 'auth', 'a' => 'login'));
+ Minz_Request::forward(['c' => 'auth', 'a' => 'login']);
return;
}
$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));
+ $url_redirect = ['c' => 'subscription', 'a' => 'feed', 'params' => ['id' => (string)$id, 'from' => $view]];
Minz_Request::forward($url_redirect, true);
return;
}
@@ -58,7 +58,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
FreshRSS_Context::$id_max = time() . '000000';
- $this->view->callbackBeforeFeeds = function (FreshRSS_View $view) {
+ $this->view->callbackBeforeFeeds = static function (FreshRSS_View $view) {
try {
$tagDAO = FreshRSS_Factory::createTagDao();
$view->tags = $tagDAO->listTags(true) ?: [];
@@ -71,7 +71,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
}
};
- $this->view->callbackBeforeEntries = function (FreshRSS_View $view) {
+ $this->view->callbackBeforeEntries = static function (FreshRSS_View $view) {
try {
FreshRSS_Context::$number++; //+1 for articles' page
$view->entries = FreshRSS_index_Controller::listEntriesByContext();
@@ -83,7 +83,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
}
};
- $this->view->callbackBeforePagination = function (?FreshRSS_View $view, int $nbEntries, FreshRSS_Entry $lastEntry) {
+ $this->view->callbackBeforePagination = static function (?FreshRSS_View $view, int $nbEntries, FreshRSS_Entry $lastEntry) {
if ($nbEntries >= FreshRSS_Context::$number) {
//We have enough entries: we discard the last one to use it for the next articles' page
ob_clean();
@@ -108,7 +108,7 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
public function globalAction(): void {
$allow_anonymous = FreshRSS_Context::$system_conf->allow_anonymous;
if (!FreshRSS_Auth::hasAccess() && !$allow_anonymous) {
- Minz_Request::forward(array('c' => 'auth', 'a' => 'login'));
+ Minz_Request::forward(['c' => 'auth', 'a' => 'login']);
return;
}
diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php
index 3ce42dd2c..9890db04b 100644
--- a/app/Controllers/statsController.php
+++ b/app/Controllers/statsController.php
@@ -104,9 +104,9 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
$id = Minz_Request::paramInt('id');
$ajax = Minz_Request::paramBoolean('ajax');
if ($ajax) {
- $url_redirect = array('c' => 'subscription', 'a' => 'feed', 'params' => array('id' => (string)$id, 'from' => 'stats', 'ajax' => (string)$ajax));
+ $url_redirect = ['c' => 'subscription', 'a' => 'feed', 'params' => ['id' => (string)$id, 'from' => 'stats', 'ajax' => (string)$ajax]];
} else {
- $url_redirect = array('c' => 'subscription', 'a' => 'feed', 'params' => array('id' => (string)$id, 'from' => 'stats'));
+ $url_redirect = ['c' => 'subscription', 'a' => 'feed', 'params' => ['id' => (string)$id, 'from' => 'stats']];
}
Minz_Request::forward($url_redirect, true);
}
@@ -130,16 +130,16 @@ class FreshRSS_stats_Controller extends FreshRSS_ActionController {
$feed_dao = FreshRSS_Factory::createFeedDao();
$statsDAO = FreshRSS_Factory::createStatsDAO();
$feeds = $statsDAO->calculateFeedLastDate() ?: [];
- $idleFeeds = array(
- 'last_5_year' => array(),
- 'last_3_year' => array(),
- 'last_2_year' => array(),
- 'last_year' => array(),
- 'last_6_month' => array(),
- 'last_3_month' => array(),
- 'last_month' => array(),
- 'last_week' => array(),
- );
+ $idleFeeds = [
+ 'last_5_year' => [],
+ 'last_3_year' => [],
+ 'last_2_year' => [],
+ 'last_year' => [],
+ 'last_6_month' => [],
+ 'last_3_month' => [],
+ 'last_month' => [],
+ 'last_week' => [],
+ ];
$now = new \DateTime();
$feedDate = clone $now;
$lastWeek = clone $now;
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index 3383dc66a..733a9252c 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -231,7 +231,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
$feed->_attributes('path_entries_filter', Minz_Request::paramString('path_entries_filter', true));
- $values = array(
+ $values = [
'name' => Minz_Request::paramString('name'),
'kind' => $feed->kind(),
'description' => sanitizeHTML(Minz_Request::paramString('description', true)),
@@ -243,26 +243,26 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
'httpAuth' => $httpAuth,
'ttl' => $feed->ttl(true),
'attributes' => $feed->attributes(),
- );
+ ];
invalidateHttpCache();
$from = Minz_Request::paramString('from');
switch ($from) {
case 'stats':
- $url_redirect = array('c' => 'stats', 'a' => 'idle', 'params' => array('id' => $id, 'from' => 'stats'));
+ $url_redirect = ['c' => 'stats', 'a' => 'idle', 'params' => ['id' => $id, 'from' => 'stats']];
break;
case 'normal':
case 'reader':
$get = Minz_Request::paramString('get');
if ($get) {
- $url_redirect = array('c' => 'index', 'a' => $from, 'params' => array('get' => $get));
+ $url_redirect = ['c' => 'index', 'a' => $from, 'params' => ['get' => $get]];
} else {
- $url_redirect = array('c' => 'index', 'a' => $from);
+ $url_redirect = ['c' => 'index', 'a' => $from];
}
break;
default:
- $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id));
+ $url_redirect = ['c' => 'subscription', 'params' => ['id' => $id]];
}
if ($values['url'] != '' && $feedDAO->updateFeed($id, $values) !== false) {
@@ -346,7 +346,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController {
invalidateHttpCache();
- $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id, 'type' => 'category'));
+ $url_redirect = ['c' => 'subscription', 'params' => ['id' => $id, 'type' => 'category']];
if (false !== $categoryDAO->updateCategory($id, $values)) {
Minz_Request::good(_t('feedback.sub.category.updated'), $url_redirect);
} else {
diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php
index eb259df12..68ef36111 100644
--- a/app/Controllers/tagController.php
+++ b/app/Controllers/tagController.php
@@ -45,7 +45,7 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController {
$tagDAO->tagEntry($existing_tag->id(), $id_entry, $checked);
} else {
//Create new tag
- $id_tag = $tagDAO->addTag(array('name' => $name_tag));
+ $id_tag = $tagDAO->addTag(['name' => $name_tag]);
}
}
if ($id_tag != false) {
@@ -56,10 +56,10 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController {
Minz_Error::error(405);
}
if (!$this->ajax) {
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'index',
'a' => 'index',
- ), true);
+ ], true);
}
}
@@ -74,10 +74,10 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController {
Minz_Error::error(405);
}
if (!$this->ajax) {
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'tag',
'a' => 'index',
- ), true);
+ ], true);
}
}
@@ -107,7 +107,7 @@ class FreshRSS_tag_Controller extends FreshRSS_ActionController {
/**
* @throws Minz_ConfigurationNamespaceException
- * @throws Minz_PDOConnectionException
+ * @throws Minz_PDOConnectionException|JsonException
*/
public function renameAction(): void {
if (!Minz_Request::isPost()) {
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index 241184090..6d9249771 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -142,17 +142,17 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
}
if (touch(FRESHRSS_PATH . '/index.html')) {
$this->view->update_to_apply = true;
- $this->view->message = array(
+ $this->view->message = [
'status' => 'good',
'title' => _t('gen.short.ok'),
'body' => _t('feedback.update.can_apply', $version),
- );
+ ];
} else {
- $this->view->message = array(
+ $this->view->message = [
'status' => 'bad',
'title' => _t('gen.short.damn'),
'body' => _t('feedback.update.file_is_nok', $version, FRESHRSS_PATH),
- );
+ ];
}
}
}
@@ -174,7 +174,7 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
// There is already an update file to apply: we don’t need to check
// the webserver!
// Or if already check during the last hour, do nothing.
- Minz_Request::forward(array('c' => 'update'), true);
+ Minz_Request::forward(['c' => 'update'], true);
return;
}
@@ -185,10 +185,10 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
if (self::hasGitUpdate()) {
$version = self::getCurrentGitBranch();
} else {
- $this->view->message = array(
+ $this->view->message = [
'status' => 'latest',
- 'body' => _t('feedback.update.none')
- );
+ 'body' => _t('feedback.update.none'),
+ ];
@touch(join_path(DATA_PATH, self::LASTUPDATEFILE));
return;
}
@@ -219,20 +219,20 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
'Error during update (HTTP code ' . $curlGetinfo . '): ' . $curlError
);
- $this->view->message = array(
+ $this->view->message = [
'status' => 'bad',
- 'body' => _t('feedback.update.server_not_found', $auto_update_url)
- );
+ 'body' => _t('feedback.update.server_not_found', $auto_update_url),
+ ];
return;
}
$res_array = explode("\n", (string)$result, 2);
$status = $res_array[0];
if (strpos($status, 'UPDATE') !== 0) {
- $this->view->message = array(
+ $this->view->message = [
'status' => 'latest',
- 'body' => _t('feedback.update.none')
- );
+ 'body' => _t('feedback.update.none'),
+ ];
@touch(join_path(DATA_PATH, self::LASTUPDATEFILE));
return;
}
@@ -246,18 +246,18 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
if (file_put_contents(UPDATE_FILENAME, $script) !== false) {
@file_put_contents(join_path(DATA_PATH, self::LASTUPDATEFILE), $version);
- Minz_Request::forward(array('c' => 'update'), true);
+ Minz_Request::forward(['c' => 'update'], true);
} else {
- $this->view->message = array(
+ $this->view->message = [
'status' => 'bad',
- 'body' => _t('feedback.update.error', 'Cannot save the update script')
- );
+ 'body' => _t('feedback.update.error', 'Cannot save the update script'),
+ ];
}
}
public function applyAction(): void {
if (FreshRSS_Context::$system_conf->disable_update || !file_exists(UPDATE_FILENAME) || !touch(FRESHRSS_PATH . '/index.html')) {
- Minz_Request::forward(array('c' => 'update'), true);
+ Minz_Request::forward(['c' => 'update'], true);
}
if (Minz_Request::paramBoolean('post_conf')) {
@@ -305,11 +305,11 @@ class FreshRSS_update_Controller extends FreshRSS_ActionController {
}
if ($res === true) {
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'update',
'a' => 'apply',
- 'params' => array('post_conf' => '1')
- ), true);
+ 'params' => ['post_conf' => '1'],
+ ], true);
} else {
Minz_Log::error(_t('feedback.update.error', $res));
Minz_Request::bad(_t('feedback.update.error', $res), [ 'c' => 'update', 'a' => 'index' ]);
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index 90eb44800..aa5682e26 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -8,7 +8,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
* The username is also used as folder name, file name, and part of SQL table name.
* '_' is a reserved internal username.
*/
- const USERNAME_PATTERN = '([0-9a-zA-Z_][0-9a-zA-Z_.@-]{1,38}|[0-9a-zA-Z])';
+ public const USERNAME_PATTERN = '([0-9a-zA-Z_][0-9a-zA-Z_.@-]{1,38}|[0-9a-zA-Z])';
public static function checkUsername(string $username): bool {
return preg_match('/^' . self::USERNAME_PATTERN . '$/', $username) === 1;
@@ -69,12 +69,12 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
if ($ok) {
$isSelfUpdate = Minz_User::name() === $username;
if ($passwordPlain == '' || !$isSelfUpdate) {
- Minz_Request::good(_t('feedback.user.updated', $username), array('c' => 'user', 'a' => 'manage'));
+ Minz_Request::good(_t('feedback.user.updated', $username), ['c' => 'user', 'a' => 'manage']);
} else {
- Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'index', 'a' => 'index'));
+ Minz_Request::good(_t('feedback.profile.updated'), ['c' => 'index', 'a' => 'index']);
}
} else {
- Minz_Request::bad(_t('feedback.user.updated.error', $username), [ 'c' => 'user', 'a' => 'manage' ]);
+ Minz_Request::bad(_t('feedback.user.updated.error', $username), ['c' => 'user', 'a' => 'manage']);
}
}
}
@@ -111,14 +111,14 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
if ($system_conf->force_email_validation && empty($email)) {
Minz_Request::bad(
_t('user.email.feedback.required'),
- array('c' => 'user', 'a' => 'profile')
+ ['c' => 'user', 'a' => 'profile']
);
}
if (!empty($email) && !validateEmailAddress($email)) {
Minz_Request::bad(
_t('user.email.feedback.invalid'),
- array('c' => 'user', 'a' => 'profile')
+ ['c' => 'user', 'a' => 'profile']
);
}
@@ -135,14 +135,14 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
if ($ok) {
if ($system_conf->force_email_validation && $email !== $old_email) {
- Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'user', 'a' => 'validateEmail'));
+ Minz_Request::good(_t('feedback.profile.updated'), ['c' => 'user', 'a' => 'validateEmail']);
} elseif ($passwordPlain == '') {
- Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'user', 'a' => 'profile'));
+ Minz_Request::good(_t('feedback.profile.updated'), ['c' => 'user', 'a' => 'profile']);
} else {
- Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'index', 'a' => 'index'));
+ Minz_Request::good(_t('feedback.profile.updated'), ['c' => 'index', 'a' => 'index']);
}
} else {
- Minz_Request::bad(_t('feedback.profile.error'), [ 'c' => 'user', 'a' => 'profile' ]);
+ Minz_Request::bad(_t('feedback.profile.error'), ['c' => 'user', 'a' => 'profile']);
}
}
}
@@ -441,7 +441,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
if ($user_config->email_validation_token === '') {
Minz_Request::good(
_t('user.email.validation.feedback.unnecessary'),
- array('c' => 'index', 'a' => 'index')
+ ['c' => 'index', 'a' => 'index']
);
}
@@ -449,7 +449,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
if ($user_config->email_validation_token !== $token) {
Minz_Request::bad(
_t('user.email.validation.feedback.wrong_token'),
- array('c' => 'user', 'a' => 'validateEmail')
+ ['c' => 'user', 'a' => 'validateEmail']
);
}
@@ -457,12 +457,12 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
if ($user_config->save()) {
Minz_Request::good(
_t('user.email.validation.feedback.ok'),
- array('c' => 'index', 'a' => 'index')
+ ['c' => 'index', 'a' => 'index']
);
} else {
Minz_Request::bad(
_t('user.email.validation.feedback.error'),
- array('c' => 'user', 'a' => 'validateEmail')
+ ['c' => 'user', 'a' => 'validateEmail']
);
}
}
@@ -491,16 +491,16 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
$user_config = FreshRSS_Context::$user_conf;
if ($user_config->email_validation_token === '') {
- Minz_Request::forward(array(
+ Minz_Request::forward([
'c' => 'index',
'a' => 'index',
- ), true);
+ ], true);
}
$mailer = new FreshRSS_User_Mailer();
$ok = $mailer->send_email_need_validation($username, $user_config);
- $redirect_url = array('c' => 'user', 'a' => 'validateEmail');
+ $redirect_url = ['c' => 'user', 'a' => 'validateEmail'];
if ($ok) {
Minz_Request::good(
_t('user.email.validation.feedback.email_sent'),
@@ -549,7 +549,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
}
if ($ok && $self_deletion) {
FreshRSS_Auth::removeAccess();
- $redirect_url = array('c' => 'index', 'a' => 'index');
+ $redirect_url = ['c' => 'index', 'a' => 'index'];
}
invalidateHttpCache();
@@ -603,10 +603,12 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
FreshRSS_UserDAO::touch($username);
if ($ok) {
- Minz_Request::good(_t('feedback.user.updated', $username), array('c' => 'user', 'a' => 'manage'));
+ Minz_Request::good(_t('feedback.user.updated', $username), ['c' => 'user', 'a' => 'manage']);
} else {
- Minz_Request::bad(_t('feedback.user.updated.error', $username),
- array('c' => 'user', 'a' => 'manage'));
+ Minz_Request::bad(
+ _t('feedback.user.updated.error', $username),
+ ['c' => 'user', 'a' => 'manage']
+ );
}
}