mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-30 19:52:17 +01:00
contacts: every card needs a version!
This commit is contained in:
parent
f2484423a7
commit
e6cf001105
@ -95,10 +95,15 @@ class OC_Contacts_VCard{
|
|||||||
|
|
||||||
$card = self::parse($data);
|
$card = self::parse($data);
|
||||||
if(!is_null($card)){
|
if(!is_null($card)){
|
||||||
|
// VCARD must have a version
|
||||||
|
$hasversion = false;
|
||||||
foreach($card->children as $property){
|
foreach($card->children as $property){
|
||||||
if($property->name == 'FN'){
|
if($property->name == 'FN'){
|
||||||
$fn = $property->value;
|
$fn = $property->value;
|
||||||
}
|
}
|
||||||
|
elseif($property->name == 'VERSION'){
|
||||||
|
$hasversion = true;
|
||||||
|
}
|
||||||
elseif(is_null($uri) && $property->name == 'UID' ){
|
elseif(is_null($uri) && $property->name == 'UID' ){
|
||||||
$uri = $property->value.'.vcf';
|
$uri = $property->value.'.vcf';
|
||||||
}
|
}
|
||||||
@ -109,6 +114,11 @@ class OC_Contacts_VCard{
|
|||||||
$card->add(new Sabre_VObject_Property('UID',$uid));
|
$card->add(new Sabre_VObject_Property('UID',$uid));
|
||||||
$data = $card->serialize();
|
$data = $card->serialize();
|
||||||
};
|
};
|
||||||
|
// Add version if needed
|
||||||
|
if(!$hasversion){
|
||||||
|
$card->add(new Sabre_VObject_Property('VERSION','3.0'));
|
||||||
|
$data = $card->serialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// that's hard. Creating a UID and not saving it
|
// that's hard. Creating a UID and not saving it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user