Merge branch 'w51_MDL-30613_m22_FULLME' of git://github.com/skodak/moodle into MOODLE_22_STABLE

This commit is contained in:
Aparup Banerjee 2011-12-12 15:05:37 +08:00
commit b750cfde81
4 changed files with 10 additions and 4 deletions

View file

@ -270,7 +270,7 @@ class user_picture implements renderable {
* @return moodle_url * @return moodle_url
*/ */
public function get_url(moodle_page $page, renderer_base $renderer = null) { public function get_url(moodle_page $page, renderer_base $renderer = null) {
global $CFG, $FULLME; global $CFG;
if (is_null($renderer)) { if (is_null($renderer)) {
$renderer = $page->get_renderer('core'); $renderer = $page->get_renderer('core');
@ -329,7 +329,7 @@ class user_picture implements renderable {
// Build a gravatar URL with what we know. // Build a gravatar URL with what we know.
// If the currently requested page is https then we'll return an // If the currently requested page is https then we'll return an
// https gravatar page. // 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))); $imageurl = new moodle_url("https://secure.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $imageurl->out(false)));
} else { } else {
$imageurl = new moodle_url("http://www.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $imageurl->out(false))); $imageurl = new moodle_url("http://www.gravatar.com/avatar/{$md5}", array('s' => $size, 'd' => $imageurl->out(false)));

View file

@ -1185,6 +1185,8 @@ class moodle_page {
} }
// now the real test and redirect! // 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) { if (strpos($FULLME, 'https:') !== 0) {
// this may lead to infinite redirect on misconfigured sites, in that case use $CFG->loginhttps=0; in /config.php // this may lead to infinite redirect on misconfigured sites, in that case use $CFG->loginhttps=0; in /config.php
redirect($this->_url); redirect($this->_url);

View file

@ -341,6 +341,10 @@ global $MCACHE;
/** /**
* Full script path including all params, slash arguments, scheme and host. * 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 * @global string $FULLME
* @name $FULLME * @name $FULLME
*/ */

View file

@ -1127,8 +1127,8 @@ function lti_get_launch_container($lti, $toolconfig) {
} }
function lti_request_is_using_ssl() { function lti_request_is_using_ssl() {
global $FULLME; global $CFG;
return (stripos($FULLME, 'https://') === 0); return (stripos($CFG->httpswwwroot, 'https://') === 0);
} }
function lti_ensure_url_is_https($url) { function lti_ensure_url_is_https($url) {