Browse Source

Adding auto-detection check for IIS (manually defining SERVER_IIS is no longer required), and fixing setUri for rewritten IIS URLs.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4858 3807eeeb-6ff5-0310-8944-8be069107fe0
nate 19 years ago
parent
commit
ef79f256a7
2 changed files with 8 additions and 2 deletions
  1. 2 2
      cake/basics.php
  2. 6 0
      cake/bootstrap.php

+ 2 - 2
cake/basics.php

@@ -921,7 +921,7 @@
 			$uri = env('REQUEST_URI');
 		} else {
 			if ($uri = env('argv')) {
-				if (defined('SERVER_IIS')) {
+				if (defined('SERVER_IIS') && SERVER_IIS) {
 					if (key($_GET) && strpos(key($_GET), '?') !== false) {
 						unset($_GET[key($_GET)]);
 					}
@@ -940,7 +940,7 @@
 				$uri = env('PHP_SELF') . '/' . env('QUERY_STRING');
 			}
 		}
-		return $uri;
+		return preg_replace('/\?url=\//', '', $uri);
 	}
 /**
  * Gets an environment variable from available sources, and provides emulation

+ 6 - 0
cake/bootstrap.php

@@ -48,6 +48,12 @@ if (!defined('PHP5')) {
 	Configure::load('class.paths');
 	Configure::write('debug', DEBUG);
 /**
+ * Check for IIS Server
+ */
+	if (!defined('SERVER_IIS') && php_sapi_name() == 'isapi') {
+		define('SERVER_IIS', true);
+	}
+/**
  * Get the application path and request URL
  */
 	if (empty($uri) && defined('BASE_URL')) {