SpecialListUsers.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * Implements Special:Listusers
  4. *
  5. * Copyright © 2004 Brion Vibber, lcrocker, Tim Starling,
  6. * Domas Mituzas, Antoine Musso, Jens Frank, Zhengzhu,
  7. * 2006 Rob Church <robchur@gmail.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  22. * http://www.gnu.org/copyleft/gpl.html
  23. *
  24. * @file
  25. * @ingroup SpecialPage
  26. */
  27. /**
  28. * @ingroup SpecialPage
  29. */
  30. class SpecialListUsers extends IncludableSpecialPage {
  31. public function __construct() {
  32. parent::__construct( 'Listusers' );
  33. }
  34. /**
  35. * @param string|null $par (optional) A group to list users from
  36. */
  37. public function execute( $par ) {
  38. $this->setHeaders();
  39. $this->outputHeader();
  40. $up = new UsersPager( $this->getContext(), $par, $this->including() );
  41. # getBody() first to check, if empty
  42. $usersbody = $up->getBody();
  43. $s = '';
  44. if ( !$this->including() ) {
  45. $s = $up->getPageHeader();
  46. }
  47. if ( $usersbody ) {
  48. $s .= $up->getNavigationBar();
  49. $s .= Html::rawElement( 'ul', [], $usersbody );
  50. $s .= $up->getNavigationBar();
  51. } else {
  52. $s .= $this->msg( 'listusers-noresult' )->parseAsBlock();
  53. }
  54. $out = $this->getOutput();
  55. $out->addHTML( $s );
  56. $out->addModuleStyles( 'mediawiki.interface.helpers.styles' );
  57. }
  58. /**
  59. * Return an array of subpages that this special page will accept.
  60. *
  61. * @return string[] subpages
  62. */
  63. public function getSubpagesForPrefixSearch() {
  64. return User::getAllGroups();
  65. }
  66. protected function getGroupName() {
  67. return 'users';
  68. }
  69. }