Fixed handling of i18n pages being used as landing page
authorAlexander Ebert <ebert@woltlab.com>
Thu, 29 Sep 2016 17:26:12 +0000 (19:26 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 29 Sep 2016 17:26:12 +0000 (19:26 +0200)
wcfsetup/install/files/lib/system/request/ControllerMap.class.php
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index e624436183a8c76e9da67e9e9bedda16dc5a843a..2350cc4f80210a6106c83cf7734b457341a6cbb4 100644 (file)
@@ -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<controller>__WCF_CMS__\d+)(?:-(?P<languageID>\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);
index edd64432ef81a426e09307be36eb354444f9d6b7..d76335039916d7f98f3f64f3640a51f9dda6ce03 100644 (file)
@@ -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'],