From d163e0b219b8afacea3cd0d1d7c2ce5bb6f8a933 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 14 Jun 2012 03:09:53 +0300 Subject: Polish changes from pull #1233 - Session class already has the time_reference setting - 'GMT' is a valid timezone, so nothing needs to be changed in order to work properly (upgrade notes) - Altered some description text --- application/config/config.php | 6 +++--- system/libraries/Session.php | 12 +++++------- user_guide_src/source/changelog.rst | 3 ++- user_guide_src/source/installation/upgrade_300.rst | 11 ++--------- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index 31ff2024d..7da889f81 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -362,9 +362,9 @@ $config['compress_output'] = FALSE; | Master Time Reference |-------------------------------------------------------------------------- | -| Options are 'local' or any PHP supported timezone. This pref tells the -| system whether to use your server's local time as the master 'now' -| reference, or convert it to any PHP supported timezone. See the 'date +| Options are 'local' or any PHP supported timezone. This preference tells +| the system whether to use your server's local time as the master 'now' +| reference, or convert it to the configured one timezone. See the 'date | helper' page of the user guide for information regarding date handling. | */ diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 9fdf744c3..72a942b8a 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -149,11 +149,11 @@ class CI_Session { public $flashdata_key = 'flash'; /** - * Function to use to get the current time + * Timezone to use for the current time * * @var string */ - public $time_reference = 'time'; + public $time_reference = 'local'; /** * Probablity level of garbage collection of old sessions @@ -203,7 +203,7 @@ class CI_Session { // manually via the $params array above or via the config file foreach (array('sess_encrypt_cookie', 'sess_use_database', 'sess_table_name', 'sess_expiration', 'sess_expire_on_close', 'sess_match_ip', 'sess_match_useragent', 'sess_cookie_name', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'sess_time_to_update', 'time_reference', 'cookie_prefix', 'encryption_key') as $key) { - $this->$key = (isset($params[$key])) ? $params[$key] : $this->CI->config->item($key); + $this->$key = isset($params[$key]) ? $params[$key] : $this->CI->config->item($key); } if ($this->encryption_key === '') @@ -786,14 +786,12 @@ class CI_Session { */ protected function _get_time() { - $timezone = config_item('time_reference'); - - if ($timezone === 'local' OR $timezone === date_default_timezone_get()) + if ($this->time_reference === 'local' OR $this->time_reference === date_default_timezone_get()) { return time(); } - $datetime = new DateTime('now', new DateTimeZone($timezone)); + $datetime = new DateTime('now', new DateTimeZone($this->time_reference)); sscanf($datetime->format('j-n-Y G:i:s'), '%d-%d-%d %d:%d:%d', $day, $month, $year, $hour, $minute, $second); return mktime($hour, $minute, $second, $month, $day, $year); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 1f5bcb648..06bfba887 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,7 +48,7 @@ Release Date: Not Released - Helpers - - Date helper will now return now() based on the timezone you specify. + - :doc:`Date Helper ` function now() now works with all timezone strings supported by PHP. - ``create_captcha()`` accepts additional colors parameter, allowing for color customization. - ``url_title()`` will now trim extra dashes from beginning and end. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper `. @@ -173,6 +173,7 @@ Release Date: Not Released - Added get_content_type() method to the :doc:`Output Library `. - Added get_mimes() function to system/core/Commons.php to return the config/mimes.php array. - Added a second argument to set_content_type() in the :doc:`Output Library ` that allows setting the document charset as well. + - $config['time_reference'] now supports all timezone strings supported by PHP. Bug fixes for 3.0 ------------------ diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index d8a3d5bc1..c70737cff 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -42,14 +42,7 @@ need to rename the `$active_record` variable to `$query_builder`. // $active_record = TRUE; $query_builder = TRUE; -Step 5: Change your use of the Date helper's now() function -=========================================================== - -Function now() has been modified. You can see the changes in :doc:`Date Helper <../helpers/date_helper>`. -You can now select all PHP supported timezones in the `time_reference` setting, listed here: -`Supported timezones `_. You can also use 'local' if you want to get time(). - -Step 6: Move your errors folder +Step 5: Move your errors folder =============================== -In version 3.0.0, the errors folder has been moved from "application/errors" to "application/views/errors". \ No newline at end of file +In version 3.0.0, the errors folder has been moved from _application/errors_ to _application/views/errors_. \ No newline at end of file -- cgit v1.2.3-24-g4f1b