Localisation updates (extensions) from Betawiki (2008-06-25 22:11 CEST)
[toast/cookiecaptcha.git] / MathCaptcha.class.php
index adf1663b8de956b6c3e03df859f25e53206fc0ec..66567e03503495846d449beb17a4e463030ce78c 100644 (file)
@@ -6,6 +6,15 @@ class MathCaptcha extends SimpleCaptcha {
        function keyMatch( $answer, $info ) {
                return (int)$answer == (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() {
        
        /** Produce a nice little form */
        function getForm() {