From bc344403999417533f003db28df3b6c4b91df9fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 10 May 2013 15:46:00 +0200 Subject: [PATCH] Allow setting whether an ACP route should be built --- .../install/files/lib/system/request/LinkHandler.class.php | 2 +- .../files/lib/system/request/RouteHandler.class.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/request/LinkHandler.class.php b/wcfsetup/install/files/lib/system/request/LinkHandler.class.php index 6ea96992d0..c85cbac3a9 100644 --- a/wcfsetup/install/files/lib/system/request/LinkHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/LinkHandler.class.php @@ -122,7 +122,7 @@ class LinkHandler extends SingletonFactory { } $parameters['controller'] = $controller; - $routeURL = RouteHandler::getInstance()->buildRoute($parameters); + $routeURL = RouteHandler::getInstance()->buildRoute($parameters, $isACP); if (!$isRaw && !empty($url)) { $routeURL .= (strpos($routeURL, '?') === false) ? '?' : '&'; } diff --git a/wcfsetup/install/files/lib/system/request/RouteHandler.class.php b/wcfsetup/install/files/lib/system/request/RouteHandler.class.php index 0e10264333..775dcb3e38 100644 --- a/wcfsetup/install/files/lib/system/request/RouteHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RouteHandler.class.php @@ -168,11 +168,14 @@ class RouteHandler extends SingletonFactory { * but a reverse lookup. * * @param array $components + * @param boolean $isACP * @return string */ - public function buildRoute(array $components) { + public function buildRoute(array $components, $isACP = null) { + if ($isACP === null) $isACP = RequestHandler::getInstance()->isACPRequest(); + foreach ($this->routes as $route) { - if (RequestHandler::getInstance()->isACPRequest() != $route->isACP()) { + if ($isACP != $route->isACP()) { continue; } -- 2.20.1