From: Alexander Ebert Date: Sun, 5 Jan 2014 14:34:37 +0000 (+0100) Subject: Fixed request handler for controller-less requests X-Git-Tag: 2.0.2~31^2~1^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7420d41c587a367d7c0c028c72a9ac9025d128c1;p=GitHub%2FWoltLab%2FWCF.git Fixed request handler for controller-less requests --- diff --git a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php index cfbbe2b1ee..d79684ef58 100644 --- a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php @@ -13,7 +13,7 @@ use wcf\util\HeaderUtil; /** * Handles http requests. - * + * * @author Marcel Werk * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License @@ -67,7 +67,7 @@ class RequestHandler extends SingletonFactory { /** * Handles a http request. - * + * * @param string $application * @param boolean $isACPRequest */ @@ -109,7 +109,7 @@ class RequestHandler extends SingletonFactory { /** * Builds a new request. - * + * * @param string $application */ protected function buildRequest($application) { @@ -135,8 +135,16 @@ class RequestHandler extends SingletonFactory { $routeData['controller'] = $landingPage->getController(); } else { - // check if current URL matches an application but controller was omitted + // check if request URI resolves to an application different from relative route + // important: request URI may not contain anything else expect for the path $currentRequestURI = RouteHandler::getHost() . $requestUri; + $redirectToLandingPage = false; + if ($currentRequestURI == ApplicationHandler::getInstance()->getPrimaryApplication()->getPageURL()) { + HeaderUtil::redirect($landingPage->getLink(), true); + exit; + } + + // check if current URL matches an application but controller was omitted foreach (ApplicationHandler::getInstance()->getApplications() as $application) { if ($currentRequestURI == $application->getPageURL()) { if ($controller = WCF::getApplicationObject($application)->getPrimaryController()) { @@ -145,12 +153,7 @@ class RequestHandler extends SingletonFactory { exit; } } - } - - // redirect to landing page - HeaderUtil::redirect($landingPage->getLink(), true); - exit; } } @@ -207,7 +210,7 @@ class RequestHandler extends SingletonFactory { /** * Returns the class data for the active request or null if for the given * configuration no proper class exist. - * + * * @param string $controller * @param string $pageType * @param string $application @@ -237,7 +240,7 @@ class RequestHandler extends SingletonFactory { /** * Returns the active request object. - * + * * @return \wcf\system\request\Request */ public function getActiveRequest() { @@ -246,7 +249,7 @@ class RequestHandler extends SingletonFactory { /** * Returns true if the request is an acp request. - * + * * @return boolean */ public function isACPRequest() { @@ -255,7 +258,7 @@ class RequestHandler extends SingletonFactory { /** * Returns true, if current host mismatches any known domain. - * + * * @return boolean */ public function inRescueMode() {