<?php
/*
+------------------------------------------------
|   IPBM HACK 资料库数据修改                     
|   若您的资料库前置名称并非 xoops_
|   请修改下列所有 xoops_ 为您的资料库前置名称
|   本档案请放至 xoops根目录\modules\ipboard 下
+------------------------------------------------
*/
require "./conf_global.php";

$INFO['sql_driver'] = !$INFO['sql_driver'] ? 'mySQL' : $INFO['sql_driver'];

$to_require = "./sources/Drivers/".$INFO['sql_driver'].".php";
require ($to_require);

$DB = new db_driver;

$DB->obj['sql_database']     = $INFO['sql_database'];
$DB->obj['sql_user']         = $INFO['sql_user'];
$DB->obj['sql_pass']         = $INFO['sql_pass'];
$DB->obj['sql_host']         = $INFO['sql_host'];
$DB->obj['sql_tbl_prefix']   = $INFO['sql_tbl_prefix'];

// 新增数据如下

$DB->connect();
$query[] = "ALTER TABLE  xoops_users add deposit int(20) default '0'";
$query[] = "ALTER TABLE  xoops_users add bank_last_visit int(10) default '0'";
$query[] = "ALTER TABLE `xoops_ipb_topics` ADD `kernel` TINYINT(1)  DEFAULT '0' NOT NULL AFTER pinned";
$query[] = "ALTER TABLE `xoops_ipb_moderators` ADD `kernel_topic` TINYINT(1)  AFTER unpin_topic";
$query[] = "ALTER TABLE `xoops_ipb_moderators` ADD `unkernel_topic` TINYINT(1)  AFTER kernel_topic";
$query[] = "ALTER TABLE `xoops_ipb_topics` ADD `ann` TINYINT(1)  DEFAULT '0' NOT NULL AFTER pinned";
$query[] = "ALTER TABLE xoops_users add kernel_posts int(5) default '0'";
$query[] = "ALTER TABLE xoops_users add delete_posts int(5) default '0'";
$query[] = "ALTER TABLE `xoops_users` ADD `money` INT(10)  DEFAULT \"0\" AFTER avatar_size";
$query[] = "ALTER TABLE `xoops_ipb_forums` ADD `coef_money` SMALLINT(5)  DEFAULT \"1\" NOT NULL AFTER inc_postcount";
$query[] = "ALTER TABLE `xoops_ipb_posts` ADD `post_price` MEDIUMINT(5)  DEFAULT '0' AFTER `post`"; 
$query[] = "ALTER TABLE `xoops_ipb_posts` ADD `attach_price` MEDIUMINT(5)  DEFAULT '0' AFTER `attach_file`";
$query[] = "ALTER TABLE `xoops_ipb_groups` ADD `g_sale_post` MEDIUMINT(5)  DEFAULT '0' AFTER `g_post_closed`"; 
$query[] = "CREATE TABLE xoops_ipb_sale (
  sid int(10) NOT NULL auto_increment,
  tid int(10) NOT NULL default '0',
  pid int(10) NOT NULL default '0',
  mode enum('p','a') NOT NULL default 'p',
  customer text,
  PRIMARY KEY  (pid,sid,tid)
) TYPE=MyISAM";
$query[] = "CREATE TABLE  xoops_ipb_bank (
id int(10) NOT  NULL auto_increment, id_send int NOT  NULL default '', 
name_send varchar (32)  NOT  NULL default '', 
id_receive int NOT  NULL default '',
 name_receive varchar (32)  NOT  NULL default '',
 money int NOT  NULL default '', 
PRIMARY KEY  (id)
) TYPE=MyISAM";


for($i=0; $i<count($query); $i++)
{
	$DB->query($query[$i]);
}
$DB->close_db();
unlink("db_hack.php");
echo "Ok，资料库数据已更新修改完成，请检查论坛根目录下db_hack.php，如果仍然存在，则<font color=#FF0000>立即删除</font>！";

?>
