Handled domain determination when constant APP_URL is defined but empty.

Now the bahavior matches the comments in config.php:
// Fully qualified domain name of your webserver.
// If this is unset or empty, the servername is determined automatically.
// You *have to set this* if you are running Framadate behind a reverse proxy.
// const APP_URL = '<www.mydomain.fr>';
This commit is contained in:
Marc Karassev 2018-10-18 19:22:09 +02:00 committed by Paul B
parent 324ac9dfcb
commit b58e61c575
No known key found for this signature in database
GPG Key ID: DE331B23748D3A27

View File

@ -39,9 +39,11 @@ class Utils {
$dirname = $dirname === '\\' ? '/' : $dirname . '/';
$dirname = str_replace('/admin', '', $dirname);
$dirname = str_replace('/action', '', $dirname);
$server_name = (defined('APP_URL') ? APP_URL : $serverName) . $port . $dirname;
return $scheme . '://' . preg_replace('#//+#', '/', $server_name);
$appUrlConfig = defined('APP_URL') ? APP_URL : '';
$domain = $appUrlConfig === '' ? $serverName : $appUrlConfig;
return $scheme . '://' . preg_replace('#//+#', '/', $domain . $port . $dirname);
}
/**