2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
2004-09-03 15:23:37 +00:00
|
|
|
* This is to display changes made to all articles linked in an article.
|
2004-09-03 23:00:01 +00:00
|
|
|
* @package MediaWiki
|
|
|
|
|
* @subpackage SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
2004-09-03 15:23:37 +00:00
|
|
|
require_once( 'SpecialRecentchanges.php' );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
2004-09-03 15:23:37 +00:00
|
|
|
* Entrypoint
|
|
|
|
|
* @param string $par parent page we will look at
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
|
|
|
|
function wfSpecialRecentchangeslinked( $par = NULL ) {
|
2005-12-04 18:27:59 +00:00
|
|
|
global $wgUser, $wgOut, $wgContLang, $wgRequest;
|
2004-09-03 15:23:37 +00:00
|
|
|
$fname = 'wfSpecialRecentchangeslinked';
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-04-01 12:53:01 +00:00
|
|
|
$days = $wgRequest->getInt( 'days' );
|
2005-05-06 11:20:37 +00:00
|
|
|
$target = isset($par) ? $par : $wgRequest->getText( 'target' );
|
2004-04-01 12:53:01 +00:00
|
|
|
$hideminor = $wgRequest->getBool( 'hideminor' ) ? 1 : 0;
|
|
|
|
|
|
2005-07-03 19:20:42 +00:00
|
|
|
$wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
$sk = $wgUser->getSkin();
|
|
|
|
|
|
2005-05-06 11:20:37 +00:00
|
|
|
if (is_null($target)) {
|
2004-09-03 15:23:37 +00:00
|
|
|
$wgOut->errorpage( 'notargettitle', 'notargettext' );
|
2003-04-14 23:10:40 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$nt = Title::newFromURL( $target );
|
2004-03-11 09:06:13 +00:00
|
|
|
if( !$nt ) {
|
2004-09-03 15:23:37 +00:00
|
|
|
$wgOut->errorpage( 'notargettitle', 'notargettext' );
|
2004-03-11 09:06:13 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$id = $nt->getArticleId();
|
|
|
|
|
|
2005-08-25 04:31:46 +00:00
|
|
|
$wgOut->setSubtitle( htmlspecialchars( wfMsg( 'rclsub', $nt->getPrefixedText() ) ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
|
|
|
|
if ( ! $days ) {
|
2004-09-03 15:23:37 +00:00
|
|
|
$days = $wgUser->getOption( 'rcdays' );
|
2003-04-14 23:10:40 +00:00
|
|
|
if ( ! $days ) { $days = 7; }
|
|
|
|
|
}
|
2003-06-03 08:44:50 +00:00
|
|
|
$days = (int)$days;
|
2004-09-03 15:23:37 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
|
2004-08-10 13:07:39 +00:00
|
|
|
|
|
|
|
|
$dbr =& wfGetDB( DB_SLAVE );
|
|
|
|
|
$cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-11-30 01:23:44 +00:00
|
|
|
$hideminor = ($hideminor ? 1 : 0);
|
2003-04-14 23:10:40 +00:00
|
|
|
if ( $hideminor ) {
|
2004-09-24 16:45:31 +00:00
|
|
|
$mlink = $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchangeslinked' ),
|
2005-08-16 21:02:15 +00:00
|
|
|
wfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
|
2003-04-14 23:10:40 +00:00
|
|
|
"&days={$days}&limit={$limit}&hideminor=0" );
|
|
|
|
|
} else {
|
2004-09-24 16:45:31 +00:00
|
|
|
$mlink = $sk->makeKnownLink( $wgContLang->specialPage( "Recentchangeslinked" ),
|
2005-08-16 21:02:15 +00:00
|
|
|
wfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
|
2003-04-14 23:10:40 +00:00
|
|
|
"&days={$days}&limit={$limit}&hideminor=1" );
|
|
|
|
|
}
|
|
|
|
|
if ( $hideminor ) {
|
2005-11-23 20:14:36 +00:00
|
|
|
$cmq = 'AND rc_minor=0';
|
2004-09-03 15:23:37 +00:00
|
|
|
} else { $cmq = ''; }
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-11-12 20:06:28 +00:00
|
|
|
extract( $dbr->tableNames( 'recentchanges', 'categorylinks', 'pagelinks', 'revision', 'page' ) );
|
2005-02-08 20:46:22 +00:00
|
|
|
|
2004-12-03 08:12:50 +00:00
|
|
|
// If target is a Category, use categorylinks and invert from and to
|
2004-12-19 08:00:50 +00:00
|
|
|
if( $nt->getNamespace() == NS_CATEGORY ) {
|
2004-12-03 08:12:50 +00:00
|
|
|
$catkey = $dbr->addQuotes( $nt->getDBKey() );
|
2005-11-12 20:43:21 +00:00
|
|
|
$sql = "SELECT /* wfSpecialRecentchangeslinked */
|
2005-11-27 09:53:13 +00:00
|
|
|
rc_id,
|
|
|
|
|
rc_cur_id,
|
|
|
|
|
rc_namespace,
|
|
|
|
|
rc_title,
|
|
|
|
|
rc_this_oldid,
|
|
|
|
|
rc_last_oldid,
|
|
|
|
|
rc_user,
|
|
|
|
|
rc_comment,
|
|
|
|
|
rc_user_text,
|
|
|
|
|
rc_timestamp,
|
|
|
|
|
rc_minor,
|
|
|
|
|
rc_new,
|
|
|
|
|
rc_patrolled,
|
|
|
|
|
rc_type
|
2005-11-12 20:43:21 +00:00
|
|
|
FROM $categorylinks, $recentchanges
|
|
|
|
|
WHERE rc_timestamp > '{$cutoff}'
|
|
|
|
|
{$cmq}
|
|
|
|
|
AND cl_from=rc_cur_id
|
|
|
|
|
AND cl_to=$catkey
|
2005-11-27 09:53:13 +00:00
|
|
|
GROUP BY rc_cur_id,rc_namespace,rc_title,
|
|
|
|
|
rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor,
|
|
|
|
|
rc_new
|
|
|
|
|
ORDER BY rc_timestamp DESC
|
2005-11-12 20:43:21 +00:00
|
|
|
LIMIT {$limit};
|
|
|
|
|
";
|
2004-12-03 08:12:50 +00:00
|
|
|
} else {
|
2005-05-26 10:23:36 +00:00
|
|
|
$sql =
|
2005-11-12 20:06:28 +00:00
|
|
|
"SELECT /* wfSpecialRecentchangeslinked */
|
2005-11-27 09:53:13 +00:00
|
|
|
rc_id,
|
|
|
|
|
rc_cur_id,
|
|
|
|
|
rc_namespace,
|
|
|
|
|
rc_title,
|
|
|
|
|
rc_user,
|
|
|
|
|
rc_comment,
|
|
|
|
|
rc_user_text,
|
2005-11-12 20:06:28 +00:00
|
|
|
rc_this_oldid,
|
2005-11-27 09:53:13 +00:00
|
|
|
rc_last_oldid,
|
|
|
|
|
rc_timestamp,
|
|
|
|
|
rc_minor,
|
|
|
|
|
rc_new,
|
|
|
|
|
rc_patrolled,
|
|
|
|
|
rc_type
|
2005-11-12 20:06:28 +00:00
|
|
|
FROM $pagelinks, $recentchanges
|
|
|
|
|
WHERE rc_timestamp > '{$cutoff}'
|
|
|
|
|
{$cmq}
|
|
|
|
|
AND pl_namespace=rc_namespace
|
|
|
|
|
AND pl_title=rc_title
|
2005-05-26 10:23:36 +00:00
|
|
|
AND pl_from=$id
|
2005-11-27 09:53:13 +00:00
|
|
|
GROUP BY rc_cur_id,rc_namespace,rc_title,
|
|
|
|
|
rc_user,rc_comment,rc_user_text,rc_timestamp,rc_minor,
|
|
|
|
|
rc_new
|
|
|
|
|
ORDER BY rc_timestamp DESC
|
2005-05-26 10:23:36 +00:00
|
|
|
LIMIT {$limit}";
|
2004-12-03 08:12:50 +00:00
|
|
|
}
|
2004-07-18 08:48:43 +00:00
|
|
|
$res = $dbr->query( $sql, $fname );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-05-06 15:30:05 +00:00
|
|
|
$wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
|
2003-06-03 08:44:50 +00:00
|
|
|
$note = wfMsg( "rcnote", $limit, $days );
|
2004-04-09 08:27:00 +00:00
|
|
|
$wgOut->addHTML( "<hr />\n{$note}\n<br />" );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2003-11-29 18:39:04 +00:00
|
|
|
$note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
|
|
|
|
|
"target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
|
|
|
|
|
false, $mlink );
|
|
|
|
|
|
2004-09-03 15:23:37 +00:00
|
|
|
$wgOut->addHTML( $note."\n" );
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2005-09-15 00:40:51 +00:00
|
|
|
$list = ChangesList::newFromUser( $wgUser );
|
2004-11-25 13:47:17 +00:00
|
|
|
$s = $list->beginRecentChangesList();
|
2004-07-18 08:48:43 +00:00
|
|
|
$count = $dbr->numRows( $res );
|
2004-04-19 09:15:01 +00:00
|
|
|
|
|
|
|
|
$counter = 1;
|
2003-04-14 23:10:40 +00:00
|
|
|
while ( $limit ) {
|
|
|
|
|
if ( 0 == $count ) { break; }
|
2004-07-18 08:48:43 +00:00
|
|
|
$obj = $dbr->fetchObject( $res );
|
2003-04-14 23:10:40 +00:00
|
|
|
--$count;
|
|
|
|
|
|
2005-11-27 09:53:13 +00:00
|
|
|
$rc = RecentChange::newFromRow( $obj );
|
2004-04-19 09:15:01 +00:00
|
|
|
$rc->counter = $counter++;
|
2004-11-25 13:47:17 +00:00
|
|
|
$s .= $list->recentChangesLine( $rc );
|
2003-04-14 23:10:40 +00:00
|
|
|
--$limit;
|
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
$s .= $list->endRecentChangesList();
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2004-07-18 08:48:43 +00:00
|
|
|
$dbr->freeResult( $res );
|
2003-04-14 23:10:40 +00:00
|
|
|
$wgOut->addHTML( $s );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|