summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialListusers.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialListusers.php')
-rw-r--r--includes/specials/SpecialListusers.php86
1 files changed, 56 insertions, 30 deletions
diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php
index abc0363a..0531444a 100644
--- a/includes/specials/SpecialListusers.php
+++ b/includes/specials/SpecialListusers.php
@@ -41,7 +41,7 @@ class UsersPager extends AlphabeticPager {
if ( $parms[0] != '' && ( in_array( $par, User::getAllGroups() ) || in_array( $par, $symsForAll ) ) ) {
$this->requestedGroup = $par;
$un = $wgRequest->getText( 'username' );
- } else if ( count( $parms ) == 2 ) {
+ } elseif ( count( $parms ) == 2 ) {
$this->requestedGroup = $parms[0];
$un = $parms[1];
} else {
@@ -64,6 +64,9 @@ class UsersPager extends AlphabeticPager {
parent::__construct();
}
+ function getTitle() {
+ return SpecialPage::getTitleFor( 'Listusers' );
+ }
function getIndexField() {
return $this->creationSort ? 'user_id' : 'user_name';
@@ -74,13 +77,16 @@ class UsersPager extends AlphabeticPager {
$dbr = wfGetDB( DB_SLAVE );
$conds = array();
// Don't show hidden names
- if( !$wgUser->isAllowed('hideuser') )
+ if( !$wgUser->isAllowed('hideuser') ) {
$conds[] = 'ipb_deleted IS NULL';
+ }
+
+ $options = array();
+
if( $this->requestedGroup != '' ) {
$conds['ug_group'] = $this->requestedGroup;
- $useIndex = '';
} else {
- $useIndex = $dbr->useIndexClause( $this->creationSort ? 'PRIMARY' : 'user_name');
+ //$options['USE INDEX'] = $this->creationSort ? 'PRIMARY' : 'user_name';
}
if( $this->requestedUser != '' ) {
# Sorted either by account creation or name
@@ -94,11 +100,10 @@ class UsersPager extends AlphabeticPager {
$conds[] = 'user_editcount > 0';
}
- list ($user,$user_groups,$ipblocks) = $dbr->tableNamesN('user','user_groups','ipblocks');
+ $options['GROUP BY'] = $this->creationSort ? 'user_id' : 'user_name';
$query = array(
- 'tables' => " $user $useIndex LEFT JOIN $user_groups ON user_id=ug_user
- LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_deleted=1 AND ipb_auto=0 ",
+ 'tables' => array( 'user', 'user_groups', 'ipblocks'),
'fields' => array(
$this->creationSort ? 'MAX(user_name) AS user_name' : 'user_name',
$this->creationSort ? 'user_id' : 'MAX(user_id) AS user_id',
@@ -108,7 +113,11 @@ class UsersPager extends AlphabeticPager {
'MIN(user_registration) AS creation',
'MAX(ipb_deleted) AS ipb_deleted' // block/hide status
),
- 'options' => array('GROUP BY' => $this->creationSort ? 'user_id' : 'user_name'),
+ 'options' => $options,
+ 'join_conds' => array(
+ 'user_groups' => array( 'LEFT JOIN', 'user_id=ug_user' ),
+ 'ipblocks' => array( 'LEFT JOIN', 'user_id=ipb_user AND ipb_deleted=1 AND ipb_auto=0' ),
+ ),
'conds' => $conds
);
@@ -123,7 +132,7 @@ class UsersPager extends AlphabeticPager {
return '';
$userPage = Title::makeTitle( NS_USER, $row->user_name );
- $name = $this->getSkin()->link( $userPage, htmlspecialchars( $userPage->getText() ) );
+ $name = Linker::link( $userPage, htmlspecialchars( $userPage->getText() ) );
$groups_list = self::getGroups( $row->user_id );
if( count( $groups_list ) > 0 ) {
@@ -247,7 +256,7 @@ class UsersPager extends AlphabeticPager {
*/
protected static function getGroups( $uid ) {
$user = User::newFromId( $uid );
- $groups = array_diff( $user->getEffectiveGroups(), $user->getImplicitGroups() );
+ $groups = array_diff( $user->getEffectiveGroups(), User::getImplicitGroups() );
return $groups;
}
@@ -266,25 +275,42 @@ class UsersPager extends AlphabeticPager {
}
/**
- * constructor
- * $par string (optional) A group to list users from
+ * @ingroup SpecialPage
*/
-function wfSpecialListusers( $par = null ) {
- global $wgOut;
-
- $up = new UsersPager($par);
-
- # getBody() first to check, if empty
- $usersbody = $up->getBody();
- $s = Xml::openElement( 'div', array('class' => 'mw-spcontent') );
- $s .= $up->getPageHeader();
- if( $usersbody ) {
- $s .= $up->getNavigationBar();
- $s .= '<ul>' . $usersbody . '</ul>';
- $s .= $up->getNavigationBar() ;
- } else {
- $s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
- };
- $s .= Xml::closeElement( 'div' );
- $wgOut->addHTML( $s );
+class SpecialListUsers extends SpecialPage {
+
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ parent::__construct( 'Listusers' );
+ }
+
+ /**
+ * Show the special page
+ *
+ * @param $par string (optional) A group to list users from
+ */
+ public function execute( $par ) {
+ global $wgOut;
+
+ $this->setHeaders();
+ $this->outputHeader();
+
+ $up = new UsersPager( $par );
+
+ # getBody() first to check, if empty
+ $usersbody = $up->getBody();
+
+ $s = $up->getPageHeader();
+ if( $usersbody ) {
+ $s .= $up->getNavigationBar();
+ $s .= Html::rawElement( 'ul', array(), $usersbody );
+ $s .= $up->getNavigationBar();
+ } else {
+ $s .= wfMessage( 'listusers-noresult' )->parseAsBlock();
+ }
+
+ $wgOut->addHTML( $s );
+ }
}