From 2542e0f591a45fe3cd98f0ac9952a9e20d19f1d8 Mon Sep 17 00:00:00 2001 From: Cameron Blankenbuehler Date: Tue, 16 Apr 2024 13:23:54 -0400 Subject: [PATCH 01/23] Update CakePHP to 3.9.* --- composer.json | 2 +- composer.lock | 350 +++++++++++++++++++++++++++++--------------------- 2 files changed, 202 insertions(+), 150 deletions(-) diff --git a/composer.json b/composer.json index 173c143a8..04309caa1 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "AGPL-3.0-only", "description": "Code for tatoeba.org, a multilingual sentence and translation database", "require": { - "cakephp/cakephp": "3.8.*", + "cakephp/cakephp": "3.9.*", "cakephp/plugin-installer": "^1.0", "dereuromark/cakephp-queue": "dev-cake3", "markstory/asset_compress": "^3.5", diff --git a/composer.lock b/composer.lock index c2da76f7e..0770f7f8b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "19696de60b3da4f1145fd0e9d017475f", + "content-hash": "051df46a79ca1c8524e2fe98b9864785", "packages": [ { "name": "aura/intl", @@ -61,16 +61,16 @@ }, { "name": "cakephp/cakephp", - "version": "3.8.13", + "version": "3.9.10", "source": { "type": "git", "url": "https://github.com/cakephp/cakephp.git", - "reference": "1915d78f659d374224b2be0a5ad7822d96fb8366" + "reference": "3e12d303e4bdc9bfb167b0bc580aee75294ebbbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/cakephp/zipball/1915d78f659d374224b2be0a5ad7822d96fb8366", - "reference": "1915d78f659d374224b2be0a5ad7822d96fb8366", + "url": "https://api.github.com/repos/cakephp/cakephp/zipball/3e12d303e4bdc9bfb167b0bc580aee75294ebbbd", + "reference": "3e12d303e4bdc9bfb167b0bc580aee75294ebbbd", "shasum": "" }, "require": { @@ -78,10 +78,11 @@ "cakephp/chronos": "^1.0.1", "ext-intl": "*", "ext-mbstring": "*", - "php": ">=5.6.0", + "laminas/laminas-diactoros": "^1.4.0", + "paragonie/random_compat": "^1.4|^2.0|9.99.99", + "php": ">=5.6.0,<8.0.0", "psr/log": "^1.0.0", - "psr/simple-cache": "^1.0.0", - "zendframework/zend-diactoros": "^1.4.0" + "psr/simple-cache": "^1.0.0" }, "conflict": { "phpunit/phpunit": "<5.7" @@ -104,12 +105,14 @@ "require-dev": { "cakephp/cakephp-codesniffer": "^3.0", "cakephp/chronos": "^1.2.1", + "paragonie/csp-builder": "^1.4|^2.3", "phpunit/phpunit": "^5.7.14|^6.0" }, "suggest": { "ext-curl": "To enable more efficient network calls in Http\\Client.", "ext-openssl": "To use Security::encrypt() or have secure CSRF token generation.", - "lib-ICU": "The intl PHP library, to use Text::transliterate() or Text::slug()" + "lib-ICU": "The intl PHP library, to use Text::transliterate() or Text::slug()", + "paragonie/csp-builder": "CSP builder, to use the CSP Middleware" }, "type": "library", "autoload": { @@ -146,13 +149,7 @@ "rapid-development", "validation" ], - "support": { - "forum": "https://stackoverflow.com/tags/cakephp", - "irc": "irc://irc.freenode.org/cakephp", - "issues": "https://github.com/cakephp/cakephp/issues", - "source": "https://github.com/cakephp/cakephp" - }, - "time": "2020-06-19T18:52:08+00:00" + "time": "2021-05-31T01:20:39+00:00" }, { "name": "cakephp/chronos", @@ -424,6 +421,132 @@ }, "time": "2021-03-09T19:44:02+00:00" }, + { + "name": "laminas/laminas-diactoros", + "version": "1.8.7p2", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-diactoros.git", + "reference": "6991c1af7c8d2c8efee81b22ba97024781824aaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-diactoros/zipball/6991c1af7c8d2c8efee81b22ba97024781824aaa", + "reference": "6991c1af7c8d2c8efee81b22ba97024781824aaa", + "shasum": "" + }, + "require": { + "laminas/laminas-zendframework-bridge": "^1.0", + "php": "^5.6 || ^7.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "replace": { + "zendframework/zend-diactoros": "~1.8.7.0" + }, + "require-dev": { + "ext-dom": "*", + "ext-libxml": "*", + "laminas/laminas-coding-standard": "~1.0", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-release-1.8": "1.8.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions/create_uploaded_file.php", + "src/functions/marshal_headers_from_sapi.php", + "src/functions/marshal_method_from_sapi.php", + "src/functions/marshal_protocol_version_from_sapi.php", + "src/functions/marshal_uri_from_sapi.php", + "src/functions/normalize_server.php", + "src/functions/normalize_uploaded_files.php", + "src/functions/parse_cookie_header.php", + "src/functions/create_uploaded_file.legacy.php", + "src/functions/marshal_headers_from_sapi.legacy.php", + "src/functions/marshal_method_from_sapi.legacy.php", + "src/functions/marshal_protocol_version_from_sapi.legacy.php", + "src/functions/marshal_uri_from_sapi.legacy.php", + "src/functions/normalize_server.legacy.php", + "src/functions/normalize_uploaded_files.legacy.php", + "src/functions/parse_cookie_header.legacy.php" + ], + "psr-4": { + "Laminas\\Diactoros\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "PSR HTTP Message implementations", + "homepage": "https://laminas.dev", + "keywords": [ + "http", + "laminas", + "psr", + "psr-7" + ], + "time": "2020-03-23T15:28:28+00:00" + }, + { + "name": "laminas/laminas-zendframework-bridge", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/laminas/laminas-zendframework-bridge.git", + "reference": "88bf037259869891afce6504cacc4f8a07b24d0f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/88bf037259869891afce6504cacc4f8a07b24d0f", + "reference": "88bf037259869891afce6504cacc4f8a07b24d0f", + "shasum": "" + }, + "require": { + "php": "^7.3 || ~8.0.0 || ~8.1.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "psalm/plugin-phpunit": "^0.15.1", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.6" + }, + "type": "library", + "extra": { + "laminas": { + "module": "Laminas\\ZendFrameworkBridge" + } + }, + "autoload": { + "files": [ + "src/autoload.php" + ], + "psr-4": { + "Laminas\\ZendFrameworkBridge\\": "src//" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Alias legacy ZF class names to Laminas Project equivalents.", + "keywords": [ + "ZendFramework", + "autoloading", + "laminas", + "zf" + ], + "abandoned": true, + "time": "2021-12-21T14:34:37+00:00" + }, { "name": "league/climate", "version": "3.6.0", @@ -655,6 +778,51 @@ ], "time": "2018-01-09T11:15:01+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v9.99.99", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "shasum": "" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "time": "2018-07-02T15:55:56+00:00" + }, { "name": "patchwork/jsqueeze", "version": "v2.0.5", @@ -754,25 +922,25 @@ }, { "name": "psr/http-message", - "version": "1.0.1", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -800,10 +968,7 @@ "request", "response" ], - "support": { - "source": "https://github.com/php-fig/http-message/tree/master" - }, - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:50:52+00:00" }, { "name": "psr/log", @@ -1330,20 +1495,6 @@ "support": { "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], "time": "2021-10-20T20:35:02+00:00" }, { @@ -1479,16 +1630,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.25.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -1502,9 +1653,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1541,24 +1689,7 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", @@ -1873,73 +2004,6 @@ "description": "Symfony Yaml Component", "homepage": "https://symfony.com", "time": "2020-11-28T10:57:20+00:00" - }, - { - "name": "zendframework/zend-diactoros", - "version": "1.8.7", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-diactoros.git", - "reference": "a85e67b86e9b8520d07e6415fcbcb8391b44a75b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/a85e67b86e9b8520d07e6415fcbcb8391b44a75b", - "reference": "a85e67b86e9b8520d07e6415fcbcb8391b44a75b", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0", - "psr/http-message": "^1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-dom": "*", - "ext-libxml": "*", - "php-http/psr7-integration-tests": "dev-master", - "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", - "zendframework/zend-coding-standard": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-release-1.8": "1.8.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions/create_uploaded_file.php", - "src/functions/marshal_headers_from_sapi.php", - "src/functions/marshal_method_from_sapi.php", - "src/functions/marshal_protocol_version_from_sapi.php", - "src/functions/marshal_uri_from_sapi.php", - "src/functions/normalize_server.php", - "src/functions/normalize_uploaded_files.php", - "src/functions/parse_cookie_header.php" - ], - "psr-4": { - "Zend\\Diactoros\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "description": "PSR HTTP Message implementations", - "homepage": "https://github.com/zendframework/zend-diactoros", - "keywords": [ - "http", - "psr", - "psr-7" - ], - "support": { - "issues": "https://github.com/zendframework/zend-diactoros/issues", - "source": "https://github.com/zendframework/zend-diactoros" - }, - "abandoned": "laminas/laminas-diactoros", - "time": "2019-08-06T17:53:53+00:00" } ], "packages-dev": [ @@ -2067,6 +2131,7 @@ "issues": "https://github.com/aptoma/twig-markdown/issues", "source": "https://github.com/aptoma/twig-markdown/tree/master" }, + "abandoned": true, "time": "2015-10-23T20:27:08+00:00" }, { @@ -3066,6 +3131,7 @@ "keywords": [ "tokenizer" ], + "abandoned": true, "time": "2017-11-27T05:48:46+00:00" }, { @@ -3877,16 +3943,6 @@ "issues": "https://github.com/twigphp/Twig/issues", "source": "https://github.com/twigphp/Twig/tree/v1.44.6" }, - "funding": [ - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/twig/twig", - "type": "tidelift" - } - ], "time": "2021-11-25T13:31:46+00:00" }, { @@ -3939,12 +3995,12 @@ "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", + "url": "https://github.com/webmozarts/assert.git", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, @@ -4054,9 +4110,5 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [], - "platform-overrides": { - "php": "7.3.31" - }, - "plugin-api-version": "2.3.0" + "platform-dev": [] } From f6f643f048474aba4eba4984958fb27d3955d3c0 Mon Sep 17 00:00:00 2001 From: Cameron Blankenbuehler Date: Tue, 16 Apr 2024 13:25:13 -0400 Subject: [PATCH 02/23] Update CakePHP to 3.10.* --- composer.json | 2 +- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 04309caa1..d100c6fc5 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "AGPL-3.0-only", "description": "Code for tatoeba.org, a multilingual sentence and translation database", "require": { - "cakephp/cakephp": "3.9.*", + "cakephp/cakephp": "3.10.*", "cakephp/plugin-installer": "^1.0", "dereuromark/cakephp-queue": "dev-cake3", "markstory/asset_compress": "^3.5", diff --git a/composer.lock b/composer.lock index 0770f7f8b..b7f6a1b63 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "051df46a79ca1c8524e2fe98b9864785", + "content-hash": "a365b93f0ea17f74ca1d08c5a3d3b36e", "packages": [ { "name": "aura/intl", @@ -61,16 +61,16 @@ }, { "name": "cakephp/cakephp", - "version": "3.9.10", + "version": "3.10.5", "source": { "type": "git", "url": "https://github.com/cakephp/cakephp.git", - "reference": "3e12d303e4bdc9bfb167b0bc580aee75294ebbbd" + "reference": "571fb867995ccfa4034ec5b66577f0ab2acd4429" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/cakephp/zipball/3e12d303e4bdc9bfb167b0bc580aee75294ebbbd", - "reference": "3e12d303e4bdc9bfb167b0bc580aee75294ebbbd", + "url": "https://api.github.com/repos/cakephp/cakephp/zipball/571fb867995ccfa4034ec5b66577f0ab2acd4429", + "reference": "571fb867995ccfa4034ec5b66577f0ab2acd4429", "shasum": "" }, "require": { @@ -149,7 +149,7 @@ "rapid-development", "validation" ], - "time": "2021-05-31T01:20:39+00:00" + "time": "2023-01-02T02:53:00+00:00" }, { "name": "cakephp/chronos", From d75beec2cf6f32fcc8f6f5b083caa505eaa2ff0d Mon Sep 17 00:00:00 2001 From: Cameron Blankenbuehler Date: Tue, 16 Apr 2024 12:53:35 -0400 Subject: [PATCH 03/23] Fix deprecation warning for setting $config Setting `$config` is deprecated. Configurations files should instead return an array. See https://book.cakephp.org/3/en/appendices/3-0-migration-guide.html#configure --- config/auth_actions.php | 2 +- config/user_rights.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/auth_actions.php b/config/auth_actions.php index 8a05f4741..24b3ddebf 100644 --- a/config/auth_actions.php +++ b/config/auth_actions.php @@ -1,7 +1,7 @@ [ 'activities' => [ 'improve_sentences', 'translate_sentences_of' ], diff --git a/config/user_rights.php b/config/user_rights.php index 946af685d..d381b4bdd 100644 --- a/config/user_rights.php +++ b/config/user_rights.php @@ -1,7 +1,7 @@ [ ] ]; From b52e47d48b8533aca1916a82afa5bf8081e8000a Mon Sep 17 00:00:00 2001 From: Cameron Blankenbuehler Date: Tue, 16 Apr 2024 13:30:24 -0400 Subject: [PATCH 04/23] Remove references to Helper::$request property Access to Helper::$request as a property is deprecated as of CakePHP 3.7 The getter `Helper->getRequest()` should be used instead. See https://book.cakephp.org/3/en/appendices/3-7-migration-guide.html#deprecations Following are some other deprecation warnings addressed while fixing the above. - Request::param() is deprecated as of 3.4. Use Request::getParam() instead. See https://book.cakephp.org/3/en/appendices/3-4-migration-guide.html#request-response-deprecations - ServerRequest::here() to be removed in 4.0.0. Use getRequestTarget() instead. Note: The SecurityComponent is deprecated and I believe SecurityHelper will need to be refactored or removed entirely per the 4.0 Migration Guide (https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html#component) before migrating to CakePHP 5.x See this StackOverflow post for more details: https://stackoverflow.com/a/61630537 --- src/View/Helper/AppHelper.php | 4 ++-- src/View/Helper/CommonModulesHelper.php | 8 ++++---- src/View/Helper/LanguagesHelper.php | 2 +- src/View/Helper/PagesHelper.php | 2 +- src/View/Helper/PaginationHelper.php | 6 +++--- src/View/Helper/SecurityHelper.php | 2 +- src/View/Helper/SentencesHelper.php | 6 +++--- src/View/Helper/ShowAllHelper.php | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/View/Helper/AppHelper.php b/src/View/Helper/AppHelper.php index 73352383e..0467f982f 100644 --- a/src/View/Helper/AppHelper.php +++ b/src/View/Helper/AppHelper.php @@ -49,10 +49,10 @@ class AppHelper extends Helper public function url($url = null, $full = false) { - if (isset($this->request->params['lang']) + if (isset($this->getView()->getRequest()->params['lang']) && is_array($url) && !isset($url['lang'])) { - $url['lang'] = $this->request->params['lang']; + $url['lang'] = $this->getView()->getRequest()->params['lang']; } diff --git a/src/View/Helper/CommonModulesHelper.php b/src/View/Helper/CommonModulesHelper.php index 59b005f82..27653a5e0 100644 --- a/src/View/Helper/CommonModulesHelper.php +++ b/src/View/Helper/CommonModulesHelper.php @@ -68,11 +68,11 @@ public function createFilterByLangMod($maxNumberOfParams = 1) // without the language parameter $path ='/'; // language of the interface - $path .= $this->request->getParam('lang') .'/'; - $path .= Inflector::delimit($this->request->getParam('controller')).'/'; - $path .= $this->request->getParam('action'); + $path .= $this->getView()->getRequest()->getParam('lang') .'/'; + $path .= Inflector::delimit($this->getView()->getRequest()->getParam('controller')).'/'; + $path .= $this->getView()->getRequest()->getParam('action'); - $params = $this->request->getParam('pass'); + $params = $this->getView()->getRequest()->getParam('pass'); $numberOfParams = count($params); $paramsWithoutLang = $numberOfParams; diff --git a/src/View/Helper/LanguagesHelper.php b/src/View/Helper/LanguagesHelper.php index d9af6b04c..cc9ebf326 100644 --- a/src/View/Helper/LanguagesHelper.php +++ b/src/View/Helper/LanguagesHelper.php @@ -66,7 +66,7 @@ public function preferredLanguageFilter() { if (CurrentUser::isMember()) { return CurrentUser::getProfileLanguages(); } else { - return $this->request->getSession()->read('last_used_lang'); + return $this->getView()->getRequest()->getSession()->read('last_used_lang'); } } diff --git a/src/View/Helper/PagesHelper.php b/src/View/Helper/PagesHelper.php index 6489ecd58..11448c74e 100644 --- a/src/View/Helper/PagesHelper.php +++ b/src/View/Helper/PagesHelper.php @@ -72,7 +72,7 @@ public function formatResultCount($paginator, $real_total = 0, $totalOnly = fals } public function currentPageUrl() { - return $this->request->here(); + return $this->getView()->getRequest()->getRequestTarget(); } /** diff --git a/src/View/Helper/PaginationHelper.php b/src/View/Helper/PaginationHelper.php index 5e610d69b..9dc9c5e24 100644 --- a/src/View/Helper/PaginationHelper.php +++ b/src/View/Helper/PaginationHelper.php @@ -53,7 +53,7 @@ class PaginationHelper extends AppHelper */ public function sortDefaultOrder($title, $key = null, $options = array()){ // direction is given or no default is specified - if(isset($this->request->params['direction']) + if(isset($this->getView()->getRequest()->params['direction']) || !isset($options['defaultOrders']) || !isset($options['defaultOrders'][$key])){ return $this->Paginator->sort($key, $title, $options); @@ -61,8 +61,8 @@ public function sortDefaultOrder($title, $key = null, $options = array()){ $do = $options['defaultOrders']; //If no field is specified or the field ordered by is not the current field - if((isset($this->request->params['sort']) && $this->request->params['sort'] != $key) - || !isset($this->request->params['sort'])){ + if((isset($this->getView()->getRequest()->params['sort']) && $this->getView()->getRequest()->params['sort'] != $key) + || !isset($this->getView()->getRequest()->params['sort'])){ $options['direction'] = $do[$key]; } diff --git a/src/View/Helper/SecurityHelper.php b/src/View/Helper/SecurityHelper.php index c35a7141e..7a3c0b420 100644 --- a/src/View/Helper/SecurityHelper.php +++ b/src/View/Helper/SecurityHelper.php @@ -34,7 +34,7 @@ class SecurityHelper extends AppHelper private $token; public function beforeRender($viewFile) { - $this->token = $this->request['_Token']; + $this->token = $this->getView()->getRequest()->getParam('_Token'); //$this->disableCSRFProtection(); } diff --git a/src/View/Helper/SentencesHelper.php b/src/View/Helper/SentencesHelper.php index 82227b781..a734b8519 100644 --- a/src/View/Helper/SentencesHelper.php +++ b/src/View/Helper/SentencesHelper.php @@ -317,7 +317,7 @@ private function _displayNewTranslationForm($id) private function _translationForm($id, $langArray) { - $preSelectedLang = $this->request->getSession()->read('contribute_lang'); + $preSelectedLang = $this->getView()->getRequest()->getSession()->read('contribute_lang'); echo $this->Images->svgIcon( 'translation', @@ -491,7 +491,7 @@ public function displayGenericSentence( $sentenceId = $sentence->id; $sentenceLang = $sentence->lang; - $isFavoritePage = ($this->request->params['controller'] == 'Favorites' && $this->request->params['action'] == 'of_user'); + $isFavoritePage = ($this->getView()->getRequest()->getParam('controller') == 'Favorites' && $this->getView()->getRequest()->getParam('action') == 'of_user'); $classes = array('sentence', $type); if ($isEditable && $type == 'directTranslation') { $classes[] = 'editableTranslation'; @@ -551,7 +551,7 @@ public function displayGenericSentence( echo ''; } - if( $isFavoritePage && $this->request->params['pass'][0] == CurrentUser::get('username') ){ + if( $isFavoritePage && $this->getView()->getRequest()->getParam('pass')[0] == CurrentUser::get('username') ){ echo '
'; $this->Menu->favoriteButton($sentenceId, true, true, true); echo '
'; diff --git a/src/View/Helper/ShowAllHelper.php b/src/View/Helper/ShowAllHelper.php index 49091c439..c79b52258 100644 --- a/src/View/Helper/ShowAllHelper.php +++ b/src/View/Helper/ShowAllHelper.php @@ -61,9 +61,9 @@ private function _generateBaseUrl() // we reconstruct the path $path ='/'; // language of the interface - $path .= $this->request->getParam('lang') .'/'; - $path .= Inflector::delimit($this->request->getParam('controller')).'/'; - $path .= $this->request->getParam('action'); + $path .= $this->getView()->getRequest()->getParam('lang') .'/'; + $path .= Inflector::delimit($this->getView()->getRequest()->getParam('controller')).'/'; + $path .= $this->getView()->getRequest()->getParam('action'); return $path; } @@ -106,7 +106,7 @@ private function _generateJavascriptUrl($params, $position) private function _generateSelect($selectedLanguage, $langs, $position) { - $params = $this->request->getParam('pass'); + $params = $this->getView()->getRequest()->getParam('pass'); $javascriptUrl = $this->_generateJavascriptUrl($params, $position); return $this->_View->element( From 30b3b9c6c04fe440403e175aa371ab09b7994acb Mon Sep 17 00:00:00 2001 From: Cameron Blankenbuehler Date: Tue, 16 Apr 2024 16:32:00 -0400 Subject: [PATCH 05/23] Fix request->params property deprecation This addresses the following CakePHP 3.x deprecation notice > Accessing `params` as a property will be removed in 4.0.0. Use request->getParam() instead See https://book.cakephp.org/3/en/appendices/3-4-migration-guide.html#request-response-deprecations for details --- src/Controller/ApiV0Controller.php | 2 +- src/Controller/AppController.php | 8 ++++---- src/Controller/LinksController.php | 4 ++-- src/Controller/SentencesController.php | 3 +-- src/Controller/SentencesListsController.php | 4 ++-- src/Template/Element/pmmenu.ctp | 6 +++--- src/Template/SentenceComments/index.ctp | 2 +- src/Template/Sentences/of_user.ctp | 2 +- src/Template/Sentences/show.ctp | 6 +++--- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Controller/ApiV0Controller.php b/src/Controller/ApiV0Controller.php index c2bed61cc..2d84b92a2 100644 --- a/src/Controller/ApiV0Controller.php +++ b/src/Controller/ApiV0Controller.php @@ -103,7 +103,7 @@ public function search() } $json = json_encode([ - 'paging' => $this->request->params['paging'], + 'paging' => $this->request->getParam('paging'), 'results' => $results ]); return $this->response diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index 21b5dc0d8..e4fab72b2 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -233,15 +233,15 @@ protected function redirectPaginationToLastPage() { $paging = $this->request->getParam('paging'); $lastPage = reset($paging)['page']; - $queryParams = $this->request->params['?']; + $queryParams = $this->request->getParam('?'); $queryParams['page'] = $lastPage; $url = Router::url(array_merge( [ - 'controller' => $this->request->params['controller'], - 'action' => $this->request->params['action'], + 'controller' => $this->request->getParam('controller'), + 'action' => $this->request->getParam('action'), '?' => $queryParams ], - $this->request->params['pass'] + $this->request->getParam('pass') )); return $this->redirect($url); } diff --git a/src/Controller/LinksController.php b/src/Controller/LinksController.php index 6399d59d7..9a7a091e8 100644 --- a/src/Controller/LinksController.php +++ b/src/Controller/LinksController.php @@ -43,12 +43,12 @@ class LinksController extends AppController { public function initialize() { parent::initialize(); - $params = $this->request->params; + $request = $this->request; $noCsrfActions = [ 'add', 'delete' ]; - if (in_array($params['action'], $noCsrfActions)) { + if (in_array($request->getParam('action'), $noCsrfActions)) { $this->components()->unload('Csrf'); } } diff --git a/src/Controller/SentencesController.php b/src/Controller/SentencesController.php index 2629ef49b..ce717a2af 100644 --- a/src/Controller/SentencesController.php +++ b/src/Controller/SentencesController.php @@ -86,9 +86,8 @@ class SentencesController extends AppController public function initialize() { parent::initialize(); - $params = $this->request->params; $noCsrfActions = ['edit_sentence', 'change_language']; - if (in_array($params['action'], $noCsrfActions)) { + if (in_array($this->request->getParam('action'), $noCsrfActions)) { $this->components()->unload('Csrf'); } } diff --git a/src/Controller/SentencesListsController.php b/src/Controller/SentencesListsController.php index b68f2847b..b5def4c8d 100644 --- a/src/Controller/SentencesListsController.php +++ b/src/Controller/SentencesListsController.php @@ -64,14 +64,14 @@ class SentencesListsController extends AppController public function initialize() { parent::initialize(); - $params = $this->request->params; + $request = $this->request; $noCsrfActions = [ 'set_option', 'save_name', 'add_new_sentence_to_list', 'add_sentence_to_new_list' ]; - if (in_array($params['action'], $noCsrfActions)) { + if (in_array($request->getParam('action'), $noCsrfActions)) { $this->components()->unload('Csrf'); } } diff --git a/src/Template/Element/pmmenu.ctp b/src/Template/Element/pmmenu.ctp index 93473136d..4dd480fb8 100644 --- a/src/Template/Element/pmmenu.ctp +++ b/src/Template/Element/pmmenu.ctp @@ -31,9 +31,9 @@ $dratftsUrl = $this->Url->build(['action' => 'folder', 'Drafts']); $sentUrl = $this->Url->build(['action' => 'folder', 'Sent']); $trashUrl = $this->Url->build(['action' => 'folder', 'Trash']); -$isTrashFolder = $this->request->params['action'] == 'folder' - && $this->request->params['pass'] - && $this->request->params['pass'][0] == 'Trash'; +$isTrashFolder = $this->request->getParam('action') == 'folder' + && $this->request->getParam('pass') + && $this->request->getParam('pass')[0] == 'Trash'; ?> set('title_for_layout', $this->Pages->formatTitle(__('Comments on sentenc $this->Paginator->options( array( - 'url' => $this->request->params['pass'] + 'url' => $this->request->getParam('pass') ) ); ?> diff --git a/src/Template/Sentences/of_user.ctp b/src/Template/Sentences/of_user.ctp index b6fec58be..20fda5f88 100644 --- a/src/Template/Sentences/of_user.ctp +++ b/src/Template/Sentences/of_user.ctp @@ -30,7 +30,7 @@ if ($userExists === true) { $numberOfSentences = $this->Paginator->param('count'); $this->Paginator->options( array( - 'url' => $this->request->params['pass'] + 'url' => $this->request->getParam('pass') ) ); diff --git a/src/Template/Sentences/show.ctp b/src/Template/Sentences/show.ctp index bb5977905..442fdb899 100644 --- a/src/Template/Sentences/show.ctp +++ b/src/Template/Sentences/show.ctp @@ -57,9 +57,9 @@ if (isset($sentence)) { } else { // Case where the sentence has been deleted $this->set('title_for_layout', $this->Pages->formatTitle( - __('Sentence does not exist: ') . $this->request->params['pass'][0] + __('Sentence does not exist: ') . $this->request->getParam('pass')[0] )); - $sentenceId = $this->request->params['pass'][0]; + $sentenceId = $this->request->getParam('pass')[0]; } @@ -109,7 +109,7 @@ echo $this->element('/sentences/navigation', [ 'There is no sentence with id {number}', true ), - array('number' => $this->request->params['pass'][0]) + array('number' => $this->request->getParam('pass')[0]) ); echo ''; } From 04fd8c93cb37a66ba7fbdbeb420a96d5299b5b9c Mon Sep 17 00:00:00 2001 From: Cameron Blankenbuehler Date: Tue, 16 Apr 2024 17:30:18 -0400 Subject: [PATCH 06/23] Fix Form/FormHelper deprecations This commit addresses the following Form and FormHelper related 3.x deprecation warnings - FormHelper::input() is deprecated. Use FormHelper::control() instead. See https://book.cakephp.org/3/en/appendices/3-4-migration-guide.html#other-deprecations. - FormHelpter::create() should take `null` instead of a `string` or `bool` as the context when creating contextless forms. See https://book.cakephp.org/3/en/appendices/3-9-migration-guide.html#deprecations. --- .../Activities/translate_sentences.ctp | 2 +- src/Template/Audio/import.ctp | 2 +- src/Template/Audio/of.ctp | 4 +-- src/Template/CategoriesTree/manage.ctp | 14 ++++----- src/Template/Element/advanced_search_form.ctp | 28 +++++++++--------- src/Template/Element/announcement.ctp | 2 +- .../Element/private_messages/form.ctp | 2 +- src/Template/Element/search_bar.ctp | 19 +++++------- .../Element/sentence_comments/add_form.ctp | 2 +- .../sentences/add_sentences_jquery.ctp | 2 +- src/Template/Element/sentences/navigation.ctp | 6 ++-- src/Template/Element/short_description.ctp | 2 +- src/Template/Element/wall/add_form.ctp | 4 +-- src/Template/Element/wall/reply_form.ctp | 4 +-- src/Template/Favorites/of_user.ctp | 4 +-- src/Template/SentenceAnnotations/show.ctp | 2 +- src/Template/Sentences/import.ctp | 8 ++--- src/Template/Tags/view_all.ctp | 4 +-- src/Template/User/edit_profile.ctp | 4 +-- src/Template/User/settings.ctp | 22 +++++++------- src/Template/Users/all.ctp | 4 +-- src/Template/Users/edit.ctp | 14 ++++----- src/Template/Users/login.ctp | 6 ++-- src/Template/Users/login_dialog_template.ctp | 16 +++++----- src/Template/Users/new_password.ctp | 4 +-- src/Template/Users/register.ctp | 8 ++--- src/Template/Vocabulary/add.ctp | 4 +-- src/Template/Vocabulary/add_sentences.ctp | 4 +-- src/View/Helper/ListsHelper.php | 8 ++--- src/View/Helper/MenuHelper.php | 2 +- src/View/Helper/SentenceAnnotationsHelper.php | 29 ++++++++----------- src/View/Helper/SentencesHelper.php | 2 +- src/View/Helper/TagsHelper.php | 4 +-- 33 files changed, 118 insertions(+), 124 deletions(-) diff --git a/src/Template/Activities/translate_sentences.ctp b/src/Template/Activities/translate_sentences.ctp index e3d443fd8..350ac19ed 100644 --- a/src/Template/Activities/translate_sentences.ctp +++ b/src/Template/Activities/translate_sentences.ctp @@ -105,7 +105,7 @@ $langsTo = $this->Languages->profileLanguagesArray();
Form->create( - 'Activity', + null, array( "url" => array("action" => "translate_sentences"), "type" => "get" diff --git a/src/Template/Audio/import.ctp b/src/Template/Audio/import.ctp index 4139ef14c..45e5fb42c 100644 --- a/src/Template/Audio/import.ctp +++ b/src/Template/Audio/import.ctp @@ -215,7 +215,7 @@ if ($filesToImport): ?> 'inside the import directory.'); ?>

Form->input('audioAuthor', ['required' => true]); +echo $this->Form->control('audioAuthor', ['required' => true]); echo $this->Form->submit(__d('admin', 'Import'), $canImport ? [] : ['disabled' => true]); echo $this->Form->end(); ?> diff --git a/src/Template/Audio/of.ctp b/src/Template/Audio/of.ctp index 249cef13f..ba7fb41bb 100644 --- a/src/Template/Audio/of.ctp +++ b/src/Template/Audio/of.ctp @@ -45,13 +45,13 @@ if (isset($sentencesWithAudio)) { 'url' => array('controller' => 'audio', 'action' => 'save_settings'), 'type' => 'post', )); - echo $this->Form->input('audio_license', array( + echo $this->Form->control('audio_license', array( 'label' => __('License:'), 'options' => $this->AudioLicense->getLicenseOptions() )); ?> - Form->input('audio_attribution_url', array( + Form->control('audio_attribution_url', array( 'label' => __('Attribution URL:'), )) ?>
diff --git a/src/Template/CategoriesTree/manage.ctp b/src/Template/CategoriesTree/manage.ctp index c9468b096..af818c013 100644 --- a/src/Template/CategoriesTree/manage.ctp +++ b/src/Template/CategoriesTree/manage.ctp @@ -56,7 +56,7 @@ $messages = [
Form->create( - 'CreateOrEditCategory', + null, [ 'url' => [ 'controller' => 'categoriesTree', @@ -68,7 +68,7 @@ $messages = [ Form->input( + echo $this->Form->control( 'name', [ 'label' => __d('beta', 'Name (required)') @@ -79,7 +79,7 @@ $messages = [ Form->input( + echo $this->Form->control( 'description', [ 'label' => __d('beta', 'Description (optional)') @@ -90,7 +90,7 @@ $messages = [ Form->input( + echo $this->Form->control( 'parentName', [ 'id' => 'parentName', @@ -122,7 +122,7 @@ $messages = [
Form->create( - 'AttachTag', + null, [ 'url' => [ 'controller' => 'categories_tree', @@ -134,7 +134,7 @@ $messages = [ Form->input( + echo $this->Form->control( 'tagName', [ 'id' => 'tagName', @@ -147,7 +147,7 @@ $messages = [ Form->input( + echo $this->Form->control( 'categoryName', [ 'id' => 'categoryName', diff --git a/src/Template/Element/advanced_search_form.ctp b/src/Template/Element/advanced_search_form.ctp index 0c65202e2..b53666a23 100644 --- a/src/Template/Element/advanced_search_form.ctp +++ b/src/Template/Element/advanced_search_form.ctp @@ -21,7 +21,7 @@ $layout = isset($isSidebar) && $isSidebar ? 'column' : 'row'; $this->Html->script('sentences/search.ctrl.js', ['block' => 'scriptBottom']); -echo $this->Form->create('AdvancedSearch', [ +echo $this->Form->create(null, [ 'id' => 'advanced-search', 'url' => false, 'name' => 'form', @@ -59,7 +59,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('query', array( + echo $this->Form->control('query', array( 'label' => __('Words:'), 'lang' => '', 'dir' => 'auto', @@ -148,7 +148,7 @@ echo $this->Form->create('AdvancedSearch', [ Form->input('user', array( + echo $this->Form->control('user', array( 'label' => __('Owner:'), 'id' => 'OwnerSearch', 'ng-model' => 'filters.user', @@ -165,7 +165,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('orphans', [ + echo $this->Form->control('orphans', [ 'label' => '', 'options' => [ /* @translators: dropdown option of "Is orphan" field in search form */ @@ -189,7 +189,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('unapproved', array( + echo $this->Form->control('unapproved', array( 'label' => '', 'options' => array( /* @translators: dropdown option of "Is unapproved" field in search form */ @@ -210,7 +210,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('has_audio', array( + echo $this->Form->control('has_audio', array( 'label' => '', 'options' => array( /* @translators: dropdown option of "Has audio" field in search form */ @@ -226,7 +226,7 @@ echo $this->Form->create('AdvancedSearch', [ Form->input('tags', array( + echo $this->Form->control('tags', array( 'label' => __('Tags:'), 'id' => 'TagSearch', 'ng-model' => 'filters.tags', @@ -246,7 +246,7 @@ echo $this->Form->create('AdvancedSearch', [
Lists->listsAsSelectable($searchableLists->toList()); - echo $this->Form->input('list', [ + echo $this->Form->control('list', [ 'class' => 'list-select', 'label' => '', 'options' => $this->safeForAngular($listOptions), @@ -316,7 +316,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('trans_link', array( + echo $this->Form->control('trans_link', array( 'label' => '', 'options' => array( /* @translators: dropdown option of "Link" field in search form */ @@ -334,7 +334,7 @@ echo $this->Form->create('AdvancedSearch', [ Form->input('trans_user', array( + echo $this->Form->control('trans_user', array( 'label' => __('Owner:'), 'id' => 'TranslatorSearch', 'ng-model' => 'filters.trans_user', @@ -351,7 +351,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('trans_orphan', array( + echo $this->Form->control('trans_orphan', array( 'label' => '', 'options' => array( '' => __x('orphan', 'Any'), @@ -372,7 +372,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('trans_unapproved', array( + echo $this->Form->control('trans_unapproved', array( 'label' => '', 'options' => array( '' => __x('unapproved', 'Any'), @@ -392,7 +392,7 @@ echo $this->Form->create('AdvancedSearch', [
Form->input('trans_has_audio', array( + echo $this->Form->control('trans_has_audio', array( 'label' => '', 'options' => array( '' => __x('audio', 'Any'), @@ -416,7 +416,7 @@ echo $this->Form->create('AdvancedSearch', [ Form->input('sort', array( + echo $this->Form->control('sort', array( 'label' => '', 'options' => array( /* @translators: sort order dropdown option in search form */ diff --git a/src/Template/Element/announcement.ctp b/src/Template/Element/announcement.ctp index 16a4239b1..dd849621c 100644 --- a/src/Template/Element/announcement.ctp +++ b/src/Template/Element/announcement.ctp @@ -41,7 +41,7 @@ if (!CurrentUser::hasAcceptedNewTermsOfUse()) { 'controller' => 'pages', 'action' => 'contact' ]); - echo $this->Form->create('Users', [ + echo $this->Form->create(null, [ 'class' => 'announcement md-whiteframe-1dp', 'url' => ['controller' => 'user', 'action' => 'accept_new_terms_of_use'] ]); diff --git a/src/Template/Element/private_messages/form.ctp b/src/Template/Element/private_messages/form.ctp index 10a184f0e..324e03324 100644 --- a/src/Template/Element/private_messages/form.ctp +++ b/src/Template/Element/private_messages/form.ctp @@ -58,7 +58,7 @@ if ($isReply) { Form->input('title', [ + echo $this->Form->control('title', [ /* @translators: title field label in private message form */ 'label' => __('Title'), 'value' => $this->safeForAngular($pm->title), diff --git a/src/Template/Element/search_bar.ctp b/src/Template/Element/search_bar.ctp index 0579fd05d..91996f8d2 100644 --- a/src/Template/Element/search_bar.ctp +++ b/src/Template/Element/search_bar.ctp @@ -33,7 +33,7 @@ $searchQuery = h(str_replace('{{', '\{\{', json_encode($searchQuery)));
Form->create('Sentence', [ + echo $this->Form->create(null, [ 'layout' => 'column', 'url' => ['controller' => 'sentences', 'action' => 'search'], 'type' => 'get', @@ -63,16 +63,13 @@ $searchQuery = h(str_replace('{{', '\{\{', json_encode($searchQuery))); Form->create( - 'Sentence', - array( - 'id' => 'SentenceSearchForm', - 'name' => 'ctrl.form', - "url" => false, - 'ng-submit' => 'ctrl.submit(ctrl.form)', - "type" => "get" - ) -); +echo $this->Form->create(null, [ + 'id' => 'SentenceSearchForm', + 'name' => 'ctrl.form', + "url" => false, + 'ng-submit' => 'ctrl.submit(ctrl.form)', + "type" => "get" +]); ?>
Form->create('', [ + echo $this->Form->create(null, [ 'url' => ['controller' => 'sentence_comments', 'action' => 'save'] ]); echo $this->Form->hidden('sentence_id', ['value' => $sentenceId]); diff --git a/src/Template/Element/sentences/add_sentences_jquery.ctp b/src/Template/Element/sentences/add_sentences_jquery.ctp index a680ad726..e1ea38e97 100644 --- a/src/Template/Element/sentences/add_sentences_jquery.ctp +++ b/src/Template/Element/sentences/add_sentences_jquery.ctp @@ -15,7 +15,7 @@ $this->Html->script(JS_PATH . 'sentences.contribute.js', ['block' => 'scriptBott } else { $preSelectedLang = $this->request->getSession()->read('contribute_lang'); - echo $this->Form->create('Sentence', [ + echo $this->Form->create(null, [ 'id' => 'sentence-form', 'url' => '/sentences/add_an_other_sentence', 'onsubmit' => 'return false', diff --git a/src/Template/Element/sentences/navigation.ctp b/src/Template/Element/sentences/navigation.ctp index 47547eb30..dce4fdcf3 100644 --- a/src/Template/Element/sentences/navigation.ctp +++ b/src/Template/Element/sentences/navigation.ctp @@ -62,9 +62,9 @@ $sentenceUrl = $this->Url->build([ Form->create('Sentence', [ + echo $this->Form->create(null, [ 'id' => 'go-to-form', - 'url' => ['action' => 'go_to_sentence'], + 'url' => ['controller' => 'sentences', 'action' => 'go_to_sentence'], 'type' => 'get', 'hide-xs' => '', 'layout' => 'row', @@ -73,7 +73,7 @@ $sentenceUrl = $this->Url->build([ ?> Form->input('sentence_id', [ + echo $this->Form->control('sentence_id', [ 'type' => 'text', 'label' => __('Show sentence #: '), 'value' => $currentId, diff --git a/src/Template/Element/short_description.ctp b/src/Template/Element/short_description.ctp index e1436ead5..9e2dc1f98 100644 --- a/src/Template/Element/short_description.ctp +++ b/src/Template/Element/short_description.ctp @@ -46,7 +46,7 @@
- Form->input('user_id', + Form->control('user_id', array( 'type' => 'text', 'label' => __d('admin', 'Numeric user id: ') @@ -75,7 +75,7 @@ $langArray = $this->Languages->onlyLanguagesArray();

Form->create( - 'Import', + null, array( 'url' => array( 'action' => 'import_sentences_with_translation' @@ -100,7 +100,7 @@ $langArray = $this->Languages->onlyLanguagesArray();
- Form->input('user_id', + Form->control('user_id', array( 'type' => 'text', 'label' => __d('admin', 'Numeric user id: ') diff --git a/src/Template/Tags/view_all.ctp b/src/Template/Tags/view_all.ctp index 8e09d064b..8f943eb15 100644 --- a/src/Template/Tags/view_all.ctp +++ b/src/Template/Tags/view_all.ctp @@ -36,13 +36,13 @@ $tagsIndexUrl = $this->Url->build([
Html->tag('h2', __('Search tags')); - echo $this->Form->create('Tags', [ + echo $this->Form->create(null, [ 'url' => array('action' => 'search'), ]); ?> Form->input('search', [ + echo $this->Form->control('search', [ 'value' => $this->safeForAngular($filter), 'label' => false, ]); diff --git a/src/Template/User/edit_profile.ctp b/src/Template/User/edit_profile.ctp index f9a090e53..192dbfec4 100644 --- a/src/Template/User/edit_profile.ctp +++ b/src/Template/User/edit_profile.ctp @@ -45,7 +45,7 @@ $this->Languages->localizedAsort($countries);
Form->create( - 'profile_image', + null, array( 'url' => array( 'controller' => 'user', @@ -81,7 +81,7 @@ $this->Languages->localizedAsort($countries);
Form->create( - 'profile_image', + null, array( 'url' => array( 'controller' => 'user', diff --git a/src/Template/User/settings.ctp b/src/Template/User/settings.ctp index 059d2c548..9a74c55a4 100644 --- a/src/Template/User/settings.ctp +++ b/src/Template/User/settings.ctp @@ -87,7 +87,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings')));

Form->input( + echo $this->Form->control( 'settings.is_public', array( 'value' => '{{isPublic}}' @@ -114,7 +114,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings'))); ) ?>

Form->input( + echo $this->Form->control( 'settings.use_most_recent_list', array( 'value' => '{{useRecent}}' @@ -140,7 +140,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings'))); ) ?>

Form->input( + echo $this->Form->control( 'settings.collapsible_translations', array( 'value' => '{{collapsibleTranslations}}' @@ -162,7 +162,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings')));

Form->input( + echo $this->Form->control( 'settings.show_transcriptions', array( 'value' => '{{showTranscriptions}}' @@ -187,7 +187,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings')));

Form->input( + echo $this->Form->control( 'settings.hide_random_sentence', array( 'value' => '{{hideRandomSentence}}' @@ -230,7 +230,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings')));

- Form->input('settings.sentences_per_page', array( + Form->control('settings.sentences_per_page', array( 'options' => array(10 => 10, 20 => 20, 50 => 50, 100 => 100), 'label' => '' )); ?> @@ -238,7 +238,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings')));

- Form->input('settings.max_visible_translations', [ + Form->control('settings.max_visible_translations', [ 'options' => [5 => 5, 10 => 10, 20 => 20, 50 => 50], 'label' => '' ]); ?> @@ -247,7 +247,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings'))); settings['can_switch_license']) : ?>

- Form->input('settings.default_license', [ + Form->control('settings.default_license', [ 'options' => $this->SentenceLicense->getLicenseOptions(), 'label' => '' ]); ?> @@ -282,7 +282,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings')));

Form->input( + echo $this->Form->control( 'settings.users_collections_ratings', array( 'value' => '{{collectionRatings}}' @@ -311,7 +311,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings'))); ) ?>

Form->input( + echo $this->Form->control( 'settings.native_indicator', array( 'value' => '{{nativeIndicator}}' @@ -335,7 +335,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Settings'))); ) ?>

Form->input( + echo $this->Form->control( 'settings.use_new_design', array( 'value' => '{{1-useOldDesign}}' diff --git a/src/Template/Users/all.ctp b/src/Template/Users/all.ctp index 464ff84a6..1f3e6c9fc 100644 --- a/src/Template/Users/all.ctp +++ b/src/Template/Users/all.ctp @@ -43,12 +43,12 @@ $this->set('title_for_layout', $this->Pages->formatTitle(__('Members')));

Security->enableCSRFProtection(); - echo $this->Form->create('User', ['url' => ['action' => 'search']]); + echo $this->Form->create(null, ['url' => ['action' => 'search']]); ?> Form->input('search_username',[ + echo $this->Form->control('search_username',[ 'id' => 'usernameInput', 'label' => '', ]); diff --git a/src/Template/Users/edit.ctp b/src/Template/Users/edit.ctp index 1518358cb..5ee3c5da4 100644 --- a/src/Template/Users/edit.ctp +++ b/src/Template/Users/edit.ctp @@ -82,14 +82,14 @@ echo $this->Form->create($user, array('id' => 'UserEditForm'));
Form->input('id', array('label' => __d('admin', 'Id'))); - echo $this->Form->input('username', array('label' => __d('admin', 'Username'))); - echo $this->Form->input('settings.lang', array('label' => __d('admin', 'Lang'))); - echo $this->Form->input('role', array( + echo $this->Form->control('id', array('label' => __d('admin', 'Id'))); + echo $this->Form->control('username', array('label' => __d('admin', 'Username'))); + echo $this->Form->control('settings.lang', array('label' => __d('admin', 'Lang'))); + echo $this->Form->control('role', array( 'options' => array_combine($groups, $groups), 'label' => __d('admin', 'Group'), )); - echo $this->Form->input( + echo $this->Form->control( 'level', array( 'type' => 'radio', @@ -101,11 +101,11 @@ echo $this->Form->create($user, array('id' => 'UserEditForm')); ) ); echo '
'; - echo $this->Form->input('send_notifications', array( + echo $this->Form->control('send_notifications', array( 'label' => __d('admin', 'Send notifications') )); - echo $this->Form->input('settings.can_switch_license', [ + echo $this->Form->control('settings.can_switch_license', [ 'type' => 'checkbox', 'label' => __('Can switch license') ]); diff --git a/src/Template/Users/login.ctp b/src/Template/Users/login.ctp index 6580146fa..e5dc45359 100644 --- a/src/Template/Users/login.ctp +++ b/src/Template/Users/login.ctp @@ -65,7 +65,7 @@ $registerUrl = $this->Url->build( $this->Security->enableCSRFProtection(); echo $this->Form->create( - 'User', + null, array( 'url' => $formTarget, 'id' => "UserLoginForm" @@ -78,7 +78,7 @@ echo $this->Form->create(
Form->input( + echo $this->Form->control( 'username', array( 'label' => __('Username'), ) @@ -88,7 +88,7 @@ echo $this->Form->create( Form->input( + echo $this->Form->control( 'password', array( 'label' => __('Password'), ) diff --git a/src/Template/Users/login_dialog_template.ctp b/src/Template/Users/login_dialog_template.ctp index 1a98fb0a7..fdd968cee 100644 --- a/src/Template/Users/login_dialog_template.ctp +++ b/src/Template/Users/login_dialog_template.ctp @@ -11,11 +11,13 @@ $passwordUrl = $this->Url->build([ Security->enableCSRFProtection(); -echo $this->Form->create('User', ['url' => [ - 'controller' => 'users', - 'action' => 'check_login', - '?' => [AuthComponent::QUERY_STRING_REDIRECT => $redirectUrl], -]]); +echo $this->Form->create(null, [ + 'url' => [ + 'controller' => 'users', + 'action' => 'check_login', + '?' => [AuthComponent::QUERY_STRING_REDIRECT => $redirectUrl], + ] +]); ?> @@ -27,7 +29,7 @@ echo $this->Form->create('User', ['url' => [ Form->input('username', [ + echo $this->Form->control('username', [ 'label' => __('Username'), 'md-autofocus' => '' ]); @@ -36,7 +38,7 @@ echo $this->Form->create('User', ['url' => [ Form->input('password', [ + echo $this->Form->control('password', [ 'label' => __('Password') ]); ?> diff --git a/src/Template/Users/new_password.ctp b/src/Template/Users/new_password.ctp index 9ef6e428e..b6e5ac3ae 100644 --- a/src/Template/Users/new_password.ctp +++ b/src/Template/Users/new_password.ctp @@ -42,13 +42,13 @@ $this->Security->enableCSRFProtection();

- Form->create('User', array( + Form->create(null, array( "ng-cloak" => true, "url" => array("action" => "new_password") )); ?> - Form->input('email', [ + Form->control('email', [ 'label' => __('Email'), ]) ?> diff --git a/src/Template/Users/register.ctp b/src/Template/Users/register.ctp index 249ea808f..381f29395 100644 --- a/src/Template/Users/register.ctp +++ b/src/Template/Users/register.ctp @@ -64,7 +64,7 @@ $label = format( person Form->input( + echo $this->Form->control( 'username', array( 'label' => '', @@ -114,7 +114,7 @@ $label = format( lock Form->input( + echo $this->Form->control( 'password', array( 'label' => '', @@ -161,7 +161,7 @@ $label = format( email Form->input( + echo $this->Form->control( 'email', array( 'label' => '', @@ -204,7 +204,7 @@ $label = format( email Form->input( + echo $this->Form->control( 'confirm', array( /* @translators: This is a simple countermeasure against spam bots trying to diff --git a/src/Template/Vocabulary/add.ctp b/src/Template/Vocabulary/add.ctp index 2910d95e0..2f448a7cb 100644 --- a/src/Template/Vocabulary/add.ctp +++ b/src/Template/Vocabulary/add.ctp @@ -56,7 +56,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle($title));
- Form->create('Vocabulary', [ + Form->create(null, [ 'ng-cloak' => true, 'id' => 'add-vocabulary-form', 'ng-submit' => 'ctrl.add()', @@ -86,7 +86,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle($title));
- Form->input('text', [ + Form->control('text', [ 'label' => __('Vocabulary item'), 'ng-model' => 'ctrl.data.text', 'ng-disabled' => 'ctrl.isAdding', diff --git a/src/Template/Vocabulary/add_sentences.ctp b/src/Template/Vocabulary/add_sentences.ctp index e5bc1150e..3a2b24794 100644 --- a/src/Template/Vocabulary/add_sentences.ctp +++ b/src/Template/Vocabulary/add_sentences.ctp @@ -108,7 +108,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle($title));
- Form->create('Vocabulary', [ + Form->create(null, [ 'id' => 'form_'.$id, 'url' => ['controller' => 'vocabulary', 'action' => 'save_sentence', $id], 'class' => 'sentence-form', @@ -121,7 +121,7 @@ $this->set('title_for_layout', $this->Pages->formatTitle($title)); ]); ?> Form->hidden('lang', ['value' => $lang]) ?> - Form->input('text', [ + Form->control('text', [ 'id' => 'form_'.$id.'_input', /* @translators: sentence text field label of sentence addition form on vocabulary page */ 'label' => __('Sentence'), diff --git a/src/View/Helper/ListsHelper.php b/src/View/Helper/ListsHelper.php index 5bb0c5f59..330990a12 100644 --- a/src/View/Helper/ListsHelper.php +++ b/src/View/Helper/ListsHelper.php @@ -585,7 +585,7 @@ public function displayAddSentenceForm($listId)
Form->input( + echo $this->Form->control( 'text', array( 'label' => __('Add a sentence to this list : '), @@ -676,7 +676,7 @@ public function displayCreateListForm()

Form->create('SentencesList', [ + echo $this->Form->create(null, [ 'url' => ['action' => 'add'], 'type' => 'post', ]); @@ -711,7 +711,7 @@ public function displaySearchForm($search, $extraHiddenParams = null) /* @translators: header text in List of lists page (noun) */ echo $this->Html->tag('h2', __x('header', 'Search')); - echo $this->Form->create('SentencesList', ['type' => 'get']); + echo $this->Form->create(null, ['type' => 'get']); if (!empty($extraHiddenParams)) { foreach ($extraHiddenParams as $key => $value) { @@ -722,7 +722,7 @@ public function displaySearchForm($search, $extraHiddenParams = null) Form->input('search', [ + echo $this->Form->control('search', [ 'value' => $this->_View->safeForAngular($search), 'label' => false ]); diff --git a/src/View/Helper/MenuHelper.php b/src/View/Helper/MenuHelper.php index 6ef4082b2..1befd44ca 100644 --- a/src/View/Helper/MenuHelper.php +++ b/src/View/Helper/MenuHelper.php @@ -278,7 +278,7 @@ public function linkToSentenceButton($sentenceId, $langFilter = 'und') {