From: Alexander Ebert Date: Fri, 16 Mar 2012 15:30:52 +0000 (+0100) Subject: Anchors are now properly handled within getLink() X-Git-Tag: 2.0.0_Beta_1~1213 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ccedf3abced41e34c3af4cb934e10464b6fd01d0;p=GitHub%2FWoltLab%2FWCF.git Anchors are now properly handled within getLink() Fixes #523 --- 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; } }