Browse Source

[php] Update CakePHP to v5 (#8472)

* [php] Update CakePHP to v5

* Add extra files

* Update composer.json

* Fix salt
Joan Miquel 1 year ago
parent
commit
b8ca165b5d
39 changed files with 1417 additions and 222 deletions
  1. 7 4
      frameworks/PHP/cakephp/README.md
  2. 1 1
      frameworks/PHP/cakephp/benchmark_config.json
  3. 32 8
      frameworks/PHP/cakephp/composer.json
  4. 38 0
      frameworks/PHP/cakephp/config/.env.example
  5. 120 127
      frameworks/PHP/cakephp/config/app.php
  6. 94 0
      frameworks/PHP/cakephp/config/app_local.example.php
  7. 82 39
      frameworks/PHP/cakephp/config/bootstrap.php
  8. 35 0
      frameworks/PHP/cakephp/config/bootstrap_cli.php
  9. 14 14
      frameworks/PHP/cakephp/config/paths.php
  10. 33 0
      frameworks/PHP/cakephp/config/plugins.php
  11. 103 0
      frameworks/PHP/cakephp/config/routes.php
  12. 61 13
      frameworks/PHP/cakephp/src/Application.php
  13. 52 0
      frameworks/PHP/cakephp/src/Controller/AppController.php
  14. 1 1
      frameworks/PHP/cakephp/src/Controller/BenchController.php
  15. 0 0
      frameworks/PHP/cakephp/src/Controller/Component/.gitkeep
  16. 70 0
      frameworks/PHP/cakephp/src/Controller/ErrorController.php
  17. 73 0
      frameworks/PHP/cakephp/src/Controller/PagesController.php
  18. 0 0
      frameworks/PHP/cakephp/src/Model/Behavior/.gitkeep
  19. 1 1
      frameworks/PHP/cakephp/src/Model/Entity/Fortune.php
  20. 1 1
      frameworks/PHP/cakephp/src/Model/Entity/World.php
  21. 2 2
      frameworks/PHP/cakephp/src/Model/Table/FortuneTable.php
  22. 2 2
      frameworks/PHP/cakephp/src/Model/Table/WorldTable.php
  23. 41 0
      frameworks/PHP/cakephp/src/View/AppView.php
  24. 0 0
      frameworks/PHP/cakephp/templates/Bench/fortunes.php
  25. 42 0
      frameworks/PHP/cakephp/templates/Error/error400.php
  26. 47 0
      frameworks/PHP/cakephp/templates/Error/error500.php
  27. 239 0
      frameworks/PHP/cakephp/templates/Pages/home.php
  28. 15 0
      frameworks/PHP/cakephp/templates/element/flash/default.php
  29. 11 0
      frameworks/PHP/cakephp/templates/element/flash/error.php
  30. 11 0
      frameworks/PHP/cakephp/templates/element/flash/info.php
  31. 11 0
      frameworks/PHP/cakephp/templates/element/flash/success.php
  32. 11 0
      frameworks/PHP/cakephp/templates/element/flash/warning.php
  33. 17 0
      frameworks/PHP/cakephp/templates/layout/ajax.php
  34. 55 1
      frameworks/PHP/cakephp/templates/layout/default.php
  35. 25 0
      frameworks/PHP/cakephp/templates/layout/email/html/default.php
  36. 17 0
      frameworks/PHP/cakephp/templates/layout/email/text/default.php
  37. 39 0
      frameworks/PHP/cakephp/templates/layout/error.php
  38. 5 0
      frameworks/PHP/cakephp/webroot/.htaccess
  39. 9 8
      frameworks/PHP/cakephp/webroot/index.php

+ 7 - 4
frameworks/PHP/cakephp/README.md

@@ -1,3 +1,8 @@
+<p align="center">
+<img src="	https://cakephp.org/img/cake-logo.svg" height=100>
+</p>
+https://www.cakephp.org
+
 # Cake PHP Benchmarking Test
 
 This is the Cake PHP portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
@@ -18,10 +23,8 @@ Uses the CakePHP Model functionality.
 ## Infrastructure Software Versions
 The tests were run with:
 
-* [Cake Version 4.0](https://cakephp.org/)
-* [PHP Version 7.4](http://www.php.net/)
-* [nginx 1.12.0](http://nginx.org/)
-* [MySQL 5.7.20](https://dev.mysql.com/)
+* [Cake Version 5](https://cakephp.org/)
+* [PHP Version 8.2](http://www.php.net/)
 
 Cake Debug mode is set to false in [core.php](config/app.php), as
 appropriate for a production deployment.

+ 1 - 1
frameworks/PHP/cakephp/benchmark_config.json

@@ -20,7 +20,7 @@
             "webserver": "nginx",
             "os": "Linux",
             "database_os": "Linux",
-            "display_name": "CakePHP 4.4",
+            "display_name": "CakePHP 5",
             "notes": "",
             "versus": "php"
         },

+ 32 - 8
frameworks/PHP/cakephp/composer.json

@@ -5,30 +5,54 @@
     "type": "project",
     "license": "MIT",
     "require": {
-        "cakephp/cakephp": "^4.4",
-        "cakephp/plugin-installer": "^1.3",
-        "cakephp/chronos": "2.3.*"
+        "php": ">=8.1",
+        "cakephp/cakephp": "^5.0.1",
+        "cakephp/migrations": "^4.0.0",
+        "cakephp/plugin-installer": "^2.0",
+        "mobiledetect/mobiledetectlib": "^3.74"
+    },
+    "require-dev": {
+        "cakephp/bake": "^3.0.0",
+        "cakephp/cakephp-codesniffer": "^5.0",
+        "cakephp/debug_kit": "^5.0.0",
+        "josegonzalez/dotenv": "^4.0",
+        "phpunit/phpunit": "^10.1.0"
+    },
+    "suggest": {
+        "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.",
+        "dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan/Psalm compatibility.",
+        "phpstan/phpstan": "PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code.",
+        "cakephp/repl": "Console tools for a REPL interface for CakePHP applications."
     },
     "autoload": {
         "psr-4": {
             "App\\": "src/"
         }
     },
+    "autoload-dev": {
+        "psr-4": {
+            "App\\Test\\": "tests/",
+            "Cake\\Test\\": "vendor/cakephp/cakephp/tests/"
+        }
+    },
     "scripts": {
+        "post-install-cmd": "App\\Console\\Installer::postInstall",
+        "post-create-project-cmd": "App\\Console\\Installer::postInstall",
         "check": [
             "@test",
             "@cs-check"
         ],
-        "cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
-        "cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/",
-        "stan": "phpstan analyse src/",
-        "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json",
+        "cs-check": "phpcs --colors -p",
+        "cs-fix": "phpcbf --colors -p",
+        "stan": "phpstan analyse",
         "test": "phpunit --colors=always"
     },
     "config": {
+        "platform-check": true,
         "sort-packages": true,
         "allow-plugins": {
-            "*": true
+            "cakephp/plugin-installer": true,
+            "dealerdirect/phpcodesniffer-composer-installer": true
         }
     }
 }

+ 38 - 0
frameworks/PHP/cakephp/config/.env.example

@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# Used as a default to seed config/.env which
+# enables you to use environment variables to configure
+# the aspects of your application that vary by
+# environment.
+#
+# Having this file in production is considered a **SECURITY RISK** and also decreases
+# the bootstrap performance of your application.
+#
+# To use this file, first copy it into `config/.env`. Also ensure the related
+# code block for loading this file is uncommented in `config/bootstrap.php`
+#
+# In development .env files are parsed by PHP
+# and set into the environment. This provides a simpler
+# development workflow over standard environment variables.
+export APP_NAME="__APP_NAME__"
+export DEBUG="true"
+export APP_ENCODING="UTF-8"
+export APP_DEFAULT_LOCALE="en_US"
+export APP_DEFAULT_TIMEZONE="UTC"
+export SECURITY_SALT="__SALT__"
+
+# Uncomment these to define cache configuration via environment variables.
+#export CACHE_DURATION="+2 minutes"
+#export CACHE_DEFAULT_URL="file:///path/to/tmp/cache/?prefix=${APP_NAME}_default_&duration=${CACHE_DURATION}"
+#export CACHE_CAKECORE_URL="file:///path/to/tmp/cache/persistent?prefix=${APP_NAME}_cake_core_&serialize=true&duration=${CACHE_DURATION}"
+#export CACHE_CAKEMODEL_URL="file:///path/to/tmp/cache/models?prefix=${APP_NAME}_cake_model_&serialize=true&duration=${CACHE_DURATION}"
+
+# Uncomment these to define email transport configuration via environment variables.
+#export EMAIL_TRANSPORT_DEFAULT_URL=""
+
+# Uncomment these to define database configuration via environment variables.
+#export DATABASE_URL="mysql://my_app:secret@localhost/${APP_NAME}?encoding=utf8&timezone=UTC&cacheMetadata=true&quoteIdentifiers=false&persistent=false"
+#export DATABASE_TEST_URL="mysql://my_app:secret@localhost/test_${APP_NAME}?encoding=utf8&timezone=UTC&cacheMetadata=true&quoteIdentifiers=false&persistent=false"
+
+# Uncomment these to define logging configuration via environment variables.
+#export LOG_DEBUG_URL="file:///path/to/logs/?levels[]=notice&levels[]=info&levels[]=debug&file=debug"
+#export LOG_ERROR_URL="file:///path/to/logs/?levels[]=warning&levels[]=error&levels[]=critical&levels[]=alert&levels[]=emergency&file=error"

+ 120 - 127
frameworks/PHP/cakephp/config/app.php

@@ -1,6 +1,13 @@
 <?php
+
+use Cake\Cache\Engine\FileEngine;
+use Cake\Database\Connection;
+use Cake\Database\Driver\Mysql;
+use Cake\Log\Engine\FileLog;
+use Cake\Mailer\Transport\MailTransport;
+
 return [
-    /**
+    /*
      * Debug Level:
      *
      * Production Mode:
@@ -9,9 +16,9 @@ return [
      * Development Mode:
      * true: Errors and warnings shown.
      */
-    'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
+    'debug' => false, //filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
 
-    /**
+    /*
      * Configure basic information about the application.
      *
      * - namespace - The namespace to find app classes under.
@@ -44,7 +51,7 @@ return [
         'encoding' => env('APP_ENCODING', 'UTF-8'),
         'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
         'defaultTimezone' => env('APP_DEFAULT_TIMEZONE', 'UTC'),
-        'base' => dirname(__DIR__),
+        'base' => false,
         'dir' => 'src',
         'webroot' => 'webroot',
         'wwwRoot' => WWW_ROOT,
@@ -60,7 +67,7 @@ return [
         ],
     ],
 
-    /**
+    /*
      * Security and encryption configuration
      *
      * - salt - A random string used in security hashing methods.
@@ -68,10 +75,10 @@ return [
      *   You should treat it as extremely sensitive data.
      */
     'Security' => [
-        'salt' => env('SECURITY_SALT', '__SALT__'),
+        'salt' => env('SECURITY_SALT', '3ff7e038084e5f048329ff059595581b5dbcfef5c9d7b0ede105382539a41f84'),
     ],
 
-    /**
+    /*
      * Apply timestamps with the last modified time to static assets (js, css, images).
      * Will append a querystring parameter containing the time the file was modified.
      * This is useful for busting browser caches.
@@ -84,62 +91,48 @@ return [
         // 'cacheTime' => '+1 year'
     ],
 
-    /**
+    /*
      * Configure the cache adapters.
      */
     'Cache' => [
         'default' => [
-            'className' => 'Cake\Cache\Engine\FileEngine',
+            'className' => FileEngine::class,
             'path' => CACHE,
             'url' => env('CACHE_DEFAULT_URL', null),
         ],
 
-        /**
+        /*
          * Configure the cache used for general framework caching.
          * Translation cache files are stored with this configuration.
          * Duration will be set to '+2 minutes' in bootstrap.php when debug = true
          * If you set 'className' => 'Null' core cache will be disabled.
          */
         '_cake_core_' => [
-            'className' => 'Cake\Cache\Engine\FileEngine',
+            'className' => FileEngine::class,
             'prefix' => 'myapp_cake_core_',
-            'path' => CACHE . 'persistent/',
+            'path' => CACHE . 'persistent' . DS,
             'serialize' => true,
             'duration' => '+1 years',
             'url' => env('CACHE_CAKECORE_URL', null),
         ],
 
-        /**
+        /*
          * Configure the cache for model and datasource caches. This cache
          * configuration is used to store schema descriptions, and table listings
          * in connections.
          * Duration will be set to '+2 minutes' in bootstrap.php when debug = true
          */
         '_cake_model_' => [
-            'className' => 'Cake\Cache\Engine\FileEngine',
+            'className' => FileEngine::class,
             'prefix' => 'myapp_cake_model_',
-            'path' => CACHE . 'models/',
+            'path' => CACHE . 'models' . DS,
             'serialize' => true,
             'duration' => '+1 years',
             'url' => env('CACHE_CAKEMODEL_URL', null),
         ],
-
-        /**
-         * Configure the cache for routes. The cached routes collection is built the
-         * first time the routes are processed via `config/routes.php`.
-         * Duration will be set to '+2 seconds' in bootstrap.php when debug = true
-         */
-        '_cake_routes_' => [
-            'className' => 'Cake\Cache\Engine\FileEngine',
-            'prefix' => 'myapp_cake_routes_',
-            'path' => CACHE,
-            'serialize' => true,
-            'duration' => '+1 years',
-            'url' => env('CACHE_CAKEROUTES_URL', null),
-        ],
     ],
 
-    /**
+    /*
      * Configure the Error and Exception handlers used by your application.
      *
      * By default errors are displayed using Debugger, when debug is true and logged
@@ -153,29 +146,54 @@ return [
      * Options:
      *
      * - `errorLevel` - int - The level of errors you are interested in capturing.
-     * - `trace` - boolean - Whether or not backtraces should be included in
+     * - `trace` - boolean - Whether backtraces should be included in
      *   logged errors/exceptions.
-     * - `log` - boolean - Whether or not you want exceptions logged.
-     * - `exceptionRenderer` - string - The class responsible for rendering
-     *   uncaught exceptions. If you choose a custom class you should place
-     *   the file for that class in src/Error. This class needs to implement a
-     *   render method.
+     * - `log` - boolean - Whether you want exceptions logged.
+     * - `exceptionRenderer` - string - The class responsible for rendering uncaught exceptions.
+     *   The chosen class will be used for both CLI and web environments. If you want different
+     *   classes used in CLI and web environments you'll need to write that conditional logic as well.
+     *   The conventional location for custom renderers is in `src/Error`. Your exception renderer needs to
+     *   implement the `render()` method and return either a string or Http\Response.
+     *   `errorRenderer` - string - The class responsible for rendering PHP errors. The selected
+     *   class will be used for both web and CLI contexts. If you want different classes for each environment
+     *   you'll need to write that conditional logic as well. Error renderers need to
+     *   to implement the `Cake\Error\ErrorRendererInterface`.
      * - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
      *   extend one of the listed exceptions will also be skipped for logging.
      *   E.g.:
      *   `'skipLog' => ['Cake\Http\Exception\NotFoundException', 'Cake\Http\Exception\UnauthorizedException']`
-     * - `extraFatalErrorMemory` - int - The number of megabytes to increase
-     *   the memory limit by when a fatal error is encountered. This allows
+     * - `extraFatalErrorMemory` - int - The number of megabytes to increase the memory limit by
+     *   when a fatal error is encountered. This allows
      *   breathing room to complete logging or error handling.
+     * - `ignoredDeprecationPaths` - array - A list of glob compatible file paths that deprecations
+     *   should be ignored in. Use this to ignore deprecations for plugins or parts of
+     *   your application that still emit deprecations.
      */
     'Error' => [
         'errorLevel' => E_ALL,
         'skipLog' => [],
-        'log' => true,
+        'log' => false,
         'trace' => true,
+        'ignoredDeprecationPaths' => [],
+    ],
+
+    /*
+     * Debugger configuration
+     *
+     * Define development error values for Cake\Error\Debugger
+     *
+     * - `editor` Set the editor URL format you want to use.
+     *   By default atom, emacs, macvim, phpstorm, sublime, textmate, and vscode are
+     *   available. You can add additional editor link formats using
+     *   `Debugger::addEditor()` during your application bootstrap.
+     * - `outputMask` A mapping of `key` to `replacement` values that
+     *   `Debugger` should replace in dumped data and logs generated by `Debugger`.
+     */
+    'Debugger' => [
+        'editor' => 'phpstorm',
     ],
 
-    /**
+    /*
      * Email configuration.
      *
      * By defining transports separately from delivery profiles you can easily
@@ -196,22 +214,26 @@ return [
      */
     'EmailTransport' => [
         'default' => [
-            'className' => 'Cake\Mailer\Transport\MailTransport',
+            'className' => MailTransport::class,
             /*
-             * The following keys are used in SMTP transports:
+             * The keys host, port, timeout, username, password, client and tls
+             * are used in SMTP transports
              */
             'host' => 'localhost',
             'port' => 25,
             'timeout' => 30,
-            'username' => null,
-            'password' => null,
+            /*
+             * It is recommended to set these options through your environment or app_local.php
+             */
+            //'username' => null,
+            //'password' => null,
             'client' => null,
-            'tls' => null,
+            'tls' => false,
             'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
         ],
     ],
 
-    /**
+    /*
      * Email delivery profiles
      *
      * Delivery profiles allow you to predefine various properties about email
@@ -224,12 +246,15 @@ return [
         'default' => [
             'transport' => 'default',
             'from' => 'you@localhost',
+            /*
+             * Will by default be set to config value of App.encoding, if that exists otherwise to UTF-8.
+             */
             //'charset' => 'utf-8',
             //'headerCharset' => 'utf-8',
         ],
     ],
 
-    /**
+    /*
      * Connection information used by the ORM to connect
      * to your application's datastores.
      *
@@ -243,58 +268,22 @@ return [
      *   other RDBMS.
      */
     'Datasources' => [
+        /*
+         * These configurations should contain permanent settings used
+         * by all environments.
+         *
+         * The values in app_local.php will override any values set here
+         * and should be used for local and per-environment configurations.
+         *
+         * Environment variable based configurations can be loaded here or
+         * in app_local.php depending on the applications needs.
+         */
         'default' => [
-            'className' => 'Cake\Database\Connection',
-            'driver' => 'Cake\Database\Driver\Mysql',
+            'className' => Connection::class,
+            'driver' => Mysql::class,
             'persistent' => true,
-            'host' => 'tfb-database',
-            /*
-             * CakePHP will use the default DB port based on the driver selected
-             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
-             * the following line and set the port accordingly
-             */
-            //'port' => '3306',
-            'username' => 'benchmarkdbuser',
-            'password' => 'benchmarkdbpass',
-            'database' => 'hello_world',
-            /*
-             * You do not need to set this flag to use full utf-8 encoding (internal default since CakePHP 3.6).
-             */
-            //'encoding' => 'utf8mb4',
             'timezone' => 'UTC',
-            'flags' => [],
-            'cacheMetadata' => true,
-            'log' => false,
 
-            /**
-             * Set identifier quoting to true if you are using reserved words or
-             * special characters in your table or column names. Enabling this
-             * setting will result in queries built using the Query Builder having
-             * identifiers quoted when creating SQL. It should be noted that this
-             * decreases performance because each query needs to be traversed and
-             * manipulated before being executed.
-             */
-            'quoteIdentifiers' => false,
-
-            /**
-             * During development, if using MySQL < 5.6, uncommenting the
-             * following line could boost the speed at which schema metadata is
-             * fetched from the database. It can also be set directly with the
-             * mysql configuration directive 'innodb_stats_on_metadata = 0'
-             * which is the recommended value in production environments
-             */
-            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
-
-            'url' => env('DATABASE_URL', null),
-        ],
-
-        /**
-         * The test connection is used during the test suite.
-         */
-        'test' => [
-            'className' => 'Cake\Database\Connection',
-            'driver' => 'Cake\Database\Driver\Mysql',
-            'persistent' => true,
             'host' => 'tfb-database',
             /*
              * CakePHP will use the default DB port based on the driver selected
@@ -313,61 +302,65 @@ return [
             'flags' => [],
             'cacheMetadata' => true,
             'log' => false,
-
-            /**
-             * Set identifier quoting to true if you are using reserved words or
-             * special characters in your table or column names. Enabling this
-             * setting will result in queries built using the Query Builder having
-             * identifiers quoted when creating SQL. It should be noted that this
-             * decreases performance because each query needs to be traversed and
-             * manipulated before being executed.
+            /*
+             * If not using the default 'public' schema with the PostgreSQL driver
+             * set it here.
              */
-            'quoteIdentifiers' => false,
+            //'schema' => 'myapp',
 
-            /**
-             * During development, if using MySQL < 5.6, uncommenting the
-             * following line could boost the speed at which schema metadata is
-             * fetched from the database. It can also be set directly with the
-             * mysql configuration directive 'innodb_stats_on_metadata = 0'
-             * which is the recommended value in production environments
+            /*
+             * You can use a DSN string to set the entire configuration
              */
-            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
-
-            'url' => env('DATABASE_URL', null),
+            //'url' => env('DATABASE_URL', null),
         ],
+        /*
+         * The test connection is used during the test suite.
+         */
+        // 'test' => [
+        //     'className' => Connection::class,
+        //     'driver' => Mysql::class,
+        //     'persistent' => false,
+        //     'timezone' => 'UTC',
+        //     //'encoding' => 'utf8mb4',
+        //     'flags' => [],
+        //     'cacheMetadata' => true,
+        //     'quoteIdentifiers' => false,
+        //     'log' => false,
+        //     //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
+        // ],
     ],
 
-    /**
+    /*
      * Configures logging options
      */
     'Log' => [
         'debug' => [
-            'className' => 'Cake\Log\Engine\NullEngine',
+            'className' => FileLog::class,
             'path' => LOGS,
             'file' => 'debug',
             'url' => env('LOG_DEBUG_URL', null),
-            'scopes' => false,
-            'levels' => ['emergency'],
+            'scopes' => null,
+            'levels' => ['notice', 'info', 'debug'],
         ],
         'error' => [
-            'className' => 'Cake\Log\Engine\NullEngine',
+            'className' => FileLog::class,
             'path' => LOGS,
             'file' => 'error',
             'url' => env('LOG_ERROR_URL', null),
-            'scopes' => false,
-            'levels' => ['emergency'],
+            'scopes' => null,
+            'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
         ],
         // To enable this dedicated query log, you need set your datasource's log flag to true
         'queries' => [
-            'className' => 'Cake\Log\Engine\NullEngine',
+            'className' => FileLog::class,
             'path' => LOGS,
             'file' => 'queries',
             'url' => env('LOG_QUERIES_URL', null),
-            'scopes' => ['queriesLog'],
+            'scopes' => ['cake.database.queries'],
         ],
     ],
 
-    /**
+    /*
      * Session configuration.
      *
      * Contains an array of settings to use for session configuration. The
@@ -376,8 +369,8 @@ return [
      *
      * ## Options
      *
-     * - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'. Avoid using `.` in cookie names,
-     *   as PHP will drop sessions from cookies with `.` in the name.
+     * - `cookie` - The name of the cookie to use. Defaults to value set for `session.name` php.ini config.
+     *    Avoid using `.` in cookie names, as PHP will drop sessions from cookies with `.` in the name.
      * - `cookiePath` - The url path for which session cookie is set. Maps to the
      *   `session.cookie_path` php.ini config. Defaults to base path of app.
      * - `timeout` - The time in minutes the session should be valid for.
@@ -391,7 +384,7 @@ return [
      *    array with at least the `engine` key, being the name of the Session engine
      *    class to use for managing the session. CakePHP bundles the `CacheSession`
      *    and `DatabaseSession` engines.
-     * - `ini` - An associative array of additional ini values to set.
+     * - `ini` - An associative array of additional 'session.*` ini values to set.
      *
      * The built-in `defaults` options are:
      *
@@ -400,7 +393,7 @@ return [
      * - 'database' - Uses CakePHP's database sessions.
      * - 'cache' - Use the Cache class to save sessions.
      *
-     * To define a custom session handler, save it at src/Network/Session/<name>.php.
+     * To define a custom session handler, save it at src/Http/Session/<name>.php.
      * Make sure the class implements PHP's `SessionHandlerInterface` and set
      * Session.handler to <name>
      *

+ 94 - 0
frameworks/PHP/cakephp/config/app_local.example.php

@@ -0,0 +1,94 @@
+<?php
+/*
+ * Local configuration file to provide any overrides to your app.php configuration.
+ * Copy and save this file as app_local.php and make changes as required.
+ * Note: It is not recommended to commit files with credentials such as app_local.php
+ * into source code version control.
+ */
+return [
+    /*
+     * Debug Level:
+     *
+     * Production Mode:
+     * false: No error messages, errors, or warnings shown.
+     *
+     * Development Mode:
+     * true: Errors and warnings shown.
+     */
+    'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
+
+    /*
+     * Security and encryption configuration
+     *
+     * - salt - A random string used in security hashing methods.
+     *   The salt value is also used as the encryption key.
+     *   You should treat it as extremely sensitive data.
+     */
+    'Security' => [
+        'salt' => env('SECURITY_SALT', '__SALT__'),
+    ],
+
+    /*
+     * Connection information used by the ORM to connect
+     * to your application's datastores.
+     *
+     * See app.php for more configuration options.
+     */
+    'Datasources' => [
+        'default' => [
+            'host' => 'localhost',
+            /*
+             * CakePHP will use the default DB port based on the driver selected
+             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
+             * the following line and set the port accordingly
+             */
+            //'port' => 'non_standard_port_number',
+
+            'username' => 'my_app',
+            'password' => 'secret',
+
+            'database' => 'my_app',
+            /*
+             * If not using the default 'public' schema with the PostgreSQL driver
+             * set it here.
+             */
+            //'schema' => 'myapp',
+
+            /*
+             * You can use a DSN string to set the entire configuration
+             */
+            'url' => env('DATABASE_URL', null),
+        ],
+
+        /*
+         * The test connection is used during the test suite.
+         */
+        'test' => [
+            'host' => 'localhost',
+            //'port' => 'non_standard_port_number',
+            'username' => 'my_app',
+            'password' => 'secret',
+            'database' => 'test_myapp',
+            //'schema' => 'myapp',
+            'url' => env('DATABASE_TEST_URL', 'sqlite://127.0.0.1/tmp/tests.sqlite'),
+        ],
+    ],
+
+    /*
+     * Email configuration.
+     *
+     * Host and credential configuration in case you are using SmtpTransport
+     *
+     * See app.php for more configuration options.
+     */
+    'EmailTransport' => [
+        'default' => [
+            'host' => 'localhost',
+            'port' => 25,
+            'username' => null,
+            'password' => null,
+            'client' => null,
+            'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
+        ],
+    ],
+];

+ 82 - 39
frameworks/PHP/cakephp/config/bootstrap.php

@@ -1,4 +1,6 @@
 <?php
+declare(strict_types=1);
+
 /**
  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
@@ -16,7 +18,7 @@
 /*
  * Configure paths required to find CakePHP + general filepath constants
  */
-require __DIR__ . '/paths.php';
+require __DIR__ . DIRECTORY_SEPARATOR . 'paths.php';
 
 /*
  * Bootstrap CakePHP.
@@ -37,6 +39,7 @@ use Cake\Database\TypeFactory;
 use Cake\Datasource\ConnectionManager;
 use Cake\Error\ErrorTrap;
 use Cake\Error\ExceptionTrap;
+use Cake\Http\ServerRequest;
 use Cake\Log\Log;
 use Cake\Mailer\Mailer;
 use Cake\Mailer\TransportFactory;
@@ -44,14 +47,24 @@ use Cake\Routing\Router;
 use Cake\Utility\Security;
 
 /**
+ * Load global functions.
+ */
+require CAKE . 'functions.php';
+
+/*
+ * See https://github.com/josegonzalez/php-dotenv for API details.
+ *
  * Uncomment block of code below if you want to use `.env` file during development.
- * You should copy `config/.env.default to `config/.env` and set/modify the
+ * You should copy `config/.env.example` to `config/.env` and set/modify the
  * variables as required.
  *
- * It is HIGHLY discouraged to use a .env file in production, due to security risks
- * and decreased performance on each request. The purpose of the .env file is to emulate
- * the presence of the environment variables like they would be present in production.
- */
+ * The purpose of the .env file is to emulate the presence of the environment
+ * variables like they would be present in production.
+ *
+ * If you use .env files, be careful to not commit them to source control to avoid
+ * security risks. See https://github.com/josegonzalez/php-dotenv#general-security-information
+ * for more information for recommended practices.
+*/
 // if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {
 //     $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']);
 //     $dotenv->parse()
@@ -76,11 +89,12 @@ try {
 }
 
 /*
- * Load an environment local configuration file.
- * You can use a file like app_local.php to provide local overrides to your
- * shared configuration.
+ * Load an environment local configuration file to provide overrides to your configuration.
+ * Notice: For security reasons app_local.php **should not** be included in your git repo.
  */
-//Configure::load('app_local', 'default');
+if (file_exists(CONFIG . 'app_local.php')) {
+    Configure::load('app_local', 'default');
+}
 
 /*
  * When debug = true the metadata cache should only last
@@ -95,7 +109,7 @@ if (Configure::read('debug')) {
 
 /*
  * Set the default server timezone. Using UTC makes time calculations / conversions easier.
- * Check http://php.net/manual/en/timezones.php for list of valid timezone strings.
+ * Check https://php.net/manual/en/timezones.php for list of valid timezone strings.
  */
 date_default_timezone_set(Configure::read('App.defaultTimezone'));
 
@@ -116,22 +130,37 @@ ini_set('intl.default_locale', Configure::read('App.defaultLocale'));
 (new ErrorTrap(Configure::read('Error')))->register();
 (new ExceptionTrap(Configure::read('Error')))->register();
 
+/*
+ * Include the CLI bootstrap overrides.
+ */
+if (PHP_SAPI === 'cli') {
+    require CONFIG . 'bootstrap_cli.php';
+}
+
 /*
  * Set the full base URL.
  * This URL is used as the base of all absolute links.
- *
- * If you define fullBaseUrl in your config file you can remove this.
  */
 $fullBaseUrl = Configure::read('App.fullBaseUrl');
 if (!$fullBaseUrl) {
+    /*
+     * When using proxies or load balancers, SSL/TLS connections might
+     * get terminated before reaching the server. If you trust the proxy,
+     * you can enable `$trustProxy` to rely on the `X-Forwarded-Proto`
+     * header to determine whether to generate URLs using `https`.
+     *
+     * See also https://book.cakephp.org/4/en/controllers/request-response.html#trusting-proxy-headers
+     */
+    $trustProxy = false;
+
     $s = null;
-    if (env('HTTPS')) {
+    if (env('HTTPS') || ($trustProxy && env('HTTP_X_FORWARDED_PROTO') === 'https')) {
         $s = 's';
     }
 
     $httpHost = env('HTTP_HOST');
     if (isset($httpHost)) {
-        Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
+        $fullBaseUrl = 'http' . $s . '://' . $httpHost;
     }
     unset($httpHost, $s);
 }
@@ -148,34 +177,43 @@ Log::setConfig(Configure::consume('Log'));
 Security::setSalt(Configure::consume('Security.salt'));
 
 /*
- * You can set whether the ORM uses immutable or mutable Time types.
- * The default changed in 4.0 to immutable types. You can uncomment
- * below to switch back to mutable types.
- *
+ * Setup detectors for mobile and tablet.
+ * If you don't use these checks you can safely remove this code
+ * and the mobiledetect package from composer.json.
+ */
+ServerRequest::addDetector('mobile', function ($request) {
+    $detector = new \Detection\MobileDetect();
+
+    return $detector->isMobile();
+});
+ServerRequest::addDetector('tablet', function ($request) {
+    $detector = new \Detection\MobileDetect();
+
+    return $detector->isTablet();
+});
+
+/*
  * You can enable default locale format parsing by adding calls
  * to `useLocaleParser()`. This enables the automatic conversion of
  * locale specific date formats. For details see
  * @link https://book.cakephp.org/4/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
  */
-// TypeFactory::build('time')
-//    ->useMutable();
-// TypeFactory::build('date')
-//    ->useMutable();
-// TypeFactory::build('datetime')
-//    ->useMutable();
-// TypeFactory::build('timestamp')
-//    ->useMutable();
-// TypeFactory::build('datetimefractional')
-//    ->useMutable();
-// TypeFactory::build('timestampfractional')
-//    ->useMutable();
-// TypeFactory::build('datetimetimezone')
-//    ->useMutable();
-// TypeFactory::build('timestamptimezone')
-//    ->useMutable();
-
-// There is no time-specific type in Cake
-TypeFactory::map('time', StringType::class);
+// \Cake\Database\TypeFactory::build('time')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('date')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('datetime')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('timestamp')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('datetimefractional')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('timestampfractional')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('datetimetimezone')
+//    ->useLocaleParser();
+// \Cake\Database\TypeFactory::build('timestamptimezone')
+//    ->useLocaleParser();
 
 /*
  * Custom Inflector rules, can be set to correctly pluralize or singularize
@@ -185,4 +223,9 @@ TypeFactory::map('time', StringType::class);
 //Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
 //Inflector::rules('irregular', ['red' => 'redlings']);
 //Inflector::rules('uninflected', ['dontinflectme']);
-//Inflector::rules('transliteration', ['/å/' => 'aa']);
+
+// set a custom date and time format
+// see https://book.cakephp.org/4/en/core-libraries/time.html#setting-the-default-locale-and-format-string
+// and https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax
+//\Cake\I18n\FrozenDate::setToStringFormat('dd.MM.yyyy');
+//\Cake\I18n\FrozenTime::setToStringFormat('dd.MM.yyyy HH:mm');

+ 35 - 0
frameworks/PHP/cakephp/config/bootstrap_cli.php

@@ -0,0 +1,35 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         3.0.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ */
+
+use Cake\Core\Configure;
+
+/*
+ * Additional bootstrapping and configuration for CLI environments should
+ * be put here.
+ */
+
+// Set the fullBaseUrl to allow URLs to be generated in shell tasks.
+// This is useful when sending email from shells.
+//Configure::write('App.fullBaseUrl', php_uname('n'));
+
+// Set logs to different files so they don't have permission conflicts.
+if (Configure::check('Log.debug')) {
+    Configure::write('Log.debug.file', 'cli-debug');
+}
+if (Configure::check('Log.error')) {
+    Configure::write('Log.error.file', 'cli-error');
+}

+ 14 - 14
frameworks/PHP/cakephp/config/paths.php

@@ -12,41 +12,41 @@
  * @license       MIT License (https://opensource.org/licenses/mit-license.php)
  */
 
-/**
+/*
  * Use the DS to separate the directories in other defines
  */
 if (!defined('DS')) {
     define('DS', DIRECTORY_SEPARATOR);
 }
 
-/**
+/*
  * These defines should only be edited if you have cake installed in
  * a directory layout other than the way it is distributed.
  * When using custom settings be sure to use the DS and do not add a trailing DS.
  */
 
-/**
+/*
  * The full path to the directory which holds "src", WITHOUT a trailing DS.
  */
 define('ROOT', dirname(__DIR__));
 
-/**
+/*
  * The actual directory name for the application directory. Normally
  * named 'src'.
  */
 define('APP_DIR', 'src');
 
-/**
+/*
  * Path to the application's directory.
  */
 define('APP', ROOT . DS . APP_DIR . DS);
 
-/**
+/*
  * Path to the config directory.
  */
 define('CONFIG', ROOT . DS . 'config' . DS);
 
-/**
+/*
  * File path to the webroot directory.
  *
  * To derive your webroot from your webserver change this to:
@@ -55,39 +55,39 @@ define('CONFIG', ROOT . DS . 'config' . DS);
  */
 define('WWW_ROOT', ROOT . DS . 'webroot' . DS);
 
-/**
+/*
  * Path to the tests directory.
  */
 define('TESTS', ROOT . DS . 'tests' . DS);
 
-/**
+/*
  * Path to the temporary files directory.
  */
 define('TMP', ROOT . DS . 'tmp' . DS);
 
-/**
+/*
  * Path to the logs directory.
  */
 define('LOGS', ROOT . DS . 'logs' . DS);
 
-/**
+/*
  * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
  */
 define('CACHE', TMP . 'cache' . DS);
 
-/**
+/*
  * Path to the resources directory.
  */
 define('RESOURCES', ROOT . DS . 'resources' . DS);
 
-/**
+/*
  * The absolute path to the "cake" directory, WITHOUT a trailing DS.
  *
  * CakePHP should always be installed with composer, so look there.
  */
 define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
 
-/**
+/*
  * Path to the cake directory.
  */
 define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);

+ 33 - 0
frameworks/PHP/cakephp/config/plugins.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * Plugin configuration.
+ *
+ * In this file, you configure which plugins are loaded in the different states your app can be.
+ * It's loaded via the `parent::bootstrap();` call inside your `Application::bootstrap()` method.
+ * For more information see https://book.cakephp.org/5/en/plugins.html#loading-plugins-via-configuration-array
+ *
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         5.0.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ */
+
+return [
+    // Plugins only needed when in debug mode
+    //'DebugKit' => ['onlyDebug' => true],
+
+    // Optional plugins which are only needed in CLI commands
+    //'Bake' => ['onlyCli' => true, 'optional' => true],
+
+    // Required plugins only in CLI commands
+    //'Migrations' => ['onlyCli' => true],
+
+    // Add your custom plugins here
+];

+ 103 - 0
frameworks/PHP/cakephp/config/routes.php

@@ -0,0 +1,103 @@
+<?php
+/**
+ * Routes configuration.
+ *
+ * In this file, you set up routes to your controllers and their actions.
+ * Routes are very important mechanism that allows you to freely connect
+ * different URLs to chosen controllers and their actions (functions).
+ *
+ * It's loaded within the context of `Application::routes()` method which
+ * receives a `RouteBuilder` instance `$routes` as method argument.
+ *
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ */
+
+use Cake\Routing\Route\DashedRoute;
+use Cake\Routing\RouteBuilder;
+
+/*
+ * This file is loaded in the context of the `Application` class.
+  * So you can use  `$this` to reference the application class instance
+  * if required.
+ */
+return function (RouteBuilder $routes): void {
+    /*
+     * The default class to use for all routes
+     *
+     * The following route classes are supplied with CakePHP and are appropriate
+     * to set as the default:
+     *
+     * - Route
+     * - InflectedRoute
+     * - DashedRoute
+     *
+     * If no call is made to `Router::defaultRouteClass()`, the class used is
+     * `Route` (`Cake\Routing\Route\Route`)
+     *
+     * Note that `Route` does not do any inflections on URLs which will result in
+     * inconsistently cased URLs when used with `{plugin}`, `{controller}` and
+     * `{action}` markers.
+     */
+    $routes->setRouteClass(DashedRoute::class);
+
+    $routes->scope('/', function (RouteBuilder $builder): void {
+        /*
+         * Here, we are connecting '/' (base path) to a controller called 'Pages',
+         * its action called 'display', and we pass a param to select the view file
+         * to use (in this case, templates/Pages/home.php)...
+         */
+        //$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);
+
+        /*
+         * ...and connect the rest of 'Pages' controller's URLs.
+         */
+        //$builder->connect('/pages/*', 'Pages::display');
+
+        $builder->connect('/plaintext', ['controller' => 'bench', 'action' => 'plaintext']);
+        $builder->connect('/json', ['controller' => 'bench', 'action' => 'json']);
+        $builder->connect('/db', ['controller' => 'bench', 'action' => 'db']);
+        $builder->connect('/queries', ['controller' => 'bench', 'action' => 'queries']);
+        $builder->connect('/updates', ['controller' => 'bench', 'action' => 'updates']);
+        $builder->connect('/fortunes', ['controller' => 'bench', 'action' => 'fortunes']);
+
+        /*
+         * Connect catchall routes for all controllers.
+         *
+         * The `fallbacks` method is a shortcut for
+         *
+         * ```
+         * $builder->connect('/{controller}', ['action' => 'index']);
+         * $builder->connect('/{controller}/{action}/*', []);
+         * ```
+         *
+         * You can remove these routes once you've connected the
+         * routes you want in your application.
+         */
+        $builder->fallbacks();
+    });
+
+    /*
+     * If you need a different set of middleware or none at all,
+     * open new scope and define routes there.
+     *
+     * ```
+     * $routes->scope('/api', function (RouteBuilder $builder): void {
+     *     // No $builder->applyMiddleware() here.
+     *
+     *     // Parse specified extensions from URLs
+     *     // $builder->setExtensions(['json', 'xml']);
+     *
+     *     // Connect API actions here.
+     * });
+     * ```
+     */
+};

+ 61 - 13
frameworks/PHP/cakephp/src/Application.php

@@ -1,4 +1,6 @@
 <?php
+declare(strict_types=1);
+
 /**
  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
@@ -14,19 +16,46 @@
  */
 namespace App;
 
+use Cake\Core\Configure;
+use Cake\Core\ContainerInterface;
+use Cake\Datasource\FactoryLocator;
+use Cake\Error\Middleware\ErrorHandlerMiddleware;
 use Cake\Http\BaseApplication;
+use Cake\Http\Middleware\BodyParserMiddleware;
+use Cake\Http\Middleware\CsrfProtectionMiddleware;
 use Cake\Http\MiddlewareQueue;
+use Cake\ORM\Locator\TableLocator;
+use Cake\Routing\Middleware\AssetMiddleware;
 use Cake\Routing\Middleware\RoutingMiddleware;
-use Cake\Routing\RouteBuilder;
 
 /**
  * Application setup class.
  *
  * This defines the bootstrapping logic and middleware layers you
  * want to use in your application.
+ *
+ * @extends \Cake\Http\BaseApplication<\App\Application>
  */
 class Application extends BaseApplication
 {
+    /**
+     * Load all the application configuration and bootstrap logic.
+     *
+     * @return void
+     */
+    public function bootstrap(): void
+    {
+        // Call parent to load bootstrap from files.
+        parent::bootstrap();
+
+        if (PHP_SAPI !== 'cli') {
+            FactoryLocator::add(
+                'Table',
+                (new TableLocator())->allowFallbackClass(false)
+            );
+        }
+    }
+
     /**
      * Setup the middleware queue your application will use.
      *
@@ -36,24 +65,43 @@ class Application extends BaseApplication
     public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
     {
         $middlewareQueue
+            // Catch any exceptions in the lower layers,
+            // and make an error page/response
+            ->add(new ErrorHandlerMiddleware(Configure::read('Error'), $this))
+
+            // Handle plugin/theme assets like CakePHP normally does.
+            ->add(new AssetMiddleware([
+                'cacheTime' => Configure::read('Asset.cacheTime'),
+            ]))
+
             // Add routing middleware.
             // If you have a large number of routes connected, turning on routes
-            // caching in production could improve performance. For that when
-            // creating the middleware instance specify the cache config name by
-            // using it's second constructor argument:
-            // `new RoutingMiddleware($this, '_cake_routes_')`
-            ->add(new RoutingMiddleware($this));
+            // caching in production could improve performance.
+            // See https://github.com/CakeDC/cakephp-cached-routing
+            ->add(new RoutingMiddleware($this))
+
+            // Parse various types of encoded request bodies so that they are
+            // available as array through $request->getData()
+            // https://book.cakephp.org/4/en/controllers/middleware.html#body-parser-middleware
+            ->add(new BodyParserMiddleware());
+
+            // Cross Site Request Forgery (CSRF) Protection Middleware
+            // https://book.cakephp.org/4/en/security/csrf.html#cross-site-request-forgery-csrf-middleware
+            //->add(new CsrfProtectionMiddleware([
+            //    'httponly' => true,
+            //]));
 
         return $middlewareQueue;
     }
 
-    public function routes(RouteBuilder $routes): void
+    /**
+     * Register application container services.
+     *
+     * @param \Cake\Core\ContainerInterface $container The Container to update.
+     * @return void
+     * @link https://book.cakephp.org/4/en/development/dependency-injection.html#dependency-injection
+     */
+    public function services(ContainerInterface $container): void
     {
-        $routes->connect('/json', ['controller' => 'Main', 'action' => 'json']);
-        $routes->connect('/plaintext', ['controller' => 'Main', 'action' => 'plaintext']);
-        $routes->connect('/fortunes', ['controller' => 'Main', 'action' => 'fortunes']);
-        $routes->connect('/db', ['controller' => 'Main', 'action' => 'db']);
-        $routes->connect('/queries', ['controller' => 'Main', 'action' => 'queries']);
-        $routes->connect('/updates', ['controller' => 'Main', 'action' => 'updates']);
     }
 }

+ 52 - 0
frameworks/PHP/cakephp/src/Controller/AppController.php

@@ -0,0 +1,52 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link      https://cakephp.org CakePHP(tm) Project
+ * @since     0.2.9
+ * @license   https://opensource.org/licenses/mit-license.php MIT License
+ */
+namespace App\Controller;
+
+use Cake\Controller\Controller;
+
+/**
+ * Application Controller
+ *
+ * Add your application-wide methods in the class below, your controllers
+ * will inherit them.
+ *
+ * @link https://book.cakephp.org/4/en/controllers.html#the-app-controller
+ */
+class AppController extends Controller
+{
+    /**
+     * Initialization hook method.
+     *
+     * Use this method to add common initialization code like loading components.
+     *
+     * e.g. `$this->loadComponent('FormProtection');`
+     *
+     * @return void
+     */
+    public function initialize(): void
+    {
+        parent::initialize();
+
+        $this->loadComponent('Flash');
+
+        /*
+         * Enable the following component for recommended CakePHP form protection settings.
+         * see https://book.cakephp.org/4/en/controllers/components/form-protection.html
+         */
+        //$this->loadComponent('FormProtection');
+    }
+}

+ 1 - 1
frameworks/PHP/cakephp/src/Controller/MainController.php → frameworks/PHP/cakephp/src/Controller/BenchController.php

@@ -4,7 +4,7 @@ namespace App\Controller;
 
 use Cake\Controller\Controller;
 
-class MainController extends Controller
+class BenchController extends Controller
 {
     public function json()
     {

+ 0 - 0
frameworks/PHP/cakephp/src/Controller/Component/.gitkeep


+ 70 - 0
frameworks/PHP/cakephp/src/Controller/ErrorController.php

@@ -0,0 +1,70 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         3.3.4
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ */
+namespace App\Controller;
+
+use Cake\Event\EventInterface;
+
+/**
+ * Error Handling Controller
+ *
+ * Controller used by ExceptionRenderer to render error responses.
+ */
+class ErrorController extends AppController
+{
+    /**
+     * Initialization hook method.
+     *
+     * @return void
+     */
+    public function initialize(): void
+    {
+        // Only add parent::initialize() if you are confident your appcontroller is safe.
+    }
+
+    /**
+     * beforeFilter callback.
+     *
+     * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event.
+     * @return \Cake\Http\Response|null|void
+     */
+    public function beforeFilter(EventInterface $event)
+    {
+    }
+
+    /**
+     * beforeRender callback.
+     *
+     * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event.
+     * @return \Cake\Http\Response|null|void
+     */
+    public function beforeRender(EventInterface $event)
+    {
+        parent::beforeRender($event);
+
+        $this->viewBuilder()->setTemplatePath('Error');
+    }
+
+    /**
+     * afterFilter callback.
+     *
+     * @param \Cake\Event\EventInterface<\Cake\Controller\Controller> $event Event.
+     * @return \Cake\Http\Response|null|void
+     */
+    public function afterFilter(EventInterface $event)
+    {
+    }
+}

+ 73 - 0
frameworks/PHP/cakephp/src/Controller/PagesController.php

@@ -0,0 +1,73 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link      https://cakephp.org CakePHP(tm) Project
+ * @since     0.2.9
+ * @license   https://opensource.org/licenses/mit-license.php MIT License
+ */
+namespace App\Controller;
+
+use Cake\Core\Configure;
+use Cake\Http\Exception\ForbiddenException;
+use Cake\Http\Exception\NotFoundException;
+use Cake\Http\Response;
+use Cake\View\Exception\MissingTemplateException;
+
+/**
+ * Static content controller
+ *
+ * This controller will render views from templates/Pages/
+ *
+ * @link https://book.cakephp.org/4/en/controllers/pages-controller.html
+ */
+class PagesController extends AppController
+{
+    /**
+     * Displays a view
+     *
+     * @param string ...$path Path segments.
+     * @return \Cake\Http\Response|null
+     * @throws \Cake\Http\Exception\ForbiddenException When a directory traversal attempt.
+     * @throws \Cake\View\Exception\MissingTemplateException When the view file could not
+     *   be found and in debug mode.
+     * @throws \Cake\Http\Exception\NotFoundException When the view file could not
+     *   be found and not in debug mode.
+     * @throws \Cake\View\Exception\MissingTemplateException In debug mode.
+     */
+    public function display(string ...$path): ?Response
+    {
+        if (!$path) {
+            return $this->redirect('/');
+        }
+        if (in_array('..', $path, true) || in_array('.', $path, true)) {
+            throw new ForbiddenException();
+        }
+        $page = $subpage = null;
+
+        if (!empty($path[0])) {
+            $page = $path[0];
+        }
+        if (!empty($path[1])) {
+            $subpage = $path[1];
+        }
+        $this->set(compact('page', 'subpage'));
+
+        try {
+            return $this->render(implode('/', $path));
+        } catch (MissingTemplateException $exception) {
+            if (Configure::read('debug')) {
+                throw $exception;
+            }
+            throw new NotFoundException();
+        }
+    }
+}

+ 0 - 0
frameworks/PHP/cakephp/src/Model/Behavior/.gitkeep


+ 1 - 1
frameworks/PHP/cakephp/src/Model/Entity/Fortune.php

@@ -6,7 +6,7 @@ use Cake\ORM\Entity;
 
 class Fortune extends Entity
 {
-    protected $_accessible = [
+    protected array $_accessible = [
         '*' => true,
     ];
 }

+ 1 - 1
frameworks/PHP/cakephp/src/Model/Entity/World.php

@@ -6,7 +6,7 @@ use Cake\ORM\Entity;
 
 class World extends Entity
 {
-    protected $_accessible = [
+    protected array $_accessible = [
         '*' => true,
     ];
 }

+ 2 - 2
frameworks/PHP/cakephp/src/Model/Table/FortuneTable.php

@@ -7,6 +7,6 @@ use Cake\ORM\Table;
 
 class FortuneTable extends Table
 {
-    protected $_table = 'fortune';
-    protected $_entityClass = Fortune::class;
+    protected ?string $_table = 'fortune';
+    protected ?string $_entityClass = Fortune::class;
 }

+ 2 - 2
frameworks/PHP/cakephp/src/Model/Table/WorldTable.php

@@ -7,6 +7,6 @@ use Cake\ORM\Table;
 
 class WorldTable extends Table
 {
-    protected $_table = 'world';
-    protected $_entityClass = World::class;
+    protected ?string $_table = 'world';
+    protected ?string $_entityClass = World::class;
 }

+ 41 - 0
frameworks/PHP/cakephp/src/View/AppView.php

@@ -0,0 +1,41 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link      https://cakephp.org CakePHP(tm) Project
+ * @since     3.0.0
+ * @license   https://opensource.org/licenses/mit-license.php MIT License
+ */
+namespace App\View;
+
+use Cake\View\View;
+
+/**
+ * Application View
+ *
+ * Your application's default view class
+ *
+ * @link https://book.cakephp.org/4/en/views.html#the-app-view
+ */
+class AppView extends View
+{
+    /**
+     * Initialization hook method.
+     *
+     * Use this method to add common initialization code like adding helpers.
+     *
+     * e.g. `$this->addHelper('Html');`
+     *
+     * @return void
+     */
+    public function initialize(): void
+    {
+    }
+}

+ 0 - 0
frameworks/PHP/cakephp/templates/Main/fortunes.php → frameworks/PHP/cakephp/templates/Bench/fortunes.php


+ 42 - 0
frameworks/PHP/cakephp/templates/Error/error400.php

@@ -0,0 +1,42 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var \Cake\Database\StatementInterface $error
+ * @var string $message
+ * @var string $url
+ */
+use Cake\Core\Configure;
+use Cake\Error\Debugger;
+
+$this->layout = 'error';
+
+if (Configure::read('debug')) :
+    $this->layout = 'dev_error';
+
+    $this->assign('title', $message);
+    $this->assign('templateName', 'error400.php');
+
+    $this->start('file');
+?>
+<?php if (!empty($error->queryString)) : ?>
+    <p class="notice">
+        <strong>SQL Query: </strong>
+        <?= h($error->queryString) ?>
+    </p>
+<?php endif; ?>
+<?php if (!empty($error->params)) : ?>
+    <strong>SQL Query Params: </strong>
+    <?php Debugger::dump($error->params) ?>
+<?php endif; ?>
+
+<?php
+    echo $this->element('auto_table_warning');
+
+    $this->end();
+endif;
+?>
+<h2><?= h($message) ?></h2>
+<p class="error">
+    <strong><?= __d('cake', 'Error') ?>: </strong>
+    <?= __d('cake', 'The requested address {0} was not found on this server.', "<strong>'{$url}'</strong>") ?>
+</p>

+ 47 - 0
frameworks/PHP/cakephp/templates/Error/error500.php

@@ -0,0 +1,47 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var \Cake\Database\StatementInterface $error
+ * @var string $message
+ * @var string $url
+ */
+use Cake\Core\Configure;
+use Cake\Error\Debugger;
+
+$this->layout = 'error';
+
+if (Configure::read('debug')) :
+    $this->layout = 'dev_error';
+
+    $this->assign('title', $message);
+    $this->assign('templateName', 'error500.php');
+
+    $this->start('file');
+?>
+<?php if (!empty($error->queryString)) : ?>
+    <p class="notice">
+        <strong>SQL Query: </strong>
+        <?= h($error->queryString) ?>
+    </p>
+<?php endif; ?>
+<?php if (!empty($error->params)) : ?>
+    <strong>SQL Query Params: </strong>
+    <?php Debugger::dump($error->params) ?>
+<?php endif; ?>
+<?php if ($error instanceof Error) : ?>
+    <?php $file = $error->getFile() ?>
+    <?php $line = $error->getLine() ?>
+    <strong>Error in: </strong>
+    <?= $this->Html->link(sprintf('%s, line %s', Debugger::trimPath($file), $line), Debugger::editorUrl($file, $line)); ?>
+<?php endif; ?>
+<?php
+    echo $this->element('auto_table_warning');
+
+    $this->end();
+endif;
+?>
+<h2><?= __d('cake', 'An Internal Error Has Occurred.') ?></h2>
+<p class="error">
+    <strong><?= __d('cake', 'Error') ?>: </strong>
+    <?= h($message) ?>
+</p>

+ 239 - 0
frameworks/PHP/cakephp/templates/Pages/home.php

@@ -0,0 +1,239 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link      https://cakephp.org CakePHP(tm) Project
+ * @since     0.10.0
+ * @license   https://opensource.org/licenses/mit-license.php MIT License
+ * @var \App\View\AppView $this
+ */
+use Cake\Cache\Cache;
+use Cake\Core\Configure;
+use Cake\Core\Plugin;
+use Cake\Datasource\ConnectionManager;
+use Cake\Error\Debugger;
+use Cake\Http\Exception\NotFoundException;
+
+$this->disableAutoLayout();
+
+$checkConnection = function (string $name) {
+    $error = null;
+    $connected = false;
+    try {
+        ConnectionManager::get($name)->getDriver()->connect();
+        // No exception means success
+        $connected = true;
+    } catch (Exception $connectionError) {
+        $error = $connectionError->getMessage();
+        if (method_exists($connectionError, 'getAttributes')) {
+            $attributes = $connectionError->getAttributes();
+            if (isset($attributes['message'])) {
+                $error .= '<br />' . $attributes['message'];
+            }
+        }
+        if ($name === 'debug_kit') {
+            $error = 'Try adding your current <b>top level domain</b> to the
+                <a href="https://book.cakephp.org/debugkit/5/en/index.html#configuration" target="_blank">DebugKit.safeTld</a>
+            config and reload.';
+            if (!in_array('sqlite', \PDO::getAvailableDrivers())) {
+                $error .= '<br />You need to install the PHP extension <code>pdo_sqlite</code> so DebugKit can work properly.';
+            }
+        }
+    }
+
+    return compact('connected', 'error');
+};
+
+if (!Configure::read('debug')) :
+    throw new NotFoundException(
+        'Please replace templates/Pages/home.php with your own version or re-enable debug mode.'
+    );
+endif;
+
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <?= $this->Html->charset() ?>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>
+        CakePHP: the rapid development PHP framework:
+        <?= $this->fetch('title') ?>
+    </title>
+    <?= $this->Html->meta('icon') ?>
+
+    <?= $this->Html->css(['normalize.min', 'milligram.min', 'fonts', 'cake', 'home']) ?>
+
+    <?= $this->fetch('meta') ?>
+    <?= $this->fetch('css') ?>
+    <?= $this->fetch('script') ?>
+</head>
+<body>
+    <header>
+        <div class="container text-center">
+            <a href="https://cakephp.org/" target="_blank" rel="noopener">
+                <img alt="CakePHP" src="https://cakephp.org/v2/img/logos/CakePHP_Logo.svg" width="350" />
+            </a>
+            <h1>
+                Welcome to CakePHP <?= h(Configure::version()) ?> Chiffon (🍰)
+            </h1>
+        </div>
+    </header>
+    <main class="main">
+        <div class="container">
+            <div class="content">
+                <div class="row">
+                    <div class="column">
+                        <div class="message default text-center">
+                            <small>Please be aware that this page will not be shown if you turn off debug mode unless you replace templates/Pages/home.php with your own version.</small>
+                        </div>
+                        <div id="url-rewriting-warning" style="padding: 1rem; background: #fcebea; color: #cc1f1a; border-color: #ef5753;">
+                            <ul>
+                                <li class="bullet problem">
+                                    URL rewriting is not properly configured on your server.<br />
+                                    1) <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/installation.html#url-rewriting">Help me configure it</a><br />
+                                    2) <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/development/configuration.html#general-configuration">I don't / can't use URL rewriting</a>
+                                </li>
+                            </ul>
+                        </div>
+                        <?php Debugger::checkSecurityKeys(); ?>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="column">
+                        <h4>Environment</h4>
+                        <ul>
+                        <?php if (version_compare(PHP_VERSION, '8.1.0', '>=')) : ?>
+                            <li class="bullet success">Your version of PHP is 8.1.0 or higher (detected <?= PHP_VERSION ?>).</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your version of PHP is too low. You need PHP 8.1.0 or higher to use CakePHP (detected <?= PHP_VERSION ?>).</li>
+                        <?php endif; ?>
+
+                        <?php if (extension_loaded('mbstring')) : ?>
+                            <li class="bullet success">Your version of PHP has the mbstring extension loaded.</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your version of PHP does NOT have the mbstring extension loaded.</li>
+                        <?php endif; ?>
+
+                        <?php if (extension_loaded('openssl')) : ?>
+                            <li class="bullet success">Your version of PHP has the openssl extension loaded.</li>
+                        <?php elseif (extension_loaded('mcrypt')) : ?>
+                            <li class="bullet success">Your version of PHP has the mcrypt extension loaded.</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your version of PHP does NOT have the openssl or mcrypt extension loaded.</li>
+                        <?php endif; ?>
+
+                        <?php if (extension_loaded('intl')) : ?>
+                            <li class="bullet success">Your version of PHP has the intl extension loaded.</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your version of PHP does NOT have the intl extension loaded.</li>
+                        <?php endif; ?>
+                        </ul>
+                    </div>
+                    <div class="column">
+                        <h4>Filesystem</h4>
+                        <ul>
+                        <?php if (is_writable(TMP)) : ?>
+                            <li class="bullet success">Your tmp directory is writable.</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your tmp directory is NOT writable.</li>
+                        <?php endif; ?>
+
+                        <?php if (is_writable(LOGS)) : ?>
+                            <li class="bullet success">Your logs directory is writable.</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your logs directory is NOT writable.</li>
+                        <?php endif; ?>
+
+                        <?php $settings = Cache::getConfig('_cake_core_'); ?>
+                        <?php if (!empty($settings)) : ?>
+                            <li class="bullet success">The <em><?= h($settings['className']) ?></em> is being used for core caching. To change the config edit config/app.php</li>
+                        <?php else : ?>
+                            <li class="bullet problem">Your cache is NOT working. Please check the settings in config/app.php</li>
+                        <?php endif; ?>
+                        </ul>
+                    </div>
+                </div>
+                <hr>
+                <div class="row">
+                    <div class="column">
+                        <h4>Database</h4>
+                        <?php
+                        $result = $checkConnection('default');
+                        ?>
+                        <ul>
+                        <?php if ($result['connected']) : ?>
+                            <li class="bullet success">CakePHP is able to connect to the database.</li>
+                        <?php else : ?>
+                            <li class="bullet problem">CakePHP is NOT able to connect to the database.<br /><?= h($result['error']) ?></li>
+                        <?php endif; ?>
+                        </ul>
+                    </div>
+                    <div class="column">
+                        <h4>DebugKit</h4>
+                        <ul>
+                        <?php if (Plugin::isLoaded('DebugKit')) : ?>
+                            <li class="bullet success">DebugKit is loaded.</li>
+                            <?php
+                            $result = $checkConnection('debug_kit');
+                            ?>
+                            <?php if ($result['connected']) : ?>
+                                <li class="bullet success">DebugKit can connect to the database.</li>
+                            <?php else : ?>
+                                <li class="bullet problem">There are configuration problems present which need to be fixed:<br /><?= $result['error'] ?></li>
+                            <?php endif; ?>
+                        <?php else : ?>
+                            <li class="bullet problem">DebugKit is <strong>not</strong> loaded.</li>
+                        <?php endif; ?>
+                        </ul>
+                    </div>
+                </div>
+                <hr>
+                <div class="row">
+                    <div class="column links">
+                        <h3>Getting Started</h3>
+                        <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/">CakePHP Documentation</a>
+                        <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/tutorials-and-examples/cms/installation.html">The 20 min CMS Tutorial</a>
+                    </div>
+                </div>
+                <hr>
+                <div class="row">
+                    <div class="column links">
+                        <h3>Help and Bug Reports</h3>
+                        <a target="_blank" rel="noopener" href="https://slack-invite.cakephp.org/">Slack</a>
+                        <a target="_blank" rel="noopener" href="https://github.com/cakephp/cakephp/issues">CakePHP Issues</a>
+                        <a target="_blank" rel="noopener" href="https://discourse.cakephp.org/">CakePHP Forum</a>
+                    </div>
+                </div>
+                <hr>
+                <div class="row">
+                    <div class="column links">
+                        <h3>Docs and Downloads</h3>
+                        <a target="_blank" rel="noopener" href="https://api.cakephp.org/">CakePHP API</a>
+                        <a target="_blank" rel="noopener" href="https://bakery.cakephp.org">The Bakery</a>
+                        <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/en/">CakePHP Documentation</a>
+                        <a target="_blank" rel="noopener" href="https://plugins.cakephp.org">CakePHP plugins repo</a>
+                        <a target="_blank" rel="noopener" href="https://github.com/cakephp/">CakePHP Code</a>
+                        <a target="_blank" rel="noopener" href="https://github.com/FriendsOfCake/awesome-cakephp">CakePHP Awesome List</a>
+                        <a target="_blank" rel="noopener" href="https://www.cakephp.org">CakePHP</a>
+                    </div>
+                </div>
+                <hr>
+                <div class="row">
+                    <div class="column links">
+                        <h3>Training and Certification</h3>
+                        <a target="_blank" rel="noopener" href="https://cakefoundation.org/">Cake Software Foundation</a>
+                        <a target="_blank" rel="noopener" href="https://training.cakephp.org/">CakePHP Training</a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </main>
+</body>
+</html>

+ 15 - 0
frameworks/PHP/cakephp/templates/element/flash/default.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var array $params
+ * @var string $message
+ */
+$class = 'message';
+if (!empty($params['class'])) {
+    $class .= ' ' . $params['class'];
+}
+if (!isset($params['escape']) || $params['escape'] !== false) {
+    $message = h($message);
+}
+?>
+<div class="<?= h($class) ?>" onclick="this.classList.add('hidden');"><?= $message ?></div>

+ 11 - 0
frameworks/PHP/cakephp/templates/element/flash/error.php

@@ -0,0 +1,11 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var array $params
+ * @var string $message
+ */
+if (!isset($params['escape']) || $params['escape'] !== false) {
+    $message = h($message);
+}
+?>
+<div class="message error" onclick="this.classList.add('hidden');"><?= $message ?></div>

+ 11 - 0
frameworks/PHP/cakephp/templates/element/flash/info.php

@@ -0,0 +1,11 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var array $params
+ * @var string $message
+ */
+if (!isset($params['escape']) || $params['escape'] !== false) {
+    $message = h($message);
+}
+?>
+<div class="message" onclick="this.classList.add('hidden');"><?= $message ?></div>

+ 11 - 0
frameworks/PHP/cakephp/templates/element/flash/success.php

@@ -0,0 +1,11 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var array $params
+ * @var string $message
+ */
+if (!isset($params['escape']) || $params['escape'] !== false) {
+    $message = h($message);
+}
+?>
+<div class="message success" onclick="this.classList.add('hidden')"><?= $message ?></div>

+ 11 - 0
frameworks/PHP/cakephp/templates/element/flash/warning.php

@@ -0,0 +1,11 @@
+<?php
+/**
+ * @var \App\View\AppView $this
+ * @var array $params
+ * @var string $message
+ */
+if (!isset($params['escape']) || $params['escape'] !== false) {
+    $message = h($message);
+}
+?>
+<div class="message warning" onclick="this.classList.add('hidden');"><?= $message ?></div>

+ 17 - 0
frameworks/PHP/cakephp/templates/layout/ajax.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         0.10.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ * @var \App\View\AppView $this
+ */
+
+echo $this->fetch('content');

+ 55 - 1
frameworks/PHP/cakephp/templates/layout/default.php

@@ -1 +1,55 @@
-<?= $this->fetch('content') ?>
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         0.10.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ * @var \App\View\AppView $this
+ */
+
+$cakeDescription = 'CakePHP: the rapid development php framework';
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <?= $this->Html->charset() ?>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>
+        <?= $cakeDescription ?>:
+        <?= $this->fetch('title') ?>
+    </title>
+    <?= $this->Html->meta('icon') ?>
+
+    <?= $this->Html->css(['normalize.min', 'milligram.min', 'fonts', 'cake']) ?>
+
+    <?= $this->fetch('meta') ?>
+    <?= $this->fetch('css') ?>
+    <?= $this->fetch('script') ?>
+</head>
+<body>
+    <nav class="top-nav">
+        <div class="top-nav-title">
+            <a href="<?= $this->Url->build('/') ?>"><span>Cake</span>PHP</a>
+        </div>
+        <div class="top-nav-links">
+            <a target="_blank" rel="noopener" href="https://book.cakephp.org/5/">Documentation</a>
+            <a target="_blank" rel="noopener" href="https://api.cakephp.org/">API</a>
+        </div>
+    </nav>
+    <main class="main">
+        <div class="container">
+            <?= $this->Flash->render() ?>
+            <?= $this->fetch('content') ?>
+        </div>
+    </main>
+    <footer>
+    </footer>
+</body>
+</html>

+ 25 - 0
frameworks/PHP/cakephp/templates/layout/email/html/default.php

@@ -0,0 +1,25 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         0.10.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ * @var \App\View\AppView $this
+ */
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head>
+    <title><?= $this->fetch('title') ?></title>
+</head>
+<body>
+    <?= $this->fetch('content') ?>
+</body>
+</html>

+ 17 - 0
frameworks/PHP/cakephp/templates/layout/email/text/default.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         0.10.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ * @var \App\View\AppView $this
+ */
+
+echo $this->fetch('content');

+ 39 - 0
frameworks/PHP/cakephp/templates/layout/error.php

@@ -0,0 +1,39 @@
+<?php
+/**
+ * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
+ * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * For full copyright and license information, please see the LICENSE.txt
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
+ * @link          https://cakephp.org CakePHP(tm) Project
+ * @since         0.10.0
+ * @license       https://opensource.org/licenses/mit-license.php MIT License
+ * @var \App\View\AppView $this
+ */
+?>
+<!DOCTYPE html>
+<html>
+<head>
+    <?= $this->Html->charset() ?>
+    <title>
+        <?= $this->fetch('title') ?>
+    </title>
+    <?= $this->Html->meta('icon') ?>
+
+    <?= $this->Html->css(['normalize.min', 'milligram.min', 'fonts', 'cake']) ?>
+
+    <?= $this->fetch('meta') ?>
+    <?= $this->fetch('css') ?>
+    <?= $this->fetch('script') ?>
+</head>
+<body>
+    <div class="error-container">
+        <?= $this->Flash->render() ?>
+        <?= $this->fetch('content') ?>
+        <?= $this->Html->link(__('Back'), 'javascript:history.back()') ?>
+    </div>
+</body>
+</html>

+ 5 - 0
frameworks/PHP/cakephp/webroot/.htaccess

@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+    RewriteEngine On
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteRule ^ index.php [L]
+</IfModule>

+ 9 - 8
frameworks/PHP/cakephp/webroot/index.php

@@ -16,14 +16,15 @@
  */
 
 // For built-in server
-if (PHP_SAPI === 'cli-server') {
-    $_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
-    $url = parse_url(urldecode($_SERVER['REQUEST_URI']));
-    $file = __DIR__ . $url['path'];
-    if (strpos($url['path'], '..') === false && strpos($url['path'], '.') !== false && is_file($file)) {
-        return false;
-    }
-}
+// if (PHP_SAPI === 'cli-server') {
+//     $_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
+
+//     $url = parse_url(urldecode($_SERVER['REQUEST_URI']));
+//     $file = __DIR__ . $url['path'];
+//     if (strpos($url['path'], '..') === false && strpos($url['path'], '.') !== false && is_file($file)) {
+//         return false;
+//     }
+// }
 require dirname(__DIR__) . '/vendor/autoload.php';
 
 use App\Application;