*/
class SpecialRecentChanges extends SpecialPage {
public function __construct() {
- SpecialPage::SpecialPage( 'Recentchanges' );
+ parent::__construct( 'Recentchanges' );
$this->includable( true );
}
* @return FormOptions
*/
public function getDefaultOptions() {
+ global $wgUser;
$opts = new FormOptions();
- $opts->add( 'days', (int)User::getDefaultOption( 'rcdays' ) );
- $opts->add( 'limit', (int)User::getDefaultOption( 'rclimit' ) );
+ $opts->add( 'days', (int)$wgUser->getOption( 'rcdays' ) );
+ $opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) );
$opts->add( 'from', '' );
- $opts->add( 'hideminor', false );
+ $opts->add( 'hideminor', (bool)$wgUser->getOption( 'hideminor' ) );
$opts->add( 'hidebots', true );
$opts->add( 'hideanons', false );
$opts->add( 'hideliu', false );
$opts->add( 'categories', '' );
$opts->add( 'categories_any', false );
-
return $opts;
}
* @return FormOptions
*/
public function setup( $parameters ) {
- global $wgUser, $wgRequest;
+ global $wgRequest;
$opts = $this->getDefaultOptions();
- $opts['days'] = (int)$wgUser->getOption( 'rcdays', $opts['days'] );
- $opts['limit'] = (int)$wgUser->getOption( 'rclimit', $opts['limit'] );
- $opts['hideminor'] = $wgUser->getOption( 'hideminor', $opts['hideminor'] );
$opts->fetchValuesFromRequest( $wgRequest );
// Give precedence to subpage syntax
$rows = array();
$batch = new LinkBatch;
$conds = $this->buildMainQueryConds( $opts );
- $res = $this->doMainQuery( $conds, $opts );
- if( $res === false ){
+ $rows = $this->doMainQuery( $conds, $opts );
+ if( $rows === false ){
$this->doHeader( $opts );
return;
}
- $dbr = wfGetDB( DB_SLAVE );
- while( $row = $dbr->fetchObject( $res ) ){
- $rows[] = $row;
+
+ foreach( $rows as $row ) {
if ( !$feedFormat ) {
// User page and talk links
$batch->add( NS_USER, $row->rc_user_text );
$batch->add( NS_USER_TALK, $row->rc_user_text );
}
-
}
- $dbr->freeResult( $res );
if ( $feedFormat ) {
list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat );
$batch->execute();
$this->webOutput( $rows, $opts );
}
+
+ $rows->free();
}
/**
}
$rc->numberofWatchingusers = $watcherCache[$obj->rc_namespace][$obj->rc_title];
}
- $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ) );
+ $s .= $list->recentChangesLine( $rc, !empty( $obj->wl_user ), $counter );
--$limit;
}
}
$panel = array();
$panel[] = $this->optionsPanel( $defaults, $nondefaults );
+ $panel[] = '<hr />';
$extraOpts = $this->getExtraOptions( $opts );
$panel[] = $form;
$panelString = implode( "\n", $panel );
- $wgOut->addHTML( '<div class="rcoptions">' . $panelString . '</div>' );
+ $wgOut->addHTML(
+ Xml::fieldset( wfMsg( strtolower( $this->mName ) ), $panelString, array( 'class' => 'rcoptions' ) )
+ );
$this->setBottomText( $wgOut, $opts );
}
* @param $out OutputPage
* @param $opts FormOptions
*/
- function setTopText( &$out, $opts ){
+ function setTopText( OutputPage $out, FormOptions $opts ){
$out->addWikiText( wfMsgForContentNoTrans( 'recentchangestext' ) );
}
* @param $out OutputPage
* @param $opts FormOptions
*/
- function setBottomText( &$out, $opts ){}
+ function setBottomText( OutputPage $out, FormOptions $opts ){}
/**
* Creates the choose namespace selection
* @param $options
*/
function makeOptionsLink( $title, $override, $options, $active = false ) {
- global $wgUser, $wgContLang;
+ global $wgUser;
$sk = $wgUser->getSkin();
- return $sk->makeKnownLinkObj( $this->getTitle(),
- htmlspecialchars( $title ), wfArrayToCGI( $override, $options ), '', '',
- $active ? 'style="font-weight: bold;"' : '' );
+ $params = wfArrayMerge( $options, $override );
+ return $sk->link( $this->getTitle(), htmlspecialchars( $title ),
+ ( $active ? array( 'style'=>'font-weight: bold;' ) : array() ), $params, array( 'known' ) );
}
/**
$note = wfMsgExt( 'rcnote', array( 'parseinline' ),
$wgLang->formatNum( $options['limit'] ),
$wgLang->formatNum( $options['days'] ),
- $wgLang->timeAndDate( wfTimestampNow(), true ) );
+ $wgLang->timeAndDate( wfTimestampNow(), true ),
+ $wgLang->date( wfTimestampNow(), true ),
+ $wgLang->time( wfTimestampNow(), true ) );
# Sort data for display and make sure it's unique after we've added user data.
$wgRCLinkLimits[] = $options['limit'];
$wgRCLinkDays[] = $options['days'];
- sort($wgRCLinkLimits);
- sort($wgRCLinkDays);
- $wgRCLinkLimits = array_unique($wgRCLinkLimits);
- $wgRCLinkDays = array_unique($wgRCLinkDays);
+ sort( $wgRCLinkLimits );
+ sort( $wgRCLinkDays );
+ $wgRCLinkLimits = array_unique( $wgRCLinkLimits );
+ $wgRCLinkDays = array_unique( $wgRCLinkDays );
// limit links
foreach( $wgRCLinkLimits as $value ) {
$cl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
array( 'limit' => $value ), $nondefaults, $value == $options['limit'] ) ;
}
- $cl = implode( ' | ', $cl);
+ $cl = implode( ' | ', $cl );
// day links, reset 'from' to none
foreach( $wgRCLinkDays as $value ) {
$dl[] = $this->makeOptionsLink( $wgLang->formatNum( $value ),
array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] ) ;
}
- $dl = implode( ' | ', $dl);
+ $dl = implode( ' | ', $dl );
// show/hide links
- $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ));
+ $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
$minorLink = $this->makeOptionsLink( $showhide[1-$options['hideminor']],
array( 'hideminor' => 1-$options['hideminor'] ), $nondefaults);
$botLink = $this->makeOptionsLink( $showhide[1-$options['hidebots']],
// show from this onward link
$now = $wgLang->timeanddate( wfTimestampNow(), true );
- $tl = $this->makeOptionsLink( $now, array( 'from' => wfTimestampNow()), $nondefaults );
+ $tl = $this->makeOptionsLink( $now, array( 'from' => wfTimestampNow() ), $nondefaults );
- $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter'),
+ $rclinks = wfMsgExt( 'rclinks', array( 'parseinline', 'replaceafter' ),
$cl, $dl, $hl );
- $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter'), $tl );
+ $rclistfrom = wfMsgExt( 'rclistfrom', array( 'parseinline', 'replaceafter' ), $tl );
return "$note<br />$rclinks<br />$rclistfrom";
}
}