X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FSpecialListusers.php;h=460d4259cd8321dff78a662a20706c05bbeebffb;hb=839f3ffd651465380923a5110dc834c23fd9c27f;hp=3794c851d836d36433ec3ce5b34bf7ce5fbe972b;hpb=91244b206bb06455fc18f0af35ee71ae1bab6f9f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SpecialListusers.php b/includes/SpecialListusers.php index 3794c851d8..460d4259cd 100644 --- a/includes/SpecialListusers.php +++ b/includes/SpecialListusers.php @@ -1,190 +1,217 @@ +# # http://www.mediawiki.org/ -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # http://www.gnu.org/copyleft/gpl.html /** * - * @package MediaWiki - * @subpackage SpecialPage - */ - -/** - * + * @addtogroup SpecialPage */ -require_once('QueryPage.php'); /** * This class is used to get a list of user. The ones with specials * rights (sysop, bureaucrat, developer) will have them displayed * next to their names. * - * @package MediaWiki - * @subpackage SpecialPage + * @addtogroup SpecialPage */ -class ListUsersPage extends QueryPage { - var $requestedGroup = ''; - var $requestedUser = ''; - var $previousResult = null; - var $concatGroups = ''; - - function getName() { - return 'Listusers'; + +class UsersPager extends AlphabeticPager { + + function __construct($group=null) { + global $wgRequest; + $this->requestedGroup = $group != "" ? $group : $wgRequest->getVal( 'group' ); + $un = $wgRequest->getText( 'username' ); + $this->requestedUser = ''; + if ( $un != '' ) { + $username = Title::makeTitleSafe( NS_USER, $un ); + if( ! is_null( $username ) ) { + $this->requestedUser = $username->getText(); + } + } + parent::__construct(); } - function isSyndicated() { return false; } - /** - * Show a drop down list to select a group as well as a user name - * search box. - * @todo localize - */ - function getPageHeader( ) { - global $wgScript; - - // Various variables used for the form - $action = htmlspecialchars( $wgScript ); - $title = Title::makeTitle( NS_SPECIAL, 'Listusers' ); - $special = htmlspecialchars( $title->getPrefixedDBkey() ); - - // form header - $out = '
'; - // congratulations the form is now build - return $out; } - - function getSQL() { - $dbr =& wfGetDB( DB_SLAVE ); - /* system showing possible actions for users - $user = $dbr->tableName( 'user' ); - $user_rights = $dbr->tableName( 'user_rights' ); - $userspace = Namespace::getUser(); - return "SELECT ur_rights as type, $userspace as namespace, user_name as title, " . - "user_name as value FROM $user LEFT JOIN $user_rights ON user_id = ur_user"; - */ - /** Show groups instead */ - $user = $dbr->tableName( 'user' ); - $group = $dbr->tableName( 'group' ); - $user_groups = $dbr->tableName( 'user_groups' ); - - $userspace = NS_USER; - $sql = "SELECT group_name as type, $userspace AS namespace, user_name AS title, user_name as value " . - "FROM $user ". - "LEFT JOIN $user_groups ON user_id =ug_user " . - "LEFT JOIN $group ON ug_group = group_id "; - - if($this->requestedGroup != '') { - $sql .= "WHERE group_id= '" . IntVal( $this->requestedGroup ) . "' "; - if($this->requestedUser != '') { - $sql .= "AND user_name = " . $dbr->addQuotes( $this->requestedUser ) . ' '; - } + + 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 ) + $list[] = self::buildGroupLink( $group ); + $groups = implode( ', ', $list ); + } elseif( $row->numgroups == 1 ) { + $groups = self::buildGroupLink( $row->singlegroup ); } else { - if($this->requestedUser !='') { - $sql .= "WHERE user_name = " . $dbr->addQuotes( $this->requestedUser ) . ' '; - } - } - - return $sql; - } - - /** - * When calling formatResult we output the previous result instead of the - * current one. We need an additional step to flush out the last result. - */ - function tryLastResult( ) { - return true; + $groups = ''; + } + + return '' . wfMsgHTML('listusers-noresult') . '
'; + }; + + $wgOut->addHTML( $s ); } -?> +