From 77e9877316fcfacb26799afdf32d94c8411da80e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 31 Dec 2021 17:00:51 +0100 Subject: Add PHPStan (#4021) * Add PHPStan #fix https://github.com/FreshRSS/FreshRSS/issues/4016 https://phpstan.org/ ```sh composer run-script phpstan ``` * More fixes * Fix global variables * Add .phtml * Fix merge https://github.com/FreshRSS/FreshRSS/pull/4090 * Fix more warnings * Fix view errors and enable in CI * ReturnTypeWillChange * Dynamic view type * Fix Minz static/self bug --- app/Controllers/authController.php | 8 ++++---- app/Controllers/configureController.php | 21 +++++++++++---------- app/Controllers/entryController.php | 9 ++++++++- app/Controllers/errorController.php | 2 +- app/Controllers/extensionController.php | 2 +- app/Controllers/feedController.php | 17 +++++++++-------- app/Controllers/importExportController.php | 9 ++++++++- app/Controllers/indexController.php | 20 ++++++++++---------- app/Controllers/statsController.php | 10 +++++++--- app/Controllers/subscriptionController.php | 10 +++++----- app/Controllers/tagController.php | 13 ++++++++++--- app/Controllers/updateController.php | 8 ++++++-- app/Controllers/userController.php | 13 +++++++------ 13 files changed, 87 insertions(+), 55 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index e48bf39e8..085278a4f 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -22,7 +22,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { Minz_Error::error(403); } - Minz_View::prependTitle(_t('admin.auth.title') . ' · '); + FreshRSS_View::prependTitle(_t('admin.auth.title') . ' · '); if (Minz_Request::isPost()) { $ok = true; @@ -107,8 +107,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { public function formLoginAction() { invalidateHttpCache(); - Minz_View::prependTitle(_t('gen.auth.login') . ' · '); - Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'))); + FreshRSS_View::prependTitle(_t('gen.auth.login') . ' · '); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'))); $limits = FreshRSS_Context::$system_conf->limits; $this->view->cookie_days = round($limits['cookie_duration'] / 86400, 1); @@ -237,6 +237,6 @@ class FreshRSS_auth_Controller extends Minz_ActionController { $this->view->show_tos_checkbox = file_exists(join_path(DATA_PATH, 'tos.html')); $this->view->show_email_field = FreshRSS_Context::$system_conf->force_email_validation; $this->view->preferred_language = Minz_Translate::getLanguage(null, Minz_Request::getPreferredLanguages(), FreshRSS_Context::$system_conf->language); - Minz_View::prependTitle(_t('gen.auth.registration.title') . ' · '); + FreshRSS_View::prependTitle(_t('gen.auth.registration.title') . ' · '); } } diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index e8d8fb546..b8bf97e77 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -70,7 +70,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->themes = FreshRSS_Themes::get(); - Minz_View::prependTitle(_t('conf.display.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.display.title') . ' · '); } /** @@ -134,7 +134,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'reading' ]); } - Minz_View::prependTitle(_t('conf.reading.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.reading.title') . ' · '); } /** @@ -148,8 +148,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * some unwanted behavior when the end-user was using an ad-blocker. */ public function integrationAction() { - Minz_View::appendScript(Minz_Url::display('/scripts/integration.js?' . @filemtime(PUBLIC_PATH . '/scripts/integration.js'))); - Minz_View::appendScript(Minz_Url::display('/scripts/draggable.js?' . @filemtime(PUBLIC_PATH . '/scripts/draggable.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/integration.js?' . @filemtime(PUBLIC_PATH . '/scripts/integration.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/draggable.js?' . @filemtime(PUBLIC_PATH . '/scripts/draggable.js'))); if (Minz_Request::isPost()) { $params = $_POST; @@ -160,7 +160,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'integration' ]); } - Minz_View::prependTitle(_t('conf.sharing.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.sharing.title') . ' · '); } /** @@ -191,7 +191,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.shortcuts_updated'), array('c' => 'configure', 'a' => 'shortcut')); } - Minz_View::prependTitle(_t('conf.shortcut.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.shortcut.title') . ' · '); } /** @@ -264,7 +264,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->size_total = $databaseDAO->size(true); } - Minz_View::prependTitle(_t('conf.archiving.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.archiving.title') . ' · '); } /** @@ -278,7 +278,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * checking if categories and feeds are still in use. */ public function queriesAction() { - Minz_View::appendScript(Minz_Url::display('/scripts/draggable.js?' . @filemtime(PUBLIC_PATH . '/scripts/draggable.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/draggable.js?' . @filemtime(PUBLIC_PATH . '/scripts/draggable.js'))); $category_dao = FreshRSS_Factory::createCategoryDao(); $feed_dao = FreshRSS_Factory::createFeedDao(); @@ -287,6 +287,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { if (Minz_Request::isPost()) { $params = Minz_Request::param('queries', array()); + $queries = []; foreach ($params as $key => $query) { if (!$query['name']) { $query['name'] = _t('conf.query.number', $key + 1); @@ -319,7 +320,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->queryId = $id; } - Minz_View::prependTitle(_t('conf.query.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.query.title') . ' · '); } /** @@ -370,7 +371,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'queries', 'params' => ['id' => $id] ]); } - Minz_View::prependTitle(_t('conf.query.title') . ' · ' . $query->getName() . ' · '); + FreshRSS_View::prependTitle(_t('conf.query.title') . ' · ' . $query->getName() . ' · '); } /** diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 15e4aa3fd..2f5c6594c 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -4,6 +4,13 @@ * Controller to handle every entry actions. */ class FreshRSS_entry_Controller extends Minz_ActionController { + + /** + * JavaScript request or not. + * @var bool + */ + private $ajax = false; + /** * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the @@ -114,7 +121,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { 'c' => 'index', 'a' => 'index', 'params' => $params, - ), true); + )); } } diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php index 325081aed..658cc71af 100644 --- a/app/Controllers/errorController.php +++ b/app/Controllers/errorController.php @@ -63,6 +63,6 @@ class FreshRSS_error_Controller extends Minz_ActionController { $this->view->errorMessage = $error_message; } - Minz_View::prependTitle($this->view->code . ' · '); + FreshRSS_View::prependTitle($this->view->code . ' · '); } } diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index a932954a9..69f52cebf 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -19,7 +19,7 @@ class FreshRSS_extension_Controller extends Minz_ActionController { * This action lists all the extensions available to the current user. */ public function indexAction() { - Minz_View::prependTitle(_t('admin.extensions.title') . ' · '); + FreshRSS_View::prependTitle(_t('admin.extensions.title') . ' · '); $this->view->extension_list = array( 'system' => array(), 'user' => array(), diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index c94b3216a..1f64687de 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -190,19 +190,19 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } catch (FreshRSS_BadUrl_Exception $e) { // Given url was not a valid url! Minz_Log::warning($e->getMessage()); - Minz_Request::bad(_t('feedback.sub.feed.invalid_url', $url), $url_redirect); + return Minz_Request::bad(_t('feedback.sub.feed.invalid_url', $url), $url_redirect); } catch (FreshRSS_Feed_Exception $e) { // Something went bad (timeout, server not found, etc.) Minz_Log::warning($e->getMessage()); - Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); + return Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); } catch (Minz_FileNotExistException $e) { // Cache directory doesn't exist! Minz_Log::error($e->getMessage()); - Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); + return Minz_Request::bad(_t('feedback.sub.feed.internal_problem', _url('index', 'logs')), $url_redirect); } catch (FreshRSS_AlreadySubscribed_Exception $e) { - Minz_Request::bad(_t('feedback.sub.feed.already_subscribed', $e->feedName()), $url_redirect); + return Minz_Request::bad(_t('feedback.sub.feed.already_subscribed', $e->feedName()), $url_redirect); } catch (FreshRSS_FeedNotAdded_Exception $e) { - Minz_Request::bad(_t('feedback.sub.feed.not_added', $e->feedName()), $url_redirect); + return Minz_Request::bad(_t('feedback.sub.feed.not_added', $e->feedName()), $url_redirect); } // Entries are in DB, we redirect to feed configuration page. @@ -211,10 +211,10 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.sub.feed.added', $feed->name()), $url_redirect); } else { // GET request: we must ask confirmation to user before adding feed. - Minz_View::prependTitle(_t('sub.feed.title_add') . ' · '); + FreshRSS_View::prependTitle(_t('sub.feed.title_add') . ' · '); - $this->catDAO = FreshRSS_Factory::createCategoryDao(); - $this->view->categories = $this->catDAO->listCategories(false); + $catDAO = FreshRSS_Factory::createCategoryDao(); + $this->view->categories = $catDAO->listCategories(false); $this->view->feed = new FreshRSS_Feed($url); try { // We try to get more information about the feed. @@ -567,6 +567,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $force = Minz_Request::param('force'); $maxFeeds = (int)Minz_Request::param('maxFeeds'); $noCommit = ($_POST['noCommit'] ?? 0) == 1; + $feed = null; if ($id == -1 && !$noCommit) { //Special request only to commit & refresh DB cache $updated_feeds = 0; diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index f3b898df4..0634bf54c 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -4,6 +4,11 @@ * Controller to handle every import and export actions. */ class FreshRSS_importExport_Controller extends Minz_ActionController { + + private $catDAO; + private $entryDAO; + private $feedDAO; + /** * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the @@ -26,7 +31,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { */ public function indexAction() { $this->view->feeds = $this->feedDAO->listFeeds(); - Minz_View::prependTitle(_t('sub.import_export.title') . ' · '); + FreshRSS_View::prependTitle(_t('sub.import_export.title') . ' · '); } private static function megabytes($size_str) { @@ -504,6 +509,8 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $website = $origin['htmlUrl']; } elseif (!empty($origin['feedUrl'])) { $website = $origin['feedUrl']; + } else { + $website = ''; } $name = empty($origin['title']) ? $website : $origin['title']; diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index ff746f4bf..eadfe252b 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -41,12 +41,12 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->categories = FreshRSS_Context::$categories; - $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . FreshRSS_View::title(); $title = FreshRSS_Context::$name; if (FreshRSS_Context::$get_unread > 0) { $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; } - Minz_View::prependTitle($title . ' · '); + FreshRSS_View::prependTitle($title . ' · '); FreshRSS_Context::$id_max = time() . '000000'; @@ -104,8 +104,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { return; } - Minz_View::appendScript(Minz_Url::display('/scripts/extra.js?' . @filemtime(PUBLIC_PATH . '/scripts/extra.js'))); - Minz_View::appendScript(Minz_Url::display('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/extra.js?' . @filemtime(PUBLIC_PATH . '/scripts/extra.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); try { $this->updateContext(); @@ -115,12 +115,12 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->categories = FreshRSS_Context::$categories; - $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . FreshRSS_View::title(); $title = _t('index.feed.title_global'); if (FreshRSS_Context::$get_unread > 0) { $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; } - Minz_View::prependTitle($title . ' · '); + FreshRSS_View::prependTitle($title . ' · '); $this->_csp([ 'default-src' => "'self'", @@ -161,7 +161,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { // No layout for RSS output. $this->view->url = PUBLIC_TO_INDEX_PATH . '/' . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']); - $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . FreshRSS_View::title(); $this->view->_layout(false); header('Content-Type: application/rss+xml; charset=utf-8'); } @@ -253,7 +253,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { * This action displays the about page of FreshRSS. */ public function aboutAction() { - Minz_View::prependTitle(_t('index.about.title') . ' · '); + FreshRSS_View::prependTitle(_t('index.about.title') . ' · '); } /** @@ -270,7 +270,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->terms_of_service = $terms_of_service; $this->view->can_register = !max_registrations_reached(); - Minz_View::prependTitle(_t('index.tos.title') . ' · '); + FreshRSS_View::prependTitle(_t('index.tos.title') . ' · '); } /** @@ -281,7 +281,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Error::error(403); } - Minz_View::prependTitle(_t('index.log.title') . ' · '); + FreshRSS_View::prependTitle(_t('index.log.title') . ' · '); if (Minz_Request::isPost()) { FreshRSS_LogDAO::truncate(); diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index c9a8cdc0c..980f3532d 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -20,7 +20,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { 'style-src' => "'self' 'unsafe-inline'", ]); - Minz_View::prependTitle(_t('admin.stats.title') . ' · '); + FreshRSS_View::prependTitle(_t('admin.stats.title') . ' · '); } private function convertToSerie($data) { @@ -57,7 +57,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { */ public function indexAction() { $statsDAO = FreshRSS_Factory::createStatsDAO(); - Minz_View::appendScript(Minz_Url::display('/scripts/vendor/chart.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/vendor/chart.min.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/vendor/chart.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/vendor/chart.min.js'))); $this->view->repartition = $statsDAO->calculateEntryRepartition(); @@ -66,6 +66,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $this->view->average = round(array_sum(array_values($entryCount)) / count($entryCount), 2); $feedByCategory_calculated = $statsDAO->calculateFeedByCategory(); + $feedByCategory = []; for ($i = 0; $i < count($feedByCategory_calculated); $i++) { $feedByCategory['label'][$i] = $feedByCategory_calculated[$i]['label']; $feedByCategory['data'][$i] = $feedByCategory_calculated[$i]['data']; @@ -73,6 +74,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $this->view->feedByCategory = $feedByCategory; $entryByCategory_calculated = $statsDAO->calculateEntryByCategory(); + $entryByCategory = []; for ($i = 0; $i < count($entryByCategory_calculated); $i++) { $entryByCategory['label'][$i] = $entryByCategory_calculated[$i]['label']; $entryByCategory['data'][$i] = $entryByCategory_calculated[$i]['data']; @@ -81,6 +83,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $this->view->topFeed = $statsDAO->calculateTopFeed(); + $last30DaysLabels = []; for ($i = 0; $i < 30; $i++) { $last30DaysLabels[$i] = date('d.m.Y', strtotime((-30 + $i) . ' days')); } @@ -178,7 +181,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $categoryDAO = FreshRSS_Factory::createCategoryDao(); $feedDAO = FreshRSS_Factory::createFeedDao(); - Minz_View::appendScript(Minz_Url::display('/scripts/vendor/chart.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/vendor/chart.min.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/vendor/chart.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/vendor/chart.min.js'))); $id = Minz_Request::param('id', null); @@ -198,6 +201,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $this->view->repartitionMonth = $statsDAO->calculateEntryRepartitionPerFeedPerMonth($id); $this->view->averageMonth = $statsDAO->calculateEntryAveragePerFeedPerMonth($id); + $hours24Labels = []; for ($i = 0; $i < 24; $i++) { $hours24Labels[$i] = $i . ':xx'; } diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 5a89d0e08..c01e01843 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -44,8 +44,8 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { * It displays categories and associated feeds. */ public function indexAction() { - Minz_View::appendScript(Minz_Url::display('/scripts/category.js?' . @filemtime(PUBLIC_PATH . '/scripts/category.js'))); - Minz_View::prependTitle(_t('sub.title') . ' · '); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/category.js?' . @filemtime(PUBLIC_PATH . '/scripts/category.js'))); + FreshRSS_View::prependTitle(_t('sub.title') . ' · '); $this->view->onlyFeedsWithError = Minz_Request::paramTernary('error'); @@ -104,7 +104,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $feed = $this->view->feeds[$id]; $this->view->feed = $feed; - Minz_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $feed->name() . ' · '); + FreshRSS_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $feed->name() . ' · '); if (Minz_Request::isPost()) { $user = trim(Minz_Request::param('http_user_feed' . $id, '')); @@ -282,13 +282,13 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { * This action displays the bookmarklet page. */ public function bookmarkletAction() { - Minz_View::prependTitle(_t('sub.title.subscription_tools') . ' . '); + FreshRSS_View::prependTitle(_t('sub.title.subscription_tools') . ' . '); } /** * This action displays the page to add a new feed */ public function addAction() { - Minz_View::prependTitle(_t('sub.title.add') . ' . '); + FreshRSS_View::prependTitle(_t('sub.title.add') . ' . '); } } diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php index 0a57c0df2..077be9700 100644 --- a/app/Controllers/tagController.php +++ b/app/Controllers/tagController.php @@ -4,6 +4,13 @@ * Controller to handle every tag actions. */ class FreshRSS_tag_Controller extends Minz_ActionController { + + /** + * JavaScript request or not. + * @var bool + */ + private $ajax = false; + /** * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the @@ -92,10 +99,10 @@ class FreshRSS_tag_Controller extends Minz_ActionController { $tagDAO = FreshRSS_Factory::createTagDao(); if (strlen($name) > 0 && null === $tagDAO->searchByName($name)) { $tagDAO->addTag(['name' => $name]); - Minz_Request::good(_t('feedback.tag.created', $name), ['c' => 'tag', 'a' => 'index'], true); + Minz_Request::good(_t('feedback.tag.created', $name), ['c' => 'tag', 'a' => 'index']); } - Minz_Request::bad(_t('feedback.tag.name_exists', $name), ['c' => 'tag', 'a' => 'index'], true); + Minz_Request::bad(_t('feedback.tag.name_exists', $name), ['c' => 'tag', 'a' => 'index']); } public function renameAction() { @@ -123,7 +130,7 @@ class FreshRSS_tag_Controller extends Minz_ActionController { $tagDAO->deleteTag($sourceId); } - Minz_Request::good(_t('feedback.tag.renamed', $sourceName, $targetName), ['c' => 'tag', 'a' => 'index'], true); + Minz_Request::good(_t('feedback.tag.renamed', $sourceName, $targetName), ['c' => 'tag', 'a' => 'index']); } public function indexAction() { diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 862fb0cf9..16ab7e427 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -108,7 +108,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { } public function indexAction() { - Minz_View::prependTitle(_t('admin.update.title') . ' · '); + FreshRSS_View::prependTitle(_t('admin.update.title') . ' · '); if (file_exists(UPDATE_FILENAME)) { // There is an update file to apply! @@ -224,6 +224,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { $res = !self::hasGitUpdate(); } else { require(UPDATE_FILENAME); + // @phpstan-ignore-next-line $res = do_post_update(); } @@ -244,9 +245,12 @@ class FreshRSS_update_Controller extends Minz_ActionController { } else { require(UPDATE_FILENAME); if (Minz_Request::isPost()) { + // @phpstan-ignore-next-line save_info_update(); } + // @phpstan-ignore-next-line if (!need_info_update()) { + // @phpstan-ignore-next-line $res = apply_update(); } else { return; @@ -269,7 +273,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { * This action displays information about installation. */ public function checkInstallAction() { - Minz_View::prependTitle(_t('admin.check_install.title') . ' · '); + FreshRSS_View::prependTitle(_t('admin.check_install.title') . ' · '); $this->view->status_php = check_install_php(); $this->view->status_files = check_install_files(); diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 81f8b20a8..b1f34ce61 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -95,9 +95,9 @@ class FreshRSS_user_Controller extends Minz_ActionController { $this->view->disable_aside = true; } - Minz_View::prependTitle(_t('conf.profile.title') . ' · '); + FreshRSS_View::prependTitle(_t('conf.profile.title') . ' · '); - Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'))); + FreshRSS_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'))); if (Minz_Request::isPost()) { $system_conf = FreshRSS_Context::$system_conf; @@ -173,7 +173,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Error::error(403); } - Minz_View::prependTitle(_t('admin.user.title') . ' · '); + FreshRSS_View::prependTitle(_t('admin.user.title') . ' · '); if (Minz_Request::isPost()) { $action = Minz_Request::param('action'); @@ -227,6 +227,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { $ok = self::checkUsername($new_user_name); $homeDir = join_path(DATA_PATH, 'users', $new_user_name); + $configPath = ''; if ($ok) { $languages = Minz_Translate::availableLanguages(); @@ -418,7 +419,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Error::error(404); } - Minz_View::prependTitle(_t('user.email.validation.title') . ' · '); + FreshRSS_View::prependTitle(_t('user.email.validation.title') . ' · '); $this->view->_layout('simple'); $username = Minz_Request::param('username'); @@ -429,11 +430,11 @@ class FreshRSS_user_Controller extends Minz_ActionController { } elseif (FreshRSS_Auth::hasAccess()) { $user_config = FreshRSS_Context::$user_conf; } else { - Minz_Error::error(403); + return Minz_Error::error(403); } if (!FreshRSS_UserDAO::exists($username) || $user_config === null) { - Minz_Error::error(404); + return Minz_Error::error(404); } if ($user_config->email_validation_token === '') { -- cgit v1.2.3