Fix article count update on page creation
[lhc/web/wiklou.git] / rdf / recent.phtml
1 <?php
2 include("Setup.php");
3 header("Content-type: text/xml; charset=utf-8");
4 echo "<?xml version=\"1.0\"?>";
5
6 if( $style == "new" ) {
7 $addl = " - " . wfMsg( "newpages");
8 } else {
9 $addl = "";
10 }
11
12 ?>
13
14 <rdf:RDF
15 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
16 xmlns="http://my.netscape.com/rdf/simple/0.9/">
17
18 <channel>
19 <title><?php echo iconv($wgInputEncoding, "utf-8", wfMsg("sitetitle") . $addl ) ?></title>
20 <link><?php echo $wgServer ?></link>
21 <description><?php echo iconv($wgInputEncoding, "utf-8", wfMsg("sitesubtitle") ) ?></description>
22 </channel>
23
24 <?php
25 #<image>
26 #<title>Wikipedia</title>
27 #<url>...</url>
28 #<link>http://wikipedia.org/</link>
29 #</image>
30
31 if(isset($limit)) {
32 if( $limit < 1) $limit = 1;
33 if( $tlimit > 500) $limit = 500;
34 }
35 if(!isset($limit)) $limit = 10;
36
37 if($style == 'new') {
38 # 10 newest articles
39 $sql = "SELECT rc_title as cur_title, rc_comment as cur_comment FROM recentchanges,cur
40 WHERE rc_cur_id=cur_id AND rc_new=1 AND rc_namespace=0 AND cur_is_redirect=0
41 AND LENGTH(cur_text) > 75
42 ORDER BY rc_timestamp DESC LIMIT {$limit}";
43 } else {
44 # 10 most recently edit articles that aren't frickin tiny
45 $sql = "SELECT rc_title as cur_title,rc_comment as cur_comment FROM recentchanges,cur
46 WHERE rc_cur_id=cur_id AND rc_namespace=0 AND rc_this_oldid=0 AND cur_is_redirect=0
47 AND LENGTH(cur_text) > 150
48 ORDER BY rc_timestamp DESC LIMIT {$limit}";
49 }
50 $res = wfQuery( $sql );
51
52 while( $row = wfFetchObject( $res ) ) {
53 $title = htmlspecialchars(
54 iconv($wgInputEncoding, "utf-8",
55 str_replace( "_", " ", $row->cur_title ) ) );
56 $url = wfFullUrl( wfUrlencode( $row->cur_title ) );
57 $description = "<description>" . iconv($wgInputEncoding, "utf-8",
58 htmlspecialchars( $row->cur_comment )) . "</description>";
59 echo "
60 <item>
61 <title>{$title}</title>
62 <link>{$url}</link>
63 {$description}
64 </item>
65 ";
66 }
67
68 #<textinput>
69 #<title>Search Wikipedia</title>
70 #<description>Search Wikipedia articles</description>
71 #<name>query</name>
72 #<link>http://www.wikipedia.org/w/wiki.phtml?search=</link>
73 #</textinput>
74 ?>
75
76 </rdf:RDF>