Thread:Extension talk:ConfirmEdit/Enable setting of $wgReCaptchaPublicKey and $wgReCaptchaPrivateKey before including ConfirmEdit

With the current SVN revision of ConfirmEdit, if you set any of the key variables ('wgReCaptchaPublicKey', 'wgReCaptchaPrivateKey', 'recaptcha_public_key', and 'recaptcha_private_key') before including ReCaptcha.php, they are overwritten and set to an empty string, causing ReCaptcha to cause an error. I have created a patch (below and http://blucoders.net/wiki/images/7/79/ConfirmEdit-ReCaptcha-fix.diff) that checks to see if they are set or not before initializing them to a blank string.

Index: ReCaptcha.php

=
====================================================== --- ReCaptcha.php      (revision 107720) +++ ReCaptcha.php      (working copy) @@ -22,11 +22,10 @@ require_once( 'recaptchalib.php' );

// Set these in LocalSettings.php -$wgReCaptchaPublicKey = ''; -$wgReCaptchaPrivateKey = ''; -// For backwards compatibility -$recaptcha_public_key = ''; -$recaptcha_private_key = ''; +// The last two are for backwards compatibility +$blank_vars = array('wgReCaptchaPublicKey', 'wgReCaptchaPrivateKey', 'recaptcha_public_key', 'recaptcha_private_key'); +foreach ($blank_vars as $varname) +       if (!isset($$varname)) $$varname = '';

/** * Sets the theme for ReCaptcha

79.160.59.72 15:04, 31 December 2011 (UTC)