X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvcard.inc.php;h=619f954996573c9eac746dd623849381e99a689c;hb=98925aab681d8a3b26e901beac0a4cf2b1a274fb;hp=d16dae6e8762f5bdc32b10d742ce381204e9e59d;hpb=805f3d1679a53bb04fff34619c171a1381068612;p=platal.git diff --git a/include/vcard.inc.php b/include/vcard.inc.php index d16dae6..619f954 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -1,6 +1,6 @@ user_list[] = $user; $this->count++; @@ -59,7 +59,7 @@ class VCard extends PlVCard { global $globals; $login = $entry['value']; - $user = get_user_details($login->login()); + $user = get_user_details($login->hrid()); 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,32 +111,34 @@ 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']); + } } } // Melix $res = XDB::query( "SELECT alias - FROM virtual - INNER JOIN virtual_redirect USING(vid) + FROM virtual AS v + INNER JOIN virtual_redirect AS vr ON (v.vid = vr.vid) INNER JOIN auth_user_quick ON ( user_id = {?} AND emails_alias_pub = 'public' ) WHERE ( redirect={?} OR redirect={?} ) AND alias LIKE '%@{$globals->mail->alias_dom}'", @@ -162,7 +165,7 @@ class VCard extends PlVCard $res = XDB::query( "SELECT attach, attachmime FROM photo AS p - WHERE u.user_id = {?}", $login->id()); + WHERE p.uid = {?}", $login->id()); if ($res->numRows()) { list($data, $type) = $res->fetchOneRow(); $entry->setPhoto($data, strtoupper($type));