Просмотр файла update_v6_to_v7.php

Размер файла: 7.19Kb
<?php

/***************************************************************************
 *
 *   Эта версия phpBB-WAP является бесплатным
 *   программным обеспечением и распространяется
 *   в рамках лицензии GNU General Public License.
 *   Автор модификации настоятельно не
 *   рекомендует распрострянять её так, как
 *   распространялась 5 версия мода.
 *
 ***************************************************************************/

include("config.php");
$connect = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname,$connect);

echo '<a href="index.php">Форумы</a>|Обновление<br/>';

$sql = array();
$sql[] = "CREATE TABLE " . $table_prefix . "shop_icq (id mediumint(10) auto_increment, icq_number bigint(20) default '0', icq_password varchar(255) default NULL, icq_cost mediumint(20) default '0', PRIMARY KEY (id))";
$sql[] = "CREATE TABLE " . $table_prefix . "shop_url (id mediumint(10) auto_increment, url varchar(255) default NULL, nazvanie varchar(255) default NULL, url_cost mediumint(20) default '0', PRIMARY KEY (id))";
$sql[] = "CREATE TABLE " . $table_prefix . "shop_sites (id mediumint(10) auto_increment, site_url varchar(255) default NULL, site_desc varchar(80) default NULL, site_time int(11) default '0', site_order mediumint(1) default '0', PRIMARY KEY (id))";
$sql[] = "CREATE TABLE " . $table_prefix . "medal (medal_id mediumint(8) UNSIGNED NOT NULL auto_increment, cat_id mediumint(8) UNSIGNED NOT NULL default '1', medal_name varchar(40) NOT NULL, medal_description varchar(255) NOT NULL, medal_image varchar(40) NULL, PRIMARY KEY (medal_id))";
$sql[] = "CREATE TABLE " . $table_prefix . "medal_user (issue_id mediumint(8) UNSIGNED NOT NULL auto_increment, medal_id mediumint(8) UNSIGNED NOT NULL, user_id mediumint(8) UNSIGNED NOT NULL, issue_reason varchar(255) NOT NULL, issue_time int(11) NOT NULL, PRIMARY KEY (issue_id))";
$sql[] = "CREATE TABLE " . $table_prefix . "medal_mod (mod_id mediumint(8) UNSIGNED NOT NULL auto_increment, medal_id mediumint(8) UNSIGNED NOT NULL, user_id mediumint(8) UNSIGNED NOT NULL, PRIMARY KEY (mod_id))";
$sql[] = "CREATE TABLE " . $table_prefix . "medal_cat (cat_id mediumint(8) UNSIGNED NOT NULL auto_increment, cat_title varchar(100) NOT NULL, cat_order mediumint(8) UNSIGNED NOT NULL default '0', PRIMARY KEY (cat_id), KEY cat_order (cat_order))";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_zvanie varchar(50) default ''";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_purse varchar(50) default ''";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_money_earned varchar(100) NOT NULL default '0'";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_money_payment varchar(100) NOT NULL default '0'";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_points int(100) NOT NULL default '0'";
$sql[] = "ALTER TABLE " . $table_prefix . "users CHANGE user_nic_color user_nic_color VARCHAR(100)";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_post_leng tinyint(8) NOT NULL default '0'";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD time_last_click int(12) default '0'";
$sql[] = "ALTER TABLE " . $table_prefix . "users ADD user_posl_red TINYINT not null DEFAULT '1'";
$sql[] = "ALTER TABLE " . $table_prefix . "forums ADD forum_money int(12) default '0'";
$sql[] = "UPDATE " . $table_prefix . "users SET user_nic_color = ''";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('min_login_regdate', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('shop', '1')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('pay_money', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('ref_url', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('kurs_payment', '1')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('money_payment', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('money_earned', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('smena_nika', '1000')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('smena_cveta', '500')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('smena_zvaniya', '300')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('pokupka_uchetki', '300')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('pokupka_uchetki_posts', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('pokupka_uchetki_nedeli', '8')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('razblokirovka_druga', '100')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('time_click', '100')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('time_last_click', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('sites', '1')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('verh_pay', '500')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('niz_pay', '300')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('verh', '3')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('niz', '3')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('allow_medal_display', '0')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('medal_display_row', '1')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('medal_display_col', '1')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('medal_display_width', '')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('medal_display_height', '')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('medal_display_order', '')";
$sql[] = "INSERT INTO " . $table_prefix . "config (config_name, config_value) VALUES ('posl_red', '1')";
$sql[] = "INSERT INTO " . $table_prefix . "medal_cat VALUES ('1', 'Default', '10')";

$errormsg = '';

for( $i = 0; $i < count($sql); $i++ )
{
	if( !$result = mysql_query($sql[$i]) )
	{
		$error = mysql_error();
		$errorsql = true;
		$errormsg .= $error['message'].'<br/>';
	}
	else
	{
		$errorsql = false;
	}
}

if($errorsql)
{
	echo '<span style="color:#FF1493">Обновление произошло с ошибками:</span><br/>';
	echo $errormsg;
} else {
	echo '<p>Обновление выполнено</p>';
}
echo '<p><span class="genmed">(c) Гутник Игорь, 2009</span></p>';
mysql_close($connect);

?>