From 83fa4afc83a21afd8f07b9d68d5fa611dca3ef4f Mon Sep 17 00:00:00 2001 From: liyuchun <563917701@qq.com> Date: Thu, 28 Apr 2022 09:02:44 +0000 Subject: [PATCH 1/2] * Fix bug #17968. --- module/install/control.php | 12 ++++++++++++ module/install/css/common.css | 1 + module/install/lang/en.php | 3 +++ module/install/lang/zh-cn.php | 3 +++ module/install/view/step1.html.php | 7 +++++-- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/module/install/control.php b/module/install/control.php index 6cff26c16d..8334068fc6 100644 --- a/module/install/control.php +++ b/module/install/control.php @@ -93,6 +93,18 @@ class install extends control $this->view->sessionInfo = $sessionInfo; } + $notice = ''; + if($this->config->framework->filterCSRF) + { + $httpType = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http'; + if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https'; + if(isset($_SERVER['REQUEST_SCHEME']) and strtolower($_SERVER['REQUEST_SCHEME']) == 'https') $httpType = 'https'; + + $httpHost = zget($_SERVER, 'HTTP_HOST', ''); + if(empty($httpHost) or strpos($this->server->http_referer, "$httpType://$httpHost") !== 0) $notice = $this->lang->install->CSRFNotice; + } + + $this->view->notice = $notice; $this->display(); } diff --git a/module/install/css/common.css b/module/install/css/common.css index 9d5cdec9ec..9d67a924d8 100644 --- a/module/install/css/common.css +++ b/module/install/css/common.css @@ -3,6 +3,7 @@ body {background: #f1f1f1;} .modal-dialog {width: 100%; margin-top: 20px;} .modal-footer {text-align: center; margin-top: 0;} .w-350px {width: 350px;} +.text-notice {padding-left: 20px; padding-bottom: 20px;} .table,.alert {margin: 0;} .table+.alert {margin-top: 20px;} diff --git a/module/install/lang/en.php b/module/install/lang/en.php index bef83bd594..05fd01f835 100644 --- a/module/install/lang/en.php +++ b/module/install/lang/en.php @@ -153,6 +153,9 @@ $lang->install->save2File = '