Merge "Localize parentheses in Linker::formatTemplates()"
[lhc/web/wiklou.git] / includes / specials / SpecialListusers.php
index 923a18d..8b44828 100644 (file)
@@ -36,7 +36,9 @@ class UsersPager extends AlphabeticPager {
 
        /**
         * @param $context IContextSource
-        * @param $par null|array
+        * @param $par array (Default null)
+        * @param $including boolean Whether this page is being transcluded in
+        * another page
         */
        function __construct( IContextSource $context = null, $par = null, $including = null ) {
                if ( $context ) {
@@ -88,8 +90,8 @@ class UsersPager extends AlphabeticPager {
                $dbr = wfGetDB( DB_SLAVE );
                $conds = array();
                // Don't show hidden names
-               if( !$this->getUser()->isAllowed('hideuser') ) {
-                       $conds[] = 'ipb_deleted IS NULL';
+               if( !$this->getUser()->isAllowed( 'hideuser' ) ) {
+                       $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
                }
 
                $options = array();
@@ -116,18 +118,21 @@ class UsersPager extends AlphabeticPager {
                $query = array(
                        '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',
-                               'MAX(user_editcount) AS edits',
-                               'COUNT(ug_group) AS numgroups',
-                               'MAX(ug_group) AS singlegroup', // the usergroup if there is only one
-                               'MIN(user_registration) AS creation',
-                               'MAX(ipb_deleted) AS ipb_deleted' // block/hide status
+                               'user_name' => $this->creationSort ? 'MAX(user_name)' : 'user_name',
+                               'user_id' => $this->creationSort ? 'user_id' : 'MAX(user_id)',
+                               'edits' => 'MAX(user_editcount)',
+                               'numgroups' => 'COUNT(ug_group)',
+                               'singlegroup' => 'MAX(ug_group)', // the usergroup if there is only one
+                               'creation' => 'MIN(user_registration)',
+                               'ipb_deleted' => 'MAX(ipb_deleted)' // block/hide status
                        ),
                        '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' ),
+                               'ipblocks' => array( 'LEFT JOIN', array(
+                                       'user_id=ipb_user',
+                                       'ipb_auto' => 0
+                               )),
                        ),
                        'conds' => $conds
                );
@@ -181,9 +186,10 @@ class UsersPager extends AlphabeticPager {
                        $created = $this->msg( 'usercreated', $d, $t, $row->user_name )->escaped();
                        $created = ' ' . $this->msg( 'parentheses' )->rawParams( $created )->escaped();
                }
+               $blocked = !is_null( $row->ipb_deleted ) ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : '';
 
                wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
-               return "<li>{$item}{$edits}{$created}</li>";
+               return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}{$blocked}" );
        }
 
        function doBatchLookups() {
@@ -294,14 +300,13 @@ class UsersPager extends AlphabeticPager {
 /**
  * @ingroup SpecialPage
  */
-class SpecialListUsers extends SpecialPage {
+class SpecialListUsers extends IncludableSpecialPage {
 
        /**
         * Constructor
         */
        public function __construct() {
                parent::__construct( 'Listusers' );
-               $this->mIncludable = true;
        }
 
        /**