Merge branch 'encrypt' into php8

This commit is contained in:
xiaomlove
2021-06-01 23:34:57 +08:00
5 changed files with 52 additions and 32 deletions

View File

@@ -424,9 +424,12 @@ function isHttps()
function getSchemeAndHttpHost()
{
global $BASEURL;
if (isRunningInConsole()) {
return $BASEURL;
}
$isHttps = isHttps();
$protocol = $isHttps ? 'https' : 'http';
$port = $_SERVER['SERVER_PORT'];
$result = "$protocol://" . $_SERVER['HTTP_HOST'];
return $result;
@@ -576,3 +579,8 @@ function nexus_trans($key, $replace = [], $locale = null)
do_log("key: $key, replace: " . nexus_json_encode($replace) . ", locale: $locale, getKey: $getKey, result: $result");
return $result;
}
function isRunningInConsole(): bool
{
return php_sapi_name() == 'cli';
}