r65299 c5894 followup
authorSam Reed <reedy@users.mediawiki.org>
Fri, 19 Feb 2010 19:44:28 +0000 (19:44 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Fri, 19 Feb 2010 19:44:28 +0000 (19:44 +0000)
Move isset check of gettoken upto level of $salt !== false. If gettoken is set, the module isn't going to do anything else (and therefore no point seeing if there is a token set, let alone attempting to validate it)

includes/api/ApiMain.php

index 4d5e455..b450934 100644 (file)
@@ -416,9 +416,9 @@ 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 && !isset( $moduleParams['gettoken'] ) )
                {
-                       if ( !isset( $moduleParams['token'] ) && !isset( $moduleParams['gettoken'] ) ) {
+                       if ( !isset( $moduleParams['token'] ) ) {
                                $this->dieUsageMsg( array( 'missingparam', 'token' ) );
                        } else {
                                global $wgUser;