Added fix for certain webspace environments (e.g. 1&1)
authorAlexander Ebert <ebert@woltlab.com>
Sat, 1 Jun 2013 12:50:48 +0000 (14:50 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 1 Jun 2013 12:50:48 +0000 (14:50 +0200)
wcfsetup/install/files/lib/system/request/RouteHandler.class.php

index c2f78ee96a757fb271505efd94b7a427a033aa04..176b0e3ea345694ab3ce885c6a6e91ace2ec4170 100644 (file)
@@ -105,7 +105,29 @@ class RouteHandler extends SingletonFactory {
         * @return      boolean
         */
        public function matches() {
-               $pathInfo = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : '';
+               $pathInfo = '';
+               if (isset($_SERVER['ORIG_PATH_INFO'])) {
+                       $pathInfo = $_SERVER['ORIG_PATH_INFO'];
+                       
+                       // in some configurations ORIG_PATH_INFO contains the path to the file
+                       // if the intended PATH_INFO component is empty
+                       if (!empty($pathInfo)) {
+                               if (isset($_SERVER['SCRIPT_NAME']) && ($pathInfo == $_SERVER['SCRIPT_NAME'])) {
+                                       $pathInfo = '';
+                               }
+                               
+                               if (isset($_SERVER['PHP_SELF']) && ($pathInfo == $_SERVER['PHP_SELF'])) {
+                                       $pathInfo = '';
+                               }
+                               
+                               if (isset($_SERVER['SCRIPT_URL']) && ($pathInfo == $_SERVER['SCRIPT_URL'])) {
+                                       $pathInfo = '';
+                               }
+                       }
+               }
+               else if (isset($_SERVER['PATH_INFO'])) {
+                       $pathInfo = $_SERVER['PATH_INFO'];
+               }
                
                foreach ($this->routes as $route) {
                        if (RequestHandler::getInstance()->isACPRequest() != $route->isACP()) {