X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUnblock.php;h=56b6cc3ee0efe36e1c4b5ddffa43dc4756075ee0;hp=4e683f6e782ed7780086a928cc5e48bc2c83824b;hb=31495b9e60e01438f5906cb24d484599e4930e66;hpb=299b7b412731f60866885c0532558c349ba3da76 diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index 4e683f6e78..56b6cc3ee0 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -57,9 +57,9 @@ class SpecialUnblock extends SpecialPage { $out = $this->getOutput(); $out->setPageTitle( $this->msg( 'unblockip' ) ); - $out->addModules( [ 'mediawiki.special', 'mediawiki.userSuggest' ] ); + $out->addModules( [ 'mediawiki.special' ] ); - $form = new HTMLForm( $this->getFields(), $this->getContext() ); + $form = HTMLForm::factory( 'ooui', $this->getFields(), $this->getContext() ); $form->setWrapperLegendMsg( 'unblockip' ); $form->setSubmitCallback( [ __CLASS__, 'processUIUnblock' ] ); $form->setSubmitTextMsg( 'ipusubmit' ); @@ -87,12 +87,12 @@ class SpecialUnblock extends SpecialPage { protected function getFields() { $fields = [ 'Target' => [ - 'type' => 'text', + 'type' => 'user', 'label-message' => 'ipaddressorusername', 'autofocus' => true, 'size' => '45', 'required' => true, - 'cssclass' => 'mw-autocomplete-user', // used by mediawiki.userSuggest + 'ipallowed' => true, ], 'Name' => [ 'type' => 'info', @@ -186,7 +186,7 @@ class SpecialUnblock extends SpecialPage { return [ [ 'ipb_cant_unblock', $target ] ]; } - # bug 15810: blocked admins should have limited access here. This + # T17810: blocked admins should have limited access here. This # won't allow sysops to remove autoblocks on themselves, but they # should have ipblock-exempt anyway $status = SpecialBlock::checkUnblockSelf( $target, $performer ); @@ -209,11 +209,18 @@ class SpecialUnblock extends SpecialPage { return [ 'unblock-hideuser' ]; } + $reason = [ 'hookaborted' ]; + if ( !Hooks::run( 'UnblockUser', [ &$block, &$performer, &$reason ] ) ) { + return $reason; + } + # Delete block if ( !$block->delete() ) { return [ [ 'ipb_cant_unblock', htmlspecialchars( $block->getTarget() ) ] ]; } + Hooks::run( 'UnblockUserComplete', [ $block, $performer ] ); + # Unset _deleted fields as needed if ( $block->mHideName ) { # Something is deeply FUBAR if this is not a User object, but who knows?