summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-27 22:42:42 +0200
committeradmin <devnull@localhost>2006-09-27 22:42:42 +0200
commit17a890df20b56c8d82812f365f27bc590be009f3 (patch)
tree15ec4f0afb68f774e0933fb27c27346ae262d060 /system
parentdcafe89f348697d273e21a2d451a99ba8c6ec68f (diff)
Diffstat (limited to 'system')
-rw-r--r--system/application/config/autoload.php16
-rw-r--r--system/application/config/database.php2
-rw-r--r--system/database/drivers/mysql/mysql_driver.php14
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php14
-rw-r--r--system/libraries/Router.php20
5 files changed, 44 insertions, 22 deletions
diff --git a/system/application/config/autoload.php b/system/application/config/autoload.php
index fc9d43fb6..245d36a7c 100644
--- a/system/application/config/autoload.php
+++ b/system/application/config/autoload.php
@@ -21,7 +21,6 @@
| 1. Libraries
| 2. Helper files
| 3. Plugins
-| 4. Scripts
| 5. Custom config files
|
*/
@@ -67,21 +66,6 @@ $autoload['plugin'] = array();
/*
| -------------------------------------------------------------------
-| Auto-load Scripts
-| -------------------------------------------------------------------
-| The term "scripts" refers to you own PHP scripts that you've
-| placed in the application/scripts/ folder
-|
-| Prototype:
-|
-| $autoload['script'] = array('my_script1', 'my_script2');
-*/
-
-$autoload['script'] = array();
-
-
-/*
-| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
diff --git a/system/application/config/database.php b/system/application/config/database.php
index 204ef6894..5e6420831 100644
--- a/system/application/config/database.php
+++ b/system/application/config/database.php
@@ -34,7 +34,7 @@ $active_group = "default";
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
-$db['default']['database'] = "test";
+$db['default']['database'] = "tester";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index b6c4eb7ea..d4f322d5f 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -222,7 +222,19 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function escape_str($str)
{
- return mysql_real_escape_string($str);
+ if (get_magic_quotes_gpc())
+ {
+ return $str;
+ }
+
+ if (function_exists('mysql_escape_string'))
+ {
+ return mysql_real_escape_string($str);
+ }
+ else
+ {
+ return addslashes($str);
+ }
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index d6e967498..63df0fe6f 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -225,7 +225,19 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
function escape_str($str)
{
- return mysqli_real_escape_string($this->conn_id, $str);
+ if (get_magic_quotes_gpc())
+ {
+ return $str;
+ }
+
+ if (function_exists('mysql_escape_string'))
+ {
+ return mysqli_real_escape_string($this->conn_id, $str);
+ }
+ else
+ {
+ return addslashes($str);
+ }
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Router.php b/system/libraries/Router.php
index d7740f5f3..34a2512a6 100644
--- a/system/libraries/Router.php
+++ b/system/libraries/Router.php
@@ -65,7 +65,9 @@ class CI_Router {
*/
function _set_route_mapping()
{
- // Are query strings enabled? If so we're done...
+
+ // Are query strings enabled in the config file?
+ // If so, we're done since segment based URIs are not used with query strings.
if ($this->config->item('enable_query_strings') === TRUE AND isset($_GET[$this->config->item('controller_trigger')]))
{
$this->set_class($_GET[$this->config->item('controller_trigger')]);
@@ -78,15 +80,26 @@ class CI_Router {
return;
}
- // Load the routes.php file and set the default controller
+ // Load the routes.php file.
@include_once(APPPATH.'config/routes'.EXT);
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
unset($route);
+ // Set the default controller so we can display it in the event
+ // the URI doesn't correlated to a valid controller.
$this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
+ // Fetch the complete URI string
+ $this->uri_string = $this->_get_uri_string();
+
+ // If the URI contains only a slash we'll kill it
+ if ($this->uri_string == '/')
+ {
+ $this->uri_string = '';
+ }
+
// Is there a URI string? If not, the default controller specified in the "routes" file will be shown.
- if (($this->uri_string = $this->_get_uri_string()) == '')
+ if ($this->uri_string == '')
{
if ($this->default_controller === FALSE)
{
@@ -107,6 +120,7 @@ class CI_Router {
$this->uri_string = preg_replace("|".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string);
}
+
// Explode the URI Segments. The individual segments will
// be stored in the $this->segments array.
foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val)