From c2350c7f5747dc3109d7a33aa2f12a3161258fda Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Feb 2017 22:13:21 -0800 Subject: [PATCH] web: try to get Recaptcha working on IE --- html/inc/account.inc | 8 ++++---- html/inc/recaptchalib.php | 13 ++++++------- html/inc/util.inc | 11 +++++++++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/html/inc/account.inc b/html/inc/account.inc index 5b4a9c02ba..cf379c2f90 100644 --- a/html/inc/account.inc +++ b/html/inc/account.inc @@ -19,6 +19,7 @@ // forms for account creation and login function create_account_form($teamid, $next_url) { + global $recaptcha_public_key; echo "
@@ -75,13 +76,12 @@ function create_account_form($teamid, $next_url) { ); } - // Check if we're reCaptcha to prevent spam accounts + // Check if we're using reCaptcha to prevent spam accounts // - $publickey = parse_config(get_config(), ""); - if ($publickey) { + if ($recaptcha_public_key) { row2( "", - boinc_recaptcha_get_html($publickey) + boinc_recaptcha_get_html($recaptcha_public_key) ); } diff --git a/html/inc/recaptchalib.php b/html/inc/recaptchalib.php index 6437fed987..6c55f424e5 100644 --- a/html/inc/recaptchalib.php +++ b/html/inc/recaptchalib.php @@ -22,16 +22,15 @@ require('../inc/recaptcha_loader.php'); function boinc_recaptcha_get_head_extra() { - // are we using recaptcha? - $publickey = parse_config(get_config(), ""); - if ($publickey) { + global $recaptcha_public_key; + if ($recaptcha_public_key) { // the meta tag must be included // for Recaptcha to work with some IE browsers return ' - '; - } else { - return null; + + '; } + return ""; } function boinc_recaptcha_get_html($publickey) { @@ -56,4 +55,4 @@ function boinc_recaptcha_isValidated($privatekey) { return true; } -?> \ No newline at end of file +?> diff --git a/html/inc/util.inc b/html/inc/util.inc index 18ae4b3122..b23aa75d52 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -31,7 +31,13 @@ require_once("../inc/translation.inc"); require_once("../inc/profile.inc"); require_once("../inc/bootstrap.inc"); -$master_url = parse_config(get_config(), ""); +// parse some stuff from config (do it here for efficiency) +// +$config = get_config(); +$master_url = parse_config($config , ""); +$no_computing = parse_bool($config, "no_computing"); +$recaptcha_public_key = parse_config($config, ""); +$recaptcha_private_key = parse_config($config, ""); // don't allow /... at the end of URL @@ -533,7 +539,8 @@ function check_tokens($auth) { } function no_computing() { - return parse_bool(get_config(), "no_computing"); + global $no_computing; + return $no_computing; } // Generates a legal filename from a parameter string.