mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-13 18:07:00 +00:00
bd5c5d494e
1. change in preparation for ExtensionRegistration. Bug: T88047 Change-Id: Ia3b84d3cb71832749ae73774dadb292dc4b9157b
65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Captcha class using the reCAPTCHA widget.
|
|
* Stop Spam. Read Books.
|
|
*
|
|
* @addtogroup Extensions
|
|
* @author Mike Crawford <mike.crawford@gmail.com>
|
|
* @copyright Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
|
* @licence MIT/X11
|
|
*/
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
exit;
|
|
}
|
|
|
|
require_once __DIR__ . '/ConfirmEdit.php';
|
|
$wgCaptchaClass = 'ReCaptcha';
|
|
|
|
$wgMessagesDirs['ReCaptcha'] = __DIR__ . '/ReCaptcha/i18n';
|
|
$wgExtensionMessagesFiles['ReCaptcha'] = __DIR__ . '/ReCaptcha.i18n.php';
|
|
|
|
$wgAutoloadClasses['ReCaptcha'] = __DIR__ . '/ReCaptcha.class.php';
|
|
|
|
require_once( 'recaptchalib.php' );
|
|
|
|
// Set these in LocalSettings.php
|
|
$wgReCaptchaPublicKey = '';
|
|
$wgReCaptchaPrivateKey = '';
|
|
// For backwards compatibility
|
|
$recaptcha_public_key = '';
|
|
$recaptcha_private_key = '';
|
|
|
|
/**
|
|
* Sets the theme for ReCaptcha
|
|
*
|
|
* See http://code.google.com/apis/recaptcha/docs/customization.html
|
|
*/
|
|
$wgReCaptchaTheme = 'red';
|
|
|
|
$wgExtensionFunctions[] = 'efReCaptcha';
|
|
|
|
/**
|
|
* Make sure the keys are defined.
|
|
*/
|
|
function efReCaptcha() {
|
|
global $wgReCaptchaPublicKey, $wgReCaptchaPrivateKey;
|
|
global $recaptcha_public_key, $recaptcha_private_key;
|
|
global $wgServerName;
|
|
|
|
// Backwards compatibility
|
|
if ( $wgReCaptchaPublicKey == '' ) {
|
|
$wgReCaptchaPublicKey = $recaptcha_public_key;
|
|
}
|
|
if ( $wgReCaptchaPrivateKey == '' ) {
|
|
$wgReCaptchaPrivateKey = $recaptcha_private_key;
|
|
}
|
|
|
|
if ( $wgReCaptchaPublicKey == '' || $wgReCaptchaPrivateKey == '' ) {
|
|
die ( 'You need to set $wgReCaptchaPrivateKey and $wgReCaptchaPublicKey in LocalSettings.php to ' .
|
|
"use the reCAPTCHA plugin. You can sign up for a key <a href='" .
|
|
htmlentities( recaptcha_get_signup_url ( $wgServerName, "mediawiki" ) ) . "'>here</a>." );
|
|
}
|
|
}
|