3 include_once( "$IP/SpecialRecentchanges.php" );
5 function wfSpecialRecentchangeslinked( $par = NULL )
7 global $wgUser, $wgOut, $wgLang, $wgTitle;
8 global $days, $target, $hideminor; # From query string
9 $fname = "wfSpecialRecentchangeslinked";
11 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
12 $sk = $wgUser->getSkin();
17 if ( "" == $target ) {
18 $wgOut->errorpage( "notargettitle", "notargettext" );
21 $nt = Title
::newFromURL( $target );
22 $wgOut->setSubtitle( wfMsg( "rclsub", $nt->getPrefixedText() ) );
25 $days = $wgUser->getOption( "rcdays" );
26 if ( ! $days ) { $days = 7; }
29 list( $limit, $offset ) = wfCheckLimits( 100, "rclimit" );
30 $cutoff = wfUnix2Timestamp( time() - ( $days * 86400 ) );
32 if ( ! isset( $hideminor ) ) {
33 $hideminor = $wgUser->getOption( "hideminor" );
36 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
37 WfMsg( "show" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
38 "&days={$days}&limit={$limit}&hideminor=0" );
40 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
41 WfMsg( "hide" ), "target=" . wfEscapeHTML( $nt->getPrefixedURL() ) .
42 "&days={$days}&limit={$limit}&hideminor=1" );
45 $cmq = "AND cur_minor_edit=0";
48 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
49 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM links, cur " .
50 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from='" .
51 wfStrencode( $nt->getPrefixedDBkey() ) . "' GROUP BY cur_id " .
52 "ORDER BY inverse_timestamp LIMIT {$limit}";
53 $res = wfQuery( $sql, DB_READ
, $fname );
55 $note = wfMsg( "rcnote", $limit, $days );
56 $wgOut->addHTML( "<hr>\n{$note}\n<br>" );
58 $tu = "target=" . $nt->getPrefixedURL();
59 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked", $tu );
60 $wgOut->addHTML( "{$note}\n" );
62 $s = $sk->beginRecentChangesList();
63 $count = wfNumRows( $res );
66 if ( 0 == $count ) { break; }
67 $obj = wfFetchObject( $res );
70 $ts = $obj->cur_timestamp
;
72 $ut = $obj->cur_user_text
;
73 $ns = $obj->cur_namespace
;
74 $ttl = $obj->cur_title
;
75 $com = $obj->cur_comment
;
76 $me = ( $obj->cur_minor_edit
> 0 );
77 $new = ( $obj->cur_is_new
> 0 );
79 $s .= $sk->recentChangesLine( $ts, $u, $ut, $ns, $ttl, $com, $me, $new );
82 $s .= $sk->endRecentChangesList();
85 $wgOut->addHTML( $s );