diff options
Diffstat (limited to 'includes/specials/SpecialUnblock.php')
-rw-r--r-- | includes/specials/SpecialUnblock.php | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index fb2005b5..ca93b6d1 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -32,11 +32,11 @@ class SpecialUnblock extends SpecialPage { protected $type; protected $block; - public function __construct(){ + public function __construct() { parent::__construct( 'Unblock', 'block' ); } - public function execute( $par ){ + public function execute( $par ) { $this->checkPermissions(); $this->checkReadOnly(); @@ -56,8 +56,8 @@ class SpecialUnblock extends SpecialPage { $form->setSubmitTextMsg( 'ipusubmit' ); $form->addPreText( $this->msg( 'unblockiptext' )->parseAsBlock() ); - if( $form->show() ){ - switch( $this->type ){ + if ( $form->show() ) { + switch ( $this->type ) { case Block::TYPE_USER: case Block::TYPE_IP: $out->addWikiMsg( 'unblocked', wfEscapeWikiText( $this->target ) ); @@ -73,7 +73,7 @@ class SpecialUnblock extends SpecialPage { } } - protected function getFields(){ + protected function getFields() { $fields = array( 'Target' => array( 'type' => 'text', @@ -92,21 +92,21 @@ class SpecialUnblock extends SpecialPage { ) ); - if( $this->block instanceof Block ){ + if ( $this->block instanceof Block ) { list( $target, $type ) = $this->block->getTargetAndType(); # Autoblocks are logged as "autoblock #123 because the IP was recently used by # User:Foo, and we've just got any block, auto or not, that applies to a target # the user has specified. Someone could be fishing to connect IPs to autoblocks, # so don't show any distinction between unblocked IPs and autoblocked IPs - if( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ){ + if ( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ) { $fields['Target']['default'] = $this->target; unset( $fields['Name'] ); } else { $fields['Target']['default'] = $target; $fields['Target']['type'] = 'hidden'; - switch( $type ){ + switch ( $type ) { case Block::TYPE_USER: case Block::TYPE_IP: $fields['Name']['default'] = Linker::link( @@ -138,6 +138,8 @@ class SpecialUnblock extends SpecialPage { /** * Submit callback for an HTMLForm object + * @param array $data + * @param HTMLForm $form * @return Array( Array(message key, parameters) */ public static function processUIUnblock( array $data, HTMLForm $form ) { @@ -149,14 +151,15 @@ class SpecialUnblock extends SpecialPage { * * @param $data Array * @param $context IContextSource + * @throws ErrorPageError * @return Array( Array(message key, parameters) ) on failure, True on success */ - public static function processUnblock( array $data, IContextSource $context ){ + public static function processUnblock( array $data, IContextSource $context ) { $performer = $context->getUser(); $target = $data['Target']; $block = Block::newFromTarget( $data['Target'] ); - if( !$block instanceof Block ){ + if ( !$block instanceof Block ) { return array( array( 'ipb_cant_unblock', $target ) ); } @@ -171,14 +174,14 @@ class SpecialUnblock extends SpecialPage { # If the specified IP is a single address, and the block is a range block, don't # unblock the whole range. list( $target, $type ) = SpecialBlock::getTargetAndType( $target ); - if( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) { - $range = $block->getTarget(); - return array( array( 'ipb_blocked_as_range', $target, $range ) ); + if ( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) { + $range = $block->getTarget(); + return array( array( 'ipb_blocked_as_range', $target, $range ) ); } # If the name was hidden and the blocking user cannot hide # names, then don't allow any block removals... - if( !$performer->isAllowed( 'hideuser' ) && $block->mHideName ) { + if ( !$performer->isAllowed( 'hideuser' ) && $block->mHideName ) { return array( 'unblock-hideuser' ); } @@ -188,7 +191,7 @@ class SpecialUnblock extends SpecialPage { } # Unset _deleted fields as needed - if( $block->mHideName ) { + if ( $block->mHideName ) { # Something is deeply FUBAR if this is not a User object, but who knows? $id = $block->getTarget() instanceof User ? $block->getTarget()->getID() @@ -208,8 +211,12 @@ class SpecialUnblock extends SpecialPage { # Make log entry $log = new LogPage( 'block' ); - $log->addEntry( 'unblock', $page, $data['Reason'] ); + $log->addEntry( 'unblock', $page, $data['Reason'], array(), $performer ); return true; } + + protected function getGroupName() { + return 'users'; + } } |