Fix $_SERVER['SERVER_PORT'] handling
While installing Framadate on Apache, but proxyfied by an Nginx, $_SERVER['SERVER_PORT'] failed to be correctly handled. $_SERVER['SERVER_PORT'] is then a string and not an integer, so it was added in the response of get_server_name() function, breaking all the css/js links. I don't know if there is other situations where the bug appears. Schema of the installation: Nginx (443) -> Apache2 (80) + Framadate Please note that using port 80 on Nginx worked.
This commit is contained in:
parent
c5b50050c9
commit
c4ec2bbc41
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user