1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 09:23:09 +02:00

MDL-63770 core: 'port' should be an integer like in parse_url()

Plus trivial comment cleanup.
This commit is contained in:
Matteo Scaramuccia 2020-05-03 23:46:18 +02:00 committed by Jun Pataleta
parent 1983718149
commit 7910fa322a

@ -897,8 +897,9 @@ function initialise_fullme() {
$_SERVER['SERVER_PORT'] = 443; // Assume default ssl port for the proxy.
}
// hopefully this will stop all those "clever" admins trying to set up moodle
// with two different addresses in intranet and Internet
// Hopefully this will stop all those "clever" admins trying to set up moodle
// with two different addresses in intranet and Internet.
// Port forwarding is still allowed!
if (!empty($CFG->reverseproxy) && $rurl['host'] === $wwwroot['host'] && (empty($wwwroot['port']) || $rurl['port'] === $wwwroot['port'])) {
print_error('reverseproxyabused', 'error');
}
@ -950,7 +951,7 @@ function setup_get_remote_url() {
} else {
$rurl['host'] = null;
}
$rurl['port'] = $_SERVER['SERVER_PORT'];
$rurl['port'] = (int)$_SERVER['SERVER_PORT'];
$rurl['path'] = $_SERVER['SCRIPT_NAME']; // Script path without slash arguments
$rurl['scheme'] = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] === 'off' or $_SERVER['HTTPS'] === 'Off' or $_SERVER['HTTPS'] === 'OFF') ? 'http' : 'https';