From 777086e0bc83e3d495a85726b4d53a15f112bac8 Mon Sep 17 00:00:00 2001 From: Frans Saris Date: Sun, 6 Jul 2014 14:34:46 +0200 Subject: [PATCH] [BUGFIX] Replace module token in be shortcut returnUrl During the addition of the token check for mod.php the token in the BE shortcut url was already replaced (#56359) but not in the returnUrl parameter that can be present. This patch makes sure that also the module token is replaced in the returnUrl param. Resolves: #59963 Releases: 6.3, 6.2 Change-Id: I12b9d6022240d0399825aade21b0879bfbc7eb6c Reviewed-on: https://review.typo3.org/31396 Reviewed-by: Markus Klein Tested-by: Markus Klein --- .../Classes/Toolbar/ShortcutToolbarItem.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/backend/Classes/Toolbar/ShortcutToolbarItem.php b/typo3/sysext/backend/Classes/Toolbar/ShortcutToolbarItem.php index 744c0fbfae01..f5f94dde208c 100644 --- a/typo3/sysext/backend/Classes/Toolbar/ShortcutToolbarItem.php +++ b/typo3/sysext/backend/Classes/Toolbar/ShortcutToolbarItem.php @@ -316,9 +316,21 @@ class ShortcutToolbarItem implements \TYPO3\CMS\Backend\Toolbar\ToolbarItemHookI protected function getTokenUrl($url) { $parsedUrl = parse_url($url); parse_str($parsedUrl['query'], $parameters); + + // parse the returnUrl and replace the module token of it + if (isset($parameters['returnUrl'])) { + $parsedReturnUrl = parse_url($parameters['returnUrl']); + parse_str($parsedReturnUrl['query'], $returnUrlParameters); + if (strpos($parsedReturnUrl['path'], 'mod.php') !== FALSE && isset($returnUrlParameters['M'])) { + $module = $returnUrlParameters['M']; + $returnUrl = BackendUtility::getModuleUrl($module, $returnUrlParameters); + $parameters['returnUrl'] = $returnUrl; + $url = $parsedUrl['path'] . '?' . http_build_query($parameters); + } + } + if (strpos($parsedUrl['path'], 'mod.php') !== FALSE && isset($parameters['M'])) { $module = $parameters['M']; - unset($parameters['M']); $url = str_replace('mod.php', '', $parsedUrl['path']) . BackendUtility::getModuleUrl($module, $parameters); } return $url; -- 2.20.1