diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/api/ApiBlock.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/api/ApiBlock.php')
-rw-r--r-- | includes/api/ApiBlock.php | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php index bb2bb253..351ac6b7 100644 --- a/includes/api/ApiBlock.php +++ b/includes/api/ApiBlock.php @@ -24,11 +24,6 @@ * @file */ -if ( !defined( 'MEDIAWIKI' ) ) { - // Eclipse helper - will be ignored in production - require_once( "ApiBase.php" ); -} - /** * API module that facilitates the blocking of users. Requires API write mode * to be enabled. @@ -48,29 +43,29 @@ class ApiBlock extends ApiBase { * of success. If it fails, the result will specify the nature of the error. */ public function execute() { - global $wgUser; + $user = $this->getUser(); $params = $this->extractRequestParams(); if ( $params['gettoken'] ) { - $res['blocktoken'] = $wgUser->editToken( '', $this->getMain()->getRequest() ); + $res['blocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() ); $this->getResult()->addValue( null, $this->getModuleName(), $res ); return; } - if ( !$wgUser->isAllowed( 'block' ) ) { + if ( !$user->isAllowed( 'block' ) ) { $this->dieUsageMsg( 'cantblock' ); } # bug 15810: blocked admins should have limited access here - if ( $wgUser->isBlocked() ) { - $status = SpecialBlock::checkUnblockSelf( $params['user'] ); + if ( $user->isBlocked() ) { + $status = SpecialBlock::checkUnblockSelf( $params['user'], $user ); if ( $status !== true ) { $this->dieUsageMsg( array( $status ) ); } } - if ( $params['hidename'] && !$wgUser->isAllowed( 'hideuser' ) ) { + if ( $params['hidename'] && !$user->isAllowed( 'hideuser' ) ) { $this->dieUsageMsg( 'canthide' ); } - if ( $params['noemail'] && !SpecialBlock::canBlockEmail( $wgUser ) ) { + if ( $params['noemail'] && !SpecialBlock::canBlockEmail( $user ) ) { $this->dieUsageMsg( 'cantblock-email' ); } @@ -87,13 +82,13 @@ class ApiBlock extends ApiBase { 'AutoBlock' => $params['autoblock'], 'DisableEmail' => $params['noemail'], 'HideUser' => $params['hidename'], - 'DisableUTEdit' => $params['allowusertalk'], + 'DisableUTEdit' => !$params['allowusertalk'], 'AlreadyBlocked' => $params['reblock'], 'Watch' => $params['watchuser'], 'Confirm' => true, ); - $retval = SpecialBlock::processForm( $data ); + $retval = SpecialBlock::processForm( $data, $this->getContext() ); if ( $retval !== true ) { // We don't care about multiple errors, just report one of them $this->dieUsageMsg( $retval ); @@ -208,7 +203,7 @@ class ApiBlock extends ApiBase { return ''; } - protected function getExamples() { + public 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=' |