Added ability to disable redirect if WCF is embedded
authorAlexander Ebert <ebert@woltlab.com>
Mon, 1 Jul 2013 15:31:01 +0000 (17:31 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 1 Jul 2013 15:31:01 +0000 (17:31 +0200)
wcfsetup/install/files/lib/system/request/RequestHandler.class.php

index b0b8e596667e23d04210e3dcc075ef44b52b467c..40ecc3c01830c2fd783799fec2bef3c724d5b663 100644 (file)
@@ -122,24 +122,26 @@ class RequestHandler extends SingletonFactory {
                                }
                                
                                // check if accessing from the wrong domain (e.g. "www." omitted but domain was configured with)
-                               $applicationObject = ApplicationHandler::getInstance()->getApplication($application);
-                               if ($applicationObject->domainName != $_SERVER['HTTP_HOST']) {
-                                       // build URL, e.g. http://example.net/forum/
-                                       $url = FileUtil::addTrailingSlash(RouteHandler::getProtocol() . $applicationObject->domainName . RouteHandler::getPath());
-                                       
-                                       // add path info, e.g. index.php/Board/2/
-                                       $pathInfo = RouteHandler::getPathInfo();
-                                       if (!empty($pathInfo)) {
-                                               $url .= 'index.php' . $pathInfo;
-                                       }
-                                       
-                                       // query string, e.g. ?foo=bar
-                                       if (!empty($_SERVER['QUERY_STRING'])) {
-                                               $url .= '?' . $_SERVER['QUERY_STRING'];
+                               if (!defined('WCF_RUN_MODE') || WCF_RUN_MODE != 'embedded') {
+                                       $applicationObject = ApplicationHandler::getInstance()->getApplication($application);
+                                       if ($applicationObject->domainName != $_SERVER['HTTP_HOST']) {
+                                               // build URL, e.g. http://example.net/forum/
+                                               $url = FileUtil::addTrailingSlash(RouteHandler::getProtocol() . $applicationObject->domainName . RouteHandler::getPath());
+                                               
+                                               // add path info, e.g. index.php/Board/2/
+                                               $pathInfo = RouteHandler::getPathInfo();
+                                               if (!empty($pathInfo)) {
+                                                       $url .= 'index.php' . $pathInfo;
+                                               }
+                                               
+                                               // query string, e.g. ?foo=bar
+                                               if (!empty($_SERVER['QUERY_STRING'])) {
+                                                       $url .= '?' . $_SERVER['QUERY_STRING'];
+                                               }
+                                               
+                                               HeaderUtil::redirect($url, true);
+                                               exit;
                                        }
-                                       
-                                       HeaderUtil::redirect($url, true);
-                                       exit;
                                }
                        }