diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index 542b916b69..c146816258 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -93,22 +93,14 @@ registerArgumentsSet('cast_type', 'bool', 'int', 'float', 'string', 'object', 'array'); expectedArguments(\Redaxo\Core\Util\Type::cast(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_get(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_post(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_server(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_session(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_cookie(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_files(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_env(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::get(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::post(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::request(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::server(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::session(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::cookie(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::files(), 1, argumentsSet('cast_type')); -expectedArguments(\rex_request::env(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::get(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::post(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::request(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::server(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::session(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::cookie(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::files(), 1, argumentsSet('cast_type')); +expectedArguments(\Redaxo\Core\HttpClient\Request::env(), 1, argumentsSet('cast_type')); override( \Redaxo\Core\Security\User::getComplexPerm(0), diff --git a/.tools/phpstan/baseline.neon b/.tools/phpstan/baseline.neon index 9787535089..15bcc39424 100644 --- a/.tools/phpstan/baseline.neon +++ b/.tools/phpstan/baseline.neon @@ -150,51 +150,6 @@ parameters: count: 1 path: ../../redaxo/src/core/functions/function_structure_rex_url.php - - - message: "#^Method rex_context\\:\\:array2inputStr\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/context.php - - - - message: "#^Method rex_context\\:\\:getHiddenInputFields\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/context.php - - - - message: "#^Method rex_context\\:\\:getUrl\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/context.php - - - - message: "#^Method rex_context_provider_interface\\:\\:getHiddenInputFields\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/context.php - - - - message: "#^Method rex_url_provider_interface\\:\\:getUrl\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/context.php - - - - message: "#^Method rex_request\\:\\:arrayKeyCast\\(\\) has parameter \\$haystack with no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/request.php - - - - message: "#^If condition is always true\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/response.php - - - - message: "#^Property rex_response\\:\\:\\$additionalHeaders type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/response.php - - - - message: "#^Property rex_response\\:\\:\\$preloadFiles type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../redaxo/src/core/lib/response.php - - message: "#^Method rex_setup\\:\\:checkDb\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" count: 1 @@ -230,6 +185,11 @@ parameters: count: 1 path: ../../src/Backend/Page.php + - + message: "#^Method Redaxo\\\\Core\\\\Base\\\\UrlProviderInterface\\:\\:getUrl\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Base/UrlProviderInterface.php + - message: "#^Method Redaxo\\\\Core\\\\Content\\\\ArticleAction\\:\\:__construct\\(\\) has parameter \\$function with no type specified\\.$#" count: 1 @@ -900,6 +860,46 @@ parameters: count: 1 path: ../../src/Form/Select/Select.php + - + message: "#^Method Redaxo\\\\Core\\\\Http\\\\Context\\:\\:array2inputStr\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/Context.php + + - + message: "#^Method Redaxo\\\\Core\\\\Http\\\\Context\\:\\:getHiddenInputFields\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/Context.php + + - + message: "#^Method Redaxo\\\\Core\\\\Http\\\\Context\\:\\:getUrl\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/Context.php + + - + message: "#^Method Redaxo\\\\Core\\\\Http\\\\ContextProviderInterface\\:\\:getHiddenInputFields\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/ContextProviderInterface.php + + - + message: "#^Method Redaxo\\\\Core\\\\Http\\\\Request\\:\\:arrayKeyCast\\(\\) has parameter \\$haystack with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/Request.php + + - + message: "#^If condition is always true\\.$#" + count: 1 + path: ../../src/Http/Response.php + + - + message: "#^Property Redaxo\\\\Core\\\\Http\\\\Response\\:\\:\\$additionalHeaders type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/Response.php + + - + message: "#^Property Redaxo\\\\Core\\\\Http\\\\Response\\:\\:\\$preloadFiles type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../src/Http/Response.php + - message: "#^Method Redaxo\\\\Core\\\\Language\\\\LanguagePermission\\:\\:getClangs\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/.tools/psalm/baseline-taint.xml b/.tools/psalm/baseline-taint.xml index 6ca3c41f76..a8c0471a28 100644 --- a/.tools/psalm/baseline-taint.xml +++ b/.tools/psalm/baseline-taint.xml @@ -2,18 +2,18 @@ - + var history_article_id = ' . Article::getCurrentId() . '; var history_clang_id = ' . Language::getCurrentId() . '; - var history_ctype_id = ' . rex_request('ctype', 'int', 0) . '; + var history_ctype_id = ' . Request::request('ctype', 'int', 0) . '; var history_article_link = "' . rex_escape($articleLink, 'js') . '"; ']]> - + var history_article_id = ' . Article::getCurrentId() . '; var history_clang_id = ' . Language::getCurrentId() . '; - var history_ctype_id = ' . rex_request('ctype', 'int', 0) . '; + var history_ctype_id = ' . Request::request('ctype', 'int', 0) . '; var history_article_link = "' . rex_escape($articleLink, 'js') . '"; ']]> @@ -76,18 +76,17 @@ getVar('content2select')]]> - - - - - - + + + + + diff --git a/.tools/psalm/baseline.xml b/.tools/psalm/baseline.xml index 4937db7e2f..98a5c3c7a1 100644 --- a/.tools/psalm/baseline.xml +++ b/.tools/psalm/baseline.xml @@ -983,32 +983,13 @@ - - - - - - - - - - - - - - - - - - - - + @@ -1032,68 +1013,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - getStart()]]> - - - - - - - - - - - - - - - - getEnd()]]> - getLength()]]> - getStart()]]> - - - - - - - - - - - - - - - - - - - @@ -1674,8 +1593,8 @@ getValue('parent_id')]]> getValue('parent_id')]]> - - + + @@ -2107,7 +2026,7 @@ - + @@ -3356,6 +3275,87 @@ ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getStart()]]> + + + + + + + + + + + + + + + + getEnd()]]> + getLength()]]> + getStart()]]> + + + + + + + + + + + + + + + + + + + @@ -4245,8 +4245,8 @@ + ]]> - @@ -4509,17 +4509,14 @@ - - - @@ -4533,7 +4530,6 @@ - diff --git a/composer.json b/composer.json index 4a96865777..8c31e3bd33 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "psalm/plugin-symfony": "v5.1.0", "rector/rector": "1.0.5", "redaxo/php-cs-fixer-config": "2.10.0", - "redaxo/psalm-plugin": "2.0.0", + "redaxo/psalm-plugin": "2.1.0", "vimeo/psalm": "5.24.0" }, "replace": { @@ -70,7 +70,6 @@ "redaxo/src/core/functions/function_metainfo_extension_cleanup.php", "redaxo/src/core/functions/function_metainfo.php", "redaxo/src/core/functions/function_rex_escape.php", - "redaxo/src/core/functions/function_rex_globals.php", "redaxo/src/core/functions/function_rex_mediapool.php", "redaxo/src/core/functions/function_rex_other.php", "redaxo/src/core/functions/function_structure_rex_url.php" diff --git a/rector.php b/rector.php index 5d35c39954..ed01dabf03 100644 --- a/rector.php +++ b/rector.php @@ -52,6 +52,7 @@ use Redaxo\Core\ExtensionPoint; use Redaxo\Core\Filesystem; use Redaxo\Core\Form; +use Redaxo\Core\Http; use Redaxo\Core\HttpClient; use Redaxo\Core\Language; use Redaxo\Core\Log; @@ -197,6 +198,10 @@ 'rex_cronjob_form' => Cronjob\Form\CronjobForm::class, 'rex_config' => Config::class, 'rex_config_db' => Database\Configuration::class, + 'rex_context' => Http\Context::class, + 'rex_context_provider_interface' => Http\ContextProviderInterface::class, + 'rex_request' => Http\Request::class, + 'rex_response' => Http\Response::class, 'rex_cronjob_form_interval_element' => Cronjob\Form\IntervalField::class, 'rex_cronjob' => Cronjob\Type\AbstractType::class, 'rex_cronjob_urlrequest' => Cronjob\Type\UrlRequestType::class, @@ -317,6 +322,7 @@ 'rex_instance_pool_trait' => Base\InstancePoolTrait::class, 'rex_singleton_trait' => Base\SingletonTrait::class, 'rex_url' => Filesystem\Url::class, + 'rex_url_provider_interface' => Base\UrlProviderInterface::class, 'rex_validator' => Validator\Validator::class, 'rex_validation_rule' => Validator\ValidationRule::class, 'rex_var' => RexVar\RexVar::class, @@ -445,13 +451,25 @@ new FuncCallToStaticCall('rex_mediapool_updateMedia', MediaPool\MediaPool::class, 'updateMedia'), // different params new FuncCallToStaticCall('rex_mediapool_syncFile', MediaPool\MediaPool::class, 'addMedia'), // different params new FuncCallToStaticCall('rex_mediapool_deleteMedia', MediaPool\MediaPool::class, 'deleteMedia'), // different return value + + new FuncCallToStaticCall('rex_cookie', Http\Request::class, 'cookie'), + new FuncCallToStaticCall('rex_env', Http\Request::class, 'env'), + new FuncCallToStaticCall('rex_files', Http\Request::class, 'files'), + new FuncCallToStaticCall('rex_get', Http\Request::class, 'get'), + new FuncCallToStaticCall('rex_post', Http\Request::class, 'post'), + new FuncCallToStaticCall('rex_request', Http\Request::class, 'request'), + new FuncCallToStaticCall('rex_request_method', Http\Request::class, 'requestMethod'), + new FuncCallToStaticCall('rex_server', Http\Request::class, 'server'), + new FuncCallToStaticCall('rex_session', Http\Request::class, 'session'), + new FuncCallToStaticCall('rex_set_session', Http\Request::class, 'setSession'), + new FuncCallToStaticCall('rex_unset_session', Http\Request::class, 'unsetSession'), ]) ->withConfiguredRule(RemoveFuncCallArgRector::class, [ new RemoveFuncCallArg('rex_getUrl', 3), ]) ->withConfiguredRule(ArgumentRemoverRector::class, [ new ArgumentRemover(Util\Str::class, 'buildQuery', 1, null), - new ArgumentRemover(rex_url_provider_interface::class, 'getUrl', 1, null), + new ArgumentRemover(Base\UrlProviderInterface::class, 'getUrl', 1, null), new ArgumentRemover(Filesystem\Url::class, 'frontendController', 1, null), new ArgumentRemover(Filesystem\Url::class, 'backendController', 1, null), new ArgumentRemover(Filesystem\Url::class, 'backendPage', 2, null), diff --git a/redaxo/src/addons/debug/boot.php b/redaxo/src/addons/debug/boot.php index 537843a9a2..98a4655966 100644 --- a/redaxo/src/addons/debug/boot.php +++ b/redaxo/src/addons/debug/boot.php @@ -10,16 +10,18 @@ use Redaxo\Core\Database\Sql; use Redaxo\Core\ExtensionPoint\Extension; use Redaxo\Core\Filesystem\Path; +use Redaxo\Core\Http\Request; +use Redaxo\Core\Http\Response; use Redaxo\Core\Language\Language; use Redaxo\Core\Log\Logger; use Redaxo\Core\Util\Editor; use Redaxo\Core\Util\Timer; -if (!rex_debug_clockwork::isRexDebugEnabled() || 'debug' === rex_get(ApiFunction::REQ_CALL_PARAM)) { +if (!rex_debug_clockwork::isRexDebugEnabled() || 'debug' === Request::get(ApiFunction::REQ_CALL_PARAM)) { return; } -if (Core::isBackend() && 'debug' === rex_request::get('page') && Core::getUser()?->isAdmin()) { +if (Core::isBackend() && 'debug' === Request::get('page') && Core::getUser()?->isAdmin()) { $index = file_get_contents(Addon::require('debug')->getAssetsPath('clockwork/index.html')); $editor = Editor::factory(); @@ -42,7 +44,7 @@ $appearance = 'auto'; } - $nonce = rex_response::getNonce(); + $nonce = Response::getNonce(); $injectedScript = << @@ -70,7 +72,7 @@ EOF; $index = str_replace('', '' . $injectedScript, $index); - rex_response::sendPage($index); + Response::sendPage($index); exit; } @@ -80,10 +82,10 @@ Logger::setFactoryClass(rex_logger_debug::class); ApiFunction::setFactoryClass(rex_api_function_debug::class); -rex_response::setHeader('X-Clockwork-Id', rex_debug_clockwork::getInstance()->getRequest()->id); -rex_response::setHeader('X-Clockwork-Version', Clockwork::VERSION); +Response::setHeader('X-Clockwork-Id', rex_debug_clockwork::getInstance()->getRequest()->id); +Response::setHeader('X-Clockwork-Version', Clockwork::VERSION); -rex_response::setHeader('X-Clockwork-Path', rex_debug_clockwork::getClockworkApiUrl()); +Response::setHeader('X-Clockwork-Path', rex_debug_clockwork::getClockworkApiUrl()); $shutdownFn = static function () { $clockwork = rex_debug_clockwork::getInstance(); diff --git a/redaxo/src/addons/debug/lib/api_debug.php b/redaxo/src/addons/debug/lib/api_debug.php index 8461124670..82b4c2f2aa 100644 --- a/redaxo/src/addons/debug/lib/api_debug.php +++ b/redaxo/src/addons/debug/lib/api_debug.php @@ -3,6 +3,7 @@ use Redaxo\Core\ApiFunction\ApiFunction; use Redaxo\Core\ApiFunction\Result; use Redaxo\Core\Core; +use Redaxo\Core\Http\Response; /** * @internal @@ -17,7 +18,7 @@ public function execute() $debug = rex_debug_clockwork::getHelper(); - rex_response::sendJson($debug->getMetadata()); + Response::sendJson($debug->getMetadata()); exit; } diff --git a/redaxo/src/addons/install/lib/api/api_core_update.php b/redaxo/src/addons/install/lib/api/api_core_update.php index 3b27691f45..0aec2b609d 100644 --- a/redaxo/src/addons/install/lib/api/api_core_update.php +++ b/redaxo/src/addons/install/lib/api/api_core_update.php @@ -11,6 +11,7 @@ use Redaxo\Core\Filesystem\File; use Redaxo\Core\Filesystem\Finder; use Redaxo\Core\Filesystem\Path; +use Redaxo\Core\Http\Request; use Redaxo\Core\Log\Logger; use Redaxo\Core\Translation\I18n; use Redaxo\Core\Util\Version; @@ -38,7 +39,7 @@ public function execute() } $installAddon = Addon::get('install'); $versions = self::getVersions(); - $versionId = rex_request('version_id', 'int'); + $versionId = Request::request('version_id', 'int'); if (!isset($versions[$versionId])) { throw new ApiFunctionException('The requested core version can not be loaded, maybe it is already installed.'); diff --git a/redaxo/src/addons/install/lib/api/api_package_add.php b/redaxo/src/addons/install/lib/api/api_package_add.php index f29611e369..2611267d96 100644 --- a/redaxo/src/addons/install/lib/api/api_package_add.php +++ b/redaxo/src/addons/install/lib/api/api_package_add.php @@ -7,6 +7,7 @@ use Redaxo\Core\ApiFunction\Result; use Redaxo\Core\Core; use Redaxo\Core\Filesystem\Url; +use Redaxo\Core\Http\Request; use Redaxo\Core\Translation\I18n; /** @@ -22,8 +23,8 @@ public function execute() if (!Core::getUser()?->isAdmin()) { throw new ApiFunctionException('You do not have the permission!'); } - $addonkey = rex_request('addonkey', 'string'); - $fileId = rex_request('file', 'int'); + $addonkey = Request::request('addonkey', 'string'); + $fileId = Request::request('file', 'int'); $installer = new rex_install_package_add(); diff --git a/redaxo/src/addons/install/lib/api/api_package_delete.php b/redaxo/src/addons/install/lib/api/api_package_delete.php index 2e4772c99f..5f81f8ce31 100644 --- a/redaxo/src/addons/install/lib/api/api_package_delete.php +++ b/redaxo/src/addons/install/lib/api/api_package_delete.php @@ -4,6 +4,7 @@ use Redaxo\Core\ApiFunction\Exception\ApiFunctionException; use Redaxo\Core\ApiFunction\Result; use Redaxo\Core\Core; +use Redaxo\Core\Http\Request; use Redaxo\Core\Translation\I18n; /** @@ -19,9 +20,9 @@ public function execute() if (!Core::getUser()?->isAdmin()) { throw new ApiFunctionException('You do not have the permission!'); } - $addonkey = rex_request('addonkey', 'string'); + $addonkey = Request::request('addonkey', 'string'); try { - rex_install_webservice::delete(rex_install_packages::getPath('?package=' . urlencode($addonkey) . '&file_id=' . rex_request('file', 'int', 0))); + rex_install_webservice::delete(rex_install_packages::getPath('?package=' . urlencode($addonkey) . '&file_id=' . Request::request('file', 'int', 0))); } catch (rex_functional_exception $e) { throw new ApiFunctionException($e->getMessage()); } diff --git a/redaxo/src/addons/install/lib/api/api_package_update.php b/redaxo/src/addons/install/lib/api/api_package_update.php index e78d9025a8..6681ccefe9 100644 --- a/redaxo/src/addons/install/lib/api/api_package_update.php +++ b/redaxo/src/addons/install/lib/api/api_package_update.php @@ -4,6 +4,7 @@ use Redaxo\Core\ApiFunction\Exception\ApiFunctionException; use Redaxo\Core\ApiFunction\Result; use Redaxo\Core\Core; +use Redaxo\Core\Http\Request; use Redaxo\Core\Translation\I18n; /** @@ -19,8 +20,8 @@ public function execute() if (!Core::getUser()?->isAdmin()) { throw new ApiFunctionException('You do not have the permission!'); } - $addonkey = rex_request('addonkey', 'string'); - $fileId = rex_request('file', 'int'); + $addonkey = Request::request('addonkey', 'string'); + $fileId = Request::request('file', 'int'); $installer = new rex_install_package_update(); diff --git a/redaxo/src/addons/install/lib/api/api_package_upload.php b/redaxo/src/addons/install/lib/api/api_package_upload.php index 04f08c032a..a948d4d99d 100644 --- a/redaxo/src/addons/install/lib/api/api_package_upload.php +++ b/redaxo/src/addons/install/lib/api/api_package_upload.php @@ -8,6 +8,7 @@ use Redaxo\Core\Filesystem\File; use Redaxo\Core\Filesystem\Path; use Redaxo\Core\Filesystem\Url; +use Redaxo\Core\Http\Request; use Redaxo\Core\Translation\I18n; /** @@ -23,8 +24,8 @@ public function execute() if (!Core::getUser()?->isAdmin()) { throw new ApiFunctionException('You do not have the permission!'); } - $addonkey = rex_request('addonkey', 'string'); - $upload = rex_request('upload', [ + $addonkey = Request::request('addonkey', 'string'); + $upload = Request::request('upload', [ ['upload_file', 'bool'], ['oldversion', 'string'], ['description', 'string'], @@ -67,7 +68,7 @@ public function execute() } $file['checksum'] = md5_file($archive); } - rex_install_webservice::post(rex_install_packages::getPath('?package=' . urlencode($addonkey) . '&file_id=' . rex_request('file', 'int', 0)), ['file' => $file], $archive); + rex_install_webservice::post(rex_install_packages::getPath('?package=' . urlencode($addonkey) . '&file_id=' . Request::request('file', 'int', 0)), ['file' => $file], $archive); } catch (rex_functional_exception $e) { throw new ApiFunctionException($e->getMessage()); } finally { diff --git a/redaxo/src/addons/install/pages/index.php b/redaxo/src/addons/install/pages/index.php index c8b89ebefc..31b46f0036 100644 --- a/redaxo/src/addons/install/pages/index.php +++ b/redaxo/src/addons/install/pages/index.php @@ -2,6 +2,7 @@ use Redaxo\Core\Addon\Addon; use Redaxo\Core\Backend\Controller; +use Redaxo\Core\Http\Request; use Redaxo\Core\Util\Markdown; use Redaxo\Core\View\Fragment; use Redaxo\Core\View\View; @@ -10,7 +11,7 @@ echo View::title($addon->i18n('title')); -if ('reload' === rex_request('func', 'string')) { +if ('reload' === Request::request('func', 'string')) { rex_install_webservice::deleteCache(); } diff --git a/redaxo/src/addons/install/pages/packages.add.php b/redaxo/src/addons/install/pages/packages.add.php index 586e4257e9..7fe4fe728e 100644 --- a/redaxo/src/addons/install/pages/packages.add.php +++ b/redaxo/src/addons/install/pages/packages.add.php @@ -5,6 +5,8 @@ use Redaxo\Core\Filesystem\File; use Redaxo\Core\Filesystem\Path; use Redaxo\Core\Filesystem\Url; +use Redaxo\Core\Http\Request; +use Redaxo\Core\Http\Response; use Redaxo\Core\Translation\I18n; use Redaxo\Core\Util\Formatter; use Redaxo\Core\Util\Version; @@ -15,7 +17,7 @@ $package = Addon::get('install'); -$addonkey = rex_request('addonkey', 'string'); +$addonkey = Request::request('addonkey', 'string'); $addons = []; echo ApiFunction::getMessage(); @@ -129,8 +131,8 @@ $fragment->setVar('autofocus', true); $toolbar = $fragment->parse('core/form/search.php'); - $sort = rex_request('sort', 'string', ''); - $sortType = rex_request('sort_type', 'string', ''); + $sort = Request::request('sort', 'string', ''); + $sortType = Request::request('sort_type', 'string', ''); $sortByPublishedDateClass = ''; $sortByDownloadsClass = ''; $sortNextPublishedDate = ''; @@ -231,7 +233,7 @@ $content .= ''; $content .= ' - '; + echo "\n" . ' '; } ?> diff --git a/redaxo/src/core/frontend.php b/redaxo/src/core/frontend.php index a62761bdb8..424172d38f 100644 --- a/redaxo/src/core/frontend.php +++ b/redaxo/src/core/frontend.php @@ -13,13 +13,15 @@ use Redaxo\Core\ExtensionPoint\ExtensionPoint; use Redaxo\Core\Filesystem\Path; use Redaxo\Core\Filesystem\Url; +use Redaxo\Core\Http\Request; +use Redaxo\Core\Http\Response; use Redaxo\Core\Language\Language; use Redaxo\Core\Mailer\Mailer; use Redaxo\Core\Security\BackendLogin; use Redaxo\Core\View\Fragment; if (Core::isSetup()) { - rex_response::sendRedirect(Url::backendController()); + Response::sendRedirect(Url::backendController()); } if (Core::isDebugMode()) { @@ -49,12 +51,12 @@ } if (Core::getConfig('article_history', false)) { - $historyDate = rex_request('rex_history_date', 'string'); + $historyDate = Request::request('rex_history_date', 'string'); if ('' != $historyDate) { - $historySession = rex_request('rex_history_session', 'string'); - $historyLogin = rex_request('rex_history_login', 'string'); - $historyValidtime = rex_request('rex_history_validtime', 'string'); + $historySession = Request::request('rex_history_session', 'string'); + $historyLogin = Request::request('rex_history_login', 'string'); + $historyValidtime = Request::request('rex_history_validtime', 'string'); $user = null; if ('' != $historySession && '' != $historyLogin && '' != $historyValidtime) { @@ -76,11 +78,11 @@ } if (!$user) { - throw new rex_http_exception(new rex_exception('no permission'), rex_response::HTTP_UNAUTHORIZED); + throw new rex_http_exception(new rex_exception('no permission'), Response::HTTP_UNAUTHORIZED); } if (!$user->hasPerm('history[article_rollback]')) { - throw new rex_http_exception(new rex_exception('no permission for the slice version'), rex_response::HTTP_FORBIDDEN); + throw new rex_http_exception(new rex_exception('no permission for the slice version'), Response::HTTP_FORBIDDEN); } Extension::register('ART_INIT', static function (ExtensionPoint $ep) { @@ -92,7 +94,7 @@ }); Extension::register('ART_SLICES_QUERY', static function (ExtensionPoint $ep) { - $historyDate = rex_request('rex_history_date', 'string'); + $historyDate = Request::request('rex_history_date', 'string'); $article = $ep->getParam('article'); if ($article instanceof ArticleContent && $article->getArticleId() == Article::getCurrentId()) { @@ -128,7 +130,7 @@ if (Core::getConfig('article_work_version', false)) { Extension::register('ART_INIT', static function (ExtensionPoint $ep) { - $version = rex_request('rex_version', 'int'); + $version = Request::request('rex_version', 'int'); if (ArticleRevision::WORK != $version) { return; } @@ -137,8 +139,8 @@ $fragment = new Fragment([ 'content' => '

No permission for the working version. You need to be logged into the REDAXO backend at the same time.

', ]); - rex_response::setStatus(rex_response::HTTP_UNAUTHORIZED); - rex_response::sendPage($fragment->parse('core/fe_ooops.php')); + Response::setStatus(Response::HTTP_UNAUTHORIZED); + Response::sendPage($fragment->parse('core/fe_ooops.php')); exit; } @@ -152,7 +154,7 @@ }); } -$clangId = rex_get('clang', 'int'); +$clangId = Request::get('clang', 'int'); if ($clangId && !Language::exists($clangId)) { rex_redirect(Article::getNotfoundArticleId(), Language::getStartId()); } @@ -169,7 +171,7 @@ 'content' => '

Article with ID ' . Article::getCurrentId() . ' not found.
If this is a fresh setup, an article must be created first.
Enter REDAXO.

', ]); $content .= $fragment->parse('core/fe_ooops.php'); - rex_response::sendPage($content); + Response::sendPage($content); exit; } @@ -185,8 +187,8 @@ $artId = $article->getArticleId(); if ($artId == Article::getNotfoundArticleId() && $artId != Article::getSiteStartArticleId()) { - rex_response::setStatus(rex_response::HTTP_NOT_FOUND); + Response::setStatus(Response::HTTP_NOT_FOUND); } // ----- inhalt ausgeben -rex_response::sendPage($content, $article->getValue('updatedate')); +Response::sendPage($content, $article->getValue('updatedate')); diff --git a/redaxo/src/core/functions/function_rex_globals.php b/redaxo/src/core/functions/function_rex_globals.php deleted file mode 100644 index 2cd6c040ef..0000000000 --- a/redaxo/src/core/functions/function_rex_globals.php +++ /dev/null @@ -1,188 +0,0 @@ - $argValue) { + foreach (Request::request('args', 'array') as $argName => $argValue) { $argFields .= '' . "\n"; } - $openerInputField = rex_request('opener_input_field', 'string'); + $openerInputField = Request::request('opener_input_field', 'string'); if ('' != $openerInputField) { $argFields .= '' . "\n"; } diff --git a/redaxo/src/core/functions/function_structure_rex_url.php b/redaxo/src/core/functions/function_structure_rex_url.php index 306c3d089d..65e122f170 100644 --- a/redaxo/src/core/functions/function_structure_rex_url.php +++ b/redaxo/src/core/functions/function_structure_rex_url.php @@ -4,6 +4,7 @@ use Redaxo\Core\ExtensionPoint\Extension; use Redaxo\Core\ExtensionPoint\ExtensionPoint; use Redaxo\Core\Filesystem\Url; +use Redaxo\Core\Http\Response; use Redaxo\Core\Language\Language; use Redaxo\Core\Util\Str; @@ -52,5 +53,5 @@ function rex_getUrl(?int $id = null, ?int $clang = null, array $params = []): st */ function rex_redirect(?int $articleId = null, ?int $clang = null, array $params = []): never { - rex_response::sendRedirect(rex_getUrl($articleId, $clang, $params)); + Response::sendRedirect(rex_getUrl($articleId, $clang, $params)); } diff --git a/redaxo/src/core/layout/bottom.php b/redaxo/src/core/layout/bottom.php index d5dbfd2227..db3d60a38d 100644 --- a/redaxo/src/core/layout/bottom.php +++ b/redaxo/src/core/layout/bottom.php @@ -2,13 +2,14 @@ use Redaxo\Core\Backend\Controller; use Redaxo\Core\Core; +use Redaxo\Core\Http\Request; use Redaxo\Core\Util\Timer; use Redaxo\Core\View\Fragment; $curPage = Controller::requireCurrentPageObject(); if (!$curPage->hasLayout()) { - if (rex_request::isPJAXRequest()) { + if (Request::isPJAXRequest()) { echo ''; } @@ -19,7 +20,7 @@ ' . rex_escape(Controller::getPageTitle()) . ''; } if (!$curPage->hasLayout()) { - if (rex_request::isPJAXRequest()) { + if (Request::isPJAXRequest()) { echo '
'; } @@ -167,8 +168,8 @@ /* Setup Navigation ********************************************************** */ if ('setup' == Controller::getCurrentPagePart(1)) { - $step = rex_request('step', 'float'); - $lang = rex_request('lang', 'string', ''); + $step = Request::request('step', 'float'); + $lang = Request::request('lang', 'string', ''); $context = rex_setup::getContext(); @@ -211,7 +212,7 @@ } /* PJAX Footer Header ********************************************************** */ -if (!rex_request::isPJAXContainer('#rex-js-page-container')) { +if (!Request::isPJAXContainer('#rex-js-page-container')) { $fragment = new Fragment(); $fragment->setVar('pageTitle', Controller::getPageTitle()); $fragment->setVar('cssFiles', Asset::getCssFiles()); diff --git a/redaxo/src/core/lib/error_handler.php b/redaxo/src/core/lib/error_handler.php index 55650e18ff..6072c190d7 100644 --- a/redaxo/src/core/lib/error_handler.php +++ b/redaxo/src/core/lib/error_handler.php @@ -3,6 +3,8 @@ use Redaxo\Core\Core; use Redaxo\Core\Filesystem\Path; use Redaxo\Core\Filesystem\Url; +use Redaxo\Core\Http\Request; +use Redaxo\Core\Http\Response; use Redaxo\Core\Log\Logger; use Redaxo\Core\Security\BackendLogin; use Redaxo\Core\Security\Login; @@ -77,15 +79,15 @@ public static function handleException($exception) ob_end_clean(); } - $status = rex_response::HTTP_INTERNAL_ERROR; + $status = Response::HTTP_INTERNAL_ERROR; if ($exception instanceof rex_http_exception && $exception->getHttpCode()) { $status = $exception->getHttpCode(); } - rex_response::setStatus($status); + Response::setStatus($status); if (Core::isSetup() || Core::isDebugMode() || !Core::isLiveMode() && BackendLogin::createUser()?->isAdmin()) { [$errPage, $contentType] = self::renderWhoops($exception); - rex_response::sendContent($errPage, $contentType); + Response::sendContent($errPage, $contentType); exit(1); } } catch (Throwable) { @@ -104,7 +106,7 @@ public static function handleException($exception) $errorPage = 'Oooops, an internal error occured!'; } - rex_response::sendContent($errorPage); + Response::sendContent($errorPage); exit(1); } @@ -141,7 +143,7 @@ private static function renderWhoops($exception) ' . Core::getVersion() . ' '; $styles = ' - '; + $mailBody .= ' '; $mailBody .= ''; $mailBody .= ' '; $mailBody .= ' '; diff --git a/src/MediaManager/Effect/ImagePropertiesEffect.php b/src/MediaManager/Effect/ImagePropertiesEffect.php index 89f4ececac..c52ee56d3f 100644 --- a/src/MediaManager/Effect/ImagePropertiesEffect.php +++ b/src/MediaManager/Effect/ImagePropertiesEffect.php @@ -2,9 +2,9 @@ namespace Redaxo\Core\MediaManager\Effect; +use Redaxo\Core\Http\Response; use Redaxo\Core\MediaManager\ManagedMedia; use Redaxo\Core\Translation\I18n; -use rex_response; use function in_array; @@ -92,7 +92,7 @@ public function getParams() 'options' => [self::NO_INTERLACING, 'jpg', 'png', 'gif'], 'attributes' => ['multiple' => true, 'class' => 'selectpicker form-control'], 'suffix' => ' -