Moved some of the functionality from mediawiki.legacy.prefs into mediawiki.specials...
[lhc/web/wiklou.git] / includes / specials / SpecialActiveusers.php
index 95302c8..369e796 100644 (file)
@@ -1,37 +1,40 @@
 <?php
-# Copyright (C) 2008 Aaron Schulz
-#
-# http://www.mediawiki.org/
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# http://www.gnu.org/copyleft/gpl.html
+/**
+ * Implements Special:Activeusers
+ *
+ * Copyright © 2008 Aaron Schulz
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
+ */
 
 /**
  * This class is used to get a list of active users. The ones with specials
  * rights (sysop, bureaucrat, developer) will have them displayed
  * next to their names.
  *
- * @file
  * @ingroup SpecialPage
  */
 class ActiveUsersPager extends UsersPager {
 
        function __construct( $group = null ) {
-               global $wgRequest, $wgRCMaxAge;
-               $this->RCMaxAge = ceil( $wgRCMaxAge / ( 3600 * 24 ) ); // Constant
-
+               global $wgRequest, $wgActiveUserDays;
+               $this->RCMaxAge = $wgActiveUserDays;
                $un = $wgRequest->getText( 'username' );
                $this->requestedUser = '';
                if ( $un != '' ) {
@@ -72,6 +75,7 @@ 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 );
@@ -126,7 +130,7 @@ class ActiveUsersPager extends UsersPager {
        }
 
        function getPageHeader() {
-               global $wgScript, $wgRequest;
+               global $wgScript;
 
                $self = $this->getTitle();
                $limit = $this->mLimit ? Xml::hidden( 'limit', $this->mLimit ) : '';
@@ -167,7 +171,7 @@ 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();
@@ -177,9 +181,9 @@ class SpecialActiveUsers extends SpecialPage {
                # 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 ) {