IPB - грешчица :D

Teodotko

Registered
Еми ... Опитвам се да инсталирам IPB 1.3 ( безплатна версия чух , че е ) .

Warning!

The following errors must be rectified before continuing!
Please go back and try again!

mySQL Error: Invalid default value for 'macro_set'
Query:CREATE TABLE ibf_macro ( macro_id smallint(3) NOT NULL auto_increment, macro_value varchar(200) default NULL, macro_replace text, can_remove tinyint(1) default '0', macro_set smallint(3) NOT NULL default '', PRIMARY KEY (macro_id), KEY macro_set (macro_set) ) TYPE=MyISAM;


sm_install.php e файла от който се инсталира ако е важно ... Ето го и него :

Код:
<?php


/*
+--------------------------------------------------------------------------
|   INVISION POWER BOARD SAFE MODE INSTALL SCRIPT v1.3
|   ========================================
|   by Matthew Mecham
|   (c) 2001 - 2003 Invision Power Services
|   http://www.invisionpower.com
|   ========================================
|   Web: http://www.ibforums.com
|   Email: phpboards@ibforums.com
|   Licence Info: phpib-licence@ibforums.com
+---------------------------------------------------------------------------
|
|   > Script written by Matthew Mecham
|   > Date started: 30th March 2002
|   > Update started: 17th October 2002
|
+--------------------------------------------------------------------------
*/

error_reporting  (E_ERROR | E_WARNING | E_PARSE);
set_magic_quotes_runtime(0);

//+---------------------------------------
// ENTER YOUR PATH TO THE DIRECTORY THIS SCRIPT
// IS IN.
//
// Tips:
//
// If you are using Windows and Apache, do not
// use backslashes, use normal forward slashes.
// You may need to remove the drive letter also
// Example: C:\apache\htdocs\ibforums\ will need
// to be: /apache/htdocs/ibforums/
//
// If you are using Windows and IIS, then you will 
// need to enter double backslashes.
//
// In all cases, please enter a trailing slash (or
// trailing backslashes...)
//+---------------------------------------

$root = "./";



//+---------------------------------------

$template = new template;
$std      = new installer;

$VARS = $std->parse_incoming();

//+---------------------------------------
// What are we doing then? Eh? I'm talking to you!
//+---------------------------------------

if ( file_exists($root.'install.lock') )
{
	install_error("This installer is locked!<br>Please (via FTP) remove the 'install.lock' file in this directory");
	exit();
}


switch($VARS['a'])
{
	case '1':
		do_setup_form();
		break;
		
	case '2':
		do_install();
		break;
		
	case 'templates':
		do_templates();
		break;
		
	case '3':
		do_finish();
		break;
		
	default:
		do_intro();
		break;
}

function do_finish()
{
	global $std, $template, $root, $VARS, $SQL;
	
	// Attempt to lock the install..
	
	if ($FH = @fopen( $root.'install.lock', 'w' ) )
	{
		@fwrite( $FH, 'bleh', 4 );
		@fclose($FH);
		
		@chmod( $root.'install.lock', 0666 );
		
		$template->print_top('Success!');
	
		$msg="Although the installer is now locked (to re-install, remove the file 'install.lock'), for added security, please remove the sm_install.php program before continuing.
			 <br><br>
			 <center><b><a href='index.php?act=Login&CODE=00'>CLICK HERE TO LOG IN!</a></center>";
	}
	else
	{
		$template->print_top('Success!');
		
		$msg = "PLEASE REMOVE THE INSTALLER ('sm_install.php') BEFORE CONTINUING!<br>Failure to do so will enable ANYONE to delete your board at any time!
				<br><br>
				<center><b><a href='index.php?act=Login&CODE=00'>CLICK HERE TO LOG IN!</a></center>";
	}
	
	$template->contents .= "
	<div class='centerbox'>
	<div class='tableborder'>
	<div class='maintitle'>Success</div>
	<div class='tablepad'>
	<b>The installation is now complete!</b>
	<br><br>
	$msg
	</div>
	</div>
	</div>";
						 
	$template->output();
	
	
	
}


//+---------------------------------------
// Install the template files, woohoo and stuff
//+---------------------------------------


function do_templates()
{
	global $std, $template, $root, $VARS, $HTTP_POST_VARS;
	
	//-----------------------------------
	// IMPORT $INFO!
	//-----------------------------------
	
	if ($root == './')
	{
		$root = str_replace( '\\', '/', getcwd() ) . '/';
	}
	
	$require = $root."conf_global.php";
	
	if ( ! file_exists($require) )
	{
		install_error("Could not locate '$require'. You may need to enter a value for the root path in this installer script, to do this, simply open up this script in a text editor and enter a value in \$root - remember to add a trailing slash. NT users will need to use double backslashes");
	}
	
	include($require);
	
	//-----------------------------------
	// Attempt a DB connection..
	//-----------------------------------
	
	if ( ! $connect_id = mysql_connect( $INFO['sql_host'],$INFO['sql_user'],$INFO['sql_pass'] ) )
	{
		install_error("Could not create a mySQL connection, please check that the file 'conf_global.php' exists in the same directory as this file and that the installer has updated the file properly.");
	}
	
		
	if ( ! mysql_select_db($INFO['sql_database'], $connect_id) )
	{
		install_error("mySQL could not locate a database called '{$VARS['sql_database']}'. Please contact our technical support if a re-install does not solve this problem");
	}
	
	//-----------------------------------
	// Lets open the style file
	//-----------------------------------
	
	$style_file = $root.'install_templates.txt';
	
	if ( ! file_exists($style_file) )
	{
		install_error("Could not locate '$style_file'. <br><br>Check to ensure that this file exists in the same location as this script.<br><br>You may need to enter a value for the root path in this installer script, to do this, simply open up this script in a text editor and enter a value in \$root - remember to add a trailing slash. NT users will need to use double backslashes");
	}
	
	if ( $fh = fopen( $style_file, 'r' ) )
	{
		$data = fread($fh, filesize($style_file) );
		fclose($fh);
	}
	else
	{
		install_error("Could open '$style_file'");
	}
	
	if (strlen($data) < 100)
	{
		install_error("Err 1:'$style_file' is incomplete, please re-upload a fresh copy over the existing copy on the server'");
	}
	
	// Chop up the data file.
	
	$template_rows = explode( "||~&~||", $data );
	
	$crows = count($template_rows);  //we're counting crows :o
	
	if ( $crows < 100 )
	{
		install_error("Err2: (Found $crows rows) '$style_file' is incomplete, please re-upload a fresh copy over the existing copy on the server'");
	}
	
	//-----------------------------------
	// Lets populate the database!
	//-----------------------------------
	
	foreach( $template_rows as $q )
	{

	   $q = trim($q);
	   
	   if (strlen($q) < 5)
	   {
	       continue;
	   }
	   
	   $query = "INSERT INTO ".$INFO['sql_tbl_prefix']."skin_templates (set_id, group_name, section_content, func_name, func_data, updated, can_remove) VALUES $q";
		   
	   if ( ! mysql_query($query, $connect_id) )
	   {
		   install_error("mySQL Error: ".mysql_error());
	   }
   }
   
   
   // ARE WE DONE? REALLY? COOL!!
   
   $template->print_top('Success!');
   
   $template->contents .= "
	<div class='centerbox'>
	<div class='tableborder'>
	<div class='maintitle'>Success</div>
	<div class='tablepad'>
	<b>Template files installed!</b>
	<br><br>
	The installation process is now complete.
	<br>
	Click the link below to clean up the installer and related files
	<br><br>
	<center><b><a href='sm_install.php?a=3'>CLICK HERE TO FINISH</a></center>
	</div>
	</div>
	</div>";
   
	$template->output();
	
}

//+---------------------------------------


function do_install()
{
	global $std, $template, $root, $VARS, $HTTP_POST_VARS;
	
	// Ok, lets check for blankies...
	
	$NEW_INFO = array();
	
	$need = array('board_url','sql_host','sql_database','sql_user','adminname','adminpassword','adminpassword2','email');
	
	//-----------------------------------
	
	foreach($need as $greed)
	{
		if ($VARS[ $greed ] == "")
		{
			install_error("You must complete all of the form with the sole exception of 'SQL Table prefix'");
		}
	}
	
	//-----------------------------------
	
	$VARS['board_url'] = preg_replace( "#/$#", "", $VARS['board_url'] );
	
	if ($VARS['sql_tbl_prefix'] == "")
	{
		$VARS['sql_tbl_prefix'] = 'ibf_';
	}
	
	//-----------------------------------
	// Did the admin passy and passy2 match?
	//-----------------------------------
	
	if ($VARS['adminpassword2'] != $VARS['adminpassword'])
	{
		install_error("Your passwords did not match");
	}
	
	/*if ( ! preg_match( "!^http://!", $VARS['board_url'] ) )
	{
		install_error("The board URL must start with 'http://'");
	}*/
	
	//-----------------------------------
	// IMPORT $INFO!
	//-----------------------------------
	
	if ($root == './')
	{
		$root = str_replace( '\\', '/', getcwd() ) . '/';
	}
	
	$require = $root."conf_global.php";
	
	if ( ! file_exists($require) )
	{
		install_error("Could not locate '$require'. You may need to enter a value for the root path in this installer script, to do this, simply open up this script in a text editor and enter a value in \$root - remember to add a trailing slash. NT users will need to use double backslashes");
	}
	
	//@chmod( "conf_global.php", 0666 );
	
	include($require);
	
	//echo("here");
	//exit();
	
	if ( count($INFO) < 1 )
	{
		install_error("Possible corruption in 'conf_global.php' ({$VARS['base_dir']}conf_global.php), please re-upload in ASCII format");
	}
	
	//-----------------------------------
	// Attempt a DB connection..
	//-----------------------------------
	
	if ( ! $connect_id = mysql_connect( $VARS['sql_host'],$HTTP_POST_VARS['sql_user'],$HTTP_POST_VARS['sql_pass'] ) )
	{
		install_error("Could not create a mySQL connection, please check the SQL values entered");
	}
	
		
	if ( ! mysql_select_db($VARS['sql_database'], $connect_id) )
	{
		install_error("mySQL could not locate a database called '{$VARS['sql_database']}' please check the value entered for this");
	}
	
	//-----------------------------------
	// Attempt to write the config file.
	//-----------------------------------
	
    $new  = array( 'base_dir'       => $root,
				   'board_url'      => $VARS['board_url'],
				   'sql_host'       => $VARS['sql_host'],
				   'sql_database'   => $VARS['sql_database'],
				   'sql_user'       => $HTTP_POST_VARS['sql_user'],
				   'sql_pass'       => $HTTP_POST_VARS['sql_pass'],
				   'sql_tbl_prefix' => $VARS['sql_tbl_prefix'],
				   
				   'html_dir'       => $root."html/",
				   'html_url'       => $VARS['board_url']."/html",
				   'upload_dir'     => $root."uploads",
				   'upload_url'     => $VARS['board_url']."/uploads",
				   'email_in'       => $VARS['email'],
				   'email_out'      => $VARS['email'],
				   'ban_names'      => "",
				   'ban_email'      => "",
				   'ban_ip'         => "",
				   'force_login'    => 0,
				   'load_limit'     => "",
				   'board_start'    => time(),
				   'installed'      => 1,
				   'guests_ava'     => 1,
				   'guests_img'		=> 1,
				   'guests_sig'		=> 1,
				   'print_headers'  => 0,
				   'guest_name_pre' => "Guest_",
				 );
					 
	 foreach( $new as $k => $v )
	 {
		 // Update the old...
		 
		 $v = preg_replace( "/'/", "\\'" , $v );
		 $v = preg_replace( "/\r/", ""   , $v );
		 
		 $INFO[ $k ] = $v;
	 }
	 
	 $file_string = "<?php\n";
		
	 foreach( $INFO as $k => $v )
	 {
		 if ($k == 'skin' or $k == 'languages')
		 {
			continue;
		 }
		 $file_string .= '$INFO['."'".$k."'".']'."\t\t\t=\t'".$v."';\n";
	 }
	 
	 $file_string .= "\n".'?'.'>';   // Question mark + greater than together break syntax hi-lighting in BBEdit 6 :p
	 
	 if ( $fh = fopen( $require, 'w' ) )
	 {
		 fputs($fh, $file_string, strlen($file_string) );
		 fclose($fh);
	 }
	 else
	 {
		 install_error("Could not write to 'conf_global.php'");
	 }
	 
	 //-----------------------------------
	 // What MySQL version are we running?
	 //-----------------------------------
	 
	 $a = mysql_query("SELECT VERSION() AS version", $connect_id);
		
	 if ( ! $row = mysql_fetch_array($a) )
	 {
		 $b = mysql_query("SHOW VARIABLES LIKE 'version'", $connect_id);
		 $row = mysql_fetch_array($b);
	 }
	 
	 $mysql_version = 32100;
	 
	 $no_array = explode( '.', preg_replace( "/^(.+?)[-_]?/", "\\1", $row['version']) );
	 
	 $one   = (!isset($no_array) || !isset($no_array[0])) ? 3  : $no_array[0];
	 $two   = (!isset($no_array[1]))                      ? 21 : $no_array[1];
	 $three = (!isset($no_array[2]))                      ? 0  : $no_array[2];
	 
	 $mysql_version = (int)sprintf('%d%02d%02d', $one, $two, intval($three));
	 
	 //-----------------------------------
	 // Lets populate the database!
	 //-----------------------------------
	 
	 $SQL = get_sql();
	 
	 foreach( $SQL as $q )
	 {
	 	if ($VARS['sql_tbl_prefix'] != "ibf_")
        {
           $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $VARS['sql_tbl_prefix']."\\1\\2", $q);
        }
        
        $q = str_replace( "<%time%>", time(), $q );
        
        if ( preg_match("/CREATE TABLE (\S+) \(/", $q, $match) )
        {
        	if ($match[1])
        	{
        		$the_query = "DROP TABLE if exists ".$match[1];
        		
        		if (! mysql_query($the_query, $connect_id) )
        		{
        			install_error("mySQL Error: ".mysql_error());
        		}
        	}
        }
        
        if ( $mysql_version < 32323 )
        {
        	$q = str_replace( "KEY forum_id (forum_id,approved,pinned),FULLTEXT KEY title (title)", 'KEY forum_id (forum_id,approved,pinned)', $q );
        	$q = str_replace( "KEY forum_id (forum_id,post_date),FULLTEXT KEY post (post)"        , 'KEY forum_id (forum_id,post_date)'      , $q );
        }
        	
        if ( ! mysql_query($q, $connect_id) )
        {
        	install_error("mySQL Error: ".mysql_error()."<br /><b>Query:</b>".$q);
        }
	}
	
	// Insert the admin...
	
	$passy = md5($VARS['adminpassword']);
	$time  = time();
	
	$query = "INSERT INTO ".$VARS['sql_tbl_prefix']."members (id, name, mgroup, password, email, joined, ip_address, posts, title, last_visit, last_activity) ".
		     "VALUES(1, '{$VARS['adminname']}', 4, '$passy', '{$VARS['email']}', '$time', '127.0.0.1', '0', 'Administrator', '$time', '$time')";
		     
	if ( ! mysql_query($query, $connect_id) )
	{
		install_error("mySQL Error: ".mysql_error());
		
	}
	
	// ARE WE DONE? REALLY? COOL!!
	
	$template->print_top('Success!');
	
	$template->contents .= "
	<div class='centerbox'>
	<div class='tableborder'>
	<div class='maintitle'>Success</div>
	<div class='tablepad'>
	<b>Your board has now been installed!</b>
	<br><br>
	The installation process is almost complete.
	<br>
	The next and final step will install the template files into your database
	<br><br>
	<center><b><a href='sm_install.php?a=templates'>CLICK HERE TO CONTINUE</a></center>
	</div>
	</div>
	</div>";
						 
	$template->output();
	
}




function do_setup_form()
{
	global $std, $template, $root, $HTTP_SERVER_VARS;
	
	$template->print_top('Set Up form');
	
	//--------------------------------------------------
	
	$this_url = str_replace( "/sm_install.php", "", $HTTP_SERVER_VARS['HTTP_REFERER']);
	
	if ( ! $this_url )
	{
		$this_url = substr($HTTP_SERVER_VARS['SCRIPT_NAME'],0, -15);
		
    	if ($this_url == '')
    	{
    		$this_url == '/';
    	}
    	$this_url = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].$this_url; 
    } 
	
	
	//--------------------------------------------------
	
	$template->contents .= "
	
	<form action='sm_install.php' method='POST'>
	<input type='hidden' name='a' value='2'>
	<div class='centerbox'>
	
	<div class='tableborder'>
	<div class='maintitle'>Your Server Environment</div>
	<div class='pformstrip'>This section requires you to enter the paths and URL's for the board.</div>
	<table width='100%' cellspacing='1'>
	<tr>
	  <td class='pformleftw'><b>The script URL</b><br>This is the URL (must start with http://) to the directory that this script is in</td>
	  <td class='pformright'><input type='text' id='textinput' name='board_url' value='$this_url'></td>
	</tr>
	</table>
	</div>
	<div class='fade'> </div>
	
	<br />
	
	<div class='tableborder'>
	<div class='maintitle'>Your SQL Environment</div>
	<div class='pformstrip'>This section requires you to enter your SQL information. If in doubt, please check with your webhost before asking for support. You may choose to enter an existing database name,if not - you must create a new database before continuing.</div>
	<table width='100%' cellspacing='1'>
	<tr>
	  <td class='pformleftw'><b>SQL Host</b><br>(localhost is usually sufficient)</td>
	  <td class='pformright'><input type='text' id='textinput' name='sql_host' value='localhost'></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>SQL Database Name</b></td>
	  <td class='pformright'><input type='text' id='textinput' name='sql_database' value=''></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>SQL Username</b></td>
	  <td class='pformright'><input type='text' id='textinput' name='sql_user' value=''></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>SQL Password</b></td>
	  <td class='pformright'><input type='text' id='textinput' name='sql_pass' value=''></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>SQL Table Prefix</b>(You can leave this blank)</td>
	  <td class='pformright'><input type='text' id='textinput' name='sql_tbl_prefix' value=''></td>
	</tr>
	</table>
	</div>
	<div class='fade'> </div>
	
	<br />
	
	<div class='tableborder'>
	<div class='maintitle'>Your Admin Account</div>
	<div class='pformstrip'>This section requires information to create your administration account. Please enter the data carefully!</div>
	<table width='100%' cellspacing='1'>
	<tr>
	  <td class='pformleftw'><b>Username</b></td>
	  <td class='pformright'><input type='text' id='textinput' name='adminname' value=''></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>Password</b></td>
	  <td class='pformright'><input type='password' id='textinput' name='adminpassword' value=''></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>Retype your password</b></td>
	  <td class='pformright'><input type='password' id='textinput' name='adminpassword2' value=''></td>
	</tr>
	
	<tr>
	  <td class='pformleftw'><b>Email Address</b></td>
	  <td class='pformright'><input type='text' id='textinput' name='email' value=''></td>
	</tr>
	</table>
	<div align='center' class='pformstrip'  style='text-align:center'><input type='image' src='html/sys-img/install_proceed.gif'></div>
	</div>
	<div class='fade'> </div>
	</div>
	</form>";
						 
	$template->output();
						 
}

//+---------------------------------------

function do_intro()
{
	global $std, $template, $root;
	
	$template->print_top('Welcome');
	
	$template->contents .= "<table width='80%' border='0' cellpadding='0' cellspacing='0' align='center'>
							<tr>
							 <td valign='top'><img src='html/sys-img/install_face.jpg' border='0' alt='Intro'></td>
							 <td><img src='html/sys-img/install_text.gif' border='0' alt='Welcome to IPB'>
							  <br /><br />
							   Before we go any further, please ensure that all the files have been uploaded, and that the 
							   file 'conf_global.php' has suitable permissions to allow this script to write to it ( 0666 should be sufficient ).
							   <br><br>
							   You will also need the following information that your webhost can provide:
							   <ul>
							   <li>Your MySQL database name</li>
							   <li>Your MySQL username</li>
							   <li>Your MySQL password</li>
							   <li>Your MySQL host address (usually localhost)</li>
							   </ul>
							   <br />
							   Once you have clicked on proceed, you will be taken to a form to enter information the installer needs to set up your board.
							   <br><br>
							   <b>PLEASE NOTE: USING THIS INSTALLER WILL DELETE ANY CURRENT INVISION POWER BOARD DATABASE IF YOU ARE USING THE SAME TABLE PREFIX</b>
							   ";
						 
	// Check to make sure that the config file is there and it's got suitable permissions to write to:
	
	$file = $root."conf_global.php";
	
	$style_file = $root."install_templates.txt";
	
	$warnings = array();
	
	if ( ! file_exists($style_file) )
	{
		$warnings[] = "Cannot locate the file 'install_templates.txt'. This should be uploaded into the same directory as this script!";
	}
	
	if ( ! file_exists($file) )
	{
		$warnings[] = "Cannot locate the file 'conf_global.php'. This should be uploaded into the same directory as this script!";
	}
	
	if ( ! is_writeable($file) )
	{
		$warnings[] = "Cannot write to 'conf_global.php'. Please adjust the permissions to allow this script to write to the file. if in doubt, CHMOD via FTP to 0777";
	}
	
	$phpversion = phpversion();
	
	if ($phpversion < '4.0.0') {
		$warnings[] = "You cannot install Invision Power Board. Invision Power Board requires PHP Version 4.0.0 or better.";
	}
	
	if ( count($warnings) > 0 )
	{
	
		$err_string = "<ul><li>".implode( "<li>", $warnings )."</ul>";
	
		$template->contents .= "<br /><br />
							    <div class='warnbox'>
							     <strong>Warning!</strong>
							     <b>The following errors must be rectified before continuing!</b>
								 <br><br>
								 $err_string
							    </div>";
	}
	else
	{
		$template->contents .= "<br /><br /><div align='center'><a href='sm_install.php?a=1'><img src='html/sys-img/install_proceed.gif' border='0' alt='proceed'></a></div>";
	}
	
	$template->contents .= " </td>
							  </tr>
							 </table>";
	
	$template->output();
}



function install_error($msg="")
{
	global $std, $template, $root;
	
	$template->print_top('Warning!');
	

	
	$template->contents .= "<div class='warnbox'>
						     <strong style='font-size:16px;color:#F00'>Warning!</strong>
						     <br /><br />
						     <b>The following errors must be rectified before continuing!</b><br>Please go back and try again!
						     <br><br>
						     $msg
						    </div>";
	
	
	
	$template->output();
}

//+--------------------------------------------------------------------------
// CLASSES
//+--------------------------------------------------------------------------



class template
{
	var $contents = "";
	
	function output()
	{
		echo $this->contents;
		echo "   
				 
				 <br><br><br><br><center><span id='copy'><a href='http://www.invisionboard.com'>Invision Power Board</a> © 2003 <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a></span></center>
				 
				 </body>
				 </html>";
		exit();
	}
	
	//--------------------------------------

	function print_top($title="")
	{
	
		$this->contents = "<html>
		          <head><title>Invision Power Board Set Up :: $title </title>
		          <style type='text/css'>
		          	
		          	BODY		          	
		          	{
		          		font-size: 11px;
		          		font-family: Verdana, Arial;
		          		color: #000;
		          		margin: 0px;
		          		padding: 0px;
		          		background-image: url(html/sys-img/fadebg.jpg);
		          		background-repeat: no-repeat;
		          		background-position: right bottom;
		          	}
		          	
		          	TABLE, TR, TD     { font-family:Verdana, Arial;font-size: 11px; color:#000 }
					
					a:link, a:visited, a:active  { color:#000055 }
					a:hover                      { color:#333377;text-decoration:underline }
					
					.centerbox { margin-right:10%;margin-left:10%;text-align:left }
					
					.warnbox {
							   border:1px solid #F00;
							   background: #FFE0E0;
							   padding:6px;
							   margin-right:10%;margin-left:10%;text-align:left;
							 }
					
					.tablepad    { background-color:#F5F9FD;padding:6px }

					.pformstrip { background-color: #D1DCEB; color:#3A4F6C;font-weight:bold;padding:7px;margin-top:1px;text-align:left }
					.pformleftw { background-color: #F5F9FD; padding:6px; margin-top:1px;width:40%; border-top:1px solid #C2CFDF; border-right:1px solid #C2CFDF; }
					.pformright { background-color: #F5F9FD; padding:6px; margin-top:1px;border-top:1px solid #C2CFDF; }

					.tableborder { border:1px solid #345487;background-color:#FFF; padding:0px; margin:0px; width:100% }

					.maintitle { text-align:left;vertical-align:middle;font-weight:bold; color:#FFF; letter-spacing:1px; padding:8px 0px 8px 5px; background-image: url(html/sys-img/tile_back.gif) }
					.maintitle a:link, .maintitle  a:visited, .maintitle  a:active { text-decoration: none; color: #FFF }
					.maintitle a:hover { text-decoration: underline }
					
					#copy { font-size:10px }
										
					#button   { background-color: #4C77B6; color: #FFFFFF; font-family:Verdana, Arial; font-size:11px }
					
					#textinput { background-color: #EEEEEE; color:К#000000; font-family:Verdana, Arial; font-size:10px; width:100% }
					
					#dropdown { background-color: #EEEEEE; color:К#000000; font-family:Verdana, Arial; font-size:10px }
					
					#multitext { background-color: #EEEEEE; color:К#000000; font-family:Courier, Verdana, Arial; font-size:10px }
					
					#logostrip {
								 padding: 0px;
								 margin: 0px;
								 background: #7AA3D0;
							   }
							   
					.fade					
					{
						background-image: url(html/sys-img/fade.jpg);
						background-repeat: repeat-x;
					}
					
				  </style>
				  </head>
				 <body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>
				 
				 <div id='logostrip'><img src='html/sys-img/title.gif' border='0' alt='Invision Power Board Installer' /></div>
				 <div class='fade'> </div>
				 <br />
				 ";
				  	   
	}


}


class installer
{

	function parse_incoming()
    {
    	global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_CLIENT_IP, $REQUEST_METHOD, $REMOTE_ADDR, $HTTP_PROXY_USER, $HTTP_X_FORWARDED_FOR;
    	$return = array();
    	
		if( is_array($HTTP_GET_VARS) )
		{
			while( list($k, $v) = each($HTTP_GET_VARS) )
			{
				//$k = $this->clean_key($k);
				if( is_array($HTTP_GET_VARS[$k]) )
				{
					while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
					{
						$return[$k][ $this->clean_key($k2) ] = $this->clean_value($v2);
					}
				}
				else
				{
					$return[$k] = $this->clean_value($v);
				}
			}
		}
		
		// Overwrite GET data with post data
		
		if( is_array($HTTP_POST_VARS) )
		{
			while( list($k, $v) = each($HTTP_POST_VARS) )
			{
				//$k = $this->clean_key($k);
				if ( is_array($HTTP_POST_VARS[$k]) )
				{
					while( list($k2, $v2) = each($HTTP_POST_VARS[$k]) )
					{
						$return[$k][ $this->clean_key($k2) ] = $this->clean_value($v2);
					}
				}
				else
				{
					$return[$k] = $this->clean_value($v);
				}
			}
		}
		
		return $return;
	}
    
    function clean_key($key) {
    
    	if ($key == "")
    	{
    		return "";
    	}
    	
    	$key = preg_replace( "/\.\./"           , ""  , $key );
    	$key = preg_replace( "/\_\_(.+?)\_\_/"  , ""  , $key );
    	$key = preg_replace( "/^([\w\.\-\_]+)$/", "$1", $key );
    	return $key;
    }
    
    function clean_value($val) {
    
    	if ($val == "")
    	{
    		return "";
    	}
    	
    	$val = preg_replace( "/&/"         , "&"         , $val );
    	$val = preg_replace( "//"       , "-->"       , $val );
    	$val = preg_replace( "/<script/i"  , "<script"   , $val );
    	$val = preg_replace( "/>/"         , ">"          , $val );
    	$val = preg_replace( "/</"         , "<"          , $val );
    	$val = preg_replace( "/\"/"        , """        , $val );
    	$val = preg_replace( "/\|/"        , "|"        , $val );
    	$val = preg_replace( "/\n/"        , "<br>"          , $val ); // Convert literal newlines
    	$val = preg_replace( "/\\\$/"      , "$"        , $val );
    	$val = preg_replace( "/\r/"        , ""              , $val ); // Remove literal carriage returns
    	$val = preg_replace( "/!/"         , "!"         , $val );
    	$val = preg_replace( "/'/"         , "'"         , $val ); // IMPORTANT: It helps to increase sql query safety.
    	$val = stripslashes($val);                                     // Swop PHP added backslashes
    	$val = preg_replace( "/\\\/"       , "\"        , $val ); // Swop user inputted backslashes
    	return $val;
    }
   
}



// DATA AND STUFF, ETC

function get_sql()
{

$SQL = array();

$SQL[] = "CREATE TABLE ibf_admin_logs (
  id bigint(20) NOT NULL auto_increment,
  act varchar(255) default NULL,
  code varchar(255) default NULL,
  member_id int(10) default NULL,
  ctime int(10) default NULL,
  note text,
  ip_address varchar(255) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_admin_sessions (
  ID varchar(32) NOT NULL default '',
  IP_ADDRESS varchar(32) NOT NULL default '',
  MEMBER_NAME varchar(32) NOT NULL default '',
  MEMBER_ID varchar(32) NOT NULL default '',
  SESSION_KEY varchar(32) NOT NULL default '',
  LOCATION varchar(64) default 'index',
  LOG_IN_TIME int(10) NOT NULL default '0',
  RUNNING_TIME int(10) NOT NULL default '0',
  PRIMARY KEY  (ID)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_badwords (
  wid int(3) NOT NULL auto_increment,
  type varchar(250) NOT NULL default '',
  swop varchar(250) default NULL,
  m_exact tinyint(1) default '0',
  PRIMARY KEY  (wid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_cache_store (
  cs_key varchar(255) NOT NULL default '',
  cs_value text NOT NULL,
  cs_extra varchar(255) NOT NULL default '',
  PRIMARY KEY  (cs_key)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_calendar_events (
  eventid mediumint(8) NOT NULL auto_increment,
  userid mediumint(8) NOT NULL default '0',
  year int(4) NOT NULL default '2002',
  month int(2) NOT NULL default '1',
  mday int(2) NOT NULL default '1',
  title varchar(254) NOT NULL default 'no title',
  event_text text NOT NULL,
  read_perms varchar(254) NOT NULL default '*',
  unix_stamp int(10) NOT NULL default '0',
  priv_event tinyint(1) NOT NULL default '0',
  show_emoticons tinyint(1) NOT NULL default '1',
  rating smallint(2) NOT NULL default '1',
  event_ranged tinyint(1) NOT NULL default '0',
  event_repeat tinyint(1) NOT NULL default '0',
  repeat_unit char(2) NOT NULL default '',
  end_day int(2) default NULL,
  end_month int(2) default NULL,
  end_year int(4) default NULL,
  end_unix_stamp int(10) default NULL,
  event_bgcolor varchar(32) NOT NULL default '',
  event_color varchar(32) NOT NULL default '',
  PRIMARY KEY  (eventid),
  KEY unix_stamp (unix_stamp)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_categories (
  id smallint(5) NOT NULL default '0',
  position tinyint(3) default NULL,
  state varchar(10) default NULL,
  name varchar(128) NOT NULL default '',
  description text,
  image varchar(128) default NULL,
  url varchar(128) default NULL,
  PRIMARY KEY  (id),
  KEY id (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_contacts (
  id mediumint(8) NOT NULL auto_increment,
  contact_id mediumint(8) NOT NULL default '0',
  member_id mediumint(8) NOT NULL default '0',
  contact_name varchar(32) NOT NULL default '',
  allow_msg tinyint(1) default NULL,
  contact_desc varchar(50) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_css (
  cssid int(10) NOT NULL auto_increment,
  css_name varchar(128) NOT NULL default '',
  css_text text,
  css_comments text,
  updated int(10) default '0',
  PRIMARY KEY  (cssid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_email_logs (
  email_id int(10) NOT NULL auto_increment,
  email_subject varchar(255) NOT NULL default '',
  email_content text NOT NULL,
  email_date int(10) NOT NULL default '0',
  from_member_id mediumint(8) NOT NULL default '0',
  from_email_address varchar(250) NOT NULL default '',
  from_ip_address varchar(16) NOT NULL default '127.0.0.1',
  to_member_id mediumint(8) NOT NULL default '0',
  to_email_address varchar(250) NOT NULL default '',
  topic_id int(10) NOT NULL default '0',
  PRIMARY KEY  (email_id),
  KEY from_member_id (from_member_id),
  KEY email_date (email_date)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_emoticons (
  id smallint(3) NOT NULL auto_increment,
  typed varchar(32) NOT NULL default '',
  image varchar(128) NOT NULL default '',
  clickable smallint(2) NOT NULL default '1',
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_faq (
  id mediumint(8) NOT NULL auto_increment,
  title varchar(128) NOT NULL default '',
  text text,
  description text NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_forum_perms (
  perm_id int(10) NOT NULL auto_increment,
  perm_name varchar(250) NOT NULL default '',
  PRIMARY KEY  (perm_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_forum_tracker (
  frid mediumint(8) NOT NULL auto_increment,
  member_id varchar(32) NOT NULL default '',
  forum_id smallint(5) NOT NULL default '0',
  start_date int(10) default NULL,
  last_sent int(10) NOT NULL default '0',
  PRIMARY KEY  (frid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_forums (
  id smallint(5) NOT NULL default '0',
  topics mediumint(6) default NULL,
  posts mediumint(6) default NULL,
  last_post int(10) default NULL,
  last_poster_id mediumint(8) NOT NULL default '0',
  last_poster_name varchar(32) default NULL,
  name varchar(128) NOT NULL default '',
  description text,
  position tinyint(2) default NULL,
  use_ibc tinyint(1) default NULL,
  use_html tinyint(1) default NULL,
  status varchar(10) default NULL,
  start_perms varchar(255) NOT NULL default '',
  reply_perms varchar(255) NOT NULL default '',
  read_perms varchar(255) NOT NULL default '',
  password varchar(32) default NULL,
  category tinyint(2) NOT NULL default '0',
  last_title varchar(128) default NULL,
  last_id int(10) default NULL,
  sort_key varchar(32) default NULL,
  sort_order varchar(32) default NULL,
  prune tinyint(3) default NULL,
  show_rules tinyint(1) default NULL,
  upload_perms varchar(255) default NULL,
  preview_posts tinyint(1) default NULL,
  allow_poll tinyint(1) NOT NULL default '1',
  allow_pollbump tinyint(1) NOT NULL default '0',
  inc_postcount tinyint(1) NOT NULL default '1',
  skin_id int(10) default NULL,
  parent_id mediumint(5) default '-1',
  subwrap tinyint(1) default '0',
  sub_can_post tinyint(1) default '1',
  quick_reply tinyint(1) default '0',
  redirect_url varchar(250) default '',
  redirect_on tinyint(1) NOT NULL default '0',
  redirect_hits int(10) NOT NULL default '0',
  redirect_loc varchar(250) default '',
  rules_title varchar(255) NOT NULL default '',
  rules_text text NOT NULL,
  has_mod_posts tinyint(1) NOT NULL default '0',
  topic_mm_id varchar(250) NOT NULL default '',
  notify_modq_emails text default '',
  PRIMARY KEY  (id),
  KEY category (category),
  KEY id (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_groups (
  g_id int(3) unsigned NOT NULL auto_increment,
  g_view_board tinyint(1) default NULL,
  g_mem_info tinyint(1) default NULL,
  g_other_topics tinyint(1) default NULL,
  g_use_search tinyint(1) default NULL,
  g_email_friend tinyint(1) default NULL,
  g_invite_friend tinyint(1) default NULL,
  g_edit_profile tinyint(1) default NULL,
  g_post_new_topics tinyint(1) default NULL,
  g_reply_own_topics tinyint(1) default NULL,
  g_reply_other_topics tinyint(1) default NULL,
  g_edit_posts tinyint(1) default NULL,
  g_delete_own_posts tinyint(1) default NULL,
  g_open_close_posts tinyint(1) default NULL,
  g_delete_own_topics tinyint(1) default NULL,
  g_post_polls tinyint(1) default NULL,
  g_vote_polls tinyint(1) default NULL,
  g_use_pm tinyint(1) default NULL,
  g_is_supmod tinyint(1) default NULL,
  g_access_cp tinyint(1) default NULL,
  g_title varchar(32) NOT NULL default '',
  g_can_remove tinyint(1) default NULL,
  g_append_edit tinyint(1) default NULL,
  g_access_offline tinyint(1) default NULL,
  g_avoid_q tinyint(1) default NULL,
  g_avoid_flood tinyint(1) default NULL,
  g_icon varchar(64) default NULL,
  g_attach_max bigint(20) default NULL,
  g_avatar_upload tinyint(1) default '0',
  g_calendar_post tinyint(1) default '0',
  prefix varchar(250) default NULL,
  suffix varchar(250) default NULL,
  g_max_messages int(5) default '50',
  g_max_mass_pm int(5) default '0',
  g_search_flood mediumint(6) default '20',
  g_edit_cutoff int(10) default '0',
  g_promotion varchar(10) default '-1&-1',
  g_hide_from_list tinyint(1) default '0',
  g_post_closed tinyint(1) default '0',
  g_perm_id varchar(255) NOT NULL default '',
  g_photo_max_vars varchar(200) default '',
  g_dohtml tinyint(1) NOT NULL default '0',
  g_edit_topic tinyint(1) NOT NULL default '0',
  g_email_limit varchar(15) NOT NULL default '10:15',
  PRIMARY KEY  (g_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_languages (
  lid mediumint(8) NOT NULL auto_increment,
  ldir varchar(64) NOT NULL default '',
  lname varchar(250) NOT NULL default '',
  lauthor varchar(250) default NULL,
  lemail varchar(250) default NULL,
  PRIMARY KEY  (lid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_macro (
  macro_id smallint(3) NOT NULL auto_increment,
  macro_value varchar(200) default NULL,
  macro_replace text,
  can_remove tinyint(1) default '0',
  macro_set smallint(3) NOT NULL default '',
  PRIMARY KEY  (macro_id),
  KEY macro_set (macro_set)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_macro_name (
  set_id smallint(3) NOT NULL default '0',
  set_name varchar(200) default NULL,
  PRIMARY KEY  (set_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_member_extra (
  id mediumint(8) NOT NULL default '0',
  notes text,
  links text,
  bio text,
  ta_size char(3) default NULL,
  photo_type varchar(10) default '',
  photo_location varchar(255) default '',
  photo_dimensions varchar(200) default '',
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_members (
  id mediumint(8) NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  mgroup smallint(3) NOT NULL default '0',
  password varchar(32) NOT NULL default '',
  email varchar(60) NOT NULL default '',
  joined int(10) NOT NULL default '0',
  ip_address varchar(16) NOT NULL default '',
  avatar varchar(128) default NULL,
  avatar_size varchar(9) default NULL,
  posts mediumint(7) default '0',
  aim_name varchar(40) default NULL,
  icq_number varchar(40) default NULL,
  location varchar(128) default NULL,
  signature text,
  website varchar(70) default NULL,
  yahoo varchar(32) default NULL,
  title varchar(64) default NULL,
  allow_admin_mails tinyint(1) default NULL,
  time_offset varchar(10) default NULL,
  interests text,
  hide_email varchar(8) default NULL,
  email_pm tinyint(1) default NULL,
  email_full tinyint(1) default NULL,
  skin smallint(5) default NULL,
  warn_level int(10) default NULL,
  warn_lastwarn int(10) NOT NULL default '0',
  language varchar(32) default NULL,
  msnname varchar(64) default NULL,
  last_post int(10) default NULL,
  restrict_post varchar(100) NOT NULL default '0',
  view_sigs tinyint(1) default '1',
  view_img tinyint(1) default '1',
  view_avs tinyint(1) default '1',
  view_pop tinyint(1) default '1',
  bday_day int(2) default NULL,
  bday_month int(2) default NULL,
  bday_year int(4) default NULL,
  new_msg tinyint(2) default NULL,
  msg_from_id mediumint(8) default NULL,
  msg_msg_id int(10) default NULL,
  msg_total smallint(5) default NULL,
  vdirs text,
  show_popup tinyint(1) default NULL,
  misc varchar(128) default NULL,
  last_visit int(10) default '0',
  last_activity int(10) default '0',
  dst_in_use tinyint(1) default '0',
  view_prefs varchar(64) default '-1&-1',
  coppa_user tinyint(1) default '0',
  mod_posts varchar(100) NOT NULL default '0',
  auto_track tinyint(1) default '0',
  org_perm_id varchar(255) default '',
  org_supmod tinyint(1) default '0',
  integ_msg varchar(250) default '',
  temp_ban varchar(100) default NULL,
  sub_end int(10) NOT NULL default '0',
  PRIMARY KEY  (id),
  KEY name (name),
  KEY mgroup (mgroup),
  KEY bday_day (bday_day),
  KEY bday_month (bday_month)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_messages (
  msg_id int(10) NOT NULL auto_increment,
  msg_date int(10) default NULL,
  read_state tinyint(1) default NULL,
  title varchar(128) default NULL,
  message text,
  from_id mediumint(8) NOT NULL default '0',
  vid varchar(32) default NULL,
  member_id mediumint(8) NOT NULL default '0',
  recipient_id mediumint(8) NOT NULL default '0',
  attach_type tinyint(128) default NULL,
  attach_file tinyint(128) default NULL,
  cc_users text,
  tracking tinyint(1) default '0',
  read_date int(10) default NULL,
  PRIMARY KEY  (msg_id),
  KEY member_id (member_id),
  KEY vid (vid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_moderator_logs (
  id int(10) NOT NULL auto_increment,
  forum_id int(5) default '0',
  topic_id int(10) NOT NULL default '0',
  post_id int(10) default NULL,
  member_id mediumint(8) NOT NULL default '0',
  member_name varchar(32) NOT NULL default '',
  ip_address varchar(16) NOT NULL default '0',
  http_referer varchar(255) default NULL,
  ctime int(10) default NULL,
  topic_title varchar(128) default NULL,
  action varchar(128) default NULL,
  query_string varchar(128) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_moderators (
  mid mediumint(8) NOT NULL auto_increment,
  forum_id int(5) NOT NULL default '0',
  member_name varchar(32) NOT NULL default '',
  member_id mediumint(8) NOT NULL default '0',
  edit_post tinyint(1) default NULL,
  edit_topic tinyint(1) default NULL,
  delete_post tinyint(1) default NULL,
  delete_topic tinyint(1) default NULL,
  view_ip tinyint(1) default NULL,
  open_topic tinyint(1) default NULL,
  close_topic tinyint(1) default NULL,
  mass_move tinyint(1) default NULL,
  mass_prune tinyint(1) default NULL,
  move_topic tinyint(1) default NULL,
  pin_topic tinyint(1) default NULL,
  unpin_topic tinyint(1) default NULL,
  post_q tinyint(1) default NULL,
  topic_q tinyint(1) default NULL,
  allow_warn tinyint(1) default NULL,
  edit_user tinyint(1) NOT NULL default '0',
  is_group tinyint(1) default '0',
  group_id smallint(3) default NULL,
  group_name varchar(200) default NULL,
  split_merge tinyint(1) default '0',
  can_mm tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (mid),
  KEY forum_id (forum_id),
  KEY group_id (group_id),
  KEY member_id (member_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_pfields_content (
  member_id mediumint(8) NOT NULL default '0',
  updated int(10) default '0',
  PRIMARY KEY  (member_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_pfields_data (
  fid smallint(5) NOT NULL auto_increment,
  ftitle varchar(200) NOT NULL default '',
  fdesc varchar(250) default '',
  fcontent text,
  ftype varchar(250) default 'text',
  freq tinyint(1) default '0',
  fhide tinyint(1) default '0',
  fmaxinput smallint(6) default '250',
  fedit tinyint(1) default '1',
  forder smallint(6) default '1',
  fshowreg tinyint(1) default '0',
  PRIMARY KEY  (fid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_polls (
  pid mediumint(8) NOT NULL auto_increment,
  tid int(10) NOT NULL default '0',
  start_date int(10) default NULL,
  choices text,
  starter_id mediumint(8) NOT NULL default '0',
  votes smallint(5) NOT NULL default '0',
  forum_id smallint(5) NOT NULL default '0',
  poll_question varchar(255) default NULL,
  PRIMARY KEY  (pid)
) TYPE=MyISAM;";


$SQL[] = "CREATE TABLE ibf_posts (
  pid int(10) NOT NULL auto_increment,
  append_edit tinyint(1) default '0',
  edit_time int(10) default NULL,
  author_id mediumint(8) NOT NULL default '0',
  author_name varchar(32) default NULL,
  use_sig tinyint(1) NOT NULL default '0',
  use_emo tinyint(1) NOT NULL default '0',
  ip_address varchar(16) NOT NULL default '',
  post_date int(10) default NULL,
  icon_id smallint(3) default NULL,
  post text,
  queued tinyint(1) default NULL,
  topic_id int(10) NOT NULL default '0',
  forum_id smallint(5) NOT NULL default '0',
  attach_id varchar(64) default NULL,
  attach_hits int(10) default NULL,
  attach_type varchar(128) default NULL,
  attach_file varchar(255) default NULL,
  post_title varchar(255) default NULL,
  new_topic tinyint(1) default '0',
  edit_name varchar(255) default NULL,
  PRIMARY KEY  (pid),
  KEY topic_id (topic_id,author_id),
  KEY author_id (author_id),
  KEY forum_id (forum_id,post_date),FULLTEXT KEY post (post)
) TYPE=MyISAM;";


$SQL[] = "CREATE TABLE ibf_reg_antispam (
  regid varchar(32) NOT NULL default '',
  regcode varchar(8) NOT NULL default '',
  ip_address varchar(32) default NULL,
  ctime int(10) default NULL,
  PRIMARY KEY  (regid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_search_results (
  id varchar(32) NOT NULL default '',
  topic_id text NOT NULL,
  search_date int(12) NOT NULL default '0',
  topic_max int(3) NOT NULL default '0',
  sort_key varchar(32) NOT NULL default 'last_post',
  sort_order varchar(4) NOT NULL default 'desc',
  member_id mediumint(10) default '0',
  ip_address varchar(64) default NULL,
  post_id text,
  post_max int(10) NOT NULL default '0',
  query_cache text
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_sessions (
  id varchar(32) NOT NULL default '0',
  member_name varchar(64) default NULL,
  member_id mediumint(8) NOT NULL default '0',
  ip_address varchar(16) default NULL,
  browser varchar(64) default NULL,
  running_time int(10) default NULL,
  login_type tinyint(1) default NULL,
  location varchar(40) default NULL,
  member_group smallint(3) default NULL,
  in_forum smallint(5) NOT NULL default '0',
  in_topic int(10) default NULL,
  PRIMARY KEY  (id),
  KEY in_topic (in_topic),
  KEY in_forum (in_forum)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_skin_templates (
  suid int(10) NOT NULL auto_increment,
  set_id int(10) NOT NULL default '0',
  group_name varchar(255) NOT NULL default '',
  section_content mediumtext,
  func_name varchar(255) default NULL,
  func_data text,
  updated int(10) default NULL,
  can_remove tinyint(4) default '0',
  PRIMARY KEY  (suid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_skins (
  uid int(10) NOT NULL auto_increment,
  sname varchar(100) NOT NULL default '',
  sid int(10) NOT NULL default '0',
  set_id int(5) NOT NULL default '0',
  tmpl_id int(10) NOT NULL default '0',
  macro_id int(10) NOT NULL default '1',
  css_id int(10) NOT NULL default '1',
  img_dir varchar(200) default '1',
  tbl_width varchar(250) default NULL,
  tbl_border varchar(250) default NULL,
  hidden tinyint(1) NOT NULL default '0',
  default_set tinyint(1) NOT NULL default '0',
  css_method varchar(100) default 'inline',
  PRIMARY KEY  (uid),
  KEY tmpl_id (tmpl_id),
  KEY css_id (css_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_spider_logs (
  sid int(10) NOT NULL auto_increment,
  bot varchar(255) NOT NULL default '',
  query_string text NOT NULL,
  entry_date int(10) NOT NULL default '0',
  ip_address varchar(16) NOT NULL default '',
  PRIMARY KEY  (sid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_stats (
  TOTAL_REPLIES int(10) NOT NULL default '0',
  TOTAL_TOPICS int(10) NOT NULL default '0',
  LAST_MEM_NAME varchar(32) default NULL,
  LAST_MEM_ID mediumint(8) NOT NULL default '0',
  MOST_DATE int(10) default NULL,
  MOST_COUNT int(10) default '0',
  MEM_COUNT mediumint(8) NOT NULL default '0'
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_subscriptions (
 sub_id smallint(5) NOT NULL auto_increment,
 sub_title varchar(250) NOT NULL default '',
 sub_desc text,
 sub_new_group mediumint(8) NOT NULL default 0,
 sub_length smallint(5) NOT NULL default '1',
 sub_unit varchar(2) NOT NULL default 'm',
 sub_cost decimal(10,2) NOT NULL default '0.00',
 sub_run_module varchar(250) NOT NULL default '',
 PRIMARY KEY (sub_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_subscription_extra (
 subextra_id smallint(5) NOT NULL auto_increment,
 subextra_sub_id smallint(5) NOT NULL default '0',
 subextra_method_id smallint(5) NOT NULL default '0',
 subextra_product_id varchar(250) NOT NULL default '0',
 subextra_can_upgrade tinyint(1) NOT NULL default '0',
 subextra_recurring tinyint(1) NOT NULL default '0',
 subextra_custom_1 text,
 subextra_custom_2 text,
 subextra_custom_3 text,
 subextra_custom_4 text,
 subextra_custom_5 text,
 PRIMARY KEY(subextra_id)
) TYPE=MyISAM;";


$SQL[] = "CREATE TABLE ibf_subscription_trans (
 subtrans_id int(10) NOT NULL auto_increment,
 subtrans_sub_id smallint(5) NOT NULL default '0',
 subtrans_member_id mediumint(8) NOT NULL default '0',
 subtrans_old_group smallint(5) NOT NULL default '0',
 subtrans_paid decimal(10,2) NOT NULL default '0.00',
 subtrans_cumulative decimal(10,2) NOT NULL default '0.00',
 subtrans_method varchar(20) NOT NULL default '',
 subtrans_start_date int(11) NOT NULL default '0',
 subtrans_end_date int(11) NOT NULL default '0',
 subtrans_state varchar(200) NOT NULL default '',
 subtrans_trxid varchar(200) NOT NULL default '',
 subtrans_subscrid varchar(200) NOT NULL default '',
 subtrans_currency varchar(10) NOT NULL default 'USD',
 PRIMARY KEY (subtrans_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_subscription_logs (
 sublog_id int(10) NOT NULL auto_increment,
 sublog_date int(10) NOT NULL default '',
 sublog_member_id mediumint(8) NOT NULL default '0',
 sublog_transid int(10) NOT NULL default '',
 sublog_ipaddress varchar(16) NOT NULL default '',
 sublog_data text,
 sublog_postdata text,
 PRIMARY KEY (sublog_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_subscription_methods (
 submethod_id smallint(5) NOT NULL auto_increment,
 submethod_title varchar(250) NOT NULL default '',
 submethod_name varchar(20) NOT NULL default '',
 submethod_email varchar(250) NOT NULL default '',
 submethod_sid text,
 submethod_custom_1 text,
 submethod_custom_2 text,
 submethod_custom_3 text,
 submethod_custom_4 text,
 submethod_custom_5 text,
 submethod_is_cc tinyint(1) NOT NULL default '0',
 submethod_is_auto tinyint(1) NOT NULL default '0',
 submethod_desc text,
 submethod_logo text,
 submethod_active tinyint(1) NOT NULL default '',
 submethod_use_currency varchar(10) NOT NULL default 'USD',
 PRIMARY KEY (submethod_id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_subscription_currency (
 subcurrency_code varchar(10) NOT NULL,
 subcurrency_desc varchar(250) NOT NULL default '',
 subcurrency_exchange decimal(10, 8) NOT NULL,
 subcurrency_default tinyint(1) NOT NULL default '0',
 PRIMARY KEY(subcurrency_code)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_templates (
  tmid int(10) NOT NULL auto_increment,
  template mediumtext,
  name varchar(128) default NULL,
  PRIMARY KEY  (tmid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_titles (
  id smallint(5) NOT NULL auto_increment,
  posts int(10) default NULL,
  title varchar(128) default NULL,
  pips varchar(128) default NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_tmpl_names (
  skid int(10) NOT NULL auto_increment,
  skname varchar(60) NOT NULL default 'Invision Board',
  author varchar(250) default '',
  email varchar(250) default '',
  url varchar(250) default '',
  PRIMARY KEY  (skid)
) TYPE=MyISAM;";

$SQL[] = "CREATE TABLE ibf_topic_mmod (
  mm_id smallint(5) NOT NULL auto_increment,
  mm_title varchar(250) NOT NULL default '',
  mm_enabled tinyint(1) NOT NULL default '0',
  topic_state varchar(10) NOT NULL default 'leave',
  topic_pin varchar(10) NOT NULL default 'leave',
  topic_move smallint(5) NOT NULL default '0',
  topic_move_link tinyint(1) NOT NULL default '0',
  topic_titl
 
Не съм се занимавал с IPB , но грешката е ясна.
Задаваш на полето по подразбиране " нищо " (под нищо , имам предвид буквално).Ето тук ти е грешката
$SQL[] = "CREATE TABLE ibf_macro (
macro_id smallint(3) NOT NULL auto_increment,
macro_value varchar(200) default NULL,
macro_replace text,
can_remove tinyint(1) default '0',
macro_set smallint(3) NOT NULL default 'тук трябва да има някаква стойност',
PRIMARY KEY (macro_id),
KEY macro_set (macro_set)
) TYPE=MyISAM;";
]
 

Горе