Example #1
0
            if (file_exists(IA_ROOT . '/index.php') && is_dir(IA_ROOT . '/web') && file_exists($verfile) && file_exists($dbfile)) {
                $dat = (require $dbfile);
                if (empty($dat) || !is_array($dat)) {
                    die('<script type="text/javascript">alert("安装包不正确, 数据安装脚本缺失.");history.back();</script>');
                }
                foreach ($dat['schemas'] as $schema) {
                    $sql = local_create_sql($schema);
                    local_run($sql);
                }
                foreach ($dat['datas'] as $data) {
                    local_run($data);
                }
            } else {
                die('<script type="text/javascript">alert("你正在使用本地安装, 但未下载完整安装包, 请从微擎官网下载完整安装包后重试.");history.back();</script>');
            }
            $salt = local_salt(8);
            $password = sha1("{$user['password']}-{$salt}-{$authkey}");
            mysql_query("INSERT INTO {$db['prefix']}users (username, password, salt, joindate) VALUES('{$user['username']}', '{$password}', '{$salt}', '" . time() . "')");
            local_mkdirs(IA_ROOT . '/data');
            file_put_contents(IA_ROOT . '/data/config.php', $config);
            touch(IA_ROOT . '/data/install.lock');
            setcookie('action', 'finish');
            header('location: ?refresh');
            exit;
        }
    }
    tpl_install_db($error);
}
if ($action == 'finish') {
    setcookie('action', '', -10);
    $dbfile = IA_ROOT . '/data/db.php';
Example #2
0
                if (file_exists(IA_ROOT . '/index.php') && file_exists(IA_ROOT . '/setting.php') && file_exists($verfile)) {
                    $sql = file_get_contents(IA_ROOT . '/data/install.sql');
                    if (empty($sql)) {
                        die('<script type="text/javascript">alert("安装包不正确, 数据安装脚本缺失.");history.back();</script>');
                    }
                    runquery($sql);
                } else {
                    die('<script type="text/javascript">alert("你正在使用本地安装, 但未下载完整安装包, 请从WORMWOOD官网下载完整安装包后重试.");history.back();</script>');
                }
            }
            $salt = local_salt(8);
            $password = sha1("{$adminpwd}-{$salt}-{$authkey}");
            mysql_query("INSERT INTO {$dbprefix}members (username, password, salt, joindate) VALUES('{$adminuser}', '{$password}', '{$salt}', '" . time() . "')");
            $uid = mysql_insert_id();
            //新建默认公众号
            $wechat = array('hash' => local_salt(5), 'type' => '1', 'uid' => $uid, 'token' => local_salt(32), 'access_token' => '', 'name' => '默认公众号', 'account' => '默认公众号', 'original' => '', 'signature' => '', 'country' => '', 'province' => '', 'city' => '', 'username' => '', 'password' => '', 'welcome' => '欢迎信息', 'default' => '默认回复', 'default_period' => '0', 'lastupdate' => '', 'key' => '', 'secret' => '', 'styleid' => '1');
            mysql_query("INSERT INTO `{$dbprefix}wechats` (`" . implode("`,`", array_keys($wechat)) . "`) VALUES ('" . implode("','", $wechat) . "')");
            local_mkdirs(IA_ROOT . '/data');
            file_put_contents(IA_ROOT . '/data/config.php', $config);
            touch(IA_ROOT . '/data/install.lock');
            setcookie('action', 'finish');
            header('location: ?refresh');
            exit;
        }
    }
    tpl_install_db($error_msg);
}
if ($action == 'finish') {
    setcookie('action', '', -10);
    @unlink(IA_ROOT . '/data/install.sql');
    define('IN_SYS', true);