Subversion Repositories Sites.tela-botanica.org

Compare Revisions

Ignore whitespace Rev 392 → Rev 393

/trunk/wikini/maj_wikini/actions/recentusersrss.php
New file
0,0 → 1,106
<?php
/*
recentusersrss.php
 
Copyright 2003,2007 David DELON, Jean-Pascal MILCENT
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;
}
$last_users = $this->LoadAll('SELECT name, signuptime, motto FROM '.$this->GetConfigValue('table_prefix').'users ORDER BY signuptime DESC LIMIT '.$max);
if ($last_users) {
if (!($link = $this->GetParameter('link'))) $link = $this->GetConfigValue('root_page');
if (!($format = $this->GetParameter('format'))) $format = 'rss1.0';
 
// Création de la sortie pour le contenu xml
$output = '<?xml version="1.0" encoding="iso-8859-1" ?>'."\n";
// En-tĂȘte du contenu xml
switch ($format) {
case 'rss1.0' :
 
$output .= '<!-- RSS v1.0 generated by Wikini -->'."\n";
$output .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"'."\n";
$output .= 'xmlns="http://purl.org/rss/1.0/">';
$output .= '<channel rdf:about="'.$this->Href('', $link).'">'."\n";
$output .= '<title>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</title>'."\n";
$output .= '<link>'.$this->Href('', $link).'</link>'."\n";
$output .= '<description>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</description>'."\n";
$output .= "<items>\n<rdf:Seq>\n";
break;
case 'rss2.0' :
$output .= '<!-- RSS v2.0 generated by Wikini -->'."\n";
$output .= '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" >'."\n";
$output .= '<channel>'."\n";
$output .= '<title>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</title>'."\n";
$output .= '<link>'.$this->Href('', $link).'</link>'."\n";
$output .= '<description>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</description>'."\n";
break;
}
 
// Corps du contenu XML
$items = '';
foreach ($last_users as $i => $user) {
$itemurl = $this->Href('', $user['name']);
switch ($format) {
case 'rss1.0' :
$output .= '<rdf:li rdf:resource="' . $itemurl . '" />';
$items .= '<item rdf:about="'.$itemurl.'">'."\n";
$items .= '<title>'.'Utilisateur '.htmlentities($user['name']).' - inscription le '.$user['signuptime'].'</title>'."\n";
$items .= '<description>'.'L\'utilisateur '.htmlentities($user['name']).' s\'est inscrit le '.$user['signuptime'];
if (!empty($user['motto'])) {
$items .= ' avec pour devise "'.htmlentities($user['motto']).'"';
}
$items .= '</description>'."\n";
$items .= '<link>'.$itemurl.'</link>'."\n";
$items .= '</item>'."\n";
break;
case 'rss2.0' :
$output .= '<item>'."\n";
$output .= '<title>'.'Utilisateur '.htmlentities($user['name']).' - inscription le '.$user['signuptime'].'</title>'."\n";
$output .= '<link>'.$itemurl.'</link>'."\n";
$output .= '<guid>'.$itemurl.'</guid>'."\n";
$output .= '<description>'.'L\'utilisateur '.htmlentities($user['name']).' s\'est inscrit le '.$user['signuptime'];
if (!empty($user['motto'])) {
$output .= ' avec pour devise "'.htmlentities($user['motto']).'"';
}
$output .= '</description>'."\n";
$output .= '</item>'."\n";
break;
}
}
 
//Pied du contenu XML
switch ($format) {
case 'rss1.0' :
$output .= "</rdf:Seq>\n</items>\n</channel>\n";
$output .= $items . "</rdf:RDF>\n";
break;
case 'rss2.0' :
$output .= '</channel>'."\n";
$output .= '</rss>'."\n";
break;
}
 
echo $output;
}
?>