Changeset 2310 for trunk/system/libraries/Router.php
- Timestamp:
- 03/17/2008 04:40:35 AM (8 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/Router.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/Router.php
r2250 r2310 29 29 /** 30 30 * Router setup routine. Automatically called during Kohana setup process. 31 * 32 * @return void 31 33 */ 32 34 public static function setup() … … 39 41 40 42 // Use the default route when no segments exist 41 if (self::$current_uri == '' OR self::$current_uri == '/')42 { 43 self::$current_uri = self::$routes['_default'];43 if (self::$current_uri === '') 44 { 45 self::$current_uri = trim(self::$routes['_default'], '/'); 44 46 $default_route = TRUE; 45 47 } … … 62 64 63 65 // Custom routing 64 if ($default_route == FALSE AND count(self::$routes) > 1)66 if ($default_route === FALSE AND count(self::$routes) > 1) 65 67 { 66 68 if (isset(self::$routes[self::$current_uri])) … … 75 77 { 76 78 if ($key === '_default') continue; 79 80 // Trim slashes 81 $key = trim($key, '/'); 82 $val = trim($val, '/'); 77 83 78 84 // Does this route match the current URI? … … 96 102 97 103 // Check router one more time to do some magic 98 self::$rsegments = isset(self::$routes[self::$rsegments]) ? self::$routes[self::$rsegments] : self::$rsegments; 104 if (isset(self::$routes[self::$rsegments])) 105 { 106 self::$rsegments = self::$routes[self::$rsegments]; 107 } 99 108 } 100 109 101 110 // Explode the segments by slashes 102 if ($default_route == TRUE OR self::$segments== '')111 if ($default_route === TRUE OR self::$segments === '') 103 112 { 104 113 self::$segments = array(); … … 108 117 self::$segments = explode('/', self::$segments); 109 118 } 119 110 120 // Routed segments will never be blank 111 121 self::$rsegments = explode('/', self::$rsegments); … … 178 188 /** 179 189 * Attempts to determine the current URI using CLI, GET, PATH_INFO, ORIG_PATH_INFO, or PHP_SELF. 190 * 191 * @return void 180 192 */ 181 193 public static function find_uri() … … 269 281 $str = trim($str); 270 282 271 if ($str != '' AND ($allowed = Config::item('routes._allowed')) != '')283 if ($str !== '' AND ($allowed = Config::item('routes._allowed')) != '') 272 284 { 273 285 if ( ! preg_match('|^['.preg_quote($allowed).']++$|iuD', $str))
