Index: trunk/web/punbb/install.php
===================================================================
--- trunk/web/punbb/install.php	(revision 10)
+++ trunk/web/punbb/install.php	(revision 1)
@@ -1,235 +1,60 @@
 <?php
-
-/**
- * Copyright (C) 2008-2011 FluxBB
- * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
- * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
- */
-
-// The FluxBB version this script installs
-define('FORUM_VERSION', '1.4.7');
-
-define('FORUM_DB_REVISION', 15);
-define('FORUM_SI_REVISION', 2);
-define('FORUM_PARSER_REVISION', 2);
-
-define('MIN_PHP_VERSION', '4.4.0');
-define('MIN_MYSQL_VERSION', '4.1.2');
-define('MIN_PGSQL_VERSION', '7.0.0');
-define('PUN_SEARCH_MIN_WORD', 3);
-define('PUN_SEARCH_MAX_WORD', 20);
-
-
-define('PUN_ROOT', dirname(__FILE__).'/');
-
-// Load the functions script
-require PUN_ROOT.'include/functions.php';
-
-// Load UTF-8 functions
-require PUN_ROOT.'include/utf8/utf8.php';
-
-// Strip out "bad" UTF-8 characters
-forum_remove_bad_characters();
-
-// Reverse the effect of register_globals
-forum_unregister_globals();
+/***********************************************************************
+
+  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
+
+  This file is part of PunBB.
+
+  PunBB 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.
+
+  PunBB 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., 59 Temple Place, Suite 330, Boston,
+  MA  02111-1307  USA
+
+************************************************************************/
+
+
+// The PunBB version this script installs
+$punbb_version = '1.2.10';
+$punbb_version_fr = '1.2.10';
+
+
+define('PUN_ROOT', './');
+if (file_exists(PUN_ROOT.'config.php'))
+	exit('Le fichier \'config.php\' existe dÃ©jÃ , ce qui signifie trÃšs probablement que PunBB est dÃ©jÃ  installÃ©. Vous devriez plutÃŽt <a href="index.php">aller ici</a>.');
+
+
+// Make sure we are running at least PHP 4.1.0
+if (intval(str_replace('.', '', phpversion())) < 410)
+	exit('Vous utilisez la version '.PHP_VERSION.' de PHP. PunBB nÃ©cÃ©ssite au minimum PHP 4.1.0 pour fonctionner correctement. Vous devez mettre Ã  jour votre installation de PHP afin que vous ne puissiez continuer.');
 
 // Disable error reporting for uninitialized variables
 error_reporting(E_ALL);
 
-// Force POSIX locale (to prevent functions such as strtolower() from messing up UTF-8 strings)
-setlocale(LC_CTYPE, 'C');
-
-// Turn off magic_quotes_runtime
-if (get_magic_quotes_runtime())
-	set_magic_quotes_runtime(0);
-
-// Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
-if (get_magic_quotes_gpc())
-{
-	function stripslashes_array($array)
-	{
-		return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
-	}
-
-	$_GET = stripslashes_array($_GET);
-	$_POST = stripslashes_array($_POST);
-	$_COOKIE = stripslashes_array($_COOKIE);
-	$_REQUEST = stripslashes_array($_REQUEST);
-}
-
 // Turn off PHP time limit
 @set_time_limit(0);
 
 
-// If we've been passed a default language, use it
-$install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English';
-
-// If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English
-if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php'))
-	$install_lang = 'English';
-
-require PUN_ROOT.'lang/'.$install_lang.'/install.php';
-
-if (file_exists(PUN_ROOT.'config.php'))
-{
-	// Check to see whether FluxBB is already installed
-	include PUN_ROOT.'config.php';
-
-	// If we have the 1.3-legacy constant defined, define the proper 1.4 constant so we don't get an incorrect "need to install" message
-	if (defined('FORUM'))
-		define('PUN', FORUM);
-
-	// If PUN is defined, config.php is probably valid and thus the software is installed
-	if (defined('PUN'))
-		exit($lang_install['Already installed']);
-}
-
-// Define PUN because email.php requires it
-define('PUN', 1);
-
-// If the cache directory is not specified, we use the default setting
-if (!defined('FORUM_CACHE_DIR'))
-	define('FORUM_CACHE_DIR', PUN_ROOT.'cache/');
-
-// Make sure we are running at least MIN_PHP_VERSION
-if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
-	exit(sprintf($lang_install['You are running error'], 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION));
-
-
-//
-// Generate output to be used for config.php
-//
-function generate_config_file()
-{
-	global $db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix, $cookie_name, $cookie_seed;
-
-	return '<?php'."\n\n".'$db_type = \''.$db_type."';\n".'$db_host = \''.$db_host."';\n".'$db_name = \''.addslashes($db_name)."';\n".'$db_username = \''.addslashes($db_username)."';\n".'$db_password = \''.addslashes($db_password)."';\n".'$db_prefix = \''.addslashes($db_prefix)."';\n".'$p_connect = false;'."\n\n".'$cookie_name = '."'".$cookie_name."';\n".'$cookie_domain = '."'';\n".'$cookie_path = '."'/';\n".'$cookie_secure = 0;'."\n".'$cookie_seed = \''.random_key(16, false, true)."';\n\ndefine('PUN', 1);\n";
-}
-
-
-if (isset($_POST['generate_config']))
-{
-	header('Content-Type: text/x-delimtext; name="config.php"');
-	header('Content-disposition: attachment; filename=config.php');
-
-	$db_type = $_POST['db_type'];
-	$db_host = $_POST['db_host'];
-	$db_name = $_POST['db_name'];
-	$db_username = $_POST['db_username'];
-	$db_password = $_POST['db_password'];
-	$db_prefix = $_POST['db_prefix'];
-	$cookie_name = $_POST['cookie_name'];
-	$cookie_seed = $_POST['cookie_seed'];
-
-	echo generate_config_file();
-	exit;
-}
-
-
 if (!isset($_POST['form_sent']))
-{
-	// Make an educated guess regarding base_url
-	$base_url  = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';	// protocol
-	$base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']);							// host[:port]
-	$base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));							// path
-
-	if (substr($base_url, -1) == '/')
-		$base_url = substr($base_url, 0, -1);
-
-	$db_type = $db_name = $db_username = $db_prefix = $username = $email = '';
-	$db_host = 'localhost';
-	$title = $lang_install['My FluxBB Forum'];
-	$description = '<p><span>'.$lang_install['Description'].'</span></p>';
-	$default_lang = $install_lang;
-	$default_style = 'Air';
-}
-else
-{
-	$db_type = $_POST['req_db_type'];
-	$db_host = pun_trim($_POST['req_db_host']);
-	$db_name = pun_trim($_POST['req_db_name']);
-	$db_username = pun_trim($_POST['db_username']);
-	$db_password = pun_trim($_POST['db_password']);
-	$db_prefix = pun_trim($_POST['db_prefix']);
-	$username = pun_trim($_POST['req_username']);
-	$email = strtolower(pun_trim($_POST['req_email']));
-	$password1 = pun_trim($_POST['req_password1']);
-	$password2 = pun_trim($_POST['req_password2']);
-	$title = pun_trim($_POST['req_title']);
-	$description = pun_trim($_POST['desc']);
-	$base_url = pun_trim($_POST['req_base_url']);
-	$default_lang = pun_trim($_POST['req_default_lang']);
-	$default_style = pun_trim($_POST['req_default_style']);
-	$alerts = array();
-
-	// Make sure base_url doesn't end with a slash
-	if (substr($base_url, -1) == '/')
-		$base_url = substr($base_url, 0, -1);
-
-	// Validate username and passwords
-	if (pun_strlen($username) < 2)
-		$alerts[] = $lang_install['Username 1'];
-	else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters
-		$alerts[] = $lang_install['Username 2'];
-	else if (!strcasecmp($username, 'Guest'))
-		$alerts[] = $lang_install['Username 3'];
-	else if (preg_match('%[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}%', $username) || preg_match('%((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))%', $username))
-		$alerts[] = $lang_install['Username 4'];
-	else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
-		$alerts[] = $lang_install['Username 5'];
-	else if (preg_match('%(?:\[/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)%i', $username))
-		$alerts[] = $lang_install['Username 6'];
-
-	if (pun_strlen($password1) < 4)
-		$alerts[] = $lang_install['Short password'];
-	else if ($password1 != $password2)
-		$alerts[] = $lang_install['Passwords not match'];
-
-	// Validate email
-	require PUN_ROOT.'include/email.php';
-
-	if (!is_valid_email($email))
-		$alerts[] = $lang_install['Wrong email'];
-
-	if ($title == '')
-		$alerts[] = $lang_install['No board title'];
-
-	$languages = forum_list_langs();
-	if (!in_array($default_lang, $languages))
-		$alerts[] = $lang_install['Error default language'];
-
-	$styles = forum_list_styles();
-	if (!in_array($default_style, $styles))
-		$alerts[] = $lang_install['Error default style'];
-}
-
-// Check if the cache directory is writable
-if (!@is_writable(FORUM_CACHE_DIR))
-	$alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR);
-
-// Check if default avatar directory is writable
-if (!@is_writable(PUN_ROOT.'img/avatars/'))
-	$alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/');
-
-if (!isset($_POST['form_sent']) || !empty($alerts))
 {
 	// Determine available database extensions
 	$dual_mysql = false;
 	$db_extensions = array();
-	$mysql_innodb = false;
 	if (function_exists('mysqli_connect'))
-	{
-		$db_extensions[] = array('mysqli', 'MySQL Improved');
-		$db_extensions[] = array('mysqli_innodb', 'MySQL Improved (InnoDB)');
-		$mysql_innodb = true;
-	}
+		$db_extensions[] = array('mysqli', 'MySQL amÃ©liorÃ© (MySQL Improved)');
 	if (function_exists('mysql_connect'))
 	{
 		$db_extensions[] = array('mysql', 'MySQL Standard');
-		$db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)');
-		$mysql_innodb = true;
-
-		if (count($db_extensions) > 2)
+
+		if (count($db_extensions) > 1)
 			$dual_mysql = true;
 	}
@@ -240,141 +65,86 @@
 
 	if (empty($db_extensions))
-		error($lang_install['No DB extensions']);
-
-	// Fetch a list of installed languages
-	$languages = forum_list_langs();
+		exit('Cet environnement PHP n\'a le support pour aucune bases de donnÃ©es que PunBB peut utiliser. Afin d\'installer PunBB, PHP doit supporter soit MySQL, PostgreSQL ou SQLite.');
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
+
+<html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title><?php echo $lang_install['FluxBB Installation'] ?></title>
-<link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>Installation de PunBB</title>
+<link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
 <script type="text/javascript">
-/* <![CDATA[ */
+<!--
 function process_form(the_form)
 {
-	var element_names = {
-		"req_db_type": "<?php echo $lang_install['Database type'] ?>",
-		"req_db_host": "<?php echo $lang_install['Database server hostname'] ?>",
-		"req_db_name": "<?php echo $lang_install['Database name'] ?>",
-		"db_prefix": "<?php echo $lang_install['Table prefix'] ?>",
-		"req_username": "<?php echo $lang_install['Administrator username'] ?>",
-		"req_password1": "<?php echo $lang_install['Administrator password 1'] ?>",
-		"req_password2": "<?php echo $lang_install['Administrator password 2'] ?>",
-		"req_email": "<?php echo $lang_install['Administrator email'] ?>",
-		"req_title": "<?php echo $lang_install['Board title'] ?>",
-		"req_base_url": "<?php echo $lang_install['Base URL'] ?>"
-	};
+	var element_names = new Object()
+	element_names["req_db_type"] = "Type de base de donnÃ©es"
+	element_names["req_db_host"] = "HÃŽte serveur de base de donnÃ©es"
+	element_names["req_db_name"] = "Nom de base de donnÃ©es"
+	element_names["db_prefix"] = "PrÃ©fixe tables"
+	element_names["req_username"] = "Nom utilisateur administrateur"
+	element_names["req_password1"] = "Mot de passe administrateur 1"
+	element_names["req_password2"] = "Mot de passe administrateur 2"
+	element_names["req_email"] = "E-mail administrateur"
+	element_names["req_base_url"] = "URL de base"
+
 	if (document.all || document.getElementById)
 	{
-		for (var i = 0; i < the_form.length; ++i)
+		for (i = 0; i < the_form.length; ++i)
 		{
-			var elem = the_form.elements[i];
-			if (elem.name && (/^req_/.test(elem.name)))
+			var elem = the_form.elements[i]
+			if (elem.name && elem.name.substring(0, 4) == "req_")
 			{
-				if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type)))
+				if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')
 				{
-					alert('"' + element_names[elem.name] + '" <?php echo $lang_install['Required field'] ?>');
-					elem.focus();
-					return false;
+					alert("\"" + element_names[elem.name] + "\" est un champ requis pour ce formulaire.")
+					elem.focus()
+					return false
 				}
 			}
 		}
 	}
-	return true;
+
+	return true
 }
-/* ]]> */
+// -->
 </script>
 </head>
-<body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;" onunload="">
-
-<div id="puninstall" class="pun">
-<div class="top-box"><div><!-- Top Corners --></div></div>
-<div class="punwrap">
-
-<div id="brdheader" class="block">
+<body onload="document.getElementById('install').req_db_type.focus()">
+
+<div id="puninstall" style="margin: auto 10% auto 10%">
+<div class="pun">
+
+<div class="block">
+	<h2><span>Installation de PunBB</span></h2>
 	<div class="box">
-		<div id="brdtitle" class="inbox">
-			<h1><span><?php echo $lang_install['FluxBB Installation'] ?></span></h1>
-			<div id="brddesc"><p><?php echo $lang_install['Install message'] ?></p><p><?php echo $lang_install['Welcome'] ?></p></div>
+		<div class="inbox">
+			<p>Bienvenue sur l'application d'installation de  PunBB ! Vous vous apprÃªtez Ã  installer PunBB. Afin d'installer celui-ci vous devez remplir le formulaire ci-dessous. Si vous rencontrez des difficultÃ©s avec l'installation, veuillez s'il vous plait vous rÃ©fÃ©rer Ã  la documentation.</p>
 		</div>
 	</div>
 </div>
 
-<div id="brdmain">
-<?php if (count($languages) > 1): ?><div class="blockform">
-	<h2><span><?php echo $lang_install['Choose install language'] ?></span></h2>
-	<div class="box">
-		<form id="install" method="post" action="install.php">
-			<div class="inform">
-				<fieldset>
-					<legend><?php echo $lang_install['Install language'] ?></legend>
-					<div class="infldset">
-						<p><?php echo $lang_install['Choose install language info'] ?></p>
-						<label><strong><?php echo $lang_install['Install language'] ?></strong>
-						<br /><select name="install_lang">
-<?php
-
-		foreach ($languages as $temp)
-		{
-			if ($temp == $install_lang)
-				echo "\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
-			else
-				echo "\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
-		}
-
-?>
-						</select>
-						<br /></label>
-					</div>
-				</fieldset>
-			</div>
-			<p class="buttons"><input type="submit" name="start" value="<?php echo $lang_install['Change language'] ?>" /></p>
-		</form>
-	</div>
-</div>
-<?php endif; ?>
-
 <div class="blockform">
-	<h2><span><?php echo $lang_install['Install'] ?></span></h2>
+	<h2><span>Installer PunBB</span></h2>
 	<div class="box">
 		<form id="install" method="post" action="install.php" onsubmit="this.start.disabled=true;if(process_form(this)){return true;}else{this.start.disabled=false;return false;}">
-		<div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div>
-			<div class="inform">
-<?php if (!empty($alerts)): ?>				<div class="forminfo error-info">
-					<h3><?php echo $lang_install['Errors'] ?></h3>
-					<ul class="error-list">
-<?php
-
-foreach ($alerts as $cur_alert)
-	echo "\t\t\t\t\t\t".'<li><strong>'.$cur_alert.'</strong></li>'."\n";
-?>
-					</ul>
-				</div>
-<?php endif; ?>			</div>
+		<div><input type="hidden" name="form_sent" value="1" /></div>
 			<div class="inform">
 				<div class="forminfo">
-					<h3><?php echo $lang_install['Database setup'] ?></h3>
-					<p><?php echo $lang_install['Info 1'] ?></p>
+					<h3>RÃ©glages de la base de donnÃ©es</h3>
+					<p>Afin d'installer votre base de donnÃ©es pour PunBB, veuillez saisir les informations demandÃ©es ci-dessous. Vous devez connaÃ®tre toutes les informations demandÃ©es avant de procÃ©der Ã  l'installation.</p>
 				</div>
 				<fieldset>
-				<legend><?php echo $lang_install['Select database'] ?></legend>
+				<legend>SÃ©lectionnez le type de votre base de donnÃ©es</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 2'] ?></p>
-<?php if ($dual_mysql): ?>						<p><?php echo $lang_install['Dual MySQL'] ?></p>
-<?php endif; ?><?php if ($mysql_innodb): ?>						<p><?php echo $lang_install['InnoDB'] ?></p>
-<?php endif; ?>						<label class="required"><strong><?php echo $lang_install['Database type'] ?> <span><?php echo $lang_install['Required'] ?></span></strong>
+						<p>PunBB supporte actuellement MySQL, PostgreSQL et SQLite. Si votre base de donnÃ©es est absente du menu dÃ©roulant ci-dessous, cela signifie que cet environnement <acronym title="PHP: Hypertext Preprocessor" lang="en">PHP</acronym> n'a pas le support pour cette base de donnÃ©es particuliÃšre. Plus d'information concernant le support des versions particuliÃšres de chaque base de donnÃ©es pourra Ãªtre trouvÃ©e dans la <acronym title="Frequently Asked Questions" lang="en">FAQ</acronym>.</p>
+<?php if ($dual_mysql): ?>						<p>PunBB a dÃ©tectÃ© que votre environnement PHP supporte deux maniÃšres diffÃ©rentes de communiquer avec MySQL. Les deux options s'appellent "standard" (MySQL) et "amÃ©liorÃ©" (MySQLi ; "i" comme "improved"). Si vous n'Ãªtes pas certain de laquelle utiliser, commencez par essayer "amÃ©liorÃ©" et si cela Ã©choue, essayez "standard".</p>
+<?php endif; ?>						<label><strong>Type de base de donnÃ©es</strong>
 						<br /><select name="req_db_type">
 <?php
 
-	foreach ($db_extensions as $temp)
-	{
-		if ($temp[0] == $db_type)
-			echo "\t\t\t\t\t\t\t".'<option value="'.$temp[0].'" selected="selected">'.$temp[1].'</option>'."\n";
-		else
-			echo "\t\t\t\t\t\t\t".'<option value="'.$temp[0].'">'.$temp[1].'</option>'."\n";
-	}
+	foreach ($db_extensions as $db_type)
+		echo "\t\t\t\t\t\t\t".'<option value="'.$db_type[0].'">'.$db_type[1].'</option>'."\n";
 
 ?>
@@ -386,8 +156,8 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Database hostname'] ?></legend>
+					<legend>Saisissez l'adresse de votre serveur de base de donnÃ©es</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 3'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Database server hostname'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input type="text" name="req_db_host" value="<?php echo pun_htmlspecialchars($db_host) ?>" size="50" /><br /></label>
+						<p>L'adresse du serveur de base de donnÃ©es  (exemples : localhost, db.monhote.com ou 192.168.0.15). Vous pouvez indiquer un numÃ©ro de port personnalisÃ© au cas oÃ¹ votre base de donnÃ©e ne fonctionne pas sur le port par dÃ©faut  (exemple : localhost:3580). Pour le support de SQLite, Ã©crivez n'importe quoi ou laissez 'localhost'.</p>
+						<label><strong>HÃŽte serveur de base de donnÃ©es</strong><br /><input type="text" name="req_db_host" value="localhost" size="50" maxlength="100" /><br /></label>
 					</div>
 				</fieldset>
@@ -395,8 +165,8 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Database enter name'] ?></legend>
+					<legend>Saisissez le nom de votre base de donnÃ©es</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 4'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Database name'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input id="req_db_name" type="text" name="req_db_name" value="<?php echo pun_htmlspecialchars($db_name) ?>" size="30" /><br /></label>
+						<p>Le nom de la base de donnÃ©es sur laquelle PunBB sera installÃ©. La base de donnÃ©es doit exister. Pour SQLite, il s'agit du chemin relatif vers le fichier de base de donnÃ©es. Si ce fichier de base de donnÃ©es SQLite n'existe pas, PunBB essayera de le crÃ©er.</p>
+						<label for="req_db_name"><strong>Nom de la base de donnÃ©es</strong><br /><input id="req_db_name" type="text" name="req_db_name" size="30" maxlength="50" /><br /></label>
 					</div>
 				</fieldset>
@@ -404,9 +174,9 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Database enter informations'] ?></legend>
+					<legend>Saisissez votre nom d'utilisateur et votre mot de passe de la base de donnÃ©es</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 5'] ?></p>
-						<label class="conl"><?php echo $lang_install['Database username'] ?><br /><input type="text" name="db_username" value="<?php echo pun_htmlspecialchars($db_username) ?>" size="30" /><br /></label>
-						<label class="conl"><?php echo $lang_install['Database password'] ?><br /><input type="password" name="db_password" size="30" /><br /></label>
+						<p>Saisissez le nom d'utilisateur et le mot de passe que vous utilisez pour vous connecter Ã  la base de donnÃ©es. Ignorez pour SQLite.</p>
+						<label class="conl">Nom d'utilisateur <acronym title="Base de donnÃ©es">BDD</acronym><br /><input type="text" name="db_username" size="30" maxlength="50" /><br /></label>
+						<label class="conl">Mot de passe <acronym title="Base de donnÃ©es">BDD</acronym><br /><input type="text" name="db_password" size="30" maxlength="50" /><br /></label>
 						<div class="clearer"></div>
 					</div>
@@ -415,8 +185,8 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Database enter prefix'] ?></legend>
+					<legend>Saisissez le prÃ©fixe des tables</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 6'] ?></p>
-						<label><?php echo $lang_install['Table prefix'] ?><br /><input id="db_prefix" type="text" name="db_prefix" value="<?php echo pun_htmlspecialchars($db_prefix) ?>" size="20" maxlength="30" /><br /></label>
+						<p>Si vous le souhaitez vous pouvez indiquer un prÃ©fixe de tables. De cette faÃ§on vous pouvez utiliser plusieurs installations de PunBB sur la mÃªme base de donnÃ©es. (exemple : pun_).</p>
+						<label>PrÃ©fixe tables<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label>
 					</div>
 				</fieldset>
@@ -424,12 +194,12 @@
 			<div class="inform">
 				<div class="forminfo">
-					<h3><?php echo $lang_install['Administration setup'] ?></h3>
-					<p><?php echo $lang_install['Info 7'] ?></p>
+					<h3>RÃ©glages d'administration</h3>
+					<p>Veuillez saisir les informations demandÃ©es ci-dessous afin de dÃ©finir un administrateur pour votre installation de PunBB.</p>
 				</div>
 				<fieldset>
-					<legend><?php echo $lang_install['Admin enter username'] ?></legend>
+					<legend>Saisissez le nom d'utilisateur de l'administrateur</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 8'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Administrator username'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input type="text" name="req_username" value="<?php echo pun_htmlspecialchars($username) ?>" size="25" maxlength="25" /><br /></label>
+						<p>Le nom d'utilisateur de l'administrateur des forums. Vous pourrez par la suite crÃ©er de nouveaux administrateurs ainsi que des modÃ©rateurs. Ce nom d'utilisateur peut faire entre 2 et 25 caractÃšres de long.</p>
+						<label><strong>Nom d'utilisateur administrateur</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>
 					</div>
 				</fieldset>
@@ -437,9 +207,9 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Admin enter password'] ?></legend>
+					<legend>Saisissez et confirmez le mot de passe administrateur</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 9'] ?></p>
-						<label class="conl required"><strong><?php echo $lang_install['Password'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input id="req_password1" type="password" name="req_password1" size="16" /><br /></label>
-						<label class="conl required"><strong><?php echo $lang_install['Confirm password'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input type="password" name="req_password2" size="16" /><br /></label>
+					<p>Les mots de passe peuvent faire entre 4 et 16 caractÃšres de long. Les mots de passe sont sensibles Ã  la casse.</p>
+						<label class="conl"><strong>Mot de passe</strong><br /><input id="req_password1" type="text" name="req_password1" size="16" maxlength="16" /><br /></label>
+						<label class="conl"><strong>Confirmez le mot de passe</strong><br /><input type="text" name="req_password2" size="16" maxlength="16" /><br /></label>
 						<div class="clearer"></div>
 					</div>
@@ -448,21 +218,8 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Admin enter email'] ?></legend>
+					<legend>Saisissez l'adresse e-mail de l'administrateur</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 10'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Administrator email'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input id="req_email" type="text" name="req_email" value="<?php echo pun_htmlspecialchars($email) ?>" size="50" maxlength="80" /><br /></label>
-					</div>
-				</fieldset>
-			</div>
-			<div class="inform">
-				<div class="forminfo">
-					<h3><?php echo $lang_install['Board setup'] ?></h3>
-					<p><?php echo $lang_install['Info 11'] ?></p>
-				</div>
-				<fieldset>
-					<legend><?php echo $lang_install['Enter board title'] ?></legend>
-					<div class="infldset">
-						<p><?php echo $lang_install['Info 12'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Board title'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input id="req_title" type="text" name="req_title" value="<?php echo pun_htmlspecialchars($title) ?>" size="60" maxlength="255" /><br /></label>
+						<p>L'adresse e-mail de l'administrateur des forums.</p>
+						<label for="req_email"><strong>E-mail administrateur</strong><br /><input id="req_email" type="text" name="req_email" size="50" maxlength="50" /><br /></label>
 					</div>
 				</fieldset>
@@ -470,72 +227,17 @@
 			<div class="inform">
 				<fieldset>
-					<legend><?php echo $lang_install['Enter board description'] ?></legend>
+					<legend>Saisissez l'<acronym title="Uniform Resource Locator" lang="en">URL</acronym> de base de votre installation de PunBB</legend>
 					<div class="infldset">
-						<p><?php echo $lang_install['Info 13'] ?></p>
-						<label><?php echo $lang_install['Board description'] ?><br /><input id="desc" type="text" name="desc" value="<?php echo pun_htmlspecialchars($description) ?>" size="60" maxlength="255" /><br /></label>
+						<p>L'<acronym title="Uniform Resource Locator" lang="en">URL</acronym> de base (sans slash Ã  la fin) de vos forums PunBB (exemple : http://forum.mondomaine.com ou http://monhote.com/~utilisateur). Ceci <strong>doit Ãªtre correct</strong> ou les administrateurs et modÃ©rateurs ne pourront valider aucun des formulaires. Veuillez noter que la valeur prÃ©-rÃ©glÃ©e ci-dessous est juste une proposition devinÃ©e par PunBB.</p>
+						<label><strong><acronym title="Uniform Resource Locator" lang="en">URL</acronym> de base</strong><br /><input type="text" name="req_base_url" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])) ?>" size="60" maxlength="100" /><br /></label>
 					</div>
 				</fieldset>
 			</div>
-			<div class="inform">
-				<fieldset>
-					<legend><?php echo $lang_install['Enter base URL'] ?></legend>
-					<div class="infldset">
-						<p><?php echo $lang_install['Info 14'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Base URL'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><input id="req_base_url" type="text" name="req_base_url" value="<?php echo pun_htmlspecialchars($base_url) ?>" size="60" maxlength="100" /><br /></label>
-					</div>
-				</fieldset>
-			</div>
-			<div class="inform">
-				<fieldset>
-					<legend><?php echo $lang_install['Choose the default language'] ?></legend>
-					<div class="infldset">
-						<p><?php echo $lang_install['Info 15'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Default language'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><select id="req_default_lang" name="req_default_lang">
-<?php
-
-		$languages = forum_list_langs();
-		foreach ($languages as $temp)
-		{
-			if ($temp == $default_lang)
-				echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
-			else
-				echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
-		}
-
-?>
-						</select><br /></label>
-					</div>
-				</fieldset>
-			</div>
-			<div class="inform">
-				<fieldset>
-					<legend><?php echo $lang_install['Choose the default style'] ?></legend>
-					<div class="infldset">
-						<p><?php echo $lang_install['Info 16'] ?></p>
-						<label class="required"><strong><?php echo $lang_install['Default style'] ?> <span><?php echo $lang_install['Required'] ?></span></strong><br /><select id="req_default_style" name="req_default_style">
-<?php
-
-		$styles = forum_list_styles();
-		foreach ($styles as $temp)
-		{
-			if ($temp == $default_style)
-				echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n";
-			else
-				echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
-		}
-
-?>
-						</select><br /></label>
-					</div>
-				</fieldset>
-			</div>
-			<p class="buttons"><input type="submit" name="start" value="<?php echo $lang_install['Start install'] ?>" /></p>
+			<p><input type="submit" name="start" value="Lancer l'installation" /></p>
 		</form>
 	</div>
 </div>
+
 </div>
-
-</div>
-<div class="end-box"><div><!-- Bottom Corners --></div></div>
 </div>
 
@@ -547,4 +249,87 @@
 else
 {
+	//
+	// Strip slashes only if magic_quotes_gpc is on.
+	//
+	function unescape($str)
+	{
+		return (get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str;
+	}
+
+
+	//
+	// Compute a hash of $str.
+	// Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5().
+	//
+	function pun_hash($str)
+	{
+		if (function_exists('sha1'))	// Only in PHP 4.3.0+
+			return sha1($str);
+		else if (function_exists('mhash'))	// Only if Mhash library is loaded
+			return bin2hex(mhash(MHASH_SHA1, $str));
+		else
+			return md5($str);
+	}
+
+
+	//
+	// A temporary replacement for the full error handler found in functions.php.
+	// It's here because a function called error() must be callable in the database abstraction layer.
+	//
+	function error($message, $file = false, $line = false, $db_error = false)
+	{
+		if ($file !== false && $line !== false)
+			echo '<strong style="color: A00000">Une erreur s\'est produite Ã  la ligne '.$line.' dans le fichier '.$file.'.</strong><br /><br />';
+		else
+			echo '<strong style="color: A00000">Une erreur s\'est produite.</strong><br /><br />';
+
+		echo '<strong>PunBB a rapportÃ©&#160;:</strong> '.htmlspecialchars($message).'<br /><br />';
+
+		if ($db_error !== false)
+			echo '<strong>La base de donnÃ©es a rapportÃ©&#160;:</strong> '.htmlspecialchars($db_error['error_msg']).(($db_error['error_no']) ? ' (Errno: '.$db_error['error_no'].')' : '');
+
+		exit;
+	}
+
+
+	$db_type = $_POST['req_db_type'];
+	$db_host = trim($_POST['req_db_host']);
+	$db_name = trim($_POST['req_db_name']);
+	$db_username = unescape(trim($_POST['db_username']));
+	$db_password = unescape(trim($_POST['db_password']));
+	$db_prefix = trim($_POST['db_prefix']);
+	$username = unescape(trim($_POST['req_username']));
+	$email = strtolower(trim($_POST['req_email']));
+	$password1 = unescape(trim($_POST['req_password1']));
+	$password2 = unescape(trim($_POST['req_password2']));
+
+
+	// Make sure base_url doesn't end with a slash
+	if (substr($_POST['req_base_url'], -1) == '/')
+		$base_url = substr($_POST['req_base_url'], 0, -1);
+	else
+		$base_url = $_POST['req_base_url'];
+
+
+	// Validate username and passwords
+	if (strlen($username) < 2)
+		error('Le nom d\'utilisateur administrateur doit faire au moins 2 caractÃšres de long. Veuillez retourner en arriÃšre et corriger.');
+	if (strlen($password1) < 4)
+		error('Le mot de passe administrateur doit faire au moins 4 caractÃšres de long. Veuillez retourner en arriÃšre et corriger.');
+	if ($password1 != $password2)
+		error('Les mots de passe administrateur ne correspondent pas. Veuillez retourner en arriÃšre et corriger.');
+	if (!strcasecmp($username, 'invitÃ©'))
+		error('Le nom d\'utilisateur \'invitÃ©\' est rÃ©servÃ©. Veuillez retourner en arriÃšre et corriger.');
+	if (!strcasecmp($username, 'guest'))
+		error('Le nom d\'utilisateur \'guest\' est rÃ©servÃ©. Veuillez retourner en arriÃšre et corriger.');
+	if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
+		error('Les noms d\'utilisateur ne peuvent Ãªtre de la forme d\'une adresse IP. Veuillez retourner en arriÃšre et corriger.');
+	if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
+		error('Le nom d\'utilisateur ne peut contenir aucune des balise de formatage (BBCode) que les forums utilisent. Veuillez retourner en arriÃšre et corriger.');
+
+	if (strlen($email) > 50 || !preg_match('/^(([^<>()[\]\\.,;:\s@"\']+(\.[^<>()[\]\\.,;:\s@"\']+)*)|("[^"\']+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-zA-Z\d\-]+\.)+[a-zA-Z]{2,}))$/', $email))
+		error('L\'adresse e-mail administrateur que vous avez saisie est incorrecte. Veuillez retourner en arriÃšre et corriger.');
+
+
 	// Load the appropriate DB layer class
 	switch ($db_type)
@@ -554,16 +339,8 @@
 			break;
 
-		case 'mysql_innodb':
-			require PUN_ROOT.'include/dblayer/mysql_innodb.php';
-			break;
-
 		case 'mysqli':
 			require PUN_ROOT.'include/dblayer/mysqli.php';
 			break;
 
-		case 'mysqli_innodb':
-			require PUN_ROOT.'include/dblayer/mysqli_innodb.php';
-			break;
-
 		case 'pgsql':
 			require PUN_ROOT.'include/dblayer/pgsql.php';
@@ -573,7 +350,7 @@
 			require PUN_ROOT.'include/dblayer/sqlite.php';
 			break;
-
+			
 		default:
-			error(sprintf($lang_install['DB type not valid'], pun_htmlspecialchars($db_type)));
+			error('\''.$db_type.'\' n\'est pas un type de base de donnÃ©es valable.');
 	}
 
@@ -581,7 +358,4 @@
 	$db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
 
-	// Validate prefix
-	if (strlen($db_prefix) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $db_prefix) || strlen($db_prefix) > 40))
-		error(sprintf($lang_install['Table prefix error'], $db->prefix));
 
 	// Do some DB type specific checks
@@ -590,1010 +364,933 @@
 		case 'mysql':
 		case 'mysqli':
-		case 'mysql_innodb':
-		case 'mysqli_innodb':
-			$mysql_info = $db->get_version();
-			if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<'))
-				error(sprintf($lang_install['You are running error'], 'MySQL', $mysql_info['version'], FORUM_VERSION, MIN_MYSQL_VERSION));
-			break;
-
-		case 'pgsql':
-			$pgsql_info = $db->get_version();
-			if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<'))
-				error(sprintf($lang_install['You are running error'], 'PostgreSQL', $pgsql_info['version'], FORUM_VERSION, MIN_PGSQL_VERSION));
+			break;
+
+		case 'pgsql':
+			// Make sure we are running at least PHP 4.3.0 (needed only for PostgreSQL)
+			if (version_compare(PHP_VERSION, '4.3.0', '<'))
+				error('Vous utilisez la version '.PHP_VERSION.'de PHP. PunBB nÃ©cÃ©ssite au minimum PHP 4.3.0 pour fonctionner correctement avec PostgreSQL. Vous devez mettre Ã  jour votre installation de PHP ou utiliser une base de donnÃ©es diffÃ©rente pour continuer.');
 			break;
 
 		case 'sqlite':
 			if (strtolower($db_prefix) == 'sqlite_')
-				error($lang_install['Prefix reserved']);
-			break;
-	}
-
-
-	// Make sure FluxBB isn't already installed
+				error('Le prÃ©fixe de tables \'sqlite_\' est rÃ©servÃ© pour l\'utilisation du moteur SQLite. Veuillez choisir un prÃ©fixe diffÃ©rent.');
+			break;
+	}
+
+
+	// Make sure PunBB isn't already installed
 	$result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1');
 	if ($db->num_rows($result))
-		error(sprintf($lang_install['Existing table error'], $db_prefix, $db_name));
-
-	// Check if InnoDB is available
-	if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
-	{
-		$result = $db->query('SHOW VARIABLES LIKE \'have_innodb\'');
-		list (, $result) = $db->fetch_row($result);
-		if ((strtoupper($result) != 'YES'))
-			error($lang_install['InnoDB off']);
-	}
-
-
-	// Start a transaction
-	$db->start_transaction();
+		error('Une table nommÃ©e "'.$db_prefix.'users" est dÃ©jÃ  prÃ©sente dans la base de donnÃ©es "'.$db_name.'". Ceci pourrait signifier que PunBB est dÃ©jÃ  installÃ© ou qu\'un autre logiciel est installÃ© et occupe un ou plusieurs des noms de tables nÃ©cÃ©ssaires Ã  PunBB. Si vous souhaitez installer plusieurs copies de PunBB sur la mÃªme base de donnÃ©s, vous devez choisir des prÃ©fixes de tables diffÃ©rents.');
 
 
 	// Create all tables
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'username'		=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> true
-			),
-			'ip'			=> array(
-				'datatype'		=> 'VARCHAR(255)',
-				'allow_null'	=> true
-			),
-			'email'			=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> true
-			),
-			'message'		=> array(
-				'datatype'		=> 'VARCHAR(255)',
-				'allow_null'	=> true
-			),
-			'expire'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'ban_creator'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('id'),
-		'INDEXES'		=> array(
-			'username_idx'	=> array('username')
-		)
-	);
-
-	if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
-		$schema['INDEXES']['username_idx'] = array('username(25)');
-
-	$db->create_table('bans', $schema) or error('Unable to create bans table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'cat_name'		=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> false,
-				'default'		=> '\'New Category\''
-			),
-			'disp_position'	=> array(
-				'datatype'		=> 'INT(10)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('id')
-	);
-
-	$db->create_table('categories', $schema) or error('Unable to create categories table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'search_for'	=> array(
-				'datatype'		=> 'VARCHAR(60)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'replace_with'	=> array(
-				'datatype'		=> 'VARCHAR(60)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			)
-		),
-		'PRIMARY KEY'	=> array('id')
-	);
-
-	$db->create_table('censoring', $schema) or error('Unable to create censoring table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'conf_name'		=> array(
-				'datatype'		=> 'VARCHAR(255)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'conf_value'	=> array(
-				'datatype'		=> 'TEXT',
-				'allow_null'	=> true
-			)
-		),
-		'PRIMARY KEY'	=> array('conf_name')
-	);
-
-	$db->create_table('config', $schema) or error('Unable to create config table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'group_id'		=> array(
-				'datatype'		=> 'INT(10)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'forum_id'		=> array(
-				'datatype'		=> 'INT(10)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'read_forum'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'post_replies'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'post_topics'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			)
-		),
-		'PRIMARY KEY'	=> array('group_id', 'forum_id')
-	);
-
-	$db->create_table('forum_perms', $schema) or error('Unable to create forum_perms table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'forum_name'	=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> false,
-				'default'		=> '\'New forum\''
-			),
-			'forum_desc'	=> array(
-				'datatype'		=> 'TEXT',
-				'allow_null'	=> true
-			),
-			'redirect_url'	=> array(
-				'datatype'		=> 'VARCHAR(100)',
-				'allow_null'	=> true
-			),
-			'moderators'	=> array(
-				'datatype'		=> 'TEXT',
-				'allow_null'	=> true
-			),
-			'num_topics'	=> array(
-				'datatype'		=> 'MEDIUMINT(8) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'num_posts'		=> array(
-				'datatype'		=> 'MEDIUMINT(8) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'last_post'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'last_post_id'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'last_poster'	=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> true
-			),
-			'sort_by'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'disp_position'	=> array(
-				'datatype'		=> 'INT(10)',
-				'allow_null'	=> false,
-				'default'		=>	'0'
-			),
-			'cat_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=>	'0'
-			)
-		),
-		'PRIMARY KEY'	=> array('id')
-	);
-
-	$db->create_table('forums', $schema) or error('Unable to create forums table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'g_id'						=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'g_title'					=> array(
-				'datatype'		=> 'VARCHAR(50)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'g_user_title'				=> array(
-				'datatype'		=> 'VARCHAR(50)',
-				'allow_null'	=> true
-			),
-			'g_moderator'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'g_mod_edit_users'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'g_mod_rename_users'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'g_mod_change_passwords'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'g_mod_ban_users'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'g_read_board'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_view_users'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_post_replies'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_post_topics'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_edit_posts'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_delete_posts'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_delete_topics'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_set_title'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_search'					=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_search_users'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_send_email'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'g_post_flood'				=> array(
-				'datatype'		=> 'SMALLINT(6)',
-				'allow_null'	=> false,
-				'default'		=> '30'
-			),
-			'g_search_flood'			=> array(
-				'datatype'		=> 'SMALLINT(6)',
-				'allow_null'	=> false,
-				'default'		=> '30'
-			),
-			'g_email_flood'				=> array(
-				'datatype'		=> 'SMALLINT(6)',
-				'allow_null'	=> false,
-				'default'		=> '60'
-			),
-			'g_report_flood'			=> array(
-				'datatype'		=> 'SMALLINT(6)',
-				'allow_null'	=> false,
-				'default'		=> '60'
-			)
-		),
-		'PRIMARY KEY'	=> array('g_id')
-	);
-
-	$db->create_table('groups', $schema) or error('Unable to create groups table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'user_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'ident'			=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'logged'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'idle'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'last_post'			=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'last_search'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-		),
-		'UNIQUE KEYS'	=> array(
-			'user_id_ident_idx'	=> array('user_id', 'ident')
-		),
-		'INDEXES'		=> array(
-			'ident_idx'		=> array('ident'),
-			'logged_idx'	=> array('logged')
-		)
-	);
-
-	if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
-	{
-		$schema['UNIQUE KEYS']['user_id_ident_idx'] = array('user_id', 'ident(25)');
-		$schema['INDEXES']['ident_idx'] = array('ident(25)');
-	}
-
-	if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
-		$schema['ENGINE'] = 'InnoDB';
-
-	$db->create_table('online', $schema) or error('Unable to create online table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'poster'		=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'poster_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'poster_ip'		=> array(
-				'datatype'		=> 'VARCHAR(39)',
-				'allow_null'	=> true
-			),
-			'poster_email'	=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> true
-			),
-			'message'		=> array(
-				'datatype'		=> 'MEDIUMTEXT',
-				'allow_null'	=> true
-			),
-			'hide_smilies'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'posted'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'edited'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'edited_by'		=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> true
-			),
-			'topic_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('id'),
-		'INDEXES'		=> array(
-			'topic_id_idx'	=> array('topic_id'),
-			'multi_idx'		=> array('poster_id', 'topic_id')
-		)
-	);
-
-	$db->create_table('posts', $schema) or error('Unable to create posts table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'rank'			=> array(
-				'datatype'		=> 'VARCHAR(50)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'min_posts'		=> array(
-				'datatype'		=> 'MEDIUMINT(8) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('id')
-	);
-
-	$db->create_table('ranks', $schema) or error('Unable to create ranks table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'post_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'topic_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'forum_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'reported_by'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'created'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'message'		=> array(
-				'datatype'		=> 'TEXT',
-				'allow_null'	=> true
-			),
-			'zapped'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'zapped_by'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			)
-		),
-		'PRIMARY KEY'	=> array('id'),
-		'INDEXES'		=> array(
-			'zapped_idx'	=> array('zapped')
-		)
-	);
-
-	$db->create_table('reports', $schema) or error('Unable to create reports table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'ident'			=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'search_data'	=> array(
-				'datatype'		=> 'MEDIUMTEXT',
-				'allow_null'	=> true
-			)
-		),
-		'PRIMARY KEY'	=> array('id'),
-		'INDEXES'		=> array(
-			'ident_idx'	=> array('ident')
-		)
-	);
-
-	if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
-		$schema['INDEXES']['ident_idx'] = array('ident(8)');
-
-	$db->create_table('search_cache', $schema) or error('Unable to create search_cache table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'post_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'word_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'subject_match'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'INDEXES'		=> array(
-			'word_id_idx'	=> array('word_id'),
-			'post_id_idx'	=> array('post_id')
-		)
-	);
-
-	$db->create_table('search_matches', $schema) or error('Unable to create search_matches table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'word'			=> array(
-				'datatype'		=> 'VARCHAR(20)',
-				'allow_null'	=> false,
-				'default'		=> '\'\'',
-				'collation'		=> 'bin'
-			)
-		),
-		'PRIMARY KEY'	=> array('word'),
-		'INDEXES'		=> array(
-			'id_idx'	=> array('id')
-		)
-	);
-
-	if ($db_type == 'sqlite')
-	{
-		$schema['PRIMARY KEY'] = array('id');
-		$schema['UNIQUE KEYS'] = array('word_idx'	=> array('word'));
-	}
-
-	$db->create_table('search_words', $schema) or error('Unable to create search_words table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'user_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'topic_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('user_id', 'topic_id')
-	);
-
-	$db->create_table('topic_subscriptions', $schema) or error('Unable to create topic subscriptions table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'user_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'forum_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('user_id', 'forum_id')
-	);
-
-	$db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'			=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'poster'		=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'subject'		=> array(
-				'datatype'		=> 'VARCHAR(255)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'posted'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'first_post_id'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'last_post'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'last_post_id'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'last_poster'	=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> true
-			),
-			'num_views'		=> array(
-				'datatype'		=> 'MEDIUMINT(8) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'num_replies'	=> array(
-				'datatype'		=> 'MEDIUMINT(8) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'closed'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'sticky'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'moved_to'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'forum_id'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			)
-		),
-		'PRIMARY KEY'	=> array('id'),
-		'INDEXES'		=> array(
-			'forum_id_idx'		=> array('forum_id'),
-			'moved_to_idx'		=> array('moved_to'),
-			'last_post_idx'		=> array('last_post'),
-			'first_post_id_idx'	=> array('first_post_id')
-		)
-	);
-
-	$db->create_table('topics', $schema) or error('Unable to create topics table', __FILE__, __LINE__, $db->error());
-
-
-	$schema = array(
-		'FIELDS'		=> array(
-			'id'				=> array(
-				'datatype'		=> 'SERIAL',
-				'allow_null'	=> false
-			),
-			'group_id'			=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '3'
-			),
-			'username'			=> array(
-				'datatype'		=> 'VARCHAR(200)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'password'			=> array(
-				'datatype'		=> 'VARCHAR(40)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'email'				=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> false,
-				'default'		=> '\'\''
-			),
-			'title'				=> array(
-				'datatype'		=> 'VARCHAR(50)',
-				'allow_null'	=> true
-			),
-			'realname'			=> array(
-				'datatype'		=> 'VARCHAR(40)',
-				'allow_null'	=> true
-			),
-			'url'				=> array(
-				'datatype'		=> 'VARCHAR(100)',
-				'allow_null'	=> true
-			),
-			'jabber'			=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> true
-			),
-			'icq'				=> array(
-				'datatype'		=> 'VARCHAR(12)',
-				'allow_null'	=> true
-			),
-			'msn'				=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> true
-			),
-			'aim'				=> array(
-				'datatype'		=> 'VARCHAR(30)',
-				'allow_null'	=> true
-			),
-			'yahoo'				=> array(
-				'datatype'		=> 'VARCHAR(30)',
-				'allow_null'	=> true
-			),
-			'location'			=> array(
-				'datatype'		=> 'VARCHAR(30)',
-				'allow_null'	=> true
-			),
-			'signature'			=> array(
-				'datatype'		=> 'TEXT',
-				'allow_null'	=> true
-			),
-			'disp_topics'		=> array(
-				'datatype'		=> 'TINYINT(3) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'disp_posts'		=> array(
-				'datatype'		=> 'TINYINT(3) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'email_setting'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'notify_with_post'	=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'auto_notify'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'show_smilies'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'show_img'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'show_img_sig'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'show_avatars'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'show_sig'			=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '1'
-			),
-			'timezone'			=> array(
-				'datatype'		=> 'FLOAT',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'dst'				=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'time_format'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'date_format'		=> array(
-				'datatype'		=> 'TINYINT(1)',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'language'			=> array(
-				'datatype'		=> 'VARCHAR(25)',
-				'allow_null'	=> false,
-				'default'		=> '\''.$db->escape($default_lang).'\''
-			),
-			'style'				=> array(
-				'datatype'		=> 'VARCHAR(25)',
-				'allow_null'	=> false,
-				'default'		=> '\''.$db->escape($default_style).'\''
-			),
-			'num_posts'			=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'last_post'			=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'last_search'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'last_email_sent'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'last_report_sent'	=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> true
-			),
-			'registered'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'registration_ip'	=> array(
-				'datatype'		=> 'VARCHAR(39)',
-				'allow_null'	=> false,
-				'default'		=> '\'0.0.0.0\''
-			),
-			'last_visit'		=> array(
-				'datatype'		=> 'INT(10) UNSIGNED',
-				'allow_null'	=> false,
-				'default'		=> '0'
-			),
-			'admin_note'		=> array(
-				'datatype'		=> 'VARCHAR(30)',
-				'allow_null'	=> true
-			),
-			'activate_string'	=> array(
-				'datatype'		=> 'VARCHAR(80)',
-				'allow_null'	=> true
-			),
-			'activate_key'		=> array(
-				'datatype'		=> 'VARCHAR(8)',
-				'allow_null'	=> true
-			),
-		),
-		'PRIMARY KEY'	=> array('id'),
-		'UNIQUE KEYS'	=> array(
-			'username_idx'		=> array('username')
-		),
-		'INDEXES'		=> array(
-			'registered_idx'	=> array('registered')
-		)
-	);
-
-	if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
-		$schema['UNIQUE KEYS']['username_idx'] = array('username(25)');
-
-	$db->create_table('users', $schema) or error('Unable to create users table', __FILE__, __LINE__, $db->error());
-
-
-	$now = time();
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."bans (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					username VARCHAR(200),
+					ip VARCHAR(255),
+					email VARCHAR(50),
+					message VARCHAR(255),
+					expire INT(10) UNSIGNED,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$db->start_transaction();
+
+			$sql = 'CREATE TABLE '.$db_prefix."bans (
+					id SERIAL,
+					username VARCHAR(200),
+					ip VARCHAR(255),
+					email VARCHAR(50),
+					message VARCHAR(255),
+					expire INT,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$db->start_transaction();
+
+			$sql = 'CREATE TABLE '.$db_prefix."bans (
+					id INTEGER NOT NULL,
+					username VARCHAR(200),
+					ip  VARCHAR(255),
+					email VARCHAR(50),
+					message VARCHAR(255),
+					expire INTEGER,
+					PRIMARY KEY (id)
+					)";
+			break;
+			
+		
+		default:  
+			error('\''.$db_type.'\' n\'est pas un type de base de donnÃ©es correct.'); 
+
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'bans. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."categories (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category',
+					disp_position INT(10) NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."categories (
+					id SERIAL,
+					cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category',
+					disp_position INT NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."categories (
+					id INTEGER NOT NULL,
+					cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category',
+					disp_position INTEGER NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'categories. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."censoring (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					search_for VARCHAR(60) NOT NULL DEFAULT '',
+					replace_with VARCHAR(60) NOT NULL DEFAULT '',
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."censoring (
+					id SERIAL,
+					search_for VARCHAR(60) NOT NULL DEFAULT '',
+					replace_with VARCHAR(60) NOT NULL DEFAULT '',
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."censoring (
+					id INTEGER NOT NULL,
+					search_for VARCHAR(60) NOT NULL DEFAULT '',
+					replace_with VARCHAR(60) NOT NULL DEFAULT '',
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'censoring. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."config (
+					conf_name VARCHAR(255) NOT NULL DEFAULT '',
+					conf_value TEXT,
+					PRIMARY KEY (conf_name)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."config (
+					conf_name VARCHAR(255) NOT NULL DEFAULT '',
+					conf_value TEXT,
+					PRIMARY KEY (conf_name)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."config (
+					conf_name VARCHAR(255) NOT NULL DEFAULT '',
+					conf_value TEXT,
+					PRIMARY KEY (conf_name)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'config. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."forum_perms (
+					group_id INT(10) NOT NULL DEFAULT 0,
+					forum_id INT(10) NOT NULL DEFAULT 0,
+					read_forum TINYINT(1) NOT NULL DEFAULT 1,
+					post_replies TINYINT(1) NOT NULL DEFAULT 1,
+					post_topics TINYINT(1) NOT NULL DEFAULT 1,
+					PRIMARY KEY (group_id, forum_id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."forum_perms (
+					group_id INT NOT NULL DEFAULT 0,
+					forum_id INT NOT NULL DEFAULT 0,
+					read_forum SMALLINT NOT NULL DEFAULT 1,
+					post_replies SMALLINT NOT NULL DEFAULT 1,
+					post_topics SMALLINT NOT NULL DEFAULT 1,
+					PRIMARY KEY (group_id, forum_id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."forum_perms (
+					group_id INTEGER NOT NULL DEFAULT 0,
+					forum_id INTEGER NOT NULL DEFAULT 0,
+					read_forum INTEGER NOT NULL DEFAULT 1,
+					post_replies INTEGER NOT NULL DEFAULT 1,
+					post_topics INTEGER NOT NULL DEFAULT 1,
+					PRIMARY KEY (group_id, forum_id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'forum_perms. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."forums (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum',
+					forum_desc TEXT,
+					redirect_url VARCHAR(100),
+					moderators TEXT,
+					num_topics MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
+					num_posts MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
+					last_post INT(10) UNSIGNED,
+					last_post_id INT(10) UNSIGNED,
+					last_poster VARCHAR(200),
+					sort_by TINYINT(1) NOT NULL DEFAULT 0,
+					disp_position INT(10) NOT NULL DEFAULT 0,
+					cat_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."forums (
+					id SERIAL,
+					forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum',
+					forum_desc TEXT,
+					redirect_url VARCHAR(100),
+					moderators TEXT,
+					num_topics INT NOT NULL DEFAULT 0,
+					num_posts INT NOT NULL DEFAULT 0,
+					last_post INT,
+					last_post_id INT,
+					last_poster VARCHAR(200),
+					sort_by SMALLINT NOT NULL DEFAULT 0,
+					disp_position INT NOT NULL DEFAULT 0,
+					cat_id INT NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."forums (
+					id INTEGER NOT NULL,
+					forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum',
+					forum_desc TEXT,
+					redirect_url VARCHAR(100),
+					moderators TEXT,
+					num_topics INTEGER NOT NULL DEFAULT 0,
+					num_posts INTEGER NOT NULL DEFAULT 0,
+					last_post INTEGER,
+					last_post_id INTEGER,
+					last_poster VARCHAR(200),
+					sort_by INTEGER NOT NULL DEFAULT 0,
+					disp_position INTEGER NOT NULL DEFAULT 0,
+					cat_id INTEGER NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'forums. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."groups (
+					g_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					g_title VARCHAR(50) NOT NULL DEFAULT '',
+					g_user_title VARCHAR(50),
+					g_read_board TINYINT(1) NOT NULL DEFAULT 1,
+					g_post_replies TINYINT(1) NOT NULL DEFAULT 1,
+					g_post_topics TINYINT(1) NOT NULL DEFAULT 1,
+					g_post_polls TINYINT(1) NOT NULL DEFAULT 1,
+					g_edit_posts TINYINT(1) NOT NULL DEFAULT 1,
+					g_delete_posts TINYINT(1) NOT NULL DEFAULT 1,
+					g_delete_topics TINYINT(1) NOT NULL DEFAULT 1,
+					g_set_title TINYINT(1) NOT NULL DEFAULT 1,
+					g_search TINYINT(1) NOT NULL DEFAULT 1,
+					g_search_users TINYINT(1) NOT NULL DEFAULT 1,
+					g_edit_subjects_interval SMALLINT(6) NOT NULL DEFAULT 300,
+					g_post_flood SMALLINT(6) NOT NULL DEFAULT 30,
+					g_search_flood SMALLINT(6) NOT NULL DEFAULT 30,
+					PRIMARY KEY (g_id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."groups (
+					g_id SERIAL,
+					g_title VARCHAR(50) NOT NULL DEFAULT '',
+					g_user_title VARCHAR(50),
+					g_read_board SMALLINT NOT NULL DEFAULT 1,
+					g_post_replies SMALLINT NOT NULL DEFAULT 1,
+					g_post_topics SMALLINT NOT NULL DEFAULT 1,
+					g_post_polls SMALLINT NOT NULL DEFAULT 1,
+					g_edit_posts SMALLINT NOT NULL DEFAULT 1,
+					g_delete_posts SMALLINT NOT NULL DEFAULT 1,
+					g_delete_topics SMALLINT NOT NULL DEFAULT 1,
+					g_set_title SMALLINT NOT NULL DEFAULT 1,
+					g_search SMALLINT NOT NULL DEFAULT 1,
+					g_search_users SMALLINT NOT NULL DEFAULT 1,
+					g_edit_subjects_interval SMALLINT NOT NULL DEFAULT 300,
+					g_post_flood SMALLINT NOT NULL DEFAULT 30,
+					g_search_flood SMALLINT NOT NULL DEFAULT 30,
+					PRIMARY KEY (g_id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."groups (
+					g_id INTEGER NOT NULL,
+					g_title VARCHAR(50) NOT NULL DEFAULT '',
+					g_user_title VARCHAR(50),
+					g_read_board INTEGER NOT NULL DEFAULT 1,
+					g_post_replies INTEGER NOT NULL DEFAULT 1,
+					g_post_topics INTEGER NOT NULL DEFAULT 1,
+					g_post_polls INTEGER NOT NULL DEFAULT 1,
+					g_edit_posts INTEGER NOT NULL DEFAULT 1,
+					g_delete_posts INTEGER NOT NULL DEFAULT 1,
+					g_delete_topics INTEGER NOT NULL DEFAULT 1,
+					g_set_title INTEGER NOT NULL DEFAULT 1,
+					g_search INTEGER NOT NULL DEFAULT 1,
+					g_search_users INTEGER NOT NULL DEFAULT 1,
+					g_edit_subjects_interval INTEGER NOT NULL DEFAULT 300,
+					g_post_flood INTEGER NOT NULL DEFAULT 30,
+					g_search_flood INTEGER NOT NULL DEFAULT 30,
+					PRIMARY KEY (g_id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'groups. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."online (
+					user_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
+					ident VARCHAR(200) NOT NULL DEFAULT '',
+					logged INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					idle TINYINT(1) NOT NULL DEFAULT 0
+					) TYPE=HEAP;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."online (
+					user_id INT NOT NULL DEFAULT 1,
+					ident VARCHAR(200) NOT NULL DEFAULT '',
+					logged INT NOT NULL DEFAULT 0,
+					idle SMALLINT NOT NULL DEFAULT 0
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."online (
+					user_id INTEGER NOT NULL DEFAULT 1,
+					ident VARCHAR(200) NOT NULL DEFAULT '',
+					logged INTEGER NOT NULL DEFAULT 0,
+					idle INTEGER NOT NULL DEFAULT 0
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'online. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."posts (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					poster VARCHAR(200) NOT NULL DEFAULT '',
+					poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
+					poster_ip VARCHAR(15),
+					poster_email VARCHAR(50),
+					message TEXT NOT NULL DEFAULT '',
+					hide_smilies TINYINT(1) NOT NULL DEFAULT 0,
+					posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					edited INT(10) UNSIGNED,
+					edited_by VARCHAR(200),
+					topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."posts (
+					id SERIAL,
+					poster VARCHAR(200) NOT NULL DEFAULT '',
+					poster_id INT NOT NULL DEFAULT 1,
+					poster_ip VARCHAR(15),
+					poster_email VARCHAR(50),
+					message TEXT NOT NULL DEFAULT '',
+					hide_smilies SMALLINT NOT NULL DEFAULT 0,
+					posted INT NOT NULL DEFAULT 0,
+					edited INT,
+					edited_by VARCHAR(200),
+					topic_id INT NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."posts (
+					id INTEGER NOT NULL,
+					poster VARCHAR(200) NOT NULL DEFAULT '',
+					poster_id INTEGER NOT NULL DEFAULT 1,
+					poster_ip VARCHAR(15),
+					poster_email VARCHAR(50),
+					message TEXT NOT NULL DEFAULT '',
+					hide_smilies INTEGER NOT NULL DEFAULT 0,
+					posted INTEGER NOT NULL DEFAULT 0,
+					edited INTEGER,
+					edited_by VARCHAR(200),
+					topic_id INTEGER NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'posts. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."ranks (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					rank VARCHAR(50) NOT NULL DEFAULT '',
+					min_posts MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."ranks (
+					id SERIAL,
+					rank VARCHAR(50) NOT NULL DEFAULT '',
+					min_posts INT NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."ranks (
+					id INTEGER NOT NULL,
+					rank VARCHAR(50) NOT NULL DEFAULT '',
+					min_posts INTEGER NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'titles. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."reports (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					reported_by INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					created INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					message TEXT NOT NULL DEFAULT '',
+					zapped INT(10) UNSIGNED,
+					zapped_by INT(10) UNSIGNED,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."reports (
+					id SERIAL,
+					post_id INT NOT NULL DEFAULT 0,
+					topic_id INT NOT NULL DEFAULT 0,
+					forum_id INT NOT NULL DEFAULT 0,
+					reported_by INT NOT NULL DEFAULT 0,
+					created INT NOT NULL DEFAULT 0,
+					message TEXT NOT NULL DEFAULT '',
+					zapped INT,
+					zapped_by INT,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."reports (
+					id INTEGER NOT NULL,
+					post_id INTEGER NOT NULL DEFAULT 0,
+					topic_id INTEGER NOT NULL DEFAULT 0,
+					forum_id INTEGER NOT NULL DEFAULT 0,
+					reported_by INTEGER NOT NULL DEFAULT 0,
+					created INTEGER NOT NULL DEFAULT 0,
+					message TEXT NOT NULL DEFAULT '',
+					zapped INTEGER,
+					zapped_by INTEGER,
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'reports. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."search_cache (
+					id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					ident VARCHAR(200) NOT NULL DEFAULT '',
+					search_data TEXT NOT NULL DEFAULT '',
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."search_cache (
+					id INT NOT NULL DEFAULT 0,
+					ident VARCHAR(200) NOT NULL DEFAULT '',
+					search_data TEXT NOT NULL DEFAULT '',
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."search_cache (
+					id INTEGER NOT NULL DEFAULT 0,
+					ident VARCHAR(200) NOT NULL DEFAULT '',
+					search_data TEXT NOT NULL DEFAULT '',
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'search_cache. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."search_matches (
+					post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					word_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
+					subject_match TINYINT(1) NOT NULL DEFAULT 0
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."search_matches (
+					post_id INT NOT NULL DEFAULT 0,
+					word_id INT NOT NULL DEFAULT 0,
+					subject_match SMALLINT NOT NULL DEFAULT 0
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."search_matches (
+					post_id INTEGER NOT NULL DEFAULT 0,
+					word_id INTEGER NOT NULL DEFAULT 0,
+					subject_match INTEGER NOT NULL DEFAULT 0
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'search_matches. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."search_words (
+					id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
+					word VARCHAR(20) BINARY NOT NULL DEFAULT '',
+					PRIMARY KEY (word),
+					KEY ".$db_prefix."search_words_id_idx (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."search_words (
+					id SERIAL,
+					word VARCHAR(20) NOT NULL DEFAULT '',
+					PRIMARY KEY (word)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."search_words (
+					id INTEGER NOT NULL,
+					word VARCHAR(20) NOT NULL DEFAULT '',
+					PRIMARY KEY (id),
+					UNIQUE (word)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'search_words. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
+					user_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					PRIMARY KEY (user_id, topic_id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
+					user_id INT NOT NULL DEFAULT 0,
+					topic_id INT NOT NULL DEFAULT 0,
+					PRIMARY KEY (user_id, topic_id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."subscriptions (
+					user_id INTEGER NOT NULL DEFAULT 0,
+					topic_id INTEGER NOT NULL DEFAULT 0,
+					PRIMARY KEY (user_id, topic_id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'subscriptions. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."topics (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					poster VARCHAR(200) NOT NULL DEFAULT '',
+					subject VARCHAR(255) NOT NULL DEFAULT '',
+					posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					last_post INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					last_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					last_poster VARCHAR(200),
+					num_views MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
+					num_replies MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
+					closed TINYINT(1) NOT NULL DEFAULT 0,
+					sticky TINYINT(1) NOT NULL DEFAULT 0,
+					moved_to INT(10) UNSIGNED,
+					forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."topics (
+					id SERIAL,
+					poster VARCHAR(200) NOT NULL DEFAULT '',
+					subject VARCHAR(255) NOT NULL DEFAULT '',
+					posted INT NOT NULL DEFAULT 0,
+					last_post INT NOT NULL DEFAULT 0,
+					last_post_id INT NOT NULL DEFAULT 0,
+					last_poster VARCHAR(200),
+					num_views INT NOT NULL DEFAULT 0,
+					num_replies INT NOT NULL DEFAULT 0,
+					closed SMALLINT NOT NULL DEFAULT 0,
+					sticky SMALLINT NOT NULL DEFAULT 0,
+					moved_to INT,
+					forum_id INT NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."topics (
+					id INTEGER NOT NULL,
+					poster VARCHAR(200) NOT NULL DEFAULT '',
+					subject VARCHAR(255) NOT NULL DEFAULT '',
+					posted INTEGER NOT NULL DEFAULT 0,
+					last_post INTEGER NOT NULL DEFAULT 0,
+					last_post_id INTEGER NOT NULL DEFAULT 0,
+					last_poster VARCHAR(200),
+					num_views INTEGER NOT NULL DEFAULT 0,
+					num_replies INTEGER NOT NULL DEFAULT 0,
+					closed INTEGER NOT NULL DEFAULT 0,
+					sticky INTEGER NOT NULL DEFAULT 0,
+					moved_to INTEGER,
+					forum_id INTEGER NOT NULL DEFAULT 0,
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'topics. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			$sql = 'CREATE TABLE '.$db_prefix."users (
+					id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+					group_id INT(10) UNSIGNED NOT NULL DEFAULT 4,
+					username VARCHAR(200) NOT NULL DEFAULT '',
+					password VARCHAR(40) NOT NULL DEFAULT '',
+					email VARCHAR(50) NOT NULL DEFAULT '',
+					title VARCHAR(50),
+					realname VARCHAR(40),
+					url VARCHAR(100),
+					jabber VARCHAR(75),
+					icq VARCHAR(12),
+					msn VARCHAR(50),
+					aim VARCHAR(30),
+					yahoo VARCHAR(30),
+					location VARCHAR(30),
+					use_avatar TINYINT(1) NOT NULL DEFAULT 0,
+					signature TEXT,
+					disp_topics TINYINT(3) UNSIGNED,
+					disp_posts TINYINT(3) UNSIGNED,
+					email_setting TINYINT(1) NOT NULL DEFAULT 1,
+					save_pass TINYINT(1) NOT NULL DEFAULT 1,
+					notify_with_post TINYINT(1) NOT NULL DEFAULT 0,
+					show_smilies TINYINT(1) NOT NULL DEFAULT 1,
+					show_img TINYINT(1) NOT NULL DEFAULT 1,
+					show_img_sig TINYINT(1) NOT NULL DEFAULT 1,
+					show_avatars TINYINT(1) NOT NULL DEFAULT 1,
+					show_sig TINYINT(1) NOT NULL DEFAULT 1,
+					timezone FLOAT NOT NULL DEFAULT 0,
+					language VARCHAR(25) NOT NULL DEFAULT 'English',
+					style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
+					num_posts INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					last_post INT(10) UNSIGNED,
+					registered INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+					last_visit INT(10) UNSIGNED NOT NULL DEFAULT 0,
+					admin_note VARCHAR(30),
+					activate_string VARCHAR(50),
+					activate_key VARCHAR(8),
+					PRIMARY KEY (id)
+					) TYPE=MyISAM;";
+			break;
+
+		case 'pgsql':
+			$sql = 'CREATE TABLE '.$db_prefix."users (
+					id SERIAL,
+					group_id INT NOT NULL DEFAULT 4,
+					username VARCHAR(200) NOT NULL DEFAULT '',
+					password VARCHAR(40) NOT NULL DEFAULT '',
+					email VARCHAR(50) NOT NULL DEFAULT '',
+					title VARCHAR(50),
+					realname VARCHAR(40),
+					url VARCHAR(100),
+					jabber VARCHAR(75),
+					icq VARCHAR(12),
+					msn VARCHAR(50),
+					aim VARCHAR(30),
+					yahoo VARCHAR(30),
+					location VARCHAR(30),
+					use_avatar SMALLINT NOT NULL DEFAULT 0,
+					signature TEXT,
+					disp_topics SMALLINT,
+					disp_posts SMALLINT,
+					email_setting SMALLINT NOT NULL DEFAULT 1,
+					save_pass SMALLINT NOT NULL DEFAULT 1,
+					notify_with_post SMALLINT NOT NULL DEFAULT 0,
+					show_smilies SMALLINT NOT NULL DEFAULT 1,
+					show_img SMALLINT NOT NULL DEFAULT 1,
+					show_img_sig SMALLINT NOT NULL DEFAULT 1,
+					show_avatars SMALLINT NOT NULL DEFAULT 1,
+					show_sig SMALLINT NOT NULL DEFAULT 1,
+					timezone REAL NOT NULL DEFAULT 0,
+					language VARCHAR(25) NOT NULL DEFAULT 'English',
+					style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
+					num_posts INT NOT NULL DEFAULT 0,
+					last_post INT,
+					registered INT NOT NULL DEFAULT 0,
+					registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+					last_visit INT NOT NULL DEFAULT 0,
+					admin_note VARCHAR(30),
+					activate_string VARCHAR(50),
+					activate_key VARCHAR(8),
+					PRIMARY KEY (id)
+					)";
+			break;
+
+		case 'sqlite':
+			$sql = 'CREATE TABLE '.$db_prefix."users (
+					id INTEGER NOT NULL,
+					group_id INTEGER NOT NULL DEFAULT 4,
+					username VARCHAR(200) NOT NULL DEFAULT '',
+					password VARCHAR(40) NOT NULL DEFAULT '',
+					email VARCHAR(50) NOT NULL DEFAULT '',
+					title VARCHAR(50),
+					realname VARCHAR(40),
+					url VARCHAR(100),
+					jabber VARCHAR(75),
+					icq VARCHAR(12),
+					msn VARCHAR(50),
+					aim VARCHAR(30),
+					yahoo VARCHAR(30),
+					location VARCHAR(30),
+					use_avatar INTEGER NOT NULL DEFAULT 0,
+					signature TEXT,
+					disp_topics INTEGER,
+					disp_posts INTEGER,
+					email_setting INTEGER NOT NULL DEFAULT 1,
+					save_pass INTEGER NOT NULL DEFAULT 1,
+					notify_with_post INTEGER NOT NULL DEFAULT 0,
+					show_smilies INTEGER NOT NULL DEFAULT 1,
+					show_img INTEGER NOT NULL DEFAULT 1,
+					show_img_sig INTEGER NOT NULL DEFAULT 1,
+					show_avatars INTEGER NOT NULL DEFAULT 1,
+					show_sig INTEGER NOT NULL DEFAULT 1,
+					timezone FLOAT NOT NULL DEFAULT 0,
+					language VARCHAR(25) NOT NULL DEFAULT 'English',
+					style VARCHAR(25) NOT NULL DEFAULT 'Oxygen',
+					num_posts INTEGER NOT NULL DEFAULT 0,
+					last_post INTEGER,
+					registered INTEGER NOT NULL DEFAULT 0,
+					registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0',
+					last_visit INTEGER NOT NULL DEFAULT 0,
+					admin_note VARCHAR(30),
+					activate_string VARCHAR(50),
+					activate_key VARCHAR(8),
+					PRIMARY KEY (id)
+					)";
+			break;
+	}
+
+	$db->query($sql) or error('Impossible de crÃ©er la table '.$db_prefix.'users. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
+
+	// Add some indexes
+	switch ($db_type)
+	{
+		case 'mysql':
+		case 'mysqli':
+			// We use MySQL's ALTER TABLE ... ADD INDEX syntax instead of CREATE INDEX to avoid problems with users lacking the INDEX privilege
+			$queries[] = 'ALTER TABLE '.$db_prefix.'online ADD INDEX '.$db_prefix.'online_user_id_idx(user_id)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_topic_id_idx(topic_id)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_multi_idx(poster_id, topic_id)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'reports ADD INDEX '.$db_prefix.'reports_zapped_idx(zapped)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_word_id_idx(word_id)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_post_id_idx(post_id)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_forum_id_idx(forum_id)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_moved_to_idx(moved_to)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_registered_idx(registered)';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'search_cache ADD INDEX '.$db_prefix.'search_cache_ident_idx(ident(8))';
+			$queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_username_idx(username(8))';
+			break;
+
+		default:
+			$queries[] = 'CREATE INDEX '.$db_prefix.'online_user_id_idx ON '.$db_prefix.'online(user_id)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'posts_topic_id_idx ON '.$db_prefix.'posts(topic_id)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'posts_multi_idx ON '.$db_prefix.'posts(poster_id, topic_id)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'reports_zapped_idx ON '.$db_prefix.'reports(zapped)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_word_id_idx ON '.$db_prefix.'search_matches(word_id)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_post_id_idx ON '.$db_prefix.'search_matches(post_id)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'topics_forum_id_idx ON '.$db_prefix.'topics(forum_id)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'topics_moved_to_idx ON '.$db_prefix.'topics(moved_to)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'users_registered_idx ON '.$db_prefix.'users(registered)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'users_username_idx ON '.$db_prefix.'users(username)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'search_cache_ident_idx ON '.$db_prefix.'search_cache(ident)';
+			$queries[] = 'CREATE INDEX '.$db_prefix.'search_words_id_idx ON '.$db_prefix.'search_words(id)';
+			break;
+	}
+
+	@reset($queries);
+	while (list(, $sql) = @each($queries))
+		$db->query($sql) or error('Impossible de crÃ©er les index. Veuillez vÃ©rifier vos rÃ©glages et essayer Ã  nouveau.',  __FILE__, __LINE__, $db->error());
+
 
 	// Insert the four preset groups
-	$db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '1, ' : '').'\''.$db->escape($lang_install['Administrators']).'\', \''.$db->escape($lang_install['Administrator']).'\', 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '2, ' : '').'\''.$db->escape($lang_install['Moderators']).'\', \''.$db->escape($lang_install['Moderator']).'\', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '3, ' : '').'\''.$db->escape($lang_install['Guests']).'\', NULL, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 60, 30, 0, 0)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db->prefix.'groups ('.($db_type != 'pgsql' ? 'g_id, ' : '').'g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES('.($db_type != 'pgsql' ? '4, ' : '').'\''.$db->escape($lang_install['Members']).'\', NULL, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 60, 30, 60, 60)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
-
-	// Insert guest and first admin user
-	$db->query('INSERT INTO '.$db_prefix.'users (group_id, username, password, email) VALUES(3, \''.$db->escape($lang_install['Guest']).'\', \''.$db->escape($lang_install['Guest']).'\', \''.$db->escape($lang_install['Guest']).'\')')
-		or error('Unable to add guest user. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db_prefix.'users (group_id, username, password, email, language, style, num_posts, last_post, registered, registration_ip, last_visit) VALUES(1, \''.$db->escape($username).'\', \''.pun_hash($password1).'\', \''.$email.'\', \''.$db->escape($default_lang).'\', \''.$db->escape($default_style).'\', 1, '.$now.', '.$now.', \''.get_remote_address().'\', '.$now.')')
-		or error('Unable to add administrator user. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	// Enable/disable avatars depending on file_uploads setting in PHP configuration
-	$avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0;
+	$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Administrateurs', 'Administrateur', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Impossible d\ajouter un groupe', __FILE__, __LINE__, $db->error());
+	$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('ModÃ©rateurs', 'ModÃ©rateur', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0)") or error('Impossible d\ajouter un groupe', __FILE__, __LINE__, $db->error());
+	$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('InvitÃ©s', NULL, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0)") or error('Impossible d\ajouter un groupe', __FILE__, __LINE__, $db->error());
+	$db->query('INSERT INTO '.$db->prefix."groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_post_polls, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES('Membres', NULL, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 300, 60, 30)") or error('Impossible d\ajouter un groupe', __FILE__, __LINE__, $db->error());
+
 
 	// Insert config data
 	$config = array(
-		'o_cur_version'				=> "'".FORUM_VERSION."'",
-		'o_database_revision'		=> "'".FORUM_DB_REVISION."'",
-		'o_searchindex_revision'	=> "'".FORUM_SI_REVISION."'",
-		'o_parser_revision'			=> "'".FORUM_PARSER_REVISION."'",
-		'o_board_title'				=> "'".$db->escape($title)."'",
-		'o_board_desc'				=> "'".$db->escape($description)."'",
-		'o_default_timezone'		=> "'0'",
+		'o_cur_version'				=> "'$punbb_version'",
+		'o_cur_version_fr'			=> "'$punbb_version_fr'",
+		'o_board_title'				=> "'Mon forum PunBB'",
+		'o_board_desc'				=> "'Malheureusement personne ne peut vous dire ce que PunBB est - vous devez le voir par vous-mÃªme.'",
+		'o_server_timezone'			=> "'0'",
 		'o_time_format'				=> "'H:i:s'",
-		'o_date_format'				=> "'Y-m-d'",
-		'o_timeout_visit'			=> "'1800'",
+		'o_date_format'				=> "'d-m-Y'",
+		'o_timeout_visit'			=> "'600'",
 		'o_timeout_online'			=> "'300'",
 		'o_redirect_delay'			=> "'1'",
@@ -1601,10 +1298,9 @@
 		'o_show_user_info'			=> "'1'",
 		'o_show_post_count'			=> "'1'",
-		'o_signatures'				=> "'1'",
 		'o_smilies'					=> "'1'",
 		'o_smilies_sig'				=> "'1'",
 		'o_make_links'				=> "'1'",
-		'o_default_lang'			=> "'".$db->escape($default_lang)."'",
-		'o_default_style'			=> "'".$db->escape($default_style)."'",
+		'o_default_lang'			=> "'French'",
+		'o_default_style'			=> "'Oxygen'",
 		'o_default_user_group'		=> "'4'",
 		'o_topic_review'			=> "'15'",
@@ -1612,5 +1308,4 @@
 		'o_disp_posts_default'		=> "'25'",
 		'o_indent_num_spaces'		=> "'4'",
-		'o_quote_depth'				=> "'3'",
 		'o_quickpost'				=> "'1'",
 		'o_users_online'			=> "'1'",
@@ -1618,5 +1313,4 @@
 		'o_ranks'					=> "'1'",
 		'o_show_dot'				=> "'0'",
-		'o_topic_views'				=> "'1'",
 		'o_quickjump'				=> "'1'",
 		'o_gzip'					=> "'0'",
@@ -1624,7 +1318,6 @@
 		'o_report_method'			=> "'0'",
 		'o_regs_report'				=> "'0'",
-		'o_default_email_setting'	=> "'1'",
-		'o_mailing_list'			=> "'".$email."'",
-		'o_avatars'					=> "'".$avatars."'",
+		'o_mailing_list'			=> "'$email'",
+		'o_avatars'					=> "'1'",
 		'o_avatars_dir'				=> "'img/avatars'",
 		'o_avatars_width'			=> "'60'",
@@ -1632,24 +1325,23 @@
 		'o_avatars_size'			=> "'10240'",
 		'o_search_all_forums'		=> "'1'",
-		'o_base_url'				=> "'".$db->escape($base_url)."'",
-		'o_admin_email'				=> "'".$email."'",
-		'o_webmaster_email'			=> "'".$email."'",
-		'o_forum_subscriptions'		=> "'1'",
-		'o_topic_subscriptions'		=> "'1'",
+		'o_base_url'				=> "'$base_url'",
+		'o_admin_email'				=> "'$email'",
+		'o_webmaster_email'			=> "'$email'",
+		'o_subscriptions'			=> "'1'",
 		'o_smtp_host'				=> "NULL",
 		'o_smtp_user'				=> "NULL",
 		'o_smtp_pass'				=> "NULL",
-		'o_smtp_ssl'				=> "'0'",
 		'o_regs_allow'				=> "'1'",
 		'o_regs_verify'				=> "'0'",
 		'o_announcement'			=> "'0'",
-		'o_announcement_message'	=> "'".$db->escape($lang_install['Announcement'])."'",
+		'o_announcement_message'	=> "'Saisissez votre annonce ici.'",
 		'o_rules'					=> "'0'",
-		'o_rules_message'			=> "'".$db->escape($lang_install['Rules'])."'",
+		'o_rules_message'			=> "'Saisissez vos rÃšgles ici.'",
 		'o_maintenance'				=> "'0'",
-		'o_maintenance_message'		=> "'".$db->escape($lang_install['Maintenance message'])."'",
-		'o_default_dst'				=> "'0'",
-		'o_feed_type'				=> "'2'",
-		'o_feed_ttl'				=> "'0'",
+		'o_maintenance_message'		=> "'Les forums sont temporairement fermÃ©s pour des raisons de maintenance. Veuillez essayer Ã  nouveau dans quelques minutes.<br />\\n<br />\\n/Administrateur'",
+		'p_mod_edit_users'			=> "'1'",
+		'p_mod_rename_users'		=> "'0'",
+		'p_mod_change_passwords'	=> "'0'",
+		'p_mod_ban_users'			=> "'0'",
 		'p_message_bbcode'			=> "'1'",
 		'p_message_img_tag'			=> "'1'",
@@ -1666,65 +1358,56 @@
 	);
 
-	foreach ($config as $conf_name => $conf_value)
+	while (list($conf_name, $conf_value) = @each($config))
 	{
 		$db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)")
-			or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-	}
+			or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'config. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+	}
+
+
+	$now = time();
+	// Insert guest and first admin user
+	$db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email) VALUES(3, 'InvitÃ©', 'InvitÃ©', 'InvitÃ©')")
+		or error('Impossible d\'ajouter l\'utilisateur "invitÃ©".');
+
+	$db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email, num_posts, last_post, registered, registration_ip, last_visit) VALUES(1, '".$db->escape($username)."', '".pun_hash($password1)."', '$email', 1, ".$now.", ".$now.", '127.0.0.1', ".$now.')')
+		or error('Impossible d\'ajouter le compte administrateur.');
 
 	// Insert some other default data
-	$subject = $lang_install['Test post'];
-	$message = $lang_install['Message'];
-
-	$db->query('INSERT INTO '.$db_prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($lang_install['New member']).'\', 0)')
-		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db_prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($lang_install['Member']).'\', 10)')
-		or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db_prefix.'categories (cat_name, disp_position) VALUES(\''.$db->escape($lang_install['Test category']).'\', 1)')
-		or error('Unable to insert into table '.$db_prefix.'categories. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db_prefix.'forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES(\''.$db->escape($lang_install['Test forum']).'\', \''.$db->escape($lang_install['This is just a test forum']).'\', 1, 1, '.$now.', 1, \''.$db->escape($username).'\', 1, 1)')
-		or error('Unable to insert into table '.$db_prefix.'forums. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db_prefix.'topics (poster, subject, posted, first_post_id, last_post, last_post_id, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', 1, '.$now.', 1, \''.$db->escape($username).'\', 1)')
-		or error('Unable to insert into table '.$db_prefix.'topics. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	$db->query('INSERT INTO '.$db_prefix.'posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES(\''.$db->escape($username).'\', 2, \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$now.', 1)')
-		or error('Unable to insert into table '.$db_prefix.'posts. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
-
-	// Index the test post so searching for it works
-	require PUN_ROOT.'include/search_idx.php';
-	$pun_config['o_default_lang'] = $default_lang;
-	update_search_index('post', 1, $message, $subject);
-
-	$db->end_transaction();
-
-
-	$alerts = array();
-
-	// Check if we disabled uploading avatars because file_uploads was disabled
-	if ($avatars == '0')
-		$alerts[] = $lang_install['Alert upload'];
-
-	// Add some random bytes at the end of the cookie name to prevent collisions
-	$cookie_name = 'pun_cookie_'.random_key(6, false, true);
-
-	// Generate the config.php file data
-	$config = generate_config_file();
-
-	// Attempt to write config.php and serve it up for download if writing fails
-	$written = false;
-	if (is_writable(PUN_ROOT))
-	{
-		$fh = @fopen(PUN_ROOT.'config.php', 'wb');
-		if ($fh)
-		{
-			fwrite($fh, $config);
-			fclose($fh);
-
-			$written = true;
-		}
-	}
+	$db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('CatÃ©gorie test', 1)")
+		or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'categories. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+
+	$db->query('INSERT INTO '.$db_prefix."forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES('Forum test', 'Ceci est juste un forum de test.', 1, 1, ".$now.", 1, '".$db->escape($username)."', 1, 1)")
+		or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'forums. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+
+	$db->query('INSERT INTO '.$db_prefix."topics (poster, subject, posted, last_post, last_post_id, last_poster, forum_id) VALUES('".$db->escape($username)."', 'Message de test', ".$now.", ".$now.", 1, '".$db->escape($username)."', 1)")
+		or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'topics. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+
+	$db->query('INSERT INTO '.$db_prefix."posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES('".$db->escape($username)."', 2, '127.0.0.1', 'Si vous lisez ceci (et je devine que vous Ãªtes Ã©videment en train de la faire), l\'installation de PunBB semble avoir fonctionnÃ©e ! Maintenant identifiez vous au panneau de contrÃŽle d\'administration pour configurer vos forums.', ".$now.', 1)')
+		or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'posts. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+
+	$db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Nouveau membre', 0)")
+		or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'ranks. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+
+	$db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Membre', 10)")
+		or error('Impossible d\'insÃ©rer dans la table '.$db_prefix.'ranks. Veuillez vÃ©rifier votre configuration et essayez Ã  nouveau.');
+
+
+	if ($db_type == 'pgsql' || $db_type == 'sqlite')
+		$db->end_transaction();
+
+
+
+	$alerts = '';
+	// Check if the cache directory is writable
+	if (!@is_writable('./cache/'))
+		$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>Le rÃ©pertoire du cache n\'est actuellement pas inscriptible !</strong></span> Afin que PunBB fonctionne corretement, le rÃ©pertoire nommÃ© <em>cache</em> doit Ãªtre inscriptible par PHP. Utilisez chmod pour rÃ©gler les permissions appropriÃ©e Ã  ce rÃ©pertoire. Si vous avez un doute, chmod 0777.</p>';
+
+	// Check if default avatar directory is writable
+	if (!@is_writable('./img/avatars/'))
+		$alerts .= '<p style="font-size: 1.1em"><span style="color: #C03000"><strong>Le rÃ©pertoire des avatars n\'est actuellement pas inscriptible !</strong></span> Si vous voulez que les utilisateurs puissent envoyer sur le serveur leur propres avatars vous devez rÃ©gler les permissions du dossier <em>img/avatars</em> pour que PHP puisse Ã©crire dedans. Utilisez chmod pour rÃ©gler les permissions appropriÃ©e Ã  ce rÃ©pertoire. Si vous avez un doute, chmod 0777.</p>';
+
+
+	/// Display config.php and give further instructions
+	$config = '<?php'."\n\n".'$db_type = \''.$db_type."';\n".'$db_host = \''.$db_host."';\n".'$db_name = \''.$db_name."';\n".'$db_username = \''.$db_username."';\n".'$db_password = \''.$db_password."';\n".'$db_prefix = \''.$db_prefix."';\n".'$p_connect = false;'."\n\n".'$cookie_name = '."'punbb_cookie';\n".'$cookie_domain = '."'';\n".'$cookie_path = '."'/';\n".'$cookie_secure = 0;'."\n".'$cookie_seed = \''.substr(md5(time()), -8)."';\n\ndefine('PUN', 1);";
 
 
@@ -1734,89 +1417,40 @@
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title><?php echo $lang_install['FluxBB Installation'] ?></title>
-<link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>Installation de PunBB</title>
+<link rel="stylesheet" type="text/css" href="style/Oxygen.css" />
 </head>
 <body>
 
-<div id="puninstall" class="pun">
-<div class="top-box"><div><!-- Top Corners --></div></div>
-<div class="punwrap">
-
-<div id="brdheader" class="block">
+<div id="puninstall" style="margin: auto 10% auto 10%">
+<div class="pun">
+
+<div class="blockform">
+	<h2>Instructions finales</h2>
 	<div class="box">
-		<div id="brdtitle" class="inbox">
-			<h1><span><?php echo $lang_install['FluxBB Installation'] ?></span></h1>
-			<div id="brddesc"><p><?php echo $lang_install['FluxBB has been installed'] ?></p></div>
+		<div class="fakeform">
+			<div class="inform">
+				<div class="forminfo">
+					<p>Afin de terminer l'installation tout ce que vous avez Ã  faire est de <strong>copier et coller le texte de la boite ci-dessous dans un fichier que vous nommerez <em>config.php</em> et qu'ensuite vous enverrez sur votre serveur dans le rÃ©pertoire racine de votre installation de PunBB</strong>. Assurez-vous qu'il n'y a aucun saut de ligne ou d'espace avant &lt;?php et aprÃšs ?&gt; dans ce fichier. Vous pourrez par la suite modifier config.php si vous reconfigurez votre installation (ex. modification du mot de passe base de donnÃ©s ... ).</p>
+<?php if ($alerts != ''): ?>					<?php echo $alerts."\n" ?>
+<?php endif; ?>				</div>
+				<fieldset>
+					<legend>Copiez ce contenu dans config.php</legend>
+					<div class="infldset">
+						<textarea cols="80" rows="20"><?php echo htmlspecialchars($config) ?></textarea>
+					</div>
+				</fieldset>
+			</div>
+			<div class="inform">
+				<div class="forminfo">
+					<p>Une fois que vous aurez crÃ©Ã© config.php avec le contenu ci-dessus, PunBB sera installÃ© !</p>
+					<p><a href="index.php">Aller Ã  l'index des forums</a></p>
+				</div>
+			</div>
 		</div>
 	</div>
 </div>
 
-<div id="brdmain">
-
-<div class="blockform">
-	<h2><span><?php echo $lang_install['Final instructions'] ?></span></h2>
-	<div class="box">
-<?php
-
-if (!$written)
-{
-
-?>
-		<form method="post" action="install.php">
-			<div class="inform">
-				<div class="forminfo">
-					<p><?php echo $lang_install['Info 17'] ?></p>
-					<p><?php echo $lang_install['Info 18'] ?></p>
-				</div>
-				<input type="hidden" name="generate_config" value="1" />
-				<input type="hidden" name="db_type" value="<?php echo $db_type; ?>" />
-				<input type="hidden" name="db_host" value="<?php echo $db_host; ?>" />
-				<input type="hidden" name="db_name" value="<?php echo pun_htmlspecialchars($db_name); ?>" />
-				<input type="hidden" name="db_username" value="<?php echo pun_htmlspecialchars($db_username); ?>" />
-				<input type="hidden" name="db_password" value="<?php echo pun_htmlspecialchars($db_password); ?>" />
-				<input type="hidden" name="db_prefix" value="<?php echo pun_htmlspecialchars($db_prefix); ?>" />
-				<input type="hidden" name="cookie_name" value="<?php echo pun_htmlspecialchars($cookie_name); ?>" />
-				<input type="hidden" name="cookie_seed" value="<?php echo pun_htmlspecialchars($cookie_seed); ?>" />
-
-<?php if (!empty($alerts)): ?>				<div class="forminfo error-info">
-					<ul class="error-list">
-<?php
-
-foreach ($alerts as $cur_alert)
-	echo "\t\t\t\t\t".'<li>'.$cur_alert.'</li>'."\n";
-?>
-					</ul>
-				</div>
-<?php endif; ?>			</div>
-			<p class="buttons"><input type="submit" value="<?php echo $lang_install['Download config.php file'] ?>" /></p>
-		</form>
-
-<?php
-
-}
-else
-{
-
-?>
-		<div class="fakeform">
-			<div class="inform">
-				<div class="forminfo">
-					<p><?php echo $lang_install['FluxBB fully installed'] ?></p>
-				</div>
-			</div>
-		</div>
-<?php
-
-}
-
-?>
-	</div>
 </div>
-
-</div>
-
-</div>
-<div class="end-box"><div><!-- Bottom Corners --></div></div>
 </div>
 
