summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Kriete <pascal@pascalkriete.com>2011-11-14 21:15:15 +0100
committerPascal Kriete <pascal@pascalkriete.com>2011-11-14 21:15:15 +0100
commitf525f10c850399700a4cce183aef55656ff44d31 (patch)
treed0250655551d773c9347573e594997e07d7280a5
parent44cdece942c310f5520497dbde4febc26e96c27e (diff)
parent917c3455cc70d5117daa7359f345a820154ada3e (diff)
Merge branch 'release/2.1.0'
Conflicts: user_guide/helpers/url_helper.html
-rw-r--r--application/config/database.php3
-rw-r--r--application/config/migration.php41
-rw-r--r--application/config/mimes.php6
-rwxr-xr-x[-rw-r--r--]system/core/Benchmark.php5
-rwxr-xr-x[-rw-r--r--]system/core/CodeIgniter.php40
-rw-r--r--system/core/Common.php30
-rwxr-xr-x[-rw-r--r--]system/core/Config.php29
-rw-r--r--system/core/Controller.php2
-rwxr-xr-x[-rw-r--r--]system/core/Exceptions.php17
-rwxr-xr-x[-rw-r--r--]system/core/Hooks.php15
-rwxr-xr-x[-rw-r--r--]system/core/Input.php75
-rwxr-xr-x[-rw-r--r--]system/core/Lang.php13
-rw-r--r--system/core/Loader.php136
-rwxr-xr-x[-rw-r--r--]system/core/Model.php1
-rwxr-xr-x[-rw-r--r--]system/core/Output.php61
-rwxr-xr-x[-rw-r--r--]system/core/Router.php59
-rwxr-xr-x[-rw-r--r--]system/core/Security.php208
-rwxr-xr-x[-rw-r--r--]system/core/URI.php31
-rwxr-xr-x[-rw-r--r--]system/database/DB.php4
-rw-r--r--system/database/DB_active_rec.php6
-rw-r--r--system/database/DB_cache.php2
-rw-r--r--system/database/DB_driver.php6
-rw-r--r--system/database/DB_forge.php2
-rw-r--r--system/database/DB_result.php46
-rw-r--r--system/database/DB_utility.php2
-rw-r--r--system/database/drivers/cubrid/cubrid_driver.php792
-rw-r--r--system/database/drivers/cubrid/cubrid_forge.php288
-rw-r--r--system/database/drivers/cubrid/cubrid_result.php202
-rw-r--r--system/database/drivers/cubrid/cubrid_utility.php108
-rw-r--r--system/database/drivers/cubrid/index.html10
-rw-r--r--system/database/drivers/mssql/mssql_driver.php1
-rw-r--r--system/database/drivers/mysql/mysql_driver.php14
-rw-r--r--system/database/drivers/mysql/mysql_result.php17
-rw-r--r--system/database/drivers/mysql/mysql_utility.php2
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php33
-rw-r--r--system/database/drivers/mysqli/mysqli_result.php19
-rw-r--r--system/database/drivers/oci8/oci8_driver.php161
-rw-r--r--system/database/drivers/oci8/oci8_result.php98
-rw-r--r--system/database/drivers/odbc/odbc_driver.php5
-rw-r--r--system/database/drivers/pdo/pdo_driver.php803
-rw-r--r--system/database/drivers/postgre/postgre_driver.php1
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php1
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php1
-rw-r--r--system/helpers/date_helper.php2
-rw-r--r--system/helpers/form_helper.php8
-rw-r--r--system/helpers/string_helper.php17
-rw-r--r--system/language/english/form_validation_lang.php1
-rw-r--r--system/language/english/migration_lang.php13
-rw-r--r--system/libraries/Cache/drivers/Cache_apc.php4
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php11
-rw-r--r--system/libraries/Cart.php8
-rw-r--r--system/libraries/Driver.php4
-rw-r--r--system/libraries/Email.php154
-rw-r--r--system/libraries/Form_validation.php119
-rw-r--r--system/libraries/Migration.php338
-rw-r--r--system/libraries/Pagination.php85
-rw-r--r--system/libraries/Session.php3
-rw-r--r--system/libraries/Upload.php66
-rw-r--r--system/libraries/User_agent.php2
-rw-r--r--system/libraries/Xmlrpc.php6
-rw-r--r--user_guide/changelog.html183
-rw-r--r--user_guide/database/active_record.html48
-rw-r--r--user_guide/database/caching.html2
-rw-r--r--user_guide/database/call_function.html2
-rw-r--r--user_guide/database/configuration.html6
-rw-r--r--user_guide/database/connecting.html2
-rw-r--r--user_guide/database/examples.html2
-rw-r--r--user_guide/database/fields.html2
-rw-r--r--user_guide/database/forge.html2
-rw-r--r--user_guide/database/helpers.html2
-rw-r--r--user_guide/database/index.html2
-rw-r--r--user_guide/database/queries.html2
-rw-r--r--user_guide/database/results.html4
-rw-r--r--user_guide/database/table_data.html2
-rw-r--r--user_guide/database/transactions.html2
-rw-r--r--user_guide/database/utilities.html2
-rw-r--r--user_guide/doc_style/index.html2
-rw-r--r--user_guide/general/alternative_php.html2
-rw-r--r--user_guide/general/ancillary_classes.html2
-rw-r--r--user_guide/general/autoloader.html2
-rw-r--r--user_guide/general/caching.html2
-rw-r--r--user_guide/general/cli.html4
-rw-r--r--user_guide/general/common_functions.html4
-rw-r--r--user_guide/general/controllers.html2
-rw-r--r--user_guide/general/core_classes.html2
-rw-r--r--user_guide/general/creating_drivers.html2
-rw-r--r--user_guide/general/creating_libraries.html2
-rw-r--r--user_guide/general/credits.html2
-rw-r--r--user_guide/general/drivers.html2
-rw-r--r--user_guide/general/environments.html2
-rw-r--r--user_guide/general/errors.html2
-rw-r--r--user_guide/general/helpers.html2
-rw-r--r--user_guide/general/hooks.html2
-rw-r--r--user_guide/general/libraries.html2
-rw-r--r--user_guide/general/managing_apps.html2
-rw-r--r--user_guide/general/models.html2
-rw-r--r--user_guide/general/profiling.html2
-rw-r--r--user_guide/general/quick_reference.html2
-rw-r--r--user_guide/general/requirements.html2
-rw-r--r--user_guide/general/reserved_names.html2
-rw-r--r--user_guide/general/routing.html2
-rw-r--r--user_guide/general/security.html2
-rw-r--r--user_guide/general/styleguide.html2
-rw-r--r--user_guide/general/urls.html2
-rw-r--r--user_guide/general/views.html2
-rw-r--r--user_guide/helpers/array_helper.html2
-rw-r--r--user_guide/helpers/captcha_helper.html2
-rw-r--r--user_guide/helpers/cookie_helper.html2
-rw-r--r--user_guide/helpers/date_helper.html2
-rw-r--r--user_guide/helpers/directory_helper.html2
-rw-r--r--user_guide/helpers/download_helper.html2
-rw-r--r--user_guide/helpers/email_helper.html2
-rw-r--r--user_guide/helpers/file_helper.html2
-rw-r--r--user_guide/helpers/form_helper.html2
-rw-r--r--user_guide/helpers/html_helper.html2
-rw-r--r--user_guide/helpers/inflector_helper.html2
-rw-r--r--user_guide/helpers/language_helper.html2
-rw-r--r--user_guide/helpers/number_helper.html2
-rw-r--r--user_guide/helpers/path_helper.html2
-rw-r--r--user_guide/helpers/security_helper.html2
-rw-r--r--user_guide/helpers/smiley_helper.html2
-rw-r--r--user_guide/helpers/string_helper.html13
-rw-r--r--user_guide/helpers/text_helper.html2
-rw-r--r--user_guide/helpers/typography_helper.html2
-rw-r--r--user_guide/helpers/url_helper.html2
-rw-r--r--user_guide/helpers/xml_helper.html2
-rw-r--r--user_guide/images/appflowchart.gifbin25276 -> 12363 bytes
-rw-r--r--user_guide/index.html3
-rw-r--r--user_guide/installation/downloads.html14
-rw-r--r--user_guide/installation/index.html2
-rw-r--r--user_guide/installation/troubleshooting.html2
-rw-r--r--user_guide/installation/upgrade_120.html2
-rw-r--r--user_guide/installation/upgrade_130.html2
-rw-r--r--user_guide/installation/upgrade_131.html2
-rw-r--r--user_guide/installation/upgrade_132.html2
-rw-r--r--user_guide/installation/upgrade_133.html2
-rw-r--r--user_guide/installation/upgrade_140.html2
-rw-r--r--user_guide/installation/upgrade_141.html2
-rw-r--r--user_guide/installation/upgrade_150.html2
-rw-r--r--user_guide/installation/upgrade_152.html2
-rw-r--r--user_guide/installation/upgrade_153.html2
-rw-r--r--user_guide/installation/upgrade_154.html2
-rw-r--r--user_guide/installation/upgrade_160.html2
-rw-r--r--user_guide/installation/upgrade_161.html2
-rw-r--r--user_guide/installation/upgrade_162.html2
-rw-r--r--user_guide/installation/upgrade_163.html2
-rw-r--r--user_guide/installation/upgrade_170.html2
-rw-r--r--user_guide/installation/upgrade_171.html2
-rw-r--r--user_guide/installation/upgrade_172.html2
-rw-r--r--user_guide/installation/upgrade_200.html2
-rw-r--r--user_guide/installation/upgrade_201.html2
-rw-r--r--user_guide/installation/upgrade_202.html2
-rw-r--r--user_guide/installation/upgrade_203.html2
-rw-r--r--user_guide/installation/upgrade_210.html89
-rw-r--r--user_guide/installation/upgrade_b11.html2
-rw-r--r--user_guide/installation/upgrading.html3
-rw-r--r--user_guide/libraries/benchmark.html2
-rw-r--r--user_guide/libraries/caching.html2
-rw-r--r--user_guide/libraries/calendar.html2
-rw-r--r--user_guide/libraries/cart.html22
-rw-r--r--user_guide/libraries/config.html2
-rw-r--r--user_guide/libraries/email.html2
-rw-r--r--user_guide/libraries/encryption.html2
-rw-r--r--user_guide/libraries/file_uploading.html2
-rw-r--r--user_guide/libraries/form_validation.html32
-rw-r--r--user_guide/libraries/ftp.html9
-rw-r--r--user_guide/libraries/image_lib.html2
-rw-r--r--user_guide/libraries/input.html20
-rw-r--r--user_guide/libraries/javascript.html2
-rw-r--r--user_guide/libraries/language.html2
-rw-r--r--user_guide/libraries/loader.html2
-rw-r--r--user_guide/libraries/migration.html176
-rw-r--r--user_guide/libraries/output.html2
-rw-r--r--user_guide/libraries/pagination.html8
-rw-r--r--user_guide/libraries/parser.html2
-rw-r--r--user_guide/libraries/security.html2
-rw-r--r--user_guide/libraries/sessions.html2
-rw-r--r--user_guide/libraries/table.html2
-rw-r--r--user_guide/libraries/trackback.html2
-rw-r--r--user_guide/libraries/typography.html2
-rw-r--r--user_guide/libraries/unit_testing.html2
-rw-r--r--user_guide/libraries/uri.html2
-rw-r--r--user_guide/libraries/user_agent.html2
-rw-r--r--user_guide/libraries/xmlrpc.html2
-rw-r--r--user_guide/libraries/zip.html2
-rw-r--r--user_guide/license.html2
-rw-r--r--user_guide/nav/nav.js12
-rw-r--r--user_guide/overview/appflow.html4
-rw-r--r--user_guide/overview/at_a_glance.html2
-rw-r--r--user_guide/overview/cheatsheets.html2
-rw-r--r--user_guide/overview/features.html2
-rw-r--r--user_guide/overview/getting_started.html2
-rw-r--r--user_guide/overview/goals.html2
-rw-r--r--user_guide/overview/index.html2
-rw-r--r--user_guide/overview/mvc.html2
-rw-r--r--user_guide/toc.html11
-rw-r--r--user_guide/tutorial/conclusion.html91
-rw-r--r--user_guide/tutorial/create_news_items.html179
-rw-r--r--user_guide/tutorial/hard_coded_pages.html158
-rw-r--r--user_guide/tutorial/index.html101
-rw-r--r--user_guide/tutorial/news_section.html230
-rw-r--r--user_guide/tutorial/static_pages.html206
202 files changed, 5366 insertions, 731 deletions
diff --git a/application/config/database.php b/application/config/database.php
index fa541a734..b4b34bf66 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -27,7 +27,8 @@
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
-| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7.
+| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
+| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
diff --git a/application/config/migration.php b/application/config/migration.php
new file mode 100644
index 000000000..afa264562
--- /dev/null
+++ b/application/config/migration.php
@@ -0,0 +1,41 @@
+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+/*
+|--------------------------------------------------------------------------
+| Enable/Disable Migrations
+|--------------------------------------------------------------------------
+|
+| Migrations are disabled by default but should be enabled
+| whenever you intend to do a schema migration.
+|
+*/
+$config['migration_enabled'] = FALSE;
+
+
+/*
+|--------------------------------------------------------------------------
+| Migrations version
+|--------------------------------------------------------------------------
+|
+| This is used to set migration version that the file system should be on.
+| If you run $this->migration->latest() this is the version that schema will
+| be upgraded / downgraded to.
+|
+*/
+$config['migration_version'] = 0;
+
+
+/*
+|--------------------------------------------------------------------------
+| Migrations Path
+|--------------------------------------------------------------------------
+|
+| Path to your migrations folder.
+| Typically, it will be within your application path.
+| Also, writing permission is required within the migrations path.
+|
+*/
+$config['migration_path'] = APPPATH . 'migrations/';
+
+
+/* End of file migration.php */
+/* Location: ./application/config/migration.php */ \ No newline at end of file
diff --git a/application/config/mimes.php b/application/config/mimes.php
index 82767d7c8..f00e5b6ed 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -65,8 +65,8 @@ $mimes = array( 'hqx' => 'application/mac-binhex40',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
- 'wav' => 'audio/x-wav',
- 'bmp' => 'image/bmp',
+ 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
+ 'bmp' => array('image/bmp', 'image/x-windows-bmp'),
'gif' => 'image/gif',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
@@ -103,4 +103,4 @@ $mimes = array( 'hqx' => 'application/mac-binhex40',
/* End of file mimes.php */
-/* Location: ./application/config/mimes.php */ \ No newline at end of file
+/* Location: ./application/config/mimes.php */
diff --git a/system/core/Benchmark.php b/system/core/Benchmark.php
index 515550e9f..a200727ab 100644..100755
--- a/system/core/Benchmark.php
+++ b/system/core/Benchmark.php
@@ -29,6 +29,11 @@
*/
class CI_Benchmark {
+ /**
+ * List of all benchmark markers and when they were added
+ *
+ * @var array
+ */
var $marker = array();
// --------------------------------------------------------------------
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 94fecb5c0..db1aee574 100644..100755
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -27,17 +27,19 @@
* @link http://codeigniter.com/user_guide/
*/
-/*
- * ------------------------------------------------------
- * Define the CodeIgniter Version
- * ------------------------------------------------------
+/**
+ * CodeIgniter Version
+ *
+ * @var string
+ *
*/
- define('CI_VERSION', '2.0.3');
+ define('CI_VERSION', '2.1.0');
-/*
- * ------------------------------------------------------
- * Define the CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
- * ------------------------------------------------------
+/**
+ * CodeIgniter Branch (Core = TRUE, Reactor = FALSE)
+ *
+ * @var boolean
+ *
*/
define('CI_CORE', FALSE);
@@ -267,7 +269,25 @@
OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
)
{
- show_404("{$class}/{$method}");
+ if ( ! empty($RTR->routes['404_override']))
+ {
+ $x = explode('/', $RTR->routes['404_override']);
+ $class = $x[0];
+ $method = (isset($x[1]) ? $x[1] : 'index');
+ if ( ! class_exists($class))
+ {
+ if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
+ {
+ show_404("{$class}/{$method}");
+ }
+
+ include_once(APPPATH.'controllers/'.$class.'.php');
+ }
+ }
+ else
+ {
+ show_404("{$class}/{$method}");
+ }
}
/*
diff --git a/system/core/Common.php b/system/core/Common.php
index db9fbeb9f..d79375475 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -132,9 +132,9 @@ if ( ! function_exists('load_class'))
$name = FALSE;
- // Look for the class first in the native system/libraries folder
- // thenin the local application/libraries folder
- foreach (array(BASEPATH, APPPATH) as $path)
+ // Look for the class first in the local application/libraries folder
+ // then in the native system/libraries folder
+ foreach (array(APPPATH, BASEPATH) as $path)
{
if (file_exists($path.$directory.'/'.$class.'.php'))
{
@@ -536,5 +536,29 @@ if ( ! function_exists('remove_invisible_characters'))
}
}
+// ------------------------------------------------------------------------
+
+/**
+* Returns HTML escaped variable
+*
+* @access public
+* @param mixed
+* @return mixed
+*/
+if ( ! function_exists('html_escape'))
+{
+ function html_escape($var)
+ {
+ if (is_array($var))
+ {
+ return array_map('html_escape', $var);
+ }
+ else
+ {
+ return htmlspecialchars($var, ENT_QUOTES, config_item('charset'));
+ }
+ }
+}
+
/* End of file Common.php */
/* Location: ./system/core/Common.php */ \ No newline at end of file
diff --git a/system/core/Config.php b/system/core/Config.php
index 0e6f10e07..714c4667b 100644..100755
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -28,8 +28,23 @@
*/
class CI_Config {
+ /**
+ * List of all loaded config values
+ *
+ * @var array
+ */
var $config = array();
+ /**
+ * List of all loaded config files
+ *
+ * @var array
+ */
var $is_loaded = array();
+ /**
+ * List of paths to search when trying to load a config file
+ *
+ * @var array
+ */
var $_config_paths = array(APPPATH);
/**
@@ -251,13 +266,13 @@ class CI_Config {
return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);
}
}
-
+
// -------------------------------------------------------------
-
+
/**
* Base URL
* Returns base_url [. uri_string]
- *
+ *
* @access public
* @param string $uri
* @return string
@@ -266,12 +281,12 @@ class CI_Config {
{
return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/');
}
-
+
// -------------------------------------------------------------
-
+
/**
* Build URI string for use in Config::site_url() and Config::base_url()
- *
+ *
* @access protected
* @param $uri
* @return string
@@ -305,7 +320,7 @@ class CI_Config {
}
// --------------------------------------------------------------------
-
+
/**
* System URL
*
diff --git a/system/core/Controller.php b/system/core/Controller.php
index ec86b7920..fddb81e19 100644
--- a/system/core/Controller.php
+++ b/system/core/Controller.php
@@ -48,7 +48,7 @@ class CI_Controller {
$this->load =& load_class('Loader', 'core');
- $this->load->set_base_classes()->ci_autoloader();
+ $this->load->initialize();
log_message('debug', "Controller Class Initialized");
}
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index bff86a92f..869739a5a 100644..100755
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -30,8 +30,21 @@ class CI_Exceptions {
var $message;
var $filename;
var $line;
+
+ /**
+ * Nesting level of the output buffering mechanism
+ *
+ * @var int
+ * @access public
+ */
var $ob_level;
+ /**
+ * List if available error levels
+ *
+ * @var array
+ * @access public
+ */
var $levels = array(
E_ERROR => 'Error',
E_WARNING => 'Warning',
@@ -84,7 +97,8 @@ class CI_Exceptions {
* 404 Page Not Found Handler
*
* @access private
- * @param string
+ * @param string the page
+ * @param bool log error yes/no
* @return string
*/
function show_404($page = '', $log_error = TRUE)
@@ -115,6 +129,7 @@ class CI_Exceptions {
* @param string the heading
* @param string the message
* @param string the template name
+ * @param int the status code
* @return string
*/
function show_error($heading, $message, $template = 'error_general', $status_code = 500)
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index fd6380f0a..33f1c034c 100644..100755
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -28,8 +28,23 @@
*/
class CI_Hooks {
+ /**
+ * Determines wether hooks are enabled
+ *
+ * @var bool
+ */
var $enabled = FALSE;
+ /**
+ * List of all hooks set in config/hooks.php
+ *
+ * @var array
+ */
var $hooks = array();
+ /**
+ * Determines wether hook is in progress, used to prevent infinte loops
+ *
+ * @var bool
+ */
var $in_progress = FALSE;
/**
diff --git a/system/core/Input.php b/system/core/Input.php
index cfbef942d..9bfb5f1fb 100644..100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -28,15 +28,51 @@
*/
class CI_Input {
+ /**
+ * IP address of the current user
+ *
+ * @var string
+ */
var $ip_address = FALSE;
+ /**
+ * user agent (web browser) being used by the current user
+ *
+ * @var string
+ */
var $user_agent = FALSE;
+ /**
+ * If FALSE, then $_GET will be set to an empty array
+ *
+ * @var bool
+ */
var $_allow_get_array = TRUE;
+ /**
+ * If TRUE, then newlines are standardized
+ *
+ * @var bool
+ */
var $_standardize_newlines = TRUE;
- var $_enable_xss = FALSE; // Set automatically based on config setting
- var $_enable_csrf = FALSE; // Set automatically based on config setting
-
+ /**
+ * Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered
+ * Set automatically based on config setting
+ *
+ * @var bool
+ */
+ var $_enable_xss = FALSE;
+ /**
+ * Enables a CSRF cookie token to be set.
+ * Set automatically based on config setting
+ *
+ * @var bool
+ */
+ var $_enable_csrf = FALSE;
+ /**
+ * List of all HTTP request headers
+ *
+ * @var array
+ */
protected $headers = array();
-
+
/**
* Constructor
@@ -147,7 +183,7 @@ class CI_Input {
}
return $post;
}
-
+
return $this->_fetch_from_array($_POST, $index, $xss_clean);
}
@@ -402,9 +438,9 @@ class CI_Input {
function _sanitize_globals()
{
// It would be "wrong" to unset any of these GLOBALS.
- $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
+ $protected = array('_SERVER', '_GET', '_POST', '_FILES', '_REQUEST',
'_SESSION', '_ENV', 'GLOBALS', 'HTTP_RAW_POST_DATA',
- 'system_folder', 'application_folder', 'BM', 'EXT',
+ 'system_folder', 'application_folder', 'BM', 'EXT',
'CFG', 'URI', 'RTR', 'OUT', 'IN');
// Unset globals for securiy.
@@ -512,8 +548,12 @@ class CI_Input {
return $new_array;
}
- // We strip slashes if magic quotes is on to keep things consistent
- if (function_exists('get_magic_quotes_gpc') AND get_magic_quotes_gpc())
+ /* We strip slashes if magic quotes is on to keep things consistent
+
+ NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
+ it will probably not exist in future versions at all.
+ */
+ if ( ! is_php('5.4') && get_magic_quotes_gpc())
{
$str = stripslashes($str);
}
@@ -523,7 +563,7 @@ class CI_Input {
{
$str = $this->uni->clean_string($str);
}
-
+
// Remove control characters
$str = remove_invisible_characters($str);
@@ -579,9 +619,11 @@ class CI_Input {
/**
* Request Headers
*
- * In Apache, you can simply call apache_request_headers(), however for
+ * In Apache, you can simply call apache_request_headers(), however for
* people running other webservers the function is undefined.
*
+ * @param bool XSS cleaning
+ *
* @return array
*/
public function request_headers($xss_clean = FALSE)
@@ -609,10 +651,10 @@ class CI_Input {
{
$key = str_replace('_', ' ', strtolower($key));
$key = str_replace(' ', '-', ucwords($key));
-
+
$this->headers[$key] = $val;
}
-
+
return $this->headers;
}
@@ -633,7 +675,7 @@ class CI_Input {
{
$this->request_headers();
}
-
+
if ( ! isset($this->headers[$index]))
{
return FALSE;
@@ -644,7 +686,7 @@ class CI_Input {
return $this->security->xss_clean($this->headers[$index]);
}
- return $this->headers[$index];
+ return $this->headers[$index];
}
// --------------------------------------------------------------------
@@ -676,7 +718,6 @@ class CI_Input {
}
}
-// END Input class
/* End of file Input.php */
-/* Location: ./system/core/Input.php */
+/* Location: ./system/core/Input.php */ \ No newline at end of file
diff --git a/system/core/Lang.php b/system/core/Lang.php
index 170e6c725..5ac671838 100644..100755
--- a/system/core/Lang.php
+++ b/system/core/Lang.php
@@ -26,7 +26,17 @@
*/
class CI_Lang {
+ /**
+ * List of translations
+ *
+ * @var array
+ */
var $language = array();
+ /**
+ * List of loaded language files
+ *
+ * @var array
+ */
var $is_loaded = array();
/**
@@ -47,6 +57,9 @@ class CI_Lang {
* @access public
* @param mixed the name of the language file to be loaded. Can be an array
* @param string the language (english, etc.)
+ * @param bool return loaded array of translations
+ * @param bool add suffix to $langfile
+ * @param string alternative path to look for language file
* @return mixed
*/
function load($langfile = '', $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 7c8b298ac..6b7ee0c28 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -29,18 +29,91 @@
class CI_Loader {
// All these are set automatically. Don't mess with them.
+ /**
+ * Nesting level of the output buffering mechanism
+ *
+ * @var int
+ * @access protected
+ */
protected $_ci_ob_level;
+ /**
+ * List of paths to load views from
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_view_paths = array();
+ /**
+ * List of paths to load libraries from
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_library_paths = array();
+ /**
+ * List of paths to load models from
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_model_paths = array();
+ /**
+ * List of paths to load helpers from
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_helper_paths = array();
+ /**
+ * List of loaded base classes
+ * Set by the controller class
+ *
+ * @var array
+ * @access protected
+ */
protected $_base_classes = array(); // Set by the controller class
+ /**
+ * List of cached variables
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_cached_vars = array();
+ /**
+ * List of loaded classes
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_classes = array();
+ /**
+ * List of loaded files
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_loaded_files = array();
+ /**
+ * List of loaded models
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_models = array();
+ /**
+ * List of loaded helpers
+ *
+ * @var array
+ * @access protected
+ */
protected $_ci_helpers = array();
- protected $_ci_varmap = array('unit_test' => 'unit',
+ /**
+ * List of class name mappings
+ *
+ * @var array
+ * @access protected
+ */
+ protected $_ci_varmap = array('unit_test' => 'unit',
'user_agent' => 'agent');
/**
@@ -55,24 +128,29 @@ class CI_Loader {
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
$this->_ci_view_paths = array(APPPATH.'views/' => TRUE);
-
+
log_message('debug', "Loader Class Initialized");
}
// --------------------------------------------------------------------
-
+
/**
- * Set _base_classes variable
+ * Initialize the Loader
*
* This method is called once in CI_Controller.
*
- * @param array
+ * @param array
* @return object
*/
- public function set_base_classes()
+ public function initialize()
{
+ $this->_ci_classes = array();
+ $this->_ci_loaded_files = array();
+ $this->_ci_models = array();
$this->_base_classes =& is_loaded();
-
+
+ $this->_ci_autoloader();
+
return $this;
}
@@ -96,7 +174,7 @@ class CI_Loader {
{
return $this->_ci_classes[$class];
}
-
+
return FALSE;
}
@@ -366,6 +444,7 @@ class CI_Loader {
* the controller class and its "view" files.
*
* @param array
+ * @param string
* @return void
*/
public function vars($vars = array(), $val = '')
@@ -507,6 +586,8 @@ class CI_Loader {
* Loads a config file
*
* @param string
+ * @param bool
+ * @param bool
* @return void
*/
public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
@@ -535,6 +616,11 @@ class CI_Loader {
require BASEPATH.'libraries/Driver.php';
}
+ if ($library == '')
+ {
+ return FALSE;
+ }
+
// We can save the loader some time since Drivers will *always* be in a subfolder,
// and typically identically named to the library
if ( ! strpos($library, '/'))
@@ -553,13 +639,13 @@ class CI_Loader {
* Prepends a parent path to the library, model, helper, and config path arrays
*
* @param string
- * @param boolean
+ * @param boolean
* @return void
*/
public function add_package_path($path, $view_cascade=TRUE)
{
$path = rtrim($path, '/').'/';
-
+
array_unshift($this->_ci_library_paths, $path);
array_unshift($this->_ci_model_paths, $path);
array_unshift($this->_ci_helper_paths, $path);
@@ -595,6 +681,7 @@ class CI_Loader {
* If no path is provided, the most recently added path is removed.
*
* @param type
+ * @param bool
* @return type
*/
public function remove_package_path($path = '', $remove_config_path = TRUE)
@@ -619,7 +706,7 @@ class CI_Loader {
unset($this->{$var}[$key]);
}
}
-
+
if (isset($this->_ci_view_paths[$path.'views/']))
{
unset($this->_ci_view_paths[$path.'views/']);
@@ -658,7 +745,7 @@ class CI_Loader {
{
$$_ci_val = ( ! isset($_ci_data[$_ci_val])) ? FALSE : $_ci_data[$_ci_val];
}
-
+
$file_exists = FALSE;
// Set the path to the requested file
@@ -680,11 +767,11 @@ class CI_Loader {
$file_exists = TRUE;
break;
}
-
+
if ( ! $cascade)
{
break;
- }
+ }
}
}
@@ -913,6 +1000,7 @@ class CI_Loader {
*
* @param string
* @param string
+ * @param bool
* @param string an optional object name
* @return null
*/
@@ -935,22 +1023,22 @@ class CI_Loader {
// first, global next
if (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'))
{
- include_once($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
+ include($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
break;
}
elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
{
- include_once($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
+ include($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
break;
}
elseif (file_exists($path .'config/'.strtolower($class).'.php'))
{
- include_once($path .'config/'.strtolower($class).'.php');
+ include($path .'config/'.strtolower($class).'.php');
break;
}
elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php'))
{
- include_once($path .'config/'.ucfirst(strtolower($class)).'.php');
+ include($path .'config/'.ucfirst(strtolower($class)).'.php');
break;
}
}
@@ -1020,23 +1108,19 @@ class CI_Loader {
* The config/autoload.php file contains an array that permits sub-systems,
* libraries, and helpers to be loaded automatically.
*
- * This function is public, as it's used in the CI_Controller class.
- * However, there is no reason you should ever needs to use it.
- *
* @param array
* @return void
*/
- public function ci_autoloader()
+ private function _ci_autoloader()
{
if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'))
{
- include_once(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
+ include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php');
}
else
{
- include_once(APPPATH.'config/autoload.php');
+ include(APPPATH.'config/autoload.php');
}
-
if ( ! isset($autoload))
{
@@ -1122,6 +1206,7 @@ class CI_Loader {
/**
* Get a reference to a specific library or model
*
+ * @param string
* @return bool
*/
protected function &_ci_get_component($component)
@@ -1138,6 +1223,7 @@ class CI_Loader {
* This function preps the name of various items to make loading them more reliable.
*
* @param mixed
+ * @param string
* @return array
*/
protected function _ci_prep_filename($filename, $extension)
diff --git a/system/core/Model.php b/system/core/Model.php
index 8566a0b66..e15ffbebc 100644..100755
--- a/system/core/Model.php
+++ b/system/core/Model.php
@@ -42,6 +42,7 @@ class CI_Model {
* Allows models to access CI's loaded classes using the same
* syntax as controllers.
*
+ * @param string
* @access private
*/
function __get($key)
diff --git a/system/core/Output.php b/system/core/Output.php
index 05ace919c..ccecafd2b 100644..100755
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -28,15 +28,67 @@
*/
class CI_Output {
+ /**
+ * Current output string
+ *
+ * @var string
+ * @access protected
+ */
protected $final_output;
+ /**
+ * Cache expiration time
+ *
+ * @var int
+ * @access protected
+ */
protected $cache_expiration = 0;
+ /**
+ * List of server headers
+ *
+ * @var array
+ * @access protected
+ */
protected $headers = array();
- protected $mime_types = array();
+ /**
+ * List of mime types
+ *
+ * @var array
+ * @access protected
+ */
+ protected $mime_types = array();
+ /**
+ * Determines wether profiler is enabled
+ *
+ * @var book
+ * @access protected
+ */
protected $enable_profiler = FALSE;
+ /**
+ * Determines if output compression is enabled
+ *
+ * @var bool
+ * @access protected
+ */
protected $_zlib_oc = FALSE;
+ /**
+ * List of profiler sections
+ *
+ * @var array
+ * @access protected
+ */
protected $_profiler_sections = array();
- protected $parse_exec_vars = TRUE; // whether or not to parse variables like {elapsed_time} and {memory_usage}
+ /**
+ * Whether or not to parse variables like {elapsed_time} and {memory_usage}
+ *
+ * @var bool
+ * @access protected
+ */
+ protected $parse_exec_vars = TRUE;
+ /**
+ * Constructor
+ *
+ */
function __construct()
{
$this->_zlib_oc = @ini_get('zlib.output_compression');
@@ -127,6 +179,7 @@ class CI_Output {
*
* @access public
* @param string
+ * @param bool
* @return void
*/
function set_header($header, $replace = TRUE)
@@ -265,6 +318,7 @@ class CI_Output {
* benchmark timer so the page rendering speed and memory usage can be shown.
*
* @access public
+ * @param string
* @return mixed
*/
function _display($output = '')
@@ -401,6 +455,7 @@ class CI_Output {
* Write a Cache File
*
* @access public
+ * @param string
* @return void
*/
function _write_cache($output)
@@ -452,6 +507,8 @@ class CI_Output {
* Update/serve a cached file
*
* @access public
+ * @param object config class
+ * @param object uri class
* @return void
*/
function _display_cache(&$CFG, &$URI)
diff --git a/system/core/Router.php b/system/core/Router.php
index 5e92a04b1..6da667472 100644..100755
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -28,12 +28,54 @@
*/
class CI_Router {
+ /**
+ * Config class
+ *
+ * @var object
+ * @access public
+ */
var $config;
+ /**
+ * List of routes
+ *
+ * @var array
+ * @access public
+ */
var $routes = array();
+ /**
+ * List of error routes
+ *
+ * @var array
+ * @access public
+ */
var $error_routes = array();
+ /**
+ * Current class name
+ *
+ * @var string
+ * @access public
+ */
var $class = '';
+ /**
+ * Current method name
+ *
+ * @var string
+ * @access public
+ */
var $method = 'index';
+ /**
+ * Sub-directory that contains the requested controller class
+ *
+ * @var string
+ * @access public
+ */
var $directory = '';
+ /**
+ * Default controller (and method if specific)
+ *
+ * @var string
+ * @access public
+ */
var $default_controller;
/**
@@ -95,7 +137,7 @@ class CI_Router {
{
include(APPPATH.'config/routes.php');
}
-
+
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;
unset($route);
@@ -244,7 +286,20 @@ class CI_Router {
// Does the requested controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].'.php'))
{
- show_404($this->fetch_directory().$segments[0]);
+ if ( ! empty($this->routes['404_override']))
+ {
+ $x = explode('/', $this->routes['404_override']);
+
+ $this->set_directory('');
+ $this->set_class($x[0]);
+ $this->set_method(isset($x[1]) ? $x[1] : 'index');
+
+ return $x;
+ }
+ else
+ {
+ show_404($this->fetch_directory().$segments[0]);
+ }
}
}
else
diff --git a/system/core/Security.php b/system/core/Security.php
index 3617cadcc..a3e227437 100644..100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -25,14 +25,49 @@
* @link http://codeigniter.com/user_guide/libraries/security.html
*/
class CI_Security {
-
+
+ /**
+ * Random Hash for protecting URLs
+ *
+ * @var string
+ * @access protected
+ */
protected $_xss_hash = '';
+ /**
+ * Random Hash for Cross Site Request Forgery Protection Cookie
+ *
+ * @var string
+ * @access protected
+ */
protected $_csrf_hash = '';
- protected $_csrf_expire = 7200; // Two hours (in seconds)
+ /**
+ * Expiration time for Cross Site Request Forgery Protection Cookie
+ * Defaults to two hours (in seconds)
+ *
+ * @var int
+ * @access protected
+ */
+ protected $_csrf_expire = 7200;
+ /**
+ * Token name for Cross Site Request Forgery Protection Cookie
+ *
+ * @var string
+ * @access protected
+ */
protected $_csrf_token_name = 'ci_csrf_token';
+ /**
+ * Cookie name for Cross Site Request Forgery Protection Cookie
+ *
+ * @var string
+ * @access protected
+ */
protected $_csrf_cookie_name = 'ci_csrf_token';
-
- /* never allowed, string replacement */
+ /**
+ * List of never allowed strings
+ *
+ * @var array
+ * @access protected
+ */
protected $_never_allowed_str = array(
'document.cookie' => '[removed]',
'document.write' => '[removed]',
@@ -42,17 +77,24 @@ class CI_Security {
'-moz-binding' => '[removed]',
'<!--' => '&lt;!--',
'-->' => '--&gt;',
- '<![CDATA[' => '&lt;![CDATA['
+ '<![CDATA[' => '&lt;![CDATA[',
+ '<comment>' => '&lt;comment&gt;'
);
/* never allowed, regex replacement */
+ /**
+ * List of never allowed regex replacement
+ *
+ * @var array
+ * @access protected
+ */
protected $_never_allowed_regex = array(
"javascript\s*:" => '[removed]',
"expression\s*(\(|&\#40;)" => '[removed]', // CSS and IE
"vbscript\s*:" => '[removed]', // IE, surprise!
"Redirect\s+302" => '[removed]'
);
-
+
/**
* Constructor
*/
@@ -95,7 +137,7 @@ class CI_Security {
}
// Do the tokens exist in both the _POST and _COOKIE arrays?
- if ( ! isset($_POST[$this->_csrf_token_name]) OR
+ if ( ! isset($_POST[$this->_csrf_token_name]) OR
! isset($_COOKIE[$this->_csrf_cookie_name]))
{
$this->csrf_show_error();
@@ -107,7 +149,7 @@ class CI_Security {
$this->csrf_show_error();
}
- // We kill this since we're done and we don't want to
+ // We kill this since we're done and we don't want to
// polute the _POST array
unset($_POST[$this->_csrf_token_name]);
@@ -117,7 +159,7 @@ class CI_Security {
$this->csrf_set_cookie();
log_message('debug', "CSRF token verified ");
-
+
return $this;
}
@@ -146,7 +188,7 @@ class CI_Security {
setcookie($this->_csrf_cookie_name, $this->_csrf_hash, $expire, config_item('cookie_path'), config_item('cookie_domain'), $secure_cookie);
log_message('debug', "CRSF cookie Set");
-
+
return $this;
}
@@ -165,9 +207,9 @@ class CI_Security {
// --------------------------------------------------------------------
/**
- * Get CSRF Hash
+ * Get CSRF Hash
*
- * Getter Method
+ * Getter Method
*
* @return string self::_csrf_hash
*/
@@ -215,6 +257,7 @@ class CI_Security {
* http://ha.ckers.org/xss.html
*
* @param mixed string or array
+ * @param bool
* @return string
*/
public function xss_clean($str, $is_image = FALSE)
@@ -263,7 +306,7 @@ class CI_Security {
*/
$str = preg_replace_callback("/[a-z]+=([\'\"]).*?\\1/si", array($this, '_convert_attribute'), $str);
-
+
$str = preg_replace_callback("/<\w+.*?(?=>|<|$)/si", array($this, '_decode_entity'), $str);
/*
@@ -276,7 +319,7 @@ class CI_Security {
*
* This prevents strings like this: ja vascript
* NOTE: we deal with spaces between characters later.
- * NOTE: preg_replace was found to be amazingly slow here on
+ * NOTE: preg_replace was found to be amazingly slow here on
* large blocks of data, so we use str_replace.
*/
@@ -304,8 +347,8 @@ class CI_Security {
*/
if ($is_image === TRUE)
{
- // Images have a tendency to have the PHP short opening and
- // closing tags every so often so we skip those and only
+ // Images have a tendency to have the PHP short opening and
+ // closing tags every so often so we skip those and only
// do the long opening tags.
$str = preg_replace('/<\?(php)/i', "&lt;?\\1", $str);
}
@@ -321,10 +364,10 @@ class CI_Security {
* These words are compacted back to their correct state.
*/
$words = array(
- 'javascript', 'expression', 'vbscript', 'script',
+ 'javascript', 'expression', 'vbscript', 'script',
'applet', 'alert', 'document', 'write', 'cookie', 'window'
);
-
+
foreach ($words as $word)
{
$temp = '';
@@ -341,8 +384,8 @@ class CI_Security {
/*
* Remove disallowed Javascript in links or img tags
- * We used to do some version comparisons and use of stripos for PHP5,
- * but it is dog slow compared to these simplified non-capturing
+ * We used to do some version comparisons and use of stripos for PHP5,
+ * but it is dog slow compared to these simplified non-capturing
* preg_match(), especially if the pattern exists in the string
*/
do
@@ -405,11 +448,11 @@ class CI_Security {
/*
* Images are Handled in a Special Way
- * - Essentially, we want to know that after all of the character
- * conversion is done whether any unwanted, likely XSS, code was found.
+ * - Essentially, we want to know that after all of the character
+ * conversion is done whether any unwanted, likely XSS, code was found.
* If not, we return TRUE, as the image is clean.
- * However, if the string post-conversion does not matched the
- * string post-removal of XSS, then it fails, as there was unwanted XSS
+ * However, if the string post-conversion does not matched the
+ * string post-removal of XSS, then it fails, as there was unwanted XSS
* code found and removed/changed during processing.
*/
@@ -433,15 +476,7 @@ class CI_Security {
{
if ($this->_xss_hash == '')
{
- if (phpversion() >= 4.2)
- {
- mt_srand();
- }
- else
- {
- mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff);
- }
-
+ mt_srand();
$this->_xss_hash = md5(time() + mt_rand(0, 1999999999));
}
@@ -455,14 +490,11 @@ class CI_Security {
*
* This function is a replacement for html_entity_decode()
*
- * In some versions of PHP the native function does not work
- * when UTF-8 is the specified character set, so this gives us
- * a work-around. More info here:
- * http://bugs.php.net/bug.php?id=25670
- *
- * NOTE: html_entity_decode() has a bug in some PHP versions when UTF-8 is the
- * character set, and the PHP developers said they were not back porting the
- * fix to versions other than PHP 5.x.
+ * The reason we are not using html_entity_decode() by itself is because
+ * while it is not technically correct to leave out the semicolon
+ * at the end of an entity most browsers will still interpret the entity
+ * correctly. html_entity_decode() does not convert entities without
+ * semicolons, so we are left with our own little solution here. Bummer.
*
* @param string
* @param string
@@ -470,33 +502,14 @@ class CI_Security {
*/
public function entity_decode($str, $charset='UTF-8')
{
- if (stristr($str, '&') === FALSE) return $str;
-
- // The reason we are not using html_entity_decode() by itself is because
- // while it is not technically correct to leave out the semicolon
- // at the end of an entity most browsers will still interpret the entity
- // correctly. html_entity_decode() does not convert entities without
- // semicolons, so we are left with our own little solution here. Bummer.
-
- if (function_exists('html_entity_decode') &&
- (strtolower($charset) != 'utf-8'))
- {
- $str = html_entity_decode($str, ENT_COMPAT, $charset);
- $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
- return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
- }
-
- // Numeric Entities
- $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
- $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);
-
- // Literal Entities - Slightly slow so we do another check
if (stristr($str, '&') === FALSE)
{
- $str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES)));
+ return $str;
}
- return $str;
+ $str = html_entity_decode($str, ENT_COMPAT, $charset);
+ $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
+ return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
}
// --------------------------------------------------------------------
@@ -505,6 +518,7 @@ class CI_Security {
* Filename Security
*
* @param string
+ * @param bool
* @return string
*/
public function sanitize_filename($str, $relative_path = FALSE)
@@ -542,7 +556,7 @@ class CI_Security {
"%3b", // ;
"%3d" // =
);
-
+
if ( ! $relative_path)
{
$bad[] = './';
@@ -570,7 +584,7 @@ class CI_Security {
}
// --------------------------------------------------------------------
-
+
/*
* Remove Evil HTML Attributes (like evenhandlers and style)
*
@@ -578,7 +592,7 @@ class CI_Security {
* - Everything up until a space
* For example, everything between the pipes:
* <a |style=document.write('hello');alert('world');| class=link>
- * - Everything inside the quotes
+ * - Everything inside the quotes
* For example, everything between the pipes:
* <a |style="document.write('hello'); alert('world');"| class="link">
*
@@ -589,7 +603,7 @@ class CI_Security {
protected function _remove_evil_attributes($str, $is_image)
{
// All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns
- $evil_attributes = array('on\w*', 'style', 'xmlns');
+ $evil_attributes = array('on\w*', 'style', 'xmlns', 'formaction');
if ($is_image === TRUE)
{
@@ -601,16 +615,36 @@ class CI_Security {
}
do {
- $str = preg_replace(
- "#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i",
- "<$1$6",
- $str, -1, $count
- );
+ $count = 0;
+ $attribs = array();
+
+ // find occurrences of illegal attribute strings without quotes
+ preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*([^\s]*)/is", $str, $matches, PREG_SET_ORDER);
+
+ foreach ($matches as $attr)
+ {
+ $attribs[] = preg_quote($attr[0], '/');
+ }
+
+ // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes)
+ preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER);
+
+ foreach ($matches as $attr)
+ {
+ $attribs[] = preg_quote($attr[0], '/');
+ }
+
+ // replace illegal attribute strings that are inside an html tag
+ if (count($attribs) > 0)
+ {
+ $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z\-])(".implode('|', $attribs).")([\s><])([><]*)/i", '<$1$2$4$5', $str, -1, $count);
+ }
+
} while ($count);
return $str;
}
-
+
// --------------------------------------------------------------------
/**
@@ -627,7 +661,7 @@ class CI_Security {
$str = '&lt;'.$matches[1].$matches[2].$matches[3];
// encode captured opening or closing brace to prevent recursive vectors
- $str .= str_replace(array('>', '<'), array('&gt;', '&lt;'),
+ $str .= str_replace(array('>', '<'), array('&gt;', '&lt;'),
$matches[4]);
return $str;
@@ -649,7 +683,7 @@ class CI_Security {
protected function _js_link_removal($match)
{
$attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
-
+
return str_replace($match[1], preg_replace("#href=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
}
@@ -669,7 +703,7 @@ class CI_Security {
protected function _js_img_removal($match)
{
$attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match[1]));
-
+
return str_replace($match[1], preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match[0]);
}
@@ -729,13 +763,13 @@ class CI_Security {
}
// --------------------------------------------------------------------
-
+
/**
* Validate URL entities
*
* Called by xss_clean()
*
- * @param string
+ * @param string
* @return string
*/
protected function _validate_entities($str)
@@ -743,9 +777,9 @@ class CI_Security {
/*
* Protect GET variables in URLs
*/
-
+
// 901119URL5918AMP18930PROTECT8198
-
+
$str = preg_replace('|\&([a-z\_0-9\-]+)\=([a-z\_0-9\-]+)|i', $this->xss_hash()."\\1=\\2", $str);
/*
@@ -769,7 +803,7 @@ class CI_Security {
* Un-Protect GET variables in URLs
*/
$str = str_replace($this->xss_hash(), '&', $str);
-
+
return $str;
}
@@ -794,7 +828,7 @@ class CI_Security {
{
$str = preg_replace("#".$key."#i", $val, $str);
}
-
+
return $str;
}
@@ -809,16 +843,16 @@ class CI_Security {
{
if ($this->_csrf_hash == '')
{
- // If the cookie exists we will use it's value.
+ // If the cookie exists we will use it's value.
// We don't necessarily want to regenerate it with
- // each page load since a page could contain embedded
+ // each page load since a page could contain embedded
// sub-pages causing this feature to fail
- if (isset($_COOKIE[$this->_csrf_cookie_name]) &&
+ if (isset($_COOKIE[$this->_csrf_cookie_name]) &&
$_COOKIE[$this->_csrf_cookie_name] != '')
{
return $this->_csrf_hash = $_COOKIE[$this->_csrf_cookie_name];
}
-
+
return $this->_csrf_hash = md5(uniqid(rand(), TRUE));
}
diff --git a/system/core/URI.php b/system/core/URI.php
index 20f0f006b..a3ae20cc3 100644..100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -28,9 +28,34 @@
*/
class CI_URI {
+ /**
+ * List of cached uri segments
+ *
+ * @var array
+ * @access public
+ */
var $keyval = array();
+ /**
+ * Current uri string
+ *
+ * @var string
+ * @access public
+ */
var $uri_string;
+ /**
+ * List of uri segments
+ *
+ * @var array
+ * @access public
+ */
var $segments = array();
+ /**
+ * Re-indexed list of uri segments
+ * Starts at 1 instead of 0
+ *
+ * @var array
+ * @access public
+ */
var $rsegments = array();
/**
@@ -127,6 +152,7 @@ class CI_URI {
* Set the URI String
*
* @access public
+ * @param string
* @return string
*/
function _set_uri_string($str)
@@ -366,6 +392,11 @@ class CI_URI {
/**
* Identical to above only it uses the re-routed segment array
*
+ * @access public
+ * @param integer the starting segment number
+ * @param array an array of default values
+ * @return array
+ *
*/
function ruri_to_assoc($n = 3, $default = array())
{
diff --git a/system/database/DB.php b/system/database/DB.php
index 33207d885..8314d3b97 100644..100755
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -21,6 +21,8 @@
* @category Database
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/database/
+ * @param string
+ * @param bool Determines if active record should be used or not
*/
function &DB($params = '', $active_record_override = NULL)
{
@@ -35,7 +37,7 @@ function &DB($params = '', $active_record_override = NULL)
show_error('The configuration file database.php does not exist.');
}
}
-
+
include($file_path);
if ( ! isset($db) OR count($db) == 0)
diff --git a/system/database/DB_active_rec.php b/system/database/DB_active_rec.php
index 2af3553ed..7bab729f5 100644
--- a/system/database/DB_active_rec.php
+++ b/system/database/DB_active_rec.php
@@ -870,11 +870,11 @@ class CI_DB_active_record extends CI_DB_driver {
*/
public function limit($value, $offset = '')
{
- $this->ar_limit = $value;
+ $this->ar_limit = (int) $value;
if ($offset != '')
{
- $this->ar_offset = $offset;
+ $this->ar_offset = (int) $offset;
}
return $this;
@@ -1322,7 +1322,7 @@ class CI_DB_active_record extends CI_DB_driver {
{
if ($this->db_debug)
{
- return $this->display_error('db_myst_use_index');
+ return $this->display_error('db_must_use_index');
}
return FALSE;
diff --git a/system/database/DB_cache.php b/system/database/DB_cache.php
index 3bf065ca5..ad1c28d72 100644
--- a/system/database/DB_cache.php
+++ b/system/database/DB_cache.php
@@ -33,7 +33,7 @@ class CI_DB_Cache {
* Grabs the CI super object instance so we can access it.
*
*/
- function CI_DB_Cache(&$db)
+ function __construct(&$db)
{
// Assign the main CI object to $this->CI
// and load the file helper since we use it a lot
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 10e8ed0c0..3680b85c2 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -78,7 +78,7 @@ class CI_DB_driver {
*
* @param array
*/
- function CI_DB_driver($params)
+ function __construct($params)
{
if (is_array($params))
{
@@ -218,7 +218,7 @@ class CI_DB_driver {
// Some DBs have functions that return the version, and don't run special
// SQL queries per se. In these instances, just return the result.
- $driver_version_exceptions = array('oci8', 'sqlite');
+ $driver_version_exceptions = array('oci8', 'sqlite', 'cubrid');
if (in_array($this->dbdriver, $driver_version_exceptions))
{
@@ -1387,4 +1387,4 @@ class CI_DB_driver {
/* End of file DB_driver.php */
-/* Location: ./system/database/DB_driver.php */ \ No newline at end of file
+/* Location: ./system/database/DB_driver.php */
diff --git a/system/database/DB_forge.php b/system/database/DB_forge.php
index 0dd29c238..6bc40411b 100644
--- a/system/database/DB_forge.php
+++ b/system/database/DB_forge.php
@@ -35,7 +35,7 @@ class CI_DB_forge {
* Grabs the CI super object instance so we can access it.
*
*/
- function CI_DB_forge()
+ function __construct()
{
// Assign the main database object to $this->db
$CI =& get_instance();
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 0c4e78105..48d66c8e4 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -45,7 +45,7 @@ class CI_DB_result {
* @param string can be "object" or "array"
* @return mixed either a result object or array
*/
- function result($type = 'object')
+ public function result($type = 'object')
{
if ($type == 'array') return $this->result_array();
else if ($type == 'object') return $this->result_object();
@@ -60,7 +60,7 @@ class CI_DB_result {
* @param class_name A string that represents the type of object you want back
* @return array of objects
*/
- function custom_result_object($class_name)
+ public function custom_result_object($class_name)
{
if (array_key_exists($class_name, $this->custom_result_object))
{
@@ -79,12 +79,12 @@ class CI_DB_result {
while ($row = $this->_fetch_object())
{
$object = new $class_name();
-
+
foreach ($row as $key => $value)
{
$object->$key = $value;
}
-
+
$result_object[] = $object;
}
@@ -100,7 +100,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function result_object()
+ public function result_object()
{
if (count($this->result_object) > 0)
{
@@ -132,7 +132,7 @@ class CI_DB_result {
* @access public
* @return array
*/
- function result_array()
+ public function result_array()
{
if (count($this->result_array) > 0)
{
@@ -166,7 +166,7 @@ class CI_DB_result {
* @param string can be "object" or "array"
* @return mixed either a result object or array
*/
- function row($n = 0, $type = 'object')
+ public function row($n = 0, $type = 'object')
{
if ( ! is_numeric($n))
{
@@ -198,7 +198,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function set_row($key, $value = NULL)
+ public function set_row($key, $value = NULL)
{
// We cache the row data for subsequent uses
if ( ! is_array($this->row_data))
@@ -230,7 +230,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function custom_row_object($n, $type)
+ public function custom_row_object($n, $type)
{
$result = $this->custom_result_object($type);
@@ -253,7 +253,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function row_object($n = 0)
+ public function row_object($n = 0)
{
$result = $this->result_object();
@@ -278,7 +278,7 @@ class CI_DB_result {
* @access public
* @return array
*/
- function row_array($n = 0)
+ public function row_array($n = 0)
{
$result = $this->result_array();
@@ -304,7 +304,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function first_row($type = 'object')
+ public function first_row($type = 'object')
{
$result = $this->result($type);
@@ -323,7 +323,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function last_row($type = 'object')
+ public function last_row($type = 'object')
{
$result = $this->result($type);
@@ -342,7 +342,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function next_row($type = 'object')
+ public function next_row($type = 'object')
{
$result = $this->result($type);
@@ -367,7 +367,7 @@ class CI_DB_result {
* @access public
* @return object
*/
- function previous_row($type = 'object')
+ public function previous_row($type = 'object')
{
$result = $this->result($type);
@@ -394,14 +394,14 @@ class CI_DB_result {
* operational due to the unavailability of the database resource IDs with
* cached results.
*/
- function num_rows() { return $this->num_rows; }
- function num_fields() { return 0; }
- function list_fields() { return array(); }
- function field_data() { return array(); }
- function free_result() { return TRUE; }
- function _data_seek() { return TRUE; }
- function _fetch_assoc() { return array(); }
- function _fetch_object() { return array(); }
+ public function num_rows() { return $this->num_rows; }
+ public function num_fields() { return 0; }
+ public function list_fields() { return array(); }
+ public function field_data() { return array(); }
+ public function free_result() { return TRUE; }
+ protected function _data_seek() { return TRUE; }
+ protected function _fetch_assoc() { return array(); }
+ protected function _fetch_object() { return array(); }
}
// END DB_result class
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index a5f174f0a..52196b7ce 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -33,7 +33,7 @@ class CI_DB_utility extends CI_DB_forge {
* Grabs the CI super object instance so we can access it.
*
*/
- function CI_DB_utility()
+ function __construct()
{
// Assign the main database object to $this->db
$CI =& get_instance();
diff --git a/system/database/drivers/cubrid/cubrid_driver.php b/system/database/drivers/cubrid/cubrid_driver.php
new file mode 100644
index 000000000..d01140412
--- /dev/null
+++ b/system/database/drivers/cubrid/cubrid_driver.php
@@ -0,0 +1,792 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author Esen Sagynov
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 2.0.2
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CUBRID Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package CodeIgniter
+ * @subpackage Drivers
+ * @category Database
+ * @author Esen Sagynov
+ * @link http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_cubrid_driver extends CI_DB {
+
+ // Default CUBRID Broker port. Will be used unless user
+ // explicitly specifies another one.
+ const DEFAULT_PORT = 33000;
+
+ var $dbdriver = 'cubrid';
+
+ // The character used for escaping - no need in CUBRID
+ var $_escape_char = '';
+
+ // clause and character used for LIKE escape sequences - not used in CUBRID
+ var $_like_escape_str = '';
+ var $_like_escape_chr = '';
+
+ /**
+ * The syntax to count rows is slightly different across different
+ * database engines, so this string appears in each driver and is
+ * used for the count_all() and count_all_results() functions.
+ */
+ var $_count_string = 'SELECT COUNT(*) AS ';
+ var $_random_keyword = ' RAND()'; // database specific random keyword
+
+ /**
+ * Non-persistent database connection
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_connect()
+ {
+ // If no port is defined by the user, use the default value
+ if ($this->port == '')
+ {
+ $this->port = self::DEFAULT_PORT;
+ }
+
+ $conn = cubrid_connect($this->hostname, $this->port, $this->database, $this->username, $this->password);
+
+ if ($conn)
+ {
+ // Check if a user wants to run queries in dry, i.e. run the
+ // queries but not commit them.
+ if (isset($this->auto_commit) && ! $this->auto_commit)
+ {
+ cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_FALSE);
+ }
+ else
+ {
+ cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_TRUE);
+ $this->auto_commit = TRUE;
+ }
+ }
+
+ return $conn;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Persistent database connection
+ * In CUBRID persistent DB connection is supported natively in CUBRID
+ * engine which can be configured in the CUBRID Broker configuration
+ * file by setting the CCI_PCONNECT parameter to ON. In that case, all
+ * connections established between the client application and the
+ * server will become persistent. This is calling the same
+ * @cubrid_connect function will establish persisten connection
+ * considering that the CCI_PCONNECT is ON.
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_pconnect()
+ {
+ return $this->db_connect();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Reconnect
+ *
+ * Keep / reestablish the db connection if no queries have been
+ * sent for a length of time exceeding the server's idle timeout
+ *
+ * @access public
+ * @return void
+ */
+ function reconnect()
+ {
+ if (cubrid_ping($this->conn_id) === FALSE)
+ {
+ $this->conn_id = FALSE;
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Select the database
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_select()
+ {
+ // In CUBRID there is no need to select a database as the database
+ // is chosen at the connection time.
+ // So, to determine if the database is "selected", all we have to
+ // do is ping the server and return that value.
+ return cubrid_ping($this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set client character set
+ *
+ * @access public
+ * @param string
+ * @param string
+ * @return resource
+ */
+ function db_set_charset($charset, $collation)
+ {
+ // In CUBRID, there is no need to set charset or collation.
+ // This is why returning true will allow the application continue
+ // its normal process.
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Version number query string
+ *
+ * @access public
+ * @return string
+ */
+ function _version()
+ {
+ // To obtain the CUBRID Server version, no need to run the SQL query.
+ // CUBRID PHP API provides a function to determin this value.
+ // This is why we also need to add 'cubrid' value to the list of
+ // $driver_version_exceptions array in DB_driver class in
+ // version() function.
+ return cubrid_get_server_info($this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Execute the query
+ *
+ * @access private called by the base class
+ * @param string an SQL query
+ * @return resource
+ */
+ function _execute($sql)
+ {
+ $sql = $this->_prep_query($sql);
+ return @cubrid_query($sql, $this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Prep the query
+ *
+ * If needed, each database adapter can prep the query string
+ *
+ * @access private called by execute()
+ * @param string an SQL query
+ * @return string
+ */
+ function _prep_query($sql)
+ {
+ // No need to prepare
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Begin Transaction
+ *
+ * @access public
+ * @return bool
+ */
+ function trans_begin($test_mode = FALSE)
+ {
+ if ( ! $this->trans_enabled)
+ {
+ return TRUE;
+ }
+
+ // When transactions are nested we only begin/commit/rollback the outermost ones
+ if ($this->_trans_depth > 0)
+ {
+ return TRUE;
+ }
+
+ // Reset the transaction failure flag.
+ // If the $test_mode flag is set to TRUE transactions will be rolled back
+ // even if the queries produce a successful result.
+ $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
+
+ if (cubrid_get_autocommit($this->conn_id))
+ {
+ cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_FALSE);
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Commit Transaction
+ *
+ * @access public
+ * @return bool
+ */
+ function trans_commit()
+ {
+ if ( ! $this->trans_enabled)
+ {
+ return TRUE;
+ }
+
+ // When transactions are nested we only begin/commit/rollback the outermost ones
+ if ($this->_trans_depth > 0)
+ {
+ return TRUE;
+ }
+
+ cubrid_commit($this->conn_id);
+
+ if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id))
+ {
+ cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Rollback Transaction
+ *
+ * @access public
+ * @return bool
+ */
+ function trans_rollback()
+ {
+ if ( ! $this->trans_enabled)
+ {
+ return TRUE;
+ }
+
+ // When transactions are nested we only begin/commit/rollback the outermost ones
+ if ($this->_trans_depth > 0)
+ {
+ return TRUE;
+ }
+
+ cubrid_rollback($this->conn_id);
+
+ if ($this->auto_commit && ! cubrid_get_autocommit($this->conn_id))
+ {
+ cubrid_set_autocommit($this->conn_id, CUBRID_AUTOCOMMIT_TRUE);
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Escape String
+ *
+ * @access public
+ * @param string
+ * @param bool whether or not the string will be used in a LIKE condition
+ * @return string
+ */
+ function escape_str($str, $like = FALSE)
+ {
+ if (is_array($str))
+ {
+ foreach ($str as $key => $val)
+ {
+ $str[$key] = $this->escape_str($val, $like);
+ }
+
+ return $str;
+ }
+
+ if (function_exists('cubrid_real_escape_string') AND is_resource($this->conn_id))
+ {
+ $str = cubrid_real_escape_string($str, $this->conn_id);
+ }
+ else
+ {
+ $str = addslashes($str);
+ }
+
+ // escape LIKE condition wildcards
+ if ($like === TRUE)
+ {
+ $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
+ }
+
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Affected Rows
+ *
+ * @access public
+ * @return integer
+ */
+ function affected_rows()
+ {
+ return @cubrid_affected_rows($this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert ID
+ *
+ * @access public
+ * @return integer
+ */
+ function insert_id()
+ {
+ return @cubrid_insert_id($this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * "Count All" query
+ *
+ * Generates a platform-specific query string that counts all records in
+ * the specified table
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ function count_all($table = '')
+ {
+ if ($table == '')
+ {
+ return 0;
+ }
+
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
+
+ if ($query->num_rows() == 0)
+ {
+ return 0;
+ }
+
+ $row = $query->row();
+ $this->_reset_select();
+ return (int) $row->numrows;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * List table query
+ *
+ * Generates a platform-specific query string so that the table names can be fetched
+ *
+ * @access private
+ * @param boolean
+ * @return string
+ */
+ function _list_tables($prefix_limit = FALSE)
+ {
+ $sql = "SHOW TABLES";
+
+ if ($prefix_limit !== FALSE AND $this->dbprefix != '')
+ {
+ $sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%'";
+ }
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Show column query
+ *
+ * Generates a platform-specific query string so that the column names can be fetched
+ *
+ * @access public
+ * @param string the table name
+ * @return string
+ */
+ function _list_columns($table = '')
+ {
+ return "SHOW COLUMNS FROM ".$this->_protect_identifiers($table, TRUE, NULL, FALSE);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data query
+ *
+ * Generates a platform-specific query so that the column data can be retrieved
+ *
+ * @access public
+ * @param string the table name
+ * @return object
+ */
+ function _field_data($table)
+ {
+ return "SELECT * FROM ".$table." LIMIT 1";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * The error message string
+ *
+ * @access private
+ * @return string
+ */
+ function _error_message()
+ {
+ return cubrid_error($this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * The error message number
+ *
+ * @access private
+ * @return integer
+ */
+ function _error_number()
+ {
+ return cubrid_errno($this->conn_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Escape the SQL Identifiers
+ *
+ * This function escapes column and table names
+ *
+ * @access private
+ * @param string
+ * @return string
+ */
+ function _escape_identifiers($item)
+ {
+ if ($this->_escape_char == '')
+ {
+ return $item;
+ }
+
+ foreach ($this->_reserved_identifiers as $id)
+ {
+ if (strpos($item, '.'.$id) !== FALSE)
+ {
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
+ // remove duplicates if the user already included the escape
+ return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
+ }
+ }
+
+ if (strpos($item, '.') !== FALSE)
+ {
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+ }
+ else
+ {
+ $str = $this->_escape_char.$item.$this->_escape_char;
+ }
+
+ // remove duplicates if the user already included the escape
+ return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * From Tables
+ *
+ * This function implicitly groups FROM tables so there is no confusion
+ * about operator precedence in harmony with SQL standards
+ *
+ * @access public
+ * @param type
+ * @return type
+ */
+ function _from_tables($tables)
+ {
+ if ( ! is_array($tables))
+ {
+ $tables = array($tables);
+ }
+
+ return '('.implode(', ', $tables).')';
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _insert($table, $keys, $values)
+ {
+ return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")";
+ }
+
+ // --------------------------------------------------------------------
+
+
+ /**
+ * Replace statement
+ *
+ * Generates a platform-specific replace string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _replace($table, $keys, $values)
+ {
+ return "REPLACE INTO ".$table." (\"".implode('", "', $keys)."\") VALUES (".implode(', ', $values).")";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert_batch statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _insert_batch($table, $keys, $values)
+ {
+ return "INSERT INTO ".$table." (\"".implode('", "', $keys)."\") VALUES ".implode(', ', $values);
+ }
+
+ // --------------------------------------------------------------------
+
+
+ /**
+ * Update statement
+ *
+ * Generates a platform-specific update string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the update data
+ * @param array the where clause
+ * @param array the orderby clause
+ * @param array the limit clause
+ * @return string
+ */
+ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ {
+ foreach ($values as $key => $val)
+ {
+ $valstr[] = sprintf('"%s" = %s', $key, $val);
+ }
+
+ $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+
+ $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
+
+ $sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
+
+ $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
+
+ $sql .= $orderby.$limit;
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+
+ /**
+ * Update_Batch statement
+ *
+ * Generates a platform-specific batch update string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the update data
+ * @param array the where clause
+ * @return string
+ */
+ function _update_batch($table, $values, $index, $where = NULL)
+ {
+ $ids = array();
+ $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : '';
+
+ foreach ($values as $key => $val)
+ {
+ $ids[] = $val[$index];
+
+ foreach (array_keys($val) as $field)
+ {
+ if ($field != $index)
+ {
+ $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
+ }
+ }
+ }
+
+ $sql = "UPDATE ".$table." SET ";
+ $cases = '';
+
+ foreach ($final as $k => $v)
+ {
+ $cases .= $k.' = CASE '."\n";
+ foreach ($v as $row)
+ {
+ $cases .= $row."\n";
+ }
+
+ $cases .= 'ELSE '.$k.' END, ';
+ }
+
+ $sql .= substr($cases, 0, -2);
+
+ $sql .= ' WHERE '.$where.$index.' IN ('.implode(',', $ids).')';
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+
+ /**
+ * Truncate statement
+ *
+ * Generates a platform-specific truncate string from the supplied data
+ * If the database does not support the truncate() command
+ * This function maps to "DELETE FROM table"
+ *
+ * @access public
+ * @param string the table name
+ * @return string
+ */
+ function _truncate($table)
+ {
+ return "TRUNCATE ".$table;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Delete statement
+ *
+ * Generates a platform-specific delete string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the where clause
+ * @param string the limit clause
+ * @return string
+ */
+ function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+ {
+ $conditions = '';
+
+ if (count($where) > 0 OR count($like) > 0)
+ {
+ $conditions = "\nWHERE ";
+ $conditions .= implode("\n", $this->ar_where);
+
+ if (count($where) > 0 && count($like) > 0)
+ {
+ $conditions .= " AND ";
+ }
+ $conditions .= implode("\n", $like);
+ }
+
+ $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$table.$conditions.$limit;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Limit string
+ *
+ * Generates a platform-specific LIMIT clause
+ *
+ * @access public
+ * @param string the sql query string
+ * @param integer the number of rows to limit the query to
+ * @param integer the offset value
+ * @return string
+ */
+ function _limit($sql, $limit, $offset)
+ {
+ if ($offset == 0)
+ {
+ $offset = '';
+ }
+ else
+ {
+ $offset .= ", ";
+ }
+
+ return $sql."LIMIT ".$offset.$limit;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Close DB Connection
+ *
+ * @access public
+ * @param resource
+ * @return void
+ */
+ function _close($conn_id)
+ {
+ @cubrid_close($conn_id);
+ }
+
+}
+
+
+/* End of file cubrid_driver.php */
+/* Location: ./system/database/drivers/cubrid/cubrid_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/cubrid/cubrid_forge.php b/system/database/drivers/cubrid/cubrid_forge.php
new file mode 100644
index 000000000..bab03f748
--- /dev/null
+++ b/system/database/drivers/cubrid/cubrid_forge.php
@@ -0,0 +1,288 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author Esen Sagynov
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CUBRID Forge Class
+ *
+ * @category Database
+ * @author Esen Sagynov
+ * @link http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_cubrid_forge extends CI_DB_forge {
+
+ /**
+ * Create database
+ *
+ * @access private
+ * @param string the database name
+ * @return bool
+ */
+ function _create_database($name)
+ {
+ // CUBRID does not allow to create a database in SQL. The GUI tools
+ // have to be used for this purpose.
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access private
+ * @param string the database name
+ * @return bool
+ */
+ function _drop_database($name)
+ {
+ // CUBRID does not allow to drop a database in SQL. The GUI tools
+ // have to be used for this purpose.
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Process Fields
+ *
+ * @access private
+ * @param mixed the fields
+ * @return string
+ */
+ function _process_fields($fields)
+ {
+ $current_field_count = 0;
+ $sql = '';
+
+ foreach ($fields as $field=>$attributes)
+ {
+ // Numeric field names aren't allowed in databases, so if the key is
+ // numeric, we know it was assigned by PHP and the developer manually
+ // entered the field information, so we'll simply add it to the list
+ if (is_numeric($field))
+ {
+ $sql .= "\n\t$attributes";
+ }
+ else
+ {
+ $attributes = array_change_key_case($attributes, CASE_UPPER);
+
+ $sql .= "\n\t\"" . $this->db->_protect_identifiers($field) . "\"";
+
+ if (array_key_exists('NAME', $attributes))
+ {
+ $sql .= ' '.$this->db->_protect_identifiers($attributes['NAME']).' ';
+ }
+
+ if (array_key_exists('TYPE', $attributes))
+ {
+ $sql .= ' '.$attributes['TYPE'];
+
+ if (array_key_exists('CONSTRAINT', $attributes))
+ {
+ switch ($attributes['TYPE'])
+ {
+ case 'decimal':
+ case 'float':
+ case 'numeric':
+ $sql .= '('.implode(',', $attributes['CONSTRAINT']).')';
+ break;
+ case 'enum': // As of version 8.4.0 CUBRID does not support
+ // enum data type.
+ break;
+ case 'set':
+ $sql .= '("'.implode('","', $attributes['CONSTRAINT']).'")';
+ break;
+ default:
+ $sql .= '('.$attributes['CONSTRAINT'].')';
+ }
+ }
+ }
+
+ if (array_key_exists('UNSIGNED', $attributes) && $attributes['UNSIGNED'] === TRUE)
+ {
+ //$sql .= ' UNSIGNED';
+ // As of version 8.4.0 CUBRID does not support UNSIGNED INTEGER data type.
+ // Will be supported in the next release as a part of MySQL Compatibility.
+ }
+
+ if (array_key_exists('DEFAULT', $attributes))
+ {
+ $sql .= ' DEFAULT \''.$attributes['DEFAULT'].'\'';
+ }
+
+ if (array_key_exists('NULL', $attributes) && $attributes['NULL'] === TRUE)
+ {
+ $sql .= ' NULL';
+ }
+ else
+ {
+ $sql .= ' NOT NULL';
+ }
+
+ if (array_key_exists('AUTO_INCREMENT', $attributes) && $attributes['AUTO_INCREMENT'] === TRUE)
+ {
+ $sql .= ' AUTO_INCREMENT';
+ }
+
+ if (array_key_exists('UNIQUE', $attributes) && $attributes['UNIQUE'] === TRUE)
+ {
+ $sql .= ' UNIQUE';
+ }
+ }
+
+ // don't add a comma on the end of the last field
+ if (++$current_field_count < count($fields))
+ {
+ $sql .= ',';
+ }
+ }
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Create Table
+ *
+ * @access private
+ * @param string the table name
+ * @param mixed the fields
+ * @param mixed primary key(s)
+ * @param mixed key(s)
+ * @param boolean should 'IF NOT EXISTS' be added to the SQL
+ * @return bool
+ */
+ function _create_table($table, $fields, $primary_keys, $keys, $if_not_exists)
+ {
+ $sql = 'CREATE TABLE ';
+
+ if ($if_not_exists === TRUE)
+ {
+ //$sql .= 'IF NOT EXISTS ';
+ // As of version 8.4.0 CUBRID does not support this SQL syntax.
+ }
+
+ $sql .= $this->db->_escape_identifiers($table)." (";
+
+ $sql .= $this->_process_fields($fields);
+
+ // If there is a PK defined
+ if (count($primary_keys) > 0)
+ {
+ $key_name = "pk_" . $table . "_" .
+ $this->db->_protect_identifiers(implode('_', $primary_keys));
+
+ $primary_keys = $this->db->_protect_identifiers($primary_keys);
+ $sql .= ",\n\tCONSTRAINT " . $key_name . " PRIMARY KEY(" . implode(', ', $primary_keys) . ")";
+ }
+
+ if (is_array($keys) && count($keys) > 0)
+ {
+ foreach ($keys as $key)
+ {
+ if (is_array($key))
+ {
+ $key_name = $this->db->_protect_identifiers(implode('_', $key));
+ $key = $this->db->_protect_identifiers($key);
+ }
+ else
+ {
+ $key_name = $this->db->_protect_identifiers($key);
+ $key = array($key_name);
+ }
+
+ $sql .= ",\n\tKEY \"{$key_name}\" (" . implode(', ', $key) . ")";
+ }
+ }
+
+ $sql .= "\n);";
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop Table
+ *
+ * @access private
+ * @return string
+ */
+ function _drop_table($table)
+ {
+ return "DROP TABLE IF EXISTS ".$this->db->_escape_identifiers($table);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Alter table query
+ *
+ * Generates a platform-specific query so that a table can be altered
+ * Called by add_column(), drop_column(), and column_alter(),
+ *
+ * @access private
+ * @param string the ALTER type (ADD, DROP, CHANGE)
+ * @param string the column name
+ * @param array fields
+ * @param string the field after which we should add the new field
+ * @return object
+ */
+ function _alter_table($alter_type, $table, $fields, $after_field = '')
+ {
+ $sql = 'ALTER TABLE '.$this->db->_protect_identifiers($table)." $alter_type ";
+
+ // DROP has everything it needs now.
+ if ($alter_type == 'DROP')
+ {
+ return $sql.$this->db->_protect_identifiers($fields);
+ }
+
+ $sql .= $this->_process_fields($fields);
+
+ if ($after_field != '')
+ {
+ $sql .= ' AFTER ' . $this->db->_protect_identifiers($after_field);
+ }
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Rename a table
+ *
+ * Generates a platform-specific query so that a table can be renamed
+ *
+ * @access private
+ * @param string the old table name
+ * @param string the new table name
+ * @return string
+ */
+ function _rename_table($table_name, $new_table_name)
+ {
+ $sql = 'RENAME TABLE '.$this->db->_protect_identifiers($table_name)." AS ".$this->db->_protect_identifiers($new_table_name);
+ return $sql;
+ }
+
+}
+
+/* End of file cubrid_forge.php */
+/* Location: ./system/database/drivers/cubrid/cubrid_forge.php */ \ No newline at end of file
diff --git a/system/database/drivers/cubrid/cubrid_result.php b/system/database/drivers/cubrid/cubrid_result.php
new file mode 100644
index 000000000..6f0c2b5f7
--- /dev/null
+++ b/system/database/drivers/cubrid/cubrid_result.php
@@ -0,0 +1,202 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author Esen Sagynov
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 2.0.2
+ * @filesource
+ */
+
+// --------------------------------------------------------------------
+
+/**
+ * CUBRID Result Class
+ *
+ * This class extends the parent result class: CI_DB_result
+ *
+ * @category Database
+ * @author Esen Sagynov
+ * @link http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_cubrid_result extends CI_DB_result {
+
+ /**
+ * Number of rows in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_rows()
+ {
+ return @cubrid_num_rows($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Number of fields in the result set
+ *
+ * @access public
+ * @return integer
+ */
+ function num_fields()
+ {
+ return @cubrid_num_fields($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Fetch Field Names
+ *
+ * Generates an array of column names
+ *
+ * @access public
+ * @return array
+ */
+ function list_fields()
+ {
+ return cubrid_column_names($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data
+ *
+ * Generates an array of objects containing field meta-data
+ *
+ * @access public
+ * @return array
+ */
+ function field_data()
+ {
+ $retval = array();
+
+ $tablePrimaryKeys = array();
+
+ while ($field = cubrid_fetch_field($this->result_id))
+ {
+ $F = new stdClass();
+ $F->name = $field->name;
+ $F->type = $field->type;
+ $F->default = $field->def;
+ $F->max_length = $field->max_length;
+
+ // At this moment primary_key property is not returned when
+ // cubrid_fetch_field is called. The following code will
+ // provide a patch for it. primary_key property will be added
+ // in the next release.
+
+ // TODO: later version of CUBRID will provide primary_key
+ // property.
+ // When PK is defined in CUBRID, an index is automatically
+ // created in the db_index system table in the form of
+ // pk_tblname_fieldname. So the following will count how many
+ // columns are there which satisfy this format.
+ // The query will search for exact single columns, thus
+ // compound PK is not supported.
+ $res = cubrid_query($this->conn_id,
+ "SELECT COUNT(*) FROM db_index WHERE class_name = '" . $field->table .
+ "' AND is_primary_key = 'YES' AND index_name = 'pk_" .
+ $field->table . "_" . $field->name . "'"
+ );
+
+ if ($res)
+ {
+ $row = cubrid_fetch_array($res, CUBRID_NUM);
+ $F->primary_key = ($row[0] > 0 ? 1 : null);
+ }
+ else
+ {
+ $F->primary_key = null;
+ }
+
+ if (is_resource($res))
+ {
+ cubrid_close_request($res);
+ $this->result_id = FALSE;
+ }
+
+ $retval[] = $F;
+ }
+
+ return $retval;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Free the result
+ *
+ * @return null
+ */
+ function free_result()
+ {
+ if(is_resource($this->result_id) ||
+ get_resource_type($this->result_id) == "Unknown" &&
+ preg_match('/Resource id #/', strval($this->result_id)))
+ {
+ cubrid_close_request($this->result_id);
+ $this->result_id = FALSE;
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Data Seek
+ *
+ * Moves the internal pointer to the desired offset. We call
+ * this internally before fetching results to make sure the
+ * result set starts at zero
+ *
+ * @access private
+ * @return array
+ */
+ function _data_seek($n = 0)
+ {
+ return cubrid_data_seek($this->result_id, $n);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - associative array
+ *
+ * Returns the result set as an array
+ *
+ * @access private
+ * @return array
+ */
+ function _fetch_assoc()
+ {
+ return cubrid_fetch_assoc($this->result_id);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Result - object
+ *
+ * Returns the result set as an object
+ *
+ * @access private
+ * @return object
+ */
+ function _fetch_object()
+ {
+ return cubrid_fetch_object($this->result_id);
+ }
+
+}
+
+
+/* End of file cubrid_result.php */
+/* Location: ./system/database/drivers/cubrid/cubrid_result.php */ \ No newline at end of file
diff --git a/system/database/drivers/cubrid/cubrid_utility.php b/system/database/drivers/cubrid/cubrid_utility.php
new file mode 100644
index 000000000..cd16d1e18
--- /dev/null
+++ b/system/database/drivers/cubrid/cubrid_utility.php
@@ -0,0 +1,108 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author Esen Sagynov
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * CUBRID Utility Class
+ *
+ * @category Database
+ * @author Esen Sagynov
+ * @link http://codeigniter.com/user_guide/database/
+ */
+class CI_DB_cubrid_utility extends CI_DB_utility {
+
+ /**
+ * List databases
+ *
+ * @access private
+ * @return array
+ */
+ function _list_databases()
+ {
+ // CUBRID does not allow to see the list of all databases on the
+ // server. It is the way its architecture is designed. Every
+ // database is independent and isolated.
+ // For this reason we can return only the name of the currect
+ // connected database.
+ if ($this->conn_id)
+ {
+ return "SELECT '" . $this->database . "'";
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Optimize table query
+ *
+ * Generates a platform-specific query so that a table can be optimized
+ *
+ * @access private
+ * @param string the table name
+ * @return object
+ * @link http://www.cubrid.org/manual/840/en/Optimize%20Database
+ */
+ function _optimize_table($table)
+ {
+ // No SQL based support in CUBRID as of version 8.4.0. Database or
+ // table optimization can be performed using CUBRID Manager
+ // database administration tool. See the link above for more info.
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Repair table query
+ *
+ * Generates a platform-specific query so that a table can be repaired
+ *
+ * @access private
+ * @param string the table name
+ * @return object
+ * @link http://www.cubrid.org/manual/840/en/Checking%20Database%20Consistency
+ */
+ function _repair_table($table)
+ {
+ // Not supported in CUBRID as of version 8.4.0. Database or
+ // table consistency can be checked using CUBRID Manager
+ // database administration tool. See the link above for more info.
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+ /**
+ * CUBRID Export
+ *
+ * @access private
+ * @param array Preferences
+ * @return mixed
+ */
+ function _backup($params = array())
+ {
+ // No SQL based support in CUBRID as of version 8.4.0. Database or
+ // table backup can be performed using CUBRID Manager
+ // database administration tool.
+ return $this->db->display_error('db_unsuported_feature');
+ }
+}
+
+/* End of file cubrid_utility.php */
+/* Location: ./system/database/drivers/cubrid/cubrid_utility.php */ \ No newline at end of file
diff --git a/system/database/drivers/cubrid/index.html b/system/database/drivers/cubrid/index.html
new file mode 100644
index 000000000..c942a79ce
--- /dev/null
+++ b/system/database/drivers/cubrid/index.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <title>403 Forbidden</title>
+</head>
+<body>
+
+<p>Directory access is forbidden.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 65397ed8f..b39bd9360 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -367,6 +367,7 @@ class CI_DB_mssql_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index b7d547cc0..f87cfea4b 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -54,6 +54,9 @@ class CI_DB_mysql_driver extends CI_DB {
var $_count_string = 'SELECT COUNT(*) AS ';
var $_random_keyword = ' RAND()'; // database specific random keyword
+ // whether SET NAMES must be used to set the character set
+ var $use_set_names;
+
/**
* Non-persistent database connection
*
@@ -132,15 +135,13 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function db_set_charset($charset, $collation)
{
- static $use_set_names;
-
- if ( ! isset($use_set_names))
+ if ( ! isset($this->use_set_names))
{
// mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback
- $use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE;
+ $this->use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE;
}
- if ($use_set_names)
+ if ($this->use_set_names === TRUE)
{
return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
}
@@ -384,6 +385,7 @@ class CI_DB_mysql_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
@@ -439,7 +441,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function _field_data($table)
{
- return "SELECT * FROM ".$table." LIMIT 1";
+ return "DESCRIBE ".$table;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php
index 507389603..e1a6e93ca 100644
--- a/system/database/drivers/mysql/mysql_result.php
+++ b/system/database/drivers/mysql/mysql_result.php
@@ -84,14 +84,19 @@ class CI_DB_mysql_result extends CI_DB_result {
function field_data()
{
$retval = array();
- while ($field = mysql_fetch_field($this->result_id))
+ while ($field = mysql_fetch_object($this->result_id))
{
+ preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches);
+
+ $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL;
+ $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL;
+
$F = new stdClass();
- $F->name = $field->name;
- $F->type = $field->type;
- $F->default = $field->def;
- $F->max_length = $field->max_length;
- $F->primary_key = $field->primary_key;
+ $F->name = $field->Field;
+ $F->type = $type;
+ $F->default = $field->Default;
+ $F->max_length = $length;
+ $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 );
$retval[] = $F;
}
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index e9747c540..48c4d6316 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -96,7 +96,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Get the table schema
- $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table);
+ $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.`'.$table.'`');
// No result means the table name was invalid
if ($query === FALSE)
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index b8586c21d..d3200f328 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -54,6 +54,9 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
var $delete_hack = TRUE;
+ // whether SET NAMES must be used to set the character set
+ var $use_set_names;
+
// --------------------------------------------------------------------
/**
@@ -132,15 +135,13 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
function _db_set_charset($charset, $collation)
{
- static $use_set_names;
-
- if ( ! isset($use_set_names))
+ if ( ! isset($this->use_set_names))
{
// mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback
- $use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE;
+ $this->use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE;
}
- if ($use_set_names)
+ if ($this->use_set_names === TRUE)
{
return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'");
}
@@ -385,6 +386,7 @@ class CI_DB_mysqli_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
@@ -440,7 +442,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
function _field_data($table)
{
- return "SELECT * FROM ".$table." LIMIT 1";
+ return "DESCRIBE ".$table;
}
// --------------------------------------------------------------------
@@ -568,6 +570,25 @@ class CI_DB_mysqli_driver extends CI_DB {
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
}
+
+ // --------------------------------------------------------------------
+
+
+ /**
+ * Replace statement
+ *
+ * Generates a platform-specific replace string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _replace($table, $keys, $values)
+ {
+ return "REPLACE INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+ }
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php
index c4d8f5d58..124d4e599 100644
--- a/system/database/drivers/mysqli/mysqli_result.php
+++ b/system/database/drivers/mysqli/mysqli_result.php
@@ -84,21 +84,26 @@ class CI_DB_mysqli_result extends CI_DB_result {
function field_data()
{
$retval = array();
- while ($field = mysqli_fetch_field($this->result_id))
+ while ($field = mysqli_fetch_object($this->result_id))
{
+ preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches);
+
+ $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL;
+ $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL;
+
$F = new stdClass();
- $F->name = $field->name;
- $F->type = $field->type;
- $F->default = $field->def;
- $F->max_length = $field->max_length;
- $F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0;
+ $F->name = $field->Field;
+ $F->type = $type;
+ $F->default = $field->Default;
+ $F->max_length = $length;
+ $F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 );
$retval[] = $F;
}
return $retval;
}
-
+
// --------------------------------------------------------------------
/**
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 14df104ff..930177e62 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -35,8 +35,6 @@
* This is a modification of the DB_driver class to
* permit access to oracle databases
*
- * NOTE: this uses the PHP 4 oci methods
- *
* @author Kelly McArdle
*
*/
@@ -77,9 +75,9 @@ class CI_DB_oci8_driver extends CI_DB {
* @access private called by the base class
* @return resource
*/
- function db_connect()
+ public function db_connect()
{
- return @ocilogon($this->username, $this->password, $this->hostname);
+ return @oci_connect($this->username, $this->password, $this->hostname, $this->char_set);
}
// --------------------------------------------------------------------
@@ -90,9 +88,9 @@ class CI_DB_oci8_driver extends CI_DB {
* @access private called by the base class
* @return resource
*/
- function db_pconnect()
+ public function db_pconnect()
{
- return @ociplogon($this->username, $this->password, $this->hostname);
+ return @oci_pconnect($this->username, $this->password, $this->hostname, $this->char_set);
}
// --------------------------------------------------------------------
@@ -106,9 +104,10 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return void
*/
- function reconnect()
+ public function reconnect()
{
// not implemented in oracle
+ return;
}
// --------------------------------------------------------------------
@@ -119,8 +118,9 @@ class CI_DB_oci8_driver extends CI_DB {
* @access private called by the base class
* @return resource
*/
- function db_select()
+ public function db_select()
{
+ // Not in Oracle - schemas are actually usernames
return TRUE;
}
@@ -134,7 +134,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param string
* @return resource
*/
- function db_set_charset($charset, $collation)
+ public function db_set_charset($charset, $collation)
{
// @todo - add support if needed
return TRUE;
@@ -145,12 +145,12 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Version number query string
*
- * @access public
+ * @access protected
* @return string
*/
- function _version()
+ protected function _version()
{
- return ociserverversion($this->conn_id);
+ return oci_server_version($this->conn_id);
}
// --------------------------------------------------------------------
@@ -158,18 +158,18 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Execute the query
*
- * @access private called by the base class
+ * @access protected called by the base class
* @param string an SQL query
* @return resource
*/
- function _execute($sql)
+ protected function _execute($sql)
{
// oracle must parse the query before it is run. All of the actions with
// the query are based on the statement id returned by ociparse
$this->stmt_id = FALSE;
$this->_set_stmt_id($sql);
- ocisetprefetch($this->stmt_id, 1000);
- return @ociexecute($this->stmt_id, $this->_commit);
+ oci_set_prefetch($this->stmt_id, 1000);
+ return @oci_execute($this->stmt_id, $this->_commit);
}
/**
@@ -179,11 +179,11 @@ class CI_DB_oci8_driver extends CI_DB {
* @param string an SQL query
* @return none
*/
- function _set_stmt_id($sql)
+ private function _set_stmt_id($sql)
{
if ( ! is_resource($this->stmt_id))
{
- $this->stmt_id = ociparse($this->conn_id, $this->_prep_query($sql));
+ $this->stmt_id = oci_parse($this->conn_id, $this->_prep_query($sql));
}
}
@@ -198,7 +198,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param string an SQL query
* @return string
*/
- function _prep_query($sql)
+ private function _prep_query($sql)
{
return $sql;
}
@@ -211,9 +211,9 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return cursor id
*/
- function get_cursor()
+ public function get_cursor()
{
- $this->curs_id = ocinewcursor($this->conn_id);
+ $this->curs_id = oci_new_cursor($this->conn_id);
return $this->curs_id;
}
@@ -237,7 +237,7 @@ class CI_DB_oci8_driver extends CI_DB {
* type yes the type of the parameter
* length yes the max size of the parameter
*/
- function stored_procedure($package, $procedure, $params)
+ public function stored_procedure($package, $procedure, $params)
{
if ($package == '' OR $procedure == '' OR ! is_array($params))
{
@@ -257,7 +257,7 @@ class CI_DB_oci8_driver extends CI_DB {
{
$sql .= $param['name'] . ",";
- if (array_key_exists('type', $param) && ($param['type'] == OCI_B_CURSOR))
+ if (array_key_exists('type', $param) && ($param['type'] === OCI_B_CURSOR))
{
$have_cursor = TRUE;
}
@@ -278,7 +278,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @access private
* @return none
*/
- function _bind_params($params)
+ private function _bind_params($params)
{
if ( ! is_array($params) OR ! is_resource($this->stmt_id))
{
@@ -295,7 +295,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
}
- ocibindbyname($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']);
+ oci_bind_by_name($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']);
}
}
@@ -307,7 +307,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return bool
*/
- function trans_begin($test_mode = FALSE)
+ public function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
@@ -337,7 +337,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return bool
*/
- function trans_commit()
+ public function trans_commit()
{
if ( ! $this->trans_enabled)
{
@@ -350,7 +350,7 @@ class CI_DB_oci8_driver extends CI_DB {
return TRUE;
}
- $ret = OCIcommit($this->conn_id);
+ $ret = oci_commit($this->conn_id);
$this->_commit = OCI_COMMIT_ON_SUCCESS;
return $ret;
}
@@ -363,7 +363,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return bool
*/
- function trans_rollback()
+ public function trans_rollback()
{
if ( ! $this->trans_enabled)
{
@@ -376,7 +376,7 @@ class CI_DB_oci8_driver extends CI_DB {
return TRUE;
}
- $ret = OCIrollback($this->conn_id);
+ $ret = oci_rollback($this->conn_id);
$this->_commit = OCI_COMMIT_ON_SUCCESS;
return $ret;
}
@@ -391,7 +391,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
- function escape_str($str, $like = FALSE)
+ public function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
@@ -424,9 +424,9 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return integer
*/
- function affected_rows()
+ public function affected_rows()
{
- return @ocirowcount($this->stmt_id);
+ return @oci_num_rows($this->stmt_id);
}
// --------------------------------------------------------------------
@@ -437,7 +437,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @access public
* @return integer
*/
- function insert_id()
+ public function insert_id()
{
// not supported in oracle
return $this->display_error('db_unsupported_function');
@@ -455,7 +455,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param string
* @return string
*/
- function count_all($table = '')
+ public function count_all($table = '')
{
if ($table == '')
{
@@ -470,6 +470,7 @@ class CI_DB_oci8_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
@@ -480,11 +481,11 @@ class CI_DB_oci8_driver extends CI_DB {
*
* Generates a platform-specific query string so that the table names can be fetched
*
- * @access private
+ * @access protected
* @param boolean
- * @return string
+ * @return string
*/
- function _list_tables($prefix_limit = FALSE)
+ protected function _list_tables($prefix_limit = FALSE)
{
$sql = "SELECT TABLE_NAME FROM ALL_TABLES";
@@ -503,11 +504,11 @@ class CI_DB_oci8_driver extends CI_DB {
*
* Generates a platform-specific query string so that the column names can be fetched
*
- * @access public
+ * @access protected
* @param string the table name
* @return string
*/
- function _list_columns($table = '')
+ protected function _list_columns($table = '')
{
return "SELECT COLUMN_NAME FROM all_tab_columns WHERE table_name = '$table'";
}
@@ -523,7 +524,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param string the table name
* @return object
*/
- function _field_data($table)
+ protected function _field_data($table)
{
return "SELECT * FROM ".$table." where rownum = 1";
}
@@ -533,12 +534,13 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* The error message string
*
- * @access private
+ * @access protected
* @return string
*/
- function _error_message()
+ protected function _error_message()
{
- $error = ocierror($this->conn_id);
+ // If the error was during connection, no conn_id should be passed
+ $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error();
return $error['message'];
}
@@ -547,12 +549,13 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* The error message number
*
- * @access private
+ * @access protected
* @return integer
*/
- function _error_number()
+ protected function _error_number()
{
- $error = ocierror($this->conn_id);
+ // Same as _error_message()
+ $error = is_resource($this->conn_id) ? oci_error($this->conn_id) : oci_error();
return $error['code'];
}
@@ -563,11 +566,11 @@ class CI_DB_oci8_driver extends CI_DB {
*
* This function escapes column and table names
*
- * @access private
+ * @access protected
* @param string
* @return string
*/
- function _escape_identifiers($item)
+ protected function _escape_identifiers($item)
{
if ($this->_escape_char == '')
{
@@ -606,11 +609,11 @@ class CI_DB_oci8_driver extends CI_DB {
* This function implicitly groups FROM tables so there is no confusion
* about operator precedence in harmony with SQL standards
*
- * @access public
+ * @access protected
* @param type
* @return type
*/
- function _from_tables($tables)
+ protected function _from_tables($tables)
{
if ( ! is_array($tables))
{
@@ -633,9 +636,37 @@ class CI_DB_oci8_driver extends CI_DB {
* @param array the insert values
* @return string
*/
- function _insert($table, $keys, $values)
+ protected function _insert($table, $keys, $values)
{
- return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+ return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert_batch statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access protected
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ protected function _insert_batch($table, $keys, $values)
+ {
+ $keys = implode(', ', $keys);
+ $sql = "INSERT ALL\n";
+
+ for ($i = 0, $c = count($values); $i < $c; $i++)
+ {
+ $sql .= ' INTO ' . $table . ' (' . $keys . ') VALUES ' . $values[$i] . "\n";
+ }
+
+ $sql .= 'SELECT * FROM dual';
+
+ return $sql;
}
// --------------------------------------------------------------------
@@ -645,7 +676,7 @@ class CI_DB_oci8_driver extends CI_DB {
*
* Generates a platform-specific update string from the supplied data
*
- * @access public
+ * @access protected
* @param string the table name
* @param array the update data
* @param array the where clause
@@ -653,7 +684,7 @@ class CI_DB_oci8_driver extends CI_DB {
* @param array the limit clause
* @return string
*/
- function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ protected function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
{
foreach ($values as $key => $val)
{
@@ -682,11 +713,11 @@ class CI_DB_oci8_driver extends CI_DB {
* If the database does not support the truncate() command
* This function maps to "DELETE FROM table"
*
- * @access public
+ * @access protected
* @param string the table name
* @return string
*/
- function _truncate($table)
+ protected function _truncate($table)
{
return "TRUNCATE TABLE ".$table;
}
@@ -698,13 +729,13 @@ class CI_DB_oci8_driver extends CI_DB {
*
* Generates a platform-specific delete string from the supplied data
*
- * @access public
+ * @access protected
* @param string the table name
* @param array the where clause
* @param string the limit clause
* @return string
*/
- function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+ protected function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
@@ -732,13 +763,13 @@ class CI_DB_oci8_driver extends CI_DB {
*
* Generates a platform-specific LIMIT clause
*
- * @access public
+ * @access protected
* @param string the sql query string
* @param integer the number of rows to limit the query to
* @param integer the offset value
* @return string
*/
- function _limit($sql, $limit, $offset)
+ protected function _limit($sql, $limit, $offset)
{
$limit = $offset + $limit;
$newsql = "SELECT * FROM (select inner_query.*, rownum rnum FROM ($sql) inner_query WHERE rownum < $limit)";
@@ -759,13 +790,13 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Close DB Connection
*
- * @access public
+ * @access protected
* @param resource
* @return void
*/
- function _close($conn_id)
+ protected function _close($conn_id)
{
- @ocilogoff($conn_id);
+ @oci_close($conn_id);
}
@@ -774,4 +805,4 @@ class CI_DB_oci8_driver extends CI_DB {
/* End of file oci8_driver.php */
-/* Location: ./system/database/drivers/oci8/oci8_driver.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/oci8/oci8_driver.php */
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 88531b436..ae133d7b5 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -40,14 +40,17 @@ class CI_DB_oci8_result extends CI_DB_result {
* @access public
* @return integer
*/
- function num_rows()
+ public function num_rows()
{
- $rowcount = count($this->result_array());
- @ociexecute($this->stmt_id);
-
- if ($this->curs_id)
+ if ($this->num_rows === 0 && count($this->result_array()) > 0)
{
- @ociexecute($this->curs_id);
+ $this->num_rows = count($this->result_array());
+ @oci_execute($this->stmt_id);
+
+ if ($this->curs_id)
+ {
+ @oci_execute($this->curs_id);
+ }
}
return $rowcount;
@@ -61,9 +64,9 @@ class CI_DB_oci8_result extends CI_DB_result {
* @access public
* @return integer
*/
- function num_fields()
+ public function num_fields()
{
- $count = @ocinumcols($this->stmt_id);
+ $count = @oci_num_fields($this->stmt_id);
// if we used a limit we subtract it
if ($this->limit_used)
@@ -84,13 +87,12 @@ class CI_DB_oci8_result extends CI_DB_result {
* @access public
* @return array
*/
- function list_fields()
+ public function list_fields()
{
$field_names = array();
- $fieldCount = $this->num_fields();
- for ($c = 1; $c <= $fieldCount; $c++)
+ for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++)
{
- $field_names[] = ocicolumnname($this->stmt_id, $c);
+ $field_names[] = oci_field_name($this->stmt_id, $c);
}
return $field_names;
}
@@ -105,16 +107,15 @@ class CI_DB_oci8_result extends CI_DB_result {
* @access public
* @return array
*/
- function field_data()
+ public function field_data()
{
$retval = array();
- $fieldCount = $this->num_fields();
- for ($c = 1; $c <= $fieldCount; $c++)
+ for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++)
{
- $F = new stdClass();
- $F->name = ocicolumnname($this->stmt_id, $c);
- $F->type = ocicolumntype($this->stmt_id, $c);
- $F->max_length = ocicolumnsize($this->stmt_id, $c);
+ $F = new stdClass();
+ $F->name = oci_field_name($this->stmt_id, $c);
+ $F->type = oci_field_type($this->stmt_id, $c);
+ $F->max_length = oci_field_size($this->stmt_id, $c);
$retval[] = $F;
}
@@ -129,11 +130,11 @@ class CI_DB_oci8_result extends CI_DB_result {
*
* @return null
*/
- function free_result()
+ public function free_result()
{
if (is_resource($this->result_id))
{
- ocifreestatement($this->result_id);
+ oci_free_statement($this->result_id);
$this->result_id = FALSE;
}
}
@@ -145,14 +146,13 @@ class CI_DB_oci8_result extends CI_DB_result {
*
* Returns the result set as an array
*
- * @access private
+ * @access protected
* @return array
*/
- function _fetch_assoc(&$row)
+ protected function _fetch_assoc()
{
$id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
-
- return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
+ return oci_fetch_assoc($id);
}
// --------------------------------------------------------------------
@@ -162,41 +162,13 @@ class CI_DB_oci8_result extends CI_DB_result {
*
* Returns the result set as an object
*
- * @access private
+ * @access protected
* @return object
*/
- function _fetch_object()
+ protected function _fetch_object()
{
- $result = array();
-
- // If PHP 5 is being used we can fetch an result object
- if (function_exists('oci_fetch_object'))
- {
- $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
-
- return @oci_fetch_object($id);
- }
-
- // If PHP 4 is being used we have to build our own result
- foreach ($this->result_array() as $key => $val)
- {
- $obj = new stdClass();
- if (is_array($val))
- {
- foreach ($val as $k => $v)
- {
- $obj->$k = $v;
- }
- }
- else
- {
- $obj->$key = $val;
- }
-
- $result[] = $obj;
- }
-
- return $result;
+ $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
+ return @oci_fetch_object($id);
}
// --------------------------------------------------------------------
@@ -207,17 +179,15 @@ class CI_DB_oci8_result extends CI_DB_result {
* @access public
* @return array
*/
- function result_array()
+ public function result_array()
{
if (count($this->result_array) > 0)
{
return $this->result_array;
}
- // oracle's fetch functions do not return arrays.
- // The information is returned in reference parameters
$row = NULL;
- while ($this->_fetch_assoc($row))
+ while ($row = $this->_fetch_assoc())
{
$this->result_array[] = $row;
}
@@ -234,10 +204,10 @@ class CI_DB_oci8_result extends CI_DB_result {
* this internally before fetching results to make sure the
* result set starts at zero
*
- * @access private
+ * @access protected
* @return array
*/
- function _data_seek($n = 0)
+ protected function _data_seek($n = 0)
{
return FALSE; // Not needed
}
@@ -246,4 +216,4 @@ class CI_DB_oci8_result extends CI_DB_result {
/* End of file oci8_result.php */
-/* Location: ./system/database/drivers/oci8/oci8_result.php */ \ No newline at end of file
+/* Location: ./system/database/drivers/oci8/oci8_result.php */
diff --git a/system/database/drivers/odbc/odbc_driver.php b/system/database/drivers/odbc/odbc_driver.php
index 81e0d7cf2..bcd7937d9 100644
--- a/system/database/drivers/odbc/odbc_driver.php
+++ b/system/database/drivers/odbc/odbc_driver.php
@@ -48,9 +48,9 @@ class CI_DB_odbc_driver extends CI_DB {
var $_random_keyword;
- function CI_DB_odbc_driver($params)
+ function __construct($params)
{
- parent::CI_DB($params);
+ parent::__construct($params);
$this->_random_keyword = ' RND('.time().')'; // database specific random keyword
}
@@ -339,6 +339,7 @@ class CI_DB_odbc_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php
new file mode 100644
index 000000000..f69893273
--- /dev/null
+++ b/system/database/drivers/pdo/pdo_driver.php
@@ -0,0 +1,803 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author ExpressionEngine Dev Team
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 2.1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * PDO Database Adapter Class
+ *
+ * Note: _DB is an extender class that the app controller
+ * creates dynamically based on whether the active record
+ * class is being used or not.
+ *
+ * @package CodeIgniter
+ * @subpackage Drivers
+ * @category Database
+ * @author ExpressionEngine Dev Team
+ * @link http://codeigniter.com/user_guide/database/
+ */
+
+class CI_DB_pdo_driver extends CI_DB {
+
+ var $dbdriver = 'pdo';
+
+ // the character used to excape - not necessary for PDO
+ var $_escape_char = '';
+ var $_like_escape_str;
+ var $_like_escape_chr;
+
+
+ /**
+ * The syntax to count rows is slightly different across different
+ * database engines, so this string appears in each driver and is
+ * used for the count_all() and count_all_results() functions.
+ */
+ var $_count_string = "SELECT COUNT(*) AS ";
+ var $_random_keyword;
+
+ var $options = array();
+
+ function __construct($params)
+ {
+ parent::__construct($params);
+
+ // clause and character used for LIKE escape sequences
+ if (strpos($this->hostname, 'mysql') !== FALSE)
+ {
+ $this->_like_escape_str = '';
+ $this->_like_escape_chr = '';
+
+ //Prior to this version, the charset can't be set in the dsn
+ if(is_php('5.3.6'))
+ {
+ $this->hostname .= ";charset={$this->char_set}";
+ }
+
+ //Set the charset with the connection options
+ $this->options['PDO::MYSQL_ATTR_INIT_COMMAND'] = "SET NAMES {$this->char_set}";
+ }
+ else if (strpos($this->hostname, 'odbc') !== FALSE)
+ {
+ $this->_like_escape_str = " {escape '%s'} ";
+ $this->_like_escape_chr = '!';
+ }
+ else
+ {
+ $this->_like_escape_str = " ESCAPE '%s' ";
+ $this->_like_escape_chr = '!';
+ }
+
+ $this->hostname .= ";dbname=".$this->database;
+ $this->trans_enabled = FALSE;
+
+ $this->_random_keyword = ' RND('.time().')'; // database specific random keyword
+ }
+
+ /**
+ * Non-persistent database connection
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_connect()
+ {
+ $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT;
+
+ return new PDO($this->hostname, $this->username, $this->password, $this->options);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Persistent database connection
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_pconnect()
+ {
+ $this->options['PDO::ATTR_ERRMODE'] = PDO::ERRMODE_SILENT;
+ $this->options['PDO::ATTR_PERSISTENT'] = TRUE;
+
+ return new PDO($this->hostname, $this->username, $this->password, $this->options);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Reconnect
+ *
+ * Keep / reestablish the db connection if no queries have been
+ * sent for a length of time exceeding the server's idle timeout
+ *
+ * @access public
+ * @return void
+ */
+ function reconnect()
+ {
+ if ($this->db->db_debug)
+ {
+ return $this->db->display_error('db_unsuported_feature');
+ }
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Select the database
+ *
+ * @access private called by the base class
+ * @return resource
+ */
+ function db_select()
+ {
+ // Not needed for PDO
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set client character set
+ *
+ * @access public
+ * @param string
+ * @param string
+ * @return resource
+ */
+ function db_set_charset($charset, $collation)
+ {
+ // @todo - add support if needed
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Version number query string
+ *
+ * @access public
+ * @return string
+ */
+ function _version()
+ {
+ return $this->conn_id->getAttribute(PDO::ATTR_CLIENT_VERSION);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Execute the query
+ *
+ * @access private called by the base class
+ * @param string an SQL query
+ * @return object
+ */
+ function _execute($sql)
+ {
+ $sql = $this->_prep_query($sql);
+ $result_id = $this->conn_id->query($sql);
+
+ if (is_object($result_id))
+ {
+ $this->affect_rows = $result_id->rowCount();
+ }
+ else
+ {
+ $this->affect_rows = 0;
+ }
+
+ return $result_id;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Prep the query
+ *
+ * If needed, each database adapter can prep the query string
+ *
+ * @access private called by execute()
+ * @param string an SQL query
+ * @return string
+ */
+ function _prep_query($sql)
+ {
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Begin Transaction
+ *
+ * @access public
+ * @return bool
+ */
+ function trans_begin($test_mode = FALSE)
+ {
+ if ( ! $this->trans_enabled)
+ {
+ return TRUE;
+ }
+
+ // When transactions are nested we only begin/commit/rollback the outermost ones
+ if ($this->_trans_depth > 0)
+ {
+ return TRUE;
+ }
+
+ // Reset the transaction failure flag.
+ // If the $test_mode flag is set to TRUE transactions will be rolled back
+ // even if the queries produce a successful result.
+ $this->_trans_failure = (bool) ($test_mode === TRUE);
+
+ return $this->conn_id->beginTransaction();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Commit Transaction
+ *
+ * @access public
+ * @return bool
+ */
+ function trans_commit()
+ {
+ if ( ! $this->trans_enabled)
+ {
+ return TRUE;
+ }
+
+ // When transactions are nested we only begin/commit/rollback the outermost ones
+ if ($this->_trans_depth > 0)
+ {
+ return TRUE;
+ }
+
+ $ret = $this->conn->commit();
+ return $ret;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Rollback Transaction
+ *
+ * @access public
+ * @return bool
+ */
+ function trans_rollback()
+ {
+ if ( ! $this->trans_enabled)
+ {
+ return TRUE;
+ }
+
+ // When transactions are nested we only begin/commit/rollback the outermost ones
+ if ($this->_trans_depth > 0)
+ {
+ return TRUE;
+ }
+
+ $ret = $this->conn_id->rollBack();
+ return $ret;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Escape String
+ *
+ * @access public
+ * @param string
+ * @param bool whether or not the string will be used in a LIKE condition
+ * @return string
+ */
+ function escape_str($str, $like = FALSE)
+ {
+ if (is_array($str))
+ {
+ foreach ($str as $key => $val)
+ {
+ $str[$key] = $this->escape_str($val, $like);
+ }
+
+ return $str;
+ }
+
+ //Escape the string
+ $str = $this->conn_id->quote($str);
+
+ //If there are duplicated quotes, trim them away
+ if (strpos($str, "'") === 0)
+ {
+ $str = substr($str, 1, -1);
+ }
+
+ // escape LIKE condition wildcards
+ if ($like === TRUE)
+ {
+ $str = str_replace( array('%', '_', $this->_like_escape_chr),
+ array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
+ $str);
+ }
+
+ return $str;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Affected Rows
+ *
+ * @access public
+ * @return integer
+ */
+ function affected_rows()
+ {
+ return $this->affect_rows;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert ID
+ *
+ * @access public
+ * @return integer
+ */
+ function insert_id($name=NULL)
+ {
+ //Convenience method for postgres insertid
+ if (strpos($this->hostname, 'pgsql') !== FALSE)
+ {
+ $v = $this->_version();
+
+ $table = func_num_args() > 0 ? func_get_arg(0) : NULL;
+
+ if ($table == NULL && $v >= '8.1')
+ {
+ $sql='SELECT LASTVAL() as ins_id';
+ }
+ $query = $this->query($sql);
+ $row = $query->row();
+ return $row->ins_id;
+ }
+ else
+ {
+ return $this->conn_id->lastInsertId($name);
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * "Count All" query
+ *
+ * Generates a platform-specific query string that counts all records in
+ * the specified database
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ function count_all($table = '')
+ {
+ if ($table == '')
+ {
+ return 0;
+ }
+
+ $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
+
+ if ($query->num_rows() == 0)
+ {
+ return 0;
+ }
+
+ $row = $query->row();
+ $this->_reset_select();
+ return (int) $row->numrows;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Show table query
+ *
+ * Generates a platform-specific query string so that the table names can be fetched
+ *
+ * @access private
+ * @param boolean
+ * @return string
+ */
+ function _list_tables($prefix_limit = FALSE)
+ {
+ $sql = "SHOW TABLES FROM `".$this->database."`";
+
+ if ($prefix_limit !== FALSE AND $this->dbprefix != '')
+ {
+ //$sql .= " LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
+ return FALSE; // not currently supported
+ }
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Show column query
+ *
+ * Generates a platform-specific query string so that the column names can be fetched
+ *
+ * @access public
+ * @param string the table name
+ * @return string
+ */
+ function _list_columns($table = '')
+ {
+ return "SHOW COLUMNS FROM ".$table;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Field data query
+ *
+ * Generates a platform-specific query so that the column data can be retrieved
+ *
+ * @access public
+ * @param string the table name
+ * @return object
+ */
+ function _field_data($table)
+ {
+ return "SELECT TOP 1 FROM ".$table;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * The error message string
+ *
+ * @access private
+ * @return string
+ */
+ function _error_message()
+ {
+ $error_array = $this->conn_id->errorInfo();
+ return $error_array[2];
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * The error message number
+ *
+ * @access private
+ * @return integer
+ */
+ function _error_number()
+ {
+ return $this->conn_id->errorCode();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Escape the SQL Identifiers
+ *
+ * This function escapes column and table names
+ *
+ * @access private
+ * @param string
+ * @return string
+ */
+ function _escape_identifiers($item)
+ {
+ if ($this->_escape_char == '')
+ {
+ return $item;
+ }
+
+ foreach ($this->_reserved_identifiers as $id)
+ {
+ if (strpos($item, '.'.$id) !== FALSE)
+ {
+ $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
+
+ // remove duplicates if the user already included the escape
+ return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
+ }
+ }
+
+ if (strpos($item, '.') !== FALSE)
+ {
+ $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
+
+ }
+ else
+ {
+ $str = $this->_escape_char.$item.$this->_escape_char;
+ }
+
+ // remove duplicates if the user already included the escape
+ return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * From Tables
+ *
+ * This function implicitly groups FROM tables so there is no confusion
+ * about operator precedence in harmony with SQL standards
+ *
+ * @access public
+ * @param type
+ * @return type
+ */
+ function _from_tables($tables)
+ {
+ if ( ! is_array($tables))
+ {
+ $tables = array($tables);
+ }
+
+ return (count($tables) == 1) ? $tables[0] : '('.implode(', ', $tables).')';
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _insert($table, $keys, $values)
+ {
+ return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Insert_batch statement
+ *
+ * Generates a platform-specific insert string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the insert keys
+ * @param array the insert values
+ * @return string
+ */
+ function _insert_batch($table, $keys, $values)
+ {
+ return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Update statement
+ *
+ * Generates a platform-specific update string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the update data
+ * @param array the where clause
+ * @param array the orderby clause
+ * @param array the limit clause
+ * @return string
+ */
+ function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
+ {
+ foreach ($values as $key => $val)
+ {
+ $valstr[] = $key." = ".$val;
+ }
+
+ $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+
+ $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
+
+ $sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
+
+ $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
+
+ $sql .= $orderby.$limit;
+
+ return $sql;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Update_Batch statement
+ *
+ * Generates a platform-specific batch update string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the update data
+ * @param array the where clause
+ * @return string
+ */
+ function _update_batch($table, $values, $index, $where = NULL)
+ {
+ $ids = array();
+ $where = ($where != '' AND count($where) >=1) ? implode(" ", $where).' AND ' : '';
+
+ foreach ($values as $key => $val)
+ {
+ $ids[] = $val[$index];
+
+ foreach (array_keys($val) as $field)
+ {
+ if ($field != $index)
+ {
+ $final[$field][] = 'WHEN '.$index.' = '.$val[$index].' THEN '.$val[$field];
+ }
+ }
+ }
+
+ $sql = "UPDATE ".$table." SET ";
+ $cases = '';
+
+ foreach ($final as $k => $v)
+ {
+ $cases .= $k.' = CASE '."\n";
+ foreach ($v as $row)
+ {
+ $cases .= $row."\n";
+ }
+
+ $cases .= 'ELSE '.$k.' END, ';
+ }
+
+ $sql .= substr($cases, 0, -2);
+
+ $sql .= ' WHERE '.$where.$index.' IN ('.implode(',', $ids).')';
+
+ return $sql;
+ }
+
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Truncate statement
+ *
+ * Generates a platform-specific truncate string from the supplied data
+ * If the database does not support the truncate() command
+ * This function maps to "DELETE FROM table"
+ *
+ * @access public
+ * @param string the table name
+ * @return string
+ */
+ function _truncate($table)
+ {
+ return $this->_delete($table);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Delete statement
+ *
+ * Generates a platform-specific delete string from the supplied data
+ *
+ * @access public
+ * @param string the table name
+ * @param array the where clause
+ * @param string the limit clause
+ * @return string
+ */
+ function _delete($table, $where = array(), $like = array(), $limit = FALSE)
+ {
+ $conditions = '';
+
+ if (count($where) > 0 OR count($like) > 0)
+ {
+ $conditions = "\nWHERE ";
+ $conditions .= implode("\n", $this->ar_where);
+
+ if (count($where) > 0 && count($like) > 0)
+ {
+ $conditions .= " AND ";
+ }
+ $conditions .= implode("\n", $like);
+ }
+
+ $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
+
+ return "DELETE FROM ".$table.$conditions.$limit;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Limit string
+ *
+ * Generates a platform-specific LIMIT clause
+ *
+ * @access public
+ * @param string the sql query string
+ * @param integer the number of rows to limit the query to
+ * @param integer the offset value
+ * @return string
+ */
+ function _limit($sql, $limit, $offset)
+ {
+ if (strpos($this->hostname, 'cubrid') !== FALSE || strpos($this->hostname, 'sqlite') !== FALSE)
+ {
+ if ($offset == 0)
+ {
+ $offset = '';
+ }
+ else
+ {
+ $offset .= ", ";
+ }
+
+ return $sql."LIMIT ".$offset.$limit;
+ }
+ else
+ {
+ $sql .= "LIMIT ".$limit;
+
+ if ($offset > 0)
+ {
+ $sql .= " OFFSET ".$offset;
+ }
+
+ return $sql;
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Close DB Connection
+ *
+ * @access public
+ * @param resource
+ * @return void
+ */
+ function _close($conn_id)
+ {
+ $this->conn_id = null;
+ }
+
+
+}
+
+
+
+/* End of file pdo_driver.php */
+/* Location: ./system/database/drivers/pdo/pdo_driver.php */ \ No newline at end of file
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 140396885..5367f9759 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -385,6 +385,7 @@ class CI_DB_postgre_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index eb4e585b3..0cc898b38 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -354,6 +354,7 @@ class CI_DB_sqlite_driver extends CI_DB {
}
$row = $query->row();
+ $this->_reset_select();
return (int) $row->numrows;
}
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 1d32792ce..400fd31c6 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -344,6 +344,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
return '0';
$row = $query->row();
+ $this->_reset_select();
return $row->numrows;
}
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 553e8d7ee..0aeb7fafb 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -116,7 +116,7 @@ if ( ! function_exists('standard_date'))
'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC',
'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q',
'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O',
- 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC',
+ 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC',
'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O',
'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O',
'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O',
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 2925d3c7c..d9305c00b 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -64,8 +64,8 @@ if ( ! function_exists('form_open'))
$form .= '>';
- // CSRF
- if ($CI->config->item('csrf_protection') === TRUE)
+ // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
+ if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->site_url()) === FALSE OR strpos($form, 'method="get"')))
{
$hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}
@@ -94,7 +94,7 @@ if ( ! function_exists('form_open'))
*/
if ( ! function_exists('form_open_multipart'))
{
- function form_open_multipart($action, $attributes = array(), $hidden = array())
+ function form_open_multipart($action = '', $attributes = array(), $hidden = array())
{
if (is_string($attributes))
{
@@ -249,7 +249,7 @@ if ( ! function_exists('form_textarea'))
{
function form_textarea($data = '', $value = '', $extra = '')
{
- $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '90', 'rows' => '12');
+ $defaults = array('name' => (( ! is_array($data)) ? $data : ''), 'cols' => '40', 'rows' => '10');
if ( ! is_array($data) OR ! isset($data['value']))
{
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php
index 7765bba31..9fa69f46c 100644
--- a/system/helpers/string_helper.php
+++ b/system/helpers/string_helper.php
@@ -243,6 +243,23 @@ if ( ! function_exists('random_string'))
// ------------------------------------------------------------------------
/**
+ * Add's _1 to a string or increment the ending number to allow _2, _3, etc
+ *
+ * @param string $str required
+ * @param string $separator What should the duplicate number be appended with
+ * @param string $first Which number should be used for the first dupe increment
+ * @return string
+ */
+function increment_string($str, $separator = '_', $first = 1)
+{
+ preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
+
+ return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
+}
+
+// ------------------------------------------------------------------------
+
+/**
* Alternator
*
* Allows strings to be alternated. See docs...
diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php
index 3f2409007..3418f29ab 100644
--- a/system/language/english/form_validation_lang.php
+++ b/system/language/english/form_validation_lang.php
@@ -17,6 +17,7 @@ $lang['is_numeric'] = "The %s field must contain only numeric characters.";
$lang['integer'] = "The %s field must contain an integer.";
$lang['regex_match'] = "The %s field is not in the correct format.";
$lang['matches'] = "The %s field does not match the %s field.";
+$lang['is_unique'] = "The %s field must contain a unique value.";
$lang['is_natural'] = "The %s field must contain only positive numbers.";
$lang['is_natural_no_zero'] = "The %s field must contain a number greater than zero.";
$lang['decimal'] = "The %s field must contain a decimal number.";
diff --git a/system/language/english/migration_lang.php b/system/language/english/migration_lang.php
new file mode 100644
index 000000000..4763ca243
--- /dev/null
+++ b/system/language/english/migration_lang.php
@@ -0,0 +1,13 @@
+<?php
+
+$lang['migration_none_found'] = "No migrations were found.";
+$lang['migration_not_found'] = "This migration could not be found.";
+$lang['migration_multiple_version'] = "This are multiple migrations with the same version number: %d.";
+$lang['migration_class_doesnt_exist'] = "The migration class \"%s\" could not be found.";
+$lang['migration_missing_up_method'] = "The migration class \"%s\" is missing an 'up' method.";
+$lang['migration_missing_down_method'] = "The migration class \"%s\" is missing an 'up' method.";
+$lang['migration_invalid_filename'] = "Migration \"%s\" has an invalid filename.";
+
+
+/* End of file migration_lang.php */
+/* Location: ./system/language/english/migration_lang.php */ \ No newline at end of file
diff --git a/system/libraries/Cache/drivers/Cache_apc.php b/system/libraries/Cache/drivers/Cache_apc.php
index de75719c4..79d91b320 100644
--- a/system/libraries/Cache/drivers/Cache_apc.php
+++ b/system/libraries/Cache/drivers/Cache_apc.php
@@ -132,7 +132,7 @@ class CI_Cache_apc extends CI_Driver {
*/
public function is_supported()
{
- if ( ! extension_loaded('apc') OR ! function_exists('apc_store'))
+ if ( ! extension_loaded('apc') OR ini_get('apc.enabled') != "1")
{
log_message('error', 'The APC PHP extension must be loaded to use APC Cache.');
return FALSE;
@@ -148,4 +148,4 @@ class CI_Cache_apc extends CI_Driver {
// End Class
/* End of file Cache_apc.php */
-/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */ \ No newline at end of file
+/* Location: ./system/libraries/Cache/drivers/Cache_apc.php */
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index ec2fd216a..fc586e025 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -64,7 +64,16 @@ class CI_Cache_memcached extends CI_Driver {
*/
public function save($id, $data, $ttl = 60)
{
- return $this->_memcached->add($id, array($data, time(), $ttl), $ttl);
+ if (get_class($this->_memcached) == 'Memcached')
+ {
+ return $this->_memcached->set($id, array($data, time(), $ttl), $ttl);
+ }
+ else if (get_class($this->_memcached) == 'Memcache')
+ {
+ return $this->_memcached->set($id, array($data, time(), $ttl), 0, $ttl);
+ }
+
+ return FALSE;
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index b2eaa9ad7..ab5a70c98 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -99,7 +99,7 @@ class CI_Cart {
$save_cart = FALSE;
if (isset($items['id']))
{
- if ($this->_insert($items) == TRUE)
+ if (($rowid = $this->_insert($items)))
{
$save_cart = TRUE;
}
@@ -110,7 +110,7 @@ class CI_Cart {
{
if (is_array($val) AND isset($val['id']))
{
- if ($this->_insert($val) == TRUE)
+ if ($this->_insert($val))
{
$save_cart = TRUE;
}
@@ -122,7 +122,7 @@ class CI_Cart {
if ($save_cart == TRUE)
{
$this->_save_cart();
- return TRUE;
+ return isset($rowid) ? $rowid : TRUE;
}
return FALSE;
@@ -244,7 +244,7 @@ class CI_Cart {
}
// Woot!
- return TRUE;
+ return $rowid;
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index c32f2c1eb..9881c1eec 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -54,7 +54,7 @@ class CI_Driver_Library {
if ( ! class_exists($child_class))
{
// check application path first
- foreach (array(APPPATH, BASEPATH) as $path)
+ foreach (get_instance()->load->get_package_paths(TRUE) as $path)
{
// loves me some nesting!
foreach (array(ucfirst($driver_name), $driver_name) as $class)
@@ -226,4 +226,4 @@ class CI_Driver {
// END CI_Driver CLASS
/* End of file Driver.php */
-/* Location: ./system/libraries/Driver.php */
+/* Location: ./system/libraries/Driver.php */ \ No newline at end of file
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 03eccea09..9ec40af9d 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -36,6 +36,7 @@ class CI_Email {
var $smtp_pass = ""; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 5; // SMTP Timeout in seconds
+ var $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl.
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "text"; // text/html Defines email formatting
@@ -379,7 +380,19 @@ class CI_Email {
*/
public function message($body)
{
- $this->_body = stripslashes(rtrim(str_replace("\r", "", $body)));
+ $this->_body = rtrim(str_replace("\r", "", $body));
+
+ /* strip slashes only if magic quotes is ON
+ if we do it with magic quotes OFF, it strips real, user-inputted chars.
+
+ NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
+ it will probably not exist in future versions at all.
+ */
+ if ( ! is_php('5.4') && get_magic_quotes_gpc())
+ {
+ $this->_body = stripslashes($this->_body);
+ }
+
return $this;
}
@@ -405,12 +418,12 @@ class CI_Email {
/**
* Add a Header Item
*
- * @access private
+ * @access protected
* @param string
* @param string
* @return void
*/
- private function _set_header($header, $value)
+ protected function _set_header($header, $value)
{
$this->_headers[$header] = $value;
}
@@ -420,11 +433,11 @@ class CI_Email {
/**
* Convert a String to an Array
*
- * @access private
+ * @access protected
* @param string
* @return array
*/
- private function _str_to_array($email)
+ protected function _str_to_array($email)
{
if ( ! is_array($email))
{
@@ -452,7 +465,7 @@ class CI_Email {
*/
public function set_alt_message($str = '')
{
- $this->alt_message = ($str == '') ? '' : $str;
+ $this->alt_message = $str;
return $this;
}
@@ -577,10 +590,10 @@ class CI_Email {
/**
* Set Message Boundary
*
- * @access private
+ * @access protected
* @return void
*/
- private function _set_boundaries()
+ protected function _set_boundaries()
{
$this->_alt_boundary = "B_ALT_".uniqid(''); // multipart/alternative
$this->_atc_boundary = "B_ATC_".uniqid(''); // attachment boundary
@@ -591,10 +604,10 @@ class CI_Email {
/**
* Get the Message ID
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_message_id()
+ protected function _get_message_id()
{
$from = $this->_headers['Return-Path'];
$from = str_replace(">", "", $from);
@@ -608,11 +621,11 @@ class CI_Email {
/**
* Get Mail Protocol
*
- * @access private
+ * @access protected
* @param bool
* @return string
*/
- private function _get_protocol($return = TRUE)
+ protected function _get_protocol($return = TRUE)
{
$this->protocol = strtolower($this->protocol);
$this->protocol = ( ! in_array($this->protocol, $this->_protocols, TRUE)) ? 'mail' : $this->protocol;
@@ -628,11 +641,11 @@ class CI_Email {
/**
* Get Mail Encoding
*
- * @access private
+ * @access protected
* @param bool
* @return string
*/
- private function _get_encoding($return = TRUE)
+ protected function _get_encoding($return = TRUE)
{
$this->_encoding = ( ! in_array($this->_encoding, $this->_bit_depths)) ? '8bit' : $this->_encoding;
@@ -655,10 +668,10 @@ class CI_Email {
/**
* Get content type (text/html/attachment)
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_content_type()
+ protected function _get_content_type()
{
if ($this->mailtype == 'html' && count($this->_attach_name) == 0)
{
@@ -683,10 +696,10 @@ class CI_Email {
/**
* Set RFC 822 Date
*
- * @access private
+ * @access protected
* @return string
*/
- private function _set_date()
+ protected function _set_date()
{
$timezone = date("Z");
$operator = (strncmp($timezone, '-', 1) == 0) ? '-' : '+';
@@ -701,10 +714,10 @@ class CI_Email {
/**
* Mime message
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_mime_message()
+ protected function _get_mime_message()
{
return "This is a multi-part message in MIME format.".$this->newline."Your email application may not support this format.";
}
@@ -802,10 +815,10 @@ class CI_Email {
* If the user hasn't specified his own alternative message
* it creates one by stripping the HTML
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_alt_message()
+ protected function _get_alt_message()
{
if ($this->alt_message != "")
{
@@ -941,11 +954,11 @@ class CI_Email {
/**
* Build final headers
*
- * @access private
+ * @access protected
* @param string
* @return string
*/
- private function _build_headers()
+ protected function _build_headers()
{
$this->_set_header('X-Sender', $this->clean_email($this->_headers['From']));
$this->_set_header('X-Mailer', $this->useragent);
@@ -959,10 +972,10 @@ class CI_Email {
/**
* Write Headers as a string
*
- * @access private
+ * @access protected
* @return void
*/
- private function _write_headers()
+ protected function _write_headers()
{
if ($this->protocol == 'mail')
{
@@ -994,10 +1007,10 @@ class CI_Email {
/**
* Build Final Body and attachments
*
- * @access private
+ * @access protected
* @return void
*/
- private function _build_message()
+ protected function _build_message()
{
if ($this->wordwrap === TRUE AND $this->mailtype != 'html')
{
@@ -1177,12 +1190,12 @@ class CI_Email {
* Prepares string for Quoted-Printable Content-Transfer-Encoding
* Refer to RFC 2045 http://www.ietf.org/rfc/rfc2045.txt
*
- * @access private
+ * @access protected
* @param string
* @param integer
* @return string
*/
- private function _prep_quoted_printable($str, $charlim = '')
+ protected function _prep_quoted_printable($str, $charlim = '')
{
// Set the character limit
// Don't allow over 76, as that will make servers and MUAs barf
@@ -1275,7 +1288,7 @@ class CI_Email {
* @param bool // set to TRUE for processing From: headers
* @return str
*/
- private function _prep_q_encoding($str, $from = FALSE)
+ protected function _prep_q_encoding($str, $from = FALSE)
{
$str = str_replace(array("\r", "\n"), array('', ''), $str);
@@ -1440,10 +1453,10 @@ class CI_Email {
/**
* Unwrap special elements
*
- * @access private
+ * @access protected
* @return void
*/
- private function _unwrap_specials()
+ protected function _unwrap_specials()
{
$this->_finalbody = preg_replace_callback("/\{unwrap\}(.*?)\{\/unwrap\}/si", array($this, '_remove_nl_callback'), $this->_finalbody);
}
@@ -1453,10 +1466,10 @@ class CI_Email {
/**
* Strip line-breaks via callback
*
- * @access private
+ * @access protected
* @return string
*/
- private function _remove_nl_callback($matches)
+ protected function _remove_nl_callback($matches)
{
if (strpos($matches[1], "\r") !== FALSE OR strpos($matches[1], "\n") !== FALSE)
{
@@ -1471,10 +1484,10 @@ class CI_Email {
/**
* Spool mail to the mail server
*
- * @access private
+ * @access protected
* @return bool
*/
- private function _spool_email()
+ protected function _spool_email()
{
$this->_unwrap_specials();
@@ -1516,10 +1529,10 @@ class CI_Email {
/**
* Send using mail()
*
- * @access private
+ * @access protected
* @return bool
*/
- private function _send_with_mail()
+ protected function _send_with_mail()
{
if ($this->_safe_mode == TRUE)
{
@@ -1553,10 +1566,10 @@ class CI_Email {
/**
* Send using Sendmail
*
- * @access private
+ * @access protected
* @return bool
*/
- private function _send_with_sendmail()
+ protected function _send_with_sendmail()
{
$fp = @popen($this->mailpath . " -oi -f ".$this->clean_email($this->_headers['From'])." -t", 'w');
@@ -1591,10 +1604,10 @@ class CI_Email {
/**
* Send using SMTP
*
- * @access private
+ * @access protected
* @return bool
*/
- private function _send_with_smtp()
+ protected function _send_with_smtp()
{
if ($this->smtp_host == '')
{
@@ -1660,13 +1673,16 @@ class CI_Email {
/**
* SMTP Connect
*
- * @access private
+ * @access protected
* @param string
* @return string
*/
- private function _smtp_connect()
+ protected function _smtp_connect()
{
- $this->_smtp_connect = fsockopen($this->smtp_host,
+ $ssl = NULL;
+ if ($this->smtp_crypto == 'ssl')
+ $ssl = 'ssl://';
+ $this->_smtp_connect = fsockopen($ssl.$this->smtp_host,
$this->smtp_port,
$errno,
$errstr,
@@ -1679,6 +1695,14 @@ class CI_Email {
}
$this->_set_error_message($this->_get_smtp_data());
+
+ if ($this->smtp_crypto == 'tls')
+ {
+ $this->_send_command('hello');
+ $this->_send_command('starttls');
+ stream_socket_enable_crypto($this->_smtp_connect, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT);
+ }
+
return $this->_send_command('hello');
}
@@ -1687,12 +1711,12 @@ class CI_Email {
/**
* Send SMTP command
*
- * @access private
+ * @access protected
* @param string
* @param string
* @return string
*/
- private function _send_command($cmd, $data = '')
+ protected function _send_command($cmd, $data = '')
{
switch ($cmd)
{
@@ -1705,6 +1729,12 @@ class CI_Email {
$resp = 250;
break;
+ case 'starttls' :
+
+ $this->_send_data('STARTTLS');
+
+ $resp = 220;
+ break;
case 'from' :
$this->_send_data('MAIL FROM:<'.$data.'>');
@@ -1754,10 +1784,10 @@ class CI_Email {
/**
* SMTP Authenticate
*
- * @access private
+ * @access protected
* @return bool
*/
- private function _smtp_authenticate()
+ protected function _smtp_authenticate()
{
if ( ! $this->_smtp_auth)
{
@@ -1808,10 +1838,10 @@ class CI_Email {
/**
* Send SMTP data
*
- * @access private
+ * @access protected
* @return bool
*/
- private function _send_data($data)
+ protected function _send_data($data)
{
if ( ! fwrite($this->_smtp_connect, $data . $this->newline))
{
@@ -1829,10 +1859,10 @@ class CI_Email {
/**
* Get SMTP data
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_smtp_data()
+ protected function _get_smtp_data()
{
$data = "";
@@ -1854,10 +1884,10 @@ class CI_Email {
/**
* Get Hostname
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_hostname()
+ protected function _get_hostname()
{
return (isset($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : 'localhost.localdomain';
}
@@ -1867,10 +1897,10 @@ class CI_Email {
/**
* Get IP
*
- * @access private
+ * @access protected
* @return string
*/
- private function _get_ip()
+ protected function _get_ip()
{
if ($this->_IP !== FALSE)
{
@@ -1933,11 +1963,11 @@ class CI_Email {
/**
* Set Message
*
- * @access private
+ * @access protected
* @param string
* @return string
*/
- private function _set_error_message($msg, $val = '')
+ protected function _set_error_message($msg, $val = '')
{
$CI =& get_instance();
$CI->lang->load('email');
@@ -1957,11 +1987,11 @@ class CI_Email {
/**
* Mime Types
*
- * @access private
+ * @access protected
* @param string
* @return string
*/
- private function _mime_types($ext = "")
+ protected function _mime_types($ext = "")
{
$mimes = array( 'hqx' => 'application/mac-binhex40',
'cpt' => 'application/mac-compactpro',
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 6f79a554a..a34809e05 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -26,16 +26,15 @@
*/
class CI_Form_validation {
- var $CI;
- var $_field_data = array();
- var $_config_rules = array();
- var $_error_array = array();
- var $_error_messages = array();
- var $_error_prefix = '<p>';
- var $_error_suffix = '</p>';
- var $error_string = '';
- var $_safe_form_data = FALSE;
-
+ protected $CI;
+ protected $_field_data = array();
+ protected $_config_rules = array();
+ protected $_error_array = array();
+ protected $_error_messages = array();
+ protected $_error_prefix = '<p>';
+ protected $_error_suffix = '</p>';
+ protected $error_string = '';
+ protected $_safe_form_data = FALSE;
/**
* Constructor
@@ -72,7 +71,7 @@ class CI_Form_validation {
* @param string
* @return void
*/
- function set_rules($field, $label = '', $rules = '')
+ public function set_rules($field, $label = '', $rules = '')
{
// No reason to set rules if we have no POST data
if (count($_POST) == 0)
@@ -163,7 +162,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function set_message($lang, $val = '')
+ public function set_message($lang, $val = '')
{
if ( ! is_array($lang))
{
@@ -187,7 +186,7 @@ class CI_Form_validation {
* @param string
* @return void
*/
- function set_error_delimiters($prefix = '<p>', $suffix = '</p>')
+ public function set_error_delimiters($prefix = '<p>', $suffix = '</p>')
{
$this->_error_prefix = $prefix;
$this->_error_suffix = $suffix;
@@ -206,7 +205,7 @@ class CI_Form_validation {
* @param string the field name
* @return void
*/
- function error($field = '', $prefix = '', $suffix = '')
+ public function error($field = '', $prefix = '', $suffix = '')
{
if ( ! isset($this->_field_data[$field]['error']) OR $this->_field_data[$field]['error'] == '')
{
@@ -238,7 +237,7 @@ class CI_Form_validation {
* @param string
* @return str
*/
- function error_string($prefix = '', $suffix = '')
+ public function error_string($prefix = '', $suffix = '')
{
// No errrors, validation passes!
if (count($this->_error_array) === 0)
@@ -279,7 +278,7 @@ class CI_Form_validation {
* @access public
* @return bool
*/
- function run($group = '')
+ public function run($group = '')
{
// Do we even have any data to process? Mm?
if (count($_POST) == 0)
@@ -374,7 +373,7 @@ class CI_Form_validation {
* @param integer
* @return mixed
*/
- function _reduce_array($array, $keys, $i = 0)
+ protected function _reduce_array($array, $keys, $i = 0)
{
if (is_array($array))
{
@@ -406,7 +405,7 @@ class CI_Form_validation {
* @access private
* @return null
*/
- function _reset_post_array()
+ protected function _reset_post_array()
{
foreach ($this->_field_data as $field => $row)
{
@@ -468,7 +467,7 @@ class CI_Form_validation {
* @param integer
* @return mixed
*/
- function _execute($row, $rules, $postdata = NULL, $cycles = 0)
+ protected function _execute($row, $rules, $postdata = NULL, $cycles = 0)
{
// If the $_POST data is an array we will run a recursive call
if (is_array($postdata))
@@ -489,7 +488,7 @@ class CI_Form_validation {
if ( ! in_array('required', $rules) AND is_null($postdata))
{
// Before we bail out, does the rule contain a callback?
- if (preg_match("/(callback_\w+)/", implode(' ', $rules), $match))
+ if (preg_match("/(callback_\w+(\[.*?\])?)/", implode(' ', $rules), $match))
{
$callback = TRUE;
$rules = (array('1' => $match[1]));
@@ -695,7 +694,7 @@ class CI_Form_validation {
* @param string the field name
* @return string
*/
- function _translate_fieldname($fieldname)
+ protected function _translate_fieldname($fieldname)
{
// Do we need to translate the field name?
// We look for the prefix lang: to determine this
@@ -727,7 +726,7 @@ class CI_Form_validation {
* @param string
* @return void
*/
- function set_value($field = '', $default = '')
+ public function set_value($field = '', $default = '')
{
if ( ! isset($this->_field_data[$field]))
{
@@ -757,7 +756,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function set_select($field = '', $value = '', $default = FALSE)
+ public function set_select($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
{
@@ -801,7 +800,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function set_radio($field = '', $value = '', $default = FALSE)
+ public function set_radio($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
{
@@ -845,7 +844,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function set_checkbox($field = '', $value = '', $default = FALSE)
+ public function set_checkbox($field = '', $value = '', $default = FALSE)
{
if ( ! isset($this->_field_data[$field]) OR ! isset($this->_field_data[$field]['postdata']))
{
@@ -885,7 +884,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function required($str)
+ public function required($str)
{
if ( ! is_array($str))
{
@@ -907,7 +906,7 @@ class CI_Form_validation {
* @param regex
* @return bool
*/
- function regex_match($str, $regex)
+ public function regex_match($str, $regex)
{
if ( ! preg_match($regex, $str))
{
@@ -927,7 +926,7 @@ class CI_Form_validation {
* @param field
* @return bool
*/
- function matches($str, $field)
+ public function matches($str, $field)
{
if ( ! isset($_POST[$field]))
{
@@ -938,6 +937,24 @@ class CI_Form_validation {
return ($str !== $field) ? FALSE : TRUE;
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Match one field to another
+ *
+ * @access public
+ * @param string
+ * @param field
+ * @return bool
+ */
+ public function is_unique($str, $field)
+ {
+ list($table, $field)=explode('.', $field);
+ $query = $this->CI->db->limit(1)->get_where($table, array($field => $str));
+
+ return $query->num_rows() === 0;
+ }
// --------------------------------------------------------------------
@@ -949,7 +966,7 @@ class CI_Form_validation {
* @param value
* @return bool
*/
- function min_length($str, $val)
+ public function min_length($str, $val)
{
if (preg_match("/[^0-9]/", $val))
{
@@ -974,7 +991,7 @@ class CI_Form_validation {
* @param value
* @return bool
*/
- function max_length($str, $val)
+ public function max_length($str, $val)
{
if (preg_match("/[^0-9]/", $val))
{
@@ -999,7 +1016,7 @@ class CI_Form_validation {
* @param value
* @return bool
*/
- function exact_length($str, $val)
+ public function exact_length($str, $val)
{
if (preg_match("/[^0-9]/", $val))
{
@@ -1023,7 +1040,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function valid_email($str)
+ public function valid_email($str)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
}
@@ -1037,7 +1054,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function valid_emails($str)
+ public function valid_emails($str)
{
if (strpos($str, ',') === FALSE)
{
@@ -1064,7 +1081,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function valid_ip($ip)
+ public function valid_ip($ip)
{
return $this->CI->input->valid_ip($ip);
}
@@ -1078,7 +1095,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function alpha($str)
+ public function alpha($str)
{
return ( ! preg_match("/^([a-z])+$/i", $str)) ? FALSE : TRUE;
}
@@ -1092,7 +1109,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function alpha_numeric($str)
+ public function alpha_numeric($str)
{
return ( ! preg_match("/^([a-z0-9])+$/i", $str)) ? FALSE : TRUE;
}
@@ -1106,7 +1123,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function alpha_dash($str)
+ public function alpha_dash($str)
{
return ( ! preg_match("/^([-a-z0-9_-])+$/i", $str)) ? FALSE : TRUE;
}
@@ -1120,7 +1137,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function numeric($str)
+ public function numeric($str)
{
return (bool)preg_match( '/^[\-+]?[0-9]*\.?[0-9]+$/', $str);
@@ -1135,7 +1152,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function is_numeric($str)
+ public function is_numeric($str)
{
return ( ! is_numeric($str)) ? FALSE : TRUE;
}
@@ -1149,7 +1166,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function integer($str)
+ public function integer($str)
{
return (bool) preg_match('/^[\-+]?[0-9]+$/', $str);
}
@@ -1163,7 +1180,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function decimal($str)
+ public function decimal($str)
{
return (bool) preg_match('/^[\-+]?[0-9]+\.[0-9]+$/', $str);
}
@@ -1177,7 +1194,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function greater_than($str, $min)
+ public function greater_than($str, $min)
{
if ( ! is_numeric($str))
{
@@ -1195,7 +1212,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function less_than($str, $max)
+ public function less_than($str, $max)
{
if ( ! is_numeric($str))
{
@@ -1213,7 +1230,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function is_natural($str)
+ public function is_natural($str)
{
return (bool) preg_match( '/^[0-9]+$/', $str);
}
@@ -1227,7 +1244,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function is_natural_no_zero($str)
+ public function is_natural_no_zero($str)
{
if ( ! preg_match( '/^[0-9]+$/', $str))
{
@@ -1254,7 +1271,7 @@ class CI_Form_validation {
* @param string
* @return bool
*/
- function valid_base64($str)
+ public function valid_base64($str)
{
return (bool) ! preg_match('/[^a-zA-Z0-9\/\+=]/', $str);
}
@@ -1271,7 +1288,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function prep_for_form($data = '')
+ public function prep_for_form($data = '')
{
if (is_array($data))
{
@@ -1300,7 +1317,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function prep_url($str = '')
+ public function prep_url($str = '')
{
if ($str == 'http://' OR $str == '')
{
@@ -1324,7 +1341,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function strip_image_tags($str)
+ public function strip_image_tags($str)
{
return $this->CI->input->strip_image_tags($str);
}
@@ -1338,7 +1355,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function xss_clean($str)
+ public function xss_clean($str)
{
return $this->CI->security->xss_clean($str);
}
@@ -1352,7 +1369,7 @@ class CI_Form_validation {
* @param string
* @return string
*/
- function encode_php_tags($str)
+ public function encode_php_tags($str)
{
return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
}
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
new file mode 100644
index 000000000..3943ec130
--- /dev/null
+++ b/system/libraries/Migration.php
@@ -0,0 +1,338 @@
+<?php defined('BASEPATH') OR exit('No direct script access allowed');
+/**
+ * CodeIgniter
+ *
+ * An open source application development framework for PHP 5.1.6 or newer
+ *
+ * @package CodeIgniter
+ * @author EllisLab Dev Team
+ * @copyright Copyright (c) 2006 - 2011, EllisLab, Inc.
+ * @license http://codeigniter.com/user_guide/license.html
+ * @link http://codeigniter.com
+ * @since Version 1.0
+ * @filesource
+ */
+
+// ------------------------------------------------------------------------
+
+/**
+ * Migration Class
+ *
+ * All migrations should implement this, forces up() and down() and gives
+ * access to the CI super-global.
+ *
+ * @package CodeIgniter
+ * @subpackage Libraries
+ * @category Libraries
+ * @author Reactor Engineers
+ * @link
+ */
+class CI_Migration {
+
+ protected $_migration_enabled = FALSE;
+ protected $_migration_path = NULL;
+ protected $_migration_version = 0;
+
+ protected $_error_string = '';
+
+ public function __construct($config = array())
+ {
+ # Only run this constructor on main library load
+ if (get_parent_class($this) !== FALSE)
+ {
+ return;
+ }
+
+ foreach ($config as $key => $val)
+ {
+ $this->{'_' . $key} = $val;
+ }
+
+ log_message('debug', 'Migrations class initialized');
+
+ // Are they trying to use migrations while it is disabled?
+ if ($this->_migration_enabled !== TRUE)
+ {
+ show_error('Migrations has been loaded but is disabled or set up incorrectly.');
+ }
+
+ // If not set, set it
+ $this->_migration_path == '' OR $this->_migration_path = APPPATH . 'migrations/';
+
+ // Add trailing slash if not set
+ $this->_migration_path = rtrim($this->_migration_path, '/').'/';
+
+ // Load migration language
+ $this->lang->load('migration');
+
+ // They'll probably be using dbforge
+ $this->load->dbforge();
+
+ // If the migrations table is missing, make it
+ if ( ! $this->db->table_exists('migrations'))
+ {
+ $this->dbforge->add_field(array(
+ 'version' => array('type' => 'INT', 'constraint' => 3),
+ ));
+
+ $this->dbforge->create_table('migrations', TRUE);
+
+ $this->db->insert('migrations', array('version' => 0));
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Migrate to a schema version
+ *
+ * Calls each migration step required to get to the schema version of
+ * choice
+ *
+ * @access public
+ * @param $version integer Target schema version
+ * @return mixed TRUE if already latest, FALSE if failed, int if upgraded
+ */
+ public function version($target_version)
+ {
+ $start = $current_version = $this->_get_version();
+ $stop = $target_version;
+
+ if ($target_version > $current_version)
+ {
+ // Moving Up
+ ++$start;
+ ++$stop;
+ $step = 1;
+ }
+
+ else
+ {
+ // Moving Down
+ $step = -1;
+ }
+
+ $method = $step === 1 ? 'up' : 'down';
+ $migrations = array();
+
+ // We now prepare to actually DO the migrations
+ // But first let's make sure that everything is the way it should be
+ for ($i = $start; $i != $stop; $i += $step)
+ {
+ $f = glob(sprintf($this->_migration_path . '%03d_*.php', $i));
+
+ // Only one migration per step is permitted
+ if (count($f) > 1)
+ {
+ $this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $i);
+ return FALSE;
+ }
+
+ // Migration step not found
+ if (count($f) == 0)
+ {
+ // If trying to migrate up to a version greater than the last
+ // existing one, migrate to the last one.
+ if ($step == 1)
+ {
+ break;
+ }
+
+ // If trying to migrate down but we're missing a step,
+ // something must definitely be wrong.
+ $this->_error_string = sprintf($this->lang->line('migration_not_found'), $i);
+ return FALSE;
+ }
+
+ $file = basename($f[0]);
+ $name = basename($f[0], '.php');
+
+ // Filename validations
+ if (preg_match('/^\d{3}_(\w+)$/', $name, $match))
+ {
+ $match[1] = strtolower($match[1]);
+
+ // Cannot repeat a migration at different steps
+ if (in_array($match[1], $migrations))
+ {
+ $this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $match[1]);
+ return FALSE;
+ }
+
+ include $f[0];
+ $class = 'Migration_' . ucfirst($match[1]);
+
+ if ( ! class_exists($class))
+ {
+ $this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class);
+ return FALSE;
+ }
+
+ if ( ! is_callable(array($class, $method)))
+ {
+ $this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class);
+ return FALSE;
+ }
+
+ $migrations[] = $match[1];
+ }
+ else
+ {
+ $this->_error_string = sprintf($this->lang->line('migration_invalid_filename'), $file);
+ return FALSE;
+ }
+ }
+
+ log_message('debug', 'Current migration: ' . $current_version);
+
+ $version = $i + ($step == 1 ? -1 : 0);
+
+ // If there is nothing to do so quit
+ if ($migrations === array())
+ {
+ return TRUE;
+ }
+
+ log_message('debug', 'Migrating from ' . $method . ' to version ' . $version);
+
+ // Loop through the migrations
+ foreach ($migrations AS $migration)
+ {
+ // Run the migration class
+ $class = 'Migration_' . ucfirst(strtolower($migration));
+ call_user_func(array(new $class, $method));
+
+ $current_version += $step;
+ $this->_update_version($current_version);
+ }
+
+ log_message('debug', 'Finished migrating to '.$current_version);
+
+ return $current_version;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set's the schema to the latest migration
+ *
+ * @access public
+ * @return mixed true if already latest, false if failed, int if upgraded
+ */
+ public function latest()
+ {
+ if ( ! $migrations = $this->find_migrations())
+ {
+ $this->_error_string = $this->line->lang('migration_none_found');
+ return false;
+ }
+
+ $last_migration = basename(end($migrations));
+
+ // Calculate the last migration step from existing migration
+ // filenames and procceed to the standard version migration
+ return $this->version((int) substr($last_migration, 0, 3));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set's the schema to the migration version set in config
+ *
+ * @access public
+ * @return mixed true if already current, false if failed, int if upgraded
+ */
+ public function current()
+ {
+ return $this->version($this->_migration_version);
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Error string
+ *
+ * @access public
+ * @return string Error message returned as a string
+ */
+ public function error_string()
+ {
+ return $this->_error_string;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Set's the schema to the latest migration
+ *
+ * @access protected
+ * @return mixed true if already latest, false if failed, int if upgraded
+ */
+ protected function find_migrations()
+ {
+ // Load all *_*.php files in the migrations path
+ $files = glob($this->_migration_path . '*_*.php');
+ $file_count = count($files);
+
+ for ($i = 0; $i < $file_count; $i++)
+ {
+ // Mark wrongly formatted files as false for later filtering
+ $name = basename($files[$i], '.php');
+ if ( ! preg_match('/^\d{3}_(\w+)$/', $name))
+ {
+ $files[$i] = FALSE;
+ }
+ }
+
+ sort($files);
+
+ return $files;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Retrieves current schema version
+ *
+ * @access protected
+ * @return integer Current Migration
+ */
+ protected function _get_version()
+ {
+ $row = $this->db->get('migrations')->row();
+ return $row ? $row->version : 0;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Stores the current schema version
+ *
+ * @access protected
+ * @param $migrations integer Migration reached
+ * @return void Outputs a report of the migration
+ */
+ protected function _update_version($migrations)
+ {
+ return $this->db->update('migrations', array(
+ 'version' => $migrations
+ ));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Enable the use of CI super-global
+ *
+ * @access public
+ * @param $var
+ * @return mixed
+ */
+ public function __get($var)
+ {
+ return get_instance()->$var;
+ }
+}
+
+/* End of file Migration.php */
+/* Location: ./system/libraries/Migration.php */ \ No newline at end of file
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index cc62e660b..cdaacf2d4 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -34,6 +34,7 @@ class CI_Pagination {
var $per_page = 10; // Max number of items you want shown per page
var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page
var $cur_page = 0; // The current page being viewed
+ var $use_page_numbers = FALSE; // Use page number for segment instead of offset
var $first_link = '&lsaquo; First';
var $next_link = '&gt;';
var $prev_link = '&lt;';
@@ -128,12 +129,22 @@ class CI_Pagination {
return '';
}
+ // Set the base page index for starting page number
+ if ($this->use_page_numbers)
+ {
+ $base_page = 1;
+ }
+ else
+ {
+ $base_page = 0;
+ }
+
// Determine the current page number.
$CI =& get_instance();
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
- if ($CI->input->get($this->query_string_segment) != 0)
+ if ($CI->input->get($this->query_string_segment) != $base_page)
{
$this->cur_page = $CI->input->get($this->query_string_segment);
@@ -143,7 +154,7 @@ class CI_Pagination {
}
else
{
- if ($CI->uri->segment($this->uri_segment) != 0)
+ if ($CI->uri->segment($this->uri_segment) != $base_page)
{
$this->cur_page = $CI->uri->segment($this->uri_segment);
@@ -151,6 +162,12 @@ class CI_Pagination {
$this->cur_page = (int) $this->cur_page;
}
}
+
+ // Set current page to 1 if using page numbers instead of offset
+ if ($this->use_page_numbers AND $this->cur_page == 0)
+ {
+ $this->cur_page = $base_page;
+ }
$this->num_links = (int)$this->num_links;
@@ -161,18 +178,32 @@ class CI_Pagination {
if ( ! is_numeric($this->cur_page))
{
- $this->cur_page = 0;
+ $this->cur_page = $base_page;
}
// Is the page number beyond the result range?
// If so we show the last page
- if ($this->cur_page > $this->total_rows)
+ if ($this->use_page_numbers)
{
- $this->cur_page = ($num_pages - 1) * $this->per_page;
+ if ($this->cur_page > $num_pages)
+ {
+ $this->cur_page = $num_pages;
+ }
+ }
+ else
+ {
+ if ($this->cur_page > $this->total_rows)
+ {
+ $this->cur_page = ($num_pages - 1) * $this->per_page;
+ }
}
$uri_page_number = $this->cur_page;
- $this->cur_page = floor(($this->cur_page/$this->per_page) + 1);
+
+ if ( ! $this->use_page_numbers)
+ {
+ $this->cur_page = floor(($this->cur_page/$this->per_page) + 1);
+ }
// Calculate the start and end numbers. These determine
// which number to start and end the digit links with
@@ -203,7 +234,14 @@ class CI_Pagination {
// Render the "previous" link
if ($this->prev_link !== FALSE AND $this->cur_page != 1)
{
- $i = $uri_page_number - $this->per_page;
+ if ($this->use_page_numbers)
+ {
+ $i = $uri_page_number - 1;
+ }
+ else
+ {
+ $i = $uri_page_number - $this->per_page;
+ }
if ($i == 0 && $this->first_url != '')
{
@@ -223,9 +261,16 @@ class CI_Pagination {
// Write the digit links
for ($loop = $start -1; $loop <= $end; $loop++)
{
- $i = ($loop * $this->per_page) - $this->per_page;
+ if ($this->use_page_numbers)
+ {
+ $i = $loop;
+ }
+ else
+ {
+ $i = ($loop * $this->per_page) - $this->per_page;
+ }
- if ($i >= 0)
+ if ($i >= $base_page)
{
if ($this->cur_page == $loop)
{
@@ -233,7 +278,7 @@ class CI_Pagination {
}
else
{
- $n = ($i == 0) ? '' : $i;
+ $n = ($i == $base_page) ? '' : $i;
if ($n == '' && $this->first_url != '')
{
@@ -253,13 +298,29 @@ class CI_Pagination {
// Render the "next" link
if ($this->next_link !== FALSE AND $this->cur_page < $num_pages)
{
- $output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close;
+ if ($this->use_page_numbers)
+ {
+ $i = $this->cur_page + 1;
+ }
+ else
+ {
+ $i = ($this->cur_page * $this->per_page);
+ }
+
+ $output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close;
}
// Render the "Last" link
if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages)
{
- $i = (($num_pages * $this->per_page) - $this->per_page);
+ if ($this->use_page_numbers)
+ {
+ $i = $num_pages;
+ }
+ else
+ {
+ $i = (($num_pages * $this->per_page) - $this->per_page);
+ }
$output .= $this->last_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close;
}
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 2c8a80163..8ee08c5b2 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -317,7 +317,8 @@ class CI_Session {
'session_id' => md5(uniqid($sessid, TRUE)),
'ip_address' => $this->CI->input->ip_address(),
'user_agent' => substr($this->CI->input->user_agent(), 0, 120),
- 'last_activity' => $this->now
+ 'last_activity' => $this->now,
+ 'user_data' => ''
);
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index 3177424c4..05511b5d3 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -196,7 +196,8 @@ class CI_Upload {
// Set the uploaded data as class variables
$this->file_temp = $_FILES[$field]['tmp_name'];
$this->file_size = $_FILES[$field]['size'];
- $this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
+ $this->_file_mime_type($_FILES[$field]);
+ $this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $this->file_type);
$this->file_type = strtolower(trim(stripslashes($this->file_type), '"'));
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);
$this->file_ext = $this->get_extension($this->file_name);
@@ -1006,8 +1007,69 @@ class CI_Upload {
// --------------------------------------------------------------------
+ /**
+ * File MIME type
+ *
+ * Detects the (actual) MIME type of the uploaded file, if possible.
+ * The input array is expected to be $_FILES[$field]
+ *
+ * @param array
+ * @return void
+ */
+ protected function _file_mime_type($file)
+ {
+ // Use if the Fileinfo extension, if available (only versions above 5.3 support the FILEINFO_MIME_TYPE flag)
+ if ( (float) substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file'))
+ {
+ $finfo = new finfo(FILEINFO_MIME_TYPE);
+ if ($finfo !== FALSE) // This is possible, if there is no magic MIME database file found on the system
+ {
+ $file_type = $finfo->file($file['tmp_name']);
+
+ /* According to the comments section of the PHP manual page,
+ * it is possible that this function returns an empty string
+ * for some files (e.g. if they don't exist in the magic MIME database)
+ */
+ if (strlen($file_type) > 1)
+ {
+ $this->file_type = $file_type;
+ return;
+ }
+ }
+ }
+
+ // Fall back to the deprecated mime_content_type(), if available
+ if (function_exists('mime_content_type'))
+ {
+ $this->file_type = @mime_content_type($file['tmp_name']);
+ return;
+ }
+
+ /* This is an ugly hack, but UNIX-type systems provide a native way to detect the file type,
+ * which is still more secure than depending on the value of $_FILES[$field]['type'].
+ *
+ * Notes:
+ * - a 'W' in the substr() expression bellow, would mean that we're using Windows
+ * - many system admins would disable the exec() function due to security concerns, hence the function_exists() check
+ */
+ if (DIRECTORY_SEPARATOR !== '\\' && function_exists('exec'))
+ {
+ $output = array();
+ @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code);
+ if ($return_code === 0 && strlen($output[0]) > 0) // A return status code != 0 would mean failed execution
+ {
+ $this->file_type = rtrim($output[0]);
+ return;
+ }
+ }
+
+ $this->file_type = $file['type'];
+ }
+
+ // --------------------------------------------------------------------
+
}
// END Upload Class
/* End of file Upload.php */
-/* Location: ./system/libraries/Upload.php */ \ No newline at end of file
+/* Location: ./system/libraries/Upload.php */
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 016102a2a..0b77a7d42 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -142,7 +142,7 @@ class CI_User_agent {
{
$this->_set_platform();
- foreach (array('_set_browser', '_set_robot', '_set_mobile') as $function)
+ foreach (array('_set_robot', '_set_browser', '_set_mobile') as $function)
{
if ($this->$function() === TRUE)
{
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 5da6ea6ae..d702e902f 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -1404,14 +1404,14 @@ class XML_RPC_Values extends CI_Xmlrpc
{
if ($utc == 1)
{
- $t = strftime("%Y%m%dT%H:%M:%S", $time);
+ $t = strftime("%Y%m%dT%H:%i:%s", $time);
}
else
{
if (function_exists('gmstrftime'))
- $t = gmstrftime("%Y%m%dT%H:%M:%S", $time);
+ $t = gmstrftime("%Y%m%dT%H:%i:%s", $time);
else
- $t = strftime("%Y%m%dT%H:%M:%S", $time - date('Z'));
+ $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z'));
}
return $t;
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index c52a33e5a..167616e57 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="./toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -57,7 +57,79 @@ Change Log
<h1>Change Log</h1>
-<p>The <img src="images/reactor-bullet.png" width="16" height="16" alt="Reactor Marker" /> indicates items that were contributed to CodeIgniter via CodeIgniter Reactor.</p>
+<h2>Version 2.1.0</h2>
+<p>Release Date: November 14, 2011</p>
+
+<ul>
+ <li>General Changes
+ <ul>
+ <li>Fixed a potential parameter injection flaw in the <a href="libraries/security.html">Security Library</a> and strengthened the XSS filter for HTML5 vulnerabilites.</li>
+ <li>Callback validation rules can now accept parameters like any other validation rule.</li>
+ <li>Added html_escape() to the <a href="general/common_functions.html">Common functions</a> to escape HTML output for preventing XSS easliy.</li>
+ </ul>
+ </li>
+ <li>Helpers
+ <ul>
+ <li>Added <samp>increment_string()</samp> to <a href="helpers/string_helper.html">String Helper</a> to turn "foo" into "foo-1" or "foo-1" into "foo-2".</li>
+ <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
+ <li><samp>url_title()</samp> will now trim extra dashes from beginning and end.</li>
+ <li>Improved speed of <a href="helpers/string_helper.html">String Helper</a>'s <b>random_string()</b> method</li>
+ </ul>
+ </li>
+ <li>Database
+ <ul>
+ <li>Added a <a href="http://www.cubrid.org/" target="_blank">CUBRID</a> driver to the <a href="libraries/database.html">Database driver</a>. Thanks to the CUBRID team for supplying this patch.</li>
+ <li>Added a <a href="http://www.php.net/manual/en/intro.pdo.php" target="_blank">PDO</a> driver to the <a href="libraries/database.html">Database driver</a>.</li>
+ <li>Typecast limit and offset in the <a href="database/queries.html">Database driver</a> to integers to avoid possible injection.</li>
+ <li>Added additional option 'none' for the optional third argument for <kbd>$this->db->like()</kbd> in the <a href="database/active_record.html">Database driver</a>.
+ </li>
+ <li>Added <kbd>$this->db->insert_batch()</kbd> support to the OCI8 (Oracle) driver.</li>
+ </ul>
+ </li>
+ <li>Libraries
+ <ul>
+ <li>Changed <kbd>$this->cart->insert()</kbd> in the <a href="libraries/cart.html">Cart library</a> to return the Row ID if a single item was inserted successfully.</li>
+ <li>Added support to set an optional parameter in your callback rules of validation using the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
+ <li>Added a <a href="libraries/migration.html">Migration library</a> to assist with applying incremental updates to your database schema.</li>
+ <li>Driver children can be located in any package path.</li>
+ <li>Added <samp>is_unique</samp> to the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
+ <li>Added <kbd>$config['use_page_numbers']</kbd> to the <a href="libraries/pagination.html">Pagination library</a>, which enables real page numbers in the URI.</li>
+ <li>Added TLS and SSL Encryption for SMTP.</li>
+ </ul>
+ </li>
+ <li>Core
+ <ul>
+ <li>Changed private functions in <a href="libraries/cart.html">URI library</a> to protected so <kdb>MY_URI</kdb> can override them.</li>
+ <li>Removed <samp>CI_CORE</samp> boolean constant from CodeIgniter.php (there are no longer different Reactor and Core versions).</li>
+ </ul>
+ </li>
+</ul>
+
+<h3>Bug fixes for 2.1.0</h3>
+<ul>
+ <li>Fixed #378 Robots identified as regular browsers by the <a href="libraries/user_agent.html">User Agent class</a>.</li>
+ <li>If a config class was loaded first then a library with the same name is loaded, the config would be ignored.</li>
+ <li>Fixed a bug (Reactor #19) where 1) the 404_override route was being ignored in some cases, and 2) auto-loaded libraries were not available to the 404_override controller when a controller existed but the requested method did not.</li>
+ <li>Fixed a bug (Reactor #89) where MySQL export would fail if the table had hyphens or other non alphanumeric/underscore characters.</li>
+ <li>Fixed a bug (#200) where MySQL queries would be malformed after calling <kbd>$this->db->count_all()</kbd> then <kdb>$this->db->get()</kdb></li>
+ <li>Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled</li>
+ <li>Fixed a bug (#160) - Removed unneeded array copy in the file cache driver.</li>
+ <li>Fixed a bug (#150) - <samp>field_data()</samp> now correctly returns column length.</li>
+ <li>Fixed a bug (#8) - <samp>load_class()</samp> now looks for core classes in <samp>APPPATH</samp> first, allowing them to be replaced.</li>
+ <li>Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().</li>
+ <li>Fixed a bug (#85) - OCI8 (Oracle) database <kbd>escape_str()</kbd> function did not escape correct.</li>
+ <li>Fixed a bug (#344) - Using schema found in <a href="libraries/sessions.html">Saving Session Data to a Database</a>, system would throw error "user_data does not have a default value" when deleting then creating a session.</li>
+ <li>Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.</li>
+ <li>Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.</li>
+ <li>Fixed a bug (#82) - WHERE clause field names in the DB <kbd>update_string()</kbd> method were not escaped, resulting in failed queries in some cases.</li>
+ <li>Fixed a bug (#89) - Fix a variable type mismatch in DB <kbd>display_error()</kbd> where an array is expected, but a string could be set instead.</li>
+ <li>Fixed a bug (#467) - Suppress warnings generated from <kbd>get_magic_quotes_gpc()</kbd> (deprecated in PHP 5.4)</li>
+ <li>Fixed a bug (#484) - First time <kbd>_csrf_set_hash()</kbd> is called, hash is never set to the cookie (in Security.php).</li>
+ <li>Fixed a bug (#60) - Added <kbd>_file_mime_type()</kbd> method to the <a href="libraries/file_uploading.html">File Uploading Library</a> in order to fix a possible MIME-type injection (also fixes bug #394).</li>
+ <li>Fixed a bug (#537) - Support for all wav type in browser.</li>
+ <li>Fixed a bug (#576) - Using <kbd>ini_get()</kbd> function to detect if apc is enabled or not.</li>
+ <li>Fixed invalid date time format in <a href="helpers/date_helper.html">Date helper</a> and <a href="libraries/xmlrpc.html">XMLRPC library</a>.</li>
+</ul>
<h2>Version 2.0.3</h2>
<p>Release Date: August 20, 2011</p>
@@ -67,29 +139,32 @@ Change Log
<ul>
<li>An improvement was made to the MySQL and MySQLi drivers to prevent exposing a potential vector for SQL injection on sites using multi-byte character sets in the database client connection. <p>An incompatibility in PHP versions &lt; 5.2.3 and MySQL &lt; 5.0.7 with <em>mysql_set_charset()</em> creates a situation where using multi-byte character sets on these environments may potentially expose a SQL injection attack vector. Latin-1, UTF-8, and other "low ASCII" character sets are unaffected on all environments.</p> <p class="critical">If you are running or considering running a multi-byte character set for your database connection, please pay close attention to the server environment you are deploying on to ensure you are not vulnerable.</p></li>
</ul>
+ </li>
<li>General Changes
<ul>
<li>Fixed a bug where there was a misspelling within a code comment in the index.php file.</li>
<li>Added Session Class userdata to the output profiler. Additionally, added a show/hide toggle on HTTP Headers, Session Data and Config Variables.</li>
<li>Removed internal usage of the <samp>EXT</samp> constant.</li>
<li>Visual updates to the welcome_message view file and default error templates. Thanks to <a href="https://bitbucket.org/danijelb">danijelb</a> for the pull request.</li>
- <li class="reactor">Added <samp>insert_batch()</samp> function to the PostgreSQL database driver. Thanks to epallerols for the patch.</li>
- <li class="reactor">Added "application/x-csv" to mimes.php.</li>
+ <li>Added "application/x-csv" to mimes.php.</li>
<li>Fixed a bug where <a href="libraries/email.html">Email library</a> attachments with a "." in the name would using invalid MIME-types.</li>
+ <li>Callback validation rules can now accept parameters like any other validation rule.</li>
</ul>
</li>
<li>Helpers
<ul>
<li>Added an optional third parameter to <samp>heading()</samp> which allows adding html attributes to the rendered heading tag.</li>
+ <li><kbd>form_open()</kbd> now only adds a hidden (Cross-site Reference Forgery) protection field when the form's action is internal and is set to the post method. (Reactor #165)</li>
+ <li>Re-worked <samp>plural()</samp> and <samp>singular()</samp> functions in the <a href="helpers/inflector_helper.html">Inflector helper</a> to support considerably more words.</li>
</ul>
</li>
<li>Libraries
<ul>
<li>Altered Session to use a longer match against the user_agent string. See upgrade notes if using database sessions.</li>
- <li class="reactor">Added <kbd>is_unique</kbd> to the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
- <li class="reactor">Added <kbd>$this->db->set_dbprefix()</kbd> to the <a href="database/queries.html">Database Driver</a>.</li>
- <li class="reactor">Changed <kbd>$this->cart->insert()</kbd> in the <a href="libraries/cart.html">Cart Library</a> to return the Row ID if a single item was inserted successfully.</li>
- <li class="reactor">Added <kbd>$this->load->get_var()</kbd> to the <a href="libraries/loader.html">Loader library</a> to retrieve global vars set with <kbd>$this->load->view()</kbd> and <kbd>$this->load->vars()</kbd>.</li>
+ <li>Added <kbd>is_unique</kbd> to the <a href="libraries/form_validation.html">Form Validation library</a>.</li>
+ <li>Added <kbd>$this->db->set_dbprefix()</kbd> to the <a href="database/queries.html">Database Driver</a>.</li>
+ <li>Changed <kbd>$this->cart->insert()</kbd> in the <a href="libraries/cart.html">Cart Library</a> to return the Row ID if a single item was inserted successfully.</li>
+ <li>Added <kbd>$this->load->get_var()</kbd> to the <a href="libraries/loader.html">Loader library</a> to retrieve global vars set with <kbd>$this->load->view()</kbd> and <kbd>$this->load->vars()</kbd>.</li>
<li>Changed <kbd>$this->db->having()</kbd> to insert quotes using escape() rather than escape_str().</li>
</ul>
</li>
@@ -97,17 +172,17 @@ Change Log
<h3>Bug fixes for 2.0.3</h3>
<ul>
- <li class="reactor">Added ENVIRONMENT to reserved constants. (Reactor #196)</li>
- <li class="reactor">Changed server check to ensure SCRIPT_NAME is defined. (Reactor #57)</li>
- <li class="reactor">Removed <samp>APPPATH.'third_party'</samp> from the packages autoloader to negate needless file stats if no packages exist or if the developer does not load any other packages by default.</li>
+ <li>Added ENVIRONMENT to reserved constants. (Reactor #196)</li>
+ <li>Changed server check to ensure SCRIPT_NAME is defined. (Reactor #57)</li>
+ <li>Removed <samp>APPPATH.'third_party'</samp> from the packages autoloader to negate needless file stats if no packages exist or if the developer does not load any other packages by default.</li>
<li>Fixed a bug (Reactor #231) where Sessions Library database table example SQL did not contain an index on last_activity. See <a href="installation/upgrade_203.html">Upgrade Notes</a>.</li>
<li>Fixed a bug (Reactor #229) where the Sessions Library example SQL in the documentation contained incorrect SQL.</li>
<li>Fixed a bug (Core #340) where when passing in the second parameter to $this->db->select(), column names in subsequent queries would not be properly escaped.</li>
- <li class="reactor">Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.</li>
- <li class="reactor">Fixed a bug where the method <kbd>$this->cart->total_items()</kbd> from <a href="libraries/cart.html">Cart Library</a> now returns the sum of the quantity of all items in the cart instead of your total count.</li>
- <li class="reactor">Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.</li>
- <li class="reactor">Fixed a bug where using <kbd>$this->db->select_max()</kdb>, <kbd>$this->db->select_min()</kdb>, etc could throw notices. Thanks to w43l for the patch.</li>
- <li class="reactor">Replace checks for STDIN with php_sapi_name() == 'cli' which on the whole is more reliable. This should get parameters in crontab working.</li>
+ <li>Fixed issue #199 - Attributes passed as string does not include a space between it and the opening tag.</li>
+ <li>Fixed a bug where the method <kbd>$this->cart->total_items()</kbd> from <a href="libraries/cart.html">Cart Library</a> now returns the sum of the quantity of all items in the cart instead of your total count.</li>
+ <li>Fixed a bug where not setting 'null' when adding fields in db_forge for mysql and mysqli drivers would default to NULL instead of NOT NULL as the docs suggest.</li>
+ <li>Fixed a bug where using <kbd>$this->db->select_max()</kdb>, <kbd>$this->db->select_min()</kdb>, etc could throw notices. Thanks to w43l for the patch.</li>
+ <li>Replace checks for STDIN with php_sapi_name() == 'cli' which on the whole is more reliable. This should get parameters in crontab working.</li>
</ul>
<h2>Version 2.0.2</h2>
@@ -119,36 +194,36 @@ Hg Tag: v2.0.2</p>
<ul>
<li>The <a href="./libraries/security.html">Security library</a> was moved to the core and is now loaded automatically. Please remove your loading calls.</li>
<li>The CI_SHA class is now deprecated. All supported versions of PHP provide a <kbd>sha1()</kbd> function.</li>
- <li class="reactor"><kbd>constants.php</kbd> will now be loaded from the environment folder if available.</li>
- <li class="reactor">Added language key error logging</li>
- <li class="reactor">Made Environment Support optional. Comment out or delete the constant to stop environment checks.</li>
- <li class="reactor">Added Environment Support for Hooks.</li>
- <li class="reactor">Added CI_ Prefix to the <a href="libraries/caching.html">Cache driver</a>.</li>
- <li class="reactor">Added <a href="./general/cli.html">CLI usage</a> documentation.</li>
+ <li><kbd>constants.php</kbd> will now be loaded from the environment folder if available.</li>
+ <li>Added language key error logging</li>
+ <li>Made Environment Support optional. Comment out or delete the constant to stop environment checks.</li>
+ <li>Added Environment Support for Hooks.</li>
+ <li>Added CI_ Prefix to the <a href="libraries/caching.html">Cache driver</a>.</li>
+ <li>Added <a href="./general/cli.html">CLI usage</a> documentation.</li>
</ul>
</li>
<li>Helpers
<ul>
<li>Removed the previously deprecated <kbd>dohash()</kbd> from the <a href="./helpers/security_helper.html">Security helper</a>; use <kbd>do_hash()</kbd> instead.</li>
- <li class="reactor">Changed the 'plural' function so that it doesn't ruin the captalization of your string. It also take into consideration acronyms which are all caps.</li>
+ <li>Changed the 'plural' function so that it doesn't ruin the captalization of your string. It also take into consideration acronyms which are all caps.</li>
</ul>
</li>
<li>Database
<ul>
- <li class="reactor"><kbd>$this->db->count_all_results()</kbd> will now return an integer instead of a string.</li>
+ <li><kbd>$this->db->count_all_results()</kbd> will now return an integer instead of a string.</li>
</ul>
</li>
</ul>
<h3>Bug fixes for 2.0.2</h3>
<ul>
- <li class="reactor">Fixed a bug (Reactor #145) where the Output Library had parse_exec_vars set to protected.</li>
- <li class="reactor">Fixed a bug (Reactor #80) where is_really_writable would create an empty file when on Windows or with safe_mode enabled.</li>
- <li class="reactor">Fixed various bugs with User Guide.</li>
- <li class="reactor">Added is_cli_request() method to documentation for <a href="libraries/input.html">Input class</a>.</li>
- <li class="reactor">Added form_validation_lang entries for <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd>.</li>
- <li class="reactor"><a href="https://bitbucket.org/ellislab/codeigniter-reactor/issue/153/escape-str-bug-in-mssql-driver">Fixed issue #153</a> Escape Str Bug in MSSQL driver.</li>
- <li class="reactor"><a href="https://bitbucket.org/ellislab/codeigniter-reactor/issue/172/bug-in-chrome-and-form_open-in-201">Fixed issue #172</a> Google Chrome 11 posts incorrectly when action is empty.</li>
+ <li>Fixed a bug (Reactor #145) where the Output Library had parse_exec_vars set to protected.</li>
+ <li>Fixed a bug (Reactor #80) where is_really_writable would create an empty file when on Windows or with safe_mode enabled.</li>
+ <li>Fixed various bugs with User Guide.</li>
+ <li>Added is_cli_request() method to documentation for <a href="libraries/input.html">Input class</a>.</li>
+ <li>Added form_validation_lang entries for <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd>.</li>
+ <li><a href="https://bitbucket.org/ellislab/codeigniter-reactor/issue/153/escape-str-bug-in-mssql-driver">Fixed issue #153</a> Escape Str Bug in MSSQL driver.</li>
+ <li><a href="https://bitbucket.org/ellislab/codeigniter-reactor/issue/172/bug-in-chrome-and-form_open-in-201">Fixed issue #172</a> Google Chrome 11 posts incorrectly when action is empty.</li>
</ul>
@@ -160,34 +235,34 @@ Hg Tag: v2.0.1</p>
<li>General changes
<ul>
<li>Added <kbd>$config['cookie_secure']</kbd> to the config file to allow requiring a secure (HTTPS) in order to set cookies.</li>
- <li class="reactor">Added the constant <kbd>CI_CORE</kbd> to help differentiate between Core: TRUE and Reactor: FALSE.</li>
- <li class="reactor">Added an <kbd>ENVIRONMENT</kbd> constant in index.php, which affects PHP error reporting settings, and optionally,
+ <li>Added the constant <kbd>CI_CORE</kbd> to help differentiate between Core: TRUE and Reactor: FALSE.</li>
+ <li>Added an <kbd>ENVIRONMENT</kbd> constant in index.php, which affects PHP error reporting settings, and optionally,
which configuration files are loaded (see below). Read more on the <a href="general/environments.html">Handling Environments</a> page.</li>
- <li class="reactor">Added support for <a href="libraries/config.html#environments">environment-specific</a> configuration files.</li>
+ <li>Added support for <a href="libraries/config.html#environments">environment-specific</a> configuration files.</li>
</ul>
</li>
<li>Libraries
<ul>
- <li class="reactor">Added <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd> rules to the <a href="libraries/form_validation.html">Form validation Class</a>.</li>
- <li class="reactor"><a href="libraries/input.html">Input Class</a> methods <kbd>post()</kbd> and <kbd>get()</kbd> will now return a full array if the first argument is not provided.</li>
- <li class="reactor">Secure cookies can now be made with the <kbd>set_cookie()</kbd> helper and <a href="libraries/input.html">Input Class</a> method.</li>
- <li class="reactor">Added <kbd>set_content_type()</kbd> to <a href="libraries/output.html">Output Class</a> to set the output <kbd>Content-Type</kbd> HTTP header based on a MIME Type or a config/mimes.php array key.</li>
- <li class="reactor"><a href="libraries/output.html">Output Class</a> will now support method chaining.</li>
+ <li>Added <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd> rules to the <a href="libraries/form_validation.html">Form validation Class</a>.</li>
+ <li><a href="libraries/input.html">Input Class</a> methods <kbd>post()</kbd> and <kbd>get()</kbd> will now return a full array if the first argument is not provided.</li>
+ <li>Secure cookies can now be made with the <kbd>set_cookie()</kbd> helper and <a href="libraries/input.html">Input Class</a> method.</li>
+ <li>Added <kbd>set_content_type()</kbd> to <a href="libraries/output.html">Output Class</a> to set the output <kbd>Content-Type</kbd> HTTP header based on a MIME Type or a config/mimes.php array key.</li>
+ <li><a href="libraries/output.html">Output Class</a> will now support method chaining.</li>
</ul>
</li>
<li>Helpers
<ul>
- <li class="reactor">Changed the logic for <kbd>form_open()</kbd> in <a href="helpers/form_helper.html">Form helper</a>. If no value is passed it will submit to the current URL.</li>
+ <li>Changed the logic for <kbd>form_open()</kbd> in <a href="helpers/form_helper.html">Form helper</a>. If no value is passed it will submit to the current URL.</li>
</ul>
</li>
</ul>
<h3>Bug fixes for 2.0.1</h3>
<ul>
- <li class="reactor">CLI requests can now be run from any folder, not just when CD'ed next to index.php.</li>
- <li class="reactor">Fixed issue #41: Added audio/mp3 mime type to mp3.</li>
- <li class="reactor">Fixed a bug (Core #329) where the file caching driver referenced the incorrect cache directory.</li>
- <li class="reactor">Fixed a bug (Reactor #69) where the SHA1 library was named incorrectly.</li>
+ <li>CLI requests can now be run from any folder, not just when CD'ed next to index.php.</li>
+ <li>Fixed issue #41: Added audio/mp3 mime type to mp3.</li>
+ <li>Fixed a bug (Core #329) where the file caching driver referenced the incorrect cache directory.</li>
+ <li>Fixed a bug (Reactor #69) where the SHA1 library was named incorrectly.</li>
</ul>
<h2>Version 2.0.0</h2>
@@ -201,7 +276,7 @@ Hg Tag: v2.0.0</p>
<li>Scaffolding, having been deprecated for a number of versions, has been removed.</li>
<li>Plugins have been removed, in favor of Helpers. The CAPTCHA plugin has been converted to a Helper and <a href="./helpers/captcha_helper.html">documented</a>. The JavaScript calendar plugin was removed due to the ready availability of great JavaScript calendars, particularly with jQuery.</li>
<li>Added new special Library type: <a href="./general/drivers.html">Drivers</a>.</li>
- <li class="reactor">Added full query-string support. See the config file for details.</li>
+ <li>Added full query-string support. See the config file for details.</li>
<li>Moved the application folder outside of the system folder.</li>
<li>Moved system/cache and system/logs directories to the application directory.</li>
<li>Added routing overrides to the main index.php file, enabling the normal routing to be overridden on a per "index" file basis.</li>
@@ -211,15 +286,15 @@ Hg Tag: v2.0.0</p>
<li>In-development code is now hosted at <a href="http://bitbucket.org/ellislab/codeigniter-reactor/">BitBucket</a>.</li>
<li>Removed the deprecated Validation Class.</li>
<li>Added CI_ Prefix to all core classes.</li>
- <li class="reactor">Package paths can now be set in application/config/autoload.php.</li>
- <li class="reactor"><a href="libraries/file_uploading.html">Upload library</a> file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.</li>
- <li class="reactor">In <a href="database/forge.html">Database Forge</a> the name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.</li>
- <li class="reactor"><kbd>$config['base_url']</kbd> is now empty by default and will guess what it should be.</li>
- <li class="reactor">Enabled full Command Line Interface compatibility with <kbd>config['uri_protocol'] = 'CLI';</kbd>.</li>
+ <li>Package paths can now be set in application/config/autoload.php.</li>
+ <li><a href="libraries/file_uploading.html">Upload library</a> file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.</li>
+ <li>In <a href="database/forge.html">Database Forge</a> the name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.</li>
+ <li><kbd>$config['base_url']</kbd> is now empty by default and will guess what it should be.</li>
+ <li>Enabled full Command Line Interface compatibility with <kbd>config['uri_protocol'] = 'CLI';</kbd>.</li>
</ul>
<li>Libraries
<ul>
- <li class="reactor">Added a <a href="libraries/caching.html">Cache driver</a> with APC, memcached, and file-based support.</li>
+ <li>Added a <a href="libraries/caching.html">Cache driver</a> with APC, memcached, and file-based support.</li>
<li>Added <var>$prefix</var>, <var>$suffix</var> and <var>$first_url</var> properties to <a href="./libraries/pagination.html">Pagination library</a>.</li>
<li>Added the ability to suppress first, previous, next, last, and page links by setting their values to FALSE in the <a href="./libraries/pagination.html">Pagination library</a>.</li>
<li>Added <a href="./libraries/security.html">Security library</a>, which now contains the <dfn>xss_clean</dfn> function, <dfn>filename_security</dfn> function and other security related functions.</li>
@@ -250,8 +325,8 @@ Hg Tag: v2.0.0</p>
<li>Altered Form_Validation library to allow for method chaining on <kbd>set_rules()</kbd>, <kbd>set_message()</kbd> and <kbd>set_error_delimiters()</kbd> functions.</li>
<li>Altered Email Library to allow for method chaining.</li>
<li>Added <kbd>request_headers()</kbd>, <kbd>get_request_header()</kbd> and <kbd>is_ajax_request()</kbd> to the input class.</li>
- <li class="reactor">Altered <a href="libraries/user_agent.html">User agent library</a> so that <kbd>is_browser()</kbd>, <kbd>is_mobile()</kbd> and <kbd>is_robot()</kbd> can optionally check for a specific browser or mobile device.</li>
- <li class="reactor">Altered <a href="libraries/input.html">Input library</a> so that <kbd>post()</kbd> and <kbd>get()</kbd> will return all POST and GET items (respectively) if there are no parameters passed in.</li>
+ <li>Altered <a href="libraries/user_agent.html">User agent library</a> so that <kbd>is_browser()</kbd>, <kbd>is_mobile()</kbd> and <kbd>is_robot()</kbd> can optionally check for a specific browser or mobile device.</li>
+ <li>Altered <a href="libraries/input.html">Input library</a> so that <kbd>post()</kbd> and <kbd>get()</kbd> will return all POST and GET items (respectively) if there are no parameters passed in.</li>
</ul>
</li>
<li>Database
@@ -313,7 +388,7 @@ Hg Tag: v2.0.0</p>
<h3>Bug fixes for 2.0.0</h3>
<ul>
- <li class="reactor">Fixed a bug where you could not change the User-Agent when sending email.</li>
+ <li>Fixed a bug where you could not change the User-Agent when sending email.</li>
<li>Fixed a bug where the Output class would send incorrect cached output for controllers implementing their own <dfn>_output()</dfn> method.</li>
<li>Fixed a bug where a failed query would not have a saved query execution time causing errors in the Profiler</li>
<li>Fixed a bug that was writing log entries when multiple identical helpers and plugins were loaded.</li>
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 3f44fcd5b..17c58c9f1 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -334,6 +334,13 @@ $this->db->or_where('id >', $id);
$this-&gt;db-&gt;like('title', 'match', 'both'); <br />
// Produces: WHERE title LIKE '%match%' </code> </li>
+If you do not want to use the wildcard (%) you can pass to the optional third argument the option 'none'.
+
+<code>
+ $this-&gt;db-&gt;like('title', 'match', 'none'); <br />
+// Produces: WHERE title LIKE 'match'
+</code>
+
<li><strong>Associative array method:</strong>
<code>
@@ -539,7 +546,7 @@ $data = array(<br/>
&nbsp;&nbsp;&nbsp;)<br/>
);<br />
<br />
-$this->db->update_batch('mytable', $data);
+$this->db->insert_batch('mytable', $data);
<br /><br />
// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</code>
@@ -662,6 +669,41 @@ You can optionally pass this information directly into the update function as a
<p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p>
+<h2>$this->db->update_batch();</h2>
+<p>Generates an update string based on the data you supply, and runs the query. You can either pass an
+<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p>
+
+<code>
+$data = array(<br/>
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'My Name 2' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'My date 2'<br />
+&nbsp;&nbsp;&nbsp;),<br />
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'Another title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'Another Name 2' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'Another date 2'<br />
+&nbsp;&nbsp;&nbsp;)<br/>
+);<br />
+<br />
+$this->db->update_batch('mytable', $data, 'title');
+<br /><br />
+// Produces: <br />
+// UPDATE `mytable` SET `name` = CASE<br />
+// WHEN `title` = 'My title' THEN 'My Name 2'<br />
+// WHEN `title` = 'Another title' THEN 'Another Name 2'<br />
+// ELSE `name` END,<br />
+// `date` = CASE <br />
+// WHEN `title` = 'My title' THEN 'My date 2'<br />
+// WHEN `title` = 'Another title' THEN 'Another date 2'<br />
+// ELSE `date` END<br />
+// WHERE `title` IN ('My title','Another title')</code>
+
+<p>The first parameter will contain the table name, the second is an associative array of values, the third parameter is the where key.</p>
+
+<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
+
<a name="delete">&nbsp;</a>
<h1>Deleting Data</h1>
@@ -779,4 +821,4 @@ Next Topic:&nbsp;&nbsp;<a href="transactions.html">Transactions</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html
index 16d380f5f..e6e72f269 100644
--- a/user_guide/database/caching.html
+++ b/user_guide/database/caching.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html
index 38cbd1b2c..4fc894743 100644
--- a/user_guide/database/call_function.html
+++ b/user_guide/database/call_function.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html
index bbdd0a3c0..17a291ac2 100644
--- a/user_guide/database/configuration.html
+++ b/user_guide/database/configuration.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -132,8 +132,8 @@ for the primary connection, but it too can be renamed to something more relevant
<li><strong>cache_on</strong> - TRUE/FALSE (boolean) - Whether database query caching is enabled, see also <a href="caching.html">Database Caching Class</a>.</li>
<li><strong>cachedir</strong> - The absolute server path to your database query cache directory.</li>
<li><strong>char_set</strong> - The character set used in communicating with the database.</li>
-<li><strong>dbcollat</strong> - The character collation used in communicating with the database. <p class="important"><strong>Note:</strong> For MySQL and MySQLi databases, this setting is only used as a backup if your server is running PHP &lt; 5.2.3 or MySQL &lt; 5.0.7. There is an incompatibility in PHP with mysql_real_escape_string() which can make your site vulnerable to SQL injection if you are using a multi-byte character set and are running versions lower than these. Sites using Latin-1 or UTF-8 database character set and collation are unaffected.</p></li>
-<li><strong>swap_pre</strong> - A default table prefix that should be swapped with <var>dbprefix</var>. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.</li>
+<li><strong>dbcollat</strong> - The character collation used in communicating with the database. <p class="important"><strong>Note:</strong> For MySQL and MySQLi databases, this setting is only used as a backup if your server is running PHP &lt; 5.2.3 or MySQL &lt; 5.0.7 (and in table creation queries made with DB Forge). There is an incompatibility in PHP with mysql_real_escape_string() which can make your site vulnerable to SQL injection if you are using a multi-byte character set and are running versions lower than these. Sites using Latin-1 or UTF-8 database character set and collation are unaffected.</p></li>
+<li><strong>swap_pre</strong> - A default table prefix that should be swapped with <var>dbprefix</var>. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.</li>
<li><strong>autoinit</strong> - Whether or not to automatically connect to the database when the library loads. If set to false, the connection will take place prior to executing the first query.</li>
<li><strong>stricton</strong> - TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application.</li>
<li><strong>port</strong> - The database port number. To use this value you have to add a line to the database config array.<code>$db['default']['port'] = 5432;</code>
diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html
index 309f2bc1a..f86602269 100644
--- a/user_guide/database/connecting.html
+++ b/user_guide/database/connecting.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/examples.html b/user_guide/database/examples.html
index 1bdecb79e..58035557d 100644
--- a/user_guide/database/examples.html
+++ b/user_guide/database/examples.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html
index 3a1ea0cf2..56c9d9fdf 100644
--- a/user_guide/database/fields.html
+++ b/user_guide/database/fields.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html
index 6b8709892..2289e148e 100644
--- a/user_guide/database/forge.html
+++ b/user_guide/database/forge.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/helpers.html b/user_guide/database/helpers.html
index 6a8aba55b..82f5c1d21 100644
--- a/user_guide/database/helpers.html
+++ b/user_guide/database/helpers.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/index.html b/user_guide/database/index.html
index c85e9bf4c..8a957ecef 100644
--- a/user_guide/database/index.html
+++ b/user_guide/database/index.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html
index e7333efc2..3152997ca 100644
--- a/user_guide/database/queries.html
+++ b/user_guide/database/queries.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/results.html b/user_guide/database/results.html
index ec5f97762..0baf992fb 100644
--- a/user_guide/database/results.html
+++ b/user_guide/database/results.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -103,7 +103,7 @@ Query Results
<code>
$query = $this->db->query("SELECT * FROM users;");<br />
<br />
- foreach ($query->result('User') as $user)<br />
+ foreach ($query->result('User') as $row)<br />
{<br />
&nbsp;&nbsp;&nbsp;echo $row->name; // call attributes<br />
&nbsp;&nbsp;&nbsp;echo $row->reverse_name(); // or methods defined on the 'User' class<br />
diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html
index 14ff28d40..dc5b54198 100644
--- a/user_guide/database/table_data.html
+++ b/user_guide/database/table_data.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/transactions.html b/user_guide/database/transactions.html
index 1a25f1657..dd5f73ed1 100644
--- a/user_guide/database/transactions.html
+++ b/user_guide/database/transactions.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html
index 8231c7e78..7c30070f6 100644
--- a/user_guide/database/utilities.html
+++ b/user_guide/database/utilities.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/doc_style/index.html b/user_guide/doc_style/index.html
index 27a1756e7..aa7fff43d 100644
--- a/user_guide/doc_style/index.html
+++ b/user_guide/doc_style/index.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html
index a4ce418e9..6e601af44 100644
--- a/user_guide/general/alternative_php.html
+++ b/user_guide/general/alternative_php.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/ancillary_classes.html b/user_guide/general/ancillary_classes.html
index fb78edaeb..0e3d54deb 100644
--- a/user_guide/general/ancillary_classes.html
+++ b/user_guide/general/ancillary_classes.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/autoloader.html b/user_guide/general/autoloader.html
index b65674fda..699751202 100644
--- a/user_guide/general/autoloader.html
+++ b/user_guide/general/autoloader.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/caching.html b/user_guide/general/caching.html
index b40e770a9..a0d7596ed 100644
--- a/user_guide/general/caching.html
+++ b/user_guide/general/caching.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/cli.html b/user_guide/general/cli.html
index befc9994a..5dda24b56 100644
--- a/user_guide/general/cli.html
+++ b/user_guide/general/cli.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -83,7 +83,7 @@ Running via the CLI
<ul>
<li>Run your cron-jobs without needing to use wget or curl</li>
- <li>Make your cron-jobs inaccessible from being loaded in the URL by checking for <kbd>IS_CLI</kbd></li>
+ <li>Make your cron-jobs inaccessible from being loaded in the URL by checking for <kbd>$this->input->is_cli_request()</kbd></li>
<li>Make interactive "tasks" that can do things like set permissions, prune cache folders, run backups, etc.</li>
<li>Integrate with other applications in other languages. For example, a random C++ script could call one command and run code in your models!</li>
</ul>
diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html
index 65457759d..f290521a9 100644
--- a/user_guide/general/common_functions.html
+++ b/user_guide/general/common_functions.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -104,6 +104,8 @@ else<br />
<p>This function prevents inserting null characters between ascii characters, like Java\0script.</p>
+<h2>html_escape(<var>$mixed</var>)</h2>
+<p>This function provides short cut for htmlspecialchars() function. It accepts string and array. To prevent Cross Site Scripting (XSS), it is very useful.</p>
</div>
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html
index 2d525141c..91dd95a00 100644
--- a/user_guide/general/controllers.html
+++ b/user_guide/general/controllers.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/core_classes.html b/user_guide/general/core_classes.html
index b8917864f..be711903c 100644
--- a/user_guide/general/core_classes.html
+++ b/user_guide/general/core_classes.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/creating_drivers.html b/user_guide/general/creating_drivers.html
index 367755452..77cccd03c 100644
--- a/user_guide/general/creating_drivers.html
+++ b/user_guide/general/creating_drivers.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html
index aeec871b2..f905bb7c3 100644
--- a/user_guide/general/creating_libraries.html
+++ b/user_guide/general/creating_libraries.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/credits.html b/user_guide/general/credits.html
index 2785e7f25..00c577871 100644
--- a/user_guide/general/credits.html
+++ b/user_guide/general/credits.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html
index d0e4a1f1b..f463adb10 100644
--- a/user_guide/general/drivers.html
+++ b/user_guide/general/drivers.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/environments.html b/user_guide/general/environments.html
index 38ce862b4..0245b085d 100644
--- a/user_guide/general/environments.html
+++ b/user_guide/general/environments.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/errors.html b/user_guide/general/errors.html
index 83725dcc5..d6bed9ea1 100644
--- a/user_guide/general/errors.html
+++ b/user_guide/general/errors.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/helpers.html b/user_guide/general/helpers.html
index 3747eb7b9..619e9ff78 100644
--- a/user_guide/general/helpers.html
+++ b/user_guide/general/helpers.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/hooks.html b/user_guide/general/hooks.html
index c0d616c50..07d302a7d 100644
--- a/user_guide/general/hooks.html
+++ b/user_guide/general/hooks.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/libraries.html b/user_guide/general/libraries.html
index 40533e124..73b642bef 100644
--- a/user_guide/general/libraries.html
+++ b/user_guide/general/libraries.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html
index e716d1072..388519796 100644
--- a/user_guide/general/managing_apps.html
+++ b/user_guide/general/managing_apps.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/models.html b/user_guide/general/models.html
index 1696f424a..7bda4d9a9 100644
--- a/user_guide/general/models.html
+++ b/user_guide/general/models.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html
index 9895b0284..451b6f9e6 100644
--- a/user_guide/general/profiling.html
+++ b/user_guide/general/profiling.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/quick_reference.html b/user_guide/general/quick_reference.html
index 242e9afb8..6c07b335c 100644
--- a/user_guide/general/quick_reference.html
+++ b/user_guide/general/quick_reference.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/requirements.html b/user_guide/general/requirements.html
index 405798f04..1393b40e0 100644
--- a/user_guide/general/requirements.html
+++ b/user_guide/general/requirements.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/reserved_names.html b/user_guide/general/reserved_names.html
index 91d93a03b..450c0f667 100644
--- a/user_guide/general/reserved_names.html
+++ b/user_guide/general/reserved_names.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/routing.html b/user_guide/general/routing.html
index c6429628e..d5c90a1b8 100644
--- a/user_guide/general/routing.html
+++ b/user_guide/general/routing.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/security.html b/user_guide/general/security.html
index 5685bfa89..9e78d4c68 100644
--- a/user_guide/general/security.html
+++ b/user_guide/general/security.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html
index 25fab6547..c94313365 100644
--- a/user_guide/general/styleguide.html
+++ b/user_guide/general/styleguide.html
@@ -34,7 +34,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/urls.html b/user_guide/general/urls.html
index 580b5fc54..edf03309b 100644
--- a/user_guide/general/urls.html
+++ b/user_guide/general/urls.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/general/views.html b/user_guide/general/views.html
index a2273f862..5dc1d3250 100644
--- a/user_guide/general/views.html
+++ b/user_guide/general/views.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/array_helper.html b/user_guide/helpers/array_helper.html
index 956c54e8f..92a11ed69 100644
--- a/user_guide/helpers/array_helper.html
+++ b/user_guide/helpers/array_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/captcha_helper.html b/user_guide/helpers/captcha_helper.html
index 991c2d3f1..6c2671ad0 100644
--- a/user_guide/helpers/captcha_helper.html
+++ b/user_guide/helpers/captcha_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/cookie_helper.html b/user_guide/helpers/cookie_helper.html
index 3fbaa8fa1..2fde7f841 100644
--- a/user_guide/helpers/cookie_helper.html
+++ b/user_guide/helpers/cookie_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/date_helper.html b/user_guide/helpers/date_helper.html
index f930ea3ae..e705593b0 100644
--- a/user_guide/helpers/date_helper.html
+++ b/user_guide/helpers/date_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/directory_helper.html b/user_guide/helpers/directory_helper.html
index 5623d5098..7fd7797af 100644
--- a/user_guide/helpers/directory_helper.html
+++ b/user_guide/helpers/directory_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/download_helper.html b/user_guide/helpers/download_helper.html
index cabacf8fe..ccfe9ac72 100644
--- a/user_guide/helpers/download_helper.html
+++ b/user_guide/helpers/download_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/email_helper.html b/user_guide/helpers/email_helper.html
index 10730d7e4..13ae220fe 100644
--- a/user_guide/helpers/email_helper.html
+++ b/user_guide/helpers/email_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/file_helper.html b/user_guide/helpers/file_helper.html
index 1194498a2..0296191ff 100644
--- a/user_guide/helpers/file_helper.html
+++ b/user_guide/helpers/file_helper.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index dd935ebd9..ce809e946 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html
index 92bfdfb2e..a8277febe 100644
--- a/user_guide/helpers/html_helper.html
+++ b/user_guide/helpers/html_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/inflector_helper.html b/user_guide/helpers/inflector_helper.html
index d7fa959e8..66982e8b3 100644
--- a/user_guide/helpers/inflector_helper.html
+++ b/user_guide/helpers/inflector_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/language_helper.html b/user_guide/helpers/language_helper.html
index 1102d7a3c..073c368d8 100644
--- a/user_guide/helpers/language_helper.html
+++ b/user_guide/helpers/language_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/number_helper.html b/user_guide/helpers/number_helper.html
index 1ee7cbbdf..c48987e6c 100644
--- a/user_guide/helpers/number_helper.html
+++ b/user_guide/helpers/number_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/path_helper.html b/user_guide/helpers/path_helper.html
index 103690cc8..00f4aa2ec 100644
--- a/user_guide/helpers/path_helper.html
+++ b/user_guide/helpers/path_helper.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/security_helper.html b/user_guide/helpers/security_helper.html
index 7343da152..16d5c51f2 100644
--- a/user_guide/helpers/security_helper.html
+++ b/user_guide/helpers/security_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html
index 6f1fa5915..8bdd1df2c 100644
--- a/user_guide/helpers/smiley_helper.html
+++ b/user_guide/helpers/smiley_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html
index a3dc16598..3d7ba1c51 100644
--- a/user_guide/helpers/string_helper.html
+++ b/user_guide/helpers/string_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -90,6 +90,17 @@ String Helper
<code>echo random_string('alnum', 16);</code>
+<h2>increment_string()</h2>
+
+<p>Increments a string by appending a number to it or increasing the number. Useful for creating "copies" or a file or duplicating database content which has unique titles or slugs.</p>
+
+<p>Usage example:</p>
+
+<code>echo increment_string('file', '_'); // "file_1"<br/>
+echo increment_string('file', '-', 2); // "file-2"<br/>
+echo increment_string('file-4'); // "file-5"<br/></code>
+
+
<h2>alternator()</h2>
<p>Allows two or more items to be alternated between, when cycling through a loop. Example:</p>
diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html
index 496eccb73..9f0d22ffc 100644
--- a/user_guide/helpers/text_helper.html
+++ b/user_guide/helpers/text_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/typography_helper.html b/user_guide/helpers/typography_helper.html
index e7bd473a9..a6bd809a5 100644
--- a/user_guide/helpers/typography_helper.html
+++ b/user_guide/helpers/typography_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/url_helper.html b/user_guide/helpers/url_helper.html
index e60e96bf0..76ec32ab2 100644
--- a/user_guide/helpers/url_helper.html
+++ b/user_guide/helpers/url_helper.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/helpers/xml_helper.html b/user_guide/helpers/xml_helper.html
index 0dbe5577c..f410b2114 100644
--- a/user_guide/helpers/xml_helper.html
+++ b/user_guide/helpers/xml_helper.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/images/appflowchart.gif b/user_guide/images/appflowchart.gif
index 422332c9e..4328e48fe 100644
--- a/user_guide/images/appflowchart.gif
+++ b/user_guide/images/appflowchart.gif
Binary files differ
diff --git a/user_guide/index.html b/user_guide/index.html
index bb1d21621..fa90983e1 100644
--- a/user_guide/index.html
+++ b/user_guide/index.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -77,7 +77,6 @@ minimizing the amount of code needed for a given task.</p>
<li>You want a framework that requires nearly zero configuration.</li>
<li>You want a framework that does not require you to use the command line.</li>
<li>You want a framework that does not require you to adhere to restrictive coding rules.</li>
-<li>You are not interested in large-scale monolithic libraries like PEAR.</li>
<li>You do not want to be forced to learn a templating language (although a template parser is optionally available if you desire one).</li>
<li>You eschew complexity, favoring simple solutions.</li>
<li>You need clear, thorough documentation.</li>
diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html
index f36b2bc0f..14c65edd0 100644
--- a/user_guide/installation/downloads.html
+++ b/user_guide/installation/downloads.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -58,7 +58,9 @@ Downloading CodeIgniter
<h1>Downloading CodeIgniter</h1>
<ul>
- <li><a href="http://codeigniter.com/downloads/">CodeIgniter V 2.0.2 (Current version)</a></li>
+ <li><a href="http://codeigniter.com/downloads/">CodeIgniter V 2.1.0 (Current version)</a></li>
+ <li><a href="http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.3.zip">CodeIgniter V 2.0.3</a></li>
+ <li><a href="http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.2.zip">CodeIgniter V 2.0.2</a></li>
<li><a href="http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.1.zip">CodeIgniter V 2.0.1</a></li>
<li><a href="http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.0.zip">CodeIgniter V 2.0.0</a></li>
<li><a href="http://codeigniter.com/download_files/CodeIgniter_1.7.3.zip">CodeIgniter V 1.7.3</a></li>
@@ -86,14 +88,14 @@ Downloading CodeIgniter
-<h1 id="hg">Mercurial Server</h1>
-<p><a href="http://mercurial.selenic.com">Mercurial</a> is a distributed version control system.</p>
+<h1 id="git">Git Server</h1>
+<p><a href="http://git-scm.com/about">Git</a> is a distributed version control system.</p>
- <p>Public Hg access is available at <a href="http://bitbucket.org/ellislab/codeigniter-reactor/">BitBucket</a>.
+ <p>Public Git access is available at <a href="https://github.com/EllisLab/CodeIgniter">GitHub</a>.
Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken
from the tip.</p>
- <p>Beginning with version 1.6.1, stable tags are also available via BitBucket, simply select the version from the Tags dropdown.</p>
+ <p>Beginning with version 2.0.3, stable tags are also available via GitHub, simply select the version from the Tags dropdown.</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html
index 5e8ab3883..f01c8b8d5 100644
--- a/user_guide/installation/index.html
+++ b/user_guide/installation/index.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/troubleshooting.html b/user_guide/installation/troubleshooting.html
index 943e2d802..e79eb6a9f 100644
--- a/user_guide/installation/troubleshooting.html
+++ b/user_guide/installation/troubleshooting.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_120.html b/user_guide/installation/upgrade_120.html
index 357f68bbb..2b3d066cd 100644
--- a/user_guide/installation/upgrade_120.html
+++ b/user_guide/installation/upgrade_120.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_130.html b/user_guide/installation/upgrade_130.html
index 7ad26bbfd..dd1465617 100644
--- a/user_guide/installation/upgrade_130.html
+++ b/user_guide/installation/upgrade_130.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_131.html b/user_guide/installation/upgrade_131.html
index bc624261a..202468dac 100644
--- a/user_guide/installation/upgrade_131.html
+++ b/user_guide/installation/upgrade_131.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_132.html b/user_guide/installation/upgrade_132.html
index beef9b279..99f8fd3ab 100644
--- a/user_guide/installation/upgrade_132.html
+++ b/user_guide/installation/upgrade_132.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_133.html b/user_guide/installation/upgrade_133.html
index 4d61ac601..b9b7a7fd3 100644
--- a/user_guide/installation/upgrade_133.html
+++ b/user_guide/installation/upgrade_133.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_140.html b/user_guide/installation/upgrade_140.html
index 721d70695..50891b912 100644
--- a/user_guide/installation/upgrade_140.html
+++ b/user_guide/installation/upgrade_140.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_141.html b/user_guide/installation/upgrade_141.html
index 7c81d0521..afa8018b8 100644
--- a/user_guide/installation/upgrade_141.html
+++ b/user_guide/installation/upgrade_141.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_150.html b/user_guide/installation/upgrade_150.html
index f622ea310..f910aa039 100644
--- a/user_guide/installation/upgrade_150.html
+++ b/user_guide/installation/upgrade_150.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_152.html b/user_guide/installation/upgrade_152.html
index d350aae78..55e43f728 100644
--- a/user_guide/installation/upgrade_152.html
+++ b/user_guide/installation/upgrade_152.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_153.html b/user_guide/installation/upgrade_153.html
index 50c6970e3..3e6af7a38 100644
--- a/user_guide/installation/upgrade_153.html
+++ b/user_guide/installation/upgrade_153.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_154.html b/user_guide/installation/upgrade_154.html
index 90abaf30b..627fa0896 100644
--- a/user_guide/installation/upgrade_154.html
+++ b/user_guide/installation/upgrade_154.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_160.html b/user_guide/installation/upgrade_160.html
index 16c53eb46..70e589ccf 100644
--- a/user_guide/installation/upgrade_160.html
+++ b/user_guide/installation/upgrade_160.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_161.html b/user_guide/installation/upgrade_161.html
index b167f1da4..40877369d 100644
--- a/user_guide/installation/upgrade_161.html
+++ b/user_guide/installation/upgrade_161.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_162.html b/user_guide/installation/upgrade_162.html
index 015b7da75..d67190842 100644
--- a/user_guide/installation/upgrade_162.html
+++ b/user_guide/installation/upgrade_162.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_163.html b/user_guide/installation/upgrade_163.html
index a1c3c8ff9..cdf6bdf6f 100644
--- a/user_guide/installation/upgrade_163.html
+++ b/user_guide/installation/upgrade_163.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_170.html b/user_guide/installation/upgrade_170.html
index a0e12c678..7c67f9125 100644
--- a/user_guide/installation/upgrade_170.html
+++ b/user_guide/installation/upgrade_170.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_171.html b/user_guide/installation/upgrade_171.html
index 052af69f7..014b2c589 100644
--- a/user_guide/installation/upgrade_171.html
+++ b/user_guide/installation/upgrade_171.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_172.html b/user_guide/installation/upgrade_172.html
index 971453297..961f3cae1 100644
--- a/user_guide/installation/upgrade_172.html
+++ b/user_guide/installation/upgrade_172.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_200.html b/user_guide/installation/upgrade_200.html
index 9f9dce7d0..b5d6e75ec 100644
--- a/user_guide/installation/upgrade_200.html
+++ b/user_guide/installation/upgrade_200.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_201.html b/user_guide/installation/upgrade_201.html
index 036ef7c05..7edd0ba6a 100644
--- a/user_guide/installation/upgrade_201.html
+++ b/user_guide/installation/upgrade_201.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_202.html b/user_guide/installation/upgrade_202.html
index b6c62b4d5..9aaa561eb 100644
--- a/user_guide/installation/upgrade_202.html
+++ b/user_guide/installation/upgrade_202.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_203.html b/user_guide/installation/upgrade_203.html
index 1d37a055d..d4b703af0 100644
--- a/user_guide/installation/upgrade_203.html
+++ b/user_guide/installation/upgrade_203.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrade_210.html b/user_guide/installation/upgrade_210.html
new file mode 100644
index 000000000..d9a7213a9
--- /dev/null
+++ b/user_guide/installation/upgrade_210.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Upgrading from 2.0.3 to 2.1.0 : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+Upgrading from 2.0.3 to 2.1.0
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+<h1>Upgrading from 2.0.3 to 2.1.0</h1>
+
+<p>Before performing an update you should take your site offline by replacing the index.php file with a static one.</p>
+
+<h2>Step 1: Update your CodeIgniter files</h2>
+
+<p>Replace all files and directories in your "system" folder and replace your index.php file. If any modifications were made to your index.php they will need to be made fresh in this new one.</p>
+
+<p class="important"><strong>Note:</strong> If you have any custom developed files in these folders please make copies of them first.</p>
+
+<h2>Step 2: Replace config/user_agents.php</h2>
+
+<p>This config file has been updated to contain more user agent types, please copy it to <kbd>application/config/user_agents.php</kbd>.</p>
+
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="index.html">Installation Instructions</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="troubleshooting.html">Troubleshooting</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/installation/upgrade_b11.html b/user_guide/installation/upgrade_b11.html
index 7cf06cd9d..dc3c1f07c 100644
--- a/user_guide/installation/upgrade_b11.html
+++ b/user_guide/installation/upgrade_b11.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/installation/upgrading.html b/user_guide/installation/upgrading.html
index 58a45ee9d..c3f5ae6dd 100644
--- a/user_guide/installation/upgrading.html
+++ b/user_guide/installation/upgrading.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -60,6 +60,7 @@ Upgrading from a Previous Version
<p>Please read the upgrade notes corresponding to the version you are upgrading from.</p>
<ul>
+ <li><a href="upgrade_210.html">Upgrading from 2.0.3 to 2.1.0</a></li>
<li><a href="upgrade_203.html">Upgrading from 2.0.2 to 2.0.3</a></li>
<li><a href="upgrade_202.html">Upgrading from 2.0.1 to 2.0.2</a></li>
<li><a href="upgrade_201.html">Upgrading from 2.0 to 2.0.1</a></li>
diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html
index c7b7ec9a7..602e6fac0 100644
--- a/user_guide/libraries/benchmark.html
+++ b/user_guide/libraries/benchmark.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html
index 9b503f6d1..9808aaa51 100644
--- a/user_guide/libraries/caching.html
+++ b/user_guide/libraries/caching.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html
index 724c08f8b..2abc43975 100644
--- a/user_guide/libraries/calendar.html
+++ b/user_guide/libraries/calendar.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html
index 3471eeb7e..b867b709c 100644
--- a/user_guide/libraries/cart.html
+++ b/user_guide/libraries/cart.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -61,7 +61,7 @@ Shopping Cart Class
<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site.
These items can be retrieved and displayed in a standard "shopping cart" format, allowing the user to update the quantity or remove items from the cart.</p>
-<p>Please note that the Cart Class ONLY provides the core "cart" functionality. It does not provide shipping, credit card authorization, or other processing components.</p>
+<p>Please note that the Cart Class ONLY provides the core "cart" functionality. It does not provide shipping, credit card authorization, or other processing components.</p>
<h2>Initializing the Shopping Cart Class</h2>
@@ -106,20 +106,20 @@ It is intended to be used in cases where your product has options associated wit
<li><strong>qty</strong> - The quantity being purchased.
<li><strong>price</strong> - The price of the item.
<li><strong>name</strong> - The name of the item.
-<li><strong>options</strong> - Any additional attributes that are needed to identify the product. These must be passed via an array.
+<li><strong>options</strong> - Any additional attributes that are needed to identify the product. These must be passed via an array.
</ul>
<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so
please do NOT use those words as index names when inserting data into the cart.</p>
-<p>Your array may contain additional data. Anything you include in your array will be stored in the session. However, it is best to standardize your data among
-all your products in order to make displaying the information in a table easier.</p>
+<p>Your array may contain additional data. Anything you include in your array will be stored in the session. However, it is best to standardize your data among all your products in order to make displaying the information in a table easier.</p>
+
+<p>The insert() method will return the $rowid if you successfully insert a single item.</p>
<h2>Adding Multiple Items to The Cart</h2>
-<p>By using a multi-dimensional array, as shown below, it is possible to add multiple products to the cart in one action. This is useful in cases where you wish to allow
-people to select from among several items on the same page.</p>
+<p>By using a multi-dimensional array, as shown below, it is possible to add multiple products to the cart in one action. This is useful in cases where you wish to allow people to select from among several items on the same page.</p>
<code>
@@ -268,8 +268,8 @@ $this->cart->update($data);
<p><strong>What is a Row ID?</strong>&nbsp; The <kbd>row ID</kbd> is a unique identifier that is generated by the cart code when an item is added to the cart. The reason a
unique ID is created is so that identical products with different options can be managed by the cart.</p>
-<p>For example, let's say someone buys two identical t-shirts (same product ID), but in different sizes. The product ID (and other attributes) will be
-identical for both sizes because it's the same shirt. The only difference will be the size. The cart must therefore have a means of identifying this
+<p>For example, let's say someone buys two identical t-shirts (same product ID), but in different sizes. The product ID (and other attributes) will be
+identical for both sizes because it's the same shirt. The only difference will be the size. The cart must therefore have a means of identifying this
difference so that the two sizes of shirts can be managed independently. It does so by creating a unique "row ID" based on the product ID and any options associated with it.</p>
<p>In nearly all cases, updating the cart will be something the user does via the "view cart" page, so as a developer, it is unlikely that you will ever have to concern yourself
@@ -311,7 +311,7 @@ function when the update form is submitted. Please examine the construction of t
<h2>$this->cart->has_options(rowid);</h2>
-<p>Returns TRUE (boolean) if a particular row in the cart contains options. This function is designed to be used in a loop with <dfn>$this->cart->contents()</dfn>, since you must pass the <kbd>rowid</kbd> to this function, as shown in the <dfn>Displaying the Cart</dfn> example above.</p>
+<p>Returns TRUE (boolean) if a particular row in the cart contains options. This function is designed to be used in a loop with <dfn>$this->cart->contents()</dfn>, since you must pass the <kbd>rowid</kbd> to this function, as shown in the <dfn>Displaying the Cart</dfn> example above.</p>
<h2>$this->cart->product_options(rowid);</h2>
@@ -322,7 +322,7 @@ function when the update form is submitted. Please examine the construction of t
<h2>$this->cart->destroy();</h2>
-<p>Permits you to destroy the cart. This function will likely be called when you are finished processing the customer's order.</p>
+<p>Permits you to destroy the cart. This function will likely be called when you are finished processing the customer's order.</p>
diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html
index d522bbc5b..08b612e77 100644
--- a/user_guide/libraries/config.html
+++ b/user_guide/libraries/config.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html
index d246254ab..7fc56d55b 100644
--- a/user_guide/libraries/email.html
+++ b/user_guide/libraries/email.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/encryption.html b/user_guide/libraries/encryption.html
index 5c64127cb..6ec629f96 100644
--- a/user_guide/libraries/encryption.html
+++ b/user_guide/libraries/encryption.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html
index a88c67220..2cb1ef5ea 100644
--- a/user_guide/libraries/file_uploading.html
+++ b/user_guide/libraries/file_uploading.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html
index 7c544b69f..2028bcd2c 100644
--- a/user_guide/libraries/form_validation.html
+++ b/user_guide/libraries/form_validation.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -390,10 +390,10 @@ $this->form_validation->set_rules($config);
<p>CodeIgniter lets you pipe multiple rules together. Let's try it. Change your rules in the third parameter of rule setting function, like this:</p>
<code>
-$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]');<br />
+$this->form_validation->set_rules('username', 'Username', 'required|min_length[5]|max_length[12]|is_unique[users.username]');<br />
$this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]');<br />
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');<br />
-$this->form_validation->set_rules('email', 'Email', 'required|valid_email');<br />
+$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');<br />
</code>
<p>The above code sets the following rules:</p>
@@ -508,15 +508,13 @@ create a callback function that does that. Let's create a example of this.</p>
<code>$this->form_validation->set_rules('username', 'Username', '<kbd>callback_username_check</kbd>');</code>
-
<p>Then add a new function called <dfn>username_check</dfn> to your controller. Here's how your controller should now look:</p>
-
-<textarea class="textarea" style="width:100%" cols="50" rows="44">&lt;?php
+<textarea class="textarea" style="width:100%" cols="50" rows="40">&lt;?php
class Form extends CI_Controller {
- function index()
+ public function index()
{
$this->load->helper(array('form', 'url'));
@@ -525,7 +523,7 @@ class Form extends CI_Controller {
$this->form_validation->set_rules('username', 'Username', 'callback_username_check');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
- $this->form_validation->set_rules('email', 'Email', 'required');
+ $this->form_validation->set_rules('email', 'Email', 'required|is_unique[users.email]');
if ($this->form_validation->run() == FALSE)
{
@@ -537,7 +535,7 @@ class Form extends CI_Controller {
}
}
- function username_check($str)
+ public function username_check($str)
{
if ($str == 'test')
{
@@ -556,14 +554,13 @@ class Form extends CI_Controller {
<p><dfn>Reload your form and submit it with the word "test" as the username. You can see that the form field data was passed to your
callback function for you to process.</dfn></p>
-<p><strong>To invoke a callback just put the function name in a rule, with "callback_" as the rule prefix.</strong></p>
+<p>To invoke a callback just put the function name in a rule, with "callback_" as the rule <strong>prefix</strong>. If you need
+to receive an extra parameter in your callback function, just add it normally after the function name between square brackets,
+as in: "callback_foo<strong>[bar]</strong>", then it will be passed as the second argument of your callback function.</p>
-<p>You can also process the form data that is passed to your callback and return it. If your callback returns anything other than a boolean TRUE/FALSE
+<p><strong>Note:</strong> You can also process the form data that is passed to your callback and return it. If your callback returns anything other than a boolean TRUE/FALSE
it is assumed that the data is your newly processed form data.</p>
-
-
-
<a name="settingerrors"></a>
<h2>Setting Error Messages</h2>
@@ -947,6 +944,13 @@ POST array:</p>
</tr>
<tr>
+ <td class="td"><strong>is_unique</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is not unique to the table and field name in the parameter.</td>
+ <td class="td">is_unique[table.field]</td>
+ </tr>
+
+ <tr>
<td class="td"><strong>min_length</strong></td>
<td class="td">Yes</td>
<td class="td">Returns FALSE if the form element is shorter then the parameter value.</td>
diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html
index 6c7ed5c65..175efe19b 100644
--- a/user_guide/libraries/ftp.html
+++ b/user_guide/libraries/ftp.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -74,7 +74,7 @@ and deleted. The FTP class also includes a "mirroring" function that permits an
<h2>Usage Examples</h2>
<p>In this example a connection is opened to the FTP server, and a local file is read and uploaded in ASCII mode. The
-file permissions are set to 755. Note: Setting permissions requires PHP 5.</p>
+file permissions are set to 755.</p>
<code>
$this->load->library('ftp');<br />
@@ -185,8 +185,7 @@ Example:</p>
<p><strong>Mode options are:</strong>&nbsp; <kbd>ascii</kbd>, <kbd>binary</kbd>, and <kbd>auto</kbd> (the default). If
<kbd>auto</kbd> is used it will base the mode on the file extension of the source file.</p>
-<p>Permissions are available if you are running PHP 5 and can be passed as an <kbd>octal</kbd> value in the fourth parameter.</p>
-
+<p>Permissions can be passed as an <kbd>octal</kbd> value in the fourth parameter.</p>
<h2>$this->ftp->download()</h2>
@@ -267,7 +266,7 @@ $this->ftp->mirror('/path/to/myfolder/', '/public_html/myfolder/');
<h2>$this->ftp->mkdir()</h2>
<p>Lets you create a directory on your server. Supply the path ending in the folder name you wish to create, with a trailing slash.
-Permissions can be set by passed an <kbd>octal</kbd> value in the second parameter (if you are running PHP 5).</p>
+Permissions can be set by passed an <kbd>octal</kbd> value in the second parameter.</p>
<code>
// Creates a folder named "bar"<br />
diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html
index 475f02a56..1caf791d8 100644
--- a/user_guide/libraries/image_lib.html
+++ b/user_guide/libraries/image_lib.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html
index 311f76ee9..10c84a9ea 100644
--- a/user_guide/libraries/input.html
+++ b/user_guide/libraries/input.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -73,11 +73,11 @@ Input Class
<p>The security filtering function is called automatically when a new <a href="../general/controllers.html">controller</a> is invoked. It does the following:</p>
<ul>
-<li>Destroys the global GET array. Since CodeIgniter does not utilize GET strings, there is no reason to allow it.</li>
+<li>If $config['allow_get_array'] is FALSE(default is TRUE), destroys the global GET array.</li>
<li>Destroys all global variables in the event register_globals is turned on.</li>
-<li>Filters the POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters.</li>
+<li>Filters the GET/POST/COOKIE array keys, permitting only alpha-numeric (and a few other) characters.</li>
<li>Provides XSS (Cross-site Scripting Hacks) filtering. This can be enabled globally, or upon request.</li>
-<li>Standardizes newline characters to \n</li>
+<li>Standardizes newline characters to \n(In Windows \r\n)</li>
</ul>
@@ -133,13 +133,13 @@ else<br />
<code>$this->input->post('some_data', TRUE);</code>
<p>To return an array of all POST items call without any parameters.</p>
-<p>To return all POST items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p>
+<p>To return all POST items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean;</p>
<p>The function returns FALSE (boolean) if there are no items in the POST.</p>
<code>
- $this->input->post(); // returns all POST items with XSS filter
+ $this->input->post(NULL, TRUE); // returns all POST items with XSS filter
<br />
- $this->input->post(NULL, FALSE); // returns all POST items without XSS
+ $this->input->post(); // returns all POST items without XSS filter
</code>
<h2>$this->input->get()</h2>
@@ -149,13 +149,13 @@ else<br />
<code>$this->input->get('some_data', TRUE);</code>
<p>To return an array of all GET items call without any parameters.</p>
-<p>To return all GET items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p>
+<p>To return all GET items and pass them through the XSS filter set the first parameter NULL while setting the second parameter to boolean;</p>
<p>The function returns FALSE (boolean) if there are no items in the GET.</p>
<code>
- $this->input->get(); // returns all GET items with XSS filter
+ $this->input->get(NULL, TRUE); // returns all GET items with XSS filter
<br />
- $this->input->get(NULL, FALSE); // returns all GET items without XSS filtering
+ $this->input->get(); // returns all GET items without XSS filtering
</code>
<h2>$this->input->get_post()</h2>
diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html
index 09530e246..3dda1fd69 100644
--- a/user_guide/libraries/javascript.html
+++ b/user_guide/libraries/javascript.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html
index 1f670ea4b..a9afcef90 100644
--- a/user_guide/libraries/language.html
+++ b/user_guide/libraries/language.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html
index af27176ad..53440c53c 100644
--- a/user_guide/libraries/loader.html
+++ b/user_guide/libraries/loader.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/migration.html b/user_guide/libraries/migration.html
new file mode 100644
index 000000000..ed99044d1
--- /dev/null
+++ b/user_guide/libraries/migration.html
@@ -0,0 +1,176 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Migration Class : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='CodeIgniter Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+Migration Class
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Migration Class</h1>
+
+<p>Migrations are a convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run them. You’d also have to keep track of which changes need to be run against the production machines next time you deploy.</p>
+
+<p>The database table <var>migration</var> tracks which migrations have already been run so all you have to do is update your application files and call <dfn>$this->migrate->current()</dfn> to work out which migrations should be run. The current version is found in <var>config/migration.php</var>.</p>
+
+<h2>Create a Migration</h2>
+
+<p>This will be the first migration for a new site which has a blog. All migrations go in the folder <var>application/migrations/</var> and have names such as: <kbd>001_add_blog.php</kbd>.</p>
+
+<pre>
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Migration_Add_blog extends CI_Migration {
+
+ public function up()
+ {
+ $this->dbforge->add_field(array(
+ 'blog_id' => array(
+ 'type' => 'INT',
+ 'constraint' => 5,
+ 'unsigned' => TRUE,
+ 'auto_increment' => TRUE
+ ),
+ 'blog_title' => array(
+ 'type' => 'VARCHAR',
+ 'constraint' => '100',
+ ),
+ 'blog_description' => array(
+ 'type' => 'TEXT',
+ 'null' => TRUE,
+ ),
+ ));
+
+ $this->dbforge->create_table('blog');
+ }
+
+ public function down()
+ {
+ $this->dbforge->drop_table('blog');
+ }
+</pre>
+
+<p>Then in <var>application/config/migration.php</var> set <dfn>$config['migration_version'] = 1;</dfn>.
+
+<h2>Usage Example</h2>
+
+<p>In this example some simple code is placed in <var>application/controllers/migrate.php</var> to update the schema.</p>
+
+<pre>
+$this->load->library('migration');
+
+if ( ! $this->migration->current())
+{
+ show_error($this->migration->error_string());
+}
+</pre>
+
+
+<h1>Function Reference</h1>
+
+<h2>$this->migration->current()</h2>
+
+<p>The current migration is whatever is set for <dfn>$config['migration_version']</dfn> in <var>application/config/migration.php</var>.</p>
+
+
+<h2>$this->migration->latest()</h2>
+
+<p>This works much the same way as current() but instead of looking for the <dfn>$config['migration_version']</dfn> the Migration class will use the very newest migration found in the filesystem.</p>
+
+<h2>$this->migration->version()</h2>
+
+<p>Version can be used to roll back changes or step forwards programmatically to specific versions. It works just like current but ignores <dfn>$config['migration_version']</dfn>.</p>
+
+<pre>
+$this->load->library('migration');
+
+$this->migration->version(5);
+</pre>
+
+<h2>Migration Preferences</h2>
+
+<p>The following is a list of all the config options for migrations.</p>
+
+
+<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
+<tr>
+<th>Preference</th>
+<th>Default&nbsp;Value</th>
+<th>Options</th>
+<th>Description</th>
+</tr><tr>
+<td class="td"><strong>migration_enabled</strong></td><td class="td">FALSE</td><td class="td">TRUE / FALSE</td><td class="td">Enable or disable migrations.</td>
+</tr><tr>
+<td class="td"><strong>migration_version</strong></td><td class="td">0</td><td class="td">None</td><td class="td">The current version your database should use.</td>
+</tr><tr>
+<td class="td"><strong>migration_path</strong></td><td class="td">APPPATH.'migrations/'</td><td class="td">None</td><td class="td">The path to your migrations folder.</td>
+</tr>
+</table>
+
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="form_validation.html">Form Validation Class</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="table.html">HTML Table Class</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html
index 7361d7961..77fe464ce 100644
--- a/user_guide/libraries/output.html
+++ b/user_guide/libraries/output.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html
index 196555441..6478694d0 100644
--- a/user_guide/libraries/pagination.html
+++ b/user_guide/libraries/pagination.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -119,7 +119,11 @@ something different you can specify it.</p>
<p>The number of &quot;digit&quot; links you would like before and after the selected page number. For example, the number 2
will place two digits on either side, as in the example links at the very top of this page.</p>
-<h4>$config['page_query_string'] = TRUE</h4>
+
+<h4>$config['use_page_numbers'] = TRUE;</h4>
+<p>By default, the URI segment will use the starting index for the items you are paginating. If you prefer to show the the actual page number, set this to TRUE.</p>
+
+<h4>$config['page_query_string'] = TRUE;</h4>
<p>By default, the pagination library assume you are using <a href="../general/urls.html">URI Segments</a>, and constructs your links something like</p>
<p><code>http://example.com/index.php/test/page/20</code></p>
<p>If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.</p>
diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html
index b8a53452e..f449145ac 100644
--- a/user_guide/libraries/parser.html
+++ b/user_guide/libraries/parser.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html
index dd62a4386..ad1d9ae86 100644
--- a/user_guide/libraries/security.html
+++ b/user_guide/libraries/security.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html
index e09c31db3..dfb732491 100644
--- a/user_guide/libraries/sessions.html
+++ b/user_guide/libraries/sessions.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html
index 1f34dd9e2..003916ef3 100644
--- a/user_guide/libraries/table.html
+++ b/user_guide/libraries/table.html
@@ -27,7 +27,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html
index a2912a594..035158463 100644
--- a/user_guide/libraries/trackback.html
+++ b/user_guide/libraries/trackback.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html
index cd287933c..12be119cc 100644
--- a/user_guide/libraries/typography.html
+++ b/user_guide/libraries/typography.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html
index 5ebec0cbf..7d27ff1dd 100644
--- a/user_guide/libraries/unit_testing.html
+++ b/user_guide/libraries/unit_testing.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html
index 0e1c26f1e..f04bb9f10 100644
--- a/user_guide/libraries/uri.html
+++ b/user_guide/libraries/uri.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html
index e1d3640d3..8b3dcee62 100644
--- a/user_guide/libraries/user_agent.html
+++ b/user_guide/libraries/user_agent.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html
index 3635c221b..bb939dff4 100644
--- a/user_guide/libraries/xmlrpc.html
+++ b/user_guide/libraries/xmlrpc.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html
index 21cf8017a..53fc71ef3 100644
--- a/user_guide/libraries/zip.html
+++ b/user_guide/libraries/zip.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/license.html b/user_guide/license.html
index a0d694f2e..f9769a417 100644
--- a/user_guide/license.html
+++ b/user_guide/license.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js
index b44994d4d..b9b6e0943 100644
--- a/user_guide/nav/nav.js
+++ b/user_guide/nav/nav.js
@@ -37,7 +37,16 @@ function create_menu(basepath)
'<li><a href="'+base+'overview/mvc.html">Model-View-Controller</a></li>' +
'<li><a href="'+base+'overview/goals.html">Architectural Goals</a></li>' +
'</ul>' +
-
+
+ '<h3>Tutorial</h3>' +
+ '<ul>' +
+ '<li><a href="'+base+'tutorial/index.html">Introduction</a></li>' +
+ '<li><a href="'+base+'tutorial/static_pages.html">Static pages</a></li>' +
+ '<li><a href="'+base+'tutorial/news_section.html">News section</a></li>' +
+ '<li><a href="'+base+'tutorial/create_news_items.html">Create news items</a></li>' +
+ '<li><a href="'+base+'tutorial/conclusion.html">Conclusion</a></li>' +
+ '</ul>' +
+
'</td><td class="td_sep" valign="top">' +
'<h3>General Topics</h3>' +
@@ -94,6 +103,7 @@ function create_menu(basepath)
'<li><a href="'+base+'libraries/javascript.html">Javascript Class</a></li>' +
'<li><a href="'+base+'libraries/loader.html">Loader Class</a></li>' +
'<li><a href="'+base+'libraries/language.html">Language Class</a></li>' +
+ '<li><a href="'+base+'libraries/migration.html">Migration Class</a></li>' +
'<li><a href="'+base+'libraries/output.html">Output Class</a></li>' +
'<li><a href="'+base+'libraries/pagination.html">Pagination Class</a></li>' +
'<li><a href="'+base+'libraries/security.html">Security Class</a></li>' +
diff --git a/user_guide/overview/appflow.html b/user_guide/overview/appflow.html
index c6bf857b4..61bf907a6 100644
--- a/user_guide/overview/appflow.html
+++ b/user_guide/overview/appflow.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -60,7 +60,7 @@ Appflow
<p>The following graphic illustrates how data flows throughout the system:</p>
-<div><img src="../images/appflowchart.gif" width="697" height="205" border="0" alt="CodeIgniter application flow" /></div>
+<div><img src="../images/appflowchart.gif" width="769" height="212" alt="CodeIgniter application flow"></div>
<ol>
diff --git a/user_guide/overview/at_a_glance.html b/user_guide/overview/at_a_glance.html
index 641c04b22..7e93bd2a6 100644
--- a/user_guide/overview/at_a_glance.html
+++ b/user_guide/overview/at_a_glance.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/overview/cheatsheets.html b/user_guide/overview/cheatsheets.html
index b7b10b90c..60e655229 100644
--- a/user_guide/overview/cheatsheets.html
+++ b/user_guide/overview/cheatsheets.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/overview/features.html b/user_guide/overview/features.html
index 5f71c5083..d1d5c8c25 100644
--- a/user_guide/overview/features.html
+++ b/user_guide/overview/features.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/overview/getting_started.html b/user_guide/overview/getting_started.html
index 2b6b3f288..ad6fa01ed 100644
--- a/user_guide/overview/getting_started.html
+++ b/user_guide/overview/getting_started.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/overview/goals.html b/user_guide/overview/goals.html
index 6acaa65a2..f2263c7ae 100644
--- a/user_guide/overview/goals.html
+++ b/user_guide/overview/goals.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/overview/index.html b/user_guide/overview/index.html
index 08e61e283..f295d4e81 100644
--- a/user_guide/overview/index.html
+++ b/user_guide/overview/index.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/overview/mvc.html b/user_guide/overview/mvc.html
index 4721cbf67..4aebb1095 100644
--- a/user_guide/overview/mvc.html
+++ b/user_guide/overview/mvc.html
@@ -28,7 +28,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
diff --git a/user_guide/toc.html b/user_guide/toc.html
index 033114873..01b5a7b92 100644
--- a/user_guide/toc.html
+++ b/user_guide/toc.html
@@ -29,7 +29,7 @@
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 2.0.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
</tr>
</table>
</div>
@@ -89,6 +89,14 @@ Table of Contents
<li><a href="./overview/goals.html">Architectural Goals</a></li>
</ul>
+<h3>Tutorial</h3>
+<ul>
+ <li><a href="./tutorial/index.html">Introduction</a></li>
+ <li><a href="./tutorial/static_pages.html">Static pages</a></li>
+ <li><a href="./tutorial/news_section.html">News section</a></li>
+ <li><a href="./tutorial/create_news_items.html">Create news items</a></li>
+ <li><a href="./tutorial/conclusion.html">Conclusion</a></li>
+</ul>
</td>
<td valign="top" width="25%">
@@ -149,6 +157,7 @@ Table of Contents
<li><a href="./libraries/javascript.html">Javascript Class</a></li>
<li><a href="./libraries/loader.html">Loader Class</a></li>
<li><a href="./libraries/language.html">Language Class</a></li>
+<li><a href="./libraries/migration.html">Migration Class</a></li>
<li><a href="./libraries/output.html">Output Class</a></li>
<li><a href="./libraries/pagination.html">Pagination Class</a></li>
<li><a href="./libraries/security.html">Security Class</a></li>
diff --git a/user_guide/tutorial/conclusion.html b/user_guide/tutorial/conclusion.html
new file mode 100644
index 000000000..9cf146746
--- /dev/null
+++ b/user_guide/tutorial/conclusion.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CodeIgniter Features : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+<a href="index.html">Tutorial</a> &nbsp;&#8250;&nbsp;
+Conclusion
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Tutorial - Conclusion</h1>
+
+<p>This tutorial did not cover all of the things you might expect of a full-fledged content management system, but it introduced you to the more important topics of routing, writing controllers, and models. We hope this tutorial gave you an insight into some of CodeIgniter's basic design patterns, which you can expand upon.</p>
+
+<p>Now that you've completed this tutorial, we recommend you check out the rest of the documentation. CodeIgniter is often praised because of its comprehensive documentation. Use this to your advantage and read the "Introduction" and "General Topics" sections thoroughly. You should read the class and helper references when needed.</p>
+
+<p>Every intermediate PHP programmer should be able to get the hang of CodeIgniter within a few days.</p>
+
+<p>If you still have questions about the framework or your own CodeIgniter code, you can:</p>
+<ul>
+ <li>Check out our <a href="http://codeigniter.com/forums">forums</a></li>
+ <li>Visit our <a href="http://codeigniter.com/wiki/IRC">IRC chatroom</a></li>
+ <li>Explore the <a href="http://codeigniter.com/wiki/">Wiki</a></li>
+</ul>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="create_news_items.html">Create news items</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="../general/urls.html">CodeIgniter URLs</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/tutorial/create_news_items.html b/user_guide/tutorial/create_news_items.html
new file mode 100644
index 000000000..26b1ed10f
--- /dev/null
+++ b/user_guide/tutorial/create_news_items.html
@@ -0,0 +1,179 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CodeIgniter Features : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+<a href="index.html">Tutorial</a> &nbsp;&#8250;&nbsp;
+Create news items
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Tutorial - Create news items</h1>
+
+<p>You now know how you can read data from a database using CodeIgnite, but you haven't written any information to the database yet. In this section you'll expand your news controller and model created earlier to include this functionality.</p>
+
+<h2>Create a form</h2>
+
+<p>To input data into the database you need to create a form where you can input the information to be stored. This means you'll be needing a form with two fields, one for the title and one for the text. You'll derive the slug from our title in the model. Create the new view at <dfn>application/views/news/create.php</dfn>.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="16">
+<h2>Create a news item</h2>
+
+&lt;?php echo validation_errors(); ?>
+
+&lt;?php echo form_open('news/create') ?>
+
+ <label for="title">Title</label>
+ <input type="input" name="title" /><br />
+
+ <label for="text">Text</label>
+ <textarea name="text">&lt;/textarea><br />
+
+ <input type="submit" name="submit" value="Create news item" />
+
+&lt;/form>
+</textarea>
+
+<p>There are only two things here that probably look unfamiliar to you: the <dfn>form_open()</dfn> function and the <dfn>validation_errors()</dfn> function.</p>
+
+<p>The first function is provided by the <a href="../helpers/form_helper.html">form helper</a> and renders the form element and adds extra functionality, like adding a hidden <a href="../libraries/security.html">CSFR prevention field</a>. The latter is used to report errors related to form validation.</p>
+
+<p>Go back to your news controller. You're going to do two things here, check whether the form was submitted and whether the submitted data passed the validation rules. You'll use the <a href="../libraries/form_validation.html">form validation</a> library to do this.</p>
+
+<pre>
+public function create()
+{
+ $this->load->helper('form');
+ $this->load->library('form_validation');
+
+ $data['title'] = 'Create a news item';
+
+ $this->form_validation->set_rules('title', 'Title', 'required');
+ $this->form_validation->set_rules('text', 'text', 'required');
+
+ if ($this->form_validation->run() === FALSE)
+ {
+ $this->load->view('templates/header', $data);
+ $this->load->view('news/create');
+ $this->load->view('templates/footer');
+
+ }
+ else
+ {
+ $this->news_model->set_news();
+ $this->load->view('news/success');
+ }
+}
+</pre>
+
+<p>The code above adds a lot of functionality. The first few lines load the form helper and the form validation library. After that, rules for the form validation are set. The <var>set_rules()</var> method takes three arguments; the name of the input field, the name to be used in error messages, and the rule. In this case the title and text fields are required.</p>
+
+<p>CodeIgniter has a powerful form validation library as demonstrated above. You can read <a href="../libraries/form_validation.html">more about this library here</a>.</p>
+
+<p>Continuing down, you can see a condition that checks whether the form validation ran successfully. If it did not, the form is displayed, if it was submitted <strong>and</strong> passed all the rules, the model is called. After this, a view is loaded to display a success message. Create a view at <dfn>application/view/news/success.php</dfn> and write a success message.</p>
+
+<h2>Model</h2>
+
+<p>The only thing that remains is writing a method that writes the data to the database. You'll use the Active Record class to insert the information and use the input library to get the posted data. Open up the model created earlier and add the following:</p>
+
+<pre>
+public function set_news()
+{
+ $this->load->helper('url');
+
+ $slug = url_title($this->input->post('title'), 'dash', TRUE);
+
+ $data = array(
+ 'title' => $this->input->post('title'),
+ 'slug' => $slug,
+ 'text' => $this->input->post('text')
+ );
+
+ return $this->db->insert('news', $data);
+}
+</pre>
+
+<p>This new method takes care of inserting the news item into the database. The third line contains a new function, <dfn>url_title()</dfn>. This function - provided by the <a href="../helpers/url_helper.html">URL helper</a> - strips down the string you pass it, replacing all spaces by dashes (-) and makes sure everything is in lowercase characters. This leaves you with a nice slug, perfect for creating URIs.</p>
+
+<p>Let's continue with preparing the record that is going to be inserted later, inside the <var>$data</var> array. Each element corresponds with a column in the database table created earlier. You might notice a new method here, namely the <dfn>post()</dfn> method from the <a href="../libraries/input.html">input library</a>. This method makes sure the data is sanitized, protecting you from nasty attacks from others. The input library is loaded by default. At last, you insert our <var>$data</var> array into our database.</p>
+
+<h2>Routing</h2>
+
+<p>Before you can start adding news items into your CodeIgniter application you have to add an extra rule to <dfn>config/routes.php</dfn> file. Make sure your file contains the following. This makes sure CodeIgniter sees 'create' as a method instead of a news item's slug.</p>
+
+<pre>
+$route['news/create'] = 'news/create';
+$route['news/(:any)'] = 'news/view/$1';
+$route['news'] = 'news';
+$route['(:any)'] = 'pages/view/$1';
+$route['default_controller'] = 'pages/view';
+</pre>
+
+<p>Now point your browser to your local development environment where you installed CodeIgniter and add <dfn>index.php/news/create</dfn> to the URL. Congratulations, you just created your first CodeIgniter application! Add some news and check out the different pages you made.</p>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="news_section.html">News section</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="conclusion.html">Conclusion</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/tutorial/hard_coded_pages.html b/user_guide/tutorial/hard_coded_pages.html
new file mode 100644
index 000000000..b34e9f1be
--- /dev/null
+++ b/user_guide/tutorial/hard_coded_pages.html
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CodeIgniter Features : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+Features
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Tutorial - Hard coded pages</h1>
+
+<p>The first thing we're going to do is setting up a controller to handle our hard coded pages. A controller is a class with a collection of methods that represent the different actions you can perform on a certain object. In our case, we want to be able to view a page.</p>
+
+<p class="important"><strong>Note:</strong> This tutorial assumes you've downloaded CodeIgniter and installed the framework in your development environment.</p>
+
+<p>Create a file at <dfn>application/controllers/pages.php</dfn> with the following code.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="9">
+&lt;?php
+class Pages extends CI_Controller {
+
+ public function view($page = 'home')
+ {
+
+ }
+}
+</textarea>
+
+<p>If you're familiar with PHP classes you see that we create a Pages class with a view method that accepts one parameter, <var>$page</var>. Another interesting observation is that the Pages class is extending the CI_Controller class. This means that the new Pages class can access the methods and variables defined in the CI_Controller class. When you look at this class in <dfn>system/core/controller.php</dfn> you can see this class is doing something really important; assigning an instance from the CodeIgniter super object to the <var>$this</var> object. In most of your code, <var>$this</var> is the object you will use to interact with the framework.</p>
+
+<p>Now we've created our first method, it is time to do some basic templating. For this tutorial, we will be creating two views to acts as our footer and header. Let's create our header at <dfn>application/views/templates/header.php</dfn> and ad the following code.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="8">
+<html>
+<head>
+ <title><?php echo $title ?> - CodeIgniter 2 Tutorial</title>
+</head>
+<body>
+ <h1>CodeIgniter 2 Tutorial</h1>
+
+</textarea>
+
+<p>Our header doesn't do anything exciting. It contains the basic HTML code that we will want to display before loading the main view. You can also see that we echo the <var>$title</var> variable, which we didn't define. We will set this variable in the Pages controller a bit later. Let's go ahead and create a footer at <dfn>application/views/templates/footer.php</dfn> that includes the following code.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="4">
+<strong>&copy; 2011</strong>
+</body>
+</html>
+</textarea>
+
+<h2>Adding logic to the controller</h2>
+
+<p>Now we've set up the basics so we can finally do some real programming. Earlier we set up our controller with a view method. Because we don't want to write a separate method for every page, we made the view method accept one parameter, the name of the page. These hard coded pages will be located in <dfn>application/views/pages/</dfn>. Create two files in this directory named <dfn>home.php</dfn> and <dfn>about.php</dfn> and put in some HTML content.</p>
+
+<p>In order to load these pages we'll have to check whether these page actually exists. When the page does exist, we load the view for that pages, including the header and footer and display it to the user. If it doesn't, we show a "404 Page not found" error.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="16">
+public function view($page = 'home')
+{
+
+ if ( ! file_exists('application/views/pages/' . $page . EXT))
+ {
+ show_404();
+ }
+
+ $data['title'] = ucfirst($page);
+
+ $this->load->view('templates/header', $data);
+ $this->load->view('pages/'.$page);
+ $this->load->view('templates/footer');
+}
+</textarea>
+
+<p>The first thing we do is checking whether the page we're looking for does actually exist. We use PHP's native file_exists() to do this check and pass the path where the file is supposed to be. Next is the function show_404(), a CodeIgniter function that renders the default error page and sets the appropriate HTTP headers.</p>
+
+<p>In the header template you saw we were using the <var>$title</var> variable to customize our page title. This is where we define the title, but instead of assigning the value to a variable, we assign it to the title element in the <var>$data</var> array. The last thing we need to do is loading the views in the order we want them to be displayed. We also pass the <var>$data</var> array to the header view to make its elements available in the header view file.<p>
+
+<h2>Routing</h2>
+
+<p>Actually, our controller is already functioning. Point your browser to <dfn>index.php/pages/view</dfn> to see your homepage. When you visit <dfn>index.php/pages/view/about</dfn> you will see the about page, again including your header and footer. Now we're going to get rid of the pages/view part in our URI. As you may have seen, CodeIgniter does its routing by the class, method and parameter, separated by slashes.</p>
+
+<p>Open the routing file located at <dfn>application/config/routes.php</dfn> and add the following two lines. Remove all other code that sets any element in the <var>$route</var> array.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="3">
+$route['(:any)'] = 'pages/view/$1';
+$route['default_controller'] = 'pages/view';
+</textarea>
+
+<p>CodeIgniter reads its routing rules from top to bottom and routes the request to the first matching rule. These routes are stored in the <var>$route</var> array where the keys represent the incoming request and the value the path to the method, as described above.</p>
+
+<p>The first rule in our <var>$routes</var> array matches every request - using the wildcard operator <dfn>(:any)</dfn> - and passes the value to the view method of the pages class we created earlier. The default controller route makes sure every request to the root goes to the view method as well, which has the first parameter set to 'home' by default.</p>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="cheatsheets.html">CodeIgniter Cheatsheets</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="appflow.html">Application Flow Chart</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/tutorial/index.html b/user_guide/tutorial/index.html
new file mode 100644
index 000000000..65075fb2a
--- /dev/null
+++ b/user_guide/tutorial/index.html
@@ -0,0 +1,101 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CodeIgniter Features : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+<a href="index.html">Tutorial</a> &nbsp;&#8250;&nbsp;
+Introduction
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Tutorial &minus; Introduction</h1>
+
+<p>This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. It will show you how a basic CodeIgniter application is constructed in step-by-step fashion.</p>
+
+<p>In this tutorial, you will be creating a <strong>basic news application</strong>. You will begin by writing the code that can load static pages. Next, you will create a news section that reads news items from a database. Finally, you'll add a form to create news items in the database.</p>
+
+<p>This tutorial will primarily focus on:</p>
+<ul>
+<li>Model-View-Controller basics</li>
+<li>Routing basics</li>
+<li>Form validation</li>
+<li>Performing basic database queries using &quot;Active Record&quot;</li>
+</ul>
+
+<p>The entire tutorial is split up over several pages, each explaining a small part of the functionality of the CodeIgniter framework. You'll go through the following pages:</p>
+<ul>
+<li>Introduction, this page, which gives you an overview of what to expect.</li>
+<li><a href="static_pages.html">Static pages</a>, which will teach you the basics of controllers, views and routing.</li>
+<li><a href="news_section.html">News section</a>, where you'll start using models and will be doing some basic database operations.</li>
+<li><a href="create_news_items.html">Create news items</a>, which will introduce more advanced database operations and form validation.</li>
+<li><a href="conclusion.html">Conclusion</a>, which will give you some pointers on further reading and other resources.</li>
+</ul>
+
+<p>Enjoy your exploration of the CodeIgniter framework.</p>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="../overview/goals.html">Goals</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="static_pages.html">Static pages</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/tutorial/news_section.html b/user_guide/tutorial/news_section.html
new file mode 100644
index 000000000..cf3377ff9
--- /dev/null
+++ b/user_guide/tutorial/news_section.html
@@ -0,0 +1,230 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CodeIgniter Features : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+<a href="index.html">Tutorial</a> &nbsp;&#8250;&nbsp;
+News section
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Tutorial &minus; News section</h1>
+
+<p>In the last section, we went over some basic concepts of the framework by writing a class that includes static pages. We cleaned up the URI by adding custom routing rules. Now it's time to introduce dynamic content and start using a database.</p>
+
+<h2>Setting up your model</h2>
+
+<p>Instead of writing database operations right in the controller, queries should be placed in a model, so they can easily be reused later. Models are the place where you retrieve, insert, and update information in your database or other data stores. They represent your data.</p>
+
+<p>Open up the <dfn>application/models</dfn> directory and create a new file called <dfn>news_model.php</dfn> and add the following code. Make sure you've configured your database properly as described <a href="../database/configuration.html">here</a>.</p>
+
+<pre>
+&lt;?php
+class News_model extends CI_Model {
+
+ public function __construct()
+ {
+ $this->load->database();
+ }
+}
+</pre>
+
+<p>This code looks similar to the controller code that was used earlier. It creates a new model by extending CI_Model and loads the database library. This will make the database class available through the <var>$this->db</var> object.</p>
+
+<p>Before querying the database, a database schema has to be created. Connect to your database and run the SQL command below. Also add some seed records.</p>
+
+<pre>
+CREATE TABLE news (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ title varchar(128) NOT NULL,
+ slug varchar(128) NOT NULL,
+ text text NOT NULL,
+ PRIMARY KEY (id),
+ KEY slug (slug)
+);
+</pre>
+
+<p>Now that the database and a model have been set up, you'll need a method to get all of our posts from our database. To do this, the database abstraction layer that is included with CodeIgniter — <a href="../database/active_record.html">Active Record</a> — is used. This makes it possible to write your 'queries' once and make them work on <a href="../general/requirements.html">all supported database systems</a>. Add the following code to your model.</p>
+
+<pre>
+public function get_news($slug = FALSE)
+{
+ if ($slug === FALSE)
+ {
+ $query = $this->db->get('news');
+ return $query->result_array();
+ }
+
+ $query = $this->db->get_where('news', array('slug' => $slug));
+ return $query->row_array();
+}
+</pre>
+
+<p>With this code you can perform two different queries. You can get all news records, or get a news item by its <a href="#" title="a URL friendly version of a string">slug</a>. You might have noticed that the <var>$slug</var> variable wasn't sanitized before running the query; Active Record does this for you.</p>
+
+<h2>Display the news</h2>
+
+<p>Now that the queries are written, the model should be tied to the views that are going to display the news items to the user. This could be done in our pages controller created earlier, but for the sake of clarity, a new "news" controller is defined. Create the new controller at <dfn>application/controllers/news.php</dfn>.</p>
+
+<pre>
+&lt;?php
+class News extends CI_Controller {
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->load->model('news_model');
+ }
+
+ public function index()
+ {
+ $data['news'] = $this->news_model->get_news();
+ }
+
+ public function view($slug)
+ {
+ $data['news'] = $this->news_model->get_news($slug);
+ }
+}
+</pre>
+
+<p>Looking at the code, you may see some similarity with the files we created earlier. First, the "__construct" method: it calls the constructor of its parent class (<dfn>CI_Controller</dfn>) and loads the model, so it can be used in all other methods in this controller.</p>
+
+<p>Next, there are two methods to view all news items and one for a specific news item. You can see that the <var>$slug</var> variable is passed to the model's method in the second method. The model is using this slug to identify the news item to be returned.</p>
+
+<p>Now the data is retrieved by the controller through our model, but nothing is displayed yet. The next thing to do is passing this data to the views.</p>
+
+<pre>
+public function index()
+{
+ $data['news'] = $this->news_model->get_news();
+ $data['title'] = 'News archive';
+
+ $this->load->view('templates/header', $data);
+ $this->load->view('news/index', $data);
+ $this->load->view('templates/footer');
+}
+</pre>
+
+<p>The code above gets all news records from the model and assigns it to a variable. The value for the title is also assigned to the <var>$data['title']</var> element and all data is passed to the views. You now need to create a view to render the news items. Create <dfn>application/views/news/index.php</dfn> and add the next piece of code.</p>
+
+<pre>
+&lt;?php foreach ($news as $news_item): ?&gt;
+
+ &lt;h2&gt;&lt;?php echo $news_item['title'] ?&gt;&lt;/h2&gt;
+ &lt;div id="main"&gt;
+ &lt;?php echo $news_item['text'] ?&gt;
+ &lt;/div&gt;
+ &lt;p&gt;&lt;a href="news/&lt;?php echo $news_item['slug'] ?&gt;"&gt;View article&lt;/a&gt;&lt;/p&gt;
+
+&lt;?php endforeach ?&gt;
+</pre>
+
+<p>Here, each news item is looped and displayed to the user. You can see we wrote our template in PHP mixed with HTML. If you prefer to use a template language, you can use CodeIgniter's <a href="../libraries/parser.html">Template Parser</a> class or a third party parser.</p>
+
+<p>The news overview page is now done, but a page to display individual news items is still absent. The model created earlier is made in such way that it can easily be used for this functionality. You only need to add some code to the controller and create a new view. Go back to the news controller and add the following lines to the file.</p>
+
+<pre>
+public function view($slug)
+{
+ $data['news_item'] = $this->news_model->get_news($slug);
+
+ if (empty($data['news_item']))
+ {
+ show_404();
+ }
+
+ $data['title'] = $data['news_item']['title'];
+
+ $this->load->view('templates/header', $data);
+ $this->load->view('news/view', $data);
+ $this->load->view('templates/footer');
+}
+</pre>
+
+<p>Instead of calling the <var>get_news()</var> method without a parameter, the <var>$slug</var> variable is passed, so it will return the specific news item. The only things left to do is create the corresponding view at <dfn>application/views/news/view.php</dfn>. Put the following code in this file.</p>
+
+<pre>
+&lt;?php
+echo '&lt;h2&gt;'.$news_item['title'].'&lt;/h2&gt;';
+echo $news_item['text'];
+</pre>
+
+<h2>Routing</h2>
+<p>Because of the wildcard routing rule created earlier, you need need an extra route to view the controller that you just made. Modify your routing file (<dfn>application/config/routes.php</dfn>) so it looks as follows. This makes sure the requests reaches the news controller instead of going directly to the pages controller. The first line routes URI's with a slug to the view method in the news controller.</p>
+
+<pre>
+$route['news/(:any)'] = 'news/view/$1';
+$route['news'] = 'news';
+$route['(:any)'] = 'pages/view/$1';
+$route['default_controller'] = 'pages/view';
+</pre>
+
+<p>Point your browser to your document root, followed by <dfn>index.php/news</dfn> and watch your news page.</p>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="static_pages.html">Static pages</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="create_news_items.html">Create news items</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html
new file mode 100644
index 000000000..da2c58cda
--- /dev/null
+++ b/user_guide/tutorial/static_pages.html
@@ -0,0 +1,206 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>CodeIgniter Features : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+<a href="index.html">Tutorial</a> &nbsp;&#8250;&nbsp;
+Static pages
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+
+<h1>Tutorial &minus; Static pages</h1>
+
+<p class="important"><strong>Note:</strong> This tutorial assumes you've downloaded CodeIgniter and <a href="../installation/index.html">installed the framework</a> in your development environment.</p>
+
+<p>The first thing you're going to do is set up a <strong>controller</strong> to handle static pages.
+A controller is simply a class that helps delegate work. It is the glue of your
+web application.</p>
+
+<p>For example, when a call is made to: <code>http://example.com/news/latest/10</code> We might imagine
+that there is a controller named &quot;news&quot;. The method being called on news
+would be &quot;latest&quot;. The news method's job could be to grab 10
+news items, and render them on the page. Very often in MVC, you'll see URL
+patterns that match: <code>http://example.com/[controller-class]/[controller-method]/[arguments]</code>
+As URL schemes become more complex, this may change. But for now, this is all we will need to know.</p>
+
+<p>Create a file at <dfn>application/controllers/pages.php</dfn> with the following code.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="10">
+&lt;?php
+
+class Pages extends CI_Controller {
+
+ public function view($page = 'home')
+ {
+
+ }
+}
+</textarea>
+
+<p>You have created a class named &quot;pages&quot;, with a view method that accepts one argument named <var>$page</var>.
+The pages class is extending the CI_Controller class.
+This means that the new pages class can access the methods and variables defined in the CI_Controller class
+(<dfn>system/core/Controller.php</dfn>).</p>
+
+<p>The <strong>controller is what will become the center of every request</strong> to your web application.
+In very technical CodeIgniter discussions, it may be referred to as the <em>super object</em>.
+Like any php class, you refer to it within your controllers as <var>$this</var>.
+Referring to <var>$this</var> is how you will load libraries, views, and generally
+command the framework.</p>
+
+<p>Now you've created your first method, it's time to make some basic page templates.
+We will be creating two &quot;views&quot; (page templates) that act as our page footer and header.</p>
+
+<p>Create the header at <dfn>application/views/templates/header.php</dfn> and add the following code.</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="8">
+<html>
+<head>
+ <title><?php echo $title ?> - CodeIgniter 2 Tutorial</title>
+</head>
+<body>
+ <h1>CodeIgniter 2 Tutorial</h1>
+
+</textarea>
+
+<p>The header contains the basic HTML code that you'll want to display before loading the main view, together with a heading.
+It will also output the <var>$title</var> variable, which we'll define later in the controller.
+Now create a footer at <dfn>application/views/templates/footer.php</dfn> that includes the following code:</p>
+
+<textarea class="textarea" style="width:100%" cols="50" rows="4">
+<strong>&#38;copy; 2011</strong>
+</body>
+</html>
+</textarea>
+
+<h2>Adding logic to the controller</h2>
+
+<p>Earlier you set up a controller with a view() method. The method accepts one parameter, which is the name of the page to be loaded.
+The static page templates will be located in the <dfn>application/views/pages/</dfn> directory.</p>
+
+<p>In that directory, create two files named <dfn>home.php</dfn> and <dfn>about.php</dfn>.
+Within those files, type some text &minus; anything you'd like &minus; and save them.
+If you like to be particularly un-original, try &quot;Hello World!&quot;.</p>
+
+<p>In order to load those pages, you'll have to check whether the requested page actually exists:</p>
+
+<pre>
+public function view($page = 'home')
+{
+
+ if ( ! file_exists('application/views/pages/'.$page.'.php'))
+ {
+ // Whoops, we don't have a page for that!
+ show_404();
+ }
+
+ $data['title'] = ucfirst($page); // Capitalize the first letter
+
+ $this->load->view('templates/header', $data);
+ $this->load->view('pages/'.$page, $data);
+ $this->load->view('templates/footer', $data);
+
+}
+</pre>
+
+<p>Now, when the page does exist, it is loaded, including the header and footer, and displayed to the user. If the page doesn't exist, a "404 Page not found" error is shown.</p>
+
+<p>The first line in this method checks whether the page actually exists. PHP's native <var>file_exists()</var> function is used to check whether the file is where it's expected to be. <var>show_404()</var> is a built-in CodeIgniter function that renders the default error page.</p>
+
+<p>In the header template, the <var>$title</var> variable was used to customize the page title. The value of title is defined in this method, but instead of assigning the value to a variable, it is assigned to the title element in the <var>$data</var> array.</p>
+
+<p>The last thing that has to be done is loading the views in the order they should be displayed.
+The second parameter in the <var>view()</var> method is used to pass values to the view. Each value in the <var>$data</var> array is assigned to a variable with the name of its key. So the value of <var>$data['title']</var> in the controller is equivalent to $title in the view.<p>
+
+<h2>Routing</h2>
+
+<p>The controller is now functioning! Point your browser to <dfn>[your-site-url]index.php/pages/view</dfn> to see your page. When you visit <dfn>index.php/pages/view/about</dfn> you'll see the about page, again including the header and footer.</p>
+
+<p>Using custom routing rules, you have the power to map any URI to any controller and method, and break free from the normal convention:
+<code>http://example.com/[controller-class]/[controller-method]/[arguments]</code></p>
+
+<p>Let's do that. Open the routing file located at <dfn>application/config/routes.php</dfn> and add the following two lines. Remove all other code that sets any element in the <var>$route</var> array.</p>
+
+<pre>
+$route['default_controller'] = 'pages/view';
+$route['(:any)'] = 'pages/view/$1';
+</pre>
+
+<p>CodeIgniter reads its routing rules from top to bottom and routes the request to the first matching rule. Each rule is a regular expression
+(left-side) mapped to a controller and method name separated by slashes (right-side).
+When a request comes in, CodeIgniter looks for the first match, and calls the appropriate controller and method, possibly with arguments.</p>
+
+<p>More information about routing can be found in the URI Routing <a href="../general/routing.html">documentation</a>.</p>
+
+<p>Here, the second rule in the <var>$routes</var> array matches <strong>any</strong> request using the wildcard string <dfn>(:any)</dfn>.
+and passes the parameter to the view() method of the pages class.</p>
+
+<p>Now visit <dfn>index.php/about</dfn>. Did it get routed correctly to the <var>view()</var> method
+in the pages controller? Awesome!</p>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="index.html">Introduction</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="news_section.html">News section</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file