summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialListusers.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialListusers.php')
-rw-r--r--includes/specials/SpecialListusers.php68
1 files changed, 46 insertions, 22 deletions
diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php
index 7dba44e2..17bec70e 100644
--- a/includes/specials/SpecialListusers.php
+++ b/includes/specials/SpecialListusers.php
@@ -35,10 +35,25 @@
*/
class UsersPager extends AlphabeticPager {
- function __construct($group=null) {
+ function __construct( $par=null ) {
global $wgRequest;
- $this->requestedGroup = $group != "" ? $group : $wgRequest->getVal( 'group' );
- $un = $wgRequest->getText( 'username' );
+ $parms = explode( '/', ($par = ( $par !== null ) ? $par : '' ) );
+ $symsForAll = array( '*', 'user' );
+ if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) {
+ $this->requestedGroup = $par;
+ $un = $wgRequest->getText( 'username' );
+ } else if ( count( $parms ) == 2 ) {
+ $this->requestedGroup = $parms[0];
+ $un = $parms[1];
+ } else {
+ $this->requestedGroup = $wgRequest->getVal( 'group' );
+ $un = ( $par != '' ) ? $par : $wgRequest->getText( 'username' );
+ }
+ if ( in_array( $this->requestedGroup, $symsForAll ) ) {
+ $this->requestedGroup = '';
+ }
+ $this->editsOnly = $wgRequest->getBool( 'editsOnly' );
+
$this->requestedUser = '';
if ( $un != '' ) {
$username = Title::makeTitleSafe( NS_USER, $un );
@@ -56,9 +71,9 @@ class UsersPager extends AlphabeticPager {
function getQueryInfo() {
$dbr = wfGetDB( DB_SLAVE );
- $conds=array();
- // don't show hidden names
- $conds[]='ipb_deleted IS NULL OR ipb_deleted = 0';
+ $conds = array();
+ // Don't show hidden names
+ $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
if ($this->requestedGroup != "") {
$conds['ug_group'] = $this->requestedGroup;
$useIndex = '';
@@ -68,6 +83,9 @@ class UsersPager extends AlphabeticPager {
if ($this->requestedUser != "") {
$conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser );
}
+ if( $this->editsOnly ) {
+ $conds[] = 'user_editcount > 0';
+ }
list ($user,$user_groups,$ipblocks) = $dbr->tableNamesN('user','user_groups','ipblocks');
@@ -76,6 +94,7 @@ class UsersPager extends AlphabeticPager {
LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_auto=0 ",
'fields' => array('user_name',
'MAX(user_id) AS user_id',
+ 'MAX(user_editcount) AS edits',
'COUNT(ug_group) AS numgroups',
'MAX(ug_group) AS singlegroup'),
'options' => array('GROUP BY' => 'user_name'),
@@ -87,6 +106,8 @@ class UsersPager extends AlphabeticPager {
}
function formatRow( $row ) {
+ global $wgLang;
+
$userPage = Title::makeTitle( NS_USER, $row->user_name );
$name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
@@ -102,18 +123,24 @@ class UsersPager extends AlphabeticPager {
}
$item = wfSpecialList( $name, $groups );
+
+ global $wgEdititis;
+ if ( $wgEdititis ) {
+ $editCount = $wgLang->formatNum( $row->edits );
+ $edits = ' [' . wfMsgExt( 'usereditcount', 'parsemag', $editCount ) . ']';
+ } else {
+ $edits = '';
+ }
wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
- return "<li>{$item}</li>";
+ return "<li>{$item}{$edits}</li>";
}
function getBody() {
- if (!$this->mQueryDone) {
+ if( !$this->mQueryDone ) {
$this->doQuery();
}
- $batch = new LinkBatch;
-
$this->mResult->rewind();
-
+ $batch = new LinkBatch;
while ( $row = $this->mResult->fetchObject() ) {
$batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
}
@@ -142,7 +169,9 @@ class UsersPager extends AlphabeticPager {
Xml::option( wfMsg( 'group-all' ), '' );
foreach( $this->getAllGroups() as $group => $groupText )
$out .= Xml::option( $groupText, $group, $group == $this->requestedGroup );
- $out .= Xml::closeElement( 'select' ) . ' ';
+ $out .= Xml::closeElement( 'select' ) . '<br/>';
+ $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly );
+ $out .= '&nbsp;';
wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
@@ -186,14 +215,8 @@ class UsersPager extends AlphabeticPager {
* @return array
*/
protected static function getGroups( $uid ) {
- $dbr = wfGetDB( DB_SLAVE );
- $groups = array();
- $res = $dbr->select( 'user_groups', 'ug_group', array( 'ug_user' => $uid ), __METHOD__ );
- if( $res && $dbr->numRows( $res ) > 0 ) {
- while( $row = $dbr->fetchObject( $res ) )
- $groups[] = $row->ug_group;
- $dbr->freeResult( $res );
- }
+ $user = User::newFromId( $uid );
+ $groups = array_diff( $user->getEffectiveGroups(), $user->getImplicitGroups() );
return $groups;
}
@@ -222,7 +245,8 @@ function wfSpecialListusers( $par = null ) {
# getBody() first to check, if empty
$usersbody = $up->getBody();
- $s = $up->getPageHeader();
+ $s = XML::openElement( 'div', array('class' => 'mw-spcontent') );
+ $s .= $up->getPageHeader();
if( $usersbody ) {
$s .= $up->getNavigationBar();
$s .= '<ul>' . $usersbody . '</ul>';
@@ -230,6 +254,6 @@ function wfSpecialListusers( $par = null ) {
} else {
$s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
};
-
+ $s .= XML::closeElement( 'div' );
$wgOut->addHTML( $s );
}