From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/specials/SpecialActiveusers.php | 90 +++++++++++++++++--------------- 1 file changed, 49 insertions(+), 41 deletions(-) (limited to 'includes/specials/SpecialActiveusers.php') diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index 7d907fb5..f016ab92 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -1,37 +1,40 @@ RCMaxAge = ceil( $wgRCMaxAge / ( 3600 * 24 ) ); // Constant - + global $wgRequest, $wgActiveUserDays; + $this->RCMaxAge = $wgActiveUserDays; $un = $wgRequest->getText( 'username' ); $this->requestedUser = ''; if ( $un != '' ) { @@ -40,15 +43,15 @@ class ActiveUsersPager extends UsersPager { $this->requestedUser = $username->getText(); } } - + $this->setupOptions(); - + parent::__construct(); } public function setupOptions() { global $wgRequest; - + $this->opts = new FormOptions(); $this->opts->add( 'hidebots', false, FormOptions::BOOL ); @@ -57,10 +60,12 @@ class ActiveUsersPager extends UsersPager { $this->opts->fetchValuesFromRequest( $wgRequest ); $this->groups = array(); - if ($this->opts->getValue('hidebots') == 1) + if ( $this->opts->getValue( 'hidebots' ) == 1 ) { $this->groups['bot'] = true; - if ($this->opts->getValue('hidesysops') == 1) + } + if ( $this->opts->getValue( 'hidesysops' ) == 1 ) { $this->groups['sysop'] = true; + } } function getIndexField() { @@ -72,7 +77,8 @@ class ActiveUsersPager extends UsersPager { $conds = array( 'rc_user > 0' ); // Users - no anons $conds[] = 'ipb_deleted IS NULL'; // don't show hidden names $conds[] = "rc_log_type IS NULL OR rc_log_type != 'newusers'"; - + $conds[] = "rc_timestamp >= '{$dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 )}'"; + if( $this->requestedUser != '' ) { $conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser ); } @@ -101,14 +107,15 @@ class ActiveUsersPager extends UsersPager { function formatRow( $row ) { global $wgLang; $userName = $row->user_name; - + $ulinks = $this->getSkin()->userLink( $row->user_id, $userName ); $ulinks .= $this->getSkin()->userToolLinks( $row->user_id, $userName ); $list = array(); foreach( self::getGroups( $row->user_id ) as $group ) { - if (isset($this->groups[$group])) + if ( isset( $this->groups[$group] ) ) { return; + } $list[] = self::buildGroupLink( $group ); } $groups = $wgLang->commaList( $list ); @@ -126,14 +133,14 @@ class ActiveUsersPager extends UsersPager { } function getPageHeader() { - global $wgScript, $wgRequest; + global $wgScript; $self = $this->getTitle(); - $limit = $this->mLimit ? Xml::hidden( 'limit', $this->mLimit ) : ''; + $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : ''; - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag + $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag $out .= Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n"; - $out .= Xml::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n"; + $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n"; $out .= Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . '
';# Username field @@ -141,10 +148,10 @@ class ActiveUsersPager extends UsersPager { $out .= Xml::checkLabel( wfMsg('activeusers-hidesysops'), 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ) ) . '
'; - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n";# Submit button and form bottom + $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n";# Submit button and form bottom $out .= Xml::closeElement( 'fieldset' ); $out .= Xml::closeElement( 'form' ); - + return $out; } } @@ -157,7 +164,7 @@ class SpecialActiveUsers extends SpecialPage { /** * Constructor */ - public function __construct() { + public function __construct() { parent::__construct( 'Activeusers' ); } @@ -167,18 +174,19 @@ class SpecialActiveUsers extends SpecialPage { * @param $par Mixed: parameter passed to the page or null */ public function execute( $par ) { - global $wgOut, $wgLang, $wgRCMaxAge; + global $wgOut, $wgLang, $wgActiveUserDays; $this->setHeaders(); + $this->outputHeader(); $up = new ActiveUsersPager(); # getBody() first to check, if empty $usersbody = $up->getBody(); - $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), - wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( ceil( $wgRCMaxAge / 86400 ) ) ) - ); + $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), + wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) ) + ); $s .= $up->getPageHeader(); if( $usersbody ) { -- cgit v1.2.3-54-g00ecf