Branch 'roundcubemail-plugins-kolab-3.1' - plugins/libcalendaring

Aleksander Machniak machniak at kolabsys.com
Wed Oct 16 11:47:27 CEST 2013


 plugins/libcalendaring/libcalendaring.php |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit c6471146b94e411726b902c3b05bf94255f4e0e6
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Wed Oct 16 11:43:31 2013 +0200

    Catch exception when timezone is invalid

diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
index 9df9e00..47cf67e 100644
--- a/plugins/libcalendaring/libcalendaring.php
+++ b/plugins/libcalendaring/libcalendaring.php
@@ -75,10 +75,17 @@ class libcalendaring extends rcube_plugin
         $this->rc = rcube::get_instance();
 
         // set user's timezone
-        $this->timezone = new DateTimeZone($this->rc->config->get('timezone', 'GMT'));
+        try {
+            $this->timezone = new DateTimeZone($this->rc->config->get('timezone', 'GMT'));
+        }
+        catch (Exception $e) {
+            $this->timezone = new DateTimeZone('GMT');
+        }
+
         $now = new DateTime('now', $this->timezone);
-        $this->gmt_offset = $now->getOffset();
-        $this->dst_active = $now->format('I');
+
+        $this->gmt_offset      = $now->getOffset();
+        $this->dst_active      = $now->format('I');
         $this->timezone_offset = $this->gmt_offset / 3600 - $this->dst_active;
 
         $this->add_texts('localization/', false);




More information about the commits mailing list