* replace hard coded namespace numbers by the php define
[lhc/web/wiklou.git] / includes / specials / SpecialListusers.php
index 8895c14..eafc054 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,9 +97,10 @@ 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',
@@ -116,13 +117,13 @@ class UsersPager extends AlphabeticPager {
                global $wgLang;
 
                $userPage = Title::makeTitle( NS_USER, $row->user_name );
-               $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
+               $name = $this->getSkin()->link( $userPage, htmlspecialchars( $userPage->getText() ) );
 
                if( $row->numgroups > 1 || ( $this->requestedGroup && $row->numgroups == 1 ) ) {
                        $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;
        }