-Subproject commit 9b41ca2c58fdac3cf09f6a89051d9bc5e81c11d2
+Subproject commit 9879250a1789b2b5819df3a11061ceb7307e3727
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, e.post_id, p.attachmime IS NOT NULL AS photo,
- IF(u2.nom_usage = "", u2.nom, u2.nom_usage) AS nom, u2.prenom, u2.promo,
- FIND_IN_SET(\'wiki\', e.flags) AS wiki
- 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) )
- LEFT JOIN evenements_photo AS p ON (p.eid = e.id)
- INNER JOIN auth_user_md5 AS u2 ON (u2.user_id = e.user_id)
- WHERE u.user_id = {?} AND FIND_IN_SET("valide", e.flags)
- AND peremption >= NOW()', $uid);
- $page->assign('rss', $rss);
+ require_once dirname(__FILE__) . '/events/feed.inc.php';
+ $feed = new EventFeed();
+ $feed->run($page, $user, $hash);
}
function handler_preview(&$page)
--- /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 *
+ ***************************************************************************/
+
+class EventFeed extends PlFeed
+{
+ public function __construct()
+ {
+ global $globals;
+ parent::__construct($globals->core->sitename . ' :: News',
+ $globals->baseurl,
+ 'Informations et Activités polytechniciennes',
+ $globals->baseurl . '/images/logo.png',
+ 'events/rss.tpl');
+ }
+
+ protected function fetch($user)
+ {
+ return XDB::iterator(
+ 'SELECT e.id, e.titre AS title, e.texte, e.creation_date AS publication, e.post_id, p.attachmime IS NOT NULL AS photo,
+ CONCAT(u2.prenom, " ", IF(u2.nom_usage = "", u2.nom, u2.nom_usage), "(X", u2.promo, ")") AS author,
+ FIND_IN_SET(\'wiki\', e.flags) AS wiki
+ 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) )
+ LEFT JOIN evenements_photo AS p ON (p.eid = e.id)
+ INNER JOIN auth_user_md5 AS u2 ON (u2.user_id = e.user_id)
+ WHERE u.user_id = {?} AND FIND_IN_SET("valide", e.flags)
+ AND peremption >= NOW()', $user);
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
{* *}
{**************************************************************************}
-
-<?xml version="1.0"?>
-<rss version="2.0">
- <channel>
- <title>{#globals.core.sitename#} :: News</title>
- <language>fr</language>
- <link>{#globals.baseurl#}/</link>
- <description>L'actualite polytechnicienne...</description>
- <image>
- <title>{#globals.core.sitename#}</title>
- <url>{#globals.baseurl#}/images/logo.png</url>
- <link>{#globals.baseurl#}/</link>
- </image>
- {iterate item=line from=$rss}
- <item>
- <title>{$line.titre|strip_tags}</title>
- <guid isPermaLink="false">{$line.id}</guid>
- <link>{#globals.baseurl#}/events#newsid{$line.id}</link>
- <description><![CDATA[
- {if $line.photo}
- <div style="float: left; padding-right: 0.5em">
- <img src="{#globals.baseurl#}/events/photo/{$line.id}" alt="{$line.title}" />
- </div>
- {/if}
- <div>{if $line.wiki}{$line.texte|miniwiki}{else}{$line.texte}{/if}</div>
- {if $line.post_id neq -1}
- <div style="clear: both">
- <br />
- <a href="{#globals.baseurl#}/banana/{#globals.banana.event_reply#|default:#globals.banana.event_forum#}/read/{$line.post_id}">
- {icon name=comments full=true} Suivre la discussion
- </a>
- </div>
- {/if}
- ]]></description>
- <author>{$line.prenom} {$line.nom} (X{$line.promo})</author>
- <pubDate>{$line.creation_date|rss_date}</pubDate>
- </item>
- {/iterate}
- </channel>
-</rss>
+{if $article->photo}
+<div style="float: left; padding-right: 0.5em">
+ <img src="{#globals.baseurl#}/events/photo/{$article->id}" alt="{$article->title|htmlentities}" />
+</div>
+{/if}
+<div>{if $article->wiki}{$article->texte|miniwiki}{else}{$article->texte}{/if}</div>
+{if $article->post_id neq -1}
+<div style="clear: both">
+ <br />
+ <a href="{#globals.baseurl#}/banana/{#globals.banana.event_reply#|default:#globals.banana.event_forum#}/read/{$article->post_id}">
+ {icon name=comments full=true} Suivre la discussion
+ </a>
+</div>
+{/if}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}