2 require_once( "SpecialRecentchanges.php" );
4 function wfSpecialRecentchangeslinked( $par = NULL )
6 global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
7 $fname = "wfSpecialRecentchangeslinked";
9 $days = $wgRequest->getInt( 'days' );
10 $target = $wgRequest->getText( 'target' );
11 $hideminor = $wgRequest->getBool( 'hideminor' ) ?
1 : 0;
13 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
14 $sk = $wgUser->getSkin();
19 if ( "" == $target ) {
20 $wgOut->errorpage( "notargettitle", "notargettext" );
23 $nt = Title
::newFromURL( $target );
25 $wgOut->errorpage( "notargettitle", "notargettext" );
28 $id = $nt->getArticleId();
30 $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
33 $days = $wgUser->getOption( "rcdays" );
34 if ( ! $days ) { $days = 7; }
37 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
38 $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
40 $hideminor = ($hideminor ?
1 : 0);
42 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
43 WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
44 "&days={$days}&limit={$limit}&hideminor=0" );
46 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
47 WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
48 "&days={$days}&limit={$limit}&hideminor=1" );
51 $cmq = "AND cur_minor_edit=0";
54 $dbr =& wfGetDB( DB_SLAVE
);
55 extract( $dbr->tableNames( 'cur', 'links' ) );
57 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
58 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM $links, $cur " .
59 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " .
60 "GROUP BY cur_id ORDER BY inverse_timestamp LIMIT {$limit}";
61 $res = $dbr->query( $sql, $fname );
63 $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
64 $note = wfMsg( "rcnote", $limit, $days );
65 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
67 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
68 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
71 $wgOut->addHTML( "{$note}\n" );
73 $s = $sk->beginRecentChangesList();
74 $count = $dbr->numRows( $res );
78 if ( 0 == $count ) { break; }
79 $obj = $dbr->fetchObject( $res );
82 $rc = RecentChange
::newFromCurRow( $obj );
83 $rc->counter
= $counter++
;
84 $s .= $sk->recentChangesLine( $rc );
87 $s .= $sk->endRecentChangesList();
89 $dbr->freeResult( $res );
90 $wgOut->addHTML( $s );