46 |
jpm |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
recentchangesrss.php
|
|
|
4 |
|
|
|
5 |
Copyright 2003 David DELON
|
|
|
6 |
Copyright 2005-2007 Didier LOISEAU
|
|
|
7 |
This program is free software; you can redistribute it and/or modify
|
|
|
8 |
it under the terms of the GNU General Public License as published by
|
|
|
9 |
the Free Software Foundation; either version 2 of the License, or
|
|
|
10 |
(at your option) any later version.
|
|
|
11 |
|
|
|
12 |
This program is distributed in the hope that it will be useful,
|
|
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
15 |
GNU General Public License for more details.
|
|
|
16 |
|
|
|
17 |
You should have received a copy of the GNU General Public License
|
|
|
18 |
along with this program; if not, write to the Free Software
|
|
|
19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
if ($this->GetMethod() != 'xml') {
|
|
|
23 |
echo 'Pour obtenir le fil RSS des derniers changements, utilisez l\'adresse suivante: ';
|
|
|
24 |
echo $this->Link($this->Href('xml'));
|
|
|
25 |
return;
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
if (isset($_GET['max']) && is_numeric($_GET['max'])) {
|
|
|
29 |
$max = ($_GET['max'] < 1000) ? $_GET['max'] : 1000;
|
|
|
30 |
} else if ($user = $this->GetUser()) {
|
|
|
31 |
$max = $user["changescount"];
|
|
|
32 |
} else {
|
|
|
33 |
$max = 50;
|
|
|
34 |
}
|
|
|
35 |
$pages = $this->LoadRecentlyChanged($max);
|
|
|
36 |
$last_users = $this->LoadAll('SELECT name, signuptime, motto FROM '.$this->GetConfigValue('table_prefix').'users ORDER BY signuptime DESC LIMIT '.$max);
|
|
|
37 |
if ($pages || $last_users)
|
|
|
38 |
{
|
|
|
39 |
if (!($link = $this->GetParameter("link"))) $link=$this->GetConfigValue("root_page");
|
|
|
40 |
$output = '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n";
|
|
|
41 |
$output .= "<channel>\n";
|
|
|
42 |
$output .= "<title> Derniers changements sur ". $this->GetConfigValue("wakka_name") . "</title>\n";
|
|
|
43 |
$output .= "<link>" . $this->Href(false, $link) . "</link>\n";
|
|
|
44 |
$output .= "<description> $max derniers changements sur " . htmlspecialchars($this->GetConfigValue("wakka_name")) . " </description>\n";
|
|
|
45 |
$output .= "<language>fr</language>\n";
|
|
|
46 |
$output .= '<generator>WikiNi ' . WIKINI_VERSION . "</generator>\n";
|
|
|
47 |
|
|
|
48 |
$items = array();
|
|
|
49 |
if ($pages)
|
|
|
50 |
{
|
|
|
51 |
foreach ($pages as $page)
|
|
|
52 |
{
|
|
|
53 |
$items[strtotime($page['time'])] = array('type' => 'page', 'content' => $page);
|
|
|
54 |
}
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
if ($last_users)
|
|
|
58 |
{
|
|
|
59 |
foreach ($last_users as $user) {
|
|
|
60 |
$items[strtotime($user['signuptime'])] = array('type' => 'user', 'content' => $user);
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
krsort($items);
|
|
|
64 |
|
|
|
65 |
foreach ($items as $item) {
|
|
|
66 |
$type = $item['type'];
|
|
|
67 |
if ($type == 'page')
|
|
|
68 |
{
|
|
|
69 |
$page = $item['content'];
|
|
|
70 |
|
|
|
71 |
$output .= "<item>\n";
|
|
|
72 |
$output .= "<title>" . htmlspecialchars($page["tag"]) . "</title>\n";
|
|
|
73 |
$output .= '<dc:creator>' . htmlspecialchars($page["user"]) . "</dc:creator>\n";
|
|
|
74 |
$output .= '<pubDate>' . gmdate('D, d M Y H:i:s \G\M\T', strtotime($page['time'])) . "</pubDate>\n";
|
|
|
75 |
$output .= "<description>" . htmlspecialchars(
|
|
|
76 |
'Modification de ' . $this->ComposeLinkToPage($page["tag"])
|
|
|
77 |
. ' (' . $this->ComposeLinkToPage($page["tag"], 'revisions', 'historique') . ')'
|
|
|
78 |
. " --- par " .$page["user"])
|
|
|
79 |
. "</description>\n";
|
|
|
80 |
$itemurl = $this->href(false, $page["tag"], "time=" . htmlspecialchars(rawurlencode($page["time"])));
|
|
|
81 |
$output .= '<guid>' . $itemurl . "</guid>\n";
|
|
|
82 |
$output .= "</item>\n";
|
|
|
83 |
}
|
|
|
84 |
else if ($type == 'user')
|
|
|
85 |
{
|
|
|
86 |
$user = $item['content'];
|
|
|
87 |
$itemurl = $this->Href('', $user['name']);
|
|
|
88 |
|
|
|
89 |
$output .= '<item>'."\n";
|
|
|
90 |
$output .= '<title>'.'Utilisateur '.htmlspecialchars($user['name']).' - inscription le '.$user['signuptime'].'</title>'."\n";
|
|
|
91 |
$output .= '<link>'.$itemurl.'</link>'."\n";
|
|
|
92 |
$output .= '<pubDate>' . gmdate('D, d M Y H:i:s \G\M\T', strtotime($user['signuptime'])) . "</pubDate>\n";
|
|
|
93 |
$output .= '<description>'.'L\'utilisateur '.htmlspecialchars($user['name']).' s\'est inscrit le '.$user['signuptime'];
|
|
|
94 |
if (!empty($user['motto']))
|
|
|
95 |
{
|
|
|
96 |
$output .= ' avec pour devise "'.htmlspecialchars($user['motto']).'"';
|
|
|
97 |
}
|
|
|
98 |
$output .= '</description>'."\n";
|
|
|
99 |
$output .= '<guid>'.$itemurl.'</guid>'."\n";
|
|
|
100 |
$output .= '</item>'."\n";
|
|
|
101 |
}
|
|
|
102 |
}
|
|
|
103 |
$output .= "</channel>\n";
|
|
|
104 |
$output .= "</rss>\n";
|
|
|
105 |
echo $output ;
|
|
|
106 |
}
|
|
|
107 |
?>
|