mirror of
https://github.com/moodle/moodle.git
synced 2025-01-21 07:28:31 +01:00
Experimental way to get the server name from wwwroot instead of
using such SERVER_NAME and HTTP_HOST variables. It should help in servers having wrong Apache configurations, being the cause of bad logins, referer problems.... Seems to work both under PHP 4.3 (linux) and PHP 5 (MacOS X). Please, TEST it, specially in installation, upgrade and cron!
This commit is contained in:
parent
e889941458
commit
b6e2260398
@ -206,7 +206,13 @@ function get_referer() {
|
||||
*/
|
||||
function qualified_me() {
|
||||
|
||||
if (!empty($_SERVER['SERVER_NAME'])) {
|
||||
global $CFG;
|
||||
|
||||
$url = parse_url($CFG->wwwroot);
|
||||
|
||||
if (!empty($url['host'])) {
|
||||
$hostname = $url['host'];
|
||||
} else if (!empty($_SERVER['SERVER_NAME'])) {
|
||||
$hostname = $_SERVER['SERVER_NAME'];
|
||||
} else if (!empty($_ENV['SERVER_NAME'])) {
|
||||
$hostname = $_ENV['SERVER_NAME'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user