From 849e943dec5f0e6aed6f91ee587508ae77fa56b8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 29 Sep 2016 19:26:12 +0200 Subject: [PATCH] Fixed handling of i18n pages being used as landing page --- .../files/lib/system/request/ControllerMap.class.php | 10 ++++++++++ .../files/lib/system/request/RequestHandler.class.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php index e624436183..2350cc4f80 100644 --- a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php +++ b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php @@ -3,6 +3,7 @@ namespace wcf\system\request; use wcf\page\CmsPage; use wcf\system\cache\builder\RoutingCacheBuilder; use wcf\system\exception\SystemException; +use wcf\system\language\LanguageFactory; use wcf\system\SingletonFactory; use wcf\system\WCF; use wcf\system\WCFACP; @@ -238,6 +239,15 @@ class ControllerMap extends SingletonFactory { // lookup custom urls first if (isset($this->customUrls['lookup'][$application], $this->customUrls['lookup'][$application][$controller])) { $controller = $this->customUrls['lookup'][$application][$controller]; + if (preg_match('~^(?P__WCF_CMS__\d+)(?:-(?P\d+))?$~', $controller, $matches)) { + if ($matches['languageID'] && $matches['languageID'] != LanguageFactory::getInstance()->getDefaultLanguageID()) { + return false; + } + else { + $controller = $matches['controller']; + } + } + if (strpos($controller, '__WCF_CMS__') !== false) { // remove language id component $controller = preg_replace('~\-\d+$~', '', $controller); diff --git a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php index edd64432ef..d763350399 100644 --- a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php @@ -222,7 +222,7 @@ class RequestHandler extends SingletonFactory { // force a redirect HeaderUtil::redirect($data['redirect'], true, false); } - else if ($data['application'] !== $application) { + else if (!empty($data['application']) && $data['application'] !== $application) { HeaderUtil::redirect( LinkHandler::getInstance()->getLink( ControllerMap::getInstance()->resolve($data['application'], $data['controller'], false)['controller'], -- 2.20.1