Subversion Repositories Applications.projet

Rev

Rev 2 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*
recentchangesrss.php

Copyright 2003  David DELON
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
*/

if ($user = $this->GetUser())
{
        $max = $user["changescount"];
}
else
{
        $max = 50;
}

if ($pages = $this->LoadRecentlyChanged($max))
{
        if (!($link = $this->GetParameter("link"))) $link=$this->config["root_page"];
        $output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
        $output .= "<!-- RSS v0.91 generated by Wikini -->\n";
        $output .= "<rdf:RDF\n";
        $output .= "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
        $output .= "xmlns=\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n";
 
        $output .= "<channel>\n";
        $output .= "<title> Derniers changements sur ". $this->config["wakka_name"]  . "</title>\n";
        $output .= "<link>".str_replace('&', '&amp;', $this->config["base_url"].$link)."</link>\n";
        $output .= "<description> Derniers changements sur " . $this->config["wakka_name"] . " </description>\n";
        $output .= "<language>fr</language>\n";
        $output .= "</channel>\n";

        foreach ($pages as $i => $page)
        {
                list($day, $time) = explode(" ", $page["time"]);
                $day= preg_replace("/-/", " ", $day);
                list($hh,$mm,$ss) = explode(":", $time);
                $output .= "<item>\n";
                $output .= "<title>" . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</title>\n";
                $output .= "<description> Modification de " . $page["tag"] . " --- par " .$page["user"] . " le " . $day ." - ". $hh .":". $mm . "</description>\n";
                $output .= "<link>".str_replace('&', '&amp;', $this->config["base_url"].$page["tag"])."&amp;time=" . rawurlencode($page["time"]) . "</link>\n";
                $output .= "</item>\n";
        }
        $output .= "</rdf:RDF>\n";
        echo $output ;
}
?>