- function handler_rss(&$page, $user = null, $hash = null)
- {
- require_once 'rss.inc.php';
-
- $uid = init_rss('events/rss.tpl', $user, $hash);
-
- $rss = XDB::iterator(
- 'SELECT e.id, e.titre, e.texte, e.creation_date,
- IF(u2.nom_usage = "", u2.nom, u2.nom_usage) AS nom, u2.prenom, u2.promo
- FROM auth_user_md5 AS u
- INNER JOIN evenements AS e ON ( (e.promo_min = 0 || e.promo_min <= u.promo)
- AND (e.promo_max = 0 || e.promo_max >= u.promo) )
- INNER JOIN auth_user_md5 AS u2 ON (u2.user_id = e.user_id)
- WHERE u.user_id = {?} AND FIND_IN_SET(e.flags, "valide")
- AND peremption >= NOW()', $uid);
- $page->assign('rss', $rss);
- }
-
- function handler_ev_submit(&$page)
+ function handler_photo($page, $eid = null, $valid = null)
+ {
+ if ($eid && $eid != 'valid') {
+ $res = XDB::query("SELECT * FROM announce_photos WHERE eid = {?}", $eid);
+ if ($res->numRows()) {
+ $photo = $res->fetchOneAssoc();
+ pl_cached_dynamic_content_headers("image/" . $photo['attachmime']);
+ echo $photo['attach'];
+ exit;
+ }
+ } elseif ($eid == 'valid') {
+ $valid = Validate::get_request_by_id($valid);
+ if ($valid && $valid->img) {
+ pl_cached_dynamic_content_headers("image/" . $valid->imgtype);
+ echo $valid->img;
+ exit;
+ }
+ } else {
+ $upload = new PlUpload(S::user()->login(), 'event');
+ if ($upload->exists() && $upload->isType('image')) {
+ pl_cached_dynamic_content_headers($upload->contentType());
+ echo $upload->getContents();
+ exit;
+ }
+ }
+ global $globals;
+ pl_cached_dynamic_content_headers("image/png");
+ echo file_get_contents($globals->spoolroot . '/htdocs/images/logo.png');
+ exit;
+ }
+
+ function handler_rss(PlPage $page, PlPage $user)
+ {
+ $this->load('feed.inc.php');
+ $feed = new EventFeed();
+ return $feed->run($page, $user);
+ }
+
+ function handler_preview($page)
+ {
+ $page->changeTpl('events/preview.tpl', NO_SKIN);
+ $texte = Get::v('texte');
+ if (!is_utf8($texte)) {
+ $texte = utf8_encode($texte);
+ }
+ $titre = Get::v('titre');
+ if (!is_utf8($titre)) {
+ $titre = utf8_encode($titre);
+ }
+ $page->assign('texte', $texte);
+ $page->assign('titre', $titre);
+ pl_content_headers("text/html");
+ }
+
+ function handler_ev_submit($page)