mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Add the httpsrequired() function to be 100% SSL in some pages.
Merged from MOODLE_15_STABLE
This commit is contained in:
parent
8d9d840a50
commit
d7697d0ec0
1 changed files with 20 additions and 0 deletions
|
@ -5958,6 +5958,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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue