From b071bb5a92aade551345a495fb13f5678f3978d0 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 26 Aug 2006 19:28:37 +0000 Subject: --- system/libraries/Calendar.php | 2 +- system/libraries/Loader.php | 2 +- system/libraries/Router.php | 45 +++++++++++++++++++++++-------------------- system/libraries/URI.php | 14 +++++++------- 4 files changed, 33 insertions(+), 30 deletions(-) (limited to 'system/libraries') diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php index 013f06796..b77dd1b6f 100644 --- a/system/libraries/Calendar.php +++ b/system/libraries/Calendar.php @@ -263,7 +263,7 @@ class CI_Calendar { } else { - $month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_novermber', '12' => 'cal_december'); + $month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december'); } $month = $month_names[$month]; diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php index e2467fa64..3d2501fc0 100644 --- a/system/libraries/Loader.php +++ b/system/libraries/Loader.php @@ -478,7 +478,7 @@ class CI_Loader { if ($path == '') { $ext = pathinfo($view, PATHINFO_EXTENSION); - $file = ($ext == '') ? $view.EXT : $view; + $file = ($ext != EXT) ? $view.EXT : $view; $path = $this->view_path.$file; } else diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 678145458..b28ead953 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -87,25 +87,31 @@ class CI_Router { // Fetch the URI string Depending on the server, // the URI will be available in one of two globals - switch ($this->config->item('uri_protocol')) + if ($this->config->item('uri_protocol') == 'auto') { - case 'path_info' : $this->uri_string = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); - break; - case 'query_string' : $this->uri_string = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); - break; - default : - $path_info = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); - - if ($path_info != '' AND $path_info != "/".SELF) - { - $this->uri_string = $path_info; - } - else - { - $this->uri_string = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); - } - break; + $path_info = getenv('PATH_INFO'); + if ($path_info != '' AND $path_info != "/".SELF) + { + $this->uri_string = $path_info; + } + else + { + $path_info = getenv('ORIG_PATH_INFO'); + if ($path_info != '' AND $path_info != "/".SELF) + { + $this->uri_string = $path_info; + } + else + { + $this->uri_string = getenv('QUERY_STRING'); + } + } + } + else + { + $this->uri_string = getenv(strtoupper($this->config->item('uri_protocol'))); } + // Is there a URI string? If not, the default controller specified // by the admin in the "routes" file will be shown. @@ -291,10 +297,7 @@ class CI_Router { // Loop through the route array looking for wildcards foreach (array_slice($this->routes, 1) as $key => $val) - { - if (count(explode('/', $key)) != $num) - continue; - + { // Convert wildcards to RegEx $key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key)); diff --git a/system/libraries/URI.php b/system/libraries/URI.php index 4c2fa9c7f..c5fd4625b 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -28,7 +28,7 @@ */ class CI_URI { - var $uri; + var $router; var $keyval = array(); /** @@ -42,7 +42,7 @@ class CI_URI { */ function CI_URI() { - $this->uri =& _load_class('CI_Router'); + $this->router =& _load_class('CI_Router'); log_message('debug', "URI Class Initialized"); } @@ -60,7 +60,7 @@ class CI_URI { */ function segment($n, $no_result = FALSE) { - return ( ! isset($this->uri->segments[$n])) ? $no_result : $this->uri->segments[$n]; + return ( ! isset($this->router->segments[$n])) ? $no_result : $this->router->segments[$n]; } // -------------------------------------------------------------------- @@ -196,7 +196,7 @@ class CI_URI { $leading = '/'; $trailing = '/'; } - return ( ! isset($this->uri->segments[$n])) ? '' : $leading.$this->uri->segments[$n].$trailing; + return ( ! isset($this->router->segments[$n])) ? '' : $leading.$this->router->segments[$n].$trailing; } // -------------------------------------------------------------------- @@ -209,7 +209,7 @@ class CI_URI { */ function segment_array() { - return $this->uri->segments; + return $this->router->segments; } // -------------------------------------------------------------------- @@ -222,7 +222,7 @@ class CI_URI { */ function total_segments() { - return count($this->uri->segments); + return count($this->router->segments); } // -------------------------------------------------------------------- @@ -235,7 +235,7 @@ class CI_URI { */ function uri_string() { - return $this->uri->uri_string; + return $this->router->uri_string; } } -- cgit v1.2.3-24-g4f1b