From 963c0b2e2125e4ba08348fcf3a13a6eba1204a3e Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Mon, 26 Feb 2007 15:11:58 +0000 Subject: [PATCH] Close #510 git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1521 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 3 +++ include/rss.inc.php | 4 +++- modules/carnet.php | 18 +++++++++++++++--- templates/carnet/mescontacts.tpl | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f0687e..604250f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ Bug/Wish: * Banana: - #407: RSS feed -FRU + * Carnet: + - #510: Use RSS hash to get iCal -FRU + * Profile: - Better checks on image type for photos -FRU diff --git a/include/rss.inc.php b/include/rss.inc.php index a52bfbe..41ede2c 100644 --- a/include/rss.inc.php +++ b/include/rss.inc.php @@ -59,7 +59,9 @@ function init_rss($template, $alias, $hash, $require_uid = true) } } - header('Content-Type: application/rss+xml; charset=utf8'); + if ($template) { + header('Content-Type: application/rss+xml; charset=utf8'); + } return $uid; } diff --git a/modules/carnet.php b/modules/carnet.php index f833946..c593816 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -30,7 +30,7 @@ class CarnetModule extends PLModule 'carnet/contacts' => $this->make_hook('contacts', AUTH_COOKIE), 'carnet/contacts/pdf' => $this->make_hook('pdf', AUTH_COOKIE), - 'carnet/contacts/ical' => $this->make_hook('ical', AUTH_COOKIE), + 'carnet/contacts/ical' => $this->make_hook('ical', AUTH_PUBLIC), 'carnet/contacts/vcard' => $this->make_hook('vcard', AUTH_COOKIE), 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC), @@ -333,8 +333,20 @@ class CarnetModule extends PLModule $page->assign('notifs', $notifs); } - function handler_ical(&$page) + 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')) { + require_once 'xorg.misc.inc.php'; + send_warning_email("Récupération d\'un autre utilisateur ($uid)"); + } + } else if (!$uid) { + exit; + } require_once 'ical.inc.php'; $page->changeTpl('carnet/calendar.tpl', NO_SKIN); $page->register_function('display_ical', 'display_ical'); @@ -350,7 +362,7 @@ class CarnetModule extends PLModule 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 = {?}', S::v('uid')); + WHERE c.uid = {?}', $uid); $annivs = Array(); while (list($prenom, $nom, $promo, $naissance, $end, $ts, $forlife) = $res->next()) { diff --git a/templates/carnet/mescontacts.tpl b/templates/carnet/mescontacts.tpl index 6757859..b6ae910 100644 --- a/templates/carnet/mescontacts.tpl +++ b/templates/carnet/mescontacts.tpl @@ -61,7 +61,7 @@ Pour récupérer ta liste de contacts dans un PDF imprimable :