ConfirmEdit: Cleaning up brain-damaged implementation of keyMatch() which expected...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 24 Jan 2008 21:42:21 +0000 (21:42 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 24 Jan 2008 21:42:21 +0000 (21:42 +0000)
ConfirmEdit_body.php
FancyCaptcha.class.php
MathCaptcha.class.php

index a9600d711946c758f846121e68a64a5c06f732c3..1755183a14eaa3f7307133277c4574da9553390d 100644 (file)
@@ -206,12 +206,12 @@ class SimpleCaptcha {
         *
         * Override this!
         *
         *
         * Override this!
         *
-        * @param WebRequest $request
+        * @param string $answer
         * @param array $info
         * @return bool
         */
         * @param array $info
         * @return bool
         */
-       function keyMatch( $request, $info ) {
-               return $request->getVal( 'wpCaptchaWord' ) == $info['answer'];
+       function keyMatch( $answer, $info ) {
+               return $answer == $info['answer'];
        }
 
        // ----------------------------------
        }
 
        // ----------------------------------
@@ -508,7 +508,7 @@ class SimpleCaptcha {
                $info = $this->retrieveCaptcha();
                if( $info ) {
                        global $wgRequest;
                $info = $this->retrieveCaptcha();
                if( $info ) {
                        global $wgRequest;
-                       if( $this->keyMatch( $wgRequest, $info ) ) {
+                       if( $this->keyMatch( $wgRequest->getVal('wpCaptchaWord'), $info ) ) {
                                $this->log( "passed" );
                                $this->clearCaptcha( $info );
                                return true;
                                $this->log( "passed" );
                                $this->clearCaptcha( $info );
                                return true;
index 93b49ffca0a28317814c1ee8ab2ea933b22e710a..fa968202b3a4f4156924ae5cacfd70d410edade4 100644 (file)
@@ -5,14 +5,13 @@ class FancyCaptcha extends SimpleCaptcha {
         * Check if the submitted form matches the captcha session data provided
         * by the plugin when the form was generated.
         *
         * Check if the submitted form matches the captcha session data provided
         * by the plugin when the form was generated.
         *
-        * @param WebRequest $request
+        * @param string $answer
         * @param array $info
         * @return bool
         */
         * @param array $info
         * @return bool
         */
-       function keyMatch( $request, $info ) {
+       function keyMatch( $answer, $info ) {
                global $wgCaptchaSecret;
 
                global $wgCaptchaSecret;
 
-               $answer = $request->getVal( 'wpCaptchaWord' );
                $digest = $wgCaptchaSecret . $info['salt'] . $answer . $wgCaptchaSecret . $info['salt'];
                $answerHash = substr( md5( $digest ), 0, 16 );
 
                $digest = $wgCaptchaSecret . $info['salt'] . $answer . $wgCaptchaSecret . $info['salt'];
                $answerHash = substr( md5( $digest ), 0, 16 );
 
index 01d63915035bb20c2d1fff645218e3380b31d80c..adf1663b8de956b6c3e03df859f25e53206fc0ec 100644 (file)
@@ -3,8 +3,8 @@
 class MathCaptcha extends SimpleCaptcha {
 
        /** Validate a captcha response */
 class MathCaptcha extends SimpleCaptcha {
 
        /** Validate a captcha response */
-       function keyMatch( $req, $info ) {
-               return (int)$req->getVal( 'wpCaptchaAnswer' ) == (int)$info['answer'];
+       function keyMatch( $answer, $info ) {
+               return (int)$answer == (int)$info['answer'];
        }
        
        /** Produce a nice little form */
        }
        
        /** Produce a nice little form */