summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/config/config.php6
-rw-r--r--system/core/Config.php14
-rw-r--r--system/core/Loader.php2
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php2
-rw-r--r--system/helpers/array_helper.php4
-rw-r--r--system/helpers/date_helper.php41
-rw-r--r--system/libraries/Image_lib.php9
-rw-r--r--tests/codeigniter/helpers/date_helper_test.php20
-rw-r--r--user_guide_src/source/changelog.rst9
-rw-r--r--user_guide_src/source/database/configuration.rst122
-rw-r--r--user_guide_src/source/database/connecting.rst34
-rw-r--r--user_guide_src/source/general/models.rst61
-rw-r--r--user_guide_src/source/helpers/date_helper.rst29
-rw-r--r--user_guide_src/source/installation/downloads.rst8
-rw-r--r--user_guide_src/source/installation/upgrade_210.rst14
-rw-r--r--user_guide_src/source/installation/upgrade_211.rst25
-rw-r--r--user_guide_src/source/installation/upgrade_212.rst10
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst127
18 files changed, 355 insertions, 182 deletions
diff --git a/application/config/config.php b/application/config/config.php
index 726e3a71c..28fc406d1 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -300,9 +300,9 @@ $config['sess_time_to_update'] = 300;
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
*/
-$config['cookie_prefix'] = "";
-$config['cookie_domain'] = "";
-$config['cookie_path'] = "/";
+$config['cookie_prefix'] = '';
+$config['cookie_domain'] = '';
+$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
diff --git a/system/core/Config.php b/system/core/Config.php
index 4b4e5a7ba..2f6a9e085 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -43,7 +43,7 @@ class CI_Config {
*
* @var array
*/
- public $config = array();
+ public $config = array();
/**
* List of all loaded config files
@@ -102,13 +102,13 @@ class CI_Config {
{
$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
$found = $loaded = FALSE;
+
+ $check_locations = defined('ENVIRONMENT')
+ ? array(ENVIRONMENT.'/'.$file, $file)
+ : array($file);
foreach ($this->_config_paths as $path)
{
- $check_locations = defined('ENVIRONMENT')
- ? array(ENVIRONMENT.'/'.$file, $file)
- : array($file);
-
foreach ($check_locations as $location)
{
$file_path = $path.'config/'.$location.'.php';
@@ -172,7 +172,7 @@ class CI_Config {
{
return FALSE;
}
- show_error('The configuration file '.$file.'.php'.' does not exist.');
+ show_error('The configuration file '.$file.'.php does not exist.');
}
return TRUE;
@@ -271,7 +271,7 @@ class CI_Config {
*/
public function base_url($uri = '')
{
- return $this->slash_item('base_url').ltrim($this->_uri_string($uri),'/');
+ return $this->slash_item('base_url').ltrim($this->_uri_string($uri), '/');
}
// -------------------------------------------------------------
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 94739c74a..d51ee0b34 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -820,7 +820,7 @@ class CI_Loader {
/*
* Extract and cache variables
*
- * You can either set variables using the dedicated $this->load_vars()
+ * You can either set variables using the dedicated $this->load->vars()
* function or via the second parameter of this function. We'll merge
* the two types and cache them so that views that are embedded within
* other views can have access to these variables.
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 12482dee0..3a4fc0aff 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -143,7 +143,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
protected function _execute($sql)
{
- return (is_write_type($sql) && stripos($sql, 'INSERT') === FALSE)
+ return ($this->is_write_type($sql) && stripos($sql, 'INSERT') === FALSE)
? sqlsrv_query($this->conn_id, $sql)
: sqlsrv_query($this->conn_id, $sql, NULL, array('Scrollable' => SQLSRV_CURSOR_STATIC));
}
diff --git a/system/helpers/array_helper.php b/system/helpers/array_helper.php
index 5d0243951..ed2fe3c4a 100644
--- a/system/helpers/array_helper.php
+++ b/system/helpers/array_helper.php
@@ -52,7 +52,7 @@ if ( ! function_exists('element'))
*/
function element($item, $array, $default = NULL)
{
- return empty($array[$item]) ? $default : $array[$item];
+ return array_key_exists($item, $array) ? $array[$item] : $default;
}
}
@@ -95,7 +95,7 @@ if ( ! function_exists('elements'))
foreach ($items as $item)
{
- $return[$item] = isset($array[$item]) ? $array[$item] : $default;
+ $return[$item] = array_key_exists($item, $array) ? $array[$item] : $default;
}
return $return;
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index 9637e26ce..a45b3d7ac 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -117,26 +117,37 @@ if ( ! function_exists('standard_date'))
*
* Returns a date formatted according to the submitted standard.
*
+ * As of PHP 5.2, the DateTime extension provides constants that
+ * serve for the exact same purpose and are used with date().
+ * Due to that, this function is DEPRECATED and should be removed
+ * in CodeIgniter 3.1+.
+ *
+ * Here are two examples of how you should replace it:
+ *
+ * date(DATE_RFC822, now()); // default
+ * date(DATE_W3C, $time); // a different format and time
+ *
+ * Reference: http://www.php.net/manual/en/class.datetime.php#datetime.constants.types
+ *
+ * @deprecated
* @param string the chosen format
* @param int Unix timestamp
* @return string
*/
- function standard_date($fmt = 'DATE_RFC822', $time = '')
+ function standard_date($fmt = 'DATE_RFC822', $time = NULL)
{
- $formats = array(
- 'DATE_ATOM' => '%Y-%m-%dT%H:%i:%s%P',
- 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC',
- 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%P',
- 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O',
- '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_RFC2822' => '%r',
- 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O',
- 'DATE_W3C' => '%Y-%m-%dT%H:%i:%s%P'
- );
-
- return isset($formats[$fmt]) ? mdate($formats[$fmt], $time) : FALSE;
+ if (empty($time))
+ {
+ $time = now();
+ }
+
+ // Procedural style pre-defined constants from the DateTime extension
+ if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE)
+ {
+ return FALSE;
+ }
+
+ return date(constant($fmt), $time);
}
}
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 4735dfd08..899b995d4 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -855,7 +855,14 @@ class CI_Image_lib {
}
else // Resize
{
- $cmd .= ' -resize '.$this->width.'x'.$this->height.' "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1';
+ if($this->maintain_ratio === TRUE)
+ {
+ $cmd .= ' -resize '.$this->width.'x'.$this->height.' "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1';
+ }
+ else
+ {
+ $cmd .= ' -resize '.$this->width.'x'.$this->height.'\! "'.$this->full_src_path.'" "'.$this->full_dst_path.'" 2>&1';
+ }
}
$retval = 1;
diff --git a/tests/codeigniter/helpers/date_helper_test.php b/tests/codeigniter/helpers/date_helper_test.php
index eaf4cf8a5..1b79b9480 100644
--- a/tests/codeigniter/helpers/date_helper_test.php
+++ b/tests/codeigniter/helpers/date_helper_test.php
@@ -69,7 +69,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_rfc822()
{
$this->assertEquals(
- date('D, d M y H:i:s O', $this->time),
+ date(DATE_RFC822, $this->time),
standard_date('DATE_RFC822', $this->time)
);
}
@@ -79,7 +79,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_atom()
{
$this->assertEquals(
- date('Y-m-d\TH:i:sP', $this->time),
+ date(DATE_ATOM, $this->time),
standard_date('DATE_ATOM', $this->time)
);
}
@@ -89,7 +89,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_cookie()
{
$this->assertEquals(
- date("l, d-M-y H:i:s \U\T\C", $this->time),
+ date(DATE_COOKIE, $this->time),
standard_date('DATE_COOKIE', $this->time)
);
}
@@ -99,7 +99,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_iso8601()
{
$this->assertEquals(
- date('Y-m-d\TH:i:sP', $this->time),
+ date(DATE_ISO8601, $this->time),
standard_date('DATE_ISO8601', $this->time)
);
}
@@ -109,7 +109,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_rfc850()
{
$this->assertEquals(
- date("l, d-M-y H:i:s \U\T\C", $this->time),
+ date(DATE_RFC850, $this->time),
standard_date('DATE_RFC850', $this->time)
);
}
@@ -119,7 +119,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_rfc1036()
{
$this->assertEquals(
- date('D, d M y H:i:s O', $this->time),
+ date(DATE_RFC1036, $this->time),
standard_date('DATE_RFC1036', $this->time)
);
}
@@ -129,7 +129,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_rfc1123()
{
$this->assertEquals(
- date('D, d M Y H:i:s O', $this->time),
+ date(DATE_RFC1123, $this->time),
standard_date('DATE_RFC1123', $this->time)
);
}
@@ -139,7 +139,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_rfc2822()
{
$this->assertEquals(
- date('r', $this->time),
+ date(DATE_RFC2822, $this->time),
standard_date('DATE_RFC2822', $this->time)
);
}
@@ -149,7 +149,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_rss()
{
$this->assertEquals(
- date('D, d M Y H:i:s O', $this->time),
+ date(DATE_RSS, $this->time),
standard_date('DATE_RSS', $this->time)
);
}
@@ -159,7 +159,7 @@ class Date_helper_test extends CI_TestCase {
public function test_standard_date_w3c()
{
$this->assertEquals(
- date('Y-m-d\TH:i:sP', $this->time),
+ date(DATE_W3C, $this->time),
standard_date('DATE_W3C', $this->time)
);
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index a2788ca77..f69ce5c15 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -52,7 +52,11 @@ Release Date: Not Released
- Helpers
- - :doc:`Date Helper <helpers/date_helper>` function now() now works with all timezone strings supported by PHP.
+ - :doc:`Date Helper <helpers/date_helper>` changes include:
+ - ``now()`` now works with all timezone strings supported by PHP.
+ - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed.
+ - Added an optional parameter to ``timezone_menu()`` that allows more attributes to be added to the generated select tag.
+ - Deprecated ``standard_date()``, which now just uses the native ``date()`` with `DateTime constants <http://bg2.php.net/manual/en/class.datetime.php#datetime.constants.types>`_.
- ``create_captcha()`` accepts additional colors parameter, allowing for color customization.
- :doc:`URL Helper <helpers/url_helper>` changes include:
- ``url_title()`` will now trim extra dashes from beginning and end.
@@ -63,7 +67,6 @@ Release Date: Not Released
- Changed ``humanize()`` to include a second param for the separator.
- Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words.
- Added an optional third parameter to ``force_download()`` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default).
- - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed.
- Added a work-around in ``force_download()`` for a bug Android <= 2.1, where the filename extension needs to be in uppercase.
- ``form_dropdown()`` will now also take an array for unity with other form helpers.
- ``do_hash()`` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated.
@@ -72,7 +75,6 @@ Release Date: Not Released
- ``set_realpath()`` can now also handle file paths as opposed to just directories.
- Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html.
- ``read_file()`` is now a deprecated alias of ``file_get_contents()``.
- - Added an optional parameter to :doc:`Date Helper <helpers/date_helper>` function ``timezone_menu()`` that allows more attributes to be added to the generated select tag.
- :doc:`Security Helper <helpers/security_helper>` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library <libraries/security>`.
- Database
@@ -151,6 +153,7 @@ Release Date: Not Released
- Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them.
- Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method if they are set manually after initialization.
- If property maintain_ratio is set to TRUE, image_reproportion() now doesn't need both width and height to be specified.
+ - Property maintain_ratio is now taken into account when resizing images using ImageMagick library
- Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
- Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
- Added $config['csrf_exclude_uris'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which allows you list URIs which will not have the CSRF validation functions run.
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst
index 7a19c840f..c17de600a 100644
--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -12,26 +12,44 @@ it the respective environment config folder.
The config settings are stored in a multi-dimensional array with this
prototype::
- $db['default']['hostname'] = "localhost";
- $db['default']['username'] = "root";
- $db['default']['password'] = "";
- $db['default']['database'] = "database_name";
- $db['default']['dbdriver'] = "mysql";
- $db['default']['dbprefix'] = "";
- $db['default']['pconnect'] = TRUE;
- $db['default']['db_debug'] = FALSE;
- $db['default']['cache_on'] = FALSE;
- $db['default']['cachedir'] = "";
- $db['default']['char_set'] = "utf8";
- $db['default']['dbcollat'] = "utf8_general_ci";
- $db['default']['swap_pre'] = "";
- $db['default']['autoinit'] = TRUE;
- $db['default']['stricton'] = FALSE;
-
-If you use PDO as your dbdriver, you can specify the full DSN string describe a connection to the database like this::
-
+ $db['default'] = array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'root',
+ 'password' => '',
+ 'database' => 'database_name',
+ 'dbdriver' => 'mysqli',
+ 'dbprefix' => '',
+ 'pconnect' => TRUE,
+ 'db_debug' => TRUE,
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'autoinit' => TRUE,
+ 'stricton' => FALSE,
+ 'failover' => array()
+ );
+
+Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might
+require a full DSN string to be provided. If that is the case, you
+should use the 'dsn' configuration setting, as if you're using the
+driver's underlying native PHP extension, like this::
+
+ // PDO
$db['default']['dsn'] = 'pgsql:host=localhost;port=5432;dbname=database_name';
+ // Oracle
+ $db['default']['dsn'] = '//localhost/XE';
+
+.. note:: If you do not specify a DSN string for a driver that requires it, CodeIgniter
+ will try to build it with the rest of the provided settings.
+
+.. note:: If you provide a DSN string and it is missing some valid settings (e.g. the
+ database character set), which are present in the rest of the configuration
+ fields, CodeIgniter will append them.
+
You can also specify failovers for the situation when the main connection cannot connect for some reason.
These failovers can be specified by setting the failover for a connection like this::
@@ -41,7 +59,7 @@ These failovers can be specified by setting the failover for a connection like t
'username' => '',
'password' => '',
'database' => '',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
@@ -58,7 +76,7 @@ These failovers can be specified by setting the failover for a connection like t
'username' => '',
'password' => '',
'database' => '',
- 'dbdriver' => 'mysql',
+ 'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
@@ -81,30 +99,34 @@ production, test, etc.) under a single installation, you can set up a
connection group for each, then switch between groups as needed. For
example, to set up a "test" environment you would do this::
- $db['test']['hostname'] = "localhost";
- $db['test']['username'] = "root";
- $db['test']['password'] = "";
- $db['test']['database'] = "database_name";
- $db['test']['dbdriver'] = "mysql";
- $db['test']['dbprefix'] = "";
- $db['test']['pconnect'] = TRUE;
- $db['test']['db_debug'] = FALSE;
- $db['test']['cache_on'] = FALSE;
- $db['test']['cachedir'] = "";
- $db['test']['char_set'] = "utf8";
- $db['test']['dbcollat'] = "utf8_general_ci";
- $db['test']['swap_pre'] = "";
- $db['test']['autoinit'] = TRUE;
- $db['test']['stricton'] = FALSE;
+ $db['test'] = array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'root',
+ 'password' => '',
+ 'database' => 'database_name',
+ 'dbdriver' => 'mysqli',
+ 'dbprefix' => '',
+ 'pconnect' => TRUE,
+ 'db_debug' => TRUE,
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'autoinit' => TRUE,
+ 'stricton' => FALSE,
+ 'failover' => array()
+ );
Then, to globally tell the system to use that group you would set this
variable located in the config file::
- $active_group = "test";
+ $active_group = 'test';
-Note: The name "test" is arbitrary. It can be anything you want. By
-default we've used the word "default" for the primary connection, but it
-too can be renamed to something more relevant to your project.
+.. note:: The name 'test' is arbitrary. It can be anything you want. By
+ default we've used the word "default" for the primary connection,
+ but it too can be renamed to something more relevant to your project.
Query Builder
-------------
@@ -119,8 +141,8 @@ when the database classes are initialized.
$query_builder = TRUE;
-.. note:: that some CodeIgniter classes such as Sessions require Active
- Records be enabled to access certain functionality.
+.. note:: that some CodeIgniter classes such as Sessions require Query
+ Builder to be enabled to access certain functionality.
Explanation of Values:
----------------------
@@ -128,11 +150,12 @@ Explanation of Values:
====================== ==================================================================================================
Name Config Description
====================== ==================================================================================================
-**hostname** The hostname of your database server. Often this is "localhost".
+**dsn** The DSN connect string (an all-in-one configuration sequence).
+**hostname** The hostname of your database server. Often this is 'localhost'.
**username** The username used to connect to the database.
**password** The password used to connect to the database.
**database** The name of the database you want to connect to.
-**dbdriver** The database type. ie: mysql, postgre, odbc, etc. Must be specified in lower case.
+**dbdriver** The database type. ie: mysqli, postgre, odbc, etc. Must be specified in lower case.
**dbprefix** An optional table prefix which will added to the table name when running :doc:
`Query Builder <query_builder>` queries. This permits multiple CodeIgniter installations
to share one database.
@@ -144,14 +167,7 @@ Explanation of Values:
**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
- (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.
+ .. note:: Only used in the 'mysql' and 'mysqli' drivers.
**swap_pre** A default table prefix that should be swapped with dbprefix. This is useful for distributed
applications where you might run manually written queries, and need the prefix to still be
@@ -163,11 +179,11 @@ Explanation of Values:
**port** The database port number. To use this value you have to add a line to the database config array.
::
- $db['default']['port'] = 5432;
+ $db['default']['port'] = 5432;
====================== ==================================================================================================
.. note:: Depending on what database platform you are using (MySQL, PostgreSQL,
etc.) not all values will be needed. For example, when using SQLite you
will not need to supply a username or password, and the database name
will be the path to your database file. The information above assumes
- you are using MySQL.
+ you are using MySQL. \ No newline at end of file
diff --git a/user_guide_src/source/database/connecting.rst b/user_guide_src/source/database/connecting.rst
index 5822ca62c..9b8117076 100644
--- a/user_guide_src/source/database/connecting.rst
+++ b/user_guide_src/source/database/connecting.rst
@@ -57,25 +57,28 @@ file.
To connect manually to a desired database you can pass an array of
values::
- $config['hostname'] = "localhost";
- $config['username'] = "myusername";
- $config['password'] = "mypassword";
- $config['database'] = "mydatabase";
- $config['dbdriver'] = "mysql";
- $config['dbprefix'] = "";
- $config['pconnect'] = FALSE;
- $config['db_debug'] = TRUE;
- $config['cache_on'] = FALSE;
- $config['cachedir'] = "";
- $config['char_set'] = "utf8";
- $config['dbcollat'] = "utf8_general_ci";
+ $config['hostname'] = 'localhost';
+ $config['username'] = 'myusername';
+ $config['password'] = 'mypassword';
+ $config['database'] = 'mydatabase';
+ $config['dbdriver'] = 'mysqli';
+ $config['dbprefix'] = '';
+ $config['pconnect'] = FALSE;
+ $config['db_debug'] = TRUE;
+ $config['cache_on'] = FALSE;
+ $config['cachedir'] = '';
+ $config['char_set'] = 'utf8';
+ $config['dbcollat'] = 'utf8_general_ci';
$this->load->database($config);
For information on each of these values please see the :doc:`configuration
page <configuration>`.
-.. note:: For the PDO driver, $config['hostname'] should look like
- this: 'mysql:host=localhost'
+.. note:: For the PDO driver, you should use the $config['dsn'] setting
+ instead of 'hostname' and 'database':
+
+ |
+ | $config['dsn'] = 'mysql:host=localhost;dbname=mydatabase';
Or you can submit your database values as a Data Source Name. DSNs must
have this prototype::
@@ -149,5 +152,4 @@ connections, you can explicitly close the connection.
::
- $this->db->close();
-
+ $this->db->close(); \ No newline at end of file
diff --git a/user_guide_src/source/general/models.rst b/user_guide_src/source/general/models.rst
index 2e1e025ee..4e52a9648 100644
--- a/user_guide_src/source/general/models.rst
+++ b/user_guide_src/source/general/models.rst
@@ -72,10 +72,11 @@ The basic prototype for a model class is this::
class Model_name extends CI_Model {
- function __construct()
- {
- parent::__construct();
- }
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
}
Where **Model_name** is the name of your class. Class names **must** have
@@ -87,10 +88,11 @@ example, if your class is this::
class User_model extends CI_Model {
- function __construct()
- {
- parent::__construct();
- }
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
}
Your file will be this::
@@ -102,7 +104,7 @@ Loading a Model
Your models will typically be loaded and called from within your
:doc:`controller <controllers>` functions. To load a model you will use
-the following function::
+the following method::
$this->load->model('model_name');
@@ -112,33 +114,34 @@ application/models/blog/queries.php you'll load it using::
$this->load->model('blog/queries');
-Once loaded, you will access your model functions using an object with
-the same name as your class::
+Once loaded, you will access your model methods using an object with the
+same name as your class::
$this->load->model('model_name');
- $this->model_name->function();
+ $this->model_name->method();
If you would like your model assigned to a different object name you can
-specify it via the second parameter of the loading function::
+specify it via the second parameter of the loading method::
- $this->load->model('model_name', 'fubar');
+ $this->load->model('model_name', 'foobar');
- $this->fubar->function();
+ $this->foobar->method();
Here is an example of a controller, that loads a model, then serves a
view::
class Blog_controller extends CI_Controller {
- function blog()
- {
- $this->load->model('blog');
+ public function blog()
+ {
+ $this->load->model('blog');
- $data['query'] = $this->Blog->get_last_ten_entries();
+ $data['query'] = $this->Blog->get_last_ten_entries();
+
+ $this->load->view('blog', $data);
+ }
- $this->load->view('blog', $data);
- }
}
@@ -170,15 +173,13 @@ database. The following options for connecting are available to you:
- You can manually pass database connectivity settings via the third
parameter::
- $config['hostname'] = "localhost";
- $config['username'] = "myusername";
- $config['password'] = "mypassword";
- $config['database'] = "mydatabase";
- $config['dbdriver'] = "mysql";
- $config['dbprefix'] = "";
+ $config['hostname'] = 'localhost';
+ $config['username'] = 'myusername';
+ $config['password'] = 'mypassword';
+ $config['database'] = 'mydatabase';
+ $config['dbdriver'] = 'mysqli';
+ $config['dbprefix'] = '';
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
- $this->load->model('Model_name', '', $config);
-
-
+ $this->load->model('Model_name', '', $config); \ No newline at end of file
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index 5adfb18d2..e332a913f 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -40,7 +40,7 @@ If a timezone is not provided, it will return time() based on "time_reference" s
mdate()
=======
-This function is identical to PHPs `date() <http://www.php.net/date>`_
+This function is identical to PHP's `date() <http://www.php.net/date>`_
function, except that it lets you use MySQL style date codes, where each
code letter is preceded with a percent sign: %Y %m %d etc.
@@ -85,21 +85,28 @@ Example
The first parameter must contain the format, the second parameter must
contain the date as a Unix timestamp.
+.. note:: This function is DEPRECATED. Use the native ``date()`` combined
+ with `DateTime's format constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_
+ instead:
+
+ |
+ | echo date(DATE_RFC822, time());
+
Supported formats:
=============== ======================= ======================================
Constant Description Example
=============== ======================= ======================================
-DATE_ATOM Atom 2005-08-15T16:13:03+0000
-DATE_COOKIE HTTP Cookies Sun, 14 Aug 2005 16:13:03 UTC
-DATE_ISO8601 ISO-8601 2005-08-14T16:13:03+00:00
-DATE_RFC822 RFC 822 Sun, 14 Aug 05 16:13:03 UTC
-DATE_RFC850 RFC 850 Sunday, 14-Aug-05 16:13:03 UTC
-DATE_RFC1036 RFC 1036 Sunday, 14-Aug-05 16:13:03 UTC
-DATE_RFC1123 RFC 1123 Sun, 14 Aug 2005 16:13:03 UTC
-DATE_RFC2822 RFC 2822 Sun, 14 Aug 2005 16:13:03 +0000
-DATE_RSS RSS Sun, 14 Aug 2005 16:13:03 UTC
-DATE_W3C W3C 2005-08-14T16:13:03+0000
+DATE_ATOM Atom 2005-08-15T16:13:03+0000
+DATE_COOKIE HTTP Cookies Sun, 14 Aug 2005 16:13:03 UTC
+DATE_ISO8601 ISO-8601 2005-08-14T16:13:03+00:00
+DATE_RFC822 RFC 822 Sun, 14 Aug 05 16:13:03 UTC
+DATE_RFC850 RFC 850 Sunday, 14-Aug-05 16:13:03 UTC
+DATE_RFC1036 RFC 1036 Sunday, 14-Aug-05 16:13:03 UTC
+DATE_RFC1123 RFC 1123 Sun, 14 Aug 2005 16:13:03 UTC
+DATE_RFC2822 RFC 2822 Sun, 14 Aug 2005 16:13:03 +0000
+DATE_RSS RSS Sun, 14 Aug 2005 16:13:03 UTC
+DATE_W3C W3C 2005-08-14T16:13:03+0000
=============== ======================= ======================================
local_to_gmt()
diff --git a/user_guide_src/source/installation/downloads.rst b/user_guide_src/source/installation/downloads.rst
index a4a6b7fbe..45a8f80a7 100644
--- a/user_guide_src/source/installation/downloads.rst
+++ b/user_guide_src/source/installation/downloads.rst
@@ -2,9 +2,15 @@
Downloading CodeIgniter
#######################
-- `CodeIgniter V 2.1.0 (Current
+- `CodeIgniter V 3.0.0 (Current
version) <http://codeigniter.com/downloads/>`_
- `CodeIgniter V
+ 2.1.2 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.1.2.zip>`_
+- `CodeIgniter V
+ 2.1.1 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.1.1.zip>`_
+- `CodeIgniter V
+ 2.1.0 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.1.0.zip>`_
+- `CodeIgniter V
2.0.3 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.3.zip>`_
- `CodeIgniter V
2.0.2 <http://codeigniter.com/download_files/reactor/CodeIgniter_2.0.2.zip>`_
diff --git a/user_guide_src/source/installation/upgrade_210.rst b/user_guide_src/source/installation/upgrade_210.rst
index 1625c64bd..5874bfc86 100644
--- a/user_guide_src/source/installation/upgrade_210.rst
+++ b/user_guide_src/source/installation/upgrade_210.rst
@@ -10,9 +10,17 @@ Step 1: Update your CodeIgniter files
Replace all files and directories in your "system" folder.
-Step 2: Update your user guide
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
+
+Step 2: Replace config/user_agents.php
+======================================
+
+This config file has been updated to contain more user agent types,
+please copy it to _application/config/user_agents.php*.
+
+Step 3: Update your user guide
==============================
Please also replace your local copy of the user guide with the new
-version.
-
+version. \ No newline at end of file
diff --git a/user_guide_src/source/installation/upgrade_211.rst b/user_guide_src/source/installation/upgrade_211.rst
index 882a520c5..59faca8e6 100644
--- a/user_guide_src/source/installation/upgrade_211.rst
+++ b/user_guide_src/source/installation/upgrade_211.rst
@@ -8,11 +8,26 @@ replacing the index.php file with a static one.
Step 1: Update your CodeIgniter files
=====================================
-Replace all files and directories in your "system" folder.
+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.
-Step 2: Update your user guide
-==============================
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
-Please also replace your local copy of the user guide with the new
-version.
+Step 2: Replace config/mimes.php
+================================
+This config file has been updated to contain more user mime-types, please copy
+it to _application/config/mimes.php*.
+
+Step 3: Update your IP address tables
+=====================================
+
+This upgrade adds support for IPv6 IP addresses. In order to store them, you need
+to enlarge your ip_address columns to 45 characters. For example, CodeIgniter's
+session table will need to change
+
+::
+
+ ALTER TABLE ci_sessions CHANGE ip_address ip_address varchar(45) default '0' NOT NULL \ No newline at end of file
diff --git a/user_guide_src/source/installation/upgrade_212.rst b/user_guide_src/source/installation/upgrade_212.rst
index fa0fb8073..205ad8622 100644
--- a/user_guide_src/source/installation/upgrade_212.rst
+++ b/user_guide_src/source/installation/upgrade_212.rst
@@ -8,11 +8,15 @@ replacing the index.php file with a static one.
Step 1: Update your CodeIgniter files
=====================================
-Replace all files and directories in your "system" folder.
+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.
+
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
Step 2: Update your user guide
==============================
Please also replace your local copy of the user guide with the new
-version.
-
+version. \ No newline at end of file
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index 14199092f..f304a716f 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -1,15 +1,14 @@
#############################
-Upgrading from 2.1.0 to 3.0.0
+Upgrading from 2.1.2 to 3.0.0
#############################
.. note:: These upgrade notes are for a version that is yet to be released.
+Before performing an update you should take your site offline by replacing the index.php file with a static one.
-Before performing an update you should take your site offline by
-replacing the index.php file with a static one.
-
+*************************************
Step 1: Update your CodeIgniter files
-=====================================
+*************************************
Replace all files and directories in your "system" folder and replace
your index.php file. If any modifications were made to your index.php
@@ -18,22 +17,23 @@ they will need to be made fresh in this new one.
.. note:: If you have any custom developed files in these folders please
make copies of them first.
-Step 2: Change References to the SHA Library
-============================================
-
-The previously deprecated SHA library has been removed in CodeIgniter 3.0.
-Alter your code to use the native `sha1()` PHP function to generate a sha1 hash.
+********************************
+Step 2: Replace config/mimes.php
+********************************
-Additionally, the `sha1()` method in the :doc:`Encryption Library <../libraries/encryption>` has been removed.
+This config file has been updated to contain more user mime-types, please copy
+it to _application/config/mimes.php*.
+**************************************************************
Step 3: Remove $autoload['core'] from your config/autoload.php
-==============================================================
+**************************************************************
-Use of the `$autoload['core']` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed.
-Move any entries that you might have listed there to `$autoload['libraries']` instead.
+Use of the ``$autoload['core']`` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed.
+Move any entries that you might have listed there to ``$autoload['libraries']`` instead.
+***************************************
Step 4: Update your config/database.php
-=======================================
+***************************************
Due to 3.0.0's renaming of Active Record to Query Builder, inside your `config/database.php`, you will
need to rename the `$active_record` variable to `$query_builder`.
@@ -42,7 +42,100 @@ need to rename the `$active_record` variable to `$query_builder`.
// $active_record = TRUE;
$query_builder = TRUE;
+*******************************
Step 5: Move your errors folder
-===============================
+*******************************
+
+In version 3.0.0, the errors folder has been moved from _application/errors* to _application/views/errors*.
+
+****************************************************************************
+Step 6: Check the calls to Array Helper's element() and elements() functions
+****************************************************************************
+
+The default return value of these functions, when the required elements
+don't exist, has been changed from FALSE to NULL.
+
+***************************************************************
+Step 7: Remove usage of (previously) deprecated functionalities
+***************************************************************
+
+In addition to the ``$autoload['core']`` configuration setting, there's a number of other functionalities
+that have been removed in CodeIgniter 3.0.0:
+
+The SHA1 library
+================
+
+The previously deprecated SHA1 library has been removed, alter your code to use PHP's native
+``sha1()`` function to generate a SHA1 hash.
+
+Additionally, the ``sha1()`` method in the :doc:`Encryption Library <../libraries/encryption>` has been removed.
+
+The EXT constant
+================
+
+Usage of the ``EXT`` constant has been deprecated since dropping support for PHP 4. There's no
+longer a need to maintain different filename extensions and in this new CodeIgniter version,
+the ``EXT`` constant has been removed. Use just '.php' instead.
+
+Smiley helper js_insert_smiley()
+================================
+
+:doc:`Smiley Helper <../helpers/smiley_helper>` function ``js_insert_smiley()`` has been deprecated
+since CodeIgniter 1.7.2 and is now removed. You'll need to switch to ``smiley_js()`` instead.
+
+Security helper do_hash()
+=========================
+
+:doc:`Security Helper <../helpers/security_helper>` function ``do_hash()`` is now just an alias for
+PHP's native ``hash()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+.
+
+.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner
+ rather than later.
+
+File helper read_file()
+=======================
+
+:doc:`File Helper <../helpers/file_helper>` function ``read_file()`` is now just an alias for
+PHP's native ``file_get_contents()`` function. It is deprecated and scheduled for removal in
+CodeIgniter 3.1+.
+
+.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner
+ rather than later.
+
+Date helper standard_date()
+===========================
+
+:doc:`Date Helper <../helpers/date_helper>` function ``standard_date()`` is being deprecated due
+to the availability of native PHP `constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_,
+which when combined with ``date()`` provide the same functionality. Furthermore, they have the
+exact same names as the ones supported by ``standard_date()``. Here are examples of how to replace
+it's usage:
+
+::
+
+ // Old way
+ standard_date(); // defaults to standard_date('DATE_RFC822', now());
+
+ // Replacement
+ date(DATE_RFC822, now());
+
+ // Old way
+ standard_date('DATE_ATOM', $time);
+
+ // Replacement
+ date(DATE_ATOM, $time);
+
+.. note:: This function is still available, but you're strongly encouraged to remove its' usage sooner
+ rather than later as it is scheduled for removal in CodeIgniter 3.1+.
+
+Pagination library 'anchor_class' setting
+=========================================
+
+The :doc:`Pagination Library <../libraries/pagination>` now supports adding pretty much any HTML
+attribute to your anchors via the 'attributes' configuration setting. This includes passing the
+'class' attribute and using the separate 'anchor_class' setting no longer makes sense.
+As a result of that, the 'anchor_class' setting is now deprecated and scheduled for removal in
+CodeIgniter 3.1+.
-In version 3.0.0, the errors folder has been moved from _application/errors* to _application/views/errors*. \ No newline at end of file
+.. note:: This setting is still available, but you're strongly encouraged to remove its' usage sooner
+ rather than later. \ No newline at end of file