From 50e300f4870fee3f0e0550a8fe17ed7328b3c543 Mon Sep 17 00:00:00 2001 From: Fran Rogers Date: Wed, 13 Aug 2008 02:37:34 +0000 Subject: [PATCH] Per bug 15146, allow additional syntax for Special:Listusers URLs. - 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 | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 7dba44e23a..6cc29db4bc 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -35,10 +35,24 @@ */ 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 ); -- 2.20.1