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

Thomas Brüderli bruederli at kolabsys.com
Fri Nov 9 17:13:39 CET 2012


 plugins/calendar/calendar.php          |    4 ++--
 plugins/calendar/lib/calendar_ical.php |    2 +-
 plugins/calendar/lib/calendar_itip.php |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4a03dd30585dfbba513d0bb4ca99e3fb90ce79a6
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Fri Nov 9 17:13:24 2012 +0100

    Fix syntax and DateTime errors according to OTRS #1000069

diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 2ac4f4a..37a723e 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1566,8 +1566,8 @@ class calendar extends rcube_plugin
   private function prepare_event(&$event, $action)
   {
     // convert dates into DateTime objects in user's current timezone
-    $event['start'] = new DateTime($event['start'], $this->user_timezone);
-    $event['end'] = new DateTime($event['end'], $this->user_timezone);
+    $event['start'] = new DateTime(is_numeric($event['start']) ? '@'.$event['start'] : $event['start'], $this->user_timezone);
+    $event['end'] = new DateTime(is_numeric($event['end']) ? '@'.$event['end'] : $event['end'], $this->user_timezone);
 
     if ($event['recurrence']['UNTIL'])
       $event['recurrence']['UNTIL'] = new DateTime($event['recurrence']['UNTIL'], $this->user_timezone);
diff --git a/plugins/calendar/lib/calendar_ical.php b/plugins/calendar/lib/calendar_ical.php
index 3f1aeda..9bd10e1 100644
--- a/plugins/calendar/lib/calendar_ical.php
+++ b/plugins/calendar/lib/calendar_ical.php
@@ -369,7 +369,7 @@ class calendar_ical
       foreach ($events as $event) {
         $vevent = "BEGIN:VEVENT" . self::EOL;
         $vevent .= "UID:" . self::escpape($event['uid']) . self::EOL;
-        $vevent .= $this->format_datetime("DTSTAMP", $event['changed'] ?: new DateTime(), false, true) . self::EOL;
+        $vevent .= $this->format_datetime("DTSTAMP", $event['changed'] ? $event['changed'] : new DateTime(), false, true) . self::EOL;
         // correctly set all-day dates
         if ($event['allday']) {
           $event['end'] = new DateTime('@'.($event['end']->format('U') + 86400));  // ends the next day
diff --git a/plugins/calendar/lib/calendar_itip.php b/plugins/calendar/lib/calendar_itip.php
index c47d081..2d828f4 100644
--- a/plugins/calendar/lib/calendar_itip.php
+++ b/plugins/calendar/lib/calendar_itip.php
@@ -255,7 +255,7 @@ class calendar_itip
       $event['uid'],
       $this->rc->user->ID,
       self::serialize_event($event),
-      date('Y-m-d H:i:s', $event['end'] + 86400 * 2)
+      date('Y-m-d H:i:s', $event['end']->format('U') + 86400 * 2)
     );
     
     if ($this->rc->db->affected_rows($query)) {





More information about the commits mailing list