/*------------------------------------------------------ */
//-- 记录管理员帐号,安装完成
/*------------------------------------------------------ */
case 'done' :
include_once(ROOT_PATH . 'data/config.php');
include_once(ROOT_PATH . 'includes/cls_ecshop.php');
include_once(ROOT_PATH . "includes/adodb/adodb.inc.php");
/* 创建 ECSHOP 对象 */
$ecs = new ECS($db_name, $prefix);
/* 初始化数据库类 */
$db = &NewADOConnection('mysql');
$db->Connect($db_host, $db_user, $db_pass, $db_name);
$db->query("SET NAMES utf8");
$mysql_ver = $db->GetOne("SELECT VERSION()");
/* 写入管理员帐号 */
$sql = "INSERT INTO $prefix"."admin_user ".
"(user_name, email, password, join_time, last_time, action_list, nav_list)".
"VALUES ".
"('$_POST[admin_name]', '$_POST[admin_email]', '".md5($_POST['admin_password']). "', CURDATE(), CURDATE(), 'all', '')";
$db->query($sql) or die($db->ErrorMsg());
/* 设置验证码策略 */
$enable_admin_captcha = '0';
$enable_comment_captcha = '0';
if (isset($_POST['captcha']))
{
if (count($_POST['captcha']) == 2)
{
$enable_admin_captcha = '1';
$enable_comment_captcha = '1';
}
else
{
if ($_POST['captcha'][0] == 1)
{
$enable_admin_captcha = '1';
}
elseif ($_POST['captcha'][0] == 2)
{
$enable_comment_captcha = '1';
}
}
}
$sql = "UPDATE $prefix"."shop_config SET value='$enable_admin_captcha' WHERE code='enable_captcha'";
$db->Execute($sql) or die($db->ErrorMsg());
$sql = "UPDATE $prefix"."shop_config SET value='$enable_comment_captcha' WHERE code='comment_captcha'";
$db->Execute($sql) or die($db->ErrorMsg());
/* 初始化友情链接 */
$sql = "INSERT INTO $prefix"."friend_link ".
"(link_name, link_url, link_logo, show_order)".
"VALUES ".
"('".$lang['default_friend_link']."', 'http://www.ecshop.com/', 'http://www.ecshop.com/images/logo/ecshop_logo.gif','0')";
$db->Execute($sql) or die($db->ErrorMsg());
/* 更新 ECSHOP 安装日期 */
$sql = "UPDATE $prefix"."shop_config SET value='" .time(). "' WHERE code='install_date'";
$db->query($sql);
/* 更新 ECSHOP 版本 */
$sql = "UPDATE $prefix"."shop_config SET value='" .VERSION. "' WHERE code='ecs_version'";
$db->query($sql);
/* 安装模板 */
include_once(ROOT_PATH . "admin/includes/lib_template.php");
$template_install = true;
if(!install_template("default"))
{
$template_install = false;
}
/* 写入安装锁定文件 */
$fp = fopen(ROOT_PATH . 'data/install.lock', 'wb+');
if (!$fp)
{
$step = 'message';
$message = $_LANG['open_installlock_error'];
}
fwrite(