From ef79f256a787d8d78da944b2aa93e197f48a3493 Mon Sep 17 00:00:00 2001 From: nate Date: Sat, 14 Apr 2007 21:35:48 +0000 Subject: [PATCH] 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 --- cake/basics.php | 4 ++-- cake/bootstrap.php | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cake/basics.php b/cake/basics.php index 49cfea939..93e3196a5 100644 --- a/cake/basics.php +++ b/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 diff --git a/cake/bootstrap.php b/cake/bootstrap.php index 5a366416c..cc0fd3a1f 100644 --- a/cake/bootstrap.php +++ b/cake/bootstrap.php @@ -47,6 +47,12 @@ if (!defined('PHP5')) { Configure::store(null, 'class.paths'); 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 */