]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: Hack around malformed BDAY.
authorThomas Tanghus <thomas@tanghus.net>
Thu, 3 May 2012 23:27:59 +0000 (01:27 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Thu, 3 May 2012 23:27:59 +0000 (01:27 +0200)
apps/contacts/lib/vcard.php

index 4be6819054b8d31fd93d8f2e1bb110ae443fc4d9..621a3c33c75e9d86b10b63d32cb030c8c2c8f9b2 100755 (executable)
@@ -475,9 +475,15 @@ class OC_Contacts_VCard{
                //$value = htmlspecialchars($value);
                if($property->name == 'ADR' || $property->name == 'N'){
                        $value = self::unescapeDelimiters($value);
-               }/* elseif($property->name == 'CATEGORIES') {
-                       $value = self::unescapeDelimiters($value, ',');
-               }*/
+               } elseif($property->name == 'BDAY') {
+                       if(strpos($value, '-') === false) {
+                               if(strlen($value) >= 8) {
+                                       $value = substr($value, 0, 4).'-'.substr($value, 4, 2).'-'.substr($value, 6, 2);
+                               } else {
+                                       return null; // Badly malformed :-(
+                               }
+                       }
+               }
                $temp = array(
                        'name' => $property->name,
                        'value' => $value,