diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 04b59a040fb..c99d53c9716 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -159,15 +159,27 @@ class OC_Contacts_VCard{ */ public static function addFromDAVData($id,$uri,$data){ $fn = null; + $email = null; $card = OC_VObject::parse($data); if(!is_null($card)){ foreach($card->children as $property){ if($property->name == 'FN'){ $fn = $property->value; - break; + } + if($property->name == 'EMAIL' && is_null($email)){ + $email = $property->value; } } } + if(!$fn) { + if($email) { + $fn = $email; + } else { + $fn = 'Unknown'; + } + $card->addProperty('EMAIL', $email); + $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())); diff --git a/apps/contacts/templates/part.contacts.php b/apps/contacts/templates/part.contacts.php index 8d89e9c7ad1..7587670f974 100644 --- a/apps/contacts/templates/part.contacts.php +++ b/apps/contacts/templates/part.contacts.php @@ -1,3 +1,13 @@ - -
  • +'; +?> +
  • diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php index f2b57014785..36d395171a9 100644 --- a/apps/contacts/thumbnail.php +++ b/apps/contacts/thumbnail.php @@ -22,8 +22,8 @@ // Init owncloud require_once('../../lib/base.php'); -//OC_JSON::checkLoggedIn(); -OC_Util::checkLoggedIn(); +OC_JSON::checkLoggedIn(); +//OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); function getStandardImage(){