From ccedf3abced41e34c3af4cb934e10464b6fd01d0 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 16 Mar 2012 16:30:52 +0100 Subject: [PATCH] Anchors are now properly handled within getLink() Fixes #523 --- .../files/lib/system/request/LinkHandler.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wcfsetup/install/files/lib/system/request/LinkHandler.class.php b/wcfsetup/install/files/lib/system/request/LinkHandler.class.php index 459becdc46..6b21e65611 100644 --- a/wcfsetup/install/files/lib/system/request/LinkHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/LinkHandler.class.php @@ -25,6 +25,7 @@ class LinkHandler extends SingletonFactory { */ public function getLink($controller = null, array $parameters = array(), $url = '') { $abbreviation = 'wcf'; + $anchor = ''; $isRaw = false; if (isset($parameters['application'])) { $abbreviation = $parameters['application']; @@ -35,6 +36,12 @@ class LinkHandler extends SingletonFactory { unset($parameters['isRaw']); } + // remove anchor before parsing + if (($pos = strpos($url, '#')) !== false) { + $anchor = substr($url, $pos); + $url = substr($url, 0, $pos); + } + // build route if ($controller !== null) { // handle object @@ -84,6 +91,9 @@ class LinkHandler extends SingletonFactory { $url = $application->domainName . $application->domainPath . $url; } + // append previously removed anchor + $url .= $anchor; + return $url; } } -- 2.20.1