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

View File

@@ -15,7 +15,7 @@ if (!file_exists($rootpath . '.env')) {
$installScriptRelativePath = 'install/install.php';
$installScriptFile = $rootpath . "public/$installScriptRelativePath";
if (file_exists($installScriptFile)) {
header('Location: ' . getBaseUrl() . $installScriptRelativePath);
header('Location: ' . getBaseUrl() . '/' . $installScriptRelativePath);
exit(0);
}
}

View File

@@ -2715,6 +2715,9 @@ function set_langfolder_cookie($folder, $expires = 0x7fffffff)
function get_protocol_prefix()
{
global $securelogin;
if (isHttps()) {
return "https://";
}
if ($securelogin == "yes") {
return "https://";
} elseif ($securelogin == "no") {

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, '/');
}