fix tracker url and takeinvite.php

This commit is contained in:
xiaomlove
2021-02-28 02:47:13 +08:00
parent 9d6f25670a
commit 3bf4b83826
5 changed files with 21 additions and 11 deletions
+8 -2
View File
@@ -387,10 +387,16 @@ function arr_set(&$array, $key, $value)
return $array;
}
function isHttps()
{
$result = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
return $result;
}
function getSchemeAndHttpHost()
{
$isHttps = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
$isHttps = isHttps();
$protocol = $isHttps ? 'https' : 'http';
$port = $_SERVER['SERVER_PORT'];
$result = "$protocol://" . $_SERVER['HTTP_HOST'];
@@ -411,5 +417,5 @@ function getBaseUrl()
} else {
$url .= $requestUri;
}
return $url;
return trim($url, '/');
}