{
return array(
'events' => $this->make_hook('ev', AUTH_COOKIE),
- 'send_bug' => $this->make_hook('bug', AUTH_COOKIE),
+ 'rss' => $this->make_hook('rss', AUTH_PUBLIC),
'events/submit' => $this->make_hook('ev_submit', AUTH_MDP),
'admin/events' => $this->make_hook('admin_events', AUTH_MDP, 'admin'),
'nl' => $this->make_hook('nl', AUTH_COOKIE),
'nl/show' => $this->make_hook('nl_show', AUTH_COOKIE),
- 'nl/submit' => $this->make_hook('nl_submit', AUTH_COOKIE),
+ 'nl/submit' => $this->make_hook('nl_submit', AUTH_MDP),
'admin/newsletter' => $this->make_hook('admin_nl', AUTH_MDP, 'admin'),
'admin/newsletter/categories' => $this->make_hook('admin_nl_cat', AUTH_MDP, 'admin'),
'admin/newsletter/edit' => $this->make_hook('admin_nl_edit', AUTH_MDP, 'admin'),
AND (promo_min = 0 OR promo_min <= {?})
AND (promo_max = 0 OR promo_max >= {?})
AND (priorite >= {?})
+ AND (state = 'active')
$exclude
ORDER BY RAND()
LIMIT 1",
return $res->fetchOneAssoc();
}
- function handler_bug(&$page)
- {
- $this->handler_ev($page);
- $page->assign('bug', 1);
- }
-
function handler_ev(&$page, $action = 'list', $eid = null, $pound = null)
{
- $page->changeTpl('login.tpl');
+ $page->changeTpl('events/index.tpl');
$page->addJsLink('ajax.js');
$page->assign('tips', $this->get_tips());
- // donne la derniere date de session
- $page->assign('lastlogin', strftime("%Y%m%d%H%M%S",S::i('lastlogin')));
-
$res = XDB::query('SELECT date, naissance FROM auth_user_md5
WHERE user_id={?}', S::v('uid'));
list($date, $naissance) = $res->fetchOneRow();
);
}
+ 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)
{
- $page->changeTpl('evenements.tpl');
+ $page->changeTpl('events/submit.tpl');
$titre = Post::v('titre');
$texte = Post::v('texte');
$valid_mesg = Post::v('valid_mesg');
$action = Post::v('action');
- if ($promo_min > $promo_max ||
+ if (($promo_min > $promo_max && $promo_max != 0)||
($promo_min != 0 && ($promo_min <= 1900 || $promo_min >= 2020)) ||
($promo_max != 0 && ($promo_max <= 1900 || $promo_max >= 2020)))
{
$table_editor->describe('promo_min', 'promo. min (0 aucune)', false);
$table_editor->describe('promo_max', 'promo. max (0 aucune)', false);
$table_editor->describe('titre', 'titre', true);
+ $table_editor->describe('state', 'actif', true);
$table_editor->describe('text', 'texte (html) de l\'astuce', false);
$table_editor->describe('priorite', 'priorité (0=min, 256=max)', false);
$table_editor->apply($page, $action, $id);
function handler_admin_events(&$page, $action = 'list', $eid = null)
{
- $page->changeTpl('admin/evenements.tpl');
+ $page->changeTpl('events/admin_events.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - Evenements');
$page->register_modifier('hde', 'html_entity_decode');