summaryrefslogtreecommitdiff
path: root/includes/api/ApiBlock.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes/api/ApiBlock.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'includes/api/ApiBlock.php')
-rw-r--r--includes/api/ApiBlock.php38
1 files changed, 23 insertions, 15 deletions
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index 23de07d6..875b8aeb 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -1,9 +1,9 @@
<?php
-
/**
- * Created on Sep 4, 2007
* API for MediaWiki 1.8+
*
+ * Created on Sep 4, 2007
+ *
* Copyright © 2007 Roan Kattouw <Firstname>.<Lastname>@home.nl
*
* This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,10 @@
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
*/
if ( !defined( 'MEDIAWIKI' ) ) {
@@ -58,12 +60,16 @@ class ApiBlock extends ApiBase {
return;
}
- if ( is_null( $params['user'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'user' ) );
- }
if ( !$wgUser->isAllowed( 'block' ) ) {
$this->dieUsageMsg( array( 'cantblock' ) );
}
+ # bug 15810: blocked admins should have limited access here
+ if ( $wgUser->isBlocked() ) {
+ $status = IPBlockForm::checkUnblockSelf( $params['user'] );
+ if ( $status !== true ) {
+ $this->dieUsageMsg( array( $status ) );
+ }
+ }
if ( $params['hidename'] && !$wgUser->isAllowed( 'hideuser' ) ) {
$this->dieUsageMsg( array( 'canthide' ) );
}
@@ -128,7 +134,10 @@ class ApiBlock extends ApiBase {
public function getAllowedParams() {
return array(
- 'user' => null,
+ 'user' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => true
+ ),
'token' => null,
'gettoken' => false,
'expiry' => 'never',
@@ -161,20 +170,19 @@ class ApiBlock extends ApiBase {
}
public function getDescription() {
- return array(
- 'Block a user.'
- );
+ return 'Block a user';
}
-
+
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
- array( 'missingparam', 'user' ),
array( 'cantblock' ),
array( 'canthide' ),
array( 'cantblock-email' ),
+ array( 'ipbblocked' ),
+ array( 'ipbnounblockself' ),
) );
}
-
+
public function needsToken() {
return true;
}
@@ -186,11 +194,11 @@ class ApiBlock extends ApiBase {
protected function getExamples() {
return array(
'api.php?action=block&user=123.5.5.12&expiry=3%20days&reason=First%20strike',
- 'api.php?action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate&autoblock&noemail'
+ 'api.php?action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail='
);
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiBlock.php 74217 2010-10-03 15:53:07Z reedy $';
+ return __CLASS__ . ': $Id: ApiBlock.php 77192 2010-11-23 22:05:27Z btongminh $';
}
}