From: Frans Saris Date: Sun, 6 Jul 2014 12:34:46 +0000 (+0200) Subject: [BUGFIX] Replace module token in be shortcut returnUrl X-Git-Tag: 6.2.4~27 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/777086e0bc83e3d495a85726b4d53a15f112bac8 [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 --- 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;