Follow up r49996, changing pathrev to revision on non-trunk preventing the 404 error.
[lhc/web/wiklou.git] / includes / specials / SpecialListusers.php
index b0a3df6..fb8005d 100644 (file)
@@ -74,7 +74,7 @@ class UsersPager extends AlphabeticPager {
                $dbr = wfGetDB( DB_SLAVE );
                $conds = array();
                // Don't show hidden names
-               $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
+               $conds[] = 'ipb_deleted IS NULL';
                if( $this->requestedGroup != '' ) {
                        $conds['ug_group'] = $this->requestedGroup;
                        $useIndex = '';
@@ -97,14 +97,15 @@ class UsersPager extends AlphabeticPager {
 
                $query = array(
                        'tables' => " $user $useIndex LEFT JOIN $user_groups ON user_id=ug_user
-                               LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_auto=0 ",
-                       'fields' => array('user_name',
-                               'MAX(user_id) AS user_id',
+                               LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_deleted=1 AND ipb_auto=0 ",
+                       'fields' => array(
+                               $this->creationSort ? 'MAX(user_name) AS user_name' : 'user_name',
+                               $this->creationSort ? 'user_id' : 'MAX(user_id) AS user_id',
                                'MAX(user_editcount) AS edits',
                                'COUNT(ug_group) AS numgroups',
                                'MAX(ug_group) AS singlegroup',
                                'MIN(user_registration) AS creation'),
-                       'options' => array('GROUP BY' => 'user_name'),
+                       'options' => array('GROUP BY' => $this->creationSort ? 'user_id' : 'user_name'),
                        'conds' => $conds
                );
 
@@ -122,7 +123,7 @@ class UsersPager extends AlphabeticPager {
                        $list = array();
                        foreach( self::getGroups( $row->user_id ) as $group )
                                $list[] = self::buildGroupLink( $group );
-                       $groups = implode( ', ', $list );
+                       $groups = $wgLang->commaList( $list );
                } elseif( $row->numgroups == 1 ) {
                        $groups = self::buildGroupLink( $row->singlegroup );
                } else {
@@ -170,10 +171,9 @@ class UsersPager extends AlphabeticPager {
                $self = $this->getTitle();
 
                # Form tag
-               $out  = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
-                       '<fieldset>' .
-                       Xml::element( 'legend', array(), wfMsg( 'listusers' ) );
-               $out .= Xml::hidden( 'title', $self->getPrefixedDbKey() );
+               $out  = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listusers-form' ) ) .
+                       Xml::fieldset( wfMsg( 'listusers' ) ) .
+                       Xml::hidden( 'title', $self->getPrefixedDbKey() );
 
                # Username field
                $out .= Xml::label( wfMsg( 'listusersfrom' ), 'offset' ) . ' ' .
@@ -197,17 +197,22 @@ class UsersPager extends AlphabeticPager {
                $out .= Xml::hidden( 'limit', $this->mLimit );
                $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
                wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) );
-               $out .= '</fieldset>' .
+               $out .= Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' );
 
                return $out;
        }
 
+       /**
+        * Get a list of all explicit groups
+        * @return array
+        */
        function getAllGroups() {
                $result = array();
                foreach( User::getAllGroups() as $group ) {
                        $result[$group] = User::getGroupName( $group );
                }
+               asort( $result );
                return $result;
        }