summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2012-10-26 07:30:44 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2012-10-26 07:30:44 (GMT)
commitc0ef86f082b41c6a53d61085845a5d55c5bc4a44 (patch)
tree7b822aa63be2be83455ec84830efe1f189cb24c8
parente03d4139ab2058a7f1d2dc7ef8c123f42e2d8f6a (diff)
downloadroundcubemail-plugins-kolab-c0ef86f082b41c6a53d61085845a5d55c5bc4a44.tar.gz
Revert 15c2a813f and find a better fix for #970. Fixes broken date handling reported in #1140
-rw-r--r--plugins/calendar/calendar.php22
1 files changed, 6 insertions, 16 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index b08a836..b3f0437 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -102,28 +102,18 @@ class calendar extends rcube_plugin
$this->add_texts('localization/', $this->rc->task == 'calendar' && (!$this->rc->action || $this->rc->action == 'print'));
// set user's timezone
- // In 0.7 timezone setting is (most likely) a numeric value
- $timezone = $this->rc->config->get('timezone', 'UTC');
- if (is_numeric($timezone) && ($tz = timezone_name_from_abbr("", $timezone * 3600, 0))) {
- $timezone = $tz;
- }
- else if (empty($timezone)) {
- $timezone = 'UTC';
- }
+ $this->timezone = $this->rc->config->get('timezone');
+ $this->dst_active = $this->rc->config->get('dst_active');
+ $this->gmt_offset = ($this->timezone + $this->dst_active) * 3600;
try {
- $this->timezone = $timezone;
- $this->user_timezone = new DateTimeZone($this->timezone);
+ $this->user_timezone = new DateTimeZone($this->timezone ? timezone_name_from_abbr("", $this->gmt_offset, $this->dst_active) : 'GMT');
}
catch (Exception $e) {
- $this->timezone = 'UTC';
- $this->user_timezone = new DateTimeZone($this->timezone);
+ $this->timezone = 0;
+ $this->user_timezone = new DateTimeZone('UTC');
}
- $now = new DateTime('now', $this->user_timezone);
- $this->gmt_offset = $now->getOffset();
- $this->dst_active = $now->format('I');
-
require($this->home . '/lib/calendar_ui.php');
$this->ui = new calendar_ui($this);