Changeset 1539
- Timestamp:
- 12/14/2007 05:41:26 PM (10 months ago)
- Location:
- trunk/system/libraries
- Files:
-
- 2 modified
-
Router.php (modified) (3 diffs)
-
URI.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Router.php
r1538 r1539 50 50 { 51 51 // Set the query string to the current query string 52 self::$query_string = $_SERVER['QUERY_STRING'];52 self::$query_string = trim($_SERVER['QUERY_STRING'], '&'); 53 53 } 54 54 … … 202 202 } 203 203 } 204 elseif (isset($_SERVER['PATH_INFO']) AND $_SERVER['PATH_INFO']) 205 { 206 self::$current_uri = $_SERVER['PATH_INFO']; 207 } 208 elseif (isset($_SERVER['ORIG_PATH_INFO']) AND $_SERVER['ORIG_PATH_INFO']) 209 { 210 self::$current_uri = $_SERVER['ORIG_PATH_INFO']; 211 } 212 elseif (isset($_SERVER['PHP_SELF']) AND $_SERVER['PHP_SELF']) 213 { 214 self::$current_uri = $_SERVER['PHP_SELF']; 215 } 216 elseif (count($_GET) === 1 AND current($_GET) == '') 217 { 218 self::$current_uri = current(array_keys($_GET)); 204 elseif (count($_GET) === 1 AND current($_GET) == '' AND substr($_SERVER['QUERY_STRING'], -1) !== '=') 205 { 206 // The URI is the array key, eg: ?this/is/the/uri 207 self::$current_uri = key($_GET); 219 208 220 209 // Fixes really strange handling of a suffix in a GET string … … 226 215 // Destroy GET 227 216 $_GET = array(); 217 $_SERVER['QUERY_STRING'] = ''; 218 } 219 elseif (isset($_SERVER['PATH_INFO']) AND $_SERVER['PATH_INFO']) 220 { 221 self::$current_uri = $_SERVER['PATH_INFO']; 222 } 223 elseif (isset($_SERVER['ORIG_PATH_INFO']) AND $_SERVER['ORIG_PATH_INFO']) 224 { 225 self::$current_uri = $_SERVER['ORIG_PATH_INFO']; 226 } 227 elseif (isset($_SERVER['PHP_SELF']) AND $_SERVER['PHP_SELF']) 228 { 229 self::$current_uri = $_SERVER['PHP_SELF']; 228 230 } 229 231 -
trunk/system/libraries/URI.php
r1522 r1539 11 11 12 12 /** 13 * Constructor: __construct 14 * Detects current query string. 13 * Constructor. 15 14 */ 16 15 public function __construct() 17 16 { 18 if ( ! empty($_GET)) 19 { 20 self::$query_string = '?'; 21 22 foreach($_GET as $key => $val) 23 { 24 if (is_array($val)) 25 { 26 foreach($val as $sub_key => $sub_val) 27 { 28 // Integer subkeys are numerically indexed arrays 29 $sub_key = is_int($sub_key) ? '[]' : '['.$sub_key.']'; 30 31 self::$query_string .= $key.rawurlencode($sub_key).'='.rawurlencode($sub_val).'&'; 32 } 33 } 34 else 35 { 36 self::$query_string .= $key.'='.rawurlencode($val).'&'; 37 } 38 } 39 40 // Remove the ending ampersand 41 self::$query_string = rtrim(self::$query_string, '&'); 42 } 17 Log::add('debug', 'URI library initialized.'); 43 18 } 44 19
