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