Changing comments layout preparing for generated documentation with Phpdocumentor
[lhc/web/wiklou.git] / includes / SpecialRecentchangeslinked.php
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 require_once( "SpecialRecentchanges.php" );
10
11 /**
12 * constructor
13 */
14 function wfSpecialRecentchangeslinked( $par = NULL ) {
15 global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
16 $fname = "wfSpecialRecentchangeslinked";
17
18 $days = $wgRequest->getInt( 'days' );
19 $target = $wgRequest->getText( 'target' );
20 $hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
21
22 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
23 $sk = $wgUser->getSkin();
24
25 if( $par ) {
26 $target = $par;
27 }
28 if ( "" == $target ) {
29 $wgOut->errorpage( "notargettitle", "notargettext" );
30 return;
31 }
32 $nt = Title::newFromURL( $target );
33 if( !$nt ) {
34 $wgOut->errorpage( "notargettitle", "notargettext" );
35 return;
36 }
37 $id = $nt->getArticleId();
38
39 $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
40
41 if ( ! $days ) {
42 $days = $wgUser->getOption( "rcdays" );
43 if ( ! $days ) { $days = 7; }
44 }
45 $days = (int)$days;
46 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
47
48 $dbr =& wfGetDB( DB_SLAVE );
49 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
50
51 $hideminor = ($hideminor ? 1 : 0);
52 if ( $hideminor ) {
53 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
54 WfMsg( "show" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
55 "&days={$days}&limit={$limit}&hideminor=0" );
56 } else {
57 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
58 WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
59 "&days={$days}&limit={$limit}&hideminor=1" );
60 }
61 if ( $hideminor ) {
62 $cmq = "AND cur_minor_edit=0";
63 } else { $cmq = ""; }
64
65 extract( $dbr->tableNames( 'cur', 'links' ) );
66
67 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
68 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM $links, $cur " .
69 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " .
70 "GROUP BY cur_id,cur_namespace,cur_title,cur_user,cur_comment,cur_user_text," .
71 "cur_timestamp,cur_minor_edit,cur_is_new,inverse_timestamp ORDER BY inverse_timestamp LIMIT {$limit}";
72 $res = $dbr->query( $sql, $fname );
73
74 $wgOut->addHTML("&lt; ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
75 $note = wfMsg( "rcnote", $limit, $days );
76 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
77
78 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
79 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
80 false, $mlink );
81
82 $wgOut->addHTML( "{$note}\n" );
83
84 $s = $sk->beginRecentChangesList();
85 $count = $dbr->numRows( $res );
86
87 $counter = 1;
88 while ( $limit ) {
89 if ( 0 == $count ) { break; }
90 $obj = $dbr->fetchObject( $res );
91 --$count;
92
93 $rc = RecentChange::newFromCurRow( $obj );
94 $rc->counter = $counter++;
95 $s .= $sk->recentChangesLine( $rc );
96 --$limit;
97 }
98 $s .= $sk->endRecentChangesList();
99
100 $dbr->freeResult( $res );
101 $wgOut->addHTML( $s );
102 }
103
104 ?>