Merge "Add CollationFa"
[lhc/web/wiklou.git] / includes / specials / SpecialActiveusers.php
index 531c330..a01e9b2 100644 (file)
@@ -52,6 +52,10 @@ class SpecialActiveUsers extends SpecialPage {
 
                $opts->add( 'username', '' );
                $opts->add( 'groups', [] );
+               $opts->add( 'excludegroups', [] );
+               // Backwards-compatibility with old URLs
+               $opts->add( 'hidebots', false, FormOptions::BOOL );
+               $opts->add( 'hidesysops', false, FormOptions::BOOL );
 
                $opts->fetchValuesFromRequest( $this->getRequest() );
 
@@ -82,17 +86,26 @@ class SpecialActiveUsers extends SpecialPage {
                $groups = User::getAllGroups();
 
                foreach ( $groups as $group ) {
-                       $msg = User::getGroupName( $group );
+                       $msg = htmlspecialchars( User::getGroupName( $group ) );
                        $options[$msg] = $group;
                }
 
+               // Backwards-compatibility with old URLs
+               $req = $this->getRequest();
+               $excludeDefault = [];
+               if ( $req->getCheck( 'hidebots' ) ) {
+                       $excludeDefault[] = 'bot';
+               }
+               if ( $req->getCheck( 'hidesysops' ) ) {
+                       $excludeDefault[] = 'sysop';
+               }
+
                $formDescriptor = [
                        'username' => [
                                'type' => 'user',
                                'name' => 'username',
                                'label-message' => 'activeusers-from',
                        ],
-
                        'groups' => [
                                'type' => 'multiselect',
                                'dropdown' => true,
@@ -101,6 +114,15 @@ class SpecialActiveUsers extends SpecialPage {
                                'label-message' => 'activeusers-groups',
                                'options' => $options,
                        ],
+                       'excludegroups' => [
+                               'type' => 'multiselect',
+                               'dropdown' => true,
+                               'flatlist' => true,
+                               'name' => 'excludegroups',
+                               'label-message' => 'activeusers-excludegroups',
+                               'options' => $options,
+                               'default' => $excludeDefault,
+                       ],
                ];
 
                HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )