X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvcard.inc.php;h=b544ef125f326fe257a3e65846c23b9acd5e750a;hb=98d858e523a7c7509bdff56e23cec4f435e93e02;hp=99086cc1adb4f0ef157385bfbe3ed738a7425246;hpb=d82359a556779137f8a90d0312b3098a2db6f482;p=platal.git diff --git a/include/vcard.inc.php b/include/vcard.inc.php index 99086cc..b544ef1 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -25,17 +25,19 @@ class VCard extends PlVCard private $count = 0; private $freetext = null; private $photos = true; + private $visibility; public function __construct($photos = true, $freetext = null) { PlVCard::$folding = false; + $this->visibility = Visibility::defaultForRead(Visibility::VIEW_PRIVATE); $this->freetext = $freetext; $this->photos = $photos; } public function addProfile($profile) { - $profile = Profile::get($profile, Profile::FETCH_ALL); + $profile = Profile::get($profile, Profile::FETCH_ALL, $this->visibility); if ($profile) { $this->profile_list[] = $profile; $this->count++; @@ -145,7 +147,7 @@ class VCard extends PlVCard // Melix if (!is_null($user)) { - $alias = $user->emailAliases(); + $alias = $user->emailAlias(); if (!is_null($alias) && $pf->alias_pub == 'public') { $entry->addMail(null, $alias); } @@ -182,8 +184,9 @@ class VCard extends PlVCard if ($this->photos) { $res = XDB::query( "SELECT attach, attachmime - FROM profile_photos AS p - WHERE p.pid = {?}", $pf->id()); + FROM profile_photos + WHERE pid = {?} AND pub IN ('public', {?})", + $pf->id(), $this->visibility->level()); if ($res->numRows()) { list($data, $type) = $res->fetchOneRow(); $entry->setPhoto($data, strtoupper($type));