Exemple #1
0
                }
            } 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';
    @unlink($dbfile);
    define('IN_SYS', true);
    require IA_ROOT . '/framework/bootstrap.inc.php';
    require IA_ROOT . '/web/common/bootstrap.sys.inc.php';
    $_W['uid'] = $_W['isfounder'] = 1;
    load()->web('common');
    load()->web('template');
    load()->model('setting');
    load()->model('cache');
    cache_build_frame_menu();
    cache_build_setting();
            $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);
    require_once IA_ROOT . '/source/bootstrap.inc.php';
    require_once IA_ROOT . '/source/model/setting.mod.php';
    $_W['uid'] = $_W['isfounder'] = 1;
    cache_build_setting();
    cache_build_announcement();
    cache_build_modules();
    cache_build_fans_struct();
    cache_build_hook();
    tpl_install_finish();
}