diff --git a/typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php b/typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php index 5c86005c6b4c1997d6f68331590572208d292e0b..8492fb3dbb622bf42eb31ffed2822371555f65c7 100644 --- a/typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php +++ b/typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php @@ -123,7 +123,7 @@ class SiteConfigurationController */ protected function overviewAction(ServerRequestInterface $request): void { - $this->configureOverViewDocHeader(); + $this->configureOverViewDocHeader($request->getAttribute('normalizedParams')->getRequestUri()); $allSites = $this->siteFinder->getAllSites(); $pages = $this->getAllSitePages(); $unassignedSites = []; @@ -627,13 +627,15 @@ class SiteConfigurationController /** * Create document header buttons of "overview" action + * + * @param string $requestUri */ - protected function configureOverViewDocHeader(): void + protected function configureOverViewDocHeader(string $requestUri): void { $iconFactory = $this->moduleTemplate->getIconFactory(); $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar(); $reloadButton = $buttonBar->makeLinkButton() - ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI')) + ->setHref($requestUri) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload')) ->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)); $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT); diff --git a/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php b/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php index 1e558b0e8153cd568b1c1e6ceb622776f4256d49..51aea3e00db0a9ca9ea346421f6cbbed8b6f21cb 100644 --- a/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php +++ b/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php @@ -402,7 +402,7 @@ class StandardContentPreviewRenderer implements PreviewRendererInterface, Logger $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'] + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '#element-tt_content-' . $row['uid'] ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); diff --git a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php index 188c9f165f4893299d5321cd4272533052fd234e..6860e844ecf261bc330cd821f20c0d5900763098 100644 --- a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php +++ b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php @@ -530,7 +530,7 @@ class ModuleTemplate trigger_error('Method makeShortcutIcon() is deprecated and will be removed in v12. Please use ShortcutButton->setArguments() instead.', E_USER_DEPRECATED); $gvList = 'route,id,' . $gvList; $storeUrl = $this->makeShortcutUrl($gvList, $setList); - $pathInfo = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI')); + $pathInfo = parse_url($GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri()); // Fallback for alt_mod. We still pass in the old xMOD... stuff, // but TBE_MODULES only knows about "record_edit". // We still need to pass the xMOD name to createShortcut below, diff --git a/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php b/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php index f42ddc5246a4d395240464234da0d89b5341873f..6c5214c98409f568be3af2df8ebbd327daf860ab 100644 --- a/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php +++ b/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php @@ -284,7 +284,7 @@ class PagePositionMap 'positionPid' => $pid, 'newPageId' => $newPagePID, 'cmd' => 'crPage', - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $this->R_URI ] ); return (string)$url; diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 43921f0264e7391a8625691c4ff8a6f3ce0cff14..c96bb9a5f5d8dd1f9807e0e7e4659700860e7445 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -2385,14 +2385,14 @@ class BackendUtility * Returns a URL with a command to TYPO3 Datahandler * * @param string $parameters Set of GET params to send. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World - * @param string $redirectUrl Redirect URL, default is to use GeneralUtility::getIndpEnv('REQUEST_URI') + * @param string $redirectUrl Redirect URL, default is to use $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() * @return string */ public static function getLinkToDataHandlerAction($parameters, $redirectUrl = '') { $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $url = (string)$uriBuilder->buildUriFromRoute('tce_db') . $parameters . '&redirect='; - $url .= rawurlencode($redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI')); + $url .= rawurlencode($redirectUrl ?: $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri()); return $url; } diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php index fa6012556680ec19a757a5a14bff5ff4d8fe02bd..1cb83eb8921f8cb2fa74c3174ef8073c9f65decc 100644 --- a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php +++ b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumn.php @@ -155,7 +155,7 @@ class GridColumn extends AbstractGridObject ); $editParam = '&edit[tt_content][' . implode(',', $this->getAllContainedItemUids()) . ']=edit' . $pageTitleParamForAltDoc; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - return $uriBuilder->buildUriFromRoute('record_edit') . $editParam . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')); + return $uriBuilder->buildUriFromRoute('record_edit') . $editParam . '&returnUrl=' . rawurlencode($GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri()); } public function getNewContentUrl(): string @@ -169,7 +169,7 @@ class GridColumn extends AbstractGridObject 'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId(), 'colPos' => $this->getColumnNumber(), 'uid_pid' => $pageId, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $routeName = BackendUtility::getPagesTSconfig($pageId)['mod.']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard'; @@ -186,7 +186,7 @@ class GridColumn extends AbstractGridObject 'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId() ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $routeName = 'record_edit'; } diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php index 7ccc57ba4c3ff9d7531bf82990256db7bdbf64b6..ce8532d1f21971b3cd74385bc55aae266fa2f38b 100644 --- a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php +++ b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php @@ -271,7 +271,7 @@ class GridColumnItem extends AbstractGridObject 'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId(), 'colPos' => $this->column->getColumnNumber(), 'uid_pid' => -$this->record['uid'], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $routeName = BackendUtility::getPagesTSconfig($pageId)['mod.']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard'; @@ -282,7 +282,7 @@ class GridColumnItem extends AbstractGridObject -$this->record['uid'] => 'new' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $routeName = 'record_edit'; } @@ -334,7 +334,7 @@ class GridColumnItem extends AbstractGridObject $this->record['uid'] => 'edit', ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $this->record['uid'], + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '#element-tt_content-' . $this->record['uid'], ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); return (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters) . '#element-tt_content-' . $this->record['uid']; diff --git a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/LanguageColumn.php b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/LanguageColumn.php index c99a9ae1d23f3e197377d3ba569fc831e326467e..f0c3438211f12adfc0bd1addb40e522dc582a07c 100644 --- a/typo3/sysext/backend/Classes/View/BackendLayout/Grid/LanguageColumn.php +++ b/typo3/sysext/backend/Classes/View/BackendLayout/Grid/LanguageColumn.php @@ -131,7 +131,7 @@ class LanguageColumn extends AbstractGridObject 'sys_language_uid' => $this->context->getSiteLanguage()->getLanguageId() ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); return (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); diff --git a/typo3/sysext/backend/Classes/View/PageLayoutContext.php b/typo3/sysext/backend/Classes/View/PageLayoutContext.php index 33cfb607e15fefbe902071bc1e4a735548988806..1329d85c859c642a531ec1491febcf6ad2855548 100644 --- a/typo3/sysext/backend/Classes/View/PageLayoutContext.php +++ b/typo3/sysext/backend/Classes/View/PageLayoutContext.php @@ -340,7 +340,7 @@ class PageLayoutContext // which, when finished editing should return back to the current page (returnUrl) $parameters = [ 'justLocalized' => 'pages:' . $id . ':' . $languageUid, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $redirectUrl = (string)$uriBuilder->buildUriFromRoute('record_edit', $parameters); diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php index 8b8bc1b3a0e37190a1f38415ee1c9a042a058b12..e0d971159a70838daf696902a0260dcde4f6104d 100644 --- a/typo3/sysext/backend/Classes/View/PageLayoutView.php +++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php @@ -357,7 +357,7 @@ class PageLayoutView implements LoggerAwareInterface 'sys_language_uid' => $lP, 'colPos' => $columnId, 'uid_pid' => $id, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $routeName = BackendUtility::getPagesTSconfig($id)['mod.']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard'; @@ -375,7 +375,7 @@ class PageLayoutView implements LoggerAwareInterface 'sys_language_uid' => $lP ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $url = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters); } @@ -465,7 +465,7 @@ class PageLayoutView implements LoggerAwareInterface 'sys_language_uid' => $row['sys_language_uid'], 'colPos' => $row['colPos'], 'uid_pid' => -$row['uid'], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $routeName = BackendUtility::getPagesTSconfig($row['pid'])['mod.']['newContentElementWizard.']['override'] ?? 'new_content_element_wizard'; @@ -477,7 +477,7 @@ class PageLayoutView implements LoggerAwareInterface -$row['uid'] => 'new' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $url = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters); } @@ -771,7 +771,7 @@ class PageLayoutView implements LoggerAwareInterface 'sys_language_uid' => $languageId ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $url = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters); if ($this->getBackendUser()->check('tables_modify', 'pages')) { @@ -812,7 +812,7 @@ class PageLayoutView implements LoggerAwareInterface $this->id => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $url = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters); if ($this->getBackendUser()->check('tables_modify', 'pages')) { @@ -938,7 +938,7 @@ class PageLayoutView implements LoggerAwareInterface $icons = ''; // Edit whole of column: if ($editParams && $this->hasContentModificationAndAccessPermissions() && $this->getBackendUser()->checkLanguageAccess(0)) { - $link = $this->uriBuilder->buildUriFromRoute('record_edit') . $editParams . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')); + $link = $this->uriBuilder->buildUriFromRoute('record_edit') . $editParams . '&returnUrl=' . rawurlencode($GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri()); $icons = '<a href="' . htmlspecialchars($link) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('editColumn')) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; @@ -1039,7 +1039,7 @@ class PageLayoutView implements LoggerAwareInterface $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'], + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '#element-tt_content-' . $row['uid'], ]; $url = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters) . '#element-tt_content-' . $row['uid']; @@ -1538,7 +1538,7 @@ class PageLayoutView implements LoggerAwareInterface $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . '#element-tt_content-' . $row['uid'] + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '#element-tt_content-' . $row['uid'] ]; $url = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $urlParameters); return '<a href="' . htmlspecialchars($url) . '" title="' . htmlspecialchars($this->getLanguageService()->getLL('edit')) . '">' . $str . '</a>'; @@ -1597,7 +1597,7 @@ class PageLayoutView implements LoggerAwareInterface // which, when finished editing should return back to the current page (returnUrl) $parameters = [ 'justLocalized' => 'pages:' . $id . ':' . $languageUid, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $redirectUrl = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $parameters); $targetUrl = BackendUtility::getLinkToDataHandlerAction( diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php index d612491cf670fdbdca2111d10116d6fe85332abd..0cfc4afb59b67c14c2133a436d91d8b12decd880 100644 --- a/typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php +++ b/typo3/sysext/backend/Classes/ViewHelpers/Link/EditRecordViewHelper.php @@ -84,7 +84,7 @@ class EditRecordViewHelper extends AbstractTagBasedViewHelper throw new \InvalidArgumentException('Uid must be a positive integer, ' . $this->arguments['uid'] . ' given.', 1526127158); } if (empty($this->arguments['returnUrl'])) { - $this->arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $this->arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } $params = [ diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php index 26a01817a03cde503ef86b886c7169104ce8b729..6564af38eeb7e44764a6fe2b64189a9b95a93057 100644 --- a/typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php +++ b/typo3/sysext/backend/Classes/ViewHelpers/Link/NewRecordViewHelper.php @@ -125,7 +125,7 @@ class NewRecordViewHelper extends AbstractTagBasedViewHelper } if (empty($this->arguments['returnUrl'])) { - $this->arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $this->arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } $params = [ diff --git a/typo3/sysext/backend/Classes/ViewHelpers/ModuleLayout/MenuItemViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/ModuleLayout/MenuItemViewHelper.php index ad15ad5394c018af5c130eb3d3088d6dfb4464f5..42ae1f9ab6cc2fcaa8a92d10ca1d5d4779d6493e 100644 --- a/typo3/sysext/backend/Classes/ViewHelpers/ModuleLayout/MenuItemViewHelper.php +++ b/typo3/sysext/backend/Classes/ViewHelpers/ModuleLayout/MenuItemViewHelper.php @@ -19,7 +19,6 @@ namespace TYPO3\CMS\Backend\ViewHelpers\ModuleLayout; use TYPO3\CMS\Backend\Template\Components\Menu\Menu; use TYPO3\CMS\Backend\ViewHelpers\ModuleLayoutViewHelper; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic; @@ -98,6 +97,6 @@ class MenuItemViewHelper extends AbstractViewHelper */ protected static function isCurrentUri(string $uri): bool { - return GeneralUtility::getIndpEnv('REQUEST_URI') === $uri; + return $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() === $uri; } } diff --git a/typo3/sysext/backend/Classes/ViewHelpers/ModuleLinkViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/ModuleLinkViewHelper.php index 9d9de2e940dbe699cd32b92eb1b08008eff886d9..9e898fd5d57b94cc5a5a4b14f6c325d7d12234bb 100644 --- a/typo3/sysext/backend/Classes/ViewHelpers/ModuleLinkViewHelper.php +++ b/typo3/sysext/backend/Classes/ViewHelpers/ModuleLinkViewHelper.php @@ -73,7 +73,7 @@ class ModuleLinkViewHelper extends AbstractViewHelper ArrayUtility::mergeRecursiveWithOverrule($parameters, GeneralUtility::explodeUrl2Array($arguments['query'])); } if ($arguments['currentUrlParameterName'] !== null) { - $parameters[$arguments['currentUrlParameterName']] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $parameters[$arguments['currentUrlParameterName']] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } return (string)$uriBuilder->buildUriFromRoute($arguments['route'], $parameters); diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php index bc330f7008507f2a73f0ca71b0272a51b9b71fb3..ed4ee8e21ef6e954877cdf6f51fa85040c2c03e3 100644 --- a/typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php +++ b/typo3/sysext/backend/Classes/ViewHelpers/Uri/EditRecordViewHelper.php @@ -72,7 +72,7 @@ class EditRecordViewHelper extends AbstractViewHelper throw new \InvalidArgumentException('Uid must be a positive integer, ' . $arguments['uid'] . ' given.', 1526128259); } if (empty($arguments['returnUrl'])) { - $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } $params = [ diff --git a/typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php b/typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php index a99838db565c40fa2fdeec58d4e58dcf0d505119..b41d1917e1a5c9070a89c363ddde7c6b39b527ec 100644 --- a/typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php +++ b/typo3/sysext/backend/Classes/ViewHelpers/Uri/NewRecordViewHelper.php @@ -100,7 +100,7 @@ class NewRecordViewHelper extends AbstractTagBasedViewHelper } if (empty($arguments['returnUrl'])) { - $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } $params = [ diff --git a/typo3/sysext/backend/Tests/Functional/View/PageLayoutViewTest.php b/typo3/sysext/backend/Tests/Functional/View/PageLayoutViewTest.php index 5d5de0849f46b246ef920a3be80e2ff535e899c2..abf00d20aea00dd3c8de28d512b964760a5f4666 100644 --- a/typo3/sysext/backend/Tests/Functional/View/PageLayoutViewTest.php +++ b/typo3/sysext/backend/Tests/Functional/View/PageLayoutViewTest.php @@ -21,6 +21,9 @@ use Prophecy\Argument; use Psr\EventDispatcher\EventDispatcherInterface; use TYPO3\CMS\Backend\View\PageLayoutView; use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\NormalizedParams; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\AccessibleObjectInterface; @@ -79,6 +82,10 @@ class PageLayoutViewTest extends FunctionalTestCase ]); $this->subject = $this->getAccessibleMock(PageLayoutView::class, ['dummy'], [$eventDispatcher->reveal()]); $this->subject->_set('siteLanguages', $site->getLanguages()); + + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/')) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withAttribute('normalizedParams', new NormalizedParams([], [], '', '')); } /** diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php index c86c09e0e79e61e63df3c369742da2cee4a4490f..c5d9aea18f307f775b78cf713579af4122008948 100644 --- a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php +++ b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/EditRecordViewHelperTest.php @@ -17,6 +17,9 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Link; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\NormalizedParams; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -26,6 +29,14 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; */ class EditRecordViewHelperTest extends FunctionalTestCase { + public function setUp(): void + { + parent::setUp(); + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/')) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withAttribute('normalizedParams', new NormalizedParams([], [], '', '')); + } + /** * @test */ diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php index de9ec0828b033011159fb4d0eab68befe81b6b33..128ee5d160e3db172dbf1037921bff1b16d687c0 100644 --- a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php +++ b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Link/NewRecordViewHelperTest.php @@ -17,6 +17,9 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Link; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\NormalizedParams; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -26,6 +29,14 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; */ class NewRecordViewHelperTest extends FunctionalTestCase { + public function setUp(): void + { + parent::setUp(); + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/')) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withAttribute('normalizedParams', new NormalizedParams([], [], '', '')); + } + /** * @test */ diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php index 5203bd514db14abe29f9e00a8274201b183ab035..db24fa1a381986f96cb54306bcebc7aafc269078 100644 --- a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php +++ b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/EditRecordViewHelperTest.php @@ -17,6 +17,9 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\NormalizedParams; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -26,6 +29,14 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; */ class EditRecordViewHelperTest extends FunctionalTestCase { + public function setUp(): void + { + parent::setUp(); + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/')) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withAttribute('normalizedParams', new NormalizedParams([], [], '', '')); + } + /** * @test */ diff --git a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php index 79ba1dcb4bfdd2bcdbc6af6481bbc6f3a299fad3..31a572594d21377bcb9b187cf7c97b4758eb597b 100644 --- a/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php +++ b/typo3/sysext/backend/Tests/Functional/ViewHelpers/Uri/NewRecordViewHelperTest.php @@ -17,6 +17,9 @@ declare(strict_types=1); namespace TYPO3\CMS\Backend\Tests\Functional\ViewHelpers\Uri; +use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\NormalizedParams; +use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Fluid\View\StandaloneView; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; @@ -26,6 +29,14 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase; */ class NewRecordViewHelperTest extends FunctionalTestCase { + public function setUp(): void + { + parent::setUp(); + $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/')) + ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE) + ->withAttribute('normalizedParams', new NormalizedParams([], [], '', '')); + } + /** * @test */ diff --git a/typo3/sysext/core/Classes/Database/QueryView.php b/typo3/sysext/core/Classes/Database/QueryView.php index 47e08f83c5bc2d64577a84436c37847a9087dadc..b8a6e966cce61fac2748349be547e1e0f3816f69 100644 --- a/typo3/sysext/core/Classes/Database/QueryView.php +++ b/typo3/sysext/core/Classes/Database/QueryView.php @@ -697,7 +697,7 @@ class QueryView $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . HttpUtility::buildQueryString(['SET' => (array)GeneralUtility::_POST('SET')], '&') ]); $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url) . '">' diff --git a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditFileContentViewHelper.php b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditFileContentViewHelper.php index 7d43f023cba4db1932bd1144dae295b7e3bf55e1..649461c0b0d4ab60777d10d2f0582dfac5a91437 100644 --- a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditFileContentViewHelper.php +++ b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/EditFileContentViewHelper.php @@ -51,7 +51,7 @@ class EditFileContentViewHelper extends AbstractViewHelper public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { if (empty($arguments['returnUrl'])) { - $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } /** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */ diff --git a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/RenameFileViewHelper.php b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/RenameFileViewHelper.php index 01d1bd0a22d41b55eb90ab46eec06572489fea38..b0c3e03dbca48b9ce644690d72b8abbddef91ed2 100644 --- a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/RenameFileViewHelper.php +++ b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/RenameFileViewHelper.php @@ -50,7 +50,7 @@ class RenameFileViewHelper extends AbstractViewHelper public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { if (empty($arguments['returnUrl'])) { - $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } /** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */ diff --git a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/ReplaceFileViewHelper.php b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/ReplaceFileViewHelper.php index d7dc83cfed87f6db19b6460203d7ea64563801a6..0b63a7599e512ded068966983a85845025dfb4c8 100644 --- a/typo3/sysext/filelist/Classes/ViewHelpers/Uri/ReplaceFileViewHelper.php +++ b/typo3/sysext/filelist/Classes/ViewHelpers/Uri/ReplaceFileViewHelper.php @@ -50,7 +50,7 @@ class ReplaceFileViewHelper extends AbstractViewHelper public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { if (empty($arguments['returnUrl'])) { - $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI'); + $arguments['returnUrl'] = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri(); } /** @var \TYPO3\CMS\Core\Resource\AbstractFile $file */ diff --git a/typo3/sysext/form/Classes/Controller/FormManagerController.php b/typo3/sysext/form/Classes/Controller/FormManagerController.php index 04ca758e0761071551a837687695e3a0dbbe4b1c..ffdc73089e03c359e6fc53b646d56474005aca43 100644 --- a/typo3/sysext/form/Classes/Controller/FormManagerController.php +++ b/typo3/sysext/form/Classes/Controller/FormManagerController.php @@ -469,7 +469,7 @@ class FormManagerController extends AbstractBackendController // Reload $reloadButton = $buttonBar->makeLinkButton() - ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI')) + ->setHref($GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri()) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload')) ->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-refresh', Icon::SIZE_SMALL)); $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT); diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 44a104e4a3555a13c347971b5264e64cf41f5983..ebf19fe245dc570f05feb6b236984ea340e65195 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -6490,6 +6490,9 @@ class ContentObjectRenderer implements LoggerAwareInterface */ protected function getEnvironmentVariable($key) { + if ($key === 'REQUEST_URI') { + return $this->getRequest()->getAttribute('normalizedParams')->getRequestUri(); + } return GeneralUtility::getIndpEnv($key); } diff --git a/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php b/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php index c4270b4711990435350801be05861ddc1c7de44c..adc19142c87bfe8be8ea7a6efb832e7211b4d028 100644 --- a/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php +++ b/typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php @@ -908,7 +908,7 @@ class AbstractPlugin 'beforeLastTag' => 1, 'iconTitle' => $title ], $oConf); - $content = $this->cObj->editIcons($content, $tablename . ':' . $fields, $conf, $tablename . ':' . $row['uid'], $row, '&viewUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))); + $content = $this->cObj->editIcons($content, $tablename . ':' . $fields, $conf, $tablename . ':' . $row['uid'], $row, '&viewUrl=' . rawurlencode($this->cObj->getRequest()->getAttribute('normalizedParams')->getRequestUri())); } return $content; } diff --git a/typo3/sysext/info/Classes/Controller/InfoPageTyposcriptConfigController.php b/typo3/sysext/info/Classes/Controller/InfoPageTyposcriptConfigController.php index f93f7fe28882b16f52b5630b5dbbc2fa2c1c794c..393b0003312efec43165846c7ff607c0f9d612d7 100644 --- a/typo3/sysext/info/Classes/Controller/InfoPageTyposcriptConfigController.php +++ b/typo3/sysext/info/Classes/Controller/InfoPageTyposcriptConfigController.php @@ -116,7 +116,7 @@ class InfoPageTyposcriptConfigController ] ], 'columnsOnly' => 'TSconfig,tsconfig_includes', - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $line['editIcon'] = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); $line['editTitle'] = 'editTSconfig'; @@ -137,7 +137,7 @@ class InfoPageTyposcriptConfigController ] ], 'columnsOnly' => 'TSconfig,tsconfig_includes', - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]; $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); $editIcon = htmlspecialchars($url); diff --git a/typo3/sysext/info/Classes/Controller/PageInformationController.php b/typo3/sysext/info/Classes/Controller/PageInformationController.php index 010550f581eddab3b3dc49cc3bf63a709e25f86d..b0f13b4064daecce3afce08ab50008f39bf4c561 100644 --- a/typo3/sysext/info/Classes/Controller/PageInformationController.php +++ b/typo3/sysext/info/Classes/Controller/PageInformationController.php @@ -105,7 +105,9 @@ class PageInformationController . BackendUtility::cshItem('_MOD_web_info', 'func_' . $this->pObj->MOD_SETTINGS['pages'], '', '<span class="btn btn-default btn-sm">|</span>') . '</div>' . '</div>' - . $this->getTable_pages($this->id, (int)$this->pObj->MOD_SETTINGS['depth']); + // Using $GLOBALS['TYPO3_REQUEST'] since $request is not available at this point + // @todo: Refactor mess and have $request available + . $this->getTable_pages($this->id, (int)$this->pObj->MOD_SETTINGS['depth'], $GLOBALS['TYPO3_REQUEST']); // Additional footer content foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/web_info/class.tx_cms_webinfo.php']['drawFooterHook'] ?? [] as $hook) { @@ -199,9 +201,11 @@ class PageInformationController * * @param int $id Page id * @param int $depth + * @param ServerRequestInterface $request * @return string HTML for the listing + * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException */ - protected function getTable_pages($id, int $depth = 0) + protected function getTable_pages($id, int $depth = 0, ServerRequestInterface $request) { $out = ''; $lang = $this->getLanguageService(); @@ -229,13 +233,13 @@ class PageInformationController if ($this->getBackendUser()->doesUserHaveAccess($row, Permission::PAGE_EDIT) && $row['uid'] > 0) { $editUids[] = $row['uid']; } - $out .= $this->pages_drawItem($row, $this->fieldArray); + $out .= $this->pages_drawItem($row, $this->fieldArray, $request); // Traverse all pages selected: foreach ($theRows as $sRow) { if ($this->getBackendUser()->doesUserHaveAccess($sRow, Permission::PAGE_EDIT)) { $editUids[] = $sRow['uid']; } - $out .= $this->pages_drawItem($sRow, $this->fieldArray); + $out .= $this->pages_drawItem($sRow, $this->fieldArray, $request); } // Header line is drawn $theData = []; @@ -257,7 +261,7 @@ class PageInformationController ] ], 'columnsOnly' => $field, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $request->getAttribute('normalizedParams')->getRequestUri() ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); @@ -374,9 +378,11 @@ class PageInformationController * * @param array $row Record array * @param array $fieldArr Field list + * @param ServerRequestInterface $request * @return string HTML for the item + * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException */ - protected function pages_drawItem($row, $fieldArr) + protected function pages_drawItem($row, $fieldArr, ServerRequestInterface $request) { $userTsConfig = $this->getBackendUser()->getTSConfig(); $theIcon = $this->getIcon($row); @@ -402,7 +408,7 @@ class PageInformationController $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $request->getAttribute('normalizedParams')->getRequestUri() ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); $url = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters); diff --git a/typo3/sysext/info/Classes/Controller/TranslationStatusController.php b/typo3/sysext/info/Classes/Controller/TranslationStatusController.php index 650948625738eb5b2b5c2a407fe17f5e38c3917e..cbb8dcacbbace77c2f930eba91ccd794eedf8583 100644 --- a/typo3/sysext/info/Classes/Controller/TranslationStatusController.php +++ b/typo3/sysext/info/Classes/Controller/TranslationStatusController.php @@ -202,7 +202,7 @@ class TranslationStatusController $data['row']['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]); $info = '<a href="#" ' . $previewUriBuilder->serializeDispatcherAttributes() . ' class="btn btn-default" title="' . $lang->sL('LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_renderl10n_viewPage') . '">' . @@ -259,7 +259,7 @@ class TranslationStatusController $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]); $info = str_replace('###LANG_UID###', (string)$languageId, $viewPageLink); $info .= '<a href="' . htmlspecialchars($editUrl) @@ -304,7 +304,7 @@ class TranslationStatusController ] ], 'columnsOnly' => 'title,nav_title,l18n_cfg,hidden', - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]); $editIco = '<a href="' . htmlspecialchars($editUrl) . '" class="btn btn-default" title="' . $lang->sL( @@ -333,7 +333,7 @@ class TranslationStatusController ] ], 'columnsOnly' => 'title,nav_title,hidden', - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]); $editButton = '<a href="' . htmlspecialchars($editUrl) . '" class="btn btn-default" title="' . $lang->sL( @@ -344,7 +344,7 @@ class TranslationStatusController } // Create new overlay records: $createLink = (string)$uriBuilder->buildUriFromRoute('tce_db', [ - 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'redirect' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() ]); $newButton = '<a href="' . htmlspecialchars($createLink) . '" data-edit-url="' . htmlspecialchars($createLink) . '" class="btn btn-default disabled t3js-language-new-' . $languageId . '" title="' . $lang->sL( 'LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_getlangsta_createNewTranslationHeaders' diff --git a/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php b/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php index 27ea200e57bb0d2b367961088017a03876e2a9c2..f7b87e2b8eb4fc842f01f93848346a19e8afe58c 100644 --- a/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php +++ b/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php @@ -518,7 +518,7 @@ class LinkValidatorReport $hookObj = $this->hookObjectsArr[$row['link_type']]; // Construct link to edit the content element - $requestUri = GeneralUtility::getIndpEnv('REQUEST_URI') . + $requestUri = $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . '&id=' . $this->id . '&search_levels=' . $this->searchLevel['report'] . // add record_uid as query parameter for rechecking after edit diff --git a/typo3/sysext/lowlevel/Classes/Database/QueryGenerator.php b/typo3/sysext/lowlevel/Classes/Database/QueryGenerator.php index 02d3c509e7e77e047535c9cf8979272f0b993255..a1822123e4e1917730f1b446a27d28b82726d588 100644 --- a/typo3/sysext/lowlevel/Classes/Database/QueryGenerator.php +++ b/typo3/sysext/lowlevel/Classes/Database/QueryGenerator.php @@ -898,7 +898,7 @@ class QueryGenerator $row['uid'] => 'edit' ] ], - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $GLOBALS['TYPO3_REQUEST']->getAttribute('normalizedParams')->getRequestUri() . HttpUtility::buildQueryString(['SET' => (array)GeneralUtility::_POST('SET')], '&') ]); $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url) . '">' diff --git a/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php b/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php index 3e58918b025ab7dd761d107f13293106d70d0b9b..53461961c7b4d0a9eeb5ab8b65f350c2115da773 100644 --- a/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php +++ b/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php @@ -15,6 +15,7 @@ namespace TYPO3\CMS\Recordlist\Browser; +use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView; use TYPO3\CMS\Backend\Utility\BackendUtility; @@ -78,6 +79,8 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf */ protected $thumbnailConfiguration = []; + protected ?ServerRequestInterface $request = null; + /** * Loads additional JavaScript */ @@ -319,7 +322,7 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf 'type' => 'file', 'table' => '_FILE', 'uid' => $fileObject->getCombinedIdentifier(), - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $this->getRequest()->getAttribute('normalizedParams')->getRequestUri() ]); // Combine the stuff: @@ -475,4 +478,14 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf { return $this->thisScript; } + + public function setRequest(ServerRequestInterface $request): void + { + $this->request = $request; + } + + protected function getRequest(): ServerRequestInterface + { + return $this->request ?? $GLOBALS['TYPO3_REQUEST']; + } } diff --git a/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php b/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php index 8fd429a0f9f8d274d70f0095fb26627365ce603b..545529d323cfdf718a84f9f0e32ff6a6884c4b9c 100644 --- a/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php +++ b/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php @@ -75,7 +75,7 @@ class ElementBrowserController $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); return new RedirectResponse((string)$uriBuilder->buildUriFromRoute('wizard_link', $_GET), 303); } - return new HtmlResponse($this->main()); + return new HtmlResponse($this->main($request)); } /** @@ -83,7 +83,7 @@ class ElementBrowserController * * @return string HTML content */ - protected function main() + protected function main(ServerRequestInterface $request) { $content = ''; @@ -103,6 +103,9 @@ class ElementBrowserController // if type was not rendered use default rendering functions if (!$browserRendered) { $browser = $this->getElementBrowserInstance(); + if (is_callable([$browser, 'setRequest'])) { + $browser->setRequest($request); + } $backendUser = $this->getBackendUser(); $modData = $backendUser->getModuleData('browse_links.php', 'ses'); diff --git a/typo3/sysext/recordlist/Classes/Controller/RecordListController.php b/typo3/sysext/recordlist/Classes/Controller/RecordListController.php index 604e54b0a9631f60fe5a6e98f64195c9abf671ae..1d8118b72ea843cd41611a8eaac40acb5b972a81 100644 --- a/typo3/sysext/recordlist/Classes/Controller/RecordListController.php +++ b/typo3/sysext/recordlist/Classes/Controller/RecordListController.php @@ -252,7 +252,7 @@ class RecordListController } } function editRecords(table,idList,addParams,CBflag) { - window.location.href="' . (string)$this->uriBuilder->buildUriFromRoute('record_edit', ['returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]) . '&edit["+table+"]["+idList+"]=edit"+addParams; + window.location.href="' . (string)$this->uriBuilder->buildUriFromRoute('record_edit', ['returnUrl' => $request->getAttribute('normalizedParams')->getRequestUri()]) . '&edit["+table+"]["+idList+"]=edit"+addParams; } if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$id . '; @@ -281,7 +281,7 @@ class RecordListController // Show the selector to add page translations and the list of translations of the current page // but only when in "default" mode if ($id && !$dblist->csvOutput && !$search_field && !$cmd && !$table) { - $output .= $this->languageSelector($id); + $output .= $this->languageSelector($id, $request->getAttribute('normalizedParams')->getRequestUri()); $pageTranslationsDatabaseRecordList = clone $dblist; $pageTranslationsDatabaseRecordList->listOnlyInSingleTableMode = false; $pageTranslationsDatabaseRecordList->disableSingleTableView = true; @@ -405,9 +405,11 @@ class RecordListController * that are not disabled with page TS. * * @param int $id Page id for which to create a new translation record of pages + * @param string $requestUri * @return string HTML <select> element (if there were items for the box anyways...) + * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException */ - protected function languageSelector(int $id): string + protected function languageSelector(int $id, string $requestUri): string { if (!$this->getBackendUserAuthentication()->check('tables_modify', 'pages')) { return ''; @@ -447,7 +449,7 @@ class RecordListController // which, when finished editing should return back to the current page (returnUrl) $parameters = [ 'justLocalized' => 'pages:' . $id . ':' . $languageUid, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $requestUri ]; $redirectUrl = (string)$this->uriBuilder->buildUriFromRoute('record_edit', $parameters); $params = []; diff --git a/typo3/sysext/redirects/Classes/Controller/ManagementController.php b/typo3/sysext/redirects/Classes/Controller/ManagementController.php index d25a040f38f116837903c5ced4b3f2b6d4b865f0..c9aea963a5abc0e2a961b677f97b4d60ce505e1d 100644 --- a/typo3/sysext/redirects/Classes/Controller/ManagementController.php +++ b/typo3/sysext/redirects/Classes/Controller/ManagementController.php @@ -171,7 +171,7 @@ class ManagementController // Reload $reloadButton = $buttonBar->makeLinkButton() - ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI')) + ->setHref($this->request->getAttribute('normalizedParams')->getRequestUri()) ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload')) ->setIcon($this->iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)); $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT); diff --git a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php index 4385e075aa0513c3b8da19f4f6a16e6d82fe9d96..f8319c2af532fad9e3197541d477e1b7e371737b 100644 --- a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php +++ b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php @@ -175,7 +175,7 @@ class SchedulerModuleController // Prepare main content $content .= '<h1>' . $this->getLanguageService()->getLL('function.' . $this->MOD_SETTINGS['function']) . '</h1>'; $previousCMD = Action::cast($parsedBody['previousCMD'] ?? $queryParams['previousCMD'] ?? null); - $content .= $this->getModuleContent($previousCMD); + $content .= $this->getModuleContent($previousCMD, $request->getAttribute('normalizedParams')->getRequestUri()); $content .= '<div id="extraFieldsSection"></div></form><div id="extraFieldsHidden"></div>'; $this->getButtons($request); @@ -231,9 +231,10 @@ class SchedulerModuleController * Generate the module's content * * @param Action $previousAction + * @param string $requestUri * @return string HTML of the module's main content */ - protected function getModuleContent(Action $previousAction): string + protected function getModuleContent(Action $previousAction, string $requestUri): string { $content = ''; $sectionTitle = ''; @@ -279,7 +280,7 @@ class SchedulerModuleController case Action::EDIT: try { // Try adding or editing - $content .= $this->editTaskAction(); + $content .= $this->editTaskAction($requestUri); $sectionTitle = $this->getLanguageService()->getLL('action.' . $this->getCurrentAction()); } catch (\LogicException|\UnexpectedValueException|\OutOfBoundsException $e) { // Catching all types of exceptions that were previously handled and @@ -506,9 +507,10 @@ class SchedulerModuleController /** * Return a form to add a new task or edit an existing one * + * @param string $requestUri * @return string HTML form to add or edit a task */ - protected function editTaskAction(): string + protected function editTaskAction(string $requestUri): string { $this->view->setTemplatePathAndFilename($this->backendTemplatePath . 'EditTask.html'); @@ -709,7 +711,7 @@ class SchedulerModuleController } $this->view->assign('additionalFields', $additionalFieldList); - $this->view->assign('returnUrl', (string)GeneralUtility::getIndpEnv('REQUEST_URI')); + $this->view->assign('returnUrl', $requestUri); $this->view->assign('table', implode(LF, $table)); $this->view->assign('now', $this->getServerTime()); $this->view->assign('frequencyOptions', (array)$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['frequencyOptions']); diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php index 98f8ee16c52f8026756d76b114f86c05c74a3d31..8ab782c050eb9cb989a210fa39b11735ab601890 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php @@ -90,7 +90,7 @@ class TypoScriptTemplateInformationModuleFunctionController ], 'columnsOnly' => $field, 'createExtension' => 0, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri() ]; /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */ $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); @@ -186,7 +186,7 @@ class TypoScriptTemplateInformationModuleFunctionController ] ], 'createExtension' => 0, - 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') + 'returnUrl' => $this->request->getAttribute('normalizedParams')->getRequestUri() ]; $assigns['editAllUrl'] = (string)$uriBuilder->buildUriFromRoute('record_edit', $urlParameters);