require_once('rss.inc.php');
require_once('notifs.inc.php');
-$uid = init_rss('carnet/rss.tpl');
-$notifs = new Notifs($uid, false);
-$page->assign('notifs', $notifs);
+if (preg_match(',^/([^/]+)/([^/]+)\.xml$,', $_SERVER['PATH_INFO'], $m)) {
+ $uid = init_rss('carnet/rss.tpl', $m[1], $m[2]);
+ $notifs = new Notifs($uid, false);
+ $page->assign('notifs', $notifs);
-$page->run();
+ $page->run();
+}
?>
// ajout du lien RSS
if (Session::has('core_rss_hash')) {
- $page->assign('xorg_rss', Array("title" => "Polytechnique.org :: News", "href" => "/rss.php/".Session::get('forlife')."/".Session::get('core_rss_hash').".xml"));
+ $page->assign('xorg_rss',
+ array("title" => "Polytechnique.org :: News",
+ "href" => "/rss/".Session::get('forlife')."/".Session::get('core_rss_hash')."/rss.xml"));
}
// cache les evenements lus et raffiche les evenements a relire
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once('xorg.inc.php');
-require_once('rss.inc.php');
-
-$uid = init_rss('rss.tpl');
-
-$rss = $globals->xdb->iterator(
- 'SELECT e.id, e.titre, e.texte, e.creation_date
- 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) )
- WHERE u.user_id = {?} AND FIND_IN_SET(e.flags, "valide") AND peremption >= NOW()', $uid);
-$page->assign('rss', $rss);
-
-$page->run();
-?>
}
}
-function init_rss($template)
+function init_rss($template, $alias, $hash)
{
global $page, $globals;
new_nonhtml_page($template, AUTH_PUBLIC);
$page->register_modifier('rss_date', '_rss_encode_date');
$page->default_modifiers = Array('@to_rss');
- if (preg_match(',^/([^/]+)/([^/]+)\.xml$,', $_SERVER['PATH_INFO'], $m)) {
- $alias = $m[1];
- $hash = $m[2];
- $res = $globals->xdb->query(
- 'SELECT a.id
- FROM aliases AS a
- INNER JOIN auth_user_quick AS q ON ( a.id = q.user_id AND q.core_rss_hash = {?} )
- WHERE a.alias = {?} AND a.type != "homonyme"', $hash, $alias);
- $uid = $res->fetchOneCell();
+ $res = $globals->xdb->query(
+ 'SELECT a.id
+ FROM aliases AS a
+ INNER JOIN auth_user_quick AS q ON ( a.id = q.user_id AND q.core_rss_hash = {?} )
+ WHERE a.alias = {?} AND a.type != "homonyme"', $hash, $alias);
+ $uid = $res->fetchOneCell();
+
+ if (empty($uid)) {
+ exit;
}
- if (empty($uid)) { exit; }
header('Content-Type: application/rss+xml; charset=utf8');
return $uid;
function handlers()
{
return array(
- 'prefs' => $this->make_hook('prefs', AUTH_COOKIE),
- 'prefs/rss' => $this->make_hook('rss', AUTH_COOKIE),
- 'password' => $this->make_hook('password', AUTH_MDP),
- 'tmpPWD' => $this->make_hook('tmpPWD', AUTH_PUBLIC),
- 'skin' => $this->make_hook('skin', AUTH_COOKIE),
+ // Preferences thingies
+ 'prefs' => $this->make_hook('prefs', AUTH_COOKIE),
+ 'prefs/rss' => $this->make_hook('prefs_rss', AUTH_COOKIE),
+ 'skin' => $this->make_hook('skin', AUTH_COOKIE),
+
+ // password related thingies
+ 'password' => $this->make_hook('password', AUTH_MDP),
+ 'tmpPWD' => $this->make_hook('tmpPWD', AUTH_PUBLIC),
+
+ // happenings related thingies
+ 'rss' => $this->make_hook('rss', AUTH_PUBLIC),
);
}
return PL_OK;
}
- function handler_rss(&$page)
+ function handler_prefs_rss(&$page)
{
global $globals;
$page->assign_by_ref('skins', $globals->xdb->iterator($sql));
return PL_OK;
}
+
+ function handler_rss(&$page, $user = null, $hash = null)
+ {
+ global $globals;
+
+ require_once 'rss.inc.php';
+
+ $uid = init_rss('rss.tpl', $user, $hash);
+
+ $rss = $globals->xdb->iterator(
+ 'SELECT e.id, e.titre, e.texte, e.creation_date
+ 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) )
+ WHERE u.user_id = {?} AND FIND_IN_SET(e.flags, "valide")
+ AND peremption >= NOW()', $uid);
+ $page->assign('rss', $rss);
+
+ return PL_OK;
+ }
}
?>
<ul>
<li>
Anonces sur la page d'entrée :
- <a href='{rel}/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' title='fil RSS'/></a>
+ <a href='{rel}/rss/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}/rss.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' title='fil RSS'/></a>
</li>
<li>
Ton carnet polytechnicien :
</p>
{if $smarty.session.core_rss_hash}
<div class="right">
- <a href='{rel}/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
+ <a href='{rel}/rss/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}/rss.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
</div>
{else}
<div class="right">