X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvcard.inc.php;h=0acbfbd0d3dc67baf109e484491e28fa868feb70;hb=9e1816c7666767755abbc24f6a0df290efff81b6;hp=2be89de9a6283bece241b89b70afd0003f82acf7;hpb=301e3543efce642475e428cfab02a8a38b4ed3f8;p=platal.git diff --git a/include/vcard.inc.php b/include/vcard.inc.php index 2be89de..0acbfbd 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -1,6 +1,6 @@ user_list[] = get_user_forlife($user); + $user = User::getSilent($user); + if ($user) { + $this->user_list[] = $user; $this->count++; } } @@ -59,7 +59,7 @@ class VCard extends PlVCard { global $globals; $login = $entry['value']; - $user = get_user_details($login); + $user = get_user_details($login->login()); if (empty($user['nom_usage'])) { $entry = new PlVCardEntry($user['prenom'], $user['nom'], null, null, @$user['nickname']); @@ -83,6 +83,7 @@ class VCard extends PlVCard } // Emails + // TODO: this logic is not hruid-compatible; replace it. $entry->addMail(null, $user['bestalias'] . '@' . $globals->mail->domain, true); $entry->addMail(null, $user['bestalias'] . '@' . $globals->mail->domain2); if ($user['bestalias'] != $user['forlife']) { @@ -110,24 +111,26 @@ class VCard extends PlVCard } // Pro - foreach ($user['adr_pro'] as $pro) { - $street = array($adr['adr1']); - if (!empty($pro['adr2'])) { - $street[] = $pro['adr2']; - } - if (!empty($pro['adr3'])) { - $street[] = $pro['adr3']; - } - $group = $entry->addWork($pro['entreprise'], null, $pro['poste'], $pro['fonction'], - $street, null, null, $pro['postcode'], $pro['city'], $pro['region'], @$pro['country']); - if (!empty($pro['tel'])) { - $entry->addTel($group, $pro['tel']); - } - if (!empty($pro['fax'])) { - $entry->addTel($group, $pro['fax'], true); - } - if (!empty($pro['email'])) { - $entry->addMail($group, $pro['email']); + if (!empty($user['adr_pro'])) { + foreach ($user['adr_pro'] as $pro) { + $street = array($pro['adr1']); + if (!empty($pro['adr2'])) { + $street[] = $pro['adr2']; + } + if (!empty($pro['adr3'])) { + $street[] = $pro['adr3']; + } + $group = $entry->addWork($pro['entreprise'], null, $pro['poste'], $pro['fonction'], + $street, null, null, $pro['postcode'], $pro['city'], $pro['region'], @$pro['country']); + if (!empty($pro['tel'])) { + $entry->addTel($group, $pro['tel']); + } + if (!empty($pro['fax'])) { + $entry->addTel($group, $pro['fax'], true); + } + if (!empty($pro['email'])) { + $entry->addMail($group, $pro['email']); + } } } @@ -160,10 +163,9 @@ class VCard extends PlVCard // Photo if ($this->photos) { $res = XDB::query( - "SELECT attach, attachmime - FROM photo AS p - INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie') - WHERE a.alias = {?}", $login); + "SELECT attach, attachmime + FROM photo AS p + WHERE p.uid = {?}", $login->id()); if ($res->numRows()) { list($data, $type) = $res->fetchOneRow(); $entry->setPhoto($data, strtoupper($type));