Subversion Repositories Sites.tela-botanica.org

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
393 jpm 1
<?php
2
/*
3
recentusersrss.php
4
 
5
Copyright 2003,2007  David DELON, Jean-Pascal MILCENT
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
10
 
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
GNU General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
*/
20
 
21
if ($user = $this->GetUser()) {
22
	$max = $user['changescount'];
23
} else {
24
	$max = 50;
25
}
26
$last_users = $this->LoadAll('SELECT name, signuptime, motto FROM '.$this->GetConfigValue('table_prefix').'users ORDER BY signuptime DESC LIMIT '.$max);
27
if ($last_users) {
28
	if (!($link = $this->GetParameter('link'))) $link = $this->GetConfigValue('root_page');
29
	if (!($format = $this->GetParameter('format'))) $format = 'rss1.0';
30
 
31
	// Création de la sortie pour le contenu xml
32
	$output = '<?xml version="1.0" encoding="iso-8859-1" ?>'."\n";
33
 
34
	// En-tête du contenu xml
35
	switch ($format) {
36
		case 'rss1.0' :
37
 
38
			$output .= '<!-- RSS v1.0 generated by Wikini -->'."\n";
39
			$output .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"'."\n";
40
		    $output .= 'xmlns="http://purl.org/rss/1.0/">';
41
 
42
			$output .= '<channel rdf:about="'.$this->Href('', $link).'">'."\n";
43
			$output .= '<title>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</title>'."\n";
44
			$output .= '<link>'.$this->Href('', $link).'</link>'."\n";
45
			$output .= '<description>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</description>'."\n";
46
 
47
    		$output .= "<items>\n<rdf:Seq>\n";
48
			break;
49
		case 'rss2.0' :
50
			$output .= '<!-- RSS v2.0 generated by Wikini -->'."\n";
51
			$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";
52
			$output .= '<channel>'."\n";
53
			$output .= '<title>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</title>'."\n";
54
			$output .= '<link>'.$this->Href('', $link).'</link>'."\n";
55
			$output .= '<description>Derniers inscrits sur '.$this->GetConfigValue('wakka_name').'</description>'."\n";
56
			break;
57
	}
58
 
59
	// Corps du contenu XML
60
    $items = '';
61
	foreach ($last_users as $i => $user) {
62
        $itemurl = $this->Href('', $user['name']);
63
		switch ($format) {
64
			case 'rss1.0' :
65
		        $output .= '<rdf:li rdf:resource="' . $itemurl . '" />';
66
 
67
				$items .= '<item rdf:about="'.$itemurl.'">'."\n";
68
				$items .= '<title>'.'Utilisateur '.htmlentities($user['name']).' - inscription le '.$user['signuptime'].'</title>'."\n";
69
				$items .= '<description>'.'L\'utilisateur '.htmlentities($user['name']).' s\'est inscrit le '.$user['signuptime'];
70
				if (!empty($user['motto'])) {
71
					$items .= ' avec pour devise  "'.htmlentities($user['motto']).'"';
72
				}
73
				$items .= '</description>'."\n";
74
				$items .= '<link>'.$itemurl.'</link>'."\n";
75
				$items .= '</item>'."\n";
76
				break;
77
			case 'rss2.0' :
78
				$output .= '<item>'."\n";
79
				$output .= '<title>'.'Utilisateur '.htmlentities($user['name']).' - inscription le '.$user['signuptime'].'</title>'."\n";
80
				$output .= '<link>'.$itemurl.'</link>'."\n";
81
				$output .= '<guid>'.$itemurl.'</guid>'."\n";
82
				$output .= '<description>'.'L\'utilisateur '.htmlentities($user['name']).' s\'est inscrit le '.$user['signuptime'];
83
				if (!empty($user['motto'])) {
84
					$output .= ' avec pour devise  "'.htmlentities($user['motto']).'"';
85
				}
86
				$output .= '</description>'."\n";
87
				$output .= '</item>'."\n";
88
				break;
89
		}
90
	}
91
 
92
	//Pied du contenu XML
93
	switch ($format) {
94
		case 'rss1.0' :
95
		    $output .= "</rdf:Seq>\n</items>\n</channel>\n";
96
			$output .= $items . "</rdf:RDF>\n";
97
			break;
98
		case 'rss2.0' :
99
			$output .= '</channel>'."\n";
100
			$output .= '</rss>'."\n";
101
			break;
102
	}
103
 
104
	echo $output;
105
}
106
?>