- Fix typo in timezone handling, more exception catching

pull/1/head
alecpl 13 years ago
parent 529bd3f1c4
commit e86a21bd83

@ -1072,7 +1072,7 @@ function format_date($date, $format=NULL, $convert=true)
try { try {
// convert to the right timezone // convert to the right timezone
$stz = date_default_timezone_get(); $stz = date_default_timezone_get();
$tz = new DateTimeZone($convert ? $RCMAIL->config->get('timezones') : 'GMT'); $tz = new DateTimeZone($convert ? $RCMAIL->config->get('timezone') : 'GMT');
$date->setTimezone($tz); $date->setTimezone($tz);
date_default_timezone_set($tz->getName()); date_default_timezone_set($tz->getName());

@ -254,9 +254,13 @@ class rcube_config
*/ */
public function get_timezone() public function get_timezone()
{ {
if ($this->get('timezone')) { if ($tz = $this->get('timezone')) {
$tz = new DateTimeZone($this->get('timezone')); try {
return $tz->getOffset(new DateTime('now')) / 3600; $tz = new DateTimeZone($tz);
return $tz->getOffset(new DateTime('now')) / 3600;
}
catch (Exception $e) {
}
} }
return 0; return 0;

Loading…
Cancel
Save