Change class filenames to Ucfirst
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index c682664..a026920 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -240,12 +240,13 @@
// Load the local application controller
// Note: The Router class automatically validates the controller path using the router->_validate_request().
// If this include fails it means that the default controller in the Routes.php file is not resolving to something valid.
- if ( ! file_exists(APPPATH.'controllers/'.$RTR->directory.$RTR->class.'.php'))
+ $class = ucfirst($RTR->class);
+ if ( ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
{
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}
- include(APPPATH.'controllers/'.$RTR->directory.$RTR->class.'.php');
+ include(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
// Set a mark point for benchmarking
$BM->mark('loading_time:_base_classes_end');
@@ -257,9 +258,8 @@
*
* None of the methods in the app controller or the
* loader class can be called via the URI, nor can
- * controller functions that begin with an underscore.
+ * controller methods that begin with an underscore.
*/
- $class = $RTR->class;
$method = $RTR->method;
if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
@@ -271,6 +271,8 @@
$method = 'index';
}
+ $class = ucfirst($class);
+
if ( ! class_exists($class, FALSE))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
@@ -309,6 +311,8 @@
$method = 'index';
}
+ $class = ucfirst($class);
+
if ( ! class_exists($class, FALSE))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 70a6b6f..535c9e4 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -261,7 +261,22 @@
show_error('The model name you are loading is the name of a resource that is already being used: '.$name);
}
- $model = strtolower($model);
+ if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE))
+ {
+ if ($db_conn === TRUE)
+ {
+ $db_conn = '';
+ }
+
+ $CI->load->database($db_conn, FALSE, TRUE);
+ }
+
+ if ( ! class_exists('CI_Model', FALSE))
+ {
+ load_class('Model', 'core');
+ }
+
+ $model = ucfirst(strtolower($model));
foreach ($this->_ci_model_paths as $mod_path)
{
@@ -270,24 +285,8 @@
continue;
}
- if ($db_conn !== FALSE && ! class_exists('CI_DB', FALSE))
- {
- if ($db_conn === TRUE)
- {
- $db_conn = '';
- }
-
- $CI->load->database($db_conn, FALSE, TRUE);
- }
-
- if ( ! class_exists('CI_Model', FALSE))
- {
- load_class('Model', 'core');
- }
-
require_once($mod_path.'models/'.$path.$model.'.php');
- $model = ucfirst($model);
$CI->$name = new $model();
$this->_ci_models[] = $name;
return;
diff --git a/system/core/Router.php b/system/core/Router.php
index cc3916f..989ae54 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -270,8 +270,7 @@
return $segments;
}
- $test = ($this->translate_uri_dashes === TRUE)
- ? str_replace('-', '_', $segments[0]) : $segments[0];
+ $test = ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]);
// Does the requested controller exist in the root folder?
if (file_exists(APPPATH.'controllers/'.$test.'.php'))
@@ -286,8 +285,7 @@
$this->set_directory(array_shift($segments));
if (count($segments) > 0)
{
- $test = ($this->translate_uri_dashes === TRUE)
- ? str_replace('-', '_', $segments[0]) : $segments[0];
+ $test = ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]);
// Does the requested controller exist in the sub-directory?
if ( ! file_exists(APPPATH.'controllers/'.$this->directory.$test.'.php'))
@@ -307,7 +305,7 @@
{
// Is the method being specified in the route?
$segments = explode('/', $this->default_controller);
- if ( ! file_exists(APPPATH.'controllers/'.$this->directory.$segments[0].'.php'))
+ if ( ! file_exists(APPPATH.'controllers/'.$this->directory.ucfirst($segments[0]).'.php'))
{
$this->directory = '';
}