Skip to content

Commit

Permalink
*7567* Fixes to time zone code
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelThessel committed Aug 26, 2013
1 parent a576772 commit 59bf8bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions classes/core/PKPApplication.inc.php
Expand Up @@ -105,9 +105,8 @@ function PKPApplication() {
// Starting from PHP 5.3.0 PHP will throw an E_WARNING if the default
// time zone is not set and date/time functions are used
// http://pl.php.net/manual/en/function.date-default-timezone-set.php
if ($timeZone = AppLocale::getTimeZone()) {
date_default_timezone_set($timeZone);
}
$timeZone = AppLocale::getTimeZone();
date_default_timezone_set($timeZone);

String::init();
set_error_handler(array($this, 'errorHandler'));
Expand Down
11 changes: 4 additions & 7 deletions classes/i18n/PKPLocale.inc.php
Expand Up @@ -643,16 +643,13 @@ static function _allLocalesCacheMiss($cache, $id) {
}

/**
* Get the sites time zone. This will try to load the time zone setting from
* config.inc.php. In case the time zone is not specified there it will
* fall back to the time zone specified in php.ini. If this is not set
* either it will default to UTC.
* Get the sites time zone.
* @return string Time zone
*/
static function getTimeZone() {
$timeZone = null;

// Load the time zone from the config
// Load the time zone from the configuration file
if ($timeZoneConfig = Config::getVar('general', 'time_zone')) {
$timeZoneDAO = DAORegistry::getDAO('TimeZoneDAO');
$timeZoneList = $timeZoneDAO->getTimeZones();
Expand All @@ -665,10 +662,10 @@ static function getTimeZone() {
}

// Fall back to the time zone set in php.ini
if (empty($timeZone)) { $timeZone = ini_get('date.timezone'); }
if (empty($timeZone)) $timeZone = ini_get('date.timezone');

// Fall back to UTC
if (empty($timeZone)) { $timeZone = 'UTC'; }
if (empty($timeZone)) $timeZone = 'UTC';

return $timeZone;
}
Expand Down

0 comments on commit 59bf8bb

Please sign in to comment.