diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index c5c204674af..16f1fe27f9a 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -270,7 +270,7 @@ class user_picture implements renderable { * @return moodle_url */ public function get_url(moodle_page $page, renderer_base $renderer = null) { - global $CFG, $FULLME; + global $CFG; if (is_null($renderer)) { $renderer = $page->get_renderer('core'); @@ -329,7 +329,7 @@ class user_picture implements renderable { // Build a gravatar URL with what we know. // If the currently requested page is https then we'll return an // https gravatar page. - if (strpos($FULLME, 'https://') === 0) { + if (strpos($CFG->httpswwwroot, 'https:') === 0) { $imageurl = new moodle_url("https://secure.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $imageurl->out(false))); } else { $imageurl = new moodle_url("http://www.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $imageurl->out(false))); diff --git a/lib/pagelib.php b/lib/pagelib.php index f01e74ceaad..aafe23a79dc 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1185,6 +1185,8 @@ class moodle_page { } // now the real test and redirect! + // NOTE: do NOT use this test for detection of https on current page because this code is not compatible with SSL proxies, + // instead use strpos($CFG->httpswwwroot, 'https:') === 0 if (strpos($FULLME, 'https:') !== 0) { // this may lead to infinite redirect on misconfigured sites, in that case use $CFG->loginhttps=0; in /config.php redirect($this->_url); diff --git a/lib/setup.php b/lib/setup.php index 2b51b1bd4ea..2f0f1e4f1fa 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -341,6 +341,10 @@ global $MCACHE; /** * Full script path including all params, slash arguments, scheme and host. + * + * Note: Do NOT use for getting of current page URL or detection of https, + * instead use $PAGE->url or strpos($CFG->httpswwwroot, 'https:') === 0 + * * @global string $FULLME * @name $FULLME */ diff --git a/mod/lti/locallib.php b/mod/lti/locallib.php index 53425a3d144..74f0276046f 100644 --- a/mod/lti/locallib.php +++ b/mod/lti/locallib.php @@ -1127,8 +1127,8 @@ function lti_get_launch_container($lti, $toolconfig) { } function lti_request_is_using_ssl() { - global $FULLME; - return (stripos($FULLME, 'https://') === 0); + global $CFG; + return (stripos($CFG->httpswwwroot, 'https://') === 0); } function lti_ensure_url_is_https($url) {