<?php
/***************************************************************************
- * Copyright (C) 2003-2011 Polytechnique.org *
+ * Copyright (C) 2003-2014 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
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++;
// Melix
if (!is_null($user)) {
- $alias = $user->emailAliases();
+ $alias = $user->emailAlias();
if (!is_null($alias) && $pf->alias_pub == 'public') {
$entry->addMail(null, $alias);
}
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));
}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
?>