From 802f85076ae4247a505aa9f03929e238d06d120c Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Thu, 9 Jan 2014 13:44:49 +0000 Subject: [PATCH] MDL-43632 mod_feedback: Use SSL for reCAPTCHA API request if Moodle is using it --- mod/feedback/item/captcha/lib.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mod/feedback/item/captcha/lib.php b/mod/feedback/item/captcha/lib.php index f790a658daa..b676f6b675b 100644 --- a/mod/feedback/item/captcha/lib.php +++ b/mod/feedback/item/captcha/lib.php @@ -231,9 +231,17 @@ class feedback_item_captcha extends feedback_item_base { ' . $strgetanimagecaptcha . ' '; + + // Check if we are using SSL. + if (strpos($CFG->wwwroot, 'https://') === 0) { + $ssl = true; + } else { + $ssl = false; + } + //we have to rename the challengefield if (!empty($CFG->recaptchaprivatekey) AND !empty($CFG->recaptchapublickey)) { - $captchahtml = recaptcha_get_html($CFG->recaptchapublickey, null); + $captchahtml = recaptcha_get_html($CFG->recaptchapublickey, null, $ssl); echo $html.$captchahtml; } }