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

Thomas Brüderli bruederli at kolabsys.com
Mon Jun 2 23:28:09 CEST 2014


 plugins/libkolab/lib/kolab_format.php |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 7b3017664bc6c835acc7b19ca54d9884b69cd458
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Mon Jun 2 23:27:44 2014 +0200

    Check existance of Configuration::customProperties() before calling it (#3125)

diff --git a/plugins/libkolab/lib/kolab_format.php b/plugins/libkolab/lib/kolab_format.php
index 165b267..f81baf6 100644
--- a/plugins/libkolab/lib/kolab_format.php
+++ b/plugins/libkolab/lib/kolab_format.php
@@ -414,7 +414,7 @@ abstract class kolab_format
         $this->obj->setLastModified(self::get_datetime($object['changed']));
 
         // Save custom properties of the given object
-        if (isset($object['x-custom'])) {
+        if (isset($object['x-custom']) && method_exists($this->obj, 'setCustomProperties')) {
             $vcustom = new vectorcs;
             foreach ((array)$object['x-custom'] as $cp) {
                 if (is_array($cp))
@@ -422,7 +422,8 @@ abstract class kolab_format
             }
             $this->obj->setCustomProperties($vcustom);
         }
-        else {  // load custom properties from XML for caching (#2238)
+        // load custom properties from XML for caching (#2238) if method exists (#3125)
+        else if (method_exists($this->obj, 'customProperties')) {
             $object['x-custom'] = array();
             $vcustom = $this->obj->customProperties();
             for ($i=0; $i < $vcustom->size(); $i++) {
@@ -455,10 +456,12 @@ abstract class kolab_format
         }
 
         // read custom properties
-        $vcustom = $this->obj->customProperties();
-        for ($i=0; $i < $vcustom->size(); $i++) {
-            $cp = $vcustom->get($i);
-            $object['x-custom'][] = array($cp->identifier, $cp->value);
+        if (method_exists($this->obj, 'customProperties')) {
+            $vcustom = $this->obj->customProperties();
+            for ($i=0; $i < $vcustom->size(); $i++) {
+                $cp = $vcustom->get($i);
+                $object['x-custom'][] = array($cp->identifier, $cp->value);
+            }
         }
 
         // merge with additional data, e.g. attachments from the message




More information about the commits mailing list