Per bug 15146, allow additional syntax for Special:Listusers URLs.
authorFran Rogers <krimpet@users.mediawiki.org>
Wed, 13 Aug 2008 02:37:34 +0000 (02:37 +0000)
committerFran Rogers <krimpet@users.mediawiki.org>
Wed, 13 Aug 2008 02:37:34 +0000 (02:37 +0000)
- Special:ListUsers/GROUP - if GROUP is a valid group name; the old syntax
- Special:ListUsers/USER
- Special:ListUsers/GROUP/USER

'*' and 'user' can be used as a GROUP for all users.

includes/specials/SpecialListusers.php

index 7dba44e..6cc29db 100644 (file)
  */
 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->requestedUser = '';
                if ( $un != '' ) {
                        $username = Title::makeTitleSafe( NS_USER, $un );