Fixed landing page belonging to different application
authorAlexander Ebert <ebert@woltlab.com>
Thu, 29 Sep 2016 15:11:55 +0000 (17:11 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 29 Sep 2016 15:11:55 +0000 (17:11 +0200)
wcfsetup/install/files/lib/system/request/ControllerMap.class.php
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index 214b66aa8b0235dd1a286c6605145af9339c3502..e624436183a8c76e9da67e9e9bedda16dc5a843a 100644 (file)
@@ -195,7 +195,8 @@ class ControllerMap extends SingletonFactory {
         * @throws      SystemException
         */
        public function lookupDefaultController($application) {
-               $controller = $this->landingPages[$application][1];
+               $data = $this->landingPages[$application];
+               $controller = $data[1];
                
                if ($application === 'wcf' && empty($controller)) {
                        return null;
@@ -221,7 +222,7 @@ class ControllerMap extends SingletonFactory {
                }
                
                return [
-                       'application' => $application,
+                       'application' => mb_substr($data[2], 0, mb_strpos($data[2], '\\')),
                        'controller' => $controller
                ];
        }
index cbf49e1561e297ebc08185ccb196fdfff199bb2c..edd64432ef81a426e09307be36eb354444f9d6b7 100644 (file)
@@ -222,6 +222,15 @@ class RequestHandler extends SingletonFactory {
                        // force a redirect
                        HeaderUtil::redirect($data['redirect'], true, false);
                }
+               else if ($data['application'] !== $application) {
+                       HeaderUtil::redirect(
+                               LinkHandler::getInstance()->getLink(
+                                       ControllerMap::getInstance()->resolve($data['application'], $data['controller'], false)['controller'],
+                                       ['application' => $data['application']]
+                               )
+                       );
+                       exit;
+               }
                
                // copy route data
                foreach ($data as $key => $value) {