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 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
55 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM links, cur " .
56 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " .
57 "GROUP BY cur_id ORDER BY inverse_timestamp LIMIT {$limit}";
58 $res = wfQuery( $sql, DB_READ
, $fname );
60 $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
61 $note = wfMsg( "rcnote", $limit, $days );
62 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
64 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
65 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
68 $wgOut->addHTML( "{$note}\n" );
70 $s = $sk->beginRecentChangesList();
71 $count = wfNumRows( $res );
75 if ( 0 == $count ) { break; }
76 $obj = wfFetchObject( $res );
79 $rc = RecentChange
::newFromCurRow( $obj );
80 $rc->counter
= $counter++
;
81 $s .= $sk->recentChangesLine( $rc );
84 $s .= $sk->endRecentChangesList();
87 $wgOut->addHTML( $s );