Add timezone option to the config file

Fixes #55
This commit is contained in:
Dmitriy Simushev 2014-08-04 14:18:43 +00:00
parent fdfb945ed0
commit ef5c919803
2 changed files with 9 additions and 3 deletions

View File

@ -21,6 +21,11 @@ home_locale: en
## If user does not provide known lang
default_locale: en
# A timezone to use. Leave this value empty to use the default timezone from the
# system settings. For the details about available timezones see
# http://php.net/manual/en/timezones.php
timezone: ""
# Plugins
plugins: []

View File

@ -67,9 +67,10 @@ if (is_secure_request()) {
session_start();
if (function_exists("date_default_timezone_set")) {
// TODO try to get timezone from config.yml/session etc.
// autodetect timezone
@date_default_timezone_set(function_exists("date_default_timezone_get") ? @date_default_timezone_get() : "GMT");
$timezone = !empty($configs['timezone'])
? $configs['timezone']
: (function_exists("date_default_timezone_get") ? @date_default_timezone_get() : "GMT");
@date_default_timezone_set($timezone);
}
if (!installation_in_progress()) {