--- /dev/null
+<?php\r
+\r
+# Copyright (C) 2008 Aaron Schulz\r
+#\r
+# http://www.mediawiki.org/\r
+#\r
+# This program is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU General Public License along\r
+# with this program; if not, write to the Free Software Foundation, Inc.,\r
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
+# http://www.gnu.org/copyleft/gpl.html\r
+/**\r
+ *\r
+ * @addtogroup SpecialPage\r
+ */\r
+\r
+/**\r
+ * This class is used to get a list of user. The ones with specials\r
+ * rights (sysop, bureaucrat, developer) will have them displayed\r
+ * next to their names.\r
+ *\r
+ * @addtogroup SpecialPage\r
+ */\r
+\r
+class ActiveUsersPager extends UsersPager {\r
+\r
+ function __construct($group=null) {\r
+ global $wgRequest;\r
+ $un = $wgRequest->getText( 'username' );\r
+ $this->requestedUser = '';\r
+ if ( $un != '' ) {\r
+ $username = Title::makeTitleSafe( NS_USER, $un );\r
+ if( ! is_null( $username ) ) {\r
+ $this->requestedUser = $username->getText();\r
+ }\r
+ }\r
+ parent::__construct();\r
+ }\r
+\r
+\r
+ function getIndexField() {\r
+ return 'rc_user_text';\r
+ }\r
+\r
+ function getQueryInfo() {\r
+ $dbr = wfGetDB( DB_SLAVE );\r
+ $conds = array();\r
+ // don't show hidden names\r
+ $conds[] = 'ipb_deleted IS NULL';\r
+ $useIndex = $dbr->useIndexClause('rc_user_text');\r
+ if( $this->requestedUser != "" ) {\r
+ $conds[] = 'rc_user_text >= ' . $dbr->addQuotes( $this->requestedUser );\r
+ }\r
+ $conds[] = 'rc_user > 0'; // Users - no anons\r
+\r
+ list ($recentchanges,$ipblocks) = $dbr->tableNamesN('recentchanges','ipblocks');\r
+\r
+ $query = array(\r
+ 'tables' => " $recentchanges $useIndex \r
+ LEFT JOIN $ipblocks ON rc_user=ipb_user AND ipb_auto=0 AND ipb_deleted=1 ",\r
+ 'fields' => array('rc_user_text AS user_name', // inheritance\r
+ 'rc_user_text', // for Pager\r
+ 'MAX(rc_user) AS user_id',\r
+ 'COUNT(*) AS recentedits',\r
+ 'MAX(ipb_user) AS blocked'),\r
+ 'options' => array('GROUP BY' => 'user_name'),\r
+ 'conds' => $conds\r
+ );\r
+ return $query;\r
+ }\r
+\r
+ function formatRow( $row ) {\r
+ $userPage = Title::makeTitle( NS_USER, $row->rc_user_text );\r
+ $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );\r
+\r
+ $list = array();\r
+ foreach( self::getGroups( $row->user_id ) as $group )\r
+ $list[] = self::buildGroupLink( $group );\r
+ $groups = implode( ', ', $list );\r
+\r
+ $item = wfSpecialList( $name, $groups );\r
+ $count = wfMsgExt( 'activeusers-count', array('parsemag'), $row->recentedits );\r
+ $blocked = $row->blocked ? ' '.wfMsg('listusers-blocked') : '';\r
+\r
+ return "<li>{$item} [{$count}]{$blocked}</li>";\r
+ }\r
+\r
+ function getPageHeader() {\r
+ global $wgScript, $wgRequest;\r
+ $self = $this->getTitle();\r
+\r
+ # Form tag\r
+ $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .\r
+ '<fieldset>' .\r
+ Xml::element( 'legend', array(), wfMsg( 'activeusers' ) );\r
+ $out .= Xml::hidden( 'title', $self->getPrefixedDbKey() );\r
+\r
+ # Username field\r
+ $out .= Xml::label( wfMsg( 'activeusers-from' ), 'offset' ) . ' ' .\r
+ Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' ';\r
+\r
+ # Submit button and form bottom\r
+ if( $this->mLimit )\r
+ $out .= Xml::hidden( 'limit', $this->mLimit );\r
+ $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );\r
+\r
+ $out .= '</fieldset>' . Xml::closeElement( 'form' );\r
+\r
+ return $out;\r
+ }\r
+}\r
+\r
+/**\r
+ * constructor\r
+ * $par string (optional) A group to list users from\r
+ */\r
+function wfSpecialActiveusers( $par = null ) {\r
+ global $wgRequest, $wgOut;\r
+\r
+ $up = new ActiveUsersPager();\r
+\r
+ # getBody() first to check, if empty\r
+ $usersbody = $up->getBody();\r
+ $s = $up->getPageHeader();\r
+ if( $usersbody ) {\r
+ $s .= $up->getNavigationBar();\r
+ $s .= '<ul>' . $usersbody . '</ul>';\r
+ $s .= $up->getNavigationBar() ;\r
+ } else {\r
+ $s .= '<p>' . wfMsgHTML('activeusers-noresult') . '</p>';\r
+ };\r
+\r
+ $wgOut->addHTML( $s );\r
+}\r
'listusers-creationsort' => 'Sort by creation date',
'usereditcount' => '$1 {{PLURAL:$1|edit|edits}}',
'usercreated' => 'Created on $1 at $2',
+'activeusers' => 'Active user list',
+'activeusers-count' => '$1 recent {{PLURAL:$1|edit|edits}}',
'newpages' => 'New pages',
'newpages-summary' => '', # do not translate or duplicate this message to other languages
'newpages-username' => 'Username:',
'listusersfrom' => 'Display users starting at:',
'listusers-submit' => 'Show',
'listusers-noresult' => 'No user found.',
+'listusers-blocked' => '(blocked)',
+
+# Special:ActiveUsers
+'activeusers-from' => 'Display users starting at:',
+'activeusers-noresult' => 'No user found.',
# Special:Log/newusers
'newuserlogpage' => 'User creation log',