moved rtl stylesheet to separate style section again, after all other styles to be...
[lhc/web/wiklou.git] / includes / SpecialNewpages.php
1 <?php
2
3 include_once( "QueryPage.php" );
4
5 class NewPagesPage extends QueryPage {
6
7 function getName() {
8 return "Newpages";
9 }
10
11 function isExpensive() {
12 return parent::isExpensive();
13 }
14
15 function getSQL( $offset, $limit ) {
16 return "SELECT rc_namespace AS cur_namespace, rc_title AS cur_title,rc_user AS cur_user,rc_user_text AS cur_user_text,rc_comment as cur_comment," .
17 "rc_timestamp AS cur_timestamp,length(cur_text) as cur_length,cur_text FROM recentchanges,cur " .
18 "WHERE rc_cur_id=cur_id AND rc_new=1 AND rc_namespace=0 AND cur_is_redirect=0 " .
19 "ORDER BY rc_timestamp DESC LIMIT {$offset}, {$limit}";
20 }
21
22 function formatResult( $skin, $result ) {
23 global $wgLang;
24 $u = $result->cur_user;
25 $ut = $result->cur_user_text;
26
27 $length = wfmsg( "nbytes", $wgLang->formatNum( $result->cur_length ) );
28 $c = $skin->formatComment($result->cur_comment );
29
30 if ( 0 == $u ) { # not by a logged-in user
31 $ul = $ut;
32 }
33 else {
34 $ul = $skin->makeLink( $wgLang->getNsText(2) . ":{$ut}", $ut );
35 }
36
37 $d = $wgLang->timeanddate( $result->cur_timestamp, true );
38 $link = $skin->makeKnownLink( $result->cur_title, "" );
39 $s = "{$d} {$link} ({$length}) . . {$ul}";
40
41 if ( "" != $c && "*" != $c ) {
42 $s .= " <em>({$c})</em>";
43 }
44
45 return $s;
46 }
47 }
48
49 function wfSpecialNewpages()
50 {
51 global $wgRequest;
52 list( $limit, $offset ) = wfCheckLimits();
53
54 $npp = new NewPagesPage();
55
56 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
57 $npp->doQuery( $offset, $limit );
58 }
59 }
60
61 ?>