9 require_once( "SpecialRecentchanges.php" );
14 function wfSpecialRecentchangeslinked( $par = NULL ) {
15 global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
16 $fname = "wfSpecialRecentchangeslinked";
18 $days = $wgRequest->getInt( 'days' );
19 $target = $wgRequest->getText( 'target' );
20 $hideminor = $wgRequest->getBool( 'hideminor' ) ?
1 : 0;
22 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
23 $sk = $wgUser->getSkin();
28 if ( "" == $target ) {
29 $wgOut->errorpage( "notargettitle", "notargettext" );
32 $nt = Title
::newFromURL( $target );
34 $wgOut->errorpage( "notargettitle", "notargettext" );
37 $id = $nt->getArticleId();
39 $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
42 $days = $wgUser->getOption( "rcdays" );
43 if ( ! $days ) { $days = 7; }
46 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
48 $dbr =& wfGetDB( DB_SLAVE
);
49 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
51 $hideminor = ($hideminor ?
1 : 0);
53 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
54 WfMsg( "show" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
55 "&days={$days}&limit={$limit}&hideminor=0" );
57 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
58 WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
59 "&days={$days}&limit={$limit}&hideminor=1" );
62 $cmq = "AND cur_minor_edit=0";
65 extract( $dbr->tableNames( 'cur', 'links' ) );
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 );
74 $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
75 $note = wfMsg( "rcnote", $limit, $days );
76 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
78 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
79 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
82 $wgOut->addHTML( "{$note}\n" );
84 $s = $sk->beginRecentChangesList();
85 $count = $dbr->numRows( $res );
89 if ( 0 == $count ) { break; }
90 $obj = $dbr->fetchObject( $res );
93 $rc = RecentChange
::newFromCurRow( $obj );
94 $rc->counter
= $counter++
;
95 $s .= $sk->recentChangesLine( $rc );
98 $s .= $sk->endRecentChangesList();
100 $dbr->freeResult( $res );
101 $wgOut->addHTML( $s );