Merge "Fix assignment in conditional"
[lhc/web/wiklou.git] / includes / api / ApiBlock.php
index 56c6289..7d3a40b 100644 (file)
  * @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.
@@ -52,7 +47,7 @@ class ApiBlock extends ApiBase {
                $params = $this->extractRequestParams();
 
                if ( $params['gettoken'] ) {
-                       $res['blocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() );
+                       $res['blocktoken'] = $user->getEditToken();
                        $this->getResult()->addValue( null, $this->getModuleName(), $res );
                        return;
                }
@@ -62,7 +57,7 @@ class ApiBlock extends ApiBase {
                }
                # bug 15810: blocked admins should have limited access here
                if ( $user->isBlocked() ) {
-                       $status = SpecialBlock::checkUnblockSelf( $params['user'] );
+                       $status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
                        if ( $status !== true ) {
                                $this->dieUsageMsg( array( $status ) );
                        }
@@ -93,7 +88,7 @@ class ApiBlock extends ApiBase {
                        '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 );
@@ -216,7 +211,7 @@ class ApiBlock extends ApiBase {
        }
 
        public function getHelpUrls() {
-               return 'http://www.mediawiki.org/wiki/API:Block';
+               return 'https://www.mediawiki.org/wiki/API:Block';
        }
 
        public function getVersion() {