diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:47 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:30:47 -0400 |
commit | 7e85254903c7c0cb49e381f16b18441ea7b058cc (patch) | |
tree | b22328fcf4c8408fc25a7acb73d1cb1089cd82ac /extensions/ConfirmEdit/includes/ConfirmEditHooks.php | |
parent | 1de335ad3f395ca6861085393ba366a9e3fb4a0d (diff) | |
parent | 1a365e77dfb8825136626202b1df462731b42060 (diff) |
Merge commit '1a365e'
Diffstat (limited to 'extensions/ConfirmEdit/includes/ConfirmEditHooks.php')
-rw-r--r-- | extensions/ConfirmEdit/includes/ConfirmEditHooks.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/extensions/ConfirmEdit/includes/ConfirmEditHooks.php b/extensions/ConfirmEdit/includes/ConfirmEditHooks.php index 5f9c3384..41c990f1 100644 --- a/extensions/ConfirmEdit/includes/ConfirmEditHooks.php +++ b/extensions/ConfirmEdit/includes/ConfirmEditHooks.php @@ -139,11 +139,36 @@ class ConfirmEditHooks { $wgCaptchaDirectory = "$wgUploadDirectory/captcha"; } } + /** * Callback for extension.json of ReCaptcha to require the recaptcha library php file. * FIXME: This should be done in a better way, e.g. only load the libraray, if really needed. */ public static function onReCaptchaSetup() { - require_once( "ReCaptcha/recaptchalib.php" ); + require_once( __DIR__ . '/../ReCaptcha/recaptchalib.php' ); + } + + /** + * Extension function, moved from ReCaptcha.php when that was decimated. + * Make sure the keys are defined. + */ + public static 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>." ); + } } } |