Location: PHPKode > projects > MGB OpenSource Guestbook > install/upgrade/068.php
<?php
	/*
	MGB 0.6.x - OpenSource PHP and MySql Guestbook
	Copyright (C) 2004 - 2011 Juergen Grueneisl - http://www.m-gb.org/

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
	*/

	// ======= //
	// 068.php //
	// ======= //
	//
	// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //

$sql = array();

$sql[1] = "ALTER TABLE `".$db['prefix']."settings` ADD `gravatar_type` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `gravatar_rating` ,
          ADD `gravatar_size` INT( 3 ) NOT NULL DEFAULT '50' AFTER `gravatar_type` ,
          ADD `gravatar_position` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `gravatar_size` ";
$sqldescription[1] = "- Adding improved gravatar support...";

$sql[2] = "ALTER TABLE `".$db['prefix']."settings` ADD `entries_order_asc_desc` VARCHAR( 4 ) NOT NULL DEFAULT 'DESC' AFTER `entries_order` ,
		   ADD `entries_numbering` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `entries_order_asc_desc` ,
		   CHANGE `entries_order` `entries_order` VARCHAR( 11 ) NOT NULL DEFAULT 'ID' ";
$sqldescription[2] = "- Adding fields for improved entries ordering...";

$sql[3] = "ALTER TABLE `".$db['prefix']."settings` ADD `smileys_break` INT( 2 ) NOT NULL DEFAULT '11' AFTER `smileys` ,
		   ADD `smileys_order` VARCHAR( 4 ) NOT NULL DEFAULT 'ASC' AFTER `smileys_break` ";
$sqldescription[3] = "- Adding fields for improved smiley editing...";

$sql[4] = "INSERT INTO ".$db['prefix']."smilies ( 
	  `ID` ,
	  `path` ,
	  `replacement` ,
	  `height` ,
	  `width`
	  ) VALUES 	( NULL , 'smiley_fun.gif', ':fun:, ^^', '15', '15' ),
				( NULL , 'smiley_doubt.gif', ':doubt:', '15', '15' ),
				( NULL , 'smiley_neutral.gif', ':neutral:, :|, :-|', '15', '15' ),
				( NULL , 'smiley_redface.gif', ':redface:', '15', '15' ),
				( NULL , 'smiley_rolleyes.gif', ':rolleyes:', '15', '15' ),
				( NULL , 'smiley_silenced.gif', ':silenced:', '15', '15' ),
				( NULL , 'smiley_cry.gif', ':cry:, :\'(, :\'-(', '15', '15' ),
				( NULL , 'smiley_doh.gif', ':doh:', '15', '15' ),
				( NULL , 'icon_arrow.gif', ':arrow:, ->', '15', '15' ),
				( NULL , 'icon_exclaim.gif', ':exclaim:', '15', '15' ),
				( NULL , 'icon_question.gif', ':question:', '15', '15' );";
$sqldescription[4] = "- Adding new smilies...";

$sql[5] = "UPDATE `".$db['prefix']."settings` SET `entries_order` = 'ID'";
$sqldescription[5] = "- Changing value of field 'entries_order'...";

$sql[6] = "ALTER TABLE `".$db['prefix']."settings` ADD `password_min_length` TINYINT( 2 ) NOT NULL DEFAULT '8' AFTER `session_timeout` ";
$sqldescription[6] = "- Adding field for minimum password length...";

$sql[7] = "ALTER TABLE `".$db['prefix']."settings` ADD `allow_img_tag` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `bbcode`,
		   ADD `max_img_width` INT( 4 ) NOT NULL DEFAULT '400' AFTER `allow_img_tag` ,
		   ADD `max_img_height` INT( 4 ) NOT NULL DEFAULT '400' AFTER `max_img_width`,
		   ADD `center_img` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `max_img_height` ,
		   ADD `allow_flash_tag` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `center_img`,
		   ADD `max_flash_width` INT( 4 ) NOT NULL DEFAULT '400' AFTER `allow_flash_tag` ,
		   ADD `max_flash_height` INT( 4 ) NOT NULL DEFAULT '400' AFTER `max_flash_width`,
		   ADD `center_flash` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `max_flash_height`,
		   ADD `captcha_coords_x` INT( 3 ) NOT NULL DEFAULT '20' AFTER `captcha_method` ,
		   ADD `captcha_coords_y` INT( 3 ) NOT NULL DEFAULT '25' AFTER `captcha_coords_x` ,
		   ADD `captcha_color` VARCHAR( 6 ) NOT NULL DEFAULT '505050' AFTER `captcha_coords_y` ,
		   ADD `captcha_angle_1` INT( 4 ) NOT NULL DEFAULT '-10' AFTER `captcha_color` ,
		   ADD `captcha_angle_2` INT( 4 ) NOT NULL DEFAULT '5' AFTER `captcha_angle_1` ";
$sqldescription[7] = "- Adding fields necessary for [img] and [flash]-Tag and for improved captcha options...";

$sql[8] = "ALTER TABLE `".$db['prefix']."settings` 
			ADD `wrong_captcha_count` INT( 2 ) NOT NULL DEFAULT '5' AFTER `captcha_angle_2` ,
			ADD `spam_mail` VARCHAR( 255 ) NOT NULL AFTER `gravatar_position` ,
			ADD `banlist_emails` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `spam_mail` ,
			ADD `banlist_domains` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `banlist_emails` ,
			ADD `banlist_ips` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `banlist_domains` ,
			ADD `banlist_log` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `banlist_ips` ,
			ADD `timezone` VARCHAR( 255 ) NOT NULL DEFAULT 'Europe/Berlin' AFTER `h_description` ,
			ADD `captcha_length` TINYINT( 2 ) NOT NULL DEFAULT '6' AFTER `captcha_method` ,
			ADD `captcha_double_hash` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `captcha_length` ,
			ADD `time_lock_spam_count` TINYINT( 2 ) NOT NULL DEFAULT '5' AFTER `time_lock_maxtime` ,
			ADD `blocktime` INT( 10 ) NOT NULL DEFAULT '9999999' AFTER `moderated`";
$sqldescription[8] = "- Adding new fields in settings table ...";

$sql[9] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."spam (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `name` VARCHAR( 255 ) NOT NULL ,
		  `ip` VARCHAR( 15 ) NOT NULL ,
		  `email` VARCHAR( 255 ) NOT NULL ,
		  `city` VARCHAR( 255 ) NOT NULL ,
		  `icq` VARCHAR( 255 ) NOT NULL ,
		  `aim` VARCHAR( 255 ) NOT NULL ,
		  `msn` VARCHAR( 255 ) NOT NULL ,
		  `hp` VARCHAR( 255 ) NOT NULL ,
		  `message` MEDIUMTEXT NOT NULL ,
		  `comment` MEDIUMTEXT NOT NULL ,
		  `user_notification` TINYINT( 1 ) NOT NULL ,
		  `user_show_email` TINYINT( 1 ) NOT NULL ,
		  `captcha` VARCHAR( 9 ) NOT NULL ,
		  `sent_captcha` VARCHAR( 9 ) NOT NULL ,
		  `counter` TINYINT( 1 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[9] = "- Creating spam table ...";

$sql[10] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."banlist_ips (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `banned_ip` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[10] = "- Creating ip banlist ...";

$sql[11] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."banlist_emails (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `banned_email` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[11] = "- Creating email banlist ...";

$sql[12] = "CREATE TABLE IF NOT EXISTS ".$db['prefix']."banlist_domains (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `banned_domain` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` INT( 11 ) NOT NULL
		  )";
$sqldescription[12] = "- Creating domain banlist ...";

$sql[13] = "CREATE TABLE ".$db['prefix']."spam_log (
		  `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
		  `ip` VARCHAR( 255 ) NOT NULL ,
		  `email` VARCHAR( 255 ) NOT NULL ,
		  `user_agent` VARCHAR( 255 ) NOT NULL ,
		  `message` MEDIUMTEXT NOT NULL ,
		  `type` INT( 2 ) NOT NULL ,
		  `site` VARCHAR( 255 ) NOT NULL ,
		  `timestamp` VARCHAR( 255 ) NOT NULL
		  )";
$sqldescription[13] = "- Creating spam log table ...";

if (isset($_POST['update_version']) AND $_POST['update_version'] == 1)
	{
	$sql[14] = "UPDATE `".$db['prefix']."settings` SET `version` = '".MGB_VERSION."'";
	$sqldescription[14] = "- Updating version number...";
	}

$to = count($sql);
?>
Return current item: MGB OpenSource Guestbook