missing parentheses
[lhc/web/wiklou.git] / includes / SpecialNewpages.php
1 <?php
2
3 require_once( "QueryPage.php" );
4
5 class NewPagesPage extends QueryPage {
6
7 function getName() {
8 return "Newpages";
9 }
10
11 function isExpensive() {
12 # Indexed on RC, and will *not* work with querycache yet.
13 return false;
14 #return parent::isExpensive();
15 }
16
17 function getSQL( $offset, $limit ) {
18 return
19 "SELECT 'Newpages' as type,
20 rc_namespace AS namespace,
21 rc_title AS title,
22 rc_cur_id AS value,
23
24 rc_user AS user,
25 rc_user_text AS user_text,
26 rc_comment as comment,
27 rc_timestamp AS timestamp,
28 length(cur_text) as length,
29 cur_text as text
30 FROM recentchanges,cur
31 WHERE rc_cur_id=cur_id AND rc_new=1
32 AND rc_namespace=0 AND cur_is_redirect=0";
33 }
34
35 function formatResult( $skin, $result ) {
36 global $wgLang;
37 $u = $result->user;
38 $ut = $result->user_text;
39
40 $length = wfMsg( "nbytes", $wgLang->formatNum( $result->length ) );
41 $c = $skin->formatComment($result->comment );
42
43 if ( 0 == $u ) { # not by a logged-in user
44 $ul = $ut;
45 }
46 else {
47 $ul = $skin->makeLink( $wgLang->getNsText(NS_USER) . ":{$ut}", $ut );
48 }
49
50 $d = $wgLang->timeanddate( $result->timestamp, true );
51 $link = $skin->makeKnownLink( $result->title, "" );
52 $s = "{$d} {$link} ({$length}) . . {$ul}";
53
54 if ( "" != $c && "*" != $c ) {
55 $s .= " <em>({$c})</em>";
56 }
57
58 return $s;
59 }
60 }
61
62 function wfSpecialNewpages()
63 {
64 global $wgRequest;
65 list( $limit, $offset ) = wfCheckLimits();
66
67 $npp = new NewPagesPage();
68
69 if( !$npp->doFeed( $wgRequest->getVal( 'feed' ) ) ) {
70 $npp->doQuery( $offset, $limit );
71 }
72 }
73
74 ?>