Followup to r62557 as per Roans comment
authorSam Reed <reedy@users.mediawiki.org>
Tue, 16 Feb 2010 21:59:16 +0000 (21:59 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 16 Feb 2010 21:59:16 +0000 (21:59 +0000)
13 files changed:
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiDelete.php
includes/api/ApiEditPage.php
includes/api/ApiEmailUser.php
includes/api/ApiImport.php
includes/api/ApiMain.php
includes/api/ApiMove.php
includes/api/ApiPatrol.php
includes/api/ApiRollback.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php
includes/api/ApiUpload.php

index 73ae1ab..0f15eca 100644 (file)
@@ -970,7 +970,7 @@ abstract class ApiBase {
        }
        
        /**
-       * Returns the token salt if there is one, null if the module doesn't require a salt, else false if the module doesn't need a token
+       * Returns the token salt if there is one, '' if the module doesn't require a salt, else false if the module doesn't need a token
        * @returns bool
        */
        public function getTokenSalt() {
@@ -997,7 +997,7 @@ abstract class ApiBase {
                        $ret[] = array ( 'writedisabled' );
                }
                
-               if ( $this->getTokenSalt() != false ) {
+               if ( $this->getTokenSalt() !== false ) {
                        $ret[] = array( 'missingparam', 'token' );
                        $ret[] = array( 'sessionfailure' );
                }
index 27895aa..5d51589 100644 (file)
@@ -166,7 +166,7 @@ class ApiBlock extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 89ee831..40f487f 100644 (file)
@@ -218,7 +218,7 @@ class ApiDelete extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 3a52405..e85da4b 100644 (file)
@@ -458,7 +458,7 @@ class ApiEditPage extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 1a735b7..0c29c6f 100644 (file)
@@ -113,7 +113,7 @@ class ApiEmailUser extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 163f2eb..2d0cfb3 100644 (file)
@@ -150,7 +150,7 @@ class ApiImport extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index fa87e57..7add216 100644 (file)
@@ -416,14 +416,13 @@ class ApiMain extends ApiBase {
                
                //Die if token required, but not provided (unless there is a gettoken parameter)
                $salt = $module->getTokenSalt();
-               if ( $salt != false )
+               if ( $salt !== false )
                {
                        if ( !isset( $moduleParams['token'] ) && !isset( $moduleParams['gettoken'] ) ) {
                                $this->dieUsageMsg( array( 'missingparam', 'token' ) );
                        } else {
                                global $wgUser;
-                               if ( ( $salt != null && !$wgUser->matchEditToken( $moduleParams['token'], $salt ) )
-                                       || !$wgUser->matchEditToken( $moduleParams['token'] ) ) {
+                               if ( !$wgUser->matchEditToken( $moduleParams['token'], $salt ) ) {
                                        $this->dieUsageMsg( array( 'sessionfailure' ) );
                                }
                        }
index 66bf71b..fca1e5d 100644 (file)
@@ -220,7 +220,7 @@ class ApiMove extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index f42523b..63ce0ce 100644 (file)
@@ -93,7 +93,7 @@ class ApiPatrol extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index d09800c..af252dc 100644 (file)
@@ -123,7 +123,7 @@ class ApiRollback extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 9fe7ac9..4b631e2 100644 (file)
@@ -117,7 +117,7 @@ class ApiUnblock extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 41ee00d..4dc603f 100644 (file)
@@ -126,7 +126,7 @@ class ApiUndelete extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {
index 0995326..ed0df7e 100644 (file)
@@ -343,7 +343,7 @@ class ApiUpload extends ApiBase {
        }
        
        public function getTokenSalt() {
-               return null;
+               return '';
        }
 
        protected function getExamples() {