X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvcard.inc.php;h=b5aa8a92c9309d829be31d20b0ccdf64511a8365;hb=8b1f8e12d444062ef63a0db3a8fa94582a9778c3;hp=749af3d933f5cabb2095d3a228e0de85ae640852;hpb=d32a4fbc78cada34d7f28efaf572a0cd2c3a092d;p=platal.git diff --git a/include/vcard.inc.php b/include/vcard.inc.php index 749af3d..b5aa8a9 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -25,9 +25,11 @@ require_once('user.func.inc.php'); class VCard { var $users = array(); + var $photos; - function VCard($users, $freetext = null) + function VCard($users, $photos = true, $freetext = null) { + $this->photos = $photos; if (is_array($users)) { foreach ($users as $user) { $this->add_user($user, $freetext); @@ -59,6 +61,9 @@ class VCard function text_encode($text, $escape = true) { + if (is_array($text)) { + return implode(',', array_map(array($this, 'text_encode'), $text)); + } if ($escape) { $text = $this->escape($text); } @@ -96,22 +101,25 @@ class VCard $user['forlife'].'@'.$globals->mail->domain2); $user['virtualalias'] = $res->fetchOneCell(); - + $user['gpxs_vcardjoin'] = join(',', array_map(array($this, 'text_encode'), $user['gpxs_name'])); + $user['binets_vcardjoin'] = join(',', array_map(array($this, 'text_encode'), $user['binets'])); // get photo - $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); - if ($res->numRows()) { - $user['photo'] = $res->fetchOneAssoc(); + 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); + if ($res->numRows()) { + $user['photo'] = $res->fetchOneAssoc(); + } } $this->users[] = $user; } function do_page(&$page) { - $page->changeTpl('vcard.tpl', NO_SKIN); + $page->changeTpl('core/vcard.tpl', NO_SKIN); $page->register_modifier('vcard_enc', array($this, 'text_encode')); $page->register_function('format_adr', array($this, 'format_adr')); $page->assign_by_ref('users', $this->users);