summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialUnblock.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
commitd9022f63880ce039446fba8364f68e656b7bf4cb (patch)
tree16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/specials/SpecialUnblock.php
parent27cf83d177256813e2e802241085fce5dd0f3fb9 (diff)
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/specials/SpecialUnblock.php')
-rw-r--r--includes/specials/SpecialUnblock.php65
1 files changed, 34 insertions, 31 deletions
diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php
index 521c1775..47944309 100644
--- a/includes/specials/SpecialUnblock.php
+++ b/includes/specials/SpecialUnblock.php
@@ -35,35 +35,22 @@ class SpecialUnblock extends SpecialPage {
}
public function execute( $par ){
- global $wgUser, $wgOut, $wgRequest;
+ $this->checkPermissions();
+ $this->checkReadOnly();
- # Check permissions
- if( !$this->userCanExecute( $wgUser ) ) {
- $this->displayRestrictionError();
- return;
- }
-
- # Check for database lock
- if( wfReadOnly() ) {
- throw new ReadOnlyError;
- }
-
- list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $wgRequest );
+ list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $this->getRequest() );
$this->block = Block::newFromTarget( $this->target );
- # bug 15810: 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( $this->target );
- if ( $status !== true ) {
- throw new ErrorPageError( 'badaccess', $status );
- }
+ $this->setHeaders();
+ $this->outputHeader();
- $wgOut->setPageTitle( wfMsg( 'unblockip' ) );
- $wgOut->addModules( 'mediawiki.special' );
+ $out = $this->getOutput();
+ $out->setPageTitle( $this->msg( 'unblockip' ) );
+ $out->addModules( 'mediawiki.special' );
$form = new HTMLForm( $this->getFields(), $this->getContext() );
$form->setWrapperLegend( wfMsg( 'unblockip' ) );
- $form->setSubmitCallback( array( __CLASS__, 'processUnblock' ) );
+ $form->setSubmitCallback( array( __CLASS__, 'processUIUnblock' ) );
$form->setSubmitText( wfMsg( 'ipusubmit' ) );
$form->addPreText( wfMsgExt( 'unblockiptext', 'parse' ) );
@@ -71,14 +58,14 @@ class SpecialUnblock extends SpecialPage {
switch( $this->type ){
case Block::TYPE_USER:
case Block::TYPE_IP:
- $wgOut->addWikiMsg( 'unblocked', $this->target );
+ $out->addWikiMsg( 'unblocked', $this->target );
break;
case Block::TYPE_RANGE:
- $wgOut->addWikiMsg( 'unblocked-range', $this->target );
+ $out->addWikiMsg( 'unblocked-range', $this->target );
break;
case Block::TYPE_ID:
case Block::TYPE_AUTO:
- $wgOut->addWikiMsg( 'unblocked-id', $this->target );
+ $out->addWikiMsg( 'unblocked-id', $this->target );
break;
}
}
@@ -120,8 +107,7 @@ class SpecialUnblock extends SpecialPage {
switch( $type ){
case Block::TYPE_USER:
case Block::TYPE_IP:
- $skin = $this->getSkin();
- $fields['Name']['default'] = $skin->link(
+ $fields['Name']['default'] = Linker::link(
$target->getUserPage(),
$target->getName()
);
@@ -149,12 +135,21 @@ class SpecialUnblock extends SpecialPage {
}
/**
+ * Submit callback for an HTMLForm object
+ */
+ public static function processUIUnblock( array $data, HTMLForm $form ) {
+ return self::processUnblock( $data, $form->getContext() );
+ }
+
+ /**
* Process the form
+ *
+ * @param $data Array
+ * @param $context IContextSource
* @return Array( Array(message key, parameters) ) on failure, True on success
*/
- public static function processUnblock( array $data ){
- global $wgUser;
-
+ public static function processUnblock( array $data, IContextSource $context ){
+ $performer = $context->getUser();
$target = $data['Target'];
$block = Block::newFromTarget( $data['Target'] );
@@ -162,6 +157,14 @@ class SpecialUnblock extends SpecialPage {
return array( array( 'ipb_cant_unblock', $target ) );
}
+ # bug 15810: 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 );
+ if ( $status !== true ) {
+ throw new ErrorPageError( 'badaccess', $status );
+ }
+
# 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 );
@@ -172,7 +175,7 @@ class SpecialUnblock extends SpecialPage {
# If the name was hidden and the blocking user cannot hide
# names, then don't allow any block removals...
- if( !$wgUser->isAllowed( 'hideuser' ) && $block->mHideName ) {
+ if( !$performer->isAllowed( 'hideuser' ) && $block->mHideName ) {
return array( 'unblock-hideuser' );
}