X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/f856872f83c84b0db5672d7833e12ca9deb0bcac..64b623934855201ace5de2a0321ccf6db1a9109b:/Captcha.php diff --git a/Captcha.php b/Captcha.php index 1d781ae..a67870c 100644 --- a/Captcha.php +++ b/Captcha.php @@ -44,7 +44,7 @@ abstract class Captcha { /** * Instantiate a new Captcha object for a given Id - * + * * @param $id Int * @return Captcha */ @@ -253,7 +253,9 @@ class SimpleCaptcha { $captcha = $this->getCaptcha(); $index = $this->storeCaptcha( $captcha ); - return "

= " . + // dir="ltr" is needed because otherwise it may say + // "5 - 20" instead of "20 - 5" and that would be wrong. + return "

= " . Xml::element( 'input', array( 'name' => 'wpCaptchaWord', 'id' => 'wpCaptchaWord', @@ -303,7 +305,7 @@ class SimpleCaptcha { wfDebug( "ConfirmEdit: user group allows skipping captcha on email sending\n" ); return true; } - $form->addFooterText( + $form->addFooterText( "

" . $wgOut->parse( $this->getMessage( 'sendemail' ) ) . $this->getForm() . @@ -690,6 +692,7 @@ class SimpleCaptcha { $this->addCaptchaAPI( $resultArr ); return false; } + return true; } @@ -740,7 +743,7 @@ class SimpleCaptcha { } /** - * Check the captcha on Special:EmailUser + * Check the captcha on Special:EmailUser * @param $from MailAddress * @param $to MailAddress * @param $subject String @@ -757,7 +760,7 @@ class SimpleCaptcha { } if ( $this->isIPWhitelisted() ) return true; - + if ( defined( 'MW_API' ) ) { # API mode # Asking for captchas in the API is really silly @@ -773,6 +776,36 @@ class SimpleCaptcha { return true; } + /** + * @param $module ApiBase + * @param $params array + * @return bool + */ + public function APIGetAllowedParams( &$module, &$params ) { + if ( !$module instanceof ApiEditPage ) { + return true; + } + $params['captchaword'] = null; + $params['captchaid'] = null; + + return true; + } + + /** + * @param $module ApiBae + * @param $desc array + * @return bool + */ + public function APIGetParamDescription( &$module, &$desc ) { + if ( !$module instanceof ApiEditPage ) { + return true; + } + $desc['captchaid'] = 'CAPTCHA ID from previous request'; + $desc['captchaword'] = 'Answer to the CAPTCHA'; + + return true; + } + /** * Given a required captcha run, test form input for correct * input on the open session.