aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-11-16 22:43:00 +0100
committerGravatar GitHub <noreply@github.com> 2023-11-16 22:43:00 +0100
commit30c7a61a9b410f023c56ef19b9389a61647d8768 (patch)
treebb58408980ce5b86f1d2b4a9be29d55b2d46dbb1
parentee99e7e2cc228500efc1b539954c0ca6cd4c146d (diff)
Use strict_types (#5830)
* Little's optimisations and booleans in conditions * Apply strict type * Apply strict type * Apply strict type * Fix multiple bugs with PHP 8.2 and 8.3 * Many declares missing, more errors fixed * Apply strict type * Another approach * Stronger typing for Minz_Session * Fix case of SQLite --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
-rw-r--r--app/Controllers/apiController.php1
-rw-r--r--app/Controllers/authController.php5
-rw-r--r--app/Controllers/categoryController.php1
-rw-r--r--app/Controllers/configureController.php1
-rw-r--r--app/Controllers/entryController.php1
-rw-r--r--app/Controllers/errorController.php6
-rw-r--r--app/Controllers/extensionController.php1
-rw-r--r--app/Controllers/feedController.php1
-rw-r--r--app/Controllers/importExportController.php1
-rw-r--r--app/Controllers/indexController.php1
-rw-r--r--app/Controllers/javascriptController.php1
-rw-r--r--app/Controllers/statsController.php1
-rw-r--r--app/Controllers/subscriptionController.php1
-rw-r--r--app/Controllers/tagController.php1
-rw-r--r--app/Controllers/updateController.php1
-rw-r--r--app/Controllers/userController.php3
-rw-r--r--app/Exceptions/AlreadySubscribedException.php1
-rw-r--r--app/Exceptions/BadUrlException.php1
-rw-r--r--app/Exceptions/ContextException.php2
-rw-r--r--app/Exceptions/DAOException.php1
-rw-r--r--app/Exceptions/EntriesGetterException.php1
-rw-r--r--app/Exceptions/FeedException.php1
-rw-r--r--app/Exceptions/FeedNotAddedException.php1
-rw-r--r--app/Exceptions/ZipException.php1
-rw-r--r--app/Exceptions/ZipMissingException.php1
-rw-r--r--app/FreshRSS.php1
-rw-r--r--app/Mailers/UserMailer.php1
-rw-r--r--app/Models/ActionController.php1
-rw-r--r--app/Models/Auth.php9
-rw-r--r--app/Models/BooleanSearch.php5
-rw-r--r--app/Models/Category.php1
-rw-r--r--app/Models/CategoryDAO.php1
-rw-r--r--app/Models/CategoryDAOSQLite.php1
-rw-r--r--app/Models/Context.php1
-rw-r--r--app/Models/DatabaseDAO.php1
-rw-r--r--app/Models/DatabaseDAOPGSQL.php1
-rw-r--r--app/Models/DatabaseDAOSQLite.php1
-rw-r--r--app/Models/Days.php1
-rw-r--r--app/Models/Entry.php11
-rw-r--r--app/Models/EntryDAO.php1
-rw-r--r--app/Models/EntryDAOPGSQL.php1
-rw-r--r--app/Models/EntryDAOSQLite.php1
-rw-r--r--app/Models/Factory.php1
-rw-r--r--app/Models/Feed.php1
-rw-r--r--app/Models/FeedDAO.php1
-rw-r--r--app/Models/FeedDAOSQLite.php1
-rw-r--r--app/Models/FilterAction.php1
-rw-r--r--app/Models/FormAuth.php1
-rw-r--r--app/Models/Log.php1
-rw-r--r--app/Models/LogDAO.php1
-rw-r--r--app/Models/ReadingMode.php1
-rw-r--r--app/Models/Search.php1
-rw-r--r--app/Models/Share.php1
-rw-r--r--app/Models/StatsDAO.php1
-rw-r--r--app/Models/StatsDAOPGSQL.php1
-rw-r--r--app/Models/StatsDAOSQLite.php1
-rw-r--r--app/Models/SystemConfiguration.php1
-rw-r--r--app/Models/Tag.php1
-rw-r--r--app/Models/TagDAO.php1
-rw-r--r--app/Models/TagDAOPGSQL.php1
-rw-r--r--app/Models/TagDAOSQLite.php1
-rw-r--r--app/Models/Themes.php1
-rw-r--r--app/Models/UserConfiguration.php1
-rw-r--r--app/Models/UserDAO.php1
-rw-r--r--app/Models/UserQuery.php1
-rw-r--r--app/Models/View.php1
-rw-r--r--app/Models/ViewJavascript.php1
-rw-r--r--app/Models/ViewStats.php1
-rw-r--r--app/Services/ExportService.php1
-rw-r--r--app/Services/ImportService.php1
-rw-r--r--app/Utils/feverUtil.php1
-rw-r--r--app/Utils/passwordUtil.php1
-rwxr-xr-xapp/actualize_script.php1
-rw-r--r--app/install.php54
-rw-r--r--app/layout/aside_configure.phtml21
-rw-r--r--app/layout/aside_feed.phtml1
-rw-r--r--app/layout/aside_subscription.phtml3
-rw-r--r--app/layout/header.phtml5
-rw-r--r--app/layout/layout.phtml1
-rw-r--r--app/layout/nav_entries.phtml3
-rw-r--r--app/layout/nav_menu.phtml8
-rw-r--r--app/layout/simple.phtml1
-rw-r--r--app/shares.php1
-rw-r--r--app/views/auth/formLogin.phtml5
-rw-r--r--app/views/auth/index.phtml2
-rw-r--r--app/views/auth/register.phtml5
-rw-r--r--app/views/configure/archiving.phtml2
-rw-r--r--app/views/configure/display.phtml2
-rw-r--r--app/views/configure/integration.phtml10
-rw-r--r--app/views/configure/queries.phtml4
-rw-r--r--app/views/configure/query.phtml1
-rw-r--r--app/views/configure/reading.phtml2
-rw-r--r--app/views/configure/shortcut.phtml2
-rw-r--r--app/views/configure/system.phtml2
-rw-r--r--app/views/entry/bookmark.phtml4
-rw-r--r--app/views/entry/read.phtml1
-rw-r--r--app/views/error/index.phtml5
-rw-r--r--app/views/extension/configure.phtml1
-rw-r--r--app/views/extension/index.phtml2
-rw-r--r--app/views/feed/add.phtml7
-rw-r--r--app/views/feed/contentSelectorPreview.phtml1
-rw-r--r--app/views/helpers/category/update.phtml5
-rw-r--r--app/views/helpers/configure/query.phtml7
-rw-r--r--app/views/helpers/export/articles.phtml1
-rw-r--r--app/views/helpers/export/opml.phtml1
-rw-r--r--app/views/helpers/extension/configure.phtml1
-rw-r--r--app/views/helpers/extension/details.phtml5
-rw-r--r--app/views/helpers/feed/update.phtml5
-rw-r--r--app/views/helpers/index/normal/entry_bottom.phtml1
-rw-r--r--app/views/helpers/index/normal/entry_header.phtml1
-rw-r--r--app/views/helpers/javascript_vars.phtml3
-rw-r--r--app/views/helpers/logs_pagination.phtml2
-rw-r--r--app/views/helpers/stream-footer.phtml10
-rw-r--r--app/views/importExport/export.phtml6
-rw-r--r--app/views/importExport/index.phtml2
-rw-r--r--app/views/index/about.phtml2
-rw-r--r--app/views/index/global.phtml2
-rw-r--r--app/views/index/logs.phtml7
-rw-r--r--app/views/index/normal.phtml1
-rw-r--r--app/views/index/opml.phtml1
-rw-r--r--app/views/index/reader.phtml1
-rw-r--r--app/views/index/rss.phtml5
-rw-r--r--app/views/index/tos.phtml2
-rw-r--r--app/views/javascript/actualize.phtml1
-rw-r--r--app/views/javascript/nbUnreadsPerFeed.phtml1
-rw-r--r--app/views/javascript/nonce.phtml1
-rw-r--r--app/views/stats/idle.phtml2
-rw-r--r--app/views/stats/index.phtml2
-rw-r--r--app/views/stats/repartition.phtml2
-rw-r--r--app/views/subscription/add.phtml2
-rw-r--r--app/views/subscription/bookmarklet.phtml2
-rw-r--r--app/views/subscription/category.phtml1
-rw-r--r--app/views/subscription/feed.phtml1
-rw-r--r--app/views/subscription/index.phtml2
-rw-r--r--app/views/tag/getTagsForEntry.phtml3
-rw-r--r--app/views/tag/index.phtml2
-rw-r--r--app/views/update/apply.phtml2
-rw-r--r--app/views/update/checkInstall.phtml2
-rw-r--r--app/views/update/index.phtml2
-rw-r--r--app/views/user/details.phtml9
-rw-r--r--app/views/user/manage.phtml2
-rw-r--r--app/views/user/profile.phtml3
-rw-r--r--app/views/user/validateEmail.phtml5
-rw-r--r--app/views/user_mailer/email_need_validation.txt.php5
-rw-r--r--cli/_cli.php2
-rw-r--r--cli/_update-or-create-user.php1
-rwxr-xr-xcli/actualize-user.php1
-rwxr-xr-xcli/check.translation.php2
-rwxr-xr-xcli/create-user.php2
-rwxr-xr-xcli/db-optimize.php1
-rwxr-xr-xcli/delete-user.php1
-rwxr-xr-xcli/do-install.php1
-rwxr-xr-xcli/export-opml-for-user.php1
-rwxr-xr-xcli/export-sqlite-for-user.php1
-rwxr-xr-xcli/export-zip-for-user.php1
-rw-r--r--cli/i18n/I18nCompletionValidator.php1
-rw-r--r--cli/i18n/I18nData.php1
-rw-r--r--cli/i18n/I18nFile.php11
-rw-r--r--cli/i18n/I18nUsageValidator.php5
-rw-r--r--cli/i18n/I18nValidatorInterface.php1
-rw-r--r--cli/i18n/I18nValue.php7
-rwxr-xr-xcli/import-for-user.php1
-rwxr-xr-xcli/import-sqlite-for-user.php1
-rwxr-xr-xcli/list-users.php1
-rwxr-xr-xcli/manipulate.translation.php2
-rwxr-xr-xcli/prepare.php1
-rwxr-xr-xcli/reconfigure.php1
-rwxr-xr-xcli/update-user.php2
-rwxr-xr-xcli/user-info.php1
-rw-r--r--constants.php1
-rw-r--r--index.php2
-rw-r--r--lib/Minz/ActionController.php2
-rw-r--r--lib/Minz/ActionException.php2
-rw-r--r--lib/Minz/Configuration.php1
-rw-r--r--lib/Minz/ConfigurationException.php2
-rw-r--r--lib/Minz/ConfigurationNamespaceException.php1
-rw-r--r--lib/Minz/ConfigurationParamException.php1
-rw-r--r--lib/Minz/ConfigurationSetterInterface.php1
-rw-r--r--lib/Minz/ControllerNotActionControllerException.php2
-rw-r--r--lib/Minz/ControllerNotExistException.php2
-rw-r--r--lib/Minz/CurrentPagePaginationException.php2
-rw-r--r--lib/Minz/Dispatcher.php2
-rw-r--r--lib/Minz/Error.php2
-rw-r--r--lib/Minz/Exception.php2
-rw-r--r--lib/Minz/Extension.php1
-rw-r--r--lib/Minz/ExtensionException.php1
-rw-r--r--lib/Minz/ExtensionManager.php1
-rw-r--r--lib/Minz/FileNotExistException.php2
-rw-r--r--lib/Minz/FrontController.php2
-rw-r--r--lib/Minz/Helper.php2
-rw-r--r--lib/Minz/Log.php2
-rw-r--r--lib/Minz/Mailer.php1
-rw-r--r--lib/Minz/Migrator.php1
-rw-r--r--lib/Minz/Model.php2
-rw-r--r--lib/Minz/ModelArray.php2
-rw-r--r--lib/Minz/ModelPdo.php3
-rw-r--r--lib/Minz/PDOConnectionException.php2
-rw-r--r--lib/Minz/Paginator.php2
-rw-r--r--lib/Minz/Pdo.php1
-rw-r--r--lib/Minz/PdoMysql.php1
-rw-r--r--lib/Minz/PdoPgsql.php1
-rw-r--r--lib/Minz/PdoSqlite.php1
-rw-r--r--lib/Minz/PermissionDeniedException.php2
-rw-r--r--lib/Minz/Request.php13
-rw-r--r--lib/Minz/Session.php52
-rw-r--r--lib/Minz/Translate.php2
-rw-r--r--lib/Minz/Url.php1
-rw-r--r--lib/Minz/User.php3
-rw-r--r--lib/Minz/View.php2
-rw-r--r--lib/SimplePie/SimplePie/IRI.php6
-rw-r--r--lib/favicons.php8
-rw-r--r--lib/http-conditional.php2
-rw-r--r--lib/lib_date.php2
-rw-r--r--lib/lib_install.php1
-rw-r--r--lib/lib_rss.php2
-rw-r--r--p/api/fever.php2
-rw-r--r--p/api/greader.php2
-rw-r--r--p/api/index.php5
-rw-r--r--p/api/pshb.php1
-rw-r--r--p/ext.php2
-rw-r--r--p/f.php1
-rw-r--r--p/i/index.php2
-rw-r--r--p/index.php1
-rw-r--r--tests/app/Models/CategoryTest.php1
-rw-r--r--tests/app/Models/SearchTest.php2
-rw-r--r--tests/app/Models/UserQueryTest.php1
-rw-r--r--tests/app/Utils/passwordUtilTest.php1
-rw-r--r--tests/bootstrap.php2
-rw-r--r--tests/cli/i18n/I18nCompletionValidatorTest.php2
-rw-r--r--tests/cli/i18n/I18nDataTest.php2
-rw-r--r--tests/cli/i18n/I18nFileTest.php2
-rw-r--r--tests/cli/i18n/I18nUsageValidatorTest.php2
-rw-r--r--tests/cli/i18n/I18nValueTest.php2
-rw-r--r--tests/fixtures/migrations/2019_12_22_FooBar.php1
-rw-r--r--tests/fixtures/migrations/2019_12_23_Baz.php1
-rw-r--r--tests/fixtures/migrations_with_failing/2020_01_11_FooBar.php1
-rw-r--r--tests/fixtures/migrations_with_failing/2020_01_12_Baz.php1
-rw-r--r--tests/lib/CssXPath/CssXPathTest.php1
-rw-r--r--tests/lib/Minz/MigratorTest.php2
-rw-r--r--tests/lib/PHPMailer/PHPMailerTest.php1
240 files changed, 462 insertions, 164 deletions
diff --git a/app/Controllers/apiController.php b/app/Controllers/apiController.php
index 52ec53045..7568f9831 100644
--- a/app/Controllers/apiController.php
+++ b/app/Controllers/apiController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This controller manage API-related features.
diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php
index 90c9a9e03..73a640748 100644
--- a/app/Controllers/authController.php
+++ b/app/Controllers/authController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This controller handles action about authentication.
@@ -116,11 +117,11 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
$limits = FreshRSS_Context::$system_conf->limits;
$this->view->cookie_days = (int)round($limits['cookie_duration'] / 86400, 1);
- $isPOST = Minz_Request::isPost() && !Minz_Session::param('POST_to_GET');
+ $isPOST = Minz_Request::isPost() && !Minz_Session::paramBoolean('POST_to_GET');
Minz_Session::_param('POST_to_GET');
if ($isPOST) {
- $nonce = Minz_Session::param('nonce', '');
+ $nonce = Minz_Session::paramString('nonce');
$username = Minz_Request::paramString('username');
$challenge = Minz_Request::paramString('challenge');
diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php
index 630399bf4..de6399e27 100644
--- a/app/Controllers/categoryController.php
+++ b/app/Controllers/categoryController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle actions relative to categories.
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index dab653ac9..ffba5186f 100644
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every configuration options.
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
index b62214970..1ce490ea1 100644
--- a/app/Controllers/entryController.php
+++ b/app/Controllers/entryController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every entry actions.
diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php
index fe56b13eb..c3e832cf8 100644
--- a/app/Controllers/errorController.php
+++ b/app/Controllers/errorController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle error page.
@@ -14,8 +15,9 @@ class FreshRSS_error_Controller extends FreshRSS_ActionController {
* - error_logs (default: array())
*/
public function indexAction(): void {
- $code_int = Minz_Session::param('error_code', 404);
- $error_logs = Minz_Session::param('error_logs', []);
+ $code_int = Minz_Session::paramInt('error_code') ?: 404;
+ /** @var array<string> */
+ $error_logs = Minz_Session::paramArray('error_logs');
Minz_Session::_params([
'error_code' => false,
'error_logs' => false,
diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php
index e93ec778f..0158b2f76 100644
--- a/app/Controllers/extensionController.php
+++ b/app/Controllers/extensionController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The controller to manage extensions.
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index a9cb51416..933f82216 100644
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every feed actions.
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index 8f611bc78..6d37cc465 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every import and export actions.
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index cad2e9f85..a1c25e649 100644
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This class handles main actions of FreshRSS.
diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php
index eea8fc233..5d402fa67 100644
--- a/app/Controllers/javascriptController.php
+++ b/app/Controllers/javascriptController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_javascript_Controller extends FreshRSS_ActionController {
diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php
index bb99bc601..6e6a2720f 100644
--- a/app/Controllers/statsController.php
+++ b/app/Controllers/statsController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle application statistics.
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php
index 86083ceb0..5566224ef 100644
--- a/app/Controllers/subscriptionController.php
+++ b/app/Controllers/subscriptionController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle subscription actions.
diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php
index 1a7c81841..13909d522 100644
--- a/app/Controllers/tagController.php
+++ b/app/Controllers/tagController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle every tag actions.
diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php
index 6d9249771..43860a50c 100644
--- a/app/Controllers/updateController.php
+++ b/app/Controllers/updateController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_update_Controller extends FreshRSS_ActionController {
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index aa5682e26..6766182c1 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Controller to handle user actions.
@@ -536,7 +537,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController {
$ok = true;
if ($self_deletion) {
// We check the password if it’s a self-destruction
- $nonce = Minz_Session::param('nonce', '');
+ $nonce = Minz_Session::paramString('nonce');
$challenge = Minz_Request::paramString('challenge');
$ok &= FreshRSS_FormAuth::checkCredentials(
diff --git a/app/Exceptions/AlreadySubscribedException.php b/app/Exceptions/AlreadySubscribedException.php
index 410784451..3802e7d65 100644
--- a/app/Exceptions/AlreadySubscribedException.php
+++ b/app/Exceptions/AlreadySubscribedException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_AlreadySubscribed_Exception extends Exception {
diff --git a/app/Exceptions/BadUrlException.php b/app/Exceptions/BadUrlException.php
index 748a619d6..d308d4791 100644
--- a/app/Exceptions/BadUrlException.php
+++ b/app/Exceptions/BadUrlException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_BadUrl_Exception extends FreshRSS_Feed_Exception {
diff --git a/app/Exceptions/ContextException.php b/app/Exceptions/ContextException.php
index d2d29abc0..5d06baf35 100644
--- a/app/Exceptions/ContextException.php
+++ b/app/Exceptions/ContextException.php
@@ -1,6 +1,6 @@
<?php
-
declare(strict_types=1);
+
/**
* An exception raised when a context is invalid
*/
diff --git a/app/Exceptions/DAOException.php b/app/Exceptions/DAOException.php
index 71ed371f8..3f689f318 100644
--- a/app/Exceptions/DAOException.php
+++ b/app/Exceptions/DAOException.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_DAO_Exception extends Exception {
diff --git a/app/Exceptions/EntriesGetterException.php b/app/Exceptions/EntriesGetterException.php
index d145a0ed5..a9f29e034 100644
--- a/app/Exceptions/EntriesGetterException.php
+++ b/app/Exceptions/EntriesGetterException.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_EntriesGetter_Exception extends Exception {
diff --git a/app/Exceptions/FeedException.php b/app/Exceptions/FeedException.php
index 49843f3ed..343aca5d6 100644
--- a/app/Exceptions/FeedException.php
+++ b/app/Exceptions/FeedException.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_Feed_Exception extends Exception {
diff --git a/app/Exceptions/FeedNotAddedException.php b/app/Exceptions/FeedNotAddedException.php
index 4676c8eb3..921cd985b 100644
--- a/app/Exceptions/FeedNotAddedException.php
+++ b/app/Exceptions/FeedNotAddedException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_FeedNotAdded_Exception extends Exception {
diff --git a/app/Exceptions/ZipException.php b/app/Exceptions/ZipException.php
index d02cc1aea..a0664f913 100644
--- a/app/Exceptions/ZipException.php
+++ b/app/Exceptions/ZipException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Zip_Exception extends Exception {
diff --git a/app/Exceptions/ZipMissingException.php b/app/Exceptions/ZipMissingException.php
index 5b4791b1b..c33c1bcb8 100644
--- a/app/Exceptions/ZipMissingException.php
+++ b/app/Exceptions/ZipMissingException.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_ZipMissing_Exception extends Exception {
diff --git a/app/FreshRSS.php b/app/FreshRSS.php
index c4f06f63f..c4eaaec1b 100644
--- a/app/FreshRSS.php
+++ b/app/FreshRSS.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS extends Minz_FrontController {
/**
diff --git a/app/Mailers/UserMailer.php b/app/Mailers/UserMailer.php
index ad634290d..6e54caa4b 100644
--- a/app/Mailers/UserMailer.php
+++ b/app/Mailers/UserMailer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Manage the emails sent to the users.
diff --git a/app/Models/ActionController.php b/app/Models/ActionController.php
index 1a46cff36..a840ccc6d 100644
--- a/app/Models/ActionController.php
+++ b/app/Models/ActionController.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_ActionController extends Minz_ActionController {
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index 205b428a2..e5f7fc0b9 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This class handles all authentication process.
@@ -20,7 +21,7 @@ class FreshRSS_Auth {
self::removeAccess();
}
- self::$login_ok = Minz_Session::param('loginOk', false);
+ self::$login_ok = Minz_Session::paramBoolean('loginOk');
$current_user = Minz_User::name();
if ($current_user === null) {
$current_user = FreshRSS_Context::$system_conf->default_user;
@@ -109,7 +110,7 @@ class FreshRSS_Auth {
switch (FreshRSS_Context::$system_conf->auth_type) {
case 'form':
- self::$login_ok = Minz_Session::param('passwordHash') === FreshRSS_Context::$user_conf->passwordHash;
+ self::$login_ok = Minz_Session::paramString('passwordHash') === FreshRSS_Context::$user_conf->passwordHash;
break;
case 'http_auth':
$current_user = Minz_User::name();
@@ -212,7 +213,7 @@ class FreshRSS_Auth {
}
public static function csrfToken(): string {
- $csrf = Minz_Session::param('csrf');
+ $csrf = Minz_Session::paramString('csrf');
if ($csrf == '') {
$salt = FreshRSS_Context::$system_conf->salt;
$csrf = sha1($salt . uniqid('' . random_int(0, mt_getrandmax()), true));
@@ -222,7 +223,7 @@ class FreshRSS_Auth {
}
public static function isCsrfOk(?string $token = null): bool {
- $csrf = Minz_Session::param('csrf');
+ $csrf = Minz_Session::paramString('csrf');
if ($token === null) {
$token = $_POST['_csrf'] ?? '';
}
diff --git a/app/Models/BooleanSearch.php b/app/Models/BooleanSearch.php
index d8c47c878..8a750a713 100644
--- a/app/Models/BooleanSearch.php
+++ b/app/Models/BooleanSearch.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Contains Boolean search from the search form.
@@ -67,7 +68,7 @@ class FreshRSS_BooleanSearch {
$name = trim($matches['search'][$i]);
if (!empty($queries[$name])) {
$fromS[] = $matches[0][$i];
- $toS[] = '(' . trim($queries[$name]->getSearch()) . ')';
+ $toS[] = '(' . trim($queries[$name]->getSearch()->getRawInput()) . ')';
}
}
}
@@ -110,7 +111,7 @@ class FreshRSS_BooleanSearch {
$id = (int)(trim($matches['search'][$i])) - 1;
if (!empty($queries[$id])) {
$fromS[] = $matches[0][$i];
- $toS[] = '(' . trim($queries[$id]->getSearch()) . ')';
+ $toS[] = '(' . trim($queries[$id]->getSearch()->getRawInput()) . ')';
}
}
}
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 370c49709..ab08a5b74 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Category extends Minz_Model {
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index 72971f44b..5dfecb36d 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_CategoryDAO extends Minz_ModelPdo {
diff --git a/app/Models/CategoryDAOSQLite.php b/app/Models/CategoryDAOSQLite.php
index ee6d5b7ad..268d579b1 100644
--- a/app/Models/CategoryDAOSQLite.php
+++ b/app/Models/CategoryDAOSQLite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_CategoryDAOSQLite extends FreshRSS_CategoryDAO {
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 9fac52d44..ac5547aa1 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The context object handles the current configuration file and different
diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php
index 1f31f161a..89327d6c9 100644
--- a/app/Models/DatabaseDAO.php
+++ b/app/Models/DatabaseDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This class is used to test database is well-constructed.
diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php
index 7976d5e14..4a92dd184 100644
--- a/app/Models/DatabaseDAOPGSQL.php
+++ b/app/Models/DatabaseDAOPGSQL.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This class is used to test database is well-constructed.
diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php
index 261932867..787380637 100644
--- a/app/Models/DatabaseDAOSQLite.php
+++ b/app/Models/DatabaseDAOSQLite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* This class is used to test database is well-constructed (SQLite).
diff --git a/app/Models/Days.php b/app/Models/Days.php
index d3f1ba075..c445c6355 100644
--- a/app/Models/Days.php
+++ b/app/Models/Days.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_Days {
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index 249f607ee..e19a637d7 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Entry extends Minz_Model {
public const STATE_READ = 1;
@@ -437,7 +438,11 @@ HTML;
return $this->hash;
}
- public function _id(string $value): void {
+ /** @param int|string $value String is for compatibility with 32-bit platforms */
+ public function _id($value): void {
+ if (is_int($value)) {
+ $value = (string)$value;
+ }
$this->id = $value;
if ($this->date_added == 0) {
$this->date_added = $value;
@@ -741,11 +746,11 @@ HTML;
}
$content = '';
- $nodes = $xpath->query(new Gt\CssXPath\Translator($path));
+ $nodes = $xpath->query((new Gt\CssXPath\Translator($path))->asXPath());
if ($nodes != false) {
foreach ($nodes as $node) {
if (!empty($attributes['path_entries_filter'])) {
- $filterednodes = $xpath->query(new Gt\CssXPath\Translator($attributes['path_entries_filter']), $node) ?: [];
+ $filterednodes = $xpath->query((new Gt\CssXPath\Translator($attributes['path_entries_filter']))->asXPath(), $node) ?: [];
foreach ($filterednodes as $filterednode) {
$filterednode->parentNode->removeChild($filterednode);
}
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index f2711d448..403f4e493 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_EntryDAO extends Minz_ModelPdo {
diff --git a/app/Models/EntryDAOPGSQL.php b/app/Models/EntryDAOPGSQL.php
index 0e8ffa463..39e86384d 100644
--- a/app/Models/EntryDAOPGSQL.php
+++ b/app/Models/EntryDAOPGSQL.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_EntryDAOPGSQL extends FreshRSS_EntryDAOSQLite {
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index 136f6d550..66feb567b 100644
--- a/app/Models/EntryDAOSQLite.php
+++ b/app/Models/EntryDAOSQLite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO {
diff --git a/app/Models/Factory.php b/app/Models/Factory.php
index d06c3c63d..eef3c81f5 100644
--- a/app/Models/Factory.php
+++ b/app/Models/Factory.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Factory {
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index 38c6ca37e..d94763e6e 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Feed extends Minz_Model {
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index ef9db1e01..42a4e77f1 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_FeedDAO extends Minz_ModelPdo {
diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.php
index 32d5bd0d2..c6bf9c8ae 100644
--- a/app/Models/FeedDAOSQLite.php
+++ b/app/Models/FeedDAOSQLite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO {
diff --git a/app/Models/FilterAction.php b/app/Models/FilterAction.php
index bd8b12a7a..6487d5100 100644
--- a/app/Models/FilterAction.php
+++ b/app/Models/FilterAction.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_FilterAction {
diff --git a/app/Models/FormAuth.php b/app/Models/FormAuth.php
index c19856c37..83fb60e3c 100644
--- a/app/Models/FormAuth.php
+++ b/app/Models/FormAuth.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_FormAuth {
public static function checkCredentials(string $username, string $hash, string $nonce, string $challenge): bool {
diff --git a/app/Models/Log.php b/app/Models/Log.php
index c3f4bb244..7760e76ca 100644
--- a/app/Models/Log.php
+++ b/app/Models/Log.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_Log extends Minz_Model {
diff --git a/app/Models/LogDAO.php b/app/Models/LogDAO.php
index 080af54ea..9d271455e 100644
--- a/app/Models/LogDAO.php
+++ b/app/Models/LogDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
final class FreshRSS_LogDAO {
public static function logPath(?string $logFileName = null): string {
diff --git a/app/Models/ReadingMode.php b/app/Models/ReadingMode.php
index 51ff26fd5..c8ebe66f3 100644
--- a/app/Models/ReadingMode.php
+++ b/app/Models/ReadingMode.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Manage the reading modes in FreshRSS.
diff --git a/app/Models/Search.php b/app/Models/Search.php
index 56f8d3834..d5dd701c3 100644
--- a/app/Models/Search.php
+++ b/app/Models/Search.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require_once(LIB_PATH . '/lib_date.php');
diff --git a/app/Models/Share.php b/app/Models/Share.php
index b0665a07c..57177c78c 100644
--- a/app/Models/Share.php
+++ b/app/Models/Share.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Manage the sharing options in FreshRSS.
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index 122ca14a8..2cef6c183 100644
--- a/app/Models/StatsDAO.php
+++ b/app/Models/StatsDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_StatsDAO extends Minz_ModelPdo {
diff --git a/app/Models/StatsDAOPGSQL.php b/app/Models/StatsDAOPGSQL.php
index 6e0e04c60..5204b04e3 100644
--- a/app/Models/StatsDAOPGSQL.php
+++ b/app/Models/StatsDAOPGSQL.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_StatsDAOPGSQL extends FreshRSS_StatsDAO {
diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php
index 7d5be10c0..2aa86f0da 100644
--- a/app/Models/StatsDAOSQLite.php
+++ b/app/Models/StatsDAOSQLite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_StatsDAOSQLite extends FreshRSS_StatsDAO {
diff --git a/app/Models/SystemConfiguration.php b/app/Models/SystemConfiguration.php
index bf5bed0d7..294ca1e3a 100644
--- a/app/Models/SystemConfiguration.php
+++ b/app/Models/SystemConfiguration.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
/**
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index 920422ac8..0e50763d0 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Tag extends Minz_Model {
diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php
index a89c04695..bd52223a8 100644
--- a/app/Models/TagDAO.php
+++ b/app/Models/TagDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_TagDAO extends Minz_ModelPdo {
diff --git a/app/Models/TagDAOPGSQL.php b/app/Models/TagDAOPGSQL.php
index 1b8bb7784..de3b20f92 100644
--- a/app/Models/TagDAOPGSQL.php
+++ b/app/Models/TagDAOPGSQL.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
class FreshRSS_TagDAOPGSQL extends FreshRSS_TagDAO {
diff --git a/app/Models/TagDAOSQLite.php b/app/Models/TagDAOSQLite.php
index f1921c9f0..efa52807a 100644
--- a/app/Models/TagDAOSQLite.php
+++ b/app/Models/TagDAOSQLite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_TagDAOSQLite extends FreshRSS_TagDAO {
diff --git a/app/Models/Themes.php b/app/Models/Themes.php
index 902d3c94b..53ae1dc27 100644
--- a/app/Models/Themes.php
+++ b/app/Models/Themes.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Themes extends Minz_Model {
diff --git a/app/Models/UserConfiguration.php b/app/Models/UserConfiguration.php
index 1eceaab99..05e36aae6 100644
--- a/app/Models/UserConfiguration.php
+++ b/app/Models/UserConfiguration.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
/**
diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php
index 0961da82e..1f85b5fe9 100644
--- a/app/Models/UserDAO.php
+++ b/app/Models/UserDAO.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_UserDAO extends Minz_ModelPdo {
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php
index 3454ede31..85df49f1c 100644
--- a/app/Models/UserQuery.php
+++ b/app/Models/UserQuery.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Contains the description of a user query
diff --git a/app/Models/View.php b/app/Models/View.php
index b8d776fbc..17772a2ec 100644
--- a/app/Models/View.php
+++ b/app/Models/View.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_View extends Minz_View {
diff --git a/app/Models/ViewJavascript.php b/app/Models/ViewJavascript.php
index 157ebe4ae..38a0a74f0 100644
--- a/app/Models/ViewJavascript.php
+++ b/app/Models/ViewJavascript.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
final class FreshRSS_ViewJavascript extends FreshRSS_View {
diff --git a/app/Models/ViewStats.php b/app/Models/ViewStats.php
index f07c19c91..25c749cd2 100644
--- a/app/Models/ViewStats.php
+++ b/app/Models/ViewStats.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
final class FreshRSS_ViewStats extends FreshRSS_View {
diff --git a/app/Services/ExportService.php b/app/Services/ExportService.php
index 80531f3fc..c44b2bf4b 100644
--- a/app/Services/ExportService.php
+++ b/app/Services/ExportService.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Provide useful methods to generate files to export.
diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php
index 9b013fea4..e210d0fd7 100644
--- a/app/Services/ImportService.php
+++ b/app/Services/ImportService.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Provide methods to import files.
diff --git a/app/Utils/feverUtil.php b/app/Utils/feverUtil.php
index c581cd5c4..3c2b8bd2e 100644
--- a/app/Utils/feverUtil.php
+++ b/app/Utils/feverUtil.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_fever_Util {
private const FEVER_PATH = DATA_PATH . '/fever';
diff --git a/app/Utils/passwordUtil.php b/app/Utils/passwordUtil.php
index 4e3040f4a..47587d336 100644
--- a/app/Utils/passwordUtil.php
+++ b/app/Utils/passwordUtil.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_password_Util {
// Will also have to be computed client side on mobile devices,
diff --git a/app/actualize_script.php b/app/actualize_script.php
index 93479e74d..cfe897bdd 100755
--- a/app/actualize_script.php
+++ b/app/actualize_script.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/../cli/_cli.php');
session_cache_limiter('');
diff --git a/app/install.php b/app/install.php
index b811f0de7..348ba079b 100644
--- a/app/install.php
+++ b/app/install.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
if (function_exists('opcache_reset')) {
opcache_reset();
}
@@ -27,15 +29,15 @@ function initTranslate(): void {
Minz_Translate::init();
$available_languages = Minz_Translate::availableLanguages();
- if (Minz_Session::param('language') == '') {
+ if (Minz_Session::paramString('language') == '') {
Minz_Session::_param('language', get_best_language());
}
- if (!in_array(Minz_Session::param('language'), $available_languages, true)) {
+ if (!in_array(Minz_Session::paramString('language'), $available_languages, true)) {
Minz_Session::_param('language', 'en');
}
- Minz_Translate::reset(Minz_Session::param('language'));
+ Minz_Translate::reset(Minz_Session::paramString('language'));
}
function get_best_language(): string {
@@ -91,7 +93,7 @@ function saveStep1(): void {
function saveStep2(): void {
if (!empty($_POST)) {
- if (Minz_Session::param('bd_type') === 'sqlite') {
+ if (Minz_Session::paramString('bd_type') === 'sqlite') {
Minz_Session::_params([
'bd_base' => false,
'bd_host' => false,
@@ -114,8 +116,8 @@ function saveStep2(): void {
'bd_prefix' => substr($_POST['prefix'], 0, 16),
]);
}
- if (Minz_Session::param('bd_type') === 'pgsql') {
- Minz_Session::_param('bd_base', strtolower(Minz_Session::param('bd_base')));
+ if (Minz_Session::paramString('bd_type') === 'pgsql') {
+ Minz_Session::_param('bd_base', strtolower(Minz_Session::paramString('bd_base')));
}
// We use dirname to remove the /i part
@@ -125,18 +127,18 @@ function saveStep2(): void {
'base_url' => $base_url,
'default_user' => '_',
'db' => [
- 'type' => Minz_Session::param('bd_type'),
- 'host' => Minz_Session::param('bd_host'),
- 'user' => Minz_Session::param('bd_user'),
- 'password' => Minz_Session::param('bd_password'),
- 'base' => Minz_Session::param('bd_base'),
- 'prefix' => Minz_Session::param('bd_prefix'),
+ 'type' => Minz_Session::paramString('bd_type'),
+ 'host' => Minz_Session::paramString('bd_host'),
+ 'user' => Minz_Session::paramString('bd_user'),
+ 'password' => Minz_Session::paramString('bd_password'),
+ 'base' => Minz_Session::paramString('bd_base'),
+ 'prefix' => Minz_Session::paramString('bd_prefix'),
'pdo_options' => [],
],
'pubsubhubbub_enabled' => Minz_Request::serverIsPublic($base_url),
];
- if (Minz_Session::param('title') != '') {
- $config_array['title'] = Minz_Session::param('title');
+ if (Minz_Session::paramString('title') != '') {
+ $config_array['title'] = Minz_Session::paramString('title');
}
$customConfigPath = DATA_PATH . '/config.custom.php';
@@ -177,7 +179,7 @@ function saveStep2(): void {
if ($ok) {
Minz_Session::_param('bd_error');
header('Location: index.php?step=3');
- } elseif (Minz_Session::param('bd_error') == '') {
+ } elseif (Minz_Session::paramString('bd_error') == '') {
Minz_Session::_param('bd_error', 'Unknown error!');
}
}
@@ -186,7 +188,7 @@ function saveStep2(): void {
function saveStep3(): bool {
FreshRSS_Context::initSystem();
- Minz_Translate::init(Minz_Session::param('language'));
+ Minz_Translate::init(Minz_Session::paramString('language'));
if (!empty($_POST)) {
if (param('auth_type', 'form') != '') {
@@ -220,16 +222,16 @@ function saveStep3(): bool {
// Create default user files but first, we delete previous data to
// avoid access right problems.
- recursive_unlink(USERS_PATH . '/' . Minz_Session::param('default_user'));
+ recursive_unlink(USERS_PATH . '/' . Minz_Session::paramString('default_user'));
$ok = false;
try {
$ok = FreshRSS_user_Controller::createUser(
- Minz_Session::param('default_user'),
+ Minz_Session::paramString('default_user'),
'', //TODO: Add e-mail
$password_plain,
[
- 'language' => Minz_Session::param('language'),
+ 'language' => Minz_Session::paramString('language'),
'is_admin' => true,
'enabled' => true,
]
@@ -270,8 +272,8 @@ function checkStep(): void {
/** @return array<string,string> */
function checkStep0(): array {
$languages = Minz_Translate::availableLanguages();
- $language = Minz_Session::param('language') != '' && in_array(Minz_Session::param('language'), $languages, true);
- $sessionWorking = Minz_Session::param('sessionWorking') === 'ok';
+ $language = Minz_Session::paramString('language') != '' && in_array(Minz_Session::paramString('language'), $languages, true);
+ $sessionWorking = Minz_Session::paramString('sessionWorking') === 'ok';
return [
'language' => $language ? 'ok' : 'ko',
@@ -310,8 +312,8 @@ function freshrss_already_installed(): bool {
function checkStep2(): array {
$conf = is_writable(join_path(DATA_PATH, 'config.php'));
- $bd = Minz_Session::param('bd_type') != '';
- $conn = Minz_Session::param('bd_error') == '';
+ $bd = Minz_Session::paramString('bd_type') != '';
+ $conn = Minz_Session::paramString('bd_error') == '';
return [
'bd' => $bd ? 'ok' : 'ko',
@@ -323,13 +325,13 @@ function checkStep2(): array {
/** @return array<string,string> */
function checkStep3(): array {
- $conf = Minz_Session::param('default_user') != '';
+ $conf = Minz_Session::paramString('default_user') != '';
- $form = Minz_Session::param('auth_type') != '';
+ $form = Minz_Session::paramString('auth_type') != '';
$defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user'];
if ($defaultUser === null) {
- $defaultUser = Minz_Session::param('default_user') == '' ? '' : Minz_Session::param('default_user');
+ $defaultUser = Minz_Session::paramString('default_user') == '' ? '' : Minz_Session::paramString('default_user');
}
$data = is_writable(join_path(USERS_PATH, $defaultUser, 'config.php'));
diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml
index ba2d28fd3..1b2f0076e 100644
--- a/app/layout/aside_configure.phtml
+++ b/app/layout/aside_configure.phtml
@@ -1,16 +1,17 @@
<?php
-function get_logout_url(): string {
- if (($_SERVER['AUTH_TYPE'] ?? '') === 'openid-connect') {
- $url_string = urlencode(Minz_Request::guessBaseUrl());
- return './oidc/?logout=' . $url_string . '/';
- # The trailing slash is necessary so that we don’t redirect to http://.
- # https://bz.apache.org/bugzilla/show_bug.cgi?id=61355#c13
- } else {
- return _url('auth', 'logout') ?: '';
+ declare(strict_types=1);
+
+ function get_logout_url(): string {
+ if (($_SERVER['AUTH_TYPE'] ?? '') === 'openid-connect') {
+ $url_string = urlencode(Minz_Request::guessBaseUrl());
+ return './oidc/?logout=' . $url_string . '/';
+ # The trailing slash is necessary so that we don’t redirect to http://.
+ # https://bz.apache.org/bugzilla/show_bug.cgi?id=61355#c13
+ } else {
+ return _url('auth', 'logout') ?: '';
+ }
}
-}
?>
-
<nav class="nav nav-list aside" id="aside_feed">
<a class="toggle_aside" href="#close"><?= _i('close') ?></a>
diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml
index 1d23a66d3..1d491ad79 100644
--- a/app/layout/aside_feed.phtml
+++ b/app/layout/aside_feed.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$actual_view = Minz_Request::actionName();
$class = '';
diff --git a/app/layout/aside_subscription.phtml b/app/layout/aside_subscription.phtml
index e6329df46..9c41603ee 100644
--- a/app/layout/aside_subscription.phtml
+++ b/app/layout/aside_subscription.phtml
@@ -1,3 +1,6 @@
+<?php
+ declare(strict_types=1);
+?>
<nav class="nav nav-list aside" id="aside_feed">
<a class="toggle_aside" href="#close"><?= _i('close') ?></a>
<ul>
diff --git a/app/layout/header.phtml b/app/layout/header.phtml
index c49d98508..e5722abb6 100644
--- a/app/layout/header.phtml
+++ b/app/layout/header.phtml
@@ -1,3 +1,6 @@
+<?php
+ declare(strict_types=1);
+?>
<header class="header">
<div class="item title">
<a href="<?= _url('index', 'index') ?>">
@@ -16,7 +19,7 @@
<form action="<?= _url('index', 'index') ?>" method="get">
<div class="stick">
<input type="search" name="search" id="search"
- value="<?= htmlspecialchars(htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES), ENT_COMPAT, 'UTF-8') ?>"
+ value="<?= htmlspecialchars(htmlspecialchars_decode(FreshRSS_Context::$search->getRawInput(), ENT_QUOTES), ENT_COMPAT, 'UTF-8') ?>"
placeholder="<?= _t('gen.menu.search') ?>" />
<?php $param_a = Minz_Request::actionName(); ?>
diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml
index 56c7e688e..49cf85a02 100644
--- a/app/layout/layout.phtml
+++ b/app/layout/layout.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
FreshRSS::preLayout();
?>
diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml
index 55e1743dc..e640f265d 100644
--- a/app/layout/nav_entries.phtml
+++ b/app/layout/nav_entries.phtml
@@ -1,3 +1,6 @@
+<?php
+ declare(strict_types=1);
+?>
<nav>
<ul id="nav_entries">
<li class="item"><a class="previous_entry" href="#"><?= _i('prev') ?></a></li>
diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml
index 418b6c54c..72838094f 100644
--- a/app/layout/nav_menu.phtml
+++ b/app/layout/nav_menu.phtml
@@ -1,7 +1,7 @@
<?php
+ declare(strict_types=1);
$actual_view = Minz_Request::actionName();
?>
-
<nav class="nav_menu">
<?php if ($actual_view === 'normal' || $actual_view === 'reader') { ?>
<div class="group">
@@ -35,7 +35,7 @@
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
<div id="dropdown-search" class="dropdown-target"></div>
- <a id="toggle-search" class="dropdown-toggle btn<?= (strlen(FreshRSS_Context::$search) > 0) ? ' active' : ''; ?>" title="<?= _t('gen.menu.search') ?>"
+ <a id="toggle-search" class="dropdown-toggle btn<?= (strlen(FreshRSS_Context::$search->getRawInput()) > 0) ? ' active' : ''; ?>" title="<?= _t('gen.menu.search') ?>"
href="#dropdown-search"><?= _i('search') ?></a>
<ul class="dropdown-menu">
<li class="item">
@@ -63,7 +63,7 @@
<div class="stick search">
<input type="search" name="search"
- value="<?= htmlspecialchars(htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES), ENT_COMPAT, 'UTF-8'); ?>"
+ value="<?= htmlspecialchars(htmlspecialchars_decode(FreshRSS_Context::$search->getRawInput(), ENT_QUOTES), ENT_COMPAT, 'UTF-8'); ?>"
placeholder="<?= _t('gen.menu.search') ?>" title="<?= _t('gen.menu.search') ?>" /><button class="btn" type="submit" title="<?= _t('index.menu.search_short') ?>"><?= _i('search') ?></button>
</div>
<p class="help"><?= _i('help') ?> <?= _t('gen.menu.search_help') ?></a></p>
@@ -128,7 +128,7 @@
'get' => $get,
'nextGet' => FreshRSS_Context::$next_get,
'idMax' => FreshRSS_Context::$id_max,
- 'search' => htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES),
+ 'search' => htmlspecialchars_decode(FreshRSS_Context::$search->getRawInput(), ENT_QUOTES),
'state' => FreshRSS_Context::$state,
),
);
diff --git a/app/layout/simple.phtml b/app/layout/simple.phtml
index 7251f6810..b9f74cf59 100644
--- a/app/layout/simple.phtml
+++ b/app/layout/simple.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
FreshRSS::preLayout();
?>
diff --git a/app/shares.php b/app/shares.php
index b3733e1f3..518898625 100644
--- a/app/shares.php
+++ b/app/shares.php
@@ -1,5 +1,4 @@
<?php
-
declare(strict_types=1);
/*
diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml
index 29f98d20b..6deade3f4 100644
--- a/app/views/auth/formLogin.phtml
+++ b/app/views/auth/formLogin.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<main class="prompt">
<h1><?= _t('gen.auth.login') ?></h1>
diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml
index 45183592a..78762c19e 100644
--- a/app/views/auth/index.phtml
+++ b/app/views/auth/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml
index 98276452f..953b07b0d 100644
--- a/app/views/auth/register.phtml
+++ b/app/views/auth/register.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<main class="prompt">
<h1><?= _t('gen.auth.registration') ?></h1>
diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml
index 47281e2f1..6004cec1b 100644
--- a/app/views/configure/archiving.phtml
+++ b/app/views/configure/archiving.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml
index 131583408..b48dcbf71 100644
--- a/app/views/configure/display.phtml
+++ b/app/views/configure/display.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/configure/integration.phtml b/app/views/configure/integration.phtml
index 34c10b3c3..fc3cc2a32 100644
--- a/app/views/configure/integration.phtml
+++ b/app/views/configure/integration.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
@@ -66,7 +66,7 @@
<input type="hidden" id="share_<?= $key ?>_type" name="share[<?= $key ?>][type]" value="<?= $share->type() ?>" />
<input type="hidden" id="share_<?= $key ?>_method" name="share[<?= $key ?>][method]" value="<?= $share->method() ?>" />
<input type="hidden" id="share_<?= $key ?>_field" name="share[<?= $key ?>][field]" value="<?= $share->field() ?>" />
-
+
<?php if ($share->isDeprecated()) { ?>
<div class="prompt alert alert-warn">
<p><?= _t('conf.sharing.deprecated') ?></p>
@@ -82,13 +82,13 @@
data-leave-validation="<?= $share->name() ?>" />
</div>
</div>
-
+
<div class="form-group">
<?php if ($share->formType() === 'advanced') { ?>
<label class="group-name" for="share_<?= $key ?>_url">
<?= _t('conf.sharing.share_url') ?>
</label>
-
+
<div class="group-controls">
<div class="stick">
<input type="url" id="share_<?= $key ?>_url" name="share[<?= $key ?>][url]" class="long" value="<?= $share->baseUrl() ?>"
@@ -99,7 +99,7 @@
</div>
<?php } ?>
</div>
-
+
<div class="form-group">
<div class="group-controls">
<button type="button" class="remove btn btn-attention" title="<?= _t('conf.sharing.remove') ?>"><?= _t('gen.action.remove') ?></button>
diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml
index 24c06ac5a..2a55eb1b2 100644
--- a/app/views/configure/queries.phtml
+++ b/app/views/configure/queries.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
@@ -19,7 +19,7 @@
<a class="configure open-slider" href="<?= _url('configure', 'query', 'id', '' . $key) ?>"><?= _i('configure') ?></a><h2><?= $query->getName() ?></h2>
<input type="hidden" id="queries_<?= $key ?>_name" name="queries[<?= $key ?>][name]" value="<?= $query->getName() ?>"/>
<input type="hidden" id="queries_<?= $key ?>_url" name="queries[<?= $key ?>][url]" value="<?= $query->getUrl() ?>"/>
- <input type="hidden" id="queries_<?= $key ?>_search" name="queries[<?= $key ?>][search]" value="<?= urlencode($query->getSearch()) ?>"/>
+ <input type="hidden" id="queries_<?= $key ?>_search" name="queries[<?= $key ?>][search]" value="<?= urlencode($query->getSearch()->getRawInput()) ?>"/>
<input type="hidden" id="queries_<?= $key ?>_state" name="queries[<?= $key ?>][state]" value="<?= $query->getState() ?>"/>
<input type="hidden" id="queries_<?= $key ?>_order" name="queries[<?= $key ?>][order]" value="<?= $query->getOrder() ?>"/>
<input type="hidden" id="queries_<?= $key ?>_get" name="queries[<?= $key ?>][get]" value="<?= $query->getGet() ?>"/>
diff --git a/app/views/configure/query.phtml b/app/views/configure/query.phtml
index 9284ae94e..e45820fbc 100644
--- a/app/views/configure/query.phtml
+++ b/app/views/configure/query.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml
index 669fa7a16..5f22d4daf 100644
--- a/app/views/configure/reading.phtml
+++ b/app/views/configure/reading.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml
index ca4a42c86..e578938cd 100644
--- a/app/views/configure/shortcut.phtml
+++ b/app/views/configure/shortcut.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml
index b1522749f..d19698932 100644
--- a/app/views/configure/system.phtml
+++ b/app/views/configure/system.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml
index 9c3fe2076..192e805a0 100644
--- a/app/views/entry/bookmark.phtml
+++ b/app/views/entry/bookmark.phtml
@@ -1,5 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
<?php
+declare(strict_types=1);
+/** @var FreshRSS_View $this */
+
header('Content-Type: application/json; charset=UTF-8');
$url = array(
diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtml
index 2d1760b87..071782895 100644
--- a/app/views/entry/read.phtml
+++ b/app/views/entry/read.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
header('Content-Type: application/json; charset=UTF-8');
diff --git a/app/views/error/index.phtml b/app/views/error/index.phtml
index abebc8332..50ad16eba 100644
--- a/app/views/error/index.phtml
+++ b/app/views/error/index.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<main class="post">
<div class="alert alert-error">
<h1 class="alert-head"><?= $this->code ?></h1>
diff --git a/app/views/extension/configure.phtml b/app/views/extension/configure.phtml
index 27946e202..c722b3a1e 100644
--- a/app/views/extension/configure.phtml
+++ b/app/views/extension/configure.phtml
@@ -1,3 +1,4 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->renderHelper('extension/configure');
diff --git a/app/views/extension/index.phtml b/app/views/extension/index.phtml
index 9b8c122e6..7bec7b233 100644
--- a/app/views/extension/index.phtml
+++ b/app/views/extension/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml
index 3461e6e61..c51289f56 100644
--- a/app/views/feed/add.phtml
+++ b/app/views/feed/add.phtml
@@ -1,5 +1,8 @@
-<?php /** @var FreshRSS_View $this */ ?>
-<?php if ($this->feed) { ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+ if ($this->feed) {
+?>
<main class="post">
<h1><?= _t('sub.feed.add') ?></h1>
diff --git a/app/views/feed/contentSelectorPreview.phtml b/app/views/feed/contentSelectorPreview.phtml
index 7ff251e38..a5afb10f4 100644
--- a/app/views/feed/contentSelectorPreview.phtml
+++ b/app/views/feed/contentSelectorPreview.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
FreshRSS::preLayout();
?>
diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml
index a0986ff04..7f8fecbf8 100644
--- a/app/views/helpers/category/update.phtml
+++ b/app/views/helpers/category/update.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<div class="post">
<h2>
<?= $this->category->name() ?>
diff --git a/app/views/helpers/configure/query.phtml b/app/views/helpers/configure/query.phtml
index f8d51c193..0f76bc202 100644
--- a/app/views/helpers/configure/query.phtml
+++ b/app/views/helpers/configure/query.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<div class="post">
<h2><?= $this->query->getName() ?></h2>
@@ -20,7 +23,7 @@
<div class="form-group">
<label class="group-name" for=""><?= _t('conf.query.filter.search') ?></label>
<div class="group-controls">
- <input type="text" id="query_search" name="query[search]" value="<?= htmlspecialchars($this->query->getSearch(), ENT_COMPAT, 'UTF-8') ?>"/>
+ <input type="text" id="query_search" name="query[search]" value="<?= htmlspecialchars($this->query->getSearch()->getRawInput(), ENT_COMPAT, 'UTF-8') ?>"/>
</div>
</div>
<div class="form-group">
diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml
index 1db627bf7..6903c3c69 100644
--- a/app/views/helpers/export/articles.phtml
+++ b/app/views/helpers/export/articles.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
$username = Minz_User::name() ?? Minz_User::INTERNAL_USER;
diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml
index 8b067b8ff..2c3e004fc 100644
--- a/app/views/helpers/export/opml.phtml
+++ b/app/views/helpers/export/opml.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @param array<FreshRSS_Feed> $feeds
diff --git a/app/views/helpers/extension/configure.phtml b/app/views/helpers/extension/configure.phtml
index e3a6b1b0c..5cf7f9c0a 100644
--- a/app/views/helpers/extension/configure.phtml
+++ b/app/views/helpers/extension/configure.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
$this->partial('aside_configure');
diff --git a/app/views/helpers/extension/details.phtml b/app/views/helpers/extension/details.phtml
index f200ce0d8..b8d0d784f 100644
--- a/app/views/helpers/extension/details.phtml
+++ b/app/views/helpers/extension/details.phtml
@@ -1,6 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
-
<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+
$name_encoded = urlencode($this->ext_details->getName());
$ext_enabled = $this->ext_details->isEnabled();
if ($ext_enabled) {
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index 680bc2399..af2503256 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<div class="post" id="feed_update">
<h1><?= $this->feed->name() ?></h1>
diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml
index 37a6de042..dba0e44a3 100644
--- a/app/views/helpers/index/normal/entry_bottom.phtml
+++ b/app/views/helpers/index/normal/entry_bottom.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$bottomline_read = FreshRSS_Context::$user_conf->bottomline_read;
$bottomline_favorite = FreshRSS_Context::$user_conf->bottomline_favorite;
diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml
index 4cfb5beda..6a693b0a9 100644
--- a/app/views/helpers/index/normal/entry_header.phtml
+++ b/app/views/helpers/index/normal/entry_header.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$topline_read = FreshRSS_Context::$user_conf->topline_read;
$topline_favorite = FreshRSS_Context::$user_conf->topline_favorite;
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml
index 8ee8a7e21..1798187d0 100644
--- a/app/views/helpers/javascript_vars.phtml
+++ b/app/views/helpers/javascript_vars.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
$mark = FreshRSS_Context::$user_conf->mark_when;
$s = FreshRSS_Context::$user_conf->shortcuts;
@@ -15,7 +16,7 @@ echo htmlspecialchars(json_encode(array(
'auto_mark_scroll' => !!$mark['scroll'],
'auto_mark_focus' => !!$mark['focus'],
'auto_load_more' => !!FreshRSS_Context::$user_conf->auto_load_more,
- 'auto_actualize_feeds' => !!Minz_Session::param('actualize_feeds', false),
+ 'auto_actualize_feeds' => Minz_Session::paramBoolean('actualize_feeds'),
'does_lazyload' => !!FreshRSS_Context::$user_conf->lazyload ,
'sides_close_article' => !!FreshRSS_Context::$user_conf->sides_close_article,
'sticky_post' => !!FreshRSS_Context::isStickyPostEnabled(),
diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml
index 349be0760..309a80e6b 100644
--- a/app/views/helpers/logs_pagination.phtml
+++ b/app/views/helpers/logs_pagination.phtml
@@ -1,10 +1,10 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$c = Minz_Request::controllerName();
$a = Minz_Request::actionName();
$params = $_GET;
?>
-
<?php if ($this->nbPage > 1) { ?>
<nav class="nav-pagination nav-list">
<ul class="pagination">
diff --git a/app/views/helpers/stream-footer.phtml b/app/views/helpers/stream-footer.phtml
index 9b61ae44f..41f4315b5 100644
--- a/app/views/helpers/stream-footer.phtml
+++ b/app/views/helpers/stream-footer.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$url_next = Minz_Request::currentRequest();
$url_next['params']['next'] = FreshRSS_Context::$next_id;
@@ -12,15 +13,14 @@
'get' => FreshRSS_Context::currentGet(),
'nextGet' => FreshRSS_Context::$next_get,
'idMax' => FreshRSS_Context::$id_max,
- 'search' => htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES),
+ 'search' => htmlspecialchars_decode(FreshRSS_Context::$search->getRawInput(), ENT_QUOTES),
'state' => FreshRSS_Context::$state,
)
);
-?>
-<?php
-$hasAccess = FreshRSS_Auth::hasAccess();
-if ($hasAccess) { ?>
+ $hasAccess = FreshRSS_Auth::hasAccess();
+ if ($hasAccess) {
+?>
<form id="stream-footer" action="" method="post">
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
<?php } else { ?>
diff --git a/app/views/importExport/export.phtml b/app/views/importExport/export.phtml
index 21ed71b2d..af0b21ea1 100644
--- a/app/views/importExport/export.phtml
+++ b/app/views/importExport/export.phtml
@@ -1,2 +1,4 @@
-<?php /** @var FreshRSS_View $this */ ?>
-<?= $this->content ?>
+<?php
+declare(strict_types=1);
+/** @var FreshRSS_View $this */
+echo $this->content;
diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml
index adc236dc4..3e8fde09f 100644
--- a/app/views/importExport/index.phtml
+++ b/app/views/importExport/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_subscription');
?>
-
<main class="post ">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml
index 1966c1f6b..5ee1729cd 100644
--- a/app/views/index/about.phtml
+++ b/app/views/index/about.phtml
@@ -1,10 +1,10 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
if (FreshRSS_Auth::hasAccess()) {
$this->partial('aside_configure');
}
?>
-
<main class="post content<?= !FreshRSS_Auth::hasAccess() ? ' centered' : ''?>">
<?php if (FreshRSS_Auth::hasAccess()) {?>
<div class="link-back-wrapper">
diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml
index 6e3b2378b..0ddc22e11 100644
--- a/app/views/index/global.phtml
+++ b/app/views/index/global.phtml
@@ -1,4 +1,5 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('nav_menu');
@@ -12,7 +13,6 @@
$state_unread = true;
}
?>
-
<main id="stream" class="global<?= $class ?>">
<h1 class="title_hidden"><?= _t('conf.reading.view.global') ?></h1>
<?php
diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml
index cba6f5243..7913405ca 100644
--- a/app/views/index/logs.phtml
+++ b/app/views/index/logs.phtml
@@ -1,5 +1,8 @@
-<?php /** @var FreshRSS_View $this */ ?>
-<?php $this->partial('aside_configure'); ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+ $this->partial('aside_configure');
+?>
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/index/normal.phtml b/app/views/index/normal.phtml
index aee2ea2a2..feda1466f 100644
--- a/app/views/index/normal.phtml
+++ b/app/views/index/normal.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
$this->partial('aside_feed');
diff --git a/app/views/index/opml.phtml b/app/views/index/opml.phtml
index 69dace924..f55461165 100644
--- a/app/views/index/opml.phtml
+++ b/app/views/index/opml.phtml
@@ -1,3 +1,4 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->renderHelper('export/opml');
diff --git a/app/views/index/reader.phtml b/app/views/index/reader.phtml
index 014b1ab42..dc90a144a 100644
--- a/app/views/index/reader.phtml
+++ b/app/views/index/reader.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
$this->partial('aside_feed');
diff --git a/app/views/index/rss.phtml b/app/views/index/rss.phtml
index f9c9d9297..a6d0d2a10 100644
--- a/app/views/index/rss.phtml
+++ b/app/views/index/rss.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<?= '<?xml version="1.0" encoding="UTF-8" ?>'; ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"
<?= $this->rss_base == '' ? '' : ' xml:base="' . $this->rss_base . '"' ?>
diff --git a/app/views/index/tos.phtml b/app/views/index/tos.phtml
index 8a9c2f583..6a2aa7ce8 100644
--- a/app/views/index/tos.phtml
+++ b/app/views/index/tos.phtml
@@ -1,10 +1,10 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
if (FreshRSS_Auth::hasAccess()) {
$this->partial('aside_configure');
}
?>
-
<main class="post content<?= !FreshRSS_Auth::hasAccess() ? ' centered' : ''?>">
<?php if (FreshRSS_Auth::hasAccess()) {?>
<div class="link-back-wrapper">
diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml
index 1a8af6e49..bce316d85 100644
--- a/app/views/javascript/actualize.phtml
+++ b/app/views/javascript/actualize.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_ViewJavascript $this */
$categories = [];
diff --git a/app/views/javascript/nbUnreadsPerFeed.phtml b/app/views/javascript/nbUnreadsPerFeed.phtml
index 4864b429a..f82893f13 100644
--- a/app/views/javascript/nbUnreadsPerFeed.phtml
+++ b/app/views/javascript/nbUnreadsPerFeed.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_ViewJavascript $this */
$result = array(
diff --git a/app/views/javascript/nonce.phtml b/app/views/javascript/nonce.phtml
index df1389f15..e7dceb339 100644
--- a/app/views/javascript/nonce.phtml
+++ b/app/views/javascript/nonce.phtml
@@ -1,3 +1,4 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_ViewJavascript $this */
echo json_encode(array('salt1' => $this->salt1, 'nonce' => $this->nonce));
diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml
index 37cc92144..a671bb83e 100644
--- a/app/views/stats/idle.phtml
+++ b/app/views/stats/idle.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_ViewStats $this */
$this->partial('aside_subscription');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml
index 593474ac7..4e14d0fc7 100644
--- a/app/views/stats/index.phtml
+++ b/app/views/stats/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_ViewStats $this */
$this->partial('aside_subscription');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml
index 6923f6992..030db0906 100644
--- a/app/views/stats/repartition.phtml
+++ b/app/views/stats/repartition.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_ViewStats $this */
$this->partial('aside_subscription');
?>
-
<main class="post ">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/subscription/add.phtml b/app/views/subscription/add.phtml
index 1f07e2931..2dfc8c705 100644
--- a/app/views/subscription/add.phtml
+++ b/app/views/subscription/add.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_subscription');
?>
-
<main class="post drop-section">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/subscription/bookmarklet.phtml b/app/views/subscription/bookmarklet.phtml
index 540bf8e52..d96f8a35b 100644
--- a/app/views/subscription/bookmarklet.phtml
+++ b/app/views/subscription/bookmarklet.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_subscription');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/subscription/category.phtml b/app/views/subscription/category.phtml
index 0b63ebc17..daf4523bb 100644
--- a/app/views/subscription/category.phtml
+++ b/app/views/subscription/category.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
diff --git a/app/views/subscription/feed.phtml b/app/views/subscription/feed.phtml
index e361cff39..934e3c690 100644
--- a/app/views/subscription/feed.phtml
+++ b/app/views/subscription/feed.phtml
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml
index 6881d0a8d..280799f2d 100644
--- a/app/views/subscription/index.phtml
+++ b/app/views/subscription/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_subscription');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/tag/getTagsForEntry.phtml b/app/views/tag/getTagsForEntry.phtml
index 46a82ca68..b2a0d78a7 100644
--- a/app/views/tag/getTagsForEntry.phtml
+++ b/app/views/tag/getTagsForEntry.phtml
@@ -1,3 +1,4 @@
-<?php /** @var FreshRSS_View $this */ ?>
<?php
+declare(strict_types=1);
+/** @var FreshRSS_View $this */
echo json_encode($this->tagsForEntry);
diff --git a/app/views/tag/index.phtml b/app/views/tag/index.phtml
index c80e0c209..eed8906c4 100644
--- a/app/views/tag/index.phtml
+++ b/app/views/tag/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_subscription');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/update/apply.phtml b/app/views/update/apply.phtml
index 077eb2184..291e634f8 100644
--- a/app/views/update/apply.phtml
+++ b/app/views/update/apply.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml
index 393a9fdee..19e3d2e1e 100644
--- a/app/views/update/checkInstall.phtml
+++ b/app/views/update/checkInstall.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/update/index.phtml b/app/views/update/index.phtml
index 2e24b3086..c93d1a75e 100644
--- a/app/views/update/index.phtml
+++ b/app/views/update/index.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/user/details.phtml b/app/views/user/details.phtml
index a2a560a65..1ea8f62d8 100644
--- a/app/views/user/details.phtml
+++ b/app/views/user/details.phtml
@@ -1,14 +1,13 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
$this->partial('aside_configure');
}
+ $isDefault = $this->details['is_default'];
+ $isAdmin = $this->details['is_admin'];
+ $enabled = $this->details['enabled'];
?>
-
-<?php $isDefault = $this->details['is_default']; ?>
-<?php $isAdmin = $this->details['is_admin']; ?>
-<?php $enabled = $this->details['enabled']; ?>
-
<div class="post">
<h2><?= $this->username ?><?php if ($isAdmin) echo ' ― ', _t('admin.user.admin'); ?></h2>
<form method="post" action="<?= _url('user', 'manage', 'username', $this->username); ?>">
diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml
index 827ba39da..dcff153d6 100644
--- a/app/views/user/manage.phtml
+++ b/app/views/user/manage.phtml
@@ -1,8 +1,8 @@
<?php
+ declare(strict_types=1);
/** @var FreshRSS_View $this */
$this->partial('aside_configure');
?>
-
<main class="post">
<div class="link-back-wrapper">
<a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml
index b5fbb04b5..0a41d4dc4 100644
--- a/app/views/user/profile.phtml
+++ b/app/views/user/profile.phtml
@@ -1,5 +1,6 @@
-<?php /** @var FreshRSS_View $this */ ?>
<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
if (!$this->disable_aside) {
$this->partial('aside_configure');
}
diff --git a/app/views/user/validateEmail.phtml b/app/views/user/validateEmail.phtml
index bd36510dd..8f822fe6a 100644
--- a/app/views/user/validateEmail.phtml
+++ b/app/views/user/validateEmail.phtml
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<main class="post">
<p>
<?= _t('user.email.validation.need_to', FreshRSS_Context::$system_conf->title) ?>
diff --git a/app/views/user_mailer/email_need_validation.txt.php b/app/views/user_mailer/email_need_validation.txt.php
index 2785911bf..5799499e7 100644
--- a/app/views/user_mailer/email_need_validation.txt.php
+++ b/app/views/user_mailer/email_need_validation.txt.php
@@ -1,4 +1,7 @@
-<?php /** @var FreshRSS_View $this */ ?>
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+?>
<?= _t('user.mailer.email_need_validation.welcome', $this->username) ?>
<?= _t('user.mailer.email_need_validation.body', $this->site_title) ?>
diff --git a/cli/_cli.php b/cli/_cli.php
index 9c62f3b4c..eb2152082 100644
--- a/cli/_cli.php
+++ b/cli/_cli.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
if (php_sapi_name() !== 'cli') {
die('FreshRSS error: This PHP script may only be invoked from command line!');
}
diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php
index 73b627597..69e6ce589 100644
--- a/cli/_update-or-create-user.php
+++ b/cli/_update-or-create-user.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/actualize-user.php b/cli/actualize-user.php
index b7bc9c2ad..9b144b7bb 100755
--- a/cli/actualize-user.php
+++ b/cli/actualize-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/check.translation.php b/cli/check.translation.php
index 34b43244f..747a35be9 100755
--- a/cli/check.translation.php
+++ b/cli/check.translation.php
@@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/i18n/I18nCompletionValidator.php';
require_once __DIR__ . '/i18n/I18nData.php';
require_once __DIR__ . '/i18n/I18nFile.php';
diff --git a/cli/create-user.php b/cli/create-user.php
index c6364371a..286befe85 100755
--- a/cli/create-user.php
+++ b/cli/create-user.php
@@ -1,5 +1,7 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
+
$isUpdate = false;
require(__DIR__ . '/_update-or-create-user.php');
diff --git a/cli/db-optimize.php b/cli/db-optimize.php
index ba14d12ea..2561e7cb2 100755
--- a/cli/db-optimize.php
+++ b/cli/db-optimize.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/delete-user.php b/cli/delete-user.php
index fbbb2eebb..2ad84b7dc 100755
--- a/cli/delete-user.php
+++ b/cli/delete-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/do-install.php b/cli/do-install.php
index 58fcb2254..1b391a458 100755
--- a/cli/do-install.php
+++ b/cli/do-install.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
if (file_exists(DATA_PATH . '/applied_migrations.txt')) {
diff --git a/cli/export-opml-for-user.php b/cli/export-opml-for-user.php
index 755cbe035..a28bddced 100755
--- a/cli/export-opml-for-user.php
+++ b/cli/export-opml-for-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/export-sqlite-for-user.php b/cli/export-sqlite-for-user.php
index b4265d28a..e1dc83987 100755
--- a/cli/export-sqlite-for-user.php
+++ b/cli/export-sqlite-for-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/export-zip-for-user.php b/cli/export-zip-for-user.php
index 90e4b87e1..dedcb6c11 100755
--- a/cli/export-zip-for-user.php
+++ b/cli/export-zip-for-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/i18n/I18nCompletionValidator.php b/cli/i18n/I18nCompletionValidator.php
index 6240580c4..4a8e54759 100644
--- a/cli/i18n/I18nCompletionValidator.php
+++ b/cli/i18n/I18nCompletionValidator.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require_once __DIR__ . '/I18nValidatorInterface.php';
diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php
index 957ec2887..6e87e1d7e 100644
--- a/cli/i18n/I18nData.php
+++ b/cli/i18n/I18nData.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class I18nData {
diff --git a/cli/i18n/I18nFile.php b/cli/i18n/I18nFile.php
index 5a0c74aaa..8932bff57 100644
--- a/cli/i18n/I18nFile.php
+++ b/cli/i18n/I18nFile.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require_once __DIR__ . '/I18nValue.php';
@@ -27,7 +28,7 @@ class I18nFile {
}
/**
- * @param array<string,array<array<string>>> $i18n
+ * @param array<string,array<string,array<string,I18nValue>>> $i18n
*/
public function dump(array $i18n): void {
foreach ($i18n as $language => $file) {
@@ -65,7 +66,7 @@ class I18nFile {
} catch (ParseError $ex) {
if (defined('STDERR')) {
fwrite(STDERR, "Error while processing: $filename\n");
- fwrite(STDERR, $ex);
+ fwrite(STDERR, $ex->getMessage());
}
die(1);
}
@@ -108,7 +109,7 @@ class I18nFile {
* The first key is dropped since it represents the filename and we have
* no use of it.
*
- * @param array<string> $translation
+ * @param array<string,I18nValue> $translation
* @return array<string,array<string,I18nValue>>
*/
private function unflatten(array $translation): array {
@@ -118,7 +119,7 @@ class I18nFile {
foreach ($translation as $compoundKey => $value) {
$keys = explode('.', $compoundKey);
array_shift($keys);
- eval("\$a['" . implode("']['", $keys) . "'] = '" . addcslashes($value, "'") . "';");
+ eval("\$a['" . implode("']['", $keys) . "'] = '" . addcslashes($value->__toString(), "'") . "';");
}
return $a;
@@ -131,7 +132,7 @@ class I18nFile {
* translation file. The array is first converted to a string then some
* formatting regexes are applied to match the original content.
*
- * @param array<string> $translation
+ * @param array<string,I18nValue> $translation
*/
private function format(array $translation): string {
$translation = var_export($this->unflatten($translation), true);
diff --git a/cli/i18n/I18nUsageValidator.php b/cli/i18n/I18nUsageValidator.php
index 49cc266f9..1267cd66d 100644
--- a/cli/i18n/I18nUsageValidator.php
+++ b/cli/i18n/I18nUsageValidator.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require_once __DIR__ . '/I18nValidatorInterface.php';
@@ -6,14 +7,14 @@ class I18nUsageValidator implements I18nValidatorInterface {
/** @var array<string> */
private array $code;
- /** @var array<string,array<string,string>> */
+ /** @var array<string,array<string,I18nValue>> */
private array $reference;
private int $totalEntries = 0;
private int $failedEntries = 0;
private string $result = '';
/**
- * @param array<string,array<string,string>> $reference
+ * @param array<string,array<string,I18nValue>> $reference
* @param array<string> $code
*/
public function __construct(array $reference, array $code) {
diff --git a/cli/i18n/I18nValidatorInterface.php b/cli/i18n/I18nValidatorInterface.php
index e6f5f7cdd..9266489f6 100644
--- a/cli/i18n/I18nValidatorInterface.php
+++ b/cli/i18n/I18nValidatorInterface.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
interface I18nValidatorInterface {
diff --git a/cli/i18n/I18nValue.php b/cli/i18n/I18nValue.php
index 4a1ddaeee..22317e1ae 100644
--- a/cli/i18n/I18nValue.php
+++ b/cli/i18n/I18nValue.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class I18nValue {
private const STATE_DIRTY = 'dirty';
@@ -13,7 +14,11 @@ class I18nValue {
private string $value;
private ?string $state = null;
- public function __construct(string $data) {
+ /** @param I18nValue|string $data */
+ public function __construct($data) {
+ if ($data instanceof I18nValue) {
+ $data = $data->__toString();
+ }
$data = explode(' -> ', $data);
$this->value = array_shift($data);
diff --git a/cli/import-for-user.php b/cli/import-for-user.php
index 405843133..212be7653 100755
--- a/cli/import-for-user.php
+++ b/cli/import-for-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/import-sqlite-for-user.php b/cli/import-sqlite-for-user.php
index 3d1fcc7bf..62a9d86c4 100755
--- a/cli/import-sqlite-for-user.php
+++ b/cli/import-sqlite-for-user.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
performRequirementCheck(FreshRSS_Context::$system_conf->db['type'] ?? '');
diff --git a/cli/list-users.php b/cli/list-users.php
index cfb76a22d..276239b25 100755
--- a/cli/list-users.php
+++ b/cli/list-users.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
$users = listUsers();
diff --git a/cli/manipulate.translation.php b/cli/manipulate.translation.php
index 4ef7101a3..611cdb0d5 100755
--- a/cli/manipulate.translation.php
+++ b/cli/manipulate.translation.php
@@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/i18n/I18nData.php';
require_once __DIR__ . '/i18n/I18nFile.php';
require_once __DIR__ . '/../constants.php';
diff --git a/cli/prepare.php b/cli/prepare.php
index e04cf7e19..ef6ebcc65 100755
--- a/cli/prepare.php
+++ b/cli/prepare.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
$dirs = array(
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index e6da4bddc..7d502a17a 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
$params = array(
diff --git a/cli/update-user.php b/cli/update-user.php
index adfc1dbdc..634a716e7 100755
--- a/cli/update-user.php
+++ b/cli/update-user.php
@@ -1,5 +1,7 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
+
$isUpdate = true;
require(__DIR__ . '/_update-or-create-user.php');
diff --git a/cli/user-info.php b/cli/user-info.php
index 525125758..f24f81078 100755
--- a/cli/user-info.php
+++ b/cli/user-info.php
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
+declare(strict_types=1);
require(__DIR__ . '/_cli.php');
const DATA_FORMAT = "%-7s | %-20s | %-5s | %-7s | %-25s | %-15s | %-10s | %-10s | %-10s | %-10s | %-10s | %-10s | %-5s | %-10s\n";
diff --git a/constants.php b/constants.php
index 6adacea51..5c5cedd6a 100644
--- a/constants.php
+++ b/constants.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
//NB: Do not edit; use ./constants.local.php instead.
//<Not customisable>
diff --git a/index.php b/index.php
index 828cca39a..d42135746 100644
--- a/index.php
+++ b/index.php
@@ -1,3 +1,5 @@
<?php
+declare(strict_types=1);
+
header('Location: p/', true, 301);
include('index.html');
diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php
index 68ef0695c..65771aa62 100644
--- a/lib/Minz/ActionController.php
+++ b/lib/Minz/ActionController.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/ActionException.php b/lib/Minz/ActionException.php
index 3c08b4892..dafc47a15 100644
--- a/lib/Minz/ActionException.php
+++ b/lib/Minz/ActionException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_ActionException extends Minz_Exception {
public function __construct(string $controller_name, string $action_name, int $code = self::ERROR) {
// Just for security, as we are not supposed to get non-alphanumeric characters.
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
index b667aa515..1aa4cae86 100644
--- a/lib/Minz/Configuration.php
+++ b/lib/Minz/Configuration.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Manage configuration for the application.
diff --git a/lib/Minz/ConfigurationException.php b/lib/Minz/ConfigurationException.php
index 498420a67..dbea6ea87 100644
--- a/lib/Minz/ConfigurationException.php
+++ b/lib/Minz/ConfigurationException.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
class Minz_ConfigurationException extends Minz_Exception {
public function __construct(string $error, int $code = self::ERROR) {
$message = 'Configuration error: ' . $error;
diff --git a/lib/Minz/ConfigurationNamespaceException.php b/lib/Minz/ConfigurationNamespaceException.php
index f4278c5d6..febe456c4 100644
--- a/lib/Minz/ConfigurationNamespaceException.php
+++ b/lib/Minz/ConfigurationNamespaceException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class Minz_ConfigurationNamespaceException extends Minz_ConfigurationException {
}
diff --git a/lib/Minz/ConfigurationParamException.php b/lib/Minz/ConfigurationParamException.php
index eac977935..93789b4dc 100644
--- a/lib/Minz/ConfigurationParamException.php
+++ b/lib/Minz/ConfigurationParamException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class Minz_ConfigurationParamException extends Minz_ConfigurationException {
}
diff --git a/lib/Minz/ConfigurationSetterInterface.php b/lib/Minz/ConfigurationSetterInterface.php
index ac8c154ba..f141a1a6f 100644
--- a/lib/Minz/ConfigurationSetterInterface.php
+++ b/lib/Minz/ConfigurationSetterInterface.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
interface Minz_ConfigurationSetterInterface {
diff --git a/lib/Minz/ControllerNotActionControllerException.php b/lib/Minz/ControllerNotActionControllerException.php
index 19e5df1b4..249ace2e1 100644
--- a/lib/Minz/ControllerNotActionControllerException.php
+++ b/lib/Minz/ControllerNotActionControllerException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_ControllerNotActionControllerException extends Minz_Exception {
public function __construct(string $controller_name, int $code = self::ERROR) {
$message = 'Controller `' . $controller_name . '` isn’t instance of ActionController';
diff --git a/lib/Minz/ControllerNotExistException.php b/lib/Minz/ControllerNotExistException.php
index 2d2178974..3ce181f09 100644
--- a/lib/Minz/ControllerNotExistException.php
+++ b/lib/Minz/ControllerNotExistException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_ControllerNotExistException extends Minz_Exception {
public function __construct(int $code = self::ERROR) {
$message = 'Controller not found!';
diff --git a/lib/Minz/CurrentPagePaginationException.php b/lib/Minz/CurrentPagePaginationException.php
index b3c8b2915..7d70c5af8 100644
--- a/lib/Minz/CurrentPagePaginationException.php
+++ b/lib/Minz/CurrentPagePaginationException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_CurrentPagePaginationException extends Minz_Exception {
public function __construct(int $page) {
$message = 'Page number `' . $page . '` doesn’t exist';
diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.php
index da46ce6cd..d5a1d7eb2 100644
--- a/lib/Minz/Dispatcher.php
+++ b/lib/Minz/Dispatcher.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php
index b6eac5174..e5a2cc794 100644
--- a/lib/Minz/Error.php
+++ b/lib/Minz/Error.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/Exception.php b/lib/Minz/Exception.php
index f2d3b876b..c306a14ca 100644
--- a/lib/Minz/Exception.php
+++ b/lib/Minz/Exception.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_Exception extends Exception {
const ERROR = 0;
const WARNING = 10;
diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php
index 8bc3ce964..7063f1c04 100644
--- a/lib/Minz/Extension.php
+++ b/lib/Minz/Extension.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The extension base class.
diff --git a/lib/Minz/ExtensionException.php b/lib/Minz/ExtensionException.php
index 730730c1d..83d60062e 100644
--- a/lib/Minz/ExtensionException.php
+++ b/lib/Minz/ExtensionException.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class Minz_ExtensionException extends Minz_Exception {
public function __construct(string $message, string $extension_name = '', int $code = self::ERROR) {
diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php
index fbb6d2a17..e1443b9c3 100644
--- a/lib/Minz/ExtensionManager.php
+++ b/lib/Minz/ExtensionManager.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* An extension manager to load extensions present in CORE_EXTENSIONS_PATH and THIRDPARTY_EXTENSIONS_PATH.
diff --git a/lib/Minz/FileNotExistException.php b/lib/Minz/FileNotExistException.php
index b467a5208..24cb1997a 100644
--- a/lib/Minz/FileNotExistException.php
+++ b/lib/Minz/FileNotExistException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_FileNotExistException extends Minz_Exception {
public function __construct(string $file_name, int $code = self::ERROR) {
$message = 'File not found: `' . $file_name.'`';
diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php
index d91fcfa68..09e986904 100644
--- a/lib/Minz/FrontController.php
+++ b/lib/Minz/FrontController.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
# ***** BEGIN LICENSE BLOCK *****
# MINZ - a free PHP Framework like Zend Framework
# Copyright (C) 2011 Marien Fressinaud
diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php
index 8ecc1af8d..642b9304c 100644
--- a/lib/Minz/Helper.php
+++ b/lib/Minz/Helper.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php
index 60aba319d..272f62f6b 100644
--- a/lib/Minz/Log.php
+++ b/lib/Minz/Log.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/Mailer.php b/lib/Minz/Mailer.php
index efdc9ea03..bd5e97ceb 100644
--- a/lib/Minz/Mailer.php
+++ b/lib/Minz/Mailer.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
diff --git a/lib/Minz/Migrator.php b/lib/Minz/Migrator.php
index 91a4e6cb1..c1978dc69 100644
--- a/lib/Minz/Migrator.php
+++ b/lib/Minz/Migrator.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The Minz_Migrator helps to migrate data (in a database or not) or the
diff --git a/lib/Minz/Model.php b/lib/Minz/Model.php
index bf6da1599..ee65d7d9c 100644
--- a/lib/Minz/Model.php
+++ b/lib/Minz/Model.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.php
index 1b17c1da6..090536623 100644
--- a/lib/Minz/ModelArray.php
+++ b/lib/Minz/ModelArray.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php
index 1e67fef9f..c78f44f2e 100644
--- a/lib/Minz/ModelPdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
@@ -57,7 +58,7 @@ class Minz_ModelPdo {
break;
case 'sqlite':
$dsn = 'sqlite:' . DATA_PATH . '/users/' . $this->current_user . '/db.sqlite';
- $this->pdo = new Minz_PdoSqlite($dsn . $dsnParams, $db['user'], $db['password'], $driver_options);
+ $this->pdo = new Minz_PdoSqlite($dsn . $dsnParams, null, null, $driver_options);
$this->pdo->setPrefix('');
break;
case 'pgsql':
diff --git a/lib/Minz/PDOConnectionException.php b/lib/Minz/PDOConnectionException.php
index 2b015607e..391db5cae 100644
--- a/lib/Minz/PDOConnectionException.php
+++ b/lib/Minz/PDOConnectionException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_PDOConnectionException extends Minz_Exception {
public function __construct(string $error, string $user, int $code = self::ERROR) {
$message = 'Access to database is denied for `' . $user . '`: ' . $error;
diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php
index 6b185c8b8..df145f4bf 100644
--- a/lib/Minz/Paginator.php
+++ b/lib/Minz/Paginator.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/Pdo.php b/lib/Minz/Pdo.php
index 477ce7c1f..3d613e832 100644
--- a/lib/Minz/Pdo.php
+++ b/lib/Minz/Pdo.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
diff --git a/lib/Minz/PdoMysql.php b/lib/Minz/PdoMysql.php
index df17a2f52..0171141ba 100644
--- a/lib/Minz/PdoMysql.php
+++ b/lib/Minz/PdoMysql.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
diff --git a/lib/Minz/PdoPgsql.php b/lib/Minz/PdoPgsql.php
index e0efb8ad1..2abf168d9 100644
--- a/lib/Minz/PdoPgsql.php
+++ b/lib/Minz/PdoPgsql.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
diff --git a/lib/Minz/PdoSqlite.php b/lib/Minz/PdoSqlite.php
index a66923ff2..1fd5c8d7a 100644
--- a/lib/Minz/PdoSqlite.php
+++ b/lib/Minz/PdoSqlite.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* MINZ - Copyright 2011 Marien Fressinaud
diff --git a/lib/Minz/PermissionDeniedException.php b/lib/Minz/PermissionDeniedException.php
index 91a4b310e..240a8c3d4 100644
--- a/lib/Minz/PermissionDeniedException.php
+++ b/lib/Minz/PermissionDeniedException.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
class Minz_PermissionDeniedException extends Minz_Exception {
public function __construct(string $file_name, int $code = self::ERROR) {
$message = 'Permission is denied for `' . $file_name.'`';
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php
index af2ba1243..0ac1a9fe3 100644
--- a/lib/Minz/Request.php
+++ b/lib/Minz/Request.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
@@ -333,7 +335,7 @@ class Minz_Request {
private static function setNotification(string $type, string $content): void {
Minz_Session::lock();
- $requests = Minz_Session::param('requests', []);
+ $requests = Minz_Session::paramArray('requests');
$requests[self::requestId()] = [
'time' => time(),
'notification' => [ 'type' => $type, 'content' => $content ],
@@ -350,14 +352,15 @@ class Minz_Request {
self::setNotification('bad', $content);
}
- /** @return array<string,string>|null */
+ /** @return array{type:string,content:string}|null */
public static function getNotification(): ?array {
$notif = null;
Minz_Session::lock();
- $requests = Minz_Session::param('requests');
- if (is_array($requests)) {
+ /** @var array<string,array{time:int,notification:array{type:string,content:string}}> */
+ $requests = Minz_Session::paramArray('requests');
+ if (!empty($requests)) {
//Delete abandoned notifications
- $requests = array_filter($requests, static function (array $r) { return isset($r['time']) && $r['time'] > time() - 3600; });
+ $requests = array_filter($requests, static function (array $r) { return $r['time'] > time() - 3600; });
$requestId = self::requestId();
if (!empty($requests[$requestId]['notification'])) {
diff --git a/lib/Minz/Session.php b/lib/Minz/Session.php
index 137f66b7a..4372c2683 100644
--- a/lib/Minz/Session.php
+++ b/lib/Minz/Session.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The Minz_Session class handles user’s session
@@ -60,11 +61,60 @@ class Minz_Session {
* @param string $p the parameter to retrieve
* @param mixed|false $default the default value if the parameter doesn’t exist
* @return mixed|false the value of the session variable, false if doesn’t exist
+ * @deprecated Use typed versions instead
*/
- public static function param(string $p, $default = false) {
+ private static function param(string $p, $default = false) {
return $_SESSION[$p] ?? $default;
}
+ /** @return array<string|int,string|array<string,mixed>> */
+ public static function paramArray(string $key): array {
+ if (empty($_SESSION[$key]) || !is_array($_SESSION[$key])) {
+ return [];
+ }
+ return $_SESSION[$key];
+ }
+
+ public static function paramTernary(string $key): ?bool {
+ if (isset($_SESSION[$key])) {
+ $p = $_SESSION[$key];
+ $tp = is_string($p) ? trim($p) : true;
+ if ($tp === '' || $tp === 'null') {
+ return null;
+ } elseif ($p == false || $tp == '0' || $tp === 'false' || $tp === 'no') {
+ return false;
+ }
+ return true;
+ }
+ return null;
+ }
+
+ public static function paramBoolean(string $key): bool {
+ if (null === $value = self::paramTernary($key)) {
+ return false;
+ }
+ return $value;
+ }
+
+ public static function paramInt(string $key): int {
+ if (!empty($_SESSION[$key])) {
+ return intval($_SESSION[$key]);
+ }
+ return 0;
+ }
+
+ public static function paramString(string $key): string {
+ if (isset($_SESSION[$key])) {
+ $s = $_SESSION[$key];
+ if (is_string($s)) {
+ return $s;
+ }
+ if (is_int($s) || is_bool($s)) {
+ return (string)$s;
+ }
+ }
+ return '';
+ }
/**
* Allows you to create or update a session variable
diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php
index dfeee2ff9..8f2e2527a 100644
--- a/lib/Minz/Translate.php
+++ b/lib/Minz/Translate.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/Minz/Url.php b/lib/Minz/Url.php
index f6fa809cf..0c17e3ec7 100644
--- a/lib/Minz/Url.php
+++ b/lib/Minz/Url.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The Minz_Url class handles URLs across the MINZ framework
diff --git a/lib/Minz/User.php b/lib/Minz/User.php
index 252584e83..8e90a4fb2 100644
--- a/lib/Minz/User.php
+++ b/lib/Minz/User.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* The Minz_User class handles the user information.
@@ -13,7 +14,7 @@ final class Minz_User {
* @return string the name of the current user, or null if there is none
*/
public static function name(): ?string {
- $currentUser = trim(Minz_Session::param(Minz_User::CURRENT_USER, ''));
+ $currentUser = trim(Minz_Session::paramString(Minz_User::CURRENT_USER));
return $currentUser === '' ? null : $currentUser;
}
diff --git a/lib/Minz/View.php b/lib/Minz/View.php
index 87b85e190..da6e55a23 100644
--- a/lib/Minz/View.php
+++ b/lib/Minz/View.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
diff --git a/lib/SimplePie/SimplePie/IRI.php b/lib/SimplePie/SimplePie/IRI.php
index a02de682c..36c051bff 100644
--- a/lib/SimplePie/SimplePie/IRI.php
+++ b/lib/SimplePie/SimplePie/IRI.php
@@ -263,9 +263,9 @@ class SimplePie_IRI
*
* Returns false if $base is not absolute, otherwise an IRI.
*
- * @param IRI|string $base (Absolute) Base IRI
- * @param IRI|string $relative Relative IRI
- * @return IRI|false
+ * @param SimplePie_IRI|string $base (Absolute) Base IRI
+ * @param SimplePie_IRI|string $relative Relative IRI
+ * @return SimplePie_IRI|false
*/
public static function absolutize($base, $relative)
{
diff --git a/lib/favicons.php b/lib/favicons.php
index b161215b2..5cf4295f5 100644
--- a/lib/favicons.php
+++ b/lib/favicons.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
const FAVICONS_DIR = DATA_PATH . '/favicons/';
const DEFAULT_FAVICON = PUBLIC_PATH . '/themes/icons/default_favicon.ico';
@@ -99,8 +101,12 @@ function searchFavicon(string &$url): string {
}
$href = SimplePie_IRI::absolutize($baseUrl, $href);
+ if ($href == false) {
+ return '';
+ }
- $favicon = downloadHttp($href, array(CURLOPT_REFERER => $url));
+ $iri = $href->get_iri();
+ $favicon = downloadHttp($iri, array(CURLOPT_REFERER => $url));
if (isImgMime($favicon)) {
return $favicon;
}
diff --git a/lib/http-conditional.php b/lib/http-conditional.php
index 21382b735..2ed597a71 100644
--- a/lib/http-conditional.php
+++ b/lib/http-conditional.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/*
Enable support for HTTP/1.x conditional requests in PHP.
Goal: Optimisation
diff --git a/lib/lib_date.php b/lib/lib_date.php
index 70c1517af..ee8bf92f6 100644
--- a/lib/lib_date.php
+++ b/lib/lib_date.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* Author: Alexandre Alapetite https://alexandre.alapetite.fr
* 2014-06-01
diff --git a/lib/lib_install.php b/lib/lib_install.php
index 80af02d4f..720c4bf77 100644
--- a/lib/lib_install.php
+++ b/lib/lib_install.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
FreshRSS_SystemConfiguration::register('default_system', join_path(FRESHRSS_PATH, 'config.default.php'));
FreshRSS_UserConfiguration::register('default_user', join_path(FRESHRSS_PATH, 'config-user.default.php'));
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 648f11a74..7a65a0433 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
if (version_compare(PHP_VERSION, FRESHRSS_MIN_PHP_VERSION, '<')) {
die(sprintf('FreshRSS error: FreshRSS requires PHP %s+!', FRESHRSS_MIN_PHP_VERSION));
}
diff --git a/p/api/fever.php b/p/api/fever.php
index 331a5a831..cc5778e9f 100644
--- a/p/api/fever.php
+++ b/p/api/fever.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
* Fever API for FreshRSS
* Version 0.1
diff --git a/p/api/greader.php b/p/api/greader.php
index 77defb326..67d82cf4d 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
/**
== Description ==
Server-side API compatible with Google Reader API layer 2
diff --git a/p/api/index.php b/p/api/index.php
index 6ca7e1b6d..686e74240 100644
--- a/p/api/index.php
+++ b/p/api/index.php
@@ -1,4 +1,7 @@
-<!DOCTYPE html>
+<?php
+ declare(strict_types=1);
+?>
+<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
<head>
<meta charset="UTF-8" />
diff --git a/p/api/pshb.php b/p/api/pshb.php
index f69329f1b..85bc5681a 100644
--- a/p/api/pshb.php
+++ b/p/api/pshb.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require(__DIR__ . '/../../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
diff --git a/p/ext.php b/p/ext.php
index abc07ad12..788488b27 100644
--- a/p/ext.php
+++ b/p/ext.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require(__DIR__ . '/../constants.php');
// Supported types with their associated content type
diff --git a/p/f.php b/p/f.php
index 43905775a..7ba4bf11e 100644
--- a/p/f.php
+++ b/p/f.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require(__DIR__ . '/../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
require(LIB_PATH . '/favicons.php');
diff --git a/p/i/index.php b/p/i/index.php
index 76fb54a4b..fbd9553ad 100644
--- a/p/i/index.php
+++ b/p/i/index.php
@@ -1,4 +1,6 @@
<?php
+declare(strict_types=1);
+
// > Error: FreshRSS requires PHP, which does not seem to be installed or configured correctly! <!--
# ***** BEGIN LICENSE BLOCK *****
diff --git a/p/index.php b/p/index.php
index 65d3a8c3f..76c43fb59 100644
--- a/p/index.php
+++ b/p/index.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
require(__DIR__ . '/../constants.php');
require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader
diff --git a/tests/app/Models/CategoryTest.php b/tests/app/Models/CategoryTest.php
index afa74d53f..bdb2a971b 100644
--- a/tests/app/Models/CategoryTest.php
+++ b/tests/app/Models/CategoryTest.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class CategoryTest extends PHPUnit\Framework\TestCase {
diff --git a/tests/app/Models/SearchTest.php b/tests/app/Models/SearchTest.php
index afec683d5..12159caeb 100644
--- a/tests/app/Models/SearchTest.php
+++ b/tests/app/Models/SearchTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require_once(LIB_PATH . '/lib_date.php');
class SearchTest extends PHPUnit\Framework\TestCase {
diff --git a/tests/app/Models/UserQueryTest.php b/tests/app/Models/UserQueryTest.php
index 668327139..9f067e848 100644
--- a/tests/app/Models/UserQueryTest.php
+++ b/tests/app/Models/UserQueryTest.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* Description of UserQueryTest
diff --git a/tests/app/Utils/passwordUtilTest.php b/tests/app/Utils/passwordUtilTest.php
index e2fe78b97..c6d7a37e9 100644
--- a/tests/app/Utils/passwordUtilTest.php
+++ b/tests/app/Utils/passwordUtilTest.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class passwordUtilTest extends PHPUnit\Framework\TestCase {
public function testCheck(): void {
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index c99fecaf0..447b038a4 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
error_reporting(E_ALL);
ini_set('display_errors', 1);
diff --git a/tests/cli/i18n/I18nCompletionValidatorTest.php b/tests/cli/i18n/I18nCompletionValidatorTest.php
index 3c6fc99eb..03896c11b 100644
--- a/tests/cli/i18n/I18nCompletionValidatorTest.php
+++ b/tests/cli/i18n/I18nCompletionValidatorTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/../../../cli/i18n/I18nCompletionValidator.php';
require_once __DIR__ . '/../../../cli/i18n/I18nValue.php';
diff --git a/tests/cli/i18n/I18nDataTest.php b/tests/cli/i18n/I18nDataTest.php
index ca578a94b..b2fa5c5fd 100644
--- a/tests/cli/i18n/I18nDataTest.php
+++ b/tests/cli/i18n/I18nDataTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/../../../cli/i18n/I18nData.php';
require_once __DIR__ . '/../../../cli/i18n/I18nValue.php';
diff --git a/tests/cli/i18n/I18nFileTest.php b/tests/cli/i18n/I18nFileTest.php
index 47464c2e2..755ea12f2 100644
--- a/tests/cli/i18n/I18nFileTest.php
+++ b/tests/cli/i18n/I18nFileTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/../../../cli/i18n/I18nFile.php';
class I18nFileTest extends PHPUnit\Framework\TestCase {
diff --git a/tests/cli/i18n/I18nUsageValidatorTest.php b/tests/cli/i18n/I18nUsageValidatorTest.php
index f2c7b5651..720cab32e 100644
--- a/tests/cli/i18n/I18nUsageValidatorTest.php
+++ b/tests/cli/i18n/I18nUsageValidatorTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/../../../cli/i18n/I18nValue.php';
require_once __DIR__ . '/../../../cli/i18n/I18nUsageValidator.php';
diff --git a/tests/cli/i18n/I18nValueTest.php b/tests/cli/i18n/I18nValueTest.php
index 4454ea073..06d57eb08 100644
--- a/tests/cli/i18n/I18nValueTest.php
+++ b/tests/cli/i18n/I18nValueTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
require_once __DIR__ . '/../../../cli/i18n/I18nValue.php';
class I18nValueTest extends PHPUnit\Framework\TestCase {
diff --git a/tests/fixtures/migrations/2019_12_22_FooBar.php b/tests/fixtures/migrations/2019_12_22_FooBar.php
index 21f673213..4a5bcb314 100644
--- a/tests/fixtures/migrations/2019_12_22_FooBar.php
+++ b/tests/fixtures/migrations/2019_12_22_FooBar.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Migration_2019_12_22_FooBar {
/**
diff --git a/tests/fixtures/migrations/2019_12_23_Baz.php b/tests/fixtures/migrations/2019_12_23_Baz.php
index 056b0836c..05513c385 100644
--- a/tests/fixtures/migrations/2019_12_23_Baz.php
+++ b/tests/fixtures/migrations/2019_12_23_Baz.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Migration_2019_12_23_Baz {
/**
diff --git a/tests/fixtures/migrations_with_failing/2020_01_11_FooBar.php b/tests/fixtures/migrations_with_failing/2020_01_11_FooBar.php
index 2edc79964..6816f582a 100644
--- a/tests/fixtures/migrations_with_failing/2020_01_11_FooBar.php
+++ b/tests/fixtures/migrations_with_failing/2020_01_11_FooBar.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Migration_2020_01_11_FooBar {
/**
diff --git a/tests/fixtures/migrations_with_failing/2020_01_12_Baz.php b/tests/fixtures/migrations_with_failing/2020_01_12_Baz.php
index 75f39f7b5..92a9fad63 100644
--- a/tests/fixtures/migrations_with_failing/2020_01_12_Baz.php
+++ b/tests/fixtures/migrations_with_failing/2020_01_12_Baz.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class FreshRSS_Migration_2020_01_12_Baz {
/**
diff --git a/tests/lib/CssXPath/CssXPathTest.php b/tests/lib/CssXPath/CssXPathTest.php
index 1cfbcf58f..ed92ece16 100644
--- a/tests/lib/CssXPath/CssXPathTest.php
+++ b/tests/lib/CssXPath/CssXPathTest.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class CssXPathTest extends PHPUnit\Framework\TestCase
{
diff --git a/tests/lib/Minz/MigratorTest.php b/tests/lib/Minz/MigratorTest.php
index 1803e6e86..5d090b2fa 100644
--- a/tests/lib/Minz/MigratorTest.php
+++ b/tests/lib/Minz/MigratorTest.php
@@ -1,5 +1,5 @@
<?php
-
+declare(strict_types=1);
use PHPUnit\Framework\TestCase;
class MigratorTest extends TestCase
diff --git a/tests/lib/PHPMailer/PHPMailerTest.php b/tests/lib/PHPMailer/PHPMailerTest.php
index 5873c58a9..021337a3b 100644
--- a/tests/lib/PHPMailer/PHPMailerTest.php
+++ b/tests/lib/PHPMailer/PHPMailerTest.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
class PHPMailerTest extends PHPUnit\Framework\TestCase
{