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

@@ -4,7 +4,8 @@ if (function_exists("http_response_code")) {
} }
$http = G::is_https() ? "https" : "http"; $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']);
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login"; $urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
$urlHome = $urlLogin; $urlHome = $urlLogin;

View File

@@ -1,7 +1,7 @@
<?php <?php
$http = G::is_https() ? "https" : "http"; $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']);
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login"; $urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
$urlHome = $urlLogin; $urlHome = $urlLogin;

View File

@@ -608,7 +608,7 @@ function WSOpen($force = false)
); );
if (!isset($_SESSION["WS_END_POINT"])) { if (!isset($_SESSION["WS_END_POINT"])) {
$defaultEndpoint = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . config("system.workspace") . "/en/classic/services/wsdl2"; $defaultEndpoint = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/en/classic/services/wsdl2";
} }
$endpoint = isset($_SESSION["WS_END_POINT"]) ? $_SESSION["WS_END_POINT"] : $defaultEndpoint; $endpoint = isset($_SESSION["WS_END_POINT"]) ? $_SESSION["WS_END_POINT"] : $defaultEndpoint;

View File

@@ -324,14 +324,13 @@ class CaseScheduler extends BaseCaseScheduler
//Set variables //Set variables
$port = ""; $port = "";
if (isset($_SERVER["SERVER_PORT"])) {
$port = ($_SERVER["SERVER_PORT"] . "" != "80")? ":" . $_SERVER["SERVER_PORT"] : "";
} else {
if (defined("SERVER_PORT")) {
$port = (SERVER_PORT . "" != "80")? ":" . SERVER_PORT : "";
}
}
if (defined("SERVER_PORT")) {
$port = (SERVER_PORT . "" != "80")? ":" . SERVER_PORT : "";
}else{
$port = (isset($_SERVER['HTTP_HOST']) && strpos($_SERVER['HTTP_HOST'], ':') !== false) ? ':' . explode(':', $_SERVER['HTTP_HOST'])[1] : '';
}
$url = SERVER_NAME . $port . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/classic/services/wsdl2"; $url = SERVER_NAME . $port . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/classic/services/wsdl2";
$testConnection = true; $testConnection = true;

View File

@@ -1380,7 +1380,7 @@ class adminProxy extends HttpProxyController
$http = G::is_https() ? 'https' : 'http'; $http = G::is_https() ? 'https' : 'http';
$lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $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']);
$endpoint = sprintf( $endpoint = sprintf(
'%s://%s/sys%s/%s/%s/oauth2/grant', '%s://%s/sys%s/%s/%s/oauth2/grant',

View File

@@ -308,6 +308,9 @@ try {
$_CSERVER = $_SERVER; $_CSERVER = $_SERVER;
unset($_CSERVER['REQUEST_TIME']); unset($_CSERVER['REQUEST_TIME']);
unset($_CSERVER['REMOTE_PORT']); unset($_CSERVER['REMOTE_PORT']);
$host = '';
$port = 80;
if (!empty($_SERVER['HTTP_HOST'])) { if (!empty($_SERVER['HTTP_HOST'])) {
$hostParts = explode(':', $_SERVER['HTTP_HOST']); $hostParts = explode(':', $_SERVER['HTTP_HOST']);

View File

@@ -8,7 +8,7 @@ if (! empty($_GET['error'])) {
} }
$http = G::is_https() ? 'https' : 'http'; $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']);
$endpoint = sprintf('%s://%s/%s/oauth2/token', $http, $host, config("system.workspace")); $endpoint = sprintf('%s://%s/%s/oauth2/token', $http, $host, config("system.workspace"));
$code = empty($_GET['code']) ? 'NN' : $_GET['code']; $code = empty($_GET['code']) ? 'NN' : $_GET['code'];

View File

@@ -4,9 +4,8 @@ $filewsdl = PATH_METHODS . 'services' . PATH_SEP . 'pmos2.wsdl';
$content = file_get_contents($filewsdl); $content = file_get_contents($filewsdl);
$http = G::is_https() ? 'https' : 'http'; $http = G::is_https() ? 'https' : 'http';
$port = $_SERVER['SERVER_PORT'] === '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
$lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . $port . '/sys' . config("system.workspace") . '/' . $lang . '/lurana/services/soap2'; $endpoint = $http . '://' . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . $lang . '/lurana/services/soap2';
$content = str_replace("___SOAP_ADDRESS___", $endpoint, $content); $content = str_replace("___SOAP_ADDRESS___", $endpoint, $content);

View File

@@ -1,7 +1,7 @@
<?php <?php
$http = G::is_https() ? "https" : "http"; $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']);
$urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login"; $urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login";
$urlHome = $urlLogin; $urlHome = $urlLogin;

View File

@@ -3,7 +3,7 @@
} }
$http = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")? "https" : "http"; $http = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")? "https" : "http";
$host = $_SERVER["SERVER_NAME"] . (($_SERVER["SERVER_PORT"] != "80")? ":" . $_SERVER["SERVER_PORT"] : ""); $host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']);
$urlLogin = $http . "://" . $host . "/sys/en/luranasoft/login/login"; $urlLogin = $http . "://" . $host . "/sys/en/luranasoft/login/login";
$urlHome = $urlLogin; $urlHome = $urlLogin;

View File

@@ -199,7 +199,7 @@ class Installer
$http = G::is_https() ? 'https' : 'http'; $http = G::is_https() ? 'https' : 'http';
$lang = defined('SYS_LANG') ? SYS_LANG : 'en'; $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']; $workspace = $this->options['name'];
$endpoint = sprintf( $endpoint = sprintf(

View File

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

View File

@@ -148,7 +148,7 @@ class Server implements iAuthenticate
public function index() public function index()
{ {
$http = \G::is_https() ? 'https' : 'http'; $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; $host = $http .'://'. $host;
$applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace")); $applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace"));
@@ -184,7 +184,7 @@ class Server implements iAuthenticate
if (! isset($_SESSION['USER_LOGGED'])) { if (! isset($_SESSION['USER_LOGGED'])) {
$http = \G::is_https() ? 'https' : 'http'; $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']); $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); $loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("system.workspace"), SYS_LANG, SYS_SKIN, $redirect);

View File

@@ -25,7 +25,7 @@ if (isset ($_GET ['x'])) {
} }
} }
$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . config("system.workspace") . '/en/classic/services/wsdl2'; $defaultEndpoint = 'http://' . $_SERVER ['HTTP_HOST'] . '/sys' . config("system.workspace") . '/en/classic/services/wsdl2';
$wsdl = isset ($_SESSION ['END_POINT']) ? $_SESSION ['END_POINT'] : $defaultEndpoint; $wsdl = isset ($_SESSION ['END_POINT']) ? $_SESSION ['END_POINT'] : $defaultEndpoint;