From b608b227bac4efba76da43dabe9bc2e32fb8fa32 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Tue, 6 Dec 2011 11:44:13 +0100 Subject: [PATCH] MDL-27364 use https for recaptcha when site runs via https Based on solution by Rajesh Taneja. --- lib/form/recaptcha.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/form/recaptcha.php b/lib/form/recaptcha.php index 79b2cb1f9b1..0282efdf0d4 100644 --- a/lib/form/recaptcha.php +++ b/lib/form/recaptcha.php @@ -34,10 +34,13 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input { * */ function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) { + global $CFG; parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes); $this->_type = 'recaptcha'; - if (!empty($attributes['https'])) { - $this->_https = $attributes['https']; + if (!empty($attributes['https']) or strpos($CFG->httpswwwroot, 'https:') === 0) { + $this->_https = true; + } else { + $this->_https = false; } }