Merge branch 'fix-SERVER_PORT-handling' into 'develop'

Fix $_SERVER['SERVER_PORT'] handling

See merge request framasoft/framadate!229
This commit is contained in:
Thomas Citharel 2018-03-02 12:03:43 +01:00
commit d8abafc78e

View File

@ -26,7 +26,7 @@ class Utils {
*/ */
public static function get_server_name() { public static function get_server_name() {
$scheme = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 'https' : 'http'; $scheme = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')) ? 'https' : 'http';
$port = in_array($_SERVER['SERVER_PORT'], [80, 443], true) ? '' : ':' . $_SERVER['SERVER_PORT']; $port = in_array($_SERVER['SERVER_PORT'], ['80', '443'], true) ? '' : ':' . $_SERVER['SERVER_PORT'];
$dirname = dirname($_SERVER['SCRIPT_NAME']); $dirname = dirname($_SERVER['SCRIPT_NAME']);
$dirname = $dirname === '\\' ? '/' : $dirname . '/'; $dirname = $dirname === '\\' ? '/' : $dirname . '/';
$dirname = str_replace('/admin', '', $dirname); $dirname = str_replace('/admin', '', $dirname);