Extension:ReCAPTCHA

What can this extension do?
reCAPTCHA places a strong CAPTCHA on your wiki. The CAPTCHA helps to read books that are scanned by projects such as archive.org. The CAPTCHA also includes an accessible audio version. Researchers at Carnegie Mellon University believe that this CAPTCHA is not readable by current OCR technology.

Requires MediaWiki 1.8 or above.

Usage
See http://recaptcha.net/plugins/mediawiki/ for instructions.

Configuration
The following set of rules strikes the right balance between keeping spam down and allowing unrestrictive access to users:
 * 1) Any user can edit the wiki, because registration puts people off.
 * 2) Unregistered users are always presented with a captcha.
 * 3) Registration requires a captcha.
 * 4) Registered users are never presented with a captcha.

In the MediaWiki config those rules looks like this:

// Fix the default captcha behaviour $wgGroupPermissions['*'           ]['skipcaptcha'] = false; $wgGroupPermissions['user'        ]['skipcaptcha'] = true; $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true; $wgGroupPermissions['bot'         ]['skipcaptcha'] = true; // registered bots $wgGroupPermissions['sysop'       ]['skipcaptcha'] = true;

$wgCaptchaTriggers['edit']         = true; $wgCaptchaTriggers['create']       = true; $wgCaptchaTriggers['createaccount'] = true;

(all other permissions having their default values)

Problem locating keys
If after defining in your LocalSettings.php your $recaptcha_public_key and $recaptcha_private_key you get the following error code,

You need to set $recaptcha_private_key and $recaptcha_public_key in LocalSettings.php to use the reCAPTCHA plugin.

then you must put your $recaptcha_public_key and $recaptcha_private_key definition after

require_once( "$IP/extensions/recaptcha/ReCaptcha.php" );

Captcha box layout messed in RTL languages (hebrew)
ReCaptcha was designed for LTR. Until a verion that supports RTL is officially released, the quick and dirty solution is to make the following change in recaptchalib.php:

(1) Go to function recaptcha_get_html (line 124 in version 1.7)

(2) Change return so that it is wrapped in a div dir="ltr" tag

Parameter 1 to ReCaptcha::confirmEdit expected to be a reference
Under PHP 5.3.2 and recaptcha-mediawiki-1.7 you may see the following error. Warning: Parameter 1 to ReCaptcha::confirmEdit expected to be a reference, value given in [...]/includes/Hooks.php on line 117 This can be fixed by applying the following patch (see Manual:Hooks/EditFilter). --- ConfirmEdit.php	2010/06/04 16:08:21	1.1 +++ ConfirmEdit.php	2010/06/04 16:08:27 @@ -483,7 +483,7 @@ 	 * @param string $section * @param bool true to continue saving, false to abort and show a captcha form */ -	function confirmEdit( &$editPage, $newtext, $section ) { +	function confirmEdit( $editPage, $newtext, $section ) { if( $this->shouldCheck( $editPage, $newtext, $section ) ) { if( $this->passCaptcha ) { return true; --- ReCaptcha.php	2010/06/04 16:04:15	1.1 +++ ReCaptcha.php	2010/06/04 16:04:19 @@ -97,7 +97,7 @@         * Called on all edit page saves. (EditFilter events) * @return boolean - true if page save should continue, false if should display Captcha widget. */ -       function confirmEdit( &$editPage, $newtext, $section ) { +       function confirmEdit( $editPage, $newtext, $section ) { if( $this->shouldCheck( $editPage, $newtext, $section ) ) { if (!isset($_POST['recaptcha_response_field'])) {

ReCaptcha.i18n.php
 array(    'recaptcha-edit' => 'To help protect against automated edit spam, please type the two words you see in the box below:',      'recaptcha-addurl' => 'Your edit includes new external links. To help protect against automated spam, please type the two words you see in the box below:',     'recaptcha-badpass' => 'To help protect against automated password cracking, please type the two words you see in the box below:',	'recaptcha-createaccount' => 'To help protect against automated account creation, please type the two words you see in the box below:',	'recaptcha-createaccount-fail' => "Incorrect or missing reCAPTCHA answer.",	'recaptcha-create' => 'To help protect against automated page creation, please type the two words you see in the box below:', ),

/* French */ 'fr' => array(    'recaptcha-edit' => "Pour nous protéger des robots, merci d'écrire les deux mots visibles dans le cadre qui suit:",      'recaptcha-addurl' => "Votre contribution contient des liens vers un site externe. Pour nous protéger des robots, merci d'écrire les deux mots visibles dans le cadre qui suit:",     'recaptcha-badpass' => "Pour nous protéger des essais automatiques de cassage de mot de passe, merci d'écrire les deux mots visibles dans le cadre qui suit:",	'recaptcha-createaccount' => "Pour nous protéger des créations automatiques de compte, merci d'écrire les deux mots visibles dans le cadre qui suit:",	'recaptcha-createaccount-fail' => "Réponse de reCAPTCHA fausse ou manquante.",	'recaptcha-create' => "Pour nous protéger des créations automatiques de pages, merci d'écrire les deux mots visibles dans le cadre qui suit:", ),

/* Spanish */ 'es' => array(    'recaptcha-edit' => 'Para protegernos de los robots, escribid por favor las dos palabras visibles en el cuadro abajo:',      'recaptcha-addurl' => 'Su aportación contiene enlaces externos. Para protegernos de los robots, escribid por favor las dos palabras visibles en el cuadro abajo:',     'recaptcha-badpass' => 'Para protegernos de los robots que intentan adivinar contraseñas, escribid por favor las dos palabras visibles en el cuadro abajo:',	'recaptcha-createaccount' => 'Para protegernos de la creación automática de cuentas, escribid por favor las dos palabras visibles en el cuadro abajo:',	'recaptcha-createaccount-fail' => "La respuesta al reCAPTCHA esta falsa o faltante.",	'recaptcha-create' => 'Para protegernos de la creación automática de páginas, escribid por favor las dos palabras visibles en el cuadro abajo:', ),

/* Polish */ 'pl' => array(    'recaptcha-edit' => 'Aby uchronić nas przed robotami, proszę wpisać dwa widoczne słowa w poniższym polu:',      'recaptcha-addurl' => 'Twoja edycja zawiera linki zewnętrzne. Aby uchronić nas przed robotami, proszę wpisać dwa widoczne słowa w poniższym polu:',     'recaptcha-badpass' => 'Aby uchronić nas przed złamaniem automatycznym haseł, proszę wpisać dwa widoczne słowa w poniższym polu:',	'recaptcha-createaccount' => 'Aby uchronić nas przed automatycznym stworzeniem użytkowników, proszę wpisać dwa widoczne słowa w poniższym polu:',	'recaptcha-createaccount-fail' => "Odpowiedź na reCAPTCHA jest fałszywa lub brakująca.",	'recaptcha-create' => 'Aby uchronić nas przed tworzeniem stron przez robotów, proszę wpisać dwa widoczne słowa w poniższym polu:', ),

/* German */ 'de' => array(    'recaptcha-edit' => 'Zum Schutz vor automatisiertem Spam gebe bitte die beiden folgenden Wörter in das untenstehende Feld ein:',      'recaptcha-addurl' => 'Deine Bearbeitung enthält neue externe Links. Zum Schutz vor automatisiertem Spam gebe bitte die beiden folgenden Wörter in das untenstehende Feld ein:',     'recaptcha-badpass' => 'Zum Schutz gegen automatisiertes Knacken von Passwörtern, gebe bitte die beiden folgenden Wörter in das untenstehende Feld ein:',	'recaptcha-createaccount' => 'Zum Schutz gegen automatisierte Erstellung von Benutzerkonten gebe bitte die beiden folgenden Wörter in das untenstehende Feld ein:',	'recaptcha-createaccount-fail' => "Fehlerhafte oder fehlende reCAPTCHA Antwort.",	'recaptcha-create' => 'Zum Schutz gegen automatisierte Erstellung von Seiten gebe bitte die beiden folgenden Wörter in das untenstehende Feld ein:', ),

/* Portuguese */ 'pt' => array(    'recaptcha-edit' => 'Para proteger-nos de spam, por favor escreva  as duas palavras visíveis abaixo:',     'recaptcha-addurl' => 'A sua edição contem ligações externas. Para proteger-nos de spam, por favor escreva  as duas palavras visíveis abaixo:',     'recaptcha-badpass' => 'Para proteger-nos de robots que tentam adivinhar senhas, por favor escreva  as duas palavras visíveis abaixo:',        'recaptcha-createaccount' => 'Para proteger-nos de criação automática de contas, por favor escreva  as duas palavras visíveis abaixo:',        'recaptcha-createaccount-fail' => "A resposta ao reCAPTCHA é errada.",        'recaptcha-create' => 'Para proteger-nos da criação automática de páginas, por favor escreva  as duas palavras visíveis abaixo:', ),

/* Brazilian Portuguese */ 'pt_br' => array(       'recaptcha-edit' => 'Para ajudar a prevenir contra vandalismos, por favor digite as duas palavras que voc&ecirc; v&ecirc; na caixa abaixo:',         'recaptcha-addurl' => 'A sua edi&ccedil;&atilde;o inclui liga&ccedil;&otilde;es externas. Para ajudar a prevenir contra vandalismos, por favor digite as duas palavras que voc&ecirc; v&ecirc; na caixa abaixo:',    'recaptcha-badpass' => 'Para ajudar a prevenir contra tentativas de desbloquear senhas, por favor digite as duas palavras que voc&ecirc; v&ecirc; na caixa abaixo:',	'recaptcha-createaccount' => 'Para ajudar a prevenir contra cria&ccedil;&atilde;o automatizada de usu&aacute;rios, por favor digite as duas palavras que voc&ecirc; v&ecirc; na caixa abaixo:',	'recaptcha-createaccount-fail' => "Resposta incorreta ao reCAPTCHA.",	'recaptcha-create' => 'Para ajudar a prevenir contra cria&ccedil;&atilde;o automatizada de p&aacute;ginas, por favor digite as duas palavras que voc&ecirc; v&ecirc; na caixa abaixo:',

),

/* Swedish */ 'sv' => array(    'recaptcha-edit' => 'Den här sidan skyddas mot spam-robotar, bevisa att du är en människa genom att skriva de två orden du ser i boxen nedan:',      'recaptcha-addurl' => 'Din förändring av sidan innehåller nya externa länkar, vilket är typiskt för spam. Bevisa att du är en människa genom att skriva de två orden du ser i boxen nedan:',     'recaptcha-badpass' => 'För att skydda wikin mot robotar som gissar användares lösenord behöver användare bevisa att de är människor. Skriv ner de två orden som du ser i boxen nedan:',	'recaptcha-createaccount' => 'För att skydda wikin mot robotar som skapar konton behöver användare bevisa att de är människor. Var vänlig och skriv ner de två orden du ser i boxen nedan:',	'recaptcha-createaccount-fail' => "Du har angivit ett felaktig svar för reCAPTCHA.",	'recaptcha-create' => 'För att skydda wikin mot robotar som skapar nya artiklar. Var vänlig och skriv ner de två orden som finns i boxen nedan:', ),

/* Vietnamese */ 'vi' => array(    'recaptcha-edit' => 'Để giúp tránh các sửa đổi rác tự động, xin hãy gõ hai từ mà bạn nhìn thấy vào ô dưới đây:',      'recaptcha-addurl' => 'Sửa đổi của bạn có chứa liên kết ngoài mới. Để giúp tránh các sửa đổi rác tự động, xin hãy gõ hai từ mà bạn nhìn vào ô dưới đây:',     'recaptcha-badpass' => 'Để giúp tránh bẻ khóa mật khẩu tự động, xin hãy gõ hai từ mà bạn nhìn vào ô dưới đây:',	'recaptcha-createaccount' => 'Để giúp tránh việc mở tài khoản tự động, xin hãy gõ hai từ mà bạn nhìn vào ô dưới đây:',	'recaptcha-createaccount-fail' => "Thiếu câu trả lời reCAPTCHA hoặc câu trả lời không đúng.",	'recaptcha-create' => 'Để giúp tránh việc tạo trang tự động, xin hãy gõ hai từ mà bạn nhìn vào ô dưới đây:', ), 'he' => array(        'recaptcha-edit' => 'אינכם משתמש רשום.כהגנה מפני ספאם אוטומטי, אנא הקלידו את שתי המילים שלהלן. תודה.',         'recaptcha-addurl' => 'אינכם משתמש רשום.כהגנה מפני ספאם אוטומטי, אנא הקלידו את שתי המילים שלהלן. תודה.',         'recaptcha-badpass' => 'כהגנה מפני מפצחי סיסמאות אוטומטיים אנא הקלידו את שתי המילים שלהלן:',	'recaptcha-createaccount' => 'כהגנה מפני יצירת חשבונות פיקטיביים ע"י אוטומטים אנא הקלידו את שתי המילים שלהלן:',	'recaptcha-createaccount-fail' => 'לא הוקלדו מילות האישור, או שהוקלדו מילים לא נכונות. נסו שנית.',	'recaptcha-create' => 'אינכם משתמש רשום.כהגנה מפני ספאם אוטומטי, אנא הקלידו את שתי המילים שלהלן. תודה.',

),

/* Japanese - 日本語 */ 'ja' => array(       'recaptcha-edit' => '自動編集スパムからの保護のため、下の画像に表示されている２つの言葉を入力 してください. ',         'recaptcha-addurl' => 'あなたの編集は新しい外部リンクを含んでいます. 自動スパムからの保護のた め、下の画像に表示されている２つの言葉を入力してください. ',    'recaptcha-badpass' => '自動パスワードクラッキングからの保護のために、下の画像に表示されている２ つの言葉を入力してください. ',	'recaptcha-createaccount' => '自動アカウント登録からの保護のために、下の画像に表示されている２つの言葉 を入力してください. ',	'recaptcha-createaccount-fail' => '入力された文字列が正しくありません. ',	'recaptcha-create' => '自動ページ作成からの保護のために、下の画像に表示されている２つの言葉を入 力してください. ',

),

/* TODO - more languages */ );

} ?>