follow up to r106097 - somehow managed to remove a line o_O also did some stylizing
authorJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 13 Dec 2011 22:29:13 +0000 (22:29 +0000)
committerJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 13 Dec 2011 22:29:13 +0000 (22:29 +0000)
ReCaptcha.php

index 6304b9f5b7a703fc0189f36a3ff70133b7f2c869..ab4ff7efd2914fa005bcf88196c433c447768229 100644 (file)
@@ -86,29 +86,31 @@ class ReCaptcha extends SimpleCaptcha {
         *
         */
        function passCaptcha() {
-               global $wgReCaptchaPrivateKey;
-               global $wgRequest;
+               global $wgReCaptchaPrivateKey, $wgRequest;
 
                //API is hardwired to return wpCaptchaId and wpCaptchaWord, so use that if the standard two are empty
-               $challenge = $wgRequest->getVal('recaptcha_challenge_field',$wgRequest->getVal('wpCaptchaId'));
-               $response = $wgRequest->getVal('recaptcha_response_field',$wgRequest->getVal('wpCaptchaWord'));
+               $challenge = $wgRequest->getVal( 'recaptcha_challenge_field', $wgRequest->getVal( 'wpCaptchaId' ) );
+               $response = $wgRequest->getVal( 'recaptcha_response_field', $wgRequest->getVal( 'wpCaptchaWord' ) );
+               
                if ( $response === null ) {
                        //new captcha session
                        return false;
                }
 
+               $recaptcha_response = recaptcha_check_answer(
+                       $wgReCaptchaPrivateKey,
+                       $wgRequest->getIP(),
+                       $challenge,
+                       $response
+               );
                
-                       recaptcha_check_answer (
-                               $wgReCaptchaPrivateKey,
-                               $wgRequest->getIP(),
-                               $challenge,
-                               $response
-                       );
                if (!$recaptcha_response->is_valid) {
                        $this->recaptcha_error = $recaptcha_response->error;
                        return false;
                }
+               
                $recaptcha_error = null;
+               
                return true;
 
        }