• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/extlinks.php
  • Класс: CWebDavExtLinks
  • Вызов: CWebDavExtLinks::GetHttpHostUrl
static function GetHttpHostUrl()
{
	$protocol = (CMain::IsHTTPS() ? "https" : "http");
	$host = $_SERVER['HTTP_HOST'];
	$port = $_SERVER['SERVER_PORT'];
	if($port <> 80 && $port <> 443 && $port > 0 && mb_strpos($host, ":") === false)
	{
		$host .= ":".$port;
	}
	elseif($protocol == "http" && $port == 80)
	{
		$host = str_replace(":80", "", $host);
	}
	elseif($protocol == "https" && $port == 443)
	{
		$host = str_replace(":443", "", $host);
	}

	return ($protocol . "://" . $host);
}