X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/152f5e39e0ad8115470ee380e567a3ea31db6f1b..2c56bd06f00f0893b6703d36d80cf9c664878ba6:/MathCaptcha.class.php diff --git a/MathCaptcha.class.php b/MathCaptcha.class.php index 01d6391..9b9cde2 100644 --- a/MathCaptcha.class.php +++ b/MathCaptcha.class.php @@ -3,21 +3,30 @@ 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']; } - + + function addCaptchaAPI( &$resultArr ) { + list( $sum, $answer ) = $this->pickSum(); + $index = $this->storeCaptcha( array( 'answer' => $answer ) ); + $resultArr['captcha']['type'] = 'math'; + $resultArr['captcha']['mime'] = 'text/tex'; + $resultArr['captcha']['id'] = $index; + $resultArr['captcha']['question'] = $sum; + } + /** Produce a nice little form */ function getForm() { list( $sum, $answer ) = $this->pickSum(); $index = $this->storeCaptcha( array( 'answer' => $answer ) ); - + $form = '
' . $this->fetchMath( $sum ) . ' | '; - $form .= '' . wfInput( 'wpCaptchaAnswer', false, false, array( 'tabindex' => '1' ) ) . ' |