2 commits - plugins/calendar plugins/libkolab

Thomas Brüderli bruederli at kolabsys.com
Tue Mar 18 10:20:59 CET 2014


 plugins/calendar/drivers/kolab/kolab_calendar.php |    7 ++++++-
 plugins/libkolab/lib/kolab_format.php             |   15 +++++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 2dec4c3e6e6d5f7af4d79518fbd580ec07848151
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Tue Mar 18 10:11:00 2014 +0100

    Avoid saving attachments with empty mimetype; validate before adding to XML (#2927)

diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index 11a5c4f..1c5fd12 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -531,8 +531,19 @@ abstract class kolab_format
                 continue;
             $attach = new Attachment;
             $attach->setLabel((string)$attr['name']);
-            $attach->setUri('cid:' . $cid, $attr['mimetype']);
-            $vattach->push($attach);
+            $attach->setUri('cid:' . $cid, $attr['mimetype'] ?: 'application/octet-stream');
+            if ($attach->isValid()) {
+              $vattach->push($attach);
+            }
+            else {
+              rcube::raise_error(array(
+                  'code' => 660,
+                  'type' => 'php',
+                  'file' => __FILE__,
+                  'line' => __LINE__,
+                  'message' => "Invalid attributes for attachment $cid: " . var_export($attr, true),
+              ), true);
+            }
         }
 
         foreach ((array) $object['links'] as $link) {


commit 621582307f813c1b4af40299f13bbcdea0ebb4a7
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Mon Mar 17 14:28:25 2014 +0100

    Clean-up save data when recurrence was removed from event

diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php
index e54722a..2019a67 100644
--- a/plugins/calendar/drivers/kolab/kolab_calendar.php
+++ b/plugins/calendar/drivers/kolab/kolab_calendar.php
@@ -647,11 +647,16 @@ class kolab_calendar
 
     $event['_owner'] = $identity['email'];
 
-    # remove EXDATE values if RDATE is given
+    // remove EXDATE values if RDATE is given
     if (!empty($event['recurrence']['RDATE'])) {
       $event['recurrence']['EXDATE'] = array();
     }
 
+    // remove recurrence information (e.g. EXDATES and EXCEPTIONS) entirely
+    if ($event['recurrence'] && empty($event['recurrence']['FREQ']) && empty($event['recurrence']['RDATE'])) {
+      $event['recurrence'] = array();
+    }
+
     // remove some internal properties which should not be saved
     unset($event['_savemode'], $event['_fromcalendar'], $event['_identity']);
 




More information about the commits mailing list