+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-function init_rss($template, $alias, $hash, $require_uid = true)
-{
- $page =& Platal::page();
- $page->changeTpl($template, NO_SKIN);
- $user = Platal::session()->tokenAuth($alias, $hash);
- if (is_null($user)) {
- if ($require_uid) {
- exit;
- } else {
- $user = null;
- }
- }
-
- if ($template) {
- $page->assign('rss_hash', $hash);
- header('Content-Type: application/rss+xml; charset=utf8');
- }
- return $user;
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
function handler_ical(&$page, $alias = null, $hash = null)
{
- require_once 'rss.inc.php';
- $uid = init_rss(null, $alias, $hash, false);
- if (S::logged()) {
- if (!$uid) {
- $uid = S::i('uid');
- } else if ($uid != S::i('uid')) {
- send_warning_email("Récupération d\'un autre utilisateur ($uid)");
+ $user = Platal::session()->tokenAuth($alias, $hash);
+ if (is_null($user)) {
+ if (S::logged()) {
+ $user == S::user();
+ } else {
+ return PL_FORBIDDEN;
}
- } else if (!$uid) {
- exit;
}
require_once 'ical.inc.php';
FROM contacts AS c
INNER JOIN auth_user_md5 AS u ON (u.user_id = c.contact)
INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type = \'a_vie\')
- WHERE c.uid = {?}', $uid);
+ WHERE c.uid = {?}', $user->id());
$annivs = Array();
while (list($prenom, $nom, $promo, $naissance, $end, $ts, $hruid) = $res->next()) {
{
if (is_null($file)) {
if (is_null($hash)) {
- exit;
+ return PL_FORBIDDEN;
}
$this->handler_rss($page, null, $group, $alias, $hash);
}
- require_once('rss.inc.php');
- $uid = init_rss(null, $alias, $hash);
- if (!$uid) {
- exit;
+ $user = Platal::session()->tokenAuth($alias, $hash);
+ if (is_null($user)) {
+ return PL_FORBIDDEN;
}
- $res = XDB::query("SELECT id AS uid, alias AS forlife
- FROM aliases
- WHERE type = 'a_vie' AND id = {?}", $uid);
- $row = $res->fetchOneAssoc();
- $_SESSION = array_merge($row, $_SESSION);
require_once 'banana/forum.inc.php';
- $banana = new ForumsBanana(S::user(), array('group' => $group, 'action' => 'rss2'));
+ $banana = new ForumsBanana($user, array('group' => $group, 'action' => 'rss2'));
$banana->run();
exit;
}
</li>
<li>
{icon name=calendar_view_day title='Anniversaires'}
- <a href="carnet/contacts/ical/{$smarty.session.hruid}/{$smarty.session.core_rss_hash}/anniv-x.ics" title="Anniversaires">
+ <a href="carnet/contacts/ical/{$smarty.session.hruid}/{$smarty.session.token}/anniv-x.ics" title="Anniversaires">
Le calendrier des anniversaires
</a>
</li>