fix some SERVER_NAME references

This commit is contained in:
IsaiDiaz
2025-07-03 09:56:35 -04:00
parent f58158cb46
commit b1bea76b52
2 changed files with 6 additions and 5 deletions

View File

@@ -1630,10 +1630,11 @@ class System
public static function getServerHostname()
{
$host = "";
if (!empty($_SERVER['SERVER_NAME'])) {
$host = $_SERVER['SERVER_NAME'];
} else if (defined('SERVER_NAME')) {
if (defined('SERVER_NAME')) {
$host = SERVER_NAME;
} else {
$hostParts = explode(':', $_SERVER['HTTP_HOST'] ?? '');
$host = isset($hostParts[0]) ? $hostParts[0] : $_SERVER['SERVER_NAME'];
}
return $host;
}

View File

@@ -447,11 +447,11 @@ define('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/');
define('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
define('SERVER_NAME', $_SERVER['SERVER_NAME']);
$hostParts = explode(':', $_SERVER['HTTP_HOST'] ?? '');
$port = isset($hostParts[1]) && is_numeric($hostParts[1]) ? (int)$hostParts[1] : $_SERVER['SERVER_PORT'];
$host = isset($hostParts[0]) ? $hostParts[0] : $_SERVER['SERVER_NAME'];
define('SERVER_NAME', $host);
define('SERVER_PORT', $port);
// create memcached singleton