/** Validate a captcha response */
function keyMatch( $answer, $info ) {
- return strtolower( $answer ) == strtolower( $info['answer'] );
+ if ( is_array( $info['answer'] ) ) {
+ return in_array( strtolower( $answer ), $info['answer'] );
+ } else {
+ return strtolower( $answer ) == strtolower( $info['answer'] );
+ }
}
function addCaptchaAPI( &$resultArr ) {
global $wgCaptchaQuestions;
$wgCaptchaQuestions = array();
+
+// Add your questions in LocalSettings.php using this format
// $wgCaptchaQuestions[] = array( 'question' => "A question?", 'answer' => "An answer!" );
// $wgCaptchaQuestions[] = array( 'question' => 'How much wood would a woodchuck chuck if a woodchuck could chuck wood?', 'answer' => 'as much wood as...' );
// $wgCaptchaQuestions[] = array( 'question' => "What is this wiki's name?", 'answer' => "$wgSitename" );
-// add your questions in LocalSettings.php using this format
+// You can also provide several acceptable answers to a given question (the answers shall be in lowercase):
+// $wgCaptchaQuestions[] = array( 'question' => "2 + 2 ?", 'answer' => array( '4', 'four' ) );
$wgExtensionMessagesFiles['QuestyCaptcha'] = dirname( __FILE__ ) . '/QuestyCaptcha.i18n.php';
$wgAutoloadClasses['QuestyCaptcha'] = dirname( __FILE__ ) . '/QuestyCaptcha.class.php';