Index: trunk/extensions/ConfirmEdit/QuestyCaptcha.php |
— | — | @@ -30,10 +30,13 @@ |
31 | 31 | |
32 | 32 | global $wgCaptchaQuestions; |
33 | 33 | $wgCaptchaQuestions = array(); |
| 34 | + |
| 35 | +// Add your questions in LocalSettings.php using this format |
34 | 36 | // $wgCaptchaQuestions[] = array( 'question' => "A question?", 'answer' => "An answer!" ); |
35 | 37 | // $wgCaptchaQuestions[] = array( 'question' => 'How much wood would a woodchuck chuck if a woodchuck could chuck wood?', 'answer' => 'as much wood as...' ); |
36 | 38 | // $wgCaptchaQuestions[] = array( 'question' => "What is this wiki's name?", 'answer' => "$wgSitename" ); |
37 | | -// add your questions in LocalSettings.php using this format |
| 39 | +// You can also provide several acceptable answers to a given question (the answers shall be in lowercase): |
| 40 | +// $wgCaptchaQuestions[] = array( 'question' => "2 + 2 ?", 'answer' => array( '4', 'four' ) ); |
38 | 41 | |
39 | 42 | $wgExtensionMessagesFiles['QuestyCaptcha'] = dirname( __FILE__ ) . '/QuestyCaptcha.i18n.php'; |
40 | 43 | $wgAutoloadClasses['QuestyCaptcha'] = dirname( __FILE__ ) . '/QuestyCaptcha.class.php'; |
Index: trunk/extensions/ConfirmEdit/QuestyCaptcha.class.php |
— | — | @@ -12,7 +12,11 @@ |
13 | 13 | |
14 | 14 | /** Validate a captcha response */ |
15 | 15 | function keyMatch( $answer, $info ) { |
16 | | - return strtolower( $answer ) == strtolower( $info['answer'] ); |
| 16 | + if ( is_array( $info['answer'] ) ) { |
| 17 | + return in_array( strtolower( $answer ), $info['answer'] ); |
| 18 | + } else { |
| 19 | + return strtolower( $answer ) == strtolower( $info['answer'] ); |
| 20 | + } |
17 | 21 | } |
18 | 22 | |
19 | 23 | function addCaptchaAPI( &$resultArr ) { |