From 86ab02cac6f2aebf107276c83df418d8d8c7f27a Mon Sep 17 00:00:00 2001 From: zhaoxiang <756958008@qq.com> Date: Mon, 21 Nov 2016 00:51:05 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E5=AE=8C=E6=88=90=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/install/controller/Index.php | 19 ++++++++++++++++++- application/install/view/index/complete.html | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/application/install/controller/Index.php b/application/install/controller/Index.php index acb53e4..4adc7dc 100644 --- a/application/install/controller/Index.php +++ b/application/install/controller/Index.php @@ -5,6 +5,17 @@ use app\admin\model\User; use think\Controller; class Index extends Controller { + + protected function _initialize() { + $noVerify = ['index', 'complete']; + if (in_array($this->request->action(), $noVerify)) { + return true; + } + if (is_file(APP_PATH . 'extra' . DS . 'install.lock')) { + $this->error('已经成功安装了本系统,请不要重复安装!', 'http://'.$_SERVER['HTTP_HOST']); + } + } + public function index(){ session('step', 1); session('error', false); @@ -144,13 +155,19 @@ class Index extends Controller { $this->error('安装出错', url('index')); }else{ session('step', 4); - $this->redirect('complete'); + $str = ""; + exit($str); } } } } public function complete(){ + if(session('step') !== 4){ + $this->error('请正确安装系统', url('index')); + } + file_put_contents(APP_PATH .'extra' . DS . 'install.lock', 'lock'); + session(null); return $this->fetch(); } diff --git a/application/install/view/index/complete.html b/application/install/view/index/complete.html index b540b9a..fd2bda6 100644 --- a/application/install/view/index/complete.html +++ b/application/install/view/index/complete.html @@ -4,8 +4,8 @@