From cb4e5e5eb5e32f5a7fb71b618829df4bf0024b99 Mon Sep 17 00:00:00 2001 From: xiaomlove <353856593@qq.com> Date: Fri, 5 Mar 2021 19:43:40 +0800 Subject: [PATCH] fix getSchemeAndHttpHost() --- include/core.php | 3 +-- include/functions.php | 5 ++++- include/globalfunctions.php | 7 ++++--- nexus/Install/Install.php | 3 +-- public/bitbucket-upload.php | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/core.php b/include/core.php index c92a7beb..7e6bde8a 100644 --- a/include/core.php +++ b/include/core.php @@ -11,8 +11,7 @@ if (!file_exists($rootpath . '.env')) { $installScriptRelativePath = 'install/install.php'; $installScriptFile = $rootpath . "public/$installScriptRelativePath"; if (file_exists($installScriptFile)) { - header('Location: ' . getBaseUrl() . '/' . $installScriptRelativePath); - exit(0); + redirect($installScriptRelativePath); } } ini_set('date.timezone', config('nexus.timezone')); diff --git a/include/functions.php b/include/functions.php index 1e13fcf1..57ee5c4a 100644 --- a/include/functions.php +++ b/include/functions.php @@ -4534,7 +4534,10 @@ function getFullDirectory($dir) if (!is_dir($dir)) { $dir = ROOT_PATH . $dir; } - return realpath($dir); + if (is_dir($dir)) { + return realpath($dir); + } + return $dir; } function checkGuestVisit() diff --git a/include/globalfunctions.php b/include/globalfunctions.php index 906ab429..32b85c4f 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -403,9 +403,10 @@ function getSchemeAndHttpHost() $protocol = $isHttps ? 'https' : 'http'; $port = $_SERVER['SERVER_PORT']; $result = "$protocol://" . $_SERVER['HTTP_HOST']; - if ((!$isHttps && $port != 80) || ($isHttps && $port != 443)) { - $result .= ":$port"; - } + //HTTP_HOST include port +// if ((!$isHttps && $port != 80) || ($isHttps && $port != 443)) { +// $result .= ":$port"; +// } return $result; } diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 453818af..daab3cc4 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -261,8 +261,7 @@ class Install public function gotoStep($step) { - header('Location: ' . getBaseUrl() . "?step=$step"); - exit(0); + redirect(getBaseUrl() . "?step=$step"); } public function maxStep() diff --git a/public/bitbucket-upload.php b/public/bitbucket-upload.php index bd06660e..92dd9dc7 100644 --- a/public/bitbucket-upload.php +++ b/public/bitbucket-upload.php @@ -21,7 +21,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") $pp=pathinfo($filename = $file["name"]); if($pp['basename'] != $filename) stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_bad_file_name']); - $tgtfile = "$bitbucket/$filename"; + $tgtfile = getFullDirectory("$bitbucket/$filename"); if (file_exists($tgtfile)) stderr($lang_bitbucketupload['std_upload_failed'], $lang_bitbucketupload['std_file_already_exists'].htmlspecialchars($filename).$lang_bitbucketupload['std_already_exists'],false);