From 3eb25f5bad21c1765d2a710b11dd74e6fc5416aa Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 8 Jun 2015 10:54:07 +0200 Subject: [PATCH] Fixed redirect to landing page triggered on non-primary application --- .../lib/system/request/RequestHandler.class.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php index dbd4fb3996..a596ce798d 100644 --- a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php @@ -291,9 +291,10 @@ class RequestHandler extends SingletonFactory { // resolve implicit application abbreviation for landing page controller $landingPageApplication = $landingPage->getApplication(); + $primaryApplication = ApplicationHandler::getInstance()->getPrimaryApplication(); + $primaryApplicationAbbr = ApplicationHandler::getInstance()->getAbbreviation($primaryApplication->packageID); if ($landingPageApplication == 'wcf') { - $primaryApplication = ApplicationHandler::getInstance()->getPrimaryApplication(); - $landingPageApplication = ApplicationHandler::getInstance()->getAbbreviation($primaryApplication->packageID); + $landingPageApplication = $primaryApplicationAbbr; } // check if currently invoked application matches the landing page @@ -303,8 +304,16 @@ class RequestHandler extends SingletonFactory { return; } - HeaderUtil::redirect($landingPage->getLink()); - exit; + // redirect if this is the primary application + if ($application === $primaryApplicationAbbr) { + HeaderUtil::redirect($landingPage->getLink()); + exit; + } + + // set default controller + $applicationObj = WCF::getApplicationObject(ApplicationHandler::getInstance()->getApplication($application)); + $routeData['controller'] = preg_replace('~^.*?\\\([^\\\]+)(?:Action|Form|Page)$~', '\\1', $applicationObj->getPrimaryController()); + if (!URL_LEGACY_MODE) $routeData['controller'] = self::getTokenizedController($routeData['controller']); } /** -- 2.20.1