From aedd66202ac0e798d0ab387c382af6bf5b6ce306 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 18 May 2025 11:24:33 +0200 Subject: [PATCH] upgrade Codeigniter4.6.1 --- app/.htaccess | 4 +- app/Common.php | 4 +- app/Config/App.php | 40 +++++------ app/Config/Autoload.php | 2 - app/Config/CURLRequest.php | 2 +- app/Config/Cache.php | 15 +--- app/Config/Constants.php | 15 ---- app/Config/ContentSecurityPolicy.php | 66 ++++++++---------- app/Config/Cookie.php | 4 +- app/Config/Database.php | 46 +++++++------ app/Config/DocTypes.php | 3 - app/Config/Events.php | 4 +- app/Config/Feature.php | 12 +++- app/Config/Format.php | 21 ++---- app/Config/Images.php | 10 +-- app/Config/Kint.php | 2 - app/Config/Logger.php | 1 - app/Config/Mimes.php | 6 +- app/Config/Modules.php | 2 - app/Config/Optimize.php | 2 - app/Config/Pager.php | 6 +- app/Config/Paths.php | 21 ++---- app/Config/Routing.php | 2 +- app/Config/Security.php | 17 ----- app/Config/Toolbar.php | 2 +- app/Config/UserAgents.php | 8 +-- app/Config/Validation.php | 16 ++--- app/Controllers/BaseController.php | 12 +++- app/Views/errors/cli/error_exception.php | 4 +- app/Views/errors/html/debug.css | 12 ++-- app/Views/errors/html/error_400.php | 84 +++++++++++++++++++++++ app/Views/errors/html/error_exception.php | 5 +- app/Views/errors/html/production.php | 8 +-- public/.htaccess | 2 +- public/index.php | 9 ++- writable/debugbar/.gitkeep | 0 writable/index.html | 11 +++ 37 files changed, 255 insertions(+), 225 deletions(-) create mode 100644 app/Views/errors/html/error_400.php delete mode 100755 writable/debugbar/.gitkeep create mode 100644 writable/index.html diff --git a/app/.htaccess b/app/.htaccess index f24db0a..3462048 100644 --- a/app/.htaccess +++ b/app/.htaccess @@ -1,6 +1,6 @@ - Require all denied + Require all denied - Deny from all + Deny from all diff --git a/app/Common.php b/app/Common.php index a74d46d..95f5544 100644 --- a/app/Common.php +++ b/app/Common.php @@ -4,12 +4,12 @@ * The goal of this file is to allow developers a location * where they can overwrite core procedural functions and * replace them with their own. This file is loaded during - * the bootstrap process and is called during the frameworks + * the bootstrap process and is called during the framework's * execution. * * This can be looked at as a `master helper` file that is * loaded early on, and may also contain additional functions * that you'd like to use throughout your entire application * - * @see: https://codeigniter4.github.io/CodeIgniter4/ + * @see: https://codeigniter.com/user_guide/extending/common.html */ diff --git a/app/Config/App.php b/app/Config/App.php index 21f258b..69339c6 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -11,24 +11,19 @@ class App extends BaseConfig * Base Site URL * -------------------------------------------------------------------------- * - * URL to your CodeIgniter root. Typically this will be your base URL, + * URL to your CodeIgniter root. Typically, this will be your base URL, * WITH a trailing slash: * - * http://example.com/ - * - * If this is not set then CodeIgniter will try guess the protocol, domain - * and path to your installation. However, you should always configure this - * explicitly and never rely on auto-guessing, especially in production - * environments. + * E.g., http://example.com/ */ public string $baseURL = 'https://finanzen.mawim.at'; //public $nodeRedUrl = 'https://mqtt.mawim.at/api/'; public string $nodeRedUrl = 'http://localhost:1880/api/'; public string $speedTestUrl = 'http://mqtt.mawim.at:3000/d/qsjZJaYVz/ping-results?orgId=1&from=now-2d&to=now&var-client=nextcloud&kiosk'; - public string $spritPreisUrl = 'http://mqtt.mawim.at:3000/d/b1fce188-593b-4629-9a73-6bd11c2998bd/spritpreis?orgId=1&viewPanel=1&from=now-7d&to=now&kiosk'; + public string $spritPreisUrl = 'https://mqtt.mawim.at/mychart/sprit'; public bool $disableShield = false; - /** + /** * Allowed Hostnames in the Site URL other than the hostname in the baseURL. * If you want to accept multiple Hostnames, set this. * @@ -46,9 +41,9 @@ class App extends BaseConfig * Index File * -------------------------------------------------------------------------- * - * Typically this will be your index.php file, unless you've renamed it to - * something else. If you are using mod_rewrite to remove the page set this - * variable so that it is blank. + * Typically, this will be your `index.php` file, unless you've renamed it to + * something else. If you have configured your web server to remove this file + * from your site URIs, set this variable to an empty string. */ public string $indexPage = 'index.php'; @@ -58,12 +53,12 @@ class App extends BaseConfig * -------------------------------------------------------------------------- * * This item determines which server global should be used to retrieve the - * URI string. The default setting of 'REQUEST_URI' works for most servers. + * URI string. The default setting of 'REQUEST_URI' works for most servers. * If your links do not seem to work, try one of the other delicious flavors: * - * 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] - * 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] - * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] + * 'REQUEST_URI': Uses $_SERVER['REQUEST_URI'] + * 'QUERY_STRING': Uses $_SERVER['QUERY_STRING'] + * 'PATH_INFO': Uses $_SERVER['PATH_INFO'] * * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! */ @@ -126,6 +121,8 @@ class App extends BaseConfig * by the application in descending order of priority. If no match is * found, the first locale will be used. * + * IncomingRequest::setLocale() also uses this list. + * * @var list */ public array $supportedLocales = ['de']; @@ -137,6 +134,9 @@ class App extends BaseConfig * * The default timezone that will be used in your application to display * dates with the date helper, and can be retrieved through app_timezone() + * + * @see https://www.php.net/manual/en/timezones.php for list of timezones + * supported by PHP. */ public string $appTimezone = 'Europe/Vienna'; @@ -154,17 +154,17 @@ class App extends BaseConfig /** * -------------------------------------------------------------------------- - * URI PROTOCOL + * Force Global Secure Requests * -------------------------------------------------------------------------- * * If true, this will force every request made to this application to be * made via a secure connection (HTTPS). If the incoming request is not * secure, the user will be redirected to a secure version of the page - * and the HTTP Strict Transport Security header will be set. + * and the HTTP Strict Transport Security (HSTS) header will be set. */ public bool $forceGlobalSecureRequests = false; - /** + /** * -------------------------------------------------------------------------- * Reverse Proxy IPs * -------------------------------------------------------------------------- @@ -204,4 +204,4 @@ class App extends BaseConfig * @see http://www.w3.org/TR/CSP/ */ public bool $CSPEnabled = false; - } +} diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 2464e8b..443ee66 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -17,8 +17,6 @@ use CodeIgniter\Config\AutoloadConfig; * * NOTE: This class is required prior to Autoloader instantiation, * and does not extend BaseConfig. - * - * @immutable */ class Autoload extends AutoloadConfig { diff --git a/app/Config/CURLRequest.php b/app/Config/CURLRequest.php index e8c5bc5..5a3d4e9 100644 --- a/app/Config/CURLRequest.php +++ b/app/Config/CURLRequest.php @@ -15,6 +15,6 @@ class CURLRequest extends BaseConfig * * If true, all the options won't be reset between requests. * It may cause an error request with unnecessary headers. - */ + */ public bool $shareOptions = false; } diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 3fbade6..e6efa3a 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -34,18 +34,6 @@ class Cache extends BaseConfig */ public string $backupHandler = 'dummy'; - /** - * -------------------------------------------------------------------------- - * Cache Directory Path - * -------------------------------------------------------------------------- - * - * The path to where cache files should be stored, if using a file-based - * system. - * - * @deprecated Use the driver-specific variant under $file - */ - public string $storePath = WRITEPATH . 'cache/'; - /** * -------------------------------------------------------------------------- * Key Prefix @@ -86,6 +74,7 @@ class Cache extends BaseConfig * -------------------------------------------------------------------------- * File settings * -------------------------------------------------------------------------- + * * Your file storage preferences can be specified below, if you are using * the File driver. * @@ -100,6 +89,7 @@ class Cache extends BaseConfig * ------------------------------------------------------------------------- * Memcached settings * ------------------------------------------------------------------------- + * * Your Memcached servers can be specified below, if you are using * the Memcached drivers. * @@ -118,6 +108,7 @@ class Cache extends BaseConfig * ------------------------------------------------------------------------- * Redis settings * ------------------------------------------------------------------------- + * * Your Redis server can be specified below, if you are using * the Redis or Predis drivers. * diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 8db1e8e..f319cde 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -77,18 +77,3 @@ defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid u defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code - -/** - * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead. - */ -define('EVENT_PRIORITY_LOW', 200); - -/** - * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead. - */ -define('EVENT_PRIORITY_NORMAL', 100); - -/** - * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead. - */ -define('EVENT_PRIORITY_HIGH', 10); diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index aa18ba9..2ac41a7 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -15,64 +15,58 @@ use CodeIgniter\Config\BaseConfig; */ class ContentSecurityPolicy extends BaseConfig { - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // Broadbrush CSP management - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- /** * Default CSP report context - * - * @var bool */ - public $reportOnly = false; + public bool $reportOnly = false; /** * Specifies a URL where a browser will send reports * when a content security policy is violated. - * - * @var string|null */ - public $reportURI; + public ?string $reportURI = null; /** * Instructs user agents to rewrite URL schemes, changing * HTTP to HTTPS. This directive is for websites with * large numbers of old URLs that need to be rewritten. - * - * @var bool */ - public $upgradeInsecureRequests = false; + public bool $upgradeInsecureRequests = false; - //------------------------------------------------------------------------- + // ------------------------------------------------------------------------- // Sources allowed - // Note: once you set a policy to 'none', it cannot be further restricted - //------------------------------------------------------------------------- + // NOTE: once you set a policy to 'none', it cannot be further restricted + // ------------------------------------------------------------------------- /** * Will default to self if not overridden * - * @var string|string[]|null + * @var list|string|null */ public $defaultSrc; /** * Lists allowed scripts' URLs. * - * @var string|string[] + * @var list|string */ public $scriptSrc = 'self'; /** * Lists allowed stylesheets' URLs. * - * @var string|string[] + * @var list|string */ public $styleSrc = 'self'; /** * Defines the origins from which images can be loaded. * - * @var string|string[] + * @var list|string */ public $imageSrc = 'self'; @@ -81,14 +75,14 @@ class ContentSecurityPolicy extends BaseConfig * * Will default to self if not overridden * - * @var string|string[]|null + * @var list|string|null */ public $baseURI; /** * Lists the URLs for workers and embedded frame contents * - * @var string|string[] + * @var list|string */ public $childSrc = 'self'; @@ -96,21 +90,21 @@ class ContentSecurityPolicy extends BaseConfig * Limits the origins that you can connect to (via XHR, * WebSockets, and EventSource). * - * @var string|string[] + * @var list|string */ public $connectSrc = 'self'; /** * Specifies the origins that can serve web fonts. * - * @var string|string[] + * @var list|string */ public $fontSrc; /** * Lists valid endpoints for submission from `
` tags. * - * @var string|string[] + * @var list|string */ public $formAction = 'self'; @@ -120,7 +114,7 @@ class ContentSecurityPolicy extends BaseConfig * and `` tags. This directive can't be used in * `` tags and applies only to non-HTML resources. * - * @var string|string[]|null + * @var list|string|null */ public $frameAncestors; @@ -128,61 +122,55 @@ class ContentSecurityPolicy extends BaseConfig * The frame-src directive restricts the URLs which may * be loaded into nested browsing contexts. * - * @var array|string|null + * @var list|string|null */ public $frameSrc; /** * Restricts the origins allowed to deliver video and audio. * - * @var string|string[]|null + * @var list|string|null */ public $mediaSrc; /** * Allows control over Flash and other plugins. * - * @var string|string[] + * @var list|string */ public $objectSrc = 'self'; /** - * @var string|string[]|null + * @var list|string|null */ public $manifestSrc; /** * Limits the kinds of plugins a page may invoke. * - * @var string|string[]|null + * @var list|string|null */ public $pluginTypes; /** * List of actions allowed. * - * @var string|string[]|null + * @var list|string|null */ public $sandbox; /** * Nonce tag for style - * - * @var string */ - public $styleNonceTag = '{csp-style-nonce}'; + public string $styleNonceTag = '{csp-style-nonce}'; /** * Nonce tag for script - * - * @var string */ - public $scriptNonceTag = '{csp-script-nonce}'; + public string $scriptNonceTag = '{csp-script-nonce}'; /** * Replace nonce tag automatically - * - * @var bool */ - public $autoNonce = true; + public bool $autoNonce = true; } diff --git a/app/Config/Cookie.php b/app/Config/Cookie.php index 93446bc..84ccc0e 100644 --- a/app/Config/Cookie.php +++ b/app/Config/Cookie.php @@ -44,7 +44,7 @@ class Cookie extends BaseConfig * -------------------------------------------------------------------------- * * Set to `.your-domain.com` for site-wide cookies. - */ + */ public string $domain = ''; /** @@ -84,6 +84,8 @@ class Cookie extends BaseConfig * Defaults to `Lax` for compatibility with modern browsers. Setting `''` * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$secure` must also be set. + * + * @phpstan-var 'None'|'Lax'|'Strict'|'' */ public string $samesite = 'Lax'; diff --git a/app/Config/Database.php b/app/Config/Database.php index ed23d30..d37a1e8 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -10,46 +10,46 @@ use CodeIgniter\Database\Config; class Database extends Config { /** - * The directory that holds the Migrations - * and Seeds directories. - * - * @var string + * The directory that holds the Migrations and Seeds directories. */ - public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR; + public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR; /** - * Lets you choose which connection group to - * use if no other is specified. - * - * @var string + * Lets you choose which connection group to use if no other is specified. */ - public $defaultGroup = 'default'; + public string $defaultGroup = 'default'; /** * The default database connection. * - * @var array + * @var array */ public $default = [ -// 'DSN' => 'host=192.168.16.14;dbname=mawim;user=finanzen;password=/mA!FZ22Wi', 'hostname' => '192.168.16.14', 'database' => 'mawim', 'username' => 'finanzen', 'password' => '/mA!FZ22Wi', + 'schema' => 'finanzen,verwaltung', 'port' => 5432, 'charset' => 'utf8', 'DBDriver' => 'Postgre', 'DBDebug' => false, - 'schema' => 'finanzen,verwaltung', + + 'swapPre' => '', + 'failover' => [], + 'dateFormat' => [ + 'date' => 'Y-m-d', + 'datetime' => 'Y-m-d H:i:s', + 'time' => 'H:i:s', + ], ]; /** - * This database connection is used when - * running PHPUnit database tests. + * This database connection is used when running PHPUnit database tests. * - * @var array + * @var array */ - public $tests = [ + public array $tests = [ 'DSN' => '', 'hostname' => '127.0.0.1', 'username' => '', @@ -58,9 +58,9 @@ class Database extends Config 'DBDriver' => 'SQLite3', 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS 'pConnect' => false, - 'DBDebug' => (ENVIRONMENT !== 'production'), - 'charset' => 'utf8mb4', - 'DBCollat' => 'utf8mb4_general_ci', + 'DBDebug' => true, + 'charset' => 'utf8', + 'DBCollat' => '', 'swapPre' => '', 'encrypt' => false, 'compress' => false, @@ -68,6 +68,12 @@ class Database extends Config 'failover' => [], 'port' => 3306, 'foreignKeys' => true, + 'busyTimeout' => 1000, + 'dateFormat' => [ + 'date' => 'Y-m-d', + 'datetime' => 'Y-m-d H:i:s', + 'time' => 'H:i:s', + ], ]; public function __construct() diff --git a/app/Config/DocTypes.php b/app/Config/DocTypes.php index 7e8aaac..788d68f 100755 --- a/app/Config/DocTypes.php +++ b/app/Config/DocTypes.php @@ -2,9 +2,6 @@ namespace Config; -/** - * @immutable - */ class DocTypes { /** diff --git a/app/Config/Events.php b/app/Config/Events.php index 62a7b86..946285b 100644 --- a/app/Config/Events.php +++ b/app/Config/Events.php @@ -44,10 +44,10 @@ Events::on('pre_system', static function (): void { */ if (CI_DEBUG && ! is_cli()) { Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); - Services::toolbar()->respond(); + service('toolbar')->respond(); // Hot Reload route - for framework use on the hot reloader. if (ENVIRONMENT === 'development') { - Services::routes()->get('__hot-reload', static function (): void { + service('routes')->get('__hot-reload', static function (): void { (new HotReloader())->run(); }); } diff --git a/app/Config/Feature.php b/app/Config/Feature.php index efd4a0b..ec1435a 100644 --- a/app/Config/Feature.php +++ b/app/Config/Feature.php @@ -10,9 +10,9 @@ use CodeIgniter\Config\BaseConfig; class Feature extends BaseConfig { /** - * Use improved new auto routing instead of the default legacy version. + * Use improved new auto routing instead of the legacy version. */ - public bool $autoRoutesImproved = false; + public bool $autoRoutesImproved = true; /** * Use filter execution order in 4.4 or before. @@ -26,4 +26,12 @@ class Feature extends BaseConfig * If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.) */ public bool $limitZeroAsAll = true; + + /** + * Use strict location negotiation. + * + * By default, the locale is selected based on a loose comparison of the language code (ISO 639-1) + * Enabling strict comparison will also consider the region code (ISO 3166-1 alpha-2). + */ + public bool $strictLocaleNegotiation = false; } diff --git a/app/Config/Format.php b/app/Config/Format.php index d89e408..0d334d7 100644 --- a/app/Config/Format.php +++ b/app/Config/Format.php @@ -3,7 +3,6 @@ namespace Config; use CodeIgniter\Config\BaseConfig; -use CodeIgniter\Format\FormatterInterface; use CodeIgniter\Format\JSONFormatter; use CodeIgniter\Format\XMLFormatter; @@ -22,9 +21,9 @@ class Format extends BaseConfig * These formats are only checked when the data passed to the respond() * method is an array. * - * @var string[] + * @var list */ - public $supportedResponseFormats = [ + public array $supportedResponseFormats = [ 'application/json', 'application/xml', // machine-readable XML 'text/xml', // human-readable XML @@ -41,7 +40,7 @@ class Format extends BaseConfig * * @var array */ - public $formatters = [ + public array $formatters = [ 'application/json' => JSONFormatter::class, 'application/xml' => XMLFormatter::class, 'text/xml' => XMLFormatter::class, @@ -57,21 +56,9 @@ class Format extends BaseConfig * * @var array */ - public $formatterOptions = [ + public array $formatterOptions = [ 'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, 'application/xml' => 0, 'text/xml' => 0, ]; - - /** - * A Factory method to return the appropriate formatter for the given mime type. - * - * @return FormatterInterface - * - * @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead. - */ - public function getFormatter(string $mime) - { - return Services::format()->getFormatter($mime); - } } diff --git a/app/Config/Images.php b/app/Config/Images.php index 1c15d81..a33ddad 100644 --- a/app/Config/Images.php +++ b/app/Config/Images.php @@ -10,25 +10,21 @@ class Images extends BaseConfig { /** * Default handler used if no other handler is specified. - * - * @var string */ - public $defaultHandler = 'gd'; + public string $defaultHandler = 'gd'; /** * The path to the image library. * Required for ImageMagick, GraphicsMagick, or NetPBM. - * - * @var string */ - public $libraryPath = '/usr/local/bin/convert'; + public string $libraryPath = '/usr/local/bin/convert'; /** * The available handler classes. * * @var array */ - public $handlers = [ + public array $handlers = [ 'gd' => GDHandler::class, 'imagick' => ImageMagickHandler::class, ]; diff --git a/app/Config/Kint.php b/app/Config/Kint.php index d070782..931ad47 100644 --- a/app/Config/Kint.php +++ b/app/Config/Kint.php @@ -3,7 +3,6 @@ namespace Config; use Kint\Parser\ConstructablePluginInterface; -use Kint\Renderer\AbstractRenderer; use Kint\Renderer\Rich\TabPluginInterface; use Kint\Renderer\Rich\ValuePluginInterface; @@ -41,7 +40,6 @@ class Kint */ public string $richTheme = 'aante-light.css'; public bool $richFolder = false; - public int $richSort = AbstractRenderer::SORT_FULL; /** * @var array>|null diff --git a/app/Config/Logger.php b/app/Config/Logger.php index 5abce4e..ab6997e 100644 --- a/app/Config/Logger.php +++ b/app/Config/Logger.php @@ -82,7 +82,6 @@ class Logger extends BaseConfig * -------------------------------------------------------------------- */ FileHandler::class => [ - // The log levels that this handler will handle. 'handles' => [ 'critical', diff --git a/app/Config/Mimes.php b/app/Config/Mimes.php index 7722444..c2db734 100644 --- a/app/Config/Mimes.php +++ b/app/Config/Mimes.php @@ -3,8 +3,6 @@ namespace Config; /** - * Mimes - * * This file contains an array of mime types. It is used by the * Upload class to help identify allowed file types. * @@ -15,8 +13,6 @@ namespace Config; * * When working with mime types, please make sure you have the ´fileinfo´ * extension enabled to reliably detect the media types. - * - * @immutable */ class Mimes { @@ -482,6 +478,8 @@ class Mimes 'application/sla', 'application/vnd.ms-pki.stl', 'application/x-navistyle', + 'model/stl', + 'application/octet-stream', ], ]; diff --git a/app/Config/Modules.php b/app/Config/Modules.php index 8d4bf56..9e03fa4 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -9,8 +9,6 @@ use CodeIgniter\Modules\Modules as BaseModules; * * NOTE: This class is required prior to Autoloader instantiation, * and does not extend BaseConfig. - * - * @immutable */ class Modules extends BaseModules { diff --git a/app/Config/Optimize.php b/app/Config/Optimize.php index 6fb441f..481e645 100644 --- a/app/Config/Optimize.php +++ b/app/Config/Optimize.php @@ -7,8 +7,6 @@ namespace Config; * * NOTE: This class does not extend BaseConfig for performance reasons. * So you cannot replace the property values with Environment Variables. - * - * @immutable */ class Optimize { diff --git a/app/Config/Pager.php b/app/Config/Pager.php index 9225753..e341f4d 100644 --- a/app/Config/Pager.php +++ b/app/Config/Pager.php @@ -20,7 +20,7 @@ class Pager extends BaseConfig * * @var array */ - public $templates = [ + public array $templates = [ 'default_full' => 'CodeIgniter\Pager\Views\default_full', 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', 'default_head' => 'CodeIgniter\Pager\Views\default_head', @@ -32,8 +32,6 @@ class Pager extends BaseConfig * -------------------------------------------------------------------------- * * The default number of results shown in a single page. - * - * @var int */ - public $perPage = 20; + public int $perPage = 20; } diff --git a/app/Config/Paths.php b/app/Config/Paths.php index 81a9469..1a39b81 100644 --- a/app/Config/Paths.php +++ b/app/Config/Paths.php @@ -12,6 +12,9 @@ namespace Config; * share a system folder between multiple applications, and more. * * All paths are relative to the project's root folder. + * + * NOTE: This class is required prior to Autoloader instantiation, + * and does not extend BaseConfig. */ class Paths { @@ -22,8 +25,6 @@ class Paths * * This must contain the name of your "system" folder. Include * the path if the folder is not in the same directory as this file. - * - * @var string */ public $systemDirectory = __DIR__ . '/../../../vendor/codeigniter4/framework/system'; @@ -38,10 +39,8 @@ class Paths * you do, use a full server path. * * @see http://codeigniter.com/user_guide/general/managing_apps.html - * - * @var string */ - public $appDirectory = __DIR__ . '/..'; + public string $appDirectory = __DIR__ . '/..'; /** * --------------------------------------------------------------- @@ -53,10 +52,8 @@ class Paths * need write permission to a single place that can be tucked away * for maximum security, keeping it out of the app and/or * system directories. - * - * @var string */ - public $writableDirectory = __DIR__ . '/../../writable'; + public string $writableDirectory = __DIR__ . '/../../writable'; /** * --------------------------------------------------------------- @@ -64,10 +61,8 @@ class Paths * --------------------------------------------------------------- * * This variable must contain the name of your "tests" directory. - * - * @var string */ - public $testsDirectory = __DIR__ . '/../../tests'; + public string $testsDirectory = __DIR__ . '/../../tests'; /** * --------------------------------------------------------------- @@ -78,8 +73,6 @@ class Paths * contains the view files used by your application. By * default this is in `app/Views`. This value * is used when no value is provided to `Services::renderer()`. - * - * @var string */ - public $viewDirectory = __DIR__ . '/../Views'; + public string $viewDirectory = __DIR__ . '/../Views'; } diff --git a/app/Config/Routing.php b/app/Config/Routing.php index c196f75..2d8d039 100644 --- a/app/Config/Routing.php +++ b/app/Config/Routing.php @@ -136,5 +136,5 @@ class Routing extends BaseRouting * * Default: false */ - public bool $translateUriToCamelCase = false; + public bool $translateUriToCamelCase = true; } diff --git a/app/Config/Security.php b/app/Config/Security.php index c077d37..ee2bb9d 100644 --- a/app/Config/Security.php +++ b/app/Config/Security.php @@ -83,21 +83,4 @@ class Security extends BaseConfig * @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure */ public bool $redirect = (ENVIRONMENT === 'production'); - - /** - * -------------------------------------------------------------------------- - * CSRF SameSite - * -------------------------------------------------------------------------- - * - * Setting for CSRF SameSite cookie token. - * - * Allowed values are: None - Lax - Strict - ''. - * - * Defaults to `Lax` as recommended in this link: - * - * @see https://portswigger.net/web-security/csrf/samesite-cookies - * - * @deprecated `Config\Cookie` $samesite property is used. - */ - public string $samesite = 'Lax'; } diff --git a/app/Config/Toolbar.php b/app/Config/Toolbar.php index 4df9508..5a3e504 100644 --- a/app/Config/Toolbar.php +++ b/app/Config/Toolbar.php @@ -86,7 +86,7 @@ class Toolbar extends BaseConfig * with hundreds of queries. * * `$maxQueries` defines the maximum amount of queries that will be stored. - */ + */ public int $maxQueries = 100; /** diff --git a/app/Config/UserAgents.php b/app/Config/UserAgents.php index e1dbfa6..fda7374 100644 --- a/app/Config/UserAgents.php +++ b/app/Config/UserAgents.php @@ -23,7 +23,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $platforms = [ + public array $platforms = [ 'windows nt 10.0' => 'Windows 10', 'windows nt 6.3' => 'Windows 8.1', 'windows nt 6.2' => 'Windows 8', @@ -78,7 +78,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $browsers = [ + public array $browsers = [ 'OPR' => 'Opera', 'Flock' => 'Flock', 'Edge' => 'Spartan', @@ -119,7 +119,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $mobiles = [ + public array $mobiles = [ // legacy array, old values commented out 'mobileexplorer' => 'Mobile Explorer', // 'openwave' => 'Open Wave', @@ -228,7 +228,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $robots = [ + public array $robots = [ 'googlebot' => 'Googlebot', 'msnbot' => 'MSNBot', 'baiduspider' => 'Baiduspider', diff --git a/app/Config/Validation.php b/app/Config/Validation.php index 497b940..6342dbb 100644 --- a/app/Config/Validation.php +++ b/app/Config/Validation.php @@ -3,16 +3,16 @@ namespace Config; use CodeIgniter\Config\BaseConfig; -use CodeIgniter\Validation\CreditCardRules; -use CodeIgniter\Validation\FileRules; -use CodeIgniter\Validation\FormatRules; -use CodeIgniter\Validation\Rules; +use CodeIgniter\Validation\StrictRules\CreditCardRules; +use CodeIgniter\Validation\StrictRules\FileRules; +use CodeIgniter\Validation\StrictRules\FormatRules; +use CodeIgniter\Validation\StrictRules\Rules; class Validation extends BaseConfig { - //-------------------------------------------------------------------- + // -------------------------------------------------------------------- // Setup - //-------------------------------------------------------------------- + // -------------------------------------------------------------------- /** * Stores the classes that contain the @@ -38,7 +38,7 @@ class Validation extends BaseConfig 'single' => 'CodeIgniter\Validation\Views\single', ]; - //-------------------------------------------------------------------- + // -------------------------------------------------------------------- // Rules - //-------------------------------------------------------------------- + // -------------------------------------------------------------------- } diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 122db5f..689405b 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -33,12 +33,18 @@ abstract class BaseController extends Controller * class instantiation. These helpers will be available * to all other controllers that extend BaseController. * - * @var array + * @var list */ protected $helpers = []; /** - * Constructor. + * Be sure to declare properties for any property fetch you initialized. + * The creation of dynamic property is deprecated in PHP 8.2. + */ + // protected $session; + + /** + * @return void */ public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { @@ -47,6 +53,6 @@ abstract class BaseController extends Controller // Preload any models, libraries, etc, here. - // E.g.: $this->session = \Config\Services::session(); + // E.g.: $this->session = service('session'); } } diff --git a/app/Views/errors/cli/error_exception.php b/app/Views/errors/cli/error_exception.php index 9f47d25..624f3b5 100644 --- a/app/Views/errors/cli/error_exception.php +++ b/app/Views/errors/cli/error_exception.php @@ -50,9 +50,9 @@ if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) { $function .= $padClass . $error['function']; } - $args = implode(', ', array_map(static fn ($value) => match (true) { + $args = implode(', ', array_map(static fn ($value): string => match (true) { is_object($value) => 'Object(' . $value::class . ')', - is_array($value) => count($value) ? '[...]' : '[]', + is_array($value) => $value !== [] ? '[...]' : '[]', $value === null => 'null', // return the lowercased version default => var_export($value, true), }, array_values($error['args'] ?? []))); diff --git a/app/Views/errors/html/debug.css b/app/Views/errors/html/debug.css index 6a050c8..b8539a4 100644 --- a/app/Views/errors/html/debug.css +++ b/app/Views/errors/html/debug.css @@ -3,7 +3,7 @@ --main-text-color: #555; --dark-text-color: #222; --light-text-color: #c7c7c7; - --brand-primary-color: #E06E3F; + --brand-primary-color: #DC4814; --light-bg-color: #ededee; --dark-bg-color: #404040; } @@ -41,6 +41,7 @@ p.lead { .header { background: var(--light-bg-color); color: var(--dark-text-color); + margin-top: 2.17rem; } .header .container { padding: 1rem; @@ -65,10 +66,13 @@ p.lead { } .environment { - background: var(--dark-bg-color); - color: var(--light-text-color); + background: var(--brand-primary-color); + color: var(--main-bg-color); text-align: center; - padding: 0.2rem; + padding: calc(4px + 0.2083vw); + width: 100%; + top: 0; + position: fixed; } .source { diff --git a/app/Views/errors/html/error_400.php b/app/Views/errors/html/error_400.php new file mode 100644 index 0000000..555da04 --- /dev/null +++ b/app/Views/errors/html/error_400.php @@ -0,0 +1,84 @@ + + + + + <?= lang('Errors.badRequest') ?> + + + + +
+

400

+ +

+ + + + + +

+
+ + diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php index 44d7498..d5e0c2e 100644 --- a/app/Views/errors/html/error_exception.php +++ b/app/Views/errors/html/error_exception.php @@ -1,6 +1,5 @@
- + @@ -343,7 +342,7 @@ $errorId = uniqid('error', true); setStatusCode(http_response_code()); ?>
diff --git a/app/Views/errors/html/production.php b/app/Views/errors/html/production.php index 9faa4a1..2f59a8d 100644 --- a/app/Views/errors/html/production.php +++ b/app/Views/errors/html/production.php @@ -4,9 +4,9 @@ - Whoops! + <?= lang('Errors.whoops') ?> - @@ -14,9 +14,9 @@
-

Whoops!

+

-

We seem to have hit a snag. Please try again later...

+

diff --git a/public/.htaccess b/public/.htaccess index dbed322..abac3cb 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -45,5 +45,5 @@ Options -Indexes # Disable server signature start - ServerSignature Off +ServerSignature Off # Disable server signature end diff --git a/public/index.php b/public/index.php index 5ec58a7..a0a20db 100644 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,8 @@ systemDirectory . '/Boot.php'; -exit(CodeIgniter\Boot::bootWeb($paths)); +exit(Boot::bootWeb($paths)); diff --git a/writable/debugbar/.gitkeep b/writable/debugbar/.gitkeep deleted file mode 100755 index e69de29..0000000 diff --git a/writable/index.html b/writable/index.html new file mode 100644 index 0000000..b702fbc --- /dev/null +++ b/writable/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + +