Skip to content

Commit

Permalink
Add the httpsrequired() function to be 100% SSL in some pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Jul 14, 2005
1 parent 5d87b5d commit 4de514f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/moodlelib.php
Expand Up @@ -5770,6 +5770,26 @@ function address_in_subnet($addr, $subnetstr) {
return $found;
}

/**
* This function sets the $HTTPSPAGEREQUIRED global
* (used in some parts of moodle to change some links)
* and calculate the proper wwwroot to be used
*
* By using this function properly, we can ensure 100% https-ized pages
* at our entire discretion (login, forgot_password, change_password)
*/
function httpsrequired() {

global $CFG, $HTTPSPAGEREQUIRED;

if (!empty($CFG->loginhttps)) {
$HTTPSPAGEREQUIRED = true;
$CFG->httpswwwroot = str_replace('http', 'https', $CFG->wwwroot);
} else {
$CFG->httpswwwroot = $CFG->wwwroot;
}
}

/**
* For outputting debugging info
*
Expand Down

0 comments on commit 4de514f

Please sign in to comment.