Branch 'roundcubemail-plugins-kolab-0.7' - plugins/calendar

Thomas Brüderli bruederli at kolabsys.com
Fri Oct 26 09:31:43 CEST 2012


 plugins/calendar/calendar.php |   22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

New commits:
commit c0ef86f082b41c6a53d61085845a5d55c5bc4a44
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Fri Oct 26 09:30:44 2012 +0200

    Revert 15c2a813f and find a better fix for #970. Fixes broken date handling reported in #1140

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);
 





More information about the commits mailing list