From 3e9e014ff2e8778eab71f6dbc78b2b0864a1da83 Mon Sep 17 00:00:00 2001
From: Joe <joe@autistici.org>
Date: Tue, 10 Sep 2013 14:37:53 +0200
Subject: [PATCH] adding a define for the global public and private recaptcha
 keys.

- Fix all blogs that have an empty recaptcha key.
- require configuration for wp-recaptcha (to define the global keys)
---
 wp-content/plugins/wp-recaptcha-bp/recaptcha.php | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/wp-content/plugins/wp-recaptcha-bp/recaptcha.php b/wp-content/plugins/wp-recaptcha-bp/recaptcha.php
index 73461902f..7c16045ec 100644
--- a/wp-content/plugins/wp-recaptcha-bp/recaptcha.php
+++ b/wp-content/plugins/wp-recaptcha-bp/recaptcha.php
@@ -11,6 +11,7 @@
  * @link      http://www.google.com/recaptcha
  */
 
+require_once('config.php');
 require_once('wp-plugin.php');
 
 if (class_exists('ReCAPTCHAPlugin'))
@@ -115,8 +116,8 @@ class ReCAPTCHAPlugin extends WPPlugin
         $option_defaults = array();
         $old_options = WPPlugin::retrieve_options("recaptcha");
         if ($old_options) {
-           $option_defaults['site_key'] = $old_options['pubkey'];
-           $option_defaults['secret'] = $old_options['privkey'];
+           $option_defaults['site_key'] = $old_options['pubkey'] ? $old_options['pubkey'] : GLOBAL_RECAPTCHA_KEY;
+           $option_defaults['secret'] = $old_options['privkey'] ? $old_options['privkey'] : GLOBAL_RECAPTCHA_PRIVATE_KEY;
 
            // styling
            $option_defaults['recaptcha_language'] = $old_options['re_lang'];
@@ -126,14 +127,14 @@ class ReCAPTCHAPlugin extends WPPlugin
         } else {
            $old_options = WPPlugin::retrieve_options($this->options_name);
            if ($old_options) {
-               $option_defaults['site_key'] = $old_options['public_key'];
-               $option_defaults['secret'] = $old_options['private_key'];
+               $option_defaults['site_key'] = $old_options['public_key'] ? $old_options['pubkey'] : GLOBAL_RECAPTCHA_KEY;
+               $option_defaults['secret'] = $old_options['private_key'] ? $old_options['privkey'] : GLOBAL_RECAPTCHA_PRIVATE_KEY;
                $option_defaults['comments_theme'] = 'standard';
                $option_defaults['recaptcha_language'] = $old_options['recaptcha_language'];
                $option_defaults['no_response_error'] = $old_options['no_response_error'];
            } else {           
-               $option_defaults['site_key'] = '';
-               $option_defaults['secret'] = '';
+               $option_defaults['site_key'] = GLOBAL_RECAPTCHA_KEY;
+               $option_defaults['secret'] = GLOBAL_RECAPTCHA_PRIVATE_KEY;
                $option_defaults['comments_theme'] = 'standard';
                $option_defaults['recaptcha_language'] = 'en';
                $option_defaults['no_response_error'] =
-- 
GitLab