multiple SERVER_PORT references updated to use HTTP_HOST

This commit is contained in:
IsaiDiaz
2025-07-02 12:07:52 -04:00
parent ba7e70fcd9
commit 615f0ff5a0
14 changed files with 24 additions and 24 deletions

View File

@@ -199,7 +199,7 @@ class Installer
$http = G::is_https() ? 'https' : 'http';
$lang = defined('SYS_LANG') ? SYS_LANG : 'en';
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] !== '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']);
$workspace = $this->options['name'];
$endpoint = sprintf(

View File

@@ -1645,10 +1645,8 @@ class System
*/
public static function getServerPort()
{
$port = "";
if (isset($_SERVER['SERVER_PORT'])) {
$port = $_SERVER['SERVER_PORT'];
} else if (defined('SERVER_PORT')) {
$port = "80";
if (defined('SERVER_PORT')) {
$port = SERVER_PORT;
}
return $port;

View File

@@ -148,7 +148,7 @@ class Server implements iAuthenticate
public function index()
{
$http = \G::is_https() ? 'https' : 'http';
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']);
$host = $http .'://'. $host;
$applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace"));
@@ -184,7 +184,7 @@ class Server implements iAuthenticate
if (! isset($_SESSION['USER_LOGGED'])) {
$http = \G::is_https() ? 'https' : 'http';
$host = $http . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$host = $http . '://' . $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']);
$redirect = urlencode('/'.self::$workspace.$_SERVER['REQUEST_URI']);
$loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("system.workspace"), SYS_LANG, SYS_SKIN, $redirect);