* Add wfReadOnlyReason() to supply the reason for the wiki being read only. Use it...
[lhc/web/wiklou.git] / includes / SpecialListusers.php
index 39ac000..460d425 100644 (file)
@@ -76,14 +76,14 @@ class UsersPager extends AlphabeticPager {
                                'MAX(ug_group) AS singlegroup'),
                        'options' => array('GROUP BY' => 'user_name'), 
                        'conds' => $conds
-               );      
-               
+               );
+
        }
 
        function formatRow( $row ) {
                $userPage = Title::makeTitle( NS_USER, $row->user_name );
                $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
-               
+
                if( $row->numgroups > 1 || ( $this->requestedGroup && $row->numgroups == 1 ) ) {
                        $list = array();
                        foreach( self::getGroups( $row->user_id ) as $group )
@@ -94,7 +94,7 @@ class UsersPager extends AlphabeticPager {
                } else {
                        $groups = '';
                }
-               
+
                return '<li>' . wfSpecialList( $name, $groups ) . '</li>';
        }
 
@@ -103,7 +103,6 @@ class UsersPager extends AlphabeticPager {
                        $this->doQuery();
                }
                $batch = new LinkBatch;
-               $db = $this->mDb;
 
                $this->mResult->rewind();
 
@@ -116,35 +115,30 @@ class UsersPager extends AlphabeticPager {
        }
 
        function getPageHeader( ) {
-               global $wgRequest;
+               global $wgScript, $wgRequest;
                $self = $this->getTitle();
 
                # Form tag
-               $out  = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $self->getLocalUrl() ) ) .
+               $out  = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
                        '<fieldset>' .
                        Xml::element( 'legend', array(), wfMsg( 'listusers' ) );
+               $out .= Xml::hidden( 'title', $self->getPrefixedDbKey() );
 
                # Username field
                $out .= Xml::label( wfMsg( 'listusersfrom' ), 'offset' ) . ' ' .
                        Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' ';
 
-               if( $this->mLimit )
-                       $out .= Xml::hidden( 'limit', $this->mLimit );
-
                # Group drop-down list
                $out .= Xml::label( wfMsg( 'group' ), 'group' ) . ' ' .
                        Xml::openElement('select',  array( 'name' => 'group', 'id' => 'group' ) ) .
-                       Xml::option( wfMsg( 'group-all' ), '' );  # Item for "all groups"
-
-               $groups = User::getAllGroups();
-               foreach( $groups as $group ) {
-                       $attribs = array( 'value' => $group );
-                       $attribs['selected'] = ( $group == $this->requestedGroup ) ? 'selected' : '';
-                       $out .= Xml::option( User::getGroupName( $group ), $attribs['value'], $attribs['selected'] );
-               }
+                       Xml::option( wfMsg( 'group-all' ), '' );
+               foreach( User::getAllGroups() as $group )
+                       $out .= Xml::option( User::getGroupName( $group ), $group, $group == $this->requestedGroup );
                $out .= Xml::closeElement( 'select' ) . ' ';
 
                # Submit button and form bottom
+               if( $this->mLimit )
+                       $out .= Xml::hidden( 'limit', $this->mLimit );
                $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
                        '</fieldset>' .
                        Xml::closeElement( 'form' );
@@ -164,7 +158,7 @@ class UsersPager extends AlphabeticPager {
                        $query['username'] = $this->requestedUser;
                return $query;
        }
-       
+
        /**
         * Get a list of groups the specified user belongs to
         *
@@ -181,8 +175,8 @@ class UsersPager extends AlphabeticPager {
                        $dbr->freeResult( $res );
                }
                return $groups;
-       }       
-       
+       }
+
        /**
         * Format a link to a group description page
         *
@@ -195,7 +189,6 @@ class UsersPager extends AlphabeticPager {
                        $cache[$group] = User::makeGroupLinkHtml( $group, User::getGroupMember( $group ) );
                return $cache[$group];
        }
-       
 }
 
 /**
@@ -205,10 +198,6 @@ class UsersPager extends AlphabeticPager {
 function wfSpecialListusers( $par = null ) {
        global $wgRequest, $wgOut;
 
-       list( $limit, $offset ) = wfCheckLimits();
-
-       $groupTarget = isset($par) ? $par : $wgRequest->getVal( 'group' );
-
        $up = new UsersPager($par);
 
        # getBody() first to check, if empty
@@ -221,7 +210,8 @@ function wfSpecialListusers( $par = null ) {
        } else {
                $s .=   '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
        };
-        $wgOut->addHTML( $s );
+
+       $wgOut->addHTML( $s );
 }
 
-?>
+