From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/api/ApiUnblock.php | 46 ++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'includes/api/ApiUnblock.php') diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index 4f6e4fb7..51ee0241 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -1,10 +1,10 @@ .@home.nl + * Copyright © 2007 Roan Kattouw .@gmail.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,40 +49,42 @@ class ApiUnblock extends ApiBase { $params = $this->extractRequestParams(); if ( $params['gettoken'] ) { - $res['unblocktoken'] = $wgUser->editToken(); + $res['unblocktoken'] = $wgUser->editToken( '', $this->getMain()->getRequest() ); $this->getResult()->addValue( null, $this->getModuleName(), $res ); return; } if ( is_null( $params['id'] ) && is_null( $params['user'] ) ) { - $this->dieUsageMsg( array( 'unblock-notarget' ) ); + $this->dieUsageMsg( 'unblock-notarget' ); } if ( !is_null( $params['id'] ) && !is_null( $params['user'] ) ) { - $this->dieUsageMsg( array( 'unblock-idanduser' ) ); + $this->dieUsageMsg( 'unblock-idanduser' ); } if ( !$wgUser->isAllowed( 'block' ) ) { - $this->dieUsageMsg( array( 'cantunblock' ) ); + $this->dieUsageMsg( 'cantunblock' ); } # bug 15810: blocked admins should have limited access here if ( $wgUser->isBlocked() ) { - $status = IPBlockForm::checkUnblockSelf( $params['user'] ); + $status = SpecialBlock::checkUnblockSelf( $params['user'] ); if ( $status !== true ) { - $this->dieUsageMsg( array( $status ) ); + $this->dieUsageMsg( $status ); } } - $id = $params['id']; - $user = $params['user']; - $reason = ( is_null( $params['reason'] ) ? '' : $params['reason'] ); - $retval = IPUnblockForm::doUnblock( $id, $user, $reason, $range ); - if ( $retval ) { - $this->dieUsageMsg( $retval ); + $data = array( + 'Target' => is_null( $params['id'] ) ? $params['user'] : "#{$params['id']}", + 'Reason' => is_null( $params['reason'] ) ? '' : $params['reason'] + ); + $block = Block::newFromTarget( $data['Target'] ); + $retval = SpecialUnblock::processUnblock( $data ); + if ( $retval !== true ) { + $this->dieUsageMsg( $retval[0] ); } - $res['id'] = intval( $id ); - $res['user'] = $user; - $res['reason'] = $reason; + $res['id'] = $block->getId(); + $res['user'] = $block->getType() == Block::TYPE_AUTO ? '' : $block->getTarget(); + $res['reason'] = $params['reason']; $this->getResult()->addValue( null, $this->getModuleName(), $res ); } @@ -96,7 +98,9 @@ class ApiUnblock extends ApiBase { public function getAllowedParams() { return array( - 'id' => null, + 'id' => array( + ApiBase::PARAM_TYPE => 'integer', + ), 'user' => null, 'token' => null, 'gettoken' => false, @@ -144,7 +148,11 @@ class ApiUnblock extends ApiBase { ); } + public function getHelpUrls() { + return 'https://www.mediawiki.org/wiki/API:Block'; + } + public function getVersion() { - return __CLASS__ . ': $Id: ApiUnblock.php 74098 2010-10-01 20:12:50Z reedy $'; + return __CLASS__ . ': $Id: ApiUnblock.php 104449 2011-11-28 15:52:04Z reedy $'; } } -- cgit v1.2.3-54-g00ecf