summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/codeigniter/CodeIgniter.php4
-rw-r--r--system/database/DB_utility.php60
-rw-r--r--system/database/drivers/mssql/mssql_utility.php28
-rw-r--r--system/database/drivers/mysql/mysql_utility.php28
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php28
-rw-r--r--system/database/drivers/oci8/oci8_utility.php16
-rw-r--r--system/database/drivers/odbc/odbc_utility.php12
-rw-r--r--system/database/drivers/postgre/postgre_utility.php28
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php12
-rw-r--r--system/libraries/Loader.php7
-rw-r--r--system/libraries/Router.php20
-rw-r--r--system/libraries/Validation.php16
12 files changed, 148 insertions, 111 deletions
diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php
index 434602742..a227066fc 100644
--- a/system/codeigniter/CodeIgniter.php
+++ b/system/codeigniter/CodeIgniter.php
@@ -197,8 +197,8 @@ else
show_404();
}
- // Call the requested method. Any URI segments present (besides the class/function)
- // will be passed to the method for convenience
+ // Call the requested method.
+ // Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($RTR->rsegments, (($RTR->fetch_directory() == '') ? 2 : 3)));
}
}
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 128984d4f..36d74c5b3 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -232,14 +232,70 @@ class CI_DB_utility {
// --------------------------------------------------------------------
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ $sql = $this->_drop_database($name);
+
+ if (is_bool($sql))
+ {
+ return $sql;
+ }
+
+ return $this->db->query($sql);
+ }
+ // --------------------------------------------------------------------
+ /**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ function list_databases()
+ {
+ $query = $this->db->query($this->_list_database());
+ $dbs = array();
+ if ($query->num_rows() > 0)
+ {
+ foreach ($query->result_array() as $row)
+ {
+ $dbs[] = current($row);
+ }
+ }
+
+ return $dbs;
+ }
+ // --------------------------------------------------------------------
-
- function create_table()
+ /**
+ * Drop Table
+ *
+ * @access public
+ * @param string the table name
+ * @return bool
+ */
+ function drop_table($name)
{
+ $sql = $this->_drop_table($name);
+
+ if (is_bool($sql))
+ {
+ return $sql;
+ }
+
+ return $this->db->query($sql);
}
+
+
function alter_table()
{
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 49b63b7d0..b85a420e7 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -42,13 +42,13 @@ class CI_DB_mssql_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -56,22 +56,12 @@ class CI_DB_mssql_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("EXEC sp_helpdb"); // Can also be: EXEC sp_databases
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases
}
// --------------------------------------------------------------------
@@ -79,12 +69,12 @@ class CI_DB_mssql_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE ".$this->db->_escape_table($name));
+ return "DROP TABLE ".$this->db->_escape_table($name);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index e5f8e850d..a0c746207 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -41,13 +41,13 @@ class CI_DB_mysql_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -55,22 +55,12 @@ class CI_DB_mysql_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("SHOW DATABASES");
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "SHOW DATABASES";
}
// --------------------------------------------------------------------
@@ -78,12 +68,12 @@ class CI_DB_mysql_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE IF EXISTS ".$this->db->_escape_table($name));
+ return "DROP TABLE IF EXISTS ".$this->db->_escape_table($name);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 1775047ca..328661866 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -41,13 +41,13 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -55,22 +55,12 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("SHOW DATABASES");
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "SHOW DATABASES";
}
// --------------------------------------------------------------------
@@ -78,12 +68,12 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE IF EXISTS ".$this->db->_escape_table($name));
+ return "DROP TABLE IF EXISTS ".$this->db->_escape_table($name);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 74b0165cb..9c3059f41 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -34,6 +34,7 @@ class CI_DB_oci8_utility extends CI_DB_utility {
*/
function _create_database($name)
{
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -41,12 +42,13 @@ class CI_DB_oci8_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -54,11 +56,12 @@ class CI_DB_oci8_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -66,11 +69,12 @@ class CI_DB_oci8_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
+ return FALSE;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 74f8d3905..5b4558f68 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -48,11 +48,11 @@ class CI_DB_odbc_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
// ODBC has no "drop database" command since it's
// designed to connect to an existing database
@@ -68,10 +68,10 @@ class CI_DB_odbc_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
// Not sure if ODBC lets you list all databases...
if ($this->db_debug)
@@ -86,10 +86,10 @@ class CI_DB_odbc_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
// Not a supported ODBC feature
if ($this->db_debug)
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 8e51623be..b31609aea 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -42,13 +42,13 @@ class CI_DB_postgre_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -56,22 +56,12 @@ class CI_DB_postgre_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("SELECT datname FROM pg_database");
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "SELECT datname FROM pg_database";
}
// --------------------------------------------------------------------
@@ -79,12 +69,12 @@ class CI_DB_postgre_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE ".$this->db->_escape_table($name)." CASCADE");
+ return "DROP TABLE ".$this->db->_escape_table($name)." CASCADE";
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 14b406a5c..754a755e4 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -43,11 +43,11 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
{
@@ -65,10 +65,10 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
if ($this->db_debug)
{
@@ -82,10 +82,10 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
if ($this->db_debug)
{
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index f4a9f821d..b69d3f049 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -363,7 +363,10 @@ class CI_Loader {
* Load Script
*
* This function loads the specified include file from the
- * application/scripts/ folder
+ * application/scripts/ folder.
+ *
+ * NOTE: This feature has been deprecated but it will remain available
+ * for legacy users.
*
* @access public
* @param array
@@ -496,7 +499,7 @@ class CI_Loader {
}
/*
- * Extract and cached variables
+ * Extract and cache variables
*
* You can either set variables using the dedicated $this->load_vars()
* function or via the second parameter of this function. We'll merge
diff --git a/system/libraries/Router.php b/system/libraries/Router.php
index d1751a0e9..d7740f5f3 100644
--- a/system/libraries/Router.php
+++ b/system/libraries/Router.php
@@ -149,12 +149,12 @@ class CI_Router {
return;
}
- $this->set_class($segments['0']);
+ $this->set_class($segments[0]);
- if (isset($segments['1']))
+ if (isset($segments[1]))
{
// A scaffolding request. No funny business with the URL
- if ($this->routes['scaffolding_trigger'] == $segments['1'] AND $segments['1'] != '_ci_scaffolding')
+ if ($this->routes['scaffolding_trigger'] == $segments[1] AND $segments[1] != '_ci_scaffolding')
{
$this->scaffolding_request = TRUE;
unset($this->routes['scaffolding_trigger']);
@@ -162,7 +162,7 @@ class CI_Router {
else
{
// A standard method request
- $this->set_method($segments['1']);
+ $this->set_method($segments[1]);
}
}
@@ -186,22 +186,22 @@ class CI_Router {
function _validate_segments($segments)
{
// Does the requested controller exist in the root folder?
- if (file_exists(APPPATH.'controllers/'.$segments['0'].EXT))
+ if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
{
return $segments;
}
// Is the controller in a sub-folder?
- if (is_dir(APPPATH.'controllers/'.$segments['0']))
+ if (is_dir(APPPATH.'controllers/'.$segments[0]))
{
// Set the directory and remove it from the segment array
- $this->set_directory($segments['0']);
+ $this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
if (count($segments) > 0)
{
// Does the requested controller exist in the sub-folder?
- if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments['0'].EXT))
+ if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
{
show_404();
}
@@ -250,7 +250,7 @@ class CI_Router {
{
$this->segments[$i++] = $val;
}
- unset($this->segments['0']);
+ unset($this->segments[0]);
if ($diff == FALSE)
{
@@ -263,7 +263,7 @@ class CI_Router {
{
$this->rsegments[$i++] = $val;
}
- unset($this->rsegments['0']);
+ unset($this->rsegments[0]);
}
}
// END _reindex_segments()
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index 153657e31..b65b9be52 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -519,13 +519,27 @@ class CI_Validation {
* Numeric
*
* @access public
- * @param string
+ * @param int
* @return bool
*/
function numeric($str)
{
return ( ! ereg("^[0-9\.]+$", $str)) ? FALSE : TRUE;
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Is Numeric
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
+ function is_numeric($str)
+ {
+ return ( ! is_numeric($str)) ? FALSE : TRUE;
+ }
// --------------------------------------------------------------------