diff --git a/application/admin/controller/Base.php b/application/admin/controller/Base.php index f9ded73..8b59c18 100644 --- a/application/admin/controller/Base.php +++ b/application/admin/controller/Base.php @@ -113,9 +113,9 @@ class Base extends Controller { $sidNow = session_id(); $sidOld = cache($this->uid); if( isset($sidOld) && !empty($sidOld) ){ - if( $sidOld != $sidNow ){ - $this->error("您的账号在别的地方登录了,请重新登录!", url('User/login')); - }else{ + //if( $sidOld != $sidNow ){ + // $this->error("您的账号在别的地方登录了,请重新登录!", url('User/login')); + //}else{ cache($this->uid, $sidNow, config('online_time')); $this->userInfo = User::get([ $this->primaryKey => $this->uid ])->toArray(); // if( $this->userInfo['updateTime'] === 0 ){ @@ -125,7 +125,7 @@ class Base extends Controller { // $this->error('初次登录请设置用户昵称!', url('User/changeNickname')); // } // } - } + //} }else{ $this->error("登录超时,请重新登录!", url('User/login')); } diff --git a/application/install/common.php b/application/install/common.php index 3c58804..27e7ca8 100644 --- a/application/install/common.php +++ b/application/install/common.php @@ -13,62 +13,45 @@ * @author jry <598821125@qq.com> */ function check_env(){ - $items = array( - 'os' => array( + $items = [ + 'os' => [ 'title' => '操作系统', 'limit' => '不限制', 'current' => PHP_OS, - 'icon' => 'am-text-success am-icon-check', - ), - 'php' => array( + 'icon' => 'fa fa-check', + ], + 'php' => [ 'title' => 'PHP版本', - 'limit' => '5.3+', + 'limit' => '5.6+', 'current' => PHP_VERSION, - 'icon' => 'am-text-success am-icon-check', - ), - 'upload' => array( + 'icon' => 'fa fa-check', + ], + 'upload' => [ 'title' => '附件上传', 'limit' => '不限制', 'current' => ini_get('file_uploads') ? ini_get('upload_max_filesize'):'未知', - 'icon' => 'am-text-success am-icon-check', - ), -// 'gd' => array( -// 'title' => 'GD库', -// 'limit' => '2.0+', -// 'current' => '未知', -// 'icon' => 'am-text-success am-icon-check', -// ), - 'disk' => array( + 'icon' => 'fa fa-check', + ], + 'disk' => [ 'title' => '磁盘空间', 'limit' => '100M+', 'current' => '未知', - 'icon' => 'am-text-success am-icon-check', - ), - ); + 'icon' => 'fa fa-check', + ], + ]; //PHP环境检测 - if($items['php']['current'] < 5.3){ - $items['php']['icon'] = 'am-text-danger am-icon-close'; + if($items['php']['current'] < 5.6){ + $items['php']['icon'] = 'fa fa-close'; session('error', true); } -// //GD库检测 -// $tmp = function_exists('gd_info') ? gd_info() : array(); -// if(!$tmp['GD Version']){ -// $items['gd']['current'] = '未安装'; -// $items['gd']['icon'] = 'am-text-danger am-icon-close'; -// session('error', true); -// }else{ -// $items['gd']['current'] = $tmp['GD Version']; -// } -// unset($tmp); - //磁盘空间检测 if(function_exists('disk_free_space')){ $disk_size = floor(disk_free_space('./') / (1024*1024)).'M'; $items['disk']['current'] = $disk_size.'B'; if($disk_size < 100){ - $items['disk']['icon'] = 'am-text-danger am-icon-close'; + $items['disk']['icon'] = 'fa fa-close'; session('error', true); } } @@ -82,26 +65,20 @@ function check_env(){ * @author jry <598821125@qq.com> */ function check_dirfile(){ - $items = array( - '0' => array( + $items = [ + '0' => [ 'type' => 'file', - 'path' => APP_PATH . 'Common/Conf/db.php', + 'path' => ROOT_PATH . 'application/database.php', 'title' => '可写', - 'icon' => 'am-text-success am-icon-check', - ), - '1' => array( - 'type' => 'dir', - 'path' => APP_PATH . 'Common/Conf', - 'title' => '可写', - 'icon' => 'am-text-success am-icon-check', - ), - '2' => array( + 'icon' => 'fa fa-check', + ], + '2' => [ 'type' => 'dir', 'path' => RUNTIME_PATH, 'title' => '可写', - 'icon' => 'am-text-success am-icon-check', - ) - ); + 'icon' => 'fa fa-check', + ] + ]; foreach ($items as &$val){ $path = $val['path']; @@ -109,11 +86,11 @@ function check_dirfile(){ if(!is_writable($path)){ if(is_dir($path)) { $val['title'] = '不可写'; - $val['icon'] = 'am-text-danger am-icon-close'; + $val['icon'] = 'fa fa-close'; session('error', true); }else{ $val['title'] = '不存在'; - $val['icon'] = 'am-text-danger am-icon-close'; + $val['icon'] = 'fa fa-close'; session('error', true); } } @@ -121,13 +98,13 @@ function check_dirfile(){ if(file_exists($path)){ if(!is_writable($path)){ $val['title'] = '不可写'; - $val['icon'] = 'am-text-danger am-icon-close'; + $val['icon'] = 'fa fa-close'; session('error', true); } }else{ if(!is_writable(dirname($path))){ $val['title'] = '不存在'; - $val['icon'] = 'am-text-danger am-icon-close'; + $val['icon'] = 'fa fa-close'; session('error', true); } } @@ -147,51 +124,59 @@ function check_func_and_ext(){ 'name' => 'pdo', 'title' => '支持', 'current' => extension_loaded('pdo'), - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => true ], [ 'type' => 'ext', - 'name' => 'mongoDB', + 'name' => 'mongoDB(不必须)', 'title' => '支持', 'current' => extension_loaded('mongo'), - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => false ], [ 'type' => 'ext', - 'name' => 'Redis', + 'name' => 'Redis(不必须)', 'title' => '支持', 'current' => extension_loaded('redis'), - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => false ], [ 'type' => 'func', 'name' => 'file_get_contents', 'title' => '支持', - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => true ], [ 'type' => 'func', 'name' => 'mb_strlen', 'title' => '支持', - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => true ], [ 'type' => 'func', 'name' => 'shell_exec', 'title' => '支持', - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => true ], [ 'type' => 'com', - 'name' => 'mongodump', + 'name' => 'mongodump(不必须)', 'title' => '支持', - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => false ], [ 'type' => 'com', - 'name' => 'mongorestore', + 'name' => 'mongorestore(不必须)', 'title' => '支持', - 'icon' => 'am-text-success am-icon-check', + 'icon' => 'fa fa-check', + 'isMust' => false ] ]; foreach($items as &$val){ @@ -199,23 +184,29 @@ function check_func_and_ext(){ case 'ext': if(!$val['current']){ $val['title'] = '不支持'; - $val['icon'] = 'am-text-danger am-icon-close'; - session('error', true); + $val['icon'] = 'fa fa-close'; + if( $val['isMust'] ){ + session('error', true); + } } break; case 'func': if(!function_exists($val['name'])){ $val['title'] = '不支持'; - $val['icon'] = 'am-text-danger am-icon-close'; - session('error', true); + $val['icon'] = 'fa fa-close'; + if( $val['isMust'] ){ + session('error', true); + } } break; case 'com': $com = 'which '.$val['name']; if(shell_exec($com) == null){ $val['title'] = '不支持'; - $val['icon'] = 'am-text-danger am-icon-close'; - session('error', true); + $val['icon'] = 'fa fa-close'; + if( $val['isMust'] ){ + session('error', true); + } } break; } @@ -241,9 +232,9 @@ function write_config($config, $type){ } //写入应用配置文件 if(file_put_contents(APP_PATH . 'Common/Conf/'.$type.'.php', $conf)){ - show_msg('配置文件'.$type.'写入成功', 'am-text-success'); + show_msg('配置文件'.$type.'写入成功', 'bg-success'); }else{ - show_msg('配置文件'.$type.'写入失败!', 'am-text-danger'); + show_msg('配置文件'.$type.'写入失败!', 'bg-danger'); session('error', true); } return true; diff --git a/application/install/controller/Index.php b/application/install/controller/Index.php index 8af3c1d..46b3be7 100644 --- a/application/install/controller/Index.php +++ b/application/install/controller/Index.php @@ -5,6 +5,37 @@ use think\Controller; class Index extends Controller { public function index() { + session('step', 1); + session('error', false); return $this->fetch(); } + + public function step2(){ + if($this->request->isAjax()){ + if(session('error')){ + $this->error('环境检测没有通过,请调整环境后重试!'); + }else{ + $this->success('恭喜您环境检测通过', url('step3')); + } + }else{ + $step = 1; + if($step != 1){ + $this->error("请按顺序安装", url('step1')); + }else{ + session('step', 2); + session('error', false); + + //环境检测 + $this->assign('check_env', check_env()); + + //目录文件读写检测 + $this->assign('check_dirfile', check_dirfile()); + + //函数及扩展库检测 + $this->assign('check_func_and_ext', check_func_and_ext()); + + return $this->fetch(); + } + } + } } diff --git a/application/install/view/index/index.html b/application/install/view/index/index.html index e13089c..2d7bdfe 100644 --- a/application/install/view/index/index.html +++ b/application/install/view/index/index.html @@ -16,8 +16,8 @@

本服务条款一旦发生变更, {:config('COMPANY_NAME')}将在官网上公布修改内容。修改后的服务条款一旦在网站公布即有效代替原来的服务条款。您可随时登陆官网查阅最新版服务条款。如果您选择接受本条款,即表示您同意接受协议各项条件的约束。如果您不同意本服务条款,则不能获得使用本服务的权利。您若有违反本条款规定,{:config('COMPANY_NAME')}有权随时中止或终止您对{:config('PRODUCT_NAME')}产品的使用资格并保留追究相关法律责任的权利。

在理解、同意、并遵守本协议的全部条款后,方可开始使用{:config('PRODUCT_NAME')}产品。您也可能与{:config('COMPANY_NAME')}直接签订另一书面协议,以补充或者取代本协议的全部或者任何部分。

{:config('COMPANY_NAME')}拥有{:config('PRODUCT_NAME')}的全部知识产权,包括商标和著作权。虽然在大部分情况下您都可以自由的进行修改、复制、下载、安装、使用或者以其他方式受益于本软件的功能或者知识产权。但是{:config('COMPANY_NAME')}还是希望您能在底部保留我们的链接和版权声明!

- - + 同意安装协议 + 不同意 {/block} \ No newline at end of file diff --git a/application/install/view/index/step2.html b/application/install/view/index/step2.html new file mode 100644 index 0000000..fdf4959 --- /dev/null +++ b/application/install/view/index/step2.html @@ -0,0 +1,75 @@ +{extend name="public/base" /} +{block name="title"}系统安装Step2{/block} +{block name="nav"} +
  • 安装协议
  • +
  • 环境检测
  • +
  • 参数设置
  • +
  • 开始安装
  • +
  • 安装完成
  • +{/block} +{block name="main"} +
    +
    {:config('PRODUCT_NAME')} 环境检测
    +
    + + + + + + + + + + + {volist name="check_env" id="item"} + + + + + + {/volist} + +

    运行环境检查

    项目所需配置当前配置
    {$item['title']}{$item['limit']} {$item['current']}
    + + + + + + + + + + + {volist name="check_dirfile" id="item"} + + + + + + {/volist} + +

    目录、文件权限检查

    目录/文件所需状态当前状态
    {$item['path']}可写 {$item['title']}
    + + + + + + + + + + {volist name="check_func_and_ext" id="item"} + + + + + {/volist} + +

    函数及扩展依赖性检查

    名称检查结果
    {$item['name']} {$item['title']}
    +
    + 下一步 + 上一步 +
    +
    +
    +{/block} \ No newline at end of file diff --git a/application/install/view/public/base.html b/application/install/view/public/base.html index 69d5321..bd48bd7 100644 --- a/application/install/view/public/base.html +++ b/application/install/view/public/base.html @@ -58,7 +58,7 @@
    -
    +
    {block name="main"}{/block}
    @@ -88,5 +88,6 @@ + diff --git a/runtime/.gitignore b/runtime/.gitignore deleted file mode 100644 index c96a04f..0000000 --- a/runtime/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file