3 * This is to display changes made to all articles linked in an article.
5 * @subpackage SpecialPage
11 require_once( 'SpecialRecentchanges.php' );
15 * @param string $par parent page we will look at
17 function wfSpecialRecentchangeslinked( $par = NULL ) {
18 global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
19 $fname = 'wfSpecialRecentchangeslinked';
21 $days = $wgRequest->getInt( 'days' );
22 $target = $wgRequest->getText( 'target' );
23 $hideminor = $wgRequest->getBool( 'hideminor' ) ?
1 : 0;
25 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
26 $sk = $wgUser->getSkin();
32 $wgOut->errorpage( 'notargettitle', 'notargettext' );
35 $nt = Title
::newFromURL( $target );
37 $wgOut->errorpage( 'notargettitle', 'notargettext' );
40 $id = $nt->getArticleId();
42 $wgOut->setSubtitle( wfMsg( 'rclsub', $nt->getPrefixedText() ) );
45 $days = $wgUser->getOption( 'rcdays' );
46 if ( ! $days ) { $days = 7; }
49 list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
51 $dbr =& wfGetDB( DB_SLAVE
);
52 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
54 $hideminor = ($hideminor ?
1 : 0);
56 $mlink = $sk->makeKnownLink( $wgLang->specialPage( 'Recentchangeslinked' ),
57 WfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
58 "&days={$days}&limit={$limit}&hideminor=0" );
60 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
61 WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
62 "&days={$days}&limit={$limit}&hideminor=1" );
65 $cmq = 'AND cur_minor_edit=0';
68 extract( $dbr->tableNames( 'cur', 'links' ) );
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 );
77 $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
78 $note = wfMsg( "rcnote", $limit, $days );
79 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
81 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
82 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
85 $wgOut->addHTML( $note."\n" );
87 $s = $sk->beginRecentChangesList();
88 $count = $dbr->numRows( $res );
92 if ( 0 == $count ) { break; }
93 $obj = $dbr->fetchObject( $res );
96 $rc = RecentChange
::newFromCurRow( $obj );
97 $rc->counter
= $counter++
;
98 $s .= $sk->recentChangesLine( $rc );
101 $s .= $sk->endRecentChangesList();
103 $dbr->freeResult( $res );
104 $wgOut->addHTML( $s );