]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update OC_VObject
authorBart Visscher <bartv@thisnet.nl>
Fri, 9 Dec 2011 20:56:03 +0000 (21:56 +0100)
committerBart Visscher <bartv@thisnet.nl>
Fri, 9 Dec 2011 20:56:03 +0000 (21:56 +0100)
apps/calendar/lib/object.php
lib/vobject.php

index 1e834241f630b62eb96943f320886ea7f0a2fc31..1c145003511c9963847c60586cdfd52d6c102b45 100644 (file)
@@ -460,7 +460,7 @@ class OC_Calendar_Object{
        {
                $title = $request["title"];
                $location = $request["location"];
-               $categories = isset($request["categories"]) ? $request["categories"] : null;
+               $categories = isset($request["categories"]) ? $request["categories"] : array();
                $allday = isset($request["allday"]);
                $from = $request["from"];
                $to  = $request["to"];
@@ -511,20 +511,9 @@ class OC_Calendar_Object{
                }
                unset($vevent->DURATION);
 
-
                $vevent->setString('LOCATION', $location);
-
-               if($description != ""){
-                       $vevent->DESCRIPTION = $description;
-               }else{
-                       unset($vevent->DESCRIPTION);
-               }
-
-               if(!empty($categories)){
-                       $vevent->CATEGORIES = join(',', $categories);
-               }else{
-                       unset($vevent->CATEGORIES);
-               }
+               $vevent->setString('DESCRIPTION', $description);
+               $vevent->setString('CATEGORIES', join(',', $categories));
 
                /*if($repeat == "true"){
                        $vevent->RRULE = $repeat;
index 5a76cfd2d43031ff7142fa2f141166e1133454a9..e3479fc6d3687a3a9c8f09416e37b8c2d06d737b 100644 (file)
@@ -48,6 +48,7 @@ class OC_VObject{
                        }
                        return $vobject;
                } catch (Exception $e) {
+                       OC_Log::write('vobject', $e->getMessage(), OC_Log::ERROR);
                        return null;
                }
        }
@@ -132,6 +133,7 @@ class OC_VObject{
 
        public function setString($name, $string){
                if ($string != ''){
+                       $string = strtr($string, array("\r\n"=>"\n"));
                        $this->vobject->__set($name, $string);
                }else{
                        $this->vobject->__unset($name);
@@ -195,6 +197,10 @@ class OC_VObject{
                return $this->vobject->__unset($name);
        }
 
+       public function __isset($name){
+               return $this->vobject->__isset($name);
+       }
+
        public function __call($function,$arguments){
                return call_user_func_array(array($this->vobject, $function), $arguments);
        }