From 911075226546c6b058eca1e0b889097f79fa6232 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 28 Apr 2011 21:14:00 +0200 Subject: [PATCH] Uses user's visibility limitations to display vcards (Closes #1478). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- ChangeLog | 1 + include/vcard.inc.php | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb997d1..5397244 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ Bug/Wish: * Profile: - #1445: Add job entry year -JAC + - #1478: Uses user's visibility limitations to display vcards -JAC * Search: - #911: Adds search on corps -JAC diff --git a/include/vcard.inc.php b/include/vcard.inc.php index 57561c0..de0b49d 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 = new ProfileVisibility(ProfileVisibility::VIS_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++; @@ -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)); -- 2.1.4