[Pkg-owncloud-commits] [owncloud] 61/75: Modify check for missing UID.

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:08:42 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v3.0.1
in repository owncloud.

commit a62ac84220c9c414fa109dedad29f512aaed3d65
Author: Thomas Tanghus <thomas at tanghus.net>
Date:   Tue Feb 14 01:56:38 2012 +0100

    Modify check for missing UID.
    
    Conflicts:
    
    	apps/contacts/lib/vcard.php
---
 apps/contacts/lib/vcard.php |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index ceac2dc..619c124 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -108,10 +108,9 @@ class OC_Contacts_VCard{
 		if(!is_null($card)){
 			$fn = $card->getAsString('FN');
 			$uid = $card->getAsString('UID');
-			if(is_null($uid)){
+			if(!$uid){
 				$card->setUID();
 				$uid = $card->getAsString('UID');
-				//$data = $card->serialize();
 			};
 			$uri = $uid.'.vcf';
 
@@ -158,14 +157,19 @@ class OC_Contacts_VCard{
 	 * @return insertid
 	 */
 	public static function addFromDAVData($id,$uri,$data){
-		$fn = null;
-		$email = null;
+		$fn = $n = $uid = $email = null;
 		$card = OC_VObject::parse($data);
 		if(!is_null($card)){
 			foreach($card->children as $property){
 				if($property->name == 'FN'){
 					$fn = $property->value;
 				}
+				if($property->name == 'N'){
+					$n = $property->value;
+				}
+				if($property->name == 'UID'){
+					$uid = $property->value;
+				}
 				if($property->name == 'EMAIL' && is_null($email)){
 					$email = $property->value;
 				}
@@ -180,6 +184,10 @@ class OC_Contacts_VCard{
 			$card->addProperty('EMAIL', $email);
 			$data = $card->serialize();
 		}
+		if(!$uid) {
+			$card->setUID();
+			$data = $card->serialize();
+		}
 
 		$stmt = OC_DB::prepare( 'INSERT INTO *PREFIX*contacts_cards (addressbookid,fullname,carddata,uri,lastmodified) VALUES(?,?,?,?,?)' );
 		$result = $stmt->execute(array($id,$fn,$data,$uri,time()));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list