Bläddra i källkod

Workaround for the missing REQUEST_URI on IIS

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@105 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 16 år sedan
förälder
incheckning
87e26e5bc6
1 ändrade filer med 16 tillägg och 1 borttagningar
  1. 16 1
      application/displayblock.class.inc.php

+ 16 - 1
application/displayblock.class.inc.php

@@ -775,7 +775,22 @@ class MenuBlock extends DisplayBlock
 		{
 			$sPort = ($_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
 		}
-		$sPath = $_SERVER['REQUEST_URI'];
+		// $_SERVER['REQUEST_URI'] is empty when running on IIS
+		// Let's use Ivan Tcholakov's fix (found on www.dokeos.com)
+		if (!empty($_SERVER['REQUEST_URI']))
+		{
+			$sPath = $_SERVER['REQUEST_URI'];
+		}
+		else
+		{
+			$sPath = $_SERVER['SCRIPT_NAME'];
+			if (!empty($_SERVER['QUERY_STRING']))
+			{
+				$sPath .= '?'.$_SERVER['QUERY_STRING'];
+			}
+			$_SERVER['REQUEST_URI'] = $sPath;
+		} 
+   		$sPath = $_SERVER['REQUEST_URI'];
 		$sUrl = "$sProtocol://{$sServerName}{$sPort}{$sPath}";
 		
 		return $sUrl;