/** * Create an image for a promotion, for a group, if needed */ function create_promo_image(Group $g, $promo) { $g->select(GroupSelect::base()); if ($g->image()) { return; } if ($promo % 2 == 0) { $upload = FrankizUpload::fromFile(dirname(__FILE__) . '/../images/rouje.png'); $label = 'Chic à la rouje'; } else { $upload = FrankizUpload::fromFile(dirname(__FILE__) . '/../images/jone.png'); $label = 'Chic à la jone'; } $i = new FrankizImage(); $i->insert(); $i->caste($g->caste(Rights::everybody())); $i->label($label); $i->image($upload, false); $g->image($i); }
function handler_links_admin($page) { if (!S::user()->perms()->hasFlag('admin')) { return PL_FORBIDDEN; } $collec = Link::all(); $collec->select(LinkSelect::all()); $results = $collec->split('ns'); if (Env::has('modify')) { $id = Env::i('id'); $link = $collec->get($id); if ($link !== false) { if (Env::has('image')) { try { $group = Group::from('partnership'); $group->select(); $image = new FrankizImage(); $image->insert(); $image->label($link->label()); $image->caste($group->caste('everybody')); $image->image(FrankizUpload::v('image')); $link->image($image); } catch (Exception $e) { $page->assign('err', $e->getMessage()); } } $link->label(Env::t('label')); $link->link(Env::t('link')); $link->description(Env::t('description')); $link->comment(Env::t('comment')); } else { $err = 'Le lien modifié n\'existe plus.'; $page->assign('err', $err); } } $page->addCssLink('links.css'); $page->assign('links', $results); $page->assign('title', 'Administrer les liens'); $page->changeTpl('links/admin_links.tpl'); }
$n->caste(Rights::member())->addUser($u); } */ //Photo $works = false; $suffix = '_original'; $folder = '/home/2009/matthieu/photos'; $original = true; $path = $folder . '/' . $u->hruid() . $suffix . '.jpg'; if (file_exists($path)) { $upload = FrankizUpload::fromFile($path); if ($upload->size() > 0) { try { $i = new FrankizImage(); $i->insert(); $i->caste($tol_caste); $i->label($u->firstname() . ' ' . $u->lastname()); $i->image($upload, false); if ($original) { $u->original($i); } else { $u->photo($i); } $works = true; } catch (Exception $e) { echo 'Error:' . $e->getMessage() . "\n"; } } } if (!$works) { echo 'Not done: ' . $u->id() . ' - ' . $u->displayname() . ' - ' . $path . "\n";
function handler_image($page, $size, $iid = null) { global $globals; $image = new FrankizImage($iid); $image->select(FrankizImageSelect::caste()); $user = S::user(); try { if ($user && $user->canSee($image->caste())) { $image->send($size); return; } } catch (DataNotFetchedException $e) { } // Not found of error => HTTP 403 header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $img = new StaticImage($globals->images->forbidden); $img->send($size); }