<?php
/**
*
- * @package MediaWiki
- * @subpackage SpecialPage
+ * @addtogroup SpecialPage
*/
/**
*
*/
-require_once( 'ChangesList.php' );
+require_once( dirname(__FILE__) . '/ChangesList.php' );
/**
* Constructor
*/
function wfSpecialRecentchanges( $par, $specialPage ) {
- global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol, $wgDBtype;
+ global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
global $wgAllowCategorizedRecentChanges ;
$fname = 'wfSpecialRecentchanges';
# Get query parameters
$feedFormat = $wgRequest->getVal( 'feed' );
- /* Checkbox values can't be true be default, because
+ /* Checkbox values can't be true by default, because
* we cannot differentiate between unset and not set at all
*/
$defaults = array(
extract($defaults);
- $days = $wgUser->getOption( 'rcdays' );
- if ( !$days ) { $days = $defaults['days']; }
+ $days = $wgUser->getOption( 'rcdays', $defaults['days']);
$days = $wgRequest->getInt( 'days', $days );
- $limit = $wgUser->getOption( 'rclimit' );
- if ( !$limit ) { $limit = $defaults['limit']; }
+ $limit = $wgUser->getOption( 'rclimit', $defaults['limit'] );
# list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
$limit = $wgRequest->getInt( 'limit', $limit );
if( $feedFormat ) {
global $wgFeedLimit;
if( $limit > $wgFeedLimit ) {
- $options['limit'] = $wgFeedLimit;
+ $limit = $wgFeedLimit;
}
} else {
if ( is_numeric( $bit ) ) {
$limit = $bit;
}
-
+
+ $m = array();
if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
$limit = $m[1];
}
# Database connection and caching
- $dbr =& wfGetDB( DB_SLAVE );
- extract( $dbr->tableNames( 'recentchanges', 'watchlist' ) );
+ $dbr = wfGetDB( DB_SLAVE );
+ list( $recentchanges, $watchlist ) = $dbr->tableNamesN( 'recentchanges', 'watchlist' );
$cutoff_unixtime = time() - ( $days * 86400 );
// Output header
if ( !$specialPage->including() ) {
- $wgOut->addWikiText( wfMsgForContent( "recentchangestext" ) );
+ $wgOut->addWikiText( wfMsgForContentNoTrans( "recentchangestext" ) );
// Dump everything here
$nondefaults = array();
}
// And now for the content
- $wgOut->setSyndicated( true );
-
$list = ChangesList::newFromUser( $wgUser );
if ( $wgAllowCategorizedRecentChanges ) {
}
function rcFilterByCategories ( &$rows , $categories , $any ) {
- require_once ( 'Categoryfinder.php' ) ;
-
# Filter categories
$cats = array () ;
foreach ( $categories AS $cat ) {
' [' . $wgContLanguageCode . ']';
$feed = new $wgFeedClasses[$feedFormat](
$feedTitle,
- htmlspecialchars( wfMsgForContent( 'recentchangestext' ) ),
+ htmlspecialchars( wfMsgForContent( 'recentchanges-feed-description' ) ),
$wgTitle->getFullUrl() );
+ //purge cache if requested
+ global $wgRequest, $wgUser;
+ $purge = $wgRequest->getVal( 'action' ) == 'purge';
+ if ( $purge && $wgUser->isAllowed('purge') ) {
+ $messageMemc->delete( $timekey );
+ $messageMemc->delete( $key );
+ }
+
/**
* Bumping around loading up diffs can be pretty slow, so where
* possible we want to cache the feed output so the next visitor
$sorted[$n] = $obj;
$n++;
}
- $first = false;
}
foreach( $sorted as $obj ) {
*
*/
function rcCountLink( $lim, $d, $page='Recentchanges', $more='' ) {
- global $wgLang, $wgContLang;
- $s = Linker::makeKnownLink( $wgContLang->specialPage( $page ),
+ global $wgUser, $wgLang, $wgContLang;
+ $sk = $wgUser->getSkin();
+ $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
($lim ? $wgLang->formatNum( "{$lim}" ) : wfMsg( 'recentchangesall' ) ), "{$more}" .
($d ? "days={$d}&" : '') . 'limit='.$lim );
return $s;
*
*/
function rcDaysLink( $lim, $d, $page='Recentchanges', $more='' ) {
- global $wgLang, $wgContLang;
- $s = Linker::makeKnownLink( $wgContLang->specialPage( $page ),
+ global $wgUser, $wgLang, $wgContLang;
+ $sk = $wgUser->getSkin();
+ $s = $sk->makeKnownLink( $wgContLang->specialPage( $page ),
($d ? $wgLang->formatNum( "{$d}" ) : wfMsg( 'recentchangesall' ) ), $more.'days='.$d .
($lim ? '&limit='.$lim : '') );
return $s;
/**
* Makes change an option link which carries all the other options
- * @param $title @see Title
+ * @param $title see Title
* @param $override
* @param $options
*/
function makeOptionsLink( $title, $override, $options ) {
- global $wgContLang;
- return Linker::makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
+ global $wgUser, $wgContLang;
+ $sk = $wgUser->getSkin();
+ return $sk->makeKnownLink( $wgContLang->specialPage( 'Recentchanges' ),
htmlspecialchars( $title ), wfArrayToCGI( $override, $options ) );
}
}
function rcFormatDiffRow( $title, $oldid, $newid, $timestamp, $comment ) {
- global $wgFeedDiffCutoff, $wgContLang;
+ global $wgFeedDiffCutoff, $wgContLang, $wgUser;
$fname = 'rcFormatDiff';
wfProfileIn( $fname );
- $completeText = '<p>' . Linker::formatComment( $comment ) . "</p>\n";
+ $skin = $wgUser->getSkin();
+ $completeText = '<p>' . $skin->formatComment( $comment ) . "</p>\n";
- if( $title->getNamespace() >= 0 ) {
+ //NOTE: Check permissions for anonymous users, not current user.
+ // No "privileged" version should end up in the cache.
+ // Most feed readers will not log in anway.
+ $anon = new User();
+ $accErrors = $title->getUserPermissionsErrors( 'read', $anon, true );
+
+ if( $title->getNamespace() >= 0 && !$accErrors ) {
if( $oldid ) {
wfProfileIn( "$fname-dodiff" );
*/
function rcApplyDiffStyle( $text ) {
$styles = array(
- 'diff' => 'background-color: white;',
- 'diff-otitle' => 'background-color: white;',
- 'diff-ntitle' => 'background-color: white;',
- 'diff-addedline' => 'background: #cfc; font-size: smaller;',
- 'diff-deletedline' => 'background: #ffa; font-size: smaller;',
- 'diff-context' => 'background: #eee; font-size: smaller;',
- 'diffchange' => 'color: red; font-weight: bold;',
+ 'diff' => 'background-color: white; color:black;',
+ 'diff-otitle' => 'background-color: white; color:black;',
+ 'diff-ntitle' => 'background-color: white; color:black;',
+ 'diff-addedline' => 'background: #cfc; color:black; font-size: smaller;',
+ 'diff-deletedline' => 'background: #ffa; color:black; font-size: smaller;',
+ 'diff-context' => 'background: #eee; color:black; font-size: smaller;',
+ 'diffchange' => 'color: red; font-weight: bold; text-decoration: none;',
);
foreach( $styles as $class => $style ) {
return $text;
}
-?>
+