<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ use ModStart\Core\Util\EnvUtil; use ModStart\Core\Util\FileUtil; goto wL2cK; y3Epp: ?>
 安装助手</title>
    <style type="text/css">
        body, html {
            min-height: 100%;
        }
        body {
            background-image:url("data:image/svg+xml;base64,<?php  goto M1U2U; M1U2U: echo base64_encode('<?xml version="1.0" encoding="UTF-8"?><svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><text x="50%" y="50%" font-size="16" fill="#444444" style="transform:rotate(-45deg);transform-origin:center;" font-family="system-ui,sans-serif" text-anchor="middle" dominant-baseline="middle">' . INSTALL_APP_NAME . ' V' . INSTALL_APP_VERSION . '</text></svg>'); goto cCUky; SHNIC: echo base64_encode('<?xml version="1.0" encoding="UTF-8"?><svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><text x="50%" y="50%" font-size="10" fill="#EEEEEE" style="transform:rotate(-45deg);transform-origin:center;" font-family="system-ui,sans-serif" text-anchor="middle" dominant-baseline="middle">' . INSTALL_APP_NAME . ' V' . INSTALL_APP_VERSION . '</text></svg>'); goto cSK6g; MFkAp: ?>
<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit">
    <script src="/asset/vendor/jquery.js"></script>
    <script src="/asset/common/base.js"></script>
    <script src="/asset/layui/layui.js"></script>
    <link rel="stylesheet" href="/asset/vendor/iconfont/iconfont.css">
    <link rel="stylesheet" href="/asset/layui/css/layui.css">
    <link rel="stylesheet" href="/asset/theme/default/style.css">
    <title><?php  goto owI8W; wL2cK: include __DIR__ . '/function.php'; goto MFkAp; owI8W: echo INSTALL_APP_NAME . ' V' . INSTALL_APP_VERSION; goto y3Epp; wF5Y0: if (file_exists(APP_PATH . '/storage/install.lock')) { ?>
        <div class="ub-alert ub-alert-danger ub-text-center">系统无需重复安装</div>
    <?php  } else { goto RXi45; wJ3oL: ?>
                            <?php  goto FU3NA; GMAn1: ?>
                            <?php  goto tW6br; jGa97: class_exists('pdo') ? text_success('PHP pdo 扩展') : text_error('缺少 PHP pdo 扩展'); goto Lur5R; iWcdz: ?>
"/>
                                </div>
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 数据库名</label>
                                    <input type="text" style="width:100%;" name="db_database"
                                           value="<?php  goto QIULA; A0VgA: ?>
"/>
                                </div>
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 密码</label>
                                    <input type="text" style="width:100%;" name="password"
                                           placeholder="<?php  goto wAunV; g0MWd: ?>
                <a href="javascript:;" class="<?php  goto UGFA8; y7IRa: ?>
                            <?php  goto CpWt9; vUAWv: ?>
" />
                            <a href="javascript:;" onclick="switch_step('env')" class="btn btn-lg btn-round">
                                上一步
                            </a>
                            <a href="javascript:;" onclick="doSubmit();" class="btn btn-primary btn-lg btn-round">
                                确定安装
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <?php  goto fBZxO; KZVp4: ?>
                            <div data-rewrite-check>
                                <div class="status loading"><div class="ub-alert">Rewrite规则检测中...</div></div>
                                <div class="status success" style="display:none;"><?php  goto aNYsw; wAunV: echo htmlspecialchars(get_env_config('admin_password')); goto zOqDe; UGFA8: if (!defined('LICENSE_URL')) { echo 'active'; } goto J5cfe; c4vX3: ?>
                            <?php  goto SCqdX; gi3S_: class_exists('ZipArchive') ? text_success('PHP zip 扩展') : text_error('缺少 PHP zip 扩展'); goto GMAn1; hzXTp: ?>
                            <?php  goto jGa97; rsecq: echo INSTALL_APP_NAME . ' V' . INSTALL_APP_VERSION; goto Vg_u4; i5GyH: is_dir_really_writable(APP_PATH . '/bootstrap/cache/') ? text_success('/bootstrap/cache/目录可写') : text_error('/bootstrap/cache/目录不可写'); goto KZVp4; RX5zD: ?>
                            <?php  goto CJQ9h; k1Dew: if (defined('LICENSE_URL')) { goto XOoSi; VwI7o: echo LICENSE_URL; goto mDQkb; XOoSi: ?>
                    <div class="step-content-item active" data-step="license">
                        <div class="content-item-body">
                            <iframe src="<?php  goto VwI7o; mDQkb: ?>
"></iframe>
                        </div>
                        <div class="content-item-foot">
                            <div>
                                <div style="color:red;padding-bottom:1rem;">
                                    禁止使用本产品进行违法违规业务，我们将对违规使用者停止授权并永久封停账号
                                </div>
                                <label style="border:none;margin-top:-10px;margin-right:0;padding-right:0;">
                                    <input type="checkbox" name="installLicense" style="vertical-align:middle;margin-right:0.2rem;" value="1"/>
                                    我已阅读协议并同意所有内容
                                </label>
                            </div>
                            <div style="margin-top:0.5rem;">
                                <a href="javascript:;" class="btn btn-primary btn-lg btn-round" onclick="doStepEnv()">
                                    下一步
                                </a>
                            </div>
                            <script>
                                function doStepEnv(){
                                    if(!$('[name="installLicense"]').is(':checked')){
                                        window.api.dialog.tipError('请先同意协议');
                                        return false;
                                    }
                                    switch_step('env');
                                    return false;
                                }
                            </script>
                        </div>
                    </div>
                <?php  goto km4Bj; km4Bj: } goto ra3LH; zOqDe: ?>
"/>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="content-item-foot">
                        <?php  goto vYrqf; bSPK3: echo htmlspecialchars(get_env_config('db_username')); goto i6CXL; QWdQw: ?>
                            <?php  goto ij5Ck; hw81Y: function_exists('exif_read_data') ? text_success('PHP exif 扩展') : text_error('缺少 PHP exif 扩展'); goto umDfj; R_L3u: ?>
                            <?php  goto gi3S_; QIULA: echo htmlspecialchars(get_env_config('db_name')); goto woKSq; u157O: function_exists('finfo_file') ? text_success('PHP fileinfo 扩展') : text_error('缺少 PHP fileinfo 扩展'); goto yVxh4; P8sU2: ?>
                    </div>
                </div>
                <div class="step-content-item ub-form" data-step="form">
                    <div class="content-item-body">
                        <div class="ub-panel" style="background:#F8F8F8;">
                            <div class="head">
                                <div class="title">
                                    <i class="iconfont icon-credit"></i>
                                    MySQL数据库
                                </div>
                            </div>
                            <div class="body">
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 主机</label>
                                    <input type="text" style="width:100%;" name="db_host"
                                           value="<?php  goto xuJF5; dkXEQ: text_success('系统：' . PHP_OS); goto QqDmw; f2zRW: if (defined('LICENSE_URL')) { ?>
                    <a href="javascript:;" class="active" data-step="license">
                        <i class="iconfont icon-file"></i>
                        安装协议
                    </a>
                    <i class="iconfont icon-angle-right"></i>
                <?php  } goto g0MWd; aNYsw: text_success('Rewrite规则正确'); goto cv5EW; QqDmw: ?>
                            <?php  goto Cu0Ng; FU3NA: is_dir_really_writable(APP_PATH . '/storage/') ? text_success('/storage/目录可写') : text_error('/storage/目录不可写'); goto y7IRa; qGkUA: if (!empty($NE3lh)) { goto INtFr; INtFr: ?>
                            <div class="ub-panel" style="background:#F8F8F8;">
                                <div class="head">
                                    <div class="title">
                                        <i class="iconfont icon-cog"></i>
                                        应用配置信息
                                    </div>
                                </div>
                                <div class="body">
                                    <?php  goto OpP9Z; Xnd2S: ?>
                                </div>
                            </div>
                        <?php  goto d18bA; OpP9Z: if (!empty($NE3lh['envs'])) { goto qdhEd; uYFE0: ?>
                                    <?php  goto zedkP; qdhEd: ?>
                                        <?php  goto RL3l9; RL3l9: foreach ($NE3lh['envs'] as $WmdMf) { goto ozn18; JfcxW: echo htmlspecialchars($WmdMf['label']); goto isfyU; EQIiy: ?>
</div>
                                                </div>
                                            </div>
                                        <?php  goto CffXj; ozn18: ?>
                                            <div class="line">
                                                <div class="label"><span class="ub-text-danger">*</span> <?php  goto JfcxW; isfyU: ?>
</div>
                                                <div class="field">
                                                    <input class="form" type="text" name="<?php  goto lrYmX; Sjm_s: ?>
" value="<?php  goto V0Pu6; V0Pu6: echo htmlspecialchars($WmdMf['default']); goto YWWlE; wEFKo: echo $WmdMf['desc']; goto EQIiy; YWWlE: ?>
" />
                                                    <div class="help"><?php  goto wEFKo; lrYmX: echo $WmdMf['name']; goto Sjm_s; CffXj: } goto uYFE0; zedkP: } goto Xnd2S; d18bA: } goto EewOv; iPDJ7: text_error('Rewrite规则错误', 'https://modstart.com/doc/install/qa.html#q-rewrite%E8%A7%84%E5%88%99', false); goto u0bHL; lIUf7: is_dir_really_writable(APP_PATH . '/bootstrap/') ? text_success('/bootstrap/目录可写') : text_error('/bootstrap/目录不可写'); goto wJ3oL; Cu0Ng: php_version_ok() ? text_success('PHP版本 ' . PHP_VERSION) : text_error('PHP版本要求（' . php_version_requires() . '） 当前为 ' . PHP_VERSION); goto gEA3X; IwCLO: ?>
                            <?php  goto w8lWx; woKSq: ?>
"/>
                                </div>
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 用户名</label>
                                    <input type="text" style="width:100%;" name="db_username"
                                           value="<?php  goto bSPK3; SCqdX: function_exists('proc_get_status') ? text_success('proc_get_status 函数') : text_error('缺少 proc_get_status 函数', 'https://modstart.com/doc/install/qa.html'); goto z109R; YImiB: echo htmlspecialchars(get_env_config('db_port')); goto iWcdz; xIJur: function_exists('proc_open') ? text_success('proc_open 函数') : text_error('缺少 proc_open 函数', 'https://modstart.com/doc/install/qa.html'); goto IwCLO; Tjpk1: ?>
                            <?php  goto kPyNy; Lur5R: ?>
                            <?php  goto tRV2j; yYXHS: ?>
"/>
                                </div>
                                <div class="line">
                                    <label class="label">数据表前缀</label>
                                    <input type="text" style="width:100%;" name="db_prefix"
                                           value="<?php  goto Zs1VE; i6CXL: ?>
"/>
                                </div>
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 密码</label>
                                    <input type="text" style="width:100%;" name="db_password"
                                           value="<?php  goto p5B6c; kPyNy: function_exists('curl_init') ? text_success('PHP curl 扩展') : text_error('缺少 PHP curl 扩展'); goto R_L3u; EewOv: ?>
                        <div class="ub-panel" style="background:#F8F8F8;">
                            <div class="head">
                                <div class="title">
                                    <i class="iconfont icon-user-o"></i>
                                    后台管理信息
                                </div>
                            </div>
                            <div class="body">
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 用户</label>
                                    <input type="text" style="width:100%;" name="username"
                                           value="<?php  goto aQYbR; u0bHL: ?>
</div>
                                <div class="status error ub-alert ub-alert-warning" style="display:none;">
                                    <div>- 配置Nginx/Apache，保证访问 <a href="/install/ping" target="_blank">/install/ping</a> 出现 ok 字样。</div>
                                </div>
                            </div>
                            <div data-public-install-path-warning style="display:none;">
                                <?php  goto fge_I; HNheT: ?>
                            <?php  goto lIUf7; aQYbR: echo htmlspecialchars(get_env_config('admin_username')); goto A0VgA; CpWt9: is_dir_really_writable(APP_PATH . '/public/') ? text_success('/public/目录可写') : text_error('/public/目录不可写'); goto X7I8A; cv5EW: ?>
</div>
                                <div class="status error" style="display:none;"><?php  goto iPDJ7; yVxh4: ?>
                            <?php  goto xIJur; gDJMI: ?>
"/>
                                </div>
                                <div class="line">
                                    <label class="label"><span class="ub-text-danger">*</span> 端口</label>
                                    <input type="text" style="width:100%;" name="db_port"
                                           value="<?php  goto YImiB; xuJF5: echo htmlspecialchars(get_env_config('db_host')); goto gDJMI; Zs1VE: echo htmlspecialchars(get_env_config('db_prefix')); goto eHBKI; QHI3Q: text_success('最大上传：' . FileUtil::formatByte(EnvUtil::env('uploadMaxSize'))); goto Tjpk1; ra3LH: ?>
                <div class="step-content-item <?php  goto zpQgQ; vYrqf: if (defined('DEMO_DATA')) { ?>
                            <div>
                                <label style="border:none;margin-top:-10px;">
                                    <input type="checkbox" style="vertical-align:middle;" name="installDemo" value="1"/>
                                    初始化安装演示数据
                                </label>
                            </div>
                        <?php  } goto z0ty1; ij5Ck: function_exists('token_get_all') ? text_success('PHP tokenizer 扩展') : text_error('缺少 PHP tokenizer 扩展'); goto LSnc9; Vy_Zy: ?>
                            </div>
                            <script>
                                if(window.location.href.indexOf('public/install.php')>0){
                                    document.querySelector('[data-public-install-path-warning]').style.display = 'block';
                                }
                            </script>
                        </div>
                    </div>
                    <div class="content-item-foot">
                        <?php  goto pJc5E; fge_I: text_warning('安装路径为 public/install.php ，可能设置错了网站根目录，请仔细检查', 'https://modstart.com/doc/install/start.html#%E5%8F%82%E8%80%83%E9%85%8D%E7%BD%AE'); goto Vy_Zy; Ce0ra: if (version_compare(PHP_VERSION, '5.6.0', 'ge') && version_compare(PHP_VERSION, '5.7.0', 'lt')) { goto IKbE5; v6Hj2: ?>
                            <?php  goto lQWBP; IKbE5: ?>
                                <?php  goto SzNUc; SzNUc: EnvUtil::iniFileConfig('always_populate_raw_post_data') == '-1' ? text_success('验证 always_populate_raw_post_data=-1') : text_error('请配置 always_populate_raw_post_data=-1', 'https://modstart.com/doc/install/qa.html'); goto v6Hj2; lQWBP: } goto HNheT; z0ty1: ?>
                        <div style="margin-top:0.5rem;">
                            <input type="hidden" name="installLicense" value="1"/>
                            <input type="hidden" name="INSTALL_CONFIG" value="<?php  goto RApaJ; RZWZT: ?>
" data-step="env">
                    <div class="content-item-body">
                        <div style="margin:0 auto;">
                            <?php  goto dkXEQ; X7I8A: ?>
                            <?php  goto i5GyH; z109R: ?>
                            <?php  goto Ce0ra; Vg_u4: ?>
 安装
        </h1>
        <div class="pb-installer-box">
            <div class="step-menu">
                <?php  goto f2zRW; zpQgQ: if (!defined('LICENSE_URL')) { echo 'active'; } goto RZWZT; umDfj: ?>
                            <?php  goto u3QFv; w8lWx: function_exists('putenv') ? text_success('putenv 函数') : text_error('缺少 putenv 函数', 'https://modstart.com/doc/install/qa.html'); goto c4vX3; u3QFv: function_exists('bcmul') ? text_success('PHP bcmath 扩展') : text_error('缺少 PHP bcmath 扩展'); goto hzXTp; pJc5E: if (error_counter(0) > 0) { goto HtM4y; IGBjB: echo error_counter(0); goto aMsCW; aMsCW: ?>
 个问题再进行安装</div>
                        <?php  goto jyhST; HtM4y: ?>
                            <div class="ub-alert ub-alert-danger ub-text-center">请解决以上 <?php  goto IGBjB; jyhST: } else { if (!env_writable()) { ?>
                            <div class="ub-alert ub-alert-danger ub-text-center">/.env文件不可写，请手动配置安装</div>
                        <?php  } else { goto eFYQW; lYxWT: if (defined('LICENSE_URL')) { ?>
                                    <a href="javascript:;" class="btn btn-lg btn-round" onclick="switch_step('license')">
                                        上一步
                                    </a>
                                <?php  } goto vn6VE; vn6VE: ?>
                                <a href="javascript:;" class="btn btn-primary btn-lg btn-round" onclick="switch_step('form')">
                                    下一步
                                </a>
                            </div>
                        <?php  goto gKZ2g; eFYQW: ?>
                            <div style="display:none;margin-top:0.5rem;" data-step-env-next>
                                <?php  goto lYxWT; gKZ2g: } } goto P8sU2; G2Gcv: ?>
                            <?php  goto hw81Y; RApaJ: echo htmlspecialchars(json_encode(isset($NE3lh) ? $NE3lh : null)); goto vUAWv; tRV2j: class_exists('pdo') && in_array('mysql', PDO::getAvailableDrivers()) ? text_success('PHP PDO mysql 驱动') : text_error('缺少 PHP PDO mysql 驱动'); goto RX5zD; LSnc9: ?>
                            <?php  goto u157O; eHBKI: ?>
"/>
                                </div>
                            </div>
                        </div>
                        <?php  goto qGkUA; gEA3X: ?>
                            <?php  goto QHI3Q; tW6br: function_exists('openssl_open') ? text_success('PHP openssl 扩展') : text_error('缺少 PHP openssl 扩展'); goto G2Gcv; RXi45: ?>
        <h1 class="ub-text-center" style="color:#FFF;">
            <i class="iconfont icon-tools"></i>
            <?php  goto rsecq; CJQ9h: function_exists('mb_internal_encoding') ? text_success('PHP mbstring 扩展') : text_error('缺少 PHP mbstring 扩展'); goto QWdQw; p5B6c: echo htmlspecialchars(get_env_config('db_password')); goto yYXHS; J5cfe: ?>
" data-step="env">
                    <i class="iconfont icon-desktop"></i>
                    环境检查
                </a>
                <i class="iconfont icon-angle-right"></i>
                <a href="javascript:;" data-step="form">
                    <i class="iconfont icon-cog"></i>
                    配置安装
                </a>
            </div>
            <div class="step-content">
                <?php  goto k1Dew; fBZxO: } goto We12b; cCUky: ?>
");
        }
        .pb-installer-box{
            background-image:url("data:image/svg+xml;base64,<?php  goto SHNIC; cSK6g: ?>
");
            background-color:#FFF;
            border-radius:0.5rem;
        }
        .pb-installer-box .step-menu{
            padding:0 0.5rem;
            text-align: center;
            border-bottom:1px solid #EEE;
        }
        .pb-installer-box .step-menu a{
            display:inline-block;
            padding:0.8rem;
            color:var(--color-text);
            text-align:center;
            border-bottom:1px solid #EEE;
            font-size:0.8rem;
        }
        .pb-installer-box .step-menu > .iconfont{
            color:var(--color-muted);
            font-size:0.8rem;
        }
        .pb-installer-box .step-menu a.checked{
            color:var(--color-primary);
        }
        .pb-installer-box .step-menu a.active{
            color:var(--color-primary);
        }
        .pb-installer-box .step-content .step-content-item{
            display:none;
        }
        .pb-installer-box .step-content .step-content-item.active{
            display:block;
        }
        .pb-installer-box .step-content .step-content-item .content-item-body{
            padding:1rem;
        }
        .pb-installer-box .step-content .step-content-item .content-item-foot{
            padding: 1rem 1rem 2rem 1rem;
            text-align:center;
        }
        .pb-installer-box .step-content .step-content-item iframe{
            width:100%;
            border:1px solid #EEE;
            border-radius:0.25rem;
            height:calc( 100vh - 200px );
        }
    </style>
</head>
<body style="background-color:#333;padding:40px 0;">
<div style="width:960px;min-height:100vh;margin:0 auto;">

    <?php  goto wF5Y0; We12b: ?>
</div>
<script>
    function switch_step(name){
        $('.pb-installer-box .step-content .step-content-item').removeClass('active');
        $('.pb-installer-box .step-content .step-content-item[data-step='+name+']').addClass('active');
        $('.pb-installer-box .step-menu a').removeClass('active');
        $('.pb-installer-box .step-menu a[data-step='+name+']').addClass('active');
        return false;
    }
    $(function () {
        var $rewriteCheck = $('[data-rewrite-check]');
        $.ajax({
            url: '/install/ping',
            type: 'GET',
            success: function(data){
                if('ok'===data){
                    $rewriteCheck.find('.status').hide().filter('.success').show();
                    $('[data-step-env-next]').show();
                }else{
                    $rewriteCheck.find('.status').hide().filter('.error').show();
                }
            },
            error: function(data) {
                $rewriteCheck.find('.status').hide().filter('.error').show();
            }
        });
        window.doSubmit = function(){
            var data = {};
            var $form = $('.ub-form');
            $form.find('input[type=text],input[type=hidden]').each(function(i,o){
                data[$(o).attr('name')] = $(o).val();
            });
            $form.find('input[type=checkbox]:checked').each(function(i,o){
                data[$(o).attr('name')] = $(o).val();
            });
            window.api.dialog.loadingOn('正在提交表单..');
            window.api.base.post('/install/prepare',data,function(res){
                window.api.dialog.loadingOff();
                window.api.base.defaultFormCallback(res, {
                    success: function (res) {
                        window.api.dialog.loadingOn('正在安装系统，可能需要较长时间，请耐心等待...');
                        window.api.base.post('/install/execute',data,function(res){
                            window.api.dialog.loadingOff();
                            window.api.base.defaultFormCallback(res);
                        });
                    }
                })
            });
            return false;
        };
    });
</script>
</body>
</html>