} elseif (Env::v('suppr')) {
S::assert_xsrf_token();
- XDB::execute('DELETE FROM photo
- WHERE uid = {?}',
- S::v('uid'));
+ XDB::execute('DELETE FROM profile_photos
+ WHERE pid = {?}',
+ S::user()->profile()->id());
XDB::execute('DELETE FROM requests
WHERE user_id = {?} AND type="photo"',
S::v('uid'));
// Now that we know this is the profile of an existing user, we can
// switch to the appropriate template.
$page->changeTpl('profile/profile.tpl', SIMPLE);
- require_once 'user.func.inc.php';
// Determines the access level at which the profile will be displayed.
if (!S::logged() || Env::v('view') == 'public') {
function handler_referent(&$page, $user)
{
- require_once 'user.func.inc.php';
$page->changeTpl('profile/fiche_referent.tpl', SIMPLE);
$user = Profile::get($user);
require_once "directory.enums.inc.php";
// Retrieval of sector names
- $sectors = DirEnum::getOptionsArray(DirEnum::SECTORS);
+ $sectors = DirEnum::getOptions(DirEnum::SECTORS);
$sectors[''] = '';
$page->assign_by_ref('sectors', $sectors);
}
$vcard = new VCard();
- $vcard->addUser($x);
+ $vcard->addProfile(Profile::get($x));
$vcard->show();
}
switch ($action) {
case "original":
- pl_cached_content_headers("image/jpeg");
- readfile("/home/web/trombino/photos" . $user->promo() . "/" . $user->login() . ".jpg");
+ PlImage::fromFile("/home/web/trombino/photos" . $user->promo() . "/" . $user->login() . ".jpg", "image/jpeg")->send();
exit;
case "new":
$mimetype = substr($_FILES['userfile']['type'], 6);
unlink($_FILES['userfile']['tmp_name']);
XDB::execute(
- "REPLACE INTO photo SET uid={?}, attachmime = {?}, attach={?}, x={?}, y={?}",
- $user->id(), $mimetype, $data, $x, $y);
+ "REPLACE INTO profile_photos SET pid={?}, attachmime = {?}, attach={?}, x={?}, y={?}",
+ $user->profile()->id(), $mimetype, $data, $x, $y);
break;
case "delete":
S::assert_xsrf_token();
- XDB::execute('DELETE FROM photo WHERE uid = {?}', $user->id());
+ XDB::execute('DELETE FROM profile_photos WHERE pid = {?}', $user->profile()->id());
break;
}
}