Changeset 3 for branches/rsr.v5.1.dev/web/punbb/install.php
- Timestamp:
- Nov 14, 2011, 11:17:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rsr.v5.1.dev/web/punbb/install.php
r1 r3 1 1 <?php 2 /*********************************************************************** 3 4 Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org) 5 6 This file is part of PunBB. 7 8 PunBB is free software; you can redistribute it and/or modify it 9 under the terms of the GNU General Public License as published 10 by the Free Software Foundation; either version 2 of the License, 11 or (at your option) any later version. 12 13 PunBB is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 MA 02111-1307 USA 22 23 ************************************************************************/ 24 25 26 // The PunBB version this script installs 27 $punbb_version = '1.2.10'; 28 $punbb_version_fr = '1.2.10'; 29 30 31 define('PUN_ROOT', './'); 32 if (file_exists(PUN_ROOT.'config.php')) 33 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>.'); 34 35 36 // Make sure we are running at least PHP 4.1.0 37 if (intval(str_replace('.', '', phpversion())) < 410) 38 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.'); 2 3 /** 4 * Copyright (C) 2008-2011 FluxBB 5 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB 6 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher 7 */ 8 9 // The FluxBB version this script installs 10 define('FORUM_VERSION', '1.4.7'); 11 12 define('FORUM_DB_REVISION', 15); 13 define('FORUM_SI_REVISION', 2); 14 define('FORUM_PARSER_REVISION', 2); 15 16 define('MIN_PHP_VERSION', '4.4.0'); 17 define('MIN_MYSQL_VERSION', '4.1.2'); 18 define('MIN_PGSQL_VERSION', '7.0.0'); 19 define('PUN_SEARCH_MIN_WORD', 3); 20 define('PUN_SEARCH_MAX_WORD', 20); 21 22 23 define('PUN_ROOT', dirname(__FILE__).'/'); 24 25 // Load the functions script 26 require PUN_ROOT.'include/functions.php'; 27 28 // Load UTF-8 functions 29 require PUN_ROOT.'include/utf8/utf8.php'; 30 31 // Strip out "bad" UTF-8 characters 32 forum_remove_bad_characters(); 33 34 // Reverse the effect of register_globals 35 forum_unregister_globals(); 39 36 40 37 // Disable error reporting for uninitialized variables 41 38 error_reporting(E_ALL); 42 39 40 // Force POSIX locale (to prevent functions such as strtolower() from messing up UTF-8 strings) 41 setlocale(LC_CTYPE, 'C'); 42 43 // Turn off magic_quotes_runtime 44 if (get_magic_quotes_runtime()) 45 set_magic_quotes_runtime(0); 46 47 // Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled) 48 if (get_magic_quotes_gpc()) 49 { 50 function stripslashes_array($array) 51 { 52 return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array); 53 } 54 55 $_GET = stripslashes_array($_GET); 56 $_POST = stripslashes_array($_POST); 57 $_COOKIE = stripslashes_array($_COOKIE); 58 $_REQUEST = stripslashes_array($_REQUEST); 59 } 60 43 61 // Turn off PHP time limit 44 62 @set_time_limit(0); 45 63 46 64 65 // If we've been passed a default language, use it 66 $install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English'; 67 68 // If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English 69 if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php')) 70 $install_lang = 'English'; 71 72 require PUN_ROOT.'lang/'.$install_lang.'/install.php'; 73 74 if (file_exists(PUN_ROOT.'config.php')) 75 { 76 // Check to see whether FluxBB is already installed 77 include PUN_ROOT.'config.php'; 78 79 // 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 80 if (defined('FORUM')) 81 define('PUN', FORUM); 82 83 // If PUN is defined, config.php is probably valid and thus the software is installed 84 if (defined('PUN')) 85 exit($lang_install['Already installed']); 86 } 87 88 // Define PUN because email.php requires it 89 define('PUN', 1); 90 91 // If the cache directory is not specified, we use the default setting 92 if (!defined('FORUM_CACHE_DIR')) 93 define('FORUM_CACHE_DIR', PUN_ROOT.'cache/'); 94 95 // Make sure we are running at least MIN_PHP_VERSION 96 if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) 97 exit(sprintf($lang_install['You are running error'], 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION)); 98 99 100 // 101 // Generate output to be used for config.php 102 // 103 function generate_config_file() 104 { 105 global $db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix, $cookie_name, $cookie_seed; 106 107 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"; 108 } 109 110 111 if (isset($_POST['generate_config'])) 112 { 113 header('Content-Type: text/x-delimtext; name="config.php"'); 114 header('Content-disposition: attachment; filename=config.php'); 115 116 $db_type = $_POST['db_type']; 117 $db_host = $_POST['db_host']; 118 $db_name = $_POST['db_name']; 119 $db_username = $_POST['db_username']; 120 $db_password = $_POST['db_password']; 121 $db_prefix = $_POST['db_prefix']; 122 $cookie_name = $_POST['cookie_name']; 123 $cookie_seed = $_POST['cookie_seed']; 124 125 echo generate_config_file(); 126 exit; 127 } 128 129 47 130 if (!isset($_POST['form_sent'])) 131 { 132 // Make an educated guess regarding base_url 133 $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol 134 $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port] 135 $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path 136 137 if (substr($base_url, -1) == '/') 138 $base_url = substr($base_url, 0, -1); 139 140 $db_type = $db_name = $db_username = $db_prefix = $username = $email = ''; 141 $db_host = 'localhost'; 142 $title = $lang_install['My FluxBB Forum']; 143 $description = '<p><span>'.$lang_install['Description'].'</span></p>'; 144 $default_lang = $install_lang; 145 $default_style = 'Air'; 146 } 147 else 148 { 149 $db_type = $_POST['req_db_type']; 150 $db_host = pun_trim($_POST['req_db_host']); 151 $db_name = pun_trim($_POST['req_db_name']); 152 $db_username = pun_trim($_POST['db_username']); 153 $db_password = pun_trim($_POST['db_password']); 154 $db_prefix = pun_trim($_POST['db_prefix']); 155 $username = pun_trim($_POST['req_username']); 156 $email = strtolower(pun_trim($_POST['req_email'])); 157 $password1 = pun_trim($_POST['req_password1']); 158 $password2 = pun_trim($_POST['req_password2']); 159 $title = pun_trim($_POST['req_title']); 160 $description = pun_trim($_POST['desc']); 161 $base_url = pun_trim($_POST['req_base_url']); 162 $default_lang = pun_trim($_POST['req_default_lang']); 163 $default_style = pun_trim($_POST['req_default_style']); 164 $alerts = array(); 165 166 // Make sure base_url doesn't end with a slash 167 if (substr($base_url, -1) == '/') 168 $base_url = substr($base_url, 0, -1); 169 170 // Validate username and passwords 171 if (pun_strlen($username) < 2) 172 $alerts[] = $lang_install['Username 1']; 173 else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters 174 $alerts[] = $lang_install['Username 2']; 175 else if (!strcasecmp($username, 'Guest')) 176 $alerts[] = $lang_install['Username 3']; 177 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)) 178 $alerts[] = $lang_install['Username 4']; 179 else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false) 180 $alerts[] = $lang_install['Username 5']; 181 else if (preg_match('%(?:\[/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)%i', $username)) 182 $alerts[] = $lang_install['Username 6']; 183 184 if (pun_strlen($password1) < 4) 185 $alerts[] = $lang_install['Short password']; 186 else if ($password1 != $password2) 187 $alerts[] = $lang_install['Passwords not match']; 188 189 // Validate email 190 require PUN_ROOT.'include/email.php'; 191 192 if (!is_valid_email($email)) 193 $alerts[] = $lang_install['Wrong email']; 194 195 if ($title == '') 196 $alerts[] = $lang_install['No board title']; 197 198 $languages = forum_list_langs(); 199 if (!in_array($default_lang, $languages)) 200 $alerts[] = $lang_install['Error default language']; 201 202 $styles = forum_list_styles(); 203 if (!in_array($default_style, $styles)) 204 $alerts[] = $lang_install['Error default style']; 205 } 206 207 // Check if the cache directory is writable 208 if (!@is_writable(FORUM_CACHE_DIR)) 209 $alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR); 210 211 // Check if default avatar directory is writable 212 if (!@is_writable(PUN_ROOT.'img/avatars/')) 213 $alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/'); 214 215 if (!isset($_POST['form_sent']) || !empty($alerts)) 48 216 { 49 217 // Determine available database extensions 50 218 $dual_mysql = false; 51 219 $db_extensions = array(); 220 $mysql_innodb = false; 52 221 if (function_exists('mysqli_connect')) 53 $db_extensions[] = array('mysqli', 'MySQL amélioré (MySQL Improved)'); 222 { 223 $db_extensions[] = array('mysqli', 'MySQL Improved'); 224 $db_extensions[] = array('mysqli_innodb', 'MySQL Improved (InnoDB)'); 225 $mysql_innodb = true; 226 } 54 227 if (function_exists('mysql_connect')) 55 228 { 56 229 $db_extensions[] = array('mysql', 'MySQL Standard'); 57 58 if (count($db_extensions) > 1) 230 $db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)'); 231 $mysql_innodb = true; 232 233 if (count($db_extensions) > 2) 59 234 $dual_mysql = true; 60 235 } … … 65 240 66 241 if (empty($db_extensions)) 67 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.'); 242 error($lang_install['No DB extensions']); 243 244 // Fetch a list of installed languages 245 $languages = forum_list_langs(); 68 246 69 247 ?> 70 248 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 71 72 <html> 249 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> 73 250 <head> 74 <meta http-equiv="Content-Type" content="text/html; charset= iso-8859-1" />75 <title> Installation de PunBB</title>76 <link rel="stylesheet" type="text/css" href="style/ Oxygen.css" />251 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 252 <title><?php echo $lang_install['FluxBB Installation'] ?></title> 253 <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> 77 254 <script type="text/javascript"> 78 <!-- 255 /* <![CDATA[ */ 79 256 function process_form(the_form) 80 257 { 81 var element_names = new Object() 82 element_names["req_db_type"] = "Type de base de données" 83 element_names["req_db_host"] = "HÃŽte serveur de base de données" 84 element_names["req_db_name"] = "Nom de base de données" 85 element_names["db_prefix"] = "Préfixe tables" 86 element_names["req_username"] = "Nom utilisateur administrateur" 87 element_names["req_password1"] = "Mot de passe administrateur 1" 88 element_names["req_password2"] = "Mot de passe administrateur 2" 89 element_names["req_email"] = "E-mail administrateur" 90 element_names["req_base_url"] = "URL de base" 91 258 var element_names = { 259 "req_db_type": "<?php echo $lang_install['Database type'] ?>", 260 "req_db_host": "<?php echo $lang_install['Database server hostname'] ?>", 261 "req_db_name": "<?php echo $lang_install['Database name'] ?>", 262 "db_prefix": "<?php echo $lang_install['Table prefix'] ?>", 263 "req_username": "<?php echo $lang_install['Administrator username'] ?>", 264 "req_password1": "<?php echo $lang_install['Administrator password 1'] ?>", 265 "req_password2": "<?php echo $lang_install['Administrator password 2'] ?>", 266 "req_email": "<?php echo $lang_install['Administrator email'] ?>", 267 "req_title": "<?php echo $lang_install['Board title'] ?>", 268 "req_base_url": "<?php echo $lang_install['Base URL'] ?>" 269 }; 92 270 if (document.all || document.getElementById) 93 271 { 94 for ( i = 0; i < the_form.length; ++i)272 for (var i = 0; i < the_form.length; ++i) 95 273 { 96 var elem = the_form.elements[i] 97 if (elem.name && elem.name.substring(0, 4) == "req_")274 var elem = the_form.elements[i]; 275 if (elem.name && (/^req_/.test(elem.name))) 98 276 { 99 if ( elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='')277 if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) 100 278 { 101 alert( "\"" + element_names[elem.name] + "\" est un champ requis pour ce formulaire.")102 elem.focus() 103 return false 279 alert('"' + element_names[elem.name] + '" <?php echo $lang_install['Required field'] ?>'); 280 elem.focus(); 281 return false; 104 282 } 105 283 } 106 284 } 107 285 } 108 109 return true 286 return true; 110 287 } 111 / / -->288 /* ]]> */ 112 289 </script> 113 290 </head> 114 <body onload="document.getElementById('install').req_db_type.focus() ">115 116 <div id="puninstall" style="margin: auto 10% auto 10%">117 <div class=" pun">118 119 <div class="block"> 120 <h2><span>Installation de PunBB</span></h2>291 <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;" onunload=""> 292 293 <div id="puninstall" class="pun"> 294 <div class="top-box"><div><!-- Top Corners --></div></div> 295 <div class="punwrap"> 296 297 <div id="brdheader" class="block"> 121 298 <div class="box"> 122 <div class="inbox"> 123 <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> 299 <div id="brdtitle" class="inbox"> 300 <h1><span><?php echo $lang_install['FluxBB Installation'] ?></span></h1> 301 <div id="brddesc"><p><?php echo $lang_install['Install message'] ?></p><p><?php echo $lang_install['Welcome'] ?></p></div> 124 302 </div> 125 303 </div> 126 304 </div> 127 305 306 <div id="brdmain"> 307 <?php if (count($languages) > 1): ?><div class="blockform"> 308 <h2><span><?php echo $lang_install['Choose install language'] ?></span></h2> 309 <div class="box"> 310 <form id="install" method="post" action="install.php"> 311 <div class="inform"> 312 <fieldset> 313 <legend><?php echo $lang_install['Install language'] ?></legend> 314 <div class="infldset"> 315 <p><?php echo $lang_install['Choose install language info'] ?></p> 316 <label><strong><?php echo $lang_install['Install language'] ?></strong> 317 <br /><select name="install_lang"> 318 <?php 319 320 foreach ($languages as $temp) 321 { 322 if ($temp == $install_lang) 323 echo "\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n"; 324 else 325 echo "\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n"; 326 } 327 328 ?> 329 </select> 330 <br /></label> 331 </div> 332 </fieldset> 333 </div> 334 <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_install['Change language'] ?>" /></p> 335 </form> 336 </div> 337 </div> 338 <?php endif; ?> 339 128 340 <div class="blockform"> 129 <h2><span> Installer PunBB</span></h2>341 <h2><span><?php echo $lang_install['Install'] ?></span></h2> 130 342 <div class="box"> 131 343 <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;}"> 132 <div><input type="hidden" name="form_sent" value="1" /></div> 344 <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div> 345 <div class="inform"> 346 <?php if (!empty($alerts)): ?> <div class="forminfo error-info"> 347 <h3><?php echo $lang_install['Errors'] ?></h3> 348 <ul class="error-list"> 349 <?php 350 351 foreach ($alerts as $cur_alert) 352 echo "\t\t\t\t\t\t".'<li><strong>'.$cur_alert.'</strong></li>'."\n"; 353 ?> 354 </ul> 355 </div> 356 <?php endif; ?> </div> 133 357 <div class="inform"> 134 358 <div class="forminfo"> 135 <h3> Réglages de la base de données</h3>136 <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>359 <h3><?php echo $lang_install['Database setup'] ?></h3> 360 <p><?php echo $lang_install['Info 1'] ?></p> 137 361 </div> 138 362 <fieldset> 139 <legend> Sélectionnez le type de votre base de données</legend>363 <legend><?php echo $lang_install['Select database'] ?></legend> 140 364 <div class="infldset"> 141 <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> 142 <?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> 143 <?php endif; ?> <label><strong>Type de base de données</strong> 365 <p><?php echo $lang_install['Info 2'] ?></p> 366 <?php if ($dual_mysql): ?> <p><?php echo $lang_install['Dual MySQL'] ?></p> 367 <?php endif; ?><?php if ($mysql_innodb): ?> <p><?php echo $lang_install['InnoDB'] ?></p> 368 <?php endif; ?> <label class="required"><strong><?php echo $lang_install['Database type'] ?> <span><?php echo $lang_install['Required'] ?></span></strong> 144 369 <br /><select name="req_db_type"> 145 370 <?php 146 371 147 foreach ($db_extensions as $db_type) 148 echo "\t\t\t\t\t\t\t".'<option value="'.$db_type[0].'">'.$db_type[1].'</option>'."\n"; 372 foreach ($db_extensions as $temp) 373 { 374 if ($temp[0] == $db_type) 375 echo "\t\t\t\t\t\t\t".'<option value="'.$temp[0].'" selected="selected">'.$temp[1].'</option>'."\n"; 376 else 377 echo "\t\t\t\t\t\t\t".'<option value="'.$temp[0].'">'.$temp[1].'</option>'."\n"; 378 } 149 379 150 380 ?> … … 156 386 <div class="inform"> 157 387 <fieldset> 158 <legend> Saisissez l'adresse de votre serveur de base de données</legend>388 <legend><?php echo $lang_install['Database hostname'] ?></legend> 159 389 <div class="infldset"> 160 <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>161 <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>390 <p><?php echo $lang_install['Info 3'] ?></p> 391 <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> 162 392 </div> 163 393 </fieldset> … … 165 395 <div class="inform"> 166 396 <fieldset> 167 <legend> Saisissez le nom de votre base de données</legend>397 <legend><?php echo $lang_install['Database enter name'] ?></legend> 168 398 <div class="infldset"> 169 <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>170 <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>399 <p><?php echo $lang_install['Info 4'] ?></p> 400 <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> 171 401 </div> 172 402 </fieldset> … … 174 404 <div class="inform"> 175 405 <fieldset> 176 <legend> Saisissez votre nom d'utilisateur et votre mot de passe de la base de données</legend>406 <legend><?php echo $lang_install['Database enter informations'] ?></legend> 177 407 <div class="infldset"> 178 <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>179 <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>180 <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>408 <p><?php echo $lang_install['Info 5'] ?></p> 409 <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> 410 <label class="conl"><?php echo $lang_install['Database password'] ?><br /><input type="password" name="db_password" size="30" /><br /></label> 181 411 <div class="clearer"></div> 182 412 </div> … … 185 415 <div class="inform"> 186 416 <fieldset> 187 <legend> Saisissez le préfixe des tables</legend>417 <legend><?php echo $lang_install['Database enter prefix'] ?></legend> 188 418 <div class="infldset"> 189 <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>190 <label> Préfixe tables<br /><input id="db_prefix" type="text" name="db_prefix" size="20" maxlength="30" /><br /></label>419 <p><?php echo $lang_install['Info 6'] ?></p> 420 <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> 191 421 </div> 192 422 </fieldset> … … 194 424 <div class="inform"> 195 425 <div class="forminfo"> 196 <h3> Réglages d'administration</h3>197 <p> Veuillez saisir les informations demandées ci-dessous afin de définir un administrateur pour votre installation de PunBB.</p>426 <h3><?php echo $lang_install['Administration setup'] ?></h3> 427 <p><?php echo $lang_install['Info 7'] ?></p> 198 428 </div> 199 429 <fieldset> 200 <legend> Saisissez le nom d'utilisateur de l'administrateur</legend>430 <legend><?php echo $lang_install['Admin enter username'] ?></legend> 201 431 <div class="infldset"> 202 <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>203 <label ><strong>Nom d'utilisateur administrateur</strong><br /><input type="text" name="req_username" size="25" maxlength="25" /><br /></label>432 <p><?php echo $lang_install['Info 8'] ?></p> 433 <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> 204 434 </div> 205 435 </fieldset> … … 207 437 <div class="inform"> 208 438 <fieldset> 209 <legend> Saisissez et confirmez le mot de passe administrateur</legend>439 <legend><?php echo $lang_install['Admin enter password'] ?></legend> 210 440 <div class="infldset"> 211 <p>Les mots de passe peuvent faire entre 4 et 16 caractÚres de long. Les mots de passe sont sensibles à la casse.</p>212 <label class="conl "><strong>Mot de passe</strong><br /><input id="req_password1" type="text" name="req_password1" size="16" maxlength="16" /><br /></label>213 <label class="conl "><strong>Confirmez le mot de passe</strong><br /><input type="text" name="req_password2" size="16" maxlength="16" /><br /></label>441 <p><?php echo $lang_install['Info 9'] ?></p> 442 <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> 443 <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> 214 444 <div class="clearer"></div> 215 445 </div> … … 218 448 <div class="inform"> 219 449 <fieldset> 220 <legend> Saisissez l'adresse e-mail de l'administrateur</legend>450 <legend><?php echo $lang_install['Admin enter email'] ?></legend> 221 451 <div class="infldset"> 222 <p>L'adresse e-mail de l'administrateur des forums.</p> 223 <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> 452 <p><?php echo $lang_install['Info 10'] ?></p> 453 <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> 454 </div> 455 </fieldset> 456 </div> 457 <div class="inform"> 458 <div class="forminfo"> 459 <h3><?php echo $lang_install['Board setup'] ?></h3> 460 <p><?php echo $lang_install['Info 11'] ?></p> 461 </div> 462 <fieldset> 463 <legend><?php echo $lang_install['Enter board title'] ?></legend> 464 <div class="infldset"> 465 <p><?php echo $lang_install['Info 12'] ?></p> 466 <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> 224 467 </div> 225 468 </fieldset> … … 227 470 <div class="inform"> 228 471 <fieldset> 229 <legend> Saisissez l'<acronym title="Uniform Resource Locator" lang="en">URL</acronym> de base de votre installation de PunBB</legend>472 <legend><?php echo $lang_install['Enter board description'] ?></legend> 230 473 <div class="infldset"> 231 <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>232 <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>474 <p><?php echo $lang_install['Info 13'] ?></p> 475 <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> 233 476 </div> 234 477 </fieldset> 235 478 </div> 236 <p><input type="submit" name="start" value="Lancer l'installation" /></p> 479 <div class="inform"> 480 <fieldset> 481 <legend><?php echo $lang_install['Enter base URL'] ?></legend> 482 <div class="infldset"> 483 <p><?php echo $lang_install['Info 14'] ?></p> 484 <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> 485 </div> 486 </fieldset> 487 </div> 488 <div class="inform"> 489 <fieldset> 490 <legend><?php echo $lang_install['Choose the default language'] ?></legend> 491 <div class="infldset"> 492 <p><?php echo $lang_install['Info 15'] ?></p> 493 <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"> 494 <?php 495 496 $languages = forum_list_langs(); 497 foreach ($languages as $temp) 498 { 499 if ($temp == $default_lang) 500 echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n"; 501 else 502 echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n"; 503 } 504 505 ?> 506 </select><br /></label> 507 </div> 508 </fieldset> 509 </div> 510 <div class="inform"> 511 <fieldset> 512 <legend><?php echo $lang_install['Choose the default style'] ?></legend> 513 <div class="infldset"> 514 <p><?php echo $lang_install['Info 16'] ?></p> 515 <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"> 516 <?php 517 518 $styles = forum_list_styles(); 519 foreach ($styles as $temp) 520 { 521 if ($temp == $default_style) 522 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n"; 523 else 524 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n"; 525 } 526 527 ?> 528 </select><br /></label> 529 </div> 530 </fieldset> 531 </div> 532 <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_install['Start install'] ?>" /></p> 237 533 </form> 238 534 </div> 239 535 </div> 240 241 536 </div> 537 538 </div> 539 <div class="end-box"><div><!-- Bottom Corners --></div></div> 242 540 </div> 243 541 … … 249 547 else 250 548 { 251 //252 // Strip slashes only if magic_quotes_gpc is on.253 //254 function unescape($str)255 {256 return (get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str;257 }258 259 260 //261 // Compute a hash of $str.262 // Uses sha1() if available. If not, SHA1 through mhash() if available. If not, fall back on md5().263 //264 function pun_hash($str)265 {266 if (function_exists('sha1')) // Only in PHP 4.3.0+267 return sha1($str);268 else if (function_exists('mhash')) // Only if Mhash library is loaded269 return bin2hex(mhash(MHASH_SHA1, $str));270 else271 return md5($str);272 }273 274 275 //276 // A temporary replacement for the full error handler found in functions.php.277 // It's here because a function called error() must be callable in the database abstraction layer.278 //279 function error($message, $file = false, $line = false, $db_error = false)280 {281 if ($file !== false && $line !== false)282 echo '<strong style="color: A00000">Une erreur s\'est produite à la ligne '.$line.' dans le fichier '.$file.'.</strong><br /><br />';283 else284 echo '<strong style="color: A00000">Une erreur s\'est produite.</strong><br /><br />';285 286 echo '<strong>PunBB a rapporté :</strong> '.htmlspecialchars($message).'<br /><br />';287 288 if ($db_error !== false)289 echo '<strong>La base de données a rapporté :</strong> '.htmlspecialchars($db_error['error_msg']).(($db_error['error_no']) ? ' (Errno: '.$db_error['error_no'].')' : '');290 291 exit;292 }293 294 295 $db_type = $_POST['req_db_type'];296 $db_host = trim($_POST['req_db_host']);297 $db_name = trim($_POST['req_db_name']);298 $db_username = unescape(trim($_POST['db_username']));299 $db_password = unescape(trim($_POST['db_password']));300 $db_prefix = trim($_POST['db_prefix']);301 $username = unescape(trim($_POST['req_username']));302 $email = strtolower(trim($_POST['req_email']));303 $password1 = unescape(trim($_POST['req_password1']));304 $password2 = unescape(trim($_POST['req_password2']));305 306 307 // Make sure base_url doesn't end with a slash308 if (substr($_POST['req_base_url'], -1) == '/')309 $base_url = substr($_POST['req_base_url'], 0, -1);310 else311 $base_url = $_POST['req_base_url'];312 313 314 // Validate username and passwords315 if (strlen($username) < 2)316 error('Le nom d\'utilisateur administrateur doit faire au moins 2 caractÚres de long. Veuillez retourner en arriÚre et corriger.');317 if (strlen($password1) < 4)318 error('Le mot de passe administrateur doit faire au moins 4 caractÚres de long. Veuillez retourner en arriÚre et corriger.');319 if ($password1 != $password2)320 error('Les mots de passe administrateur ne correspondent pas. Veuillez retourner en arriÚre et corriger.');321 if (!strcasecmp($username, 'invité'))322 error('Le nom d\'utilisateur \'invité\' est réservé. Veuillez retourner en arriÚre et corriger.');323 if (!strcasecmp($username, 'guest'))324 error('Le nom d\'utilisateur \'guest\' est réservé. Veuillez retourner en arriÚre et corriger.');325 if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))326 error('Les noms d\'utilisateur ne peuvent être de la forme d\'une adresse IP. Veuillez retourner en arriÚre et corriger.');327 if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))328 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.');329 330 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))331 error('L\'adresse e-mail administrateur que vous avez saisie est incorrecte. Veuillez retourner en arriÚre et corriger.');332 333 334 549 // Load the appropriate DB layer class 335 550 switch ($db_type) … … 339 554 break; 340 555 556 case 'mysql_innodb': 557 require PUN_ROOT.'include/dblayer/mysql_innodb.php'; 558 break; 559 341 560 case 'mysqli': 342 561 require PUN_ROOT.'include/dblayer/mysqli.php'; 343 562 break; 344 563 564 case 'mysqli_innodb': 565 require PUN_ROOT.'include/dblayer/mysqli_innodb.php'; 566 break; 567 345 568 case 'pgsql': 346 569 require PUN_ROOT.'include/dblayer/pgsql.php'; … … 350 573 require PUN_ROOT.'include/dblayer/sqlite.php'; 351 574 break; 352 575 353 576 default: 354 error( '\''.$db_type.'\' n\'est pas un type de base de données valable.');577 error(sprintf($lang_install['DB type not valid'], pun_htmlspecialchars($db_type))); 355 578 } 356 579 … … 358 581 $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false); 359 582 583 // Validate prefix 584 if (strlen($db_prefix) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $db_prefix) || strlen($db_prefix) > 40)) 585 error(sprintf($lang_install['Table prefix error'], $db->prefix)); 360 586 361 587 // Do some DB type specific checks … … 364 590 case 'mysql': 365 591 case 'mysqli': 592 case 'mysql_innodb': 593 case 'mysqli_innodb': 594 $mysql_info = $db->get_version(); 595 if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<')) 596 error(sprintf($lang_install['You are running error'], 'MySQL', $mysql_info['version'], FORUM_VERSION, MIN_MYSQL_VERSION)); 366 597 break; 367 598 368 599 case 'pgsql': 369 // Make sure we are running at least PHP 4.3.0 (needed only for PostgreSQL)370 if (version_compare( PHP_VERSION, '4.3.0', '<'))371 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.');600 $pgsql_info = $db->get_version(); 601 if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<')) 602 error(sprintf($lang_install['You are running error'], 'PostgreSQL', $pgsql_info['version'], FORUM_VERSION, MIN_PGSQL_VERSION)); 372 603 break; 373 604 374 605 case 'sqlite': 375 606 if (strtolower($db_prefix) == 'sqlite_') 376 error( 'Le préfixe de tables \'sqlite_\' est réservé pour l\'utilisation du moteur SQLite. Veuillez choisir un préfixe différent.');607 error($lang_install['Prefix reserved']); 377 608 break; 378 609 } 379 610 380 611 381 // Make sure PunBB isn't already installed612 // Make sure FluxBB isn't already installed 382 613 $result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1'); 383 614 if ($db->num_rows($result)) 384 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.'); 615 error(sprintf($lang_install['Existing table error'], $db_prefix, $db_name)); 616 617 // Check if InnoDB is available 618 if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 619 { 620 $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\''); 621 list (, $result) = $db->fetch_row($result); 622 if ((strtoupper($result) != 'YES')) 623 error($lang_install['InnoDB off']); 624 } 625 626 627 // Start a transaction 628 $db->start_transaction(); 385 629 386 630 387 631 // Create all tables 388 switch ($db_type) 632 $schema = array( 633 'FIELDS' => array( 634 'id' => array( 635 'datatype' => 'SERIAL', 636 'allow_null' => false 637 ), 638 'username' => array( 639 'datatype' => 'VARCHAR(200)', 640 'allow_null' => true 641 ), 642 'ip' => array( 643 'datatype' => 'VARCHAR(255)', 644 'allow_null' => true 645 ), 646 'email' => array( 647 'datatype' => 'VARCHAR(80)', 648 'allow_null' => true 649 ), 650 'message' => array( 651 'datatype' => 'VARCHAR(255)', 652 'allow_null' => true 653 ), 654 'expire' => array( 655 'datatype' => 'INT(10) UNSIGNED', 656 'allow_null' => true 657 ), 658 'ban_creator' => array( 659 'datatype' => 'INT(10) UNSIGNED', 660 'allow_null' => false, 661 'default' => '0' 662 ) 663 ), 664 'PRIMARY KEY' => array('id'), 665 'INDEXES' => array( 666 'username_idx' => array('username') 667 ) 668 ); 669 670 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 671 $schema['INDEXES']['username_idx'] = array('username(25)'); 672 673 $db->create_table('bans', $schema) or error('Unable to create bans table', __FILE__, __LINE__, $db->error()); 674 675 676 $schema = array( 677 'FIELDS' => array( 678 'id' => array( 679 'datatype' => 'SERIAL', 680 'allow_null' => false 681 ), 682 'cat_name' => array( 683 'datatype' => 'VARCHAR(80)', 684 'allow_null' => false, 685 'default' => '\'New Category\'' 686 ), 687 'disp_position' => array( 688 'datatype' => 'INT(10)', 689 'allow_null' => false, 690 'default' => '0' 691 ) 692 ), 693 'PRIMARY KEY' => array('id') 694 ); 695 696 $db->create_table('categories', $schema) or error('Unable to create categories table', __FILE__, __LINE__, $db->error()); 697 698 699 $schema = array( 700 'FIELDS' => array( 701 'id' => array( 702 'datatype' => 'SERIAL', 703 'allow_null' => false 704 ), 705 'search_for' => array( 706 'datatype' => 'VARCHAR(60)', 707 'allow_null' => false, 708 'default' => '\'\'' 709 ), 710 'replace_with' => array( 711 'datatype' => 'VARCHAR(60)', 712 'allow_null' => false, 713 'default' => '\'\'' 714 ) 715 ), 716 'PRIMARY KEY' => array('id') 717 ); 718 719 $db->create_table('censoring', $schema) or error('Unable to create censoring table', __FILE__, __LINE__, $db->error()); 720 721 722 $schema = array( 723 'FIELDS' => array( 724 'conf_name' => array( 725 'datatype' => 'VARCHAR(255)', 726 'allow_null' => false, 727 'default' => '\'\'' 728 ), 729 'conf_value' => array( 730 'datatype' => 'TEXT', 731 'allow_null' => true 732 ) 733 ), 734 'PRIMARY KEY' => array('conf_name') 735 ); 736 737 $db->create_table('config', $schema) or error('Unable to create config table', __FILE__, __LINE__, $db->error()); 738 739 740 $schema = array( 741 'FIELDS' => array( 742 'group_id' => array( 743 'datatype' => 'INT(10)', 744 'allow_null' => false, 745 'default' => '0' 746 ), 747 'forum_id' => array( 748 'datatype' => 'INT(10)', 749 'allow_null' => false, 750 'default' => '0' 751 ), 752 'read_forum' => array( 753 'datatype' => 'TINYINT(1)', 754 'allow_null' => false, 755 'default' => '1' 756 ), 757 'post_replies' => array( 758 'datatype' => 'TINYINT(1)', 759 'allow_null' => false, 760 'default' => '1' 761 ), 762 'post_topics' => array( 763 'datatype' => 'TINYINT(1)', 764 'allow_null' => false, 765 'default' => '1' 766 ) 767 ), 768 'PRIMARY KEY' => array('group_id', 'forum_id') 769 ); 770 771 $db->create_table('forum_perms', $schema) or error('Unable to create forum_perms table', __FILE__, __LINE__, $db->error()); 772 773 774 $schema = array( 775 'FIELDS' => array( 776 'id' => array( 777 'datatype' => 'SERIAL', 778 'allow_null' => false 779 ), 780 'forum_name' => array( 781 'datatype' => 'VARCHAR(80)', 782 'allow_null' => false, 783 'default' => '\'New forum\'' 784 ), 785 'forum_desc' => array( 786 'datatype' => 'TEXT', 787 'allow_null' => true 788 ), 789 'redirect_url' => array( 790 'datatype' => 'VARCHAR(100)', 791 'allow_null' => true 792 ), 793 'moderators' => array( 794 'datatype' => 'TEXT', 795 'allow_null' => true 796 ), 797 'num_topics' => array( 798 'datatype' => 'MEDIUMINT(8) UNSIGNED', 799 'allow_null' => false, 800 'default' => '0' 801 ), 802 'num_posts' => array( 803 'datatype' => 'MEDIUMINT(8) UNSIGNED', 804 'allow_null' => false, 805 'default' => '0' 806 ), 807 'last_post' => array( 808 'datatype' => 'INT(10) UNSIGNED', 809 'allow_null' => true 810 ), 811 'last_post_id' => array( 812 'datatype' => 'INT(10) UNSIGNED', 813 'allow_null' => true 814 ), 815 'last_poster' => array( 816 'datatype' => 'VARCHAR(200)', 817 'allow_null' => true 818 ), 819 'sort_by' => array( 820 'datatype' => 'TINYINT(1)', 821 'allow_null' => false, 822 'default' => '0' 823 ), 824 'disp_position' => array( 825 'datatype' => 'INT(10)', 826 'allow_null' => false, 827 'default' => '0' 828 ), 829 'cat_id' => array( 830 'datatype' => 'INT(10) UNSIGNED', 831 'allow_null' => false, 832 'default' => '0' 833 ) 834 ), 835 'PRIMARY KEY' => array('id') 836 ); 837 838 $db->create_table('forums', $schema) or error('Unable to create forums table', __FILE__, __LINE__, $db->error()); 839 840 841 $schema = array( 842 'FIELDS' => array( 843 'g_id' => array( 844 'datatype' => 'SERIAL', 845 'allow_null' => false 846 ), 847 'g_title' => array( 848 'datatype' => 'VARCHAR(50)', 849 'allow_null' => false, 850 'default' => '\'\'' 851 ), 852 'g_user_title' => array( 853 'datatype' => 'VARCHAR(50)', 854 'allow_null' => true 855 ), 856 'g_moderator' => array( 857 'datatype' => 'TINYINT(1)', 858 'allow_null' => false, 859 'default' => '0' 860 ), 861 'g_mod_edit_users' => array( 862 'datatype' => 'TINYINT(1)', 863 'allow_null' => false, 864 'default' => '0' 865 ), 866 'g_mod_rename_users' => array( 867 'datatype' => 'TINYINT(1)', 868 'allow_null' => false, 869 'default' => '0' 870 ), 871 'g_mod_change_passwords' => array( 872 'datatype' => 'TINYINT(1)', 873 'allow_null' => false, 874 'default' => '0' 875 ), 876 'g_mod_ban_users' => array( 877 'datatype' => 'TINYINT(1)', 878 'allow_null' => false, 879 'default' => '0' 880 ), 881 'g_read_board' => array( 882 'datatype' => 'TINYINT(1)', 883 'allow_null' => false, 884 'default' => '1' 885 ), 886 'g_view_users' => array( 887 'datatype' => 'TINYINT(1)', 888 'allow_null' => false, 889 'default' => '1' 890 ), 891 'g_post_replies' => array( 892 'datatype' => 'TINYINT(1)', 893 'allow_null' => false, 894 'default' => '1' 895 ), 896 'g_post_topics' => array( 897 'datatype' => 'TINYINT(1)', 898 'allow_null' => false, 899 'default' => '1' 900 ), 901 'g_edit_posts' => array( 902 'datatype' => 'TINYINT(1)', 903 'allow_null' => false, 904 'default' => '1' 905 ), 906 'g_delete_posts' => array( 907 'datatype' => 'TINYINT(1)', 908 'allow_null' => false, 909 'default' => '1' 910 ), 911 'g_delete_topics' => array( 912 'datatype' => 'TINYINT(1)', 913 'allow_null' => false, 914 'default' => '1' 915 ), 916 'g_set_title' => array( 917 'datatype' => 'TINYINT(1)', 918 'allow_null' => false, 919 'default' => '1' 920 ), 921 'g_search' => array( 922 'datatype' => 'TINYINT(1)', 923 'allow_null' => false, 924 'default' => '1' 925 ), 926 'g_search_users' => array( 927 'datatype' => 'TINYINT(1)', 928 'allow_null' => false, 929 'default' => '1' 930 ), 931 'g_send_email' => array( 932 'datatype' => 'TINYINT(1)', 933 'allow_null' => false, 934 'default' => '1' 935 ), 936 'g_post_flood' => array( 937 'datatype' => 'SMALLINT(6)', 938 'allow_null' => false, 939 'default' => '30' 940 ), 941 'g_search_flood' => array( 942 'datatype' => 'SMALLINT(6)', 943 'allow_null' => false, 944 'default' => '30' 945 ), 946 'g_email_flood' => array( 947 'datatype' => 'SMALLINT(6)', 948 'allow_null' => false, 949 'default' => '60' 950 ), 951 'g_report_flood' => array( 952 'datatype' => 'SMALLINT(6)', 953 'allow_null' => false, 954 'default' => '60' 955 ) 956 ), 957 'PRIMARY KEY' => array('g_id') 958 ); 959 960 $db->create_table('groups', $schema) or error('Unable to create groups table', __FILE__, __LINE__, $db->error()); 961 962 963 $schema = array( 964 'FIELDS' => array( 965 'user_id' => array( 966 'datatype' => 'INT(10) UNSIGNED', 967 'allow_null' => false, 968 'default' => '1' 969 ), 970 'ident' => array( 971 'datatype' => 'VARCHAR(200)', 972 'allow_null' => false, 973 'default' => '\'\'' 974 ), 975 'logged' => array( 976 'datatype' => 'INT(10) UNSIGNED', 977 'allow_null' => false, 978 'default' => '0' 979 ), 980 'idle' => array( 981 'datatype' => 'TINYINT(1)', 982 'allow_null' => false, 983 'default' => '0' 984 ), 985 'last_post' => array( 986 'datatype' => 'INT(10) UNSIGNED', 987 'allow_null' => true 988 ), 989 'last_search' => array( 990 'datatype' => 'INT(10) UNSIGNED', 991 'allow_null' => true 992 ), 993 ), 994 'UNIQUE KEYS' => array( 995 'user_id_ident_idx' => array('user_id', 'ident') 996 ), 997 'INDEXES' => array( 998 'ident_idx' => array('ident'), 999 'logged_idx' => array('logged') 1000 ) 1001 ); 1002 1003 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 389 1004 { 390 case 'mysql': 391 case 'mysqli': 392 $sql = 'CREATE TABLE '.$db_prefix."bans ( 393 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 394 username VARCHAR(200), 395 ip VARCHAR(255), 396 email VARCHAR(50), 397 message VARCHAR(255), 398 expire INT(10) UNSIGNED, 399 PRIMARY KEY (id) 400 ) TYPE=MyISAM;"; 401 break; 402 403 case 'pgsql': 404 $db->start_transaction(); 405 406 $sql = 'CREATE TABLE '.$db_prefix."bans ( 407 id SERIAL, 408 username VARCHAR(200), 409 ip VARCHAR(255), 410 email VARCHAR(50), 411 message VARCHAR(255), 412 expire INT, 413 PRIMARY KEY (id) 414 )"; 415 break; 416 417 case 'sqlite': 418 $db->start_transaction(); 419 420 $sql = 'CREATE TABLE '.$db_prefix."bans ( 421 id INTEGER NOT NULL, 422 username VARCHAR(200), 423 ip VARCHAR(255), 424 email VARCHAR(50), 425 message VARCHAR(255), 426 expire INTEGER, 427 PRIMARY KEY (id) 428 )"; 429 break; 430 431 432 default: 433 error('\''.$db_type.'\' n\'est pas un type de base de données correct.'); 434 1005 $schema['UNIQUE KEYS']['user_id_ident_idx'] = array('user_id', 'ident(25)'); 1006 $schema['INDEXES']['ident_idx'] = array('ident(25)'); 435 1007 } 436 1008 437 $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()); 438 439 440 switch ($db_type) 1009 if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 1010 $schema['ENGINE'] = 'InnoDB'; 1011 1012 $db->create_table('online', $schema) or error('Unable to create online table', __FILE__, __LINE__, $db->error()); 1013 1014 1015 $schema = array( 1016 'FIELDS' => array( 1017 'id' => array( 1018 'datatype' => 'SERIAL', 1019 'allow_null' => false 1020 ), 1021 'poster' => array( 1022 'datatype' => 'VARCHAR(200)', 1023 'allow_null' => false, 1024 'default' => '\'\'' 1025 ), 1026 'poster_id' => array( 1027 'datatype' => 'INT(10) UNSIGNED', 1028 'allow_null' => false, 1029 'default' => '1' 1030 ), 1031 'poster_ip' => array( 1032 'datatype' => 'VARCHAR(39)', 1033 'allow_null' => true 1034 ), 1035 'poster_email' => array( 1036 'datatype' => 'VARCHAR(80)', 1037 'allow_null' => true 1038 ), 1039 'message' => array( 1040 'datatype' => 'MEDIUMTEXT', 1041 'allow_null' => true 1042 ), 1043 'hide_smilies' => array( 1044 'datatype' => 'TINYINT(1)', 1045 'allow_null' => false, 1046 'default' => '0' 1047 ), 1048 'posted' => array( 1049 'datatype' => 'INT(10) UNSIGNED', 1050 'allow_null' => false, 1051 'default' => '0' 1052 ), 1053 'edited' => array( 1054 'datatype' => 'INT(10) UNSIGNED', 1055 'allow_null' => true 1056 ), 1057 'edited_by' => array( 1058 'datatype' => 'VARCHAR(200)', 1059 'allow_null' => true 1060 ), 1061 'topic_id' => array( 1062 'datatype' => 'INT(10) UNSIGNED', 1063 'allow_null' => false, 1064 'default' => '0' 1065 ) 1066 ), 1067 'PRIMARY KEY' => array('id'), 1068 'INDEXES' => array( 1069 'topic_id_idx' => array('topic_id'), 1070 'multi_idx' => array('poster_id', 'topic_id') 1071 ) 1072 ); 1073 1074 $db->create_table('posts', $schema) or error('Unable to create posts table', __FILE__, __LINE__, $db->error()); 1075 1076 1077 $schema = array( 1078 'FIELDS' => array( 1079 'id' => array( 1080 'datatype' => 'SERIAL', 1081 'allow_null' => false 1082 ), 1083 'rank' => array( 1084 'datatype' => 'VARCHAR(50)', 1085 'allow_null' => false, 1086 'default' => '\'\'' 1087 ), 1088 'min_posts' => array( 1089 'datatype' => 'MEDIUMINT(8) UNSIGNED', 1090 'allow_null' => false, 1091 'default' => '0' 1092 ) 1093 ), 1094 'PRIMARY KEY' => array('id') 1095 ); 1096 1097 $db->create_table('ranks', $schema) or error('Unable to create ranks table', __FILE__, __LINE__, $db->error()); 1098 1099 1100 $schema = array( 1101 'FIELDS' => array( 1102 'id' => array( 1103 'datatype' => 'SERIAL', 1104 'allow_null' => false 1105 ), 1106 'post_id' => array( 1107 'datatype' => 'INT(10) UNSIGNED', 1108 'allow_null' => false, 1109 'default' => '0' 1110 ), 1111 'topic_id' => array( 1112 'datatype' => 'INT(10) UNSIGNED', 1113 'allow_null' => false, 1114 'default' => '0' 1115 ), 1116 'forum_id' => array( 1117 'datatype' => 'INT(10) UNSIGNED', 1118 'allow_null' => false, 1119 'default' => '0' 1120 ), 1121 'reported_by' => array( 1122 'datatype' => 'INT(10) UNSIGNED', 1123 'allow_null' => false, 1124 'default' => '0' 1125 ), 1126 'created' => array( 1127 'datatype' => 'INT(10) UNSIGNED', 1128 'allow_null' => false, 1129 'default' => '0' 1130 ), 1131 'message' => array( 1132 'datatype' => 'TEXT', 1133 'allow_null' => true 1134 ), 1135 'zapped' => array( 1136 'datatype' => 'INT(10) UNSIGNED', 1137 'allow_null' => true 1138 ), 1139 'zapped_by' => array( 1140 'datatype' => 'INT(10) UNSIGNED', 1141 'allow_null' => true 1142 ) 1143 ), 1144 'PRIMARY KEY' => array('id'), 1145 'INDEXES' => array( 1146 'zapped_idx' => array('zapped') 1147 ) 1148 ); 1149 1150 $db->create_table('reports', $schema) or error('Unable to create reports table', __FILE__, __LINE__, $db->error()); 1151 1152 1153 $schema = array( 1154 'FIELDS' => array( 1155 'id' => array( 1156 'datatype' => 'INT(10) UNSIGNED', 1157 'allow_null' => false, 1158 'default' => '0' 1159 ), 1160 'ident' => array( 1161 'datatype' => 'VARCHAR(200)', 1162 'allow_null' => false, 1163 'default' => '\'\'' 1164 ), 1165 'search_data' => array( 1166 'datatype' => 'MEDIUMTEXT', 1167 'allow_null' => true 1168 ) 1169 ), 1170 'PRIMARY KEY' => array('id'), 1171 'INDEXES' => array( 1172 'ident_idx' => array('ident') 1173 ) 1174 ); 1175 1176 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 1177 $schema['INDEXES']['ident_idx'] = array('ident(8)'); 1178 1179 $db->create_table('search_cache', $schema) or error('Unable to create search_cache table', __FILE__, __LINE__, $db->error()); 1180 1181 1182 $schema = array( 1183 'FIELDS' => array( 1184 'post_id' => array( 1185 'datatype' => 'INT(10) UNSIGNED', 1186 'allow_null' => false, 1187 'default' => '0' 1188 ), 1189 'word_id' => array( 1190 'datatype' => 'INT(10) UNSIGNED', 1191 'allow_null' => false, 1192 'default' => '0' 1193 ), 1194 'subject_match' => array( 1195 'datatype' => 'TINYINT(1)', 1196 'allow_null' => false, 1197 'default' => '0' 1198 ) 1199 ), 1200 'INDEXES' => array( 1201 'word_id_idx' => array('word_id'), 1202 'post_id_idx' => array('post_id') 1203 ) 1204 ); 1205 1206 $db->create_table('search_matches', $schema) or error('Unable to create search_matches table', __FILE__, __LINE__, $db->error()); 1207 1208 1209 $schema = array( 1210 'FIELDS' => array( 1211 'id' => array( 1212 'datatype' => 'SERIAL', 1213 'allow_null' => false 1214 ), 1215 'word' => array( 1216 'datatype' => 'VARCHAR(20)', 1217 'allow_null' => false, 1218 'default' => '\'\'', 1219 'collation' => 'bin' 1220 ) 1221 ), 1222 'PRIMARY KEY' => array('word'), 1223 'INDEXES' => array( 1224 'id_idx' => array('id') 1225 ) 1226 ); 1227 1228 if ($db_type == 'sqlite') 441 1229 { 442 case 'mysql': 443 case 'mysqli': 444 $sql = 'CREATE TABLE '.$db_prefix."categories ( 445 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 446 cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category', 447 disp_position INT(10) NOT NULL DEFAULT 0, 448 PRIMARY KEY (id) 449 ) TYPE=MyISAM;"; 450 break; 451 452 case 'pgsql': 453 $sql = 'CREATE TABLE '.$db_prefix."categories ( 454 id SERIAL, 455 cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category', 456 disp_position INT NOT NULL DEFAULT 0, 457 PRIMARY KEY (id) 458 )"; 459 break; 460 461 case 'sqlite': 462 $sql = 'CREATE TABLE '.$db_prefix."categories ( 463 id INTEGER NOT NULL, 464 cat_name VARCHAR(80) NOT NULL DEFAULT 'New Category', 465 disp_position INTEGER NOT NULL DEFAULT 0, 466 PRIMARY KEY (id) 467 )"; 468 break; 1230 $schema['PRIMARY KEY'] = array('id'); 1231 $schema['UNIQUE KEYS'] = array('word_idx' => array('word')); 469 1232 } 470 1233 471 $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()); 472 473 474 475 switch ($db_type) 476 { 477 case 'mysql': 478 case 'mysqli': 479 $sql = 'CREATE TABLE '.$db_prefix."censoring ( 480 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 481 search_for VARCHAR(60) NOT NULL DEFAULT '', 482 replace_with VARCHAR(60) NOT NULL DEFAULT '', 483 PRIMARY KEY (id) 484 ) TYPE=MyISAM;"; 485 break; 486 487 case 'pgsql': 488 $sql = 'CREATE TABLE '.$db_prefix."censoring ( 489 id SERIAL, 490 search_for VARCHAR(60) NOT NULL DEFAULT '', 491 replace_with VARCHAR(60) NOT NULL DEFAULT '', 492 PRIMARY KEY (id) 493 )"; 494 break; 495 496 case 'sqlite': 497 $sql = 'CREATE TABLE '.$db_prefix."censoring ( 498 id INTEGER NOT NULL, 499 search_for VARCHAR(60) NOT NULL DEFAULT '', 500 replace_with VARCHAR(60) NOT NULL DEFAULT '', 501 PRIMARY KEY (id) 502 )"; 503 break; 504 } 505 506 $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()); 507 508 509 510 switch ($db_type) 511 { 512 case 'mysql': 513 case 'mysqli': 514 $sql = 'CREATE TABLE '.$db_prefix."config ( 515 conf_name VARCHAR(255) NOT NULL DEFAULT '', 516 conf_value TEXT, 517 PRIMARY KEY (conf_name) 518 ) TYPE=MyISAM;"; 519 break; 520 521 case 'pgsql': 522 $sql = 'CREATE TABLE '.$db_prefix."config ( 523 conf_name VARCHAR(255) NOT NULL DEFAULT '', 524 conf_value TEXT, 525 PRIMARY KEY (conf_name) 526 )"; 527 break; 528 529 case 'sqlite': 530 $sql = 'CREATE TABLE '.$db_prefix."config ( 531 conf_name VARCHAR(255) NOT NULL DEFAULT '', 532 conf_value TEXT, 533 PRIMARY KEY (conf_name) 534 )"; 535 break; 536 } 537 538 $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()); 539 540 541 542 switch ($db_type) 543 { 544 case 'mysql': 545 case 'mysqli': 546 $sql = 'CREATE TABLE '.$db_prefix."forum_perms ( 547 group_id INT(10) NOT NULL DEFAULT 0, 548 forum_id INT(10) NOT NULL DEFAULT 0, 549 read_forum TINYINT(1) NOT NULL DEFAULT 1, 550 post_replies TINYINT(1) NOT NULL DEFAULT 1, 551 post_topics TINYINT(1) NOT NULL DEFAULT 1, 552 PRIMARY KEY (group_id, forum_id) 553 ) TYPE=MyISAM;"; 554 break; 555 556 case 'pgsql': 557 $sql = 'CREATE TABLE '.$db_prefix."forum_perms ( 558 group_id INT NOT NULL DEFAULT 0, 559 forum_id INT NOT NULL DEFAULT 0, 560 read_forum SMALLINT NOT NULL DEFAULT 1, 561 post_replies SMALLINT NOT NULL DEFAULT 1, 562 post_topics SMALLINT NOT NULL DEFAULT 1, 563 PRIMARY KEY (group_id, forum_id) 564 )"; 565 break; 566 567 case 'sqlite': 568 $sql = 'CREATE TABLE '.$db_prefix."forum_perms ( 569 group_id INTEGER NOT NULL DEFAULT 0, 570 forum_id INTEGER NOT NULL DEFAULT 0, 571 read_forum INTEGER NOT NULL DEFAULT 1, 572 post_replies INTEGER NOT NULL DEFAULT 1, 573 post_topics INTEGER NOT NULL DEFAULT 1, 574 PRIMARY KEY (group_id, forum_id) 575 )"; 576 break; 577 } 578 579 $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()); 580 581 582 583 switch ($db_type) 584 { 585 case 'mysql': 586 case 'mysqli': 587 $sql = 'CREATE TABLE '.$db_prefix."forums ( 588 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 589 forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum', 590 forum_desc TEXT, 591 redirect_url VARCHAR(100), 592 moderators TEXT, 593 num_topics MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, 594 num_posts MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, 595 last_post INT(10) UNSIGNED, 596 last_post_id INT(10) UNSIGNED, 597 last_poster VARCHAR(200), 598 sort_by TINYINT(1) NOT NULL DEFAULT 0, 599 disp_position INT(10) NOT NULL DEFAULT 0, 600 cat_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 601 PRIMARY KEY (id) 602 ) TYPE=MyISAM;"; 603 break; 604 605 case 'pgsql': 606 $sql = 'CREATE TABLE '.$db_prefix."forums ( 607 id SERIAL, 608 forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum', 609 forum_desc TEXT, 610 redirect_url VARCHAR(100), 611 moderators TEXT, 612 num_topics INT NOT NULL DEFAULT 0, 613 num_posts INT NOT NULL DEFAULT 0, 614 last_post INT, 615 last_post_id INT, 616 last_poster VARCHAR(200), 617 sort_by SMALLINT NOT NULL DEFAULT 0, 618 disp_position INT NOT NULL DEFAULT 0, 619 cat_id INT NOT NULL DEFAULT 0, 620 PRIMARY KEY (id) 621 )"; 622 break; 623 624 case 'sqlite': 625 $sql = 'CREATE TABLE '.$db_prefix."forums ( 626 id INTEGER NOT NULL, 627 forum_name VARCHAR(80) NOT NULL DEFAULT 'New forum', 628 forum_desc TEXT, 629 redirect_url VARCHAR(100), 630 moderators TEXT, 631 num_topics INTEGER NOT NULL DEFAULT 0, 632 num_posts INTEGER NOT NULL DEFAULT 0, 633 last_post INTEGER, 634 last_post_id INTEGER, 635 last_poster VARCHAR(200), 636 sort_by INTEGER NOT NULL DEFAULT 0, 637 disp_position INTEGER NOT NULL DEFAULT 0, 638 cat_id INTEGER NOT NULL DEFAULT 0, 639 PRIMARY KEY (id) 640 )"; 641 break; 642 } 643 644 $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()); 645 646 647 648 switch ($db_type) 649 { 650 case 'mysql': 651 case 'mysqli': 652 $sql = 'CREATE TABLE '.$db_prefix."groups ( 653 g_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 654 g_title VARCHAR(50) NOT NULL DEFAULT '', 655 g_user_title VARCHAR(50), 656 g_read_board TINYINT(1) NOT NULL DEFAULT 1, 657 g_post_replies TINYINT(1) NOT NULL DEFAULT 1, 658 g_post_topics TINYINT(1) NOT NULL DEFAULT 1, 659 g_post_polls TINYINT(1) NOT NULL DEFAULT 1, 660 g_edit_posts TINYINT(1) NOT NULL DEFAULT 1, 661 g_delete_posts TINYINT(1) NOT NULL DEFAULT 1, 662 g_delete_topics TINYINT(1) NOT NULL DEFAULT 1, 663 g_set_title TINYINT(1) NOT NULL DEFAULT 1, 664 g_search TINYINT(1) NOT NULL DEFAULT 1, 665 g_search_users TINYINT(1) NOT NULL DEFAULT 1, 666 g_edit_subjects_interval SMALLINT(6) NOT NULL DEFAULT 300, 667 g_post_flood SMALLINT(6) NOT NULL DEFAULT 30, 668 g_search_flood SMALLINT(6) NOT NULL DEFAULT 30, 669 PRIMARY KEY (g_id) 670 ) TYPE=MyISAM;"; 671 break; 672 673 case 'pgsql': 674 $sql = 'CREATE TABLE '.$db_prefix."groups ( 675 g_id SERIAL, 676 g_title VARCHAR(50) NOT NULL DEFAULT '', 677 g_user_title VARCHAR(50), 678 g_read_board SMALLINT NOT NULL DEFAULT 1, 679 g_post_replies SMALLINT NOT NULL DEFAULT 1, 680 g_post_topics SMALLINT NOT NULL DEFAULT 1, 681 g_post_polls SMALLINT NOT NULL DEFAULT 1, 682 g_edit_posts SMALLINT NOT NULL DEFAULT 1, 683 g_delete_posts SMALLINT NOT NULL DEFAULT 1, 684 g_delete_topics SMALLINT NOT NULL DEFAULT 1, 685 g_set_title SMALLINT NOT NULL DEFAULT 1, 686 g_search SMALLINT NOT NULL DEFAULT 1, 687 g_search_users SMALLINT NOT NULL DEFAULT 1, 688 g_edit_subjects_interval SMALLINT NOT NULL DEFAULT 300, 689 g_post_flood SMALLINT NOT NULL DEFAULT 30, 690 g_search_flood SMALLINT NOT NULL DEFAULT 30, 691 PRIMARY KEY (g_id) 692 )"; 693 break; 694 695 case 'sqlite': 696 $sql = 'CREATE TABLE '.$db_prefix."groups ( 697 g_id INTEGER NOT NULL, 698 g_title VARCHAR(50) NOT NULL DEFAULT '', 699 g_user_title VARCHAR(50), 700 g_read_board INTEGER NOT NULL DEFAULT 1, 701 g_post_replies INTEGER NOT NULL DEFAULT 1, 702 g_post_topics INTEGER NOT NULL DEFAULT 1, 703 g_post_polls INTEGER NOT NULL DEFAULT 1, 704 g_edit_posts INTEGER NOT NULL DEFAULT 1, 705 g_delete_posts INTEGER NOT NULL DEFAULT 1, 706 g_delete_topics INTEGER NOT NULL DEFAULT 1, 707 g_set_title INTEGER NOT NULL DEFAULT 1, 708 g_search INTEGER NOT NULL DEFAULT 1, 709 g_search_users INTEGER NOT NULL DEFAULT 1, 710 g_edit_subjects_interval INTEGER NOT NULL DEFAULT 300, 711 g_post_flood INTEGER NOT NULL DEFAULT 30, 712 g_search_flood INTEGER NOT NULL DEFAULT 30, 713 PRIMARY KEY (g_id) 714 )"; 715 break; 716 } 717 718 $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()); 719 720 721 722 switch ($db_type) 723 { 724 case 'mysql': 725 case 'mysqli': 726 $sql = 'CREATE TABLE '.$db_prefix."online ( 727 user_id INT(10) UNSIGNED NOT NULL DEFAULT 1, 728 ident VARCHAR(200) NOT NULL DEFAULT '', 729 logged INT(10) UNSIGNED NOT NULL DEFAULT 0, 730 idle TINYINT(1) NOT NULL DEFAULT 0 731 ) TYPE=HEAP;"; 732 break; 733 734 case 'pgsql': 735 $sql = 'CREATE TABLE '.$db_prefix."online ( 736 user_id INT NOT NULL DEFAULT 1, 737 ident VARCHAR(200) NOT NULL DEFAULT '', 738 logged INT NOT NULL DEFAULT 0, 739 idle SMALLINT NOT NULL DEFAULT 0 740 )"; 741 break; 742 743 case 'sqlite': 744 $sql = 'CREATE TABLE '.$db_prefix."online ( 745 user_id INTEGER NOT NULL DEFAULT 1, 746 ident VARCHAR(200) NOT NULL DEFAULT '', 747 logged INTEGER NOT NULL DEFAULT 0, 748 idle INTEGER NOT NULL DEFAULT 0 749 )"; 750 break; 751 } 752 753 $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()); 754 755 756 757 switch ($db_type) 758 { 759 case 'mysql': 760 case 'mysqli': 761 $sql = 'CREATE TABLE '.$db_prefix."posts ( 762 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 763 poster VARCHAR(200) NOT NULL DEFAULT '', 764 poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1, 765 poster_ip VARCHAR(15), 766 poster_email VARCHAR(50), 767 message TEXT NOT NULL DEFAULT '', 768 hide_smilies TINYINT(1) NOT NULL DEFAULT 0, 769 posted INT(10) UNSIGNED NOT NULL DEFAULT 0, 770 edited INT(10) UNSIGNED, 771 edited_by VARCHAR(200), 772 topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 773 PRIMARY KEY (id) 774 ) TYPE=MyISAM;"; 775 break; 776 777 case 'pgsql': 778 $sql = 'CREATE TABLE '.$db_prefix."posts ( 779 id SERIAL, 780 poster VARCHAR(200) NOT NULL DEFAULT '', 781 poster_id INT NOT NULL DEFAULT 1, 782 poster_ip VARCHAR(15), 783 poster_email VARCHAR(50), 784 message TEXT NOT NULL DEFAULT '', 785 hide_smilies SMALLINT NOT NULL DEFAULT 0, 786 posted INT NOT NULL DEFAULT 0, 787 edited INT, 788 edited_by VARCHAR(200), 789 topic_id INT NOT NULL DEFAULT 0, 790 PRIMARY KEY (id) 791 )"; 792 break; 793 794 case 'sqlite': 795 $sql = 'CREATE TABLE '.$db_prefix."posts ( 796 id INTEGER NOT NULL, 797 poster VARCHAR(200) NOT NULL DEFAULT '', 798 poster_id INTEGER NOT NULL DEFAULT 1, 799 poster_ip VARCHAR(15), 800 poster_email VARCHAR(50), 801 message TEXT NOT NULL DEFAULT '', 802 hide_smilies INTEGER NOT NULL DEFAULT 0, 803 posted INTEGER NOT NULL DEFAULT 0, 804 edited INTEGER, 805 edited_by VARCHAR(200), 806 topic_id INTEGER NOT NULL DEFAULT 0, 807 PRIMARY KEY (id) 808 )"; 809 break; 810 } 811 812 $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()); 813 814 815 816 switch ($db_type) 817 { 818 case 'mysql': 819 case 'mysqli': 820 $sql = 'CREATE TABLE '.$db_prefix."ranks ( 821 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 822 rank VARCHAR(50) NOT NULL DEFAULT '', 823 min_posts MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, 824 PRIMARY KEY (id) 825 ) TYPE=MyISAM;"; 826 break; 827 828 case 'pgsql': 829 $sql = 'CREATE TABLE '.$db_prefix."ranks ( 830 id SERIAL, 831 rank VARCHAR(50) NOT NULL DEFAULT '', 832 min_posts INT NOT NULL DEFAULT 0, 833 PRIMARY KEY (id) 834 )"; 835 break; 836 837 case 'sqlite': 838 $sql = 'CREATE TABLE '.$db_prefix."ranks ( 839 id INTEGER NOT NULL, 840 rank VARCHAR(50) NOT NULL DEFAULT '', 841 min_posts INTEGER NOT NULL DEFAULT 0, 842 PRIMARY KEY (id) 843 )"; 844 break; 845 } 846 847 $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()); 848 849 850 851 switch ($db_type) 852 { 853 case 'mysql': 854 case 'mysqli': 855 $sql = 'CREATE TABLE '.$db_prefix."reports ( 856 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 857 post_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 858 topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 859 forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 860 reported_by INT(10) UNSIGNED NOT NULL DEFAULT 0, 861 created INT(10) UNSIGNED NOT NULL DEFAULT 0, 862 message TEXT NOT NULL DEFAULT '', 863 zapped INT(10) UNSIGNED, 864 zapped_by INT(10) UNSIGNED, 865 PRIMARY KEY (id) 866 ) TYPE=MyISAM;"; 867 break; 868 869 case 'pgsql': 870 $sql = 'CREATE TABLE '.$db_prefix."reports ( 871 id SERIAL, 872 post_id INT NOT NULL DEFAULT 0, 873 topic_id INT NOT NULL DEFAULT 0, 874 forum_id INT NOT NULL DEFAULT 0, 875 reported_by INT NOT NULL DEFAULT 0, 876 created INT NOT NULL DEFAULT 0, 877 message TEXT NOT NULL DEFAULT '', 878 zapped INT, 879 zapped_by INT, 880 PRIMARY KEY (id) 881 )"; 882 break; 883 884 case 'sqlite': 885 $sql = 'CREATE TABLE '.$db_prefix."reports ( 886 id INTEGER NOT NULL, 887 post_id INTEGER NOT NULL DEFAULT 0, 888 topic_id INTEGER NOT NULL DEFAULT 0, 889 forum_id INTEGER NOT NULL DEFAULT 0, 890 reported_by INTEGER NOT NULL DEFAULT 0, 891 created INTEGER NOT NULL DEFAULT 0, 892 message TEXT NOT NULL DEFAULT '', 893 zapped INTEGER, 894 zapped_by INTEGER, 895 PRIMARY KEY (id) 896 )"; 897 break; 898 } 899 900 $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()); 901 902 903 904 switch ($db_type) 905 { 906 case 'mysql': 907 case 'mysqli': 908 $sql = 'CREATE TABLE '.$db_prefix."search_cache ( 909 id INT(10) UNSIGNED NOT NULL DEFAULT 0, 910 ident VARCHAR(200) NOT NULL DEFAULT '', 911 search_data TEXT NOT NULL DEFAULT '', 912 PRIMARY KEY (id) 913 ) TYPE=MyISAM;"; 914 break; 915 916 case 'pgsql': 917 $sql = 'CREATE TABLE '.$db_prefix."search_cache ( 918 id INT NOT NULL DEFAULT 0, 919 ident VARCHAR(200) NOT NULL DEFAULT '', 920 search_data TEXT NOT NULL DEFAULT '', 921 PRIMARY KEY (id) 922 )"; 923 break; 924 925 case 'sqlite': 926 $sql = 'CREATE TABLE '.$db_prefix."search_cache ( 927 id INTEGER NOT NULL DEFAULT 0, 928 ident VARCHAR(200) NOT NULL DEFAULT '', 929 search_data TEXT NOT NULL DEFAULT '', 930 PRIMARY KEY (id) 931 )"; 932 break; 933 } 934 935 $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()); 936 937 938 939 switch ($db_type) 940 { 941 case 'mysql': 942 case 'mysqli': 943 $sql = 'CREATE TABLE '.$db_prefix."search_matches ( 944 post_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 945 word_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, 946 subject_match TINYINT(1) NOT NULL DEFAULT 0 947 ) TYPE=MyISAM;"; 948 break; 949 950 case 'pgsql': 951 $sql = 'CREATE TABLE '.$db_prefix."search_matches ( 952 post_id INT NOT NULL DEFAULT 0, 953 word_id INT NOT NULL DEFAULT 0, 954 subject_match SMALLINT NOT NULL DEFAULT 0 955 )"; 956 break; 957 958 case 'sqlite': 959 $sql = 'CREATE TABLE '.$db_prefix."search_matches ( 960 post_id INTEGER NOT NULL DEFAULT 0, 961 word_id INTEGER NOT NULL DEFAULT 0, 962 subject_match INTEGER NOT NULL DEFAULT 0 963 )"; 964 break; 965 } 966 967 $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()); 968 969 970 971 switch ($db_type) 972 { 973 case 'mysql': 974 case 'mysqli': 975 $sql = 'CREATE TABLE '.$db_prefix."search_words ( 976 id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT, 977 word VARCHAR(20) BINARY NOT NULL DEFAULT '', 978 PRIMARY KEY (word), 979 KEY ".$db_prefix."search_words_id_idx (id) 980 ) TYPE=MyISAM;"; 981 break; 982 983 case 'pgsql': 984 $sql = 'CREATE TABLE '.$db_prefix."search_words ( 985 id SERIAL, 986 word VARCHAR(20) NOT NULL DEFAULT '', 987 PRIMARY KEY (word) 988 )"; 989 break; 990 991 case 'sqlite': 992 $sql = 'CREATE TABLE '.$db_prefix."search_words ( 993 id INTEGER NOT NULL, 994 word VARCHAR(20) NOT NULL DEFAULT '', 995 PRIMARY KEY (id), 996 UNIQUE (word) 997 )"; 998 break; 999 } 1000 1001 $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()); 1002 1003 1004 1005 switch ($db_type) 1006 { 1007 case 'mysql': 1008 case 'mysqli': 1009 $sql = 'CREATE TABLE '.$db_prefix."subscriptions ( 1010 user_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 1011 topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 1012 PRIMARY KEY (user_id, topic_id) 1013 ) TYPE=MyISAM;"; 1014 break; 1015 1016 case 'pgsql': 1017 $sql = 'CREATE TABLE '.$db_prefix."subscriptions ( 1018 user_id INT NOT NULL DEFAULT 0, 1019 topic_id INT NOT NULL DEFAULT 0, 1020 PRIMARY KEY (user_id, topic_id) 1021 )"; 1022 break; 1023 1024 case 'sqlite': 1025 $sql = 'CREATE TABLE '.$db_prefix."subscriptions ( 1026 user_id INTEGER NOT NULL DEFAULT 0, 1027 topic_id INTEGER NOT NULL DEFAULT 0, 1028 PRIMARY KEY (user_id, topic_id) 1029 )"; 1030 break; 1031 } 1032 1033 $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()); 1034 1035 1036 1037 switch ($db_type) 1038 { 1039 case 'mysql': 1040 case 'mysqli': 1041 $sql = 'CREATE TABLE '.$db_prefix."topics ( 1042 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 1043 poster VARCHAR(200) NOT NULL DEFAULT '', 1044 subject VARCHAR(255) NOT NULL DEFAULT '', 1045 posted INT(10) UNSIGNED NOT NULL DEFAULT 0, 1046 last_post INT(10) UNSIGNED NOT NULL DEFAULT 0, 1047 last_post_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 1048 last_poster VARCHAR(200), 1049 num_views MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, 1050 num_replies MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, 1051 closed TINYINT(1) NOT NULL DEFAULT 0, 1052 sticky TINYINT(1) NOT NULL DEFAULT 0, 1053 moved_to INT(10) UNSIGNED, 1054 forum_id INT(10) UNSIGNED NOT NULL DEFAULT 0, 1055 PRIMARY KEY (id) 1056 ) TYPE=MyISAM;"; 1057 break; 1058 1059 case 'pgsql': 1060 $sql = 'CREATE TABLE '.$db_prefix."topics ( 1061 id SERIAL, 1062 poster VARCHAR(200) NOT NULL DEFAULT '', 1063 subject VARCHAR(255) NOT NULL DEFAULT '', 1064 posted INT NOT NULL DEFAULT 0, 1065 last_post INT NOT NULL DEFAULT 0, 1066 last_post_id INT NOT NULL DEFAULT 0, 1067 last_poster VARCHAR(200), 1068 num_views INT NOT NULL DEFAULT 0, 1069 num_replies INT NOT NULL DEFAULT 0, 1070 closed SMALLINT NOT NULL DEFAULT 0, 1071 sticky SMALLINT NOT NULL DEFAULT 0, 1072 moved_to INT, 1073 forum_id INT NOT NULL DEFAULT 0, 1074 PRIMARY KEY (id) 1075 )"; 1076 break; 1077 1078 case 'sqlite': 1079 $sql = 'CREATE TABLE '.$db_prefix."topics ( 1080 id INTEGER NOT NULL, 1081 poster VARCHAR(200) NOT NULL DEFAULT '', 1082 subject VARCHAR(255) NOT NULL DEFAULT '', 1083 posted INTEGER NOT NULL DEFAULT 0, 1084 last_post INTEGER NOT NULL DEFAULT 0, 1085 last_post_id INTEGER NOT NULL DEFAULT 0, 1086 last_poster VARCHAR(200), 1087 num_views INTEGER NOT NULL DEFAULT 0, 1088 num_replies INTEGER NOT NULL DEFAULT 0, 1089 closed INTEGER NOT NULL DEFAULT 0, 1090 sticky INTEGER NOT NULL DEFAULT 0, 1091 moved_to INTEGER, 1092 forum_id INTEGER NOT NULL DEFAULT 0, 1093 PRIMARY KEY (id) 1094 )"; 1095 break; 1096 } 1097 1098 $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()); 1099 1100 1101 1102 switch ($db_type) 1103 { 1104 case 'mysql': 1105 case 'mysqli': 1106 $sql = 'CREATE TABLE '.$db_prefix."users ( 1107 id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, 1108 group_id INT(10) UNSIGNED NOT NULL DEFAULT 4, 1109 username VARCHAR(200) NOT NULL DEFAULT '', 1110 password VARCHAR(40) NOT NULL DEFAULT '', 1111 email VARCHAR(50) NOT NULL DEFAULT '', 1112 title VARCHAR(50), 1113 realname VARCHAR(40), 1114 url VARCHAR(100), 1115 jabber VARCHAR(75), 1116 icq VARCHAR(12), 1117 msn VARCHAR(50), 1118 aim VARCHAR(30), 1119 yahoo VARCHAR(30), 1120 location VARCHAR(30), 1121 use_avatar TINYINT(1) NOT NULL DEFAULT 0, 1122 signature TEXT, 1123 disp_topics TINYINT(3) UNSIGNED, 1124 disp_posts TINYINT(3) UNSIGNED, 1125 email_setting TINYINT(1) NOT NULL DEFAULT 1, 1126 save_pass TINYINT(1) NOT NULL DEFAULT 1, 1127 notify_with_post TINYINT(1) NOT NULL DEFAULT 0, 1128 show_smilies TINYINT(1) NOT NULL DEFAULT 1, 1129 show_img TINYINT(1) NOT NULL DEFAULT 1, 1130 show_img_sig TINYINT(1) NOT NULL DEFAULT 1, 1131 show_avatars TINYINT(1) NOT NULL DEFAULT 1, 1132 show_sig TINYINT(1) NOT NULL DEFAULT 1, 1133 timezone FLOAT NOT NULL DEFAULT 0, 1134 language VARCHAR(25) NOT NULL DEFAULT 'English', 1135 style VARCHAR(25) NOT NULL DEFAULT 'Oxygen', 1136 num_posts INT(10) UNSIGNED NOT NULL DEFAULT 0, 1137 last_post INT(10) UNSIGNED, 1138 registered INT(10) UNSIGNED NOT NULL DEFAULT 0, 1139 registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', 1140 last_visit INT(10) UNSIGNED NOT NULL DEFAULT 0, 1141 admin_note VARCHAR(30), 1142 activate_string VARCHAR(50), 1143 activate_key VARCHAR(8), 1144 PRIMARY KEY (id) 1145 ) TYPE=MyISAM;"; 1146 break; 1147 1148 case 'pgsql': 1149 $sql = 'CREATE TABLE '.$db_prefix."users ( 1150 id SERIAL, 1151 group_id INT NOT NULL DEFAULT 4, 1152 username VARCHAR(200) NOT NULL DEFAULT '', 1153 password VARCHAR(40) NOT NULL DEFAULT '', 1154 email VARCHAR(50) NOT NULL DEFAULT '', 1155 title VARCHAR(50), 1156 realname VARCHAR(40), 1157 url VARCHAR(100), 1158 jabber VARCHAR(75), 1159 icq VARCHAR(12), 1160 msn VARCHAR(50), 1161 aim VARCHAR(30), 1162 yahoo VARCHAR(30), 1163 location VARCHAR(30), 1164 use_avatar SMALLINT NOT NULL DEFAULT 0, 1165 signature TEXT, 1166 disp_topics SMALLINT, 1167 disp_posts SMALLINT, 1168 email_setting SMALLINT NOT NULL DEFAULT 1, 1169 save_pass SMALLINT NOT NULL DEFAULT 1, 1170 notify_with_post SMALLINT NOT NULL DEFAULT 0, 1171 show_smilies SMALLINT NOT NULL DEFAULT 1, 1172 show_img SMALLINT NOT NULL DEFAULT 1, 1173 show_img_sig SMALLINT NOT NULL DEFAULT 1, 1174 show_avatars SMALLINT NOT NULL DEFAULT 1, 1175 show_sig SMALLINT NOT NULL DEFAULT 1, 1176 timezone REAL NOT NULL DEFAULT 0, 1177 language VARCHAR(25) NOT NULL DEFAULT 'English', 1178 style VARCHAR(25) NOT NULL DEFAULT 'Oxygen', 1179 num_posts INT NOT NULL DEFAULT 0, 1180 last_post INT, 1181 registered INT NOT NULL DEFAULT 0, 1182 registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', 1183 last_visit INT NOT NULL DEFAULT 0, 1184 admin_note VARCHAR(30), 1185 activate_string VARCHAR(50), 1186 activate_key VARCHAR(8), 1187 PRIMARY KEY (id) 1188 )"; 1189 break; 1190 1191 case 'sqlite': 1192 $sql = 'CREATE TABLE '.$db_prefix."users ( 1193 id INTEGER NOT NULL, 1194 group_id INTEGER NOT NULL DEFAULT 4, 1195 username VARCHAR(200) NOT NULL DEFAULT '', 1196 password VARCHAR(40) NOT NULL DEFAULT '', 1197 email VARCHAR(50) NOT NULL DEFAULT '', 1198 title VARCHAR(50), 1199 realname VARCHAR(40), 1200 url VARCHAR(100), 1201 jabber VARCHAR(75), 1202 icq VARCHAR(12), 1203 msn VARCHAR(50), 1204 aim VARCHAR(30), 1205 yahoo VARCHAR(30), 1206 location VARCHAR(30), 1207 use_avatar INTEGER NOT NULL DEFAULT 0, 1208 signature TEXT, 1209 disp_topics INTEGER, 1210 disp_posts INTEGER, 1211 email_setting INTEGER NOT NULL DEFAULT 1, 1212 save_pass INTEGER NOT NULL DEFAULT 1, 1213 notify_with_post INTEGER NOT NULL DEFAULT 0, 1214 show_smilies INTEGER NOT NULL DEFAULT 1, 1215 show_img INTEGER NOT NULL DEFAULT 1, 1216 show_img_sig INTEGER NOT NULL DEFAULT 1, 1217 show_avatars INTEGER NOT NULL DEFAULT 1, 1218 show_sig INTEGER NOT NULL DEFAULT 1, 1219 timezone FLOAT NOT NULL DEFAULT 0, 1220 language VARCHAR(25) NOT NULL DEFAULT 'English', 1221 style VARCHAR(25) NOT NULL DEFAULT 'Oxygen', 1222 num_posts INTEGER NOT NULL DEFAULT 0, 1223 last_post INTEGER, 1224 registered INTEGER NOT NULL DEFAULT 0, 1225 registration_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', 1226 last_visit INTEGER NOT NULL DEFAULT 0, 1227 admin_note VARCHAR(30), 1228 activate_string VARCHAR(50), 1229 activate_key VARCHAR(8), 1230 PRIMARY KEY (id) 1231 )"; 1232 break; 1233 } 1234 1235 $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()); 1236 1237 1238 // Add some indexes 1239 switch ($db_type) 1240 { 1241 case 'mysql': 1242 case 'mysqli': 1243 // We use MySQL's ALTER TABLE ... ADD INDEX syntax instead of CREATE INDEX to avoid problems with users lacking the INDEX privilege 1244 $queries[] = 'ALTER TABLE '.$db_prefix.'online ADD INDEX '.$db_prefix.'online_user_id_idx(user_id)'; 1245 $queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_topic_id_idx(topic_id)'; 1246 $queries[] = 'ALTER TABLE '.$db_prefix.'posts ADD INDEX '.$db_prefix.'posts_multi_idx(poster_id, topic_id)'; 1247 $queries[] = 'ALTER TABLE '.$db_prefix.'reports ADD INDEX '.$db_prefix.'reports_zapped_idx(zapped)'; 1248 $queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_word_id_idx(word_id)'; 1249 $queries[] = 'ALTER TABLE '.$db_prefix.'search_matches ADD INDEX '.$db_prefix.'search_matches_post_id_idx(post_id)'; 1250 $queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_forum_id_idx(forum_id)'; 1251 $queries[] = 'ALTER TABLE '.$db_prefix.'topics ADD INDEX '.$db_prefix.'topics_moved_to_idx(moved_to)'; 1252 $queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_registered_idx(registered)'; 1253 $queries[] = 'ALTER TABLE '.$db_prefix.'search_cache ADD INDEX '.$db_prefix.'search_cache_ident_idx(ident(8))'; 1254 $queries[] = 'ALTER TABLE '.$db_prefix.'users ADD INDEX '.$db_prefix.'users_username_idx(username(8))'; 1255 break; 1256 1257 default: 1258 $queries[] = 'CREATE INDEX '.$db_prefix.'online_user_id_idx ON '.$db_prefix.'online(user_id)'; 1259 $queries[] = 'CREATE INDEX '.$db_prefix.'posts_topic_id_idx ON '.$db_prefix.'posts(topic_id)'; 1260 $queries[] = 'CREATE INDEX '.$db_prefix.'posts_multi_idx ON '.$db_prefix.'posts(poster_id, topic_id)'; 1261 $queries[] = 'CREATE INDEX '.$db_prefix.'reports_zapped_idx ON '.$db_prefix.'reports(zapped)'; 1262 $queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_word_id_idx ON '.$db_prefix.'search_matches(word_id)'; 1263 $queries[] = 'CREATE INDEX '.$db_prefix.'search_matches_post_id_idx ON '.$db_prefix.'search_matches(post_id)'; 1264 $queries[] = 'CREATE INDEX '.$db_prefix.'topics_forum_id_idx ON '.$db_prefix.'topics(forum_id)'; 1265 $queries[] = 'CREATE INDEX '.$db_prefix.'topics_moved_to_idx ON '.$db_prefix.'topics(moved_to)'; 1266 $queries[] = 'CREATE INDEX '.$db_prefix.'users_registered_idx ON '.$db_prefix.'users(registered)'; 1267 $queries[] = 'CREATE INDEX '.$db_prefix.'users_username_idx ON '.$db_prefix.'users(username)'; 1268 $queries[] = 'CREATE INDEX '.$db_prefix.'search_cache_ident_idx ON '.$db_prefix.'search_cache(ident)'; 1269 $queries[] = 'CREATE INDEX '.$db_prefix.'search_words_id_idx ON '.$db_prefix.'search_words(id)'; 1270 break; 1271 } 1272 1273 @reset($queries); 1274 while (list(, $sql) = @each($queries)) 1275 $db->query($sql) or error('Impossible de créer les index. Veuillez vérifier vos réglages et essayer à nouveau.', __FILE__, __LINE__, $db->error()); 1276 1234 $db->create_table('search_words', $schema) or error('Unable to create search_words table', __FILE__, __LINE__, $db->error()); 1235 1236 1237 $schema = array( 1238 'FIELDS' => array( 1239 'user_id' => array( 1240 'datatype' => 'INT(10) UNSIGNED', 1241 'allow_null' => false, 1242 'default' => '0' 1243 ), 1244 'topic_id' => array( 1245 'datatype' => 'INT(10) UNSIGNED', 1246 'allow_null' => false, 1247 'default' => '0' 1248 ) 1249 ), 1250 'PRIMARY KEY' => array('user_id', 'topic_id') 1251 ); 1252 1253 $db->create_table('topic_subscriptions', $schema) or error('Unable to create topic subscriptions table', __FILE__, __LINE__, $db->error()); 1254 1255 1256 $schema = array( 1257 'FIELDS' => array( 1258 'user_id' => array( 1259 'datatype' => 'INT(10) UNSIGNED', 1260 'allow_null' => false, 1261 'default' => '0' 1262 ), 1263 'forum_id' => array( 1264 'datatype' => 'INT(10) UNSIGNED', 1265 'allow_null' => false, 1266 'default' => '0' 1267 ) 1268 ), 1269 'PRIMARY KEY' => array('user_id', 'forum_id') 1270 ); 1271 1272 $db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error()); 1273 1274 1275 $schema = array( 1276 'FIELDS' => array( 1277 'id' => array( 1278 'datatype' => 'SERIAL', 1279 'allow_null' => false 1280 ), 1281 'poster' => array( 1282 'datatype' => 'VARCHAR(200)', 1283 'allow_null' => false, 1284 'default' => '\'\'' 1285 ), 1286 'subject' => array( 1287 'datatype' => 'VARCHAR(255)', 1288 'allow_null' => false, 1289 'default' => '\'\'' 1290 ), 1291 'posted' => array( 1292 'datatype' => 'INT(10) UNSIGNED', 1293 'allow_null' => false, 1294 'default' => '0' 1295 ), 1296 'first_post_id' => array( 1297 'datatype' => 'INT(10) UNSIGNED', 1298 'allow_null' => false, 1299 'default' => '0' 1300 ), 1301 'last_post' => array( 1302 'datatype' => 'INT(10) UNSIGNED', 1303 'allow_null' => false, 1304 'default' => '0' 1305 ), 1306 'last_post_id' => array( 1307 'datatype' => 'INT(10) UNSIGNED', 1308 'allow_null' => false, 1309 'default' => '0' 1310 ), 1311 'last_poster' => array( 1312 'datatype' => 'VARCHAR(200)', 1313 'allow_null' => true 1314 ), 1315 'num_views' => array( 1316 'datatype' => 'MEDIUMINT(8) UNSIGNED', 1317 'allow_null' => false, 1318 'default' => '0' 1319 ), 1320 'num_replies' => array( 1321 'datatype' => 'MEDIUMINT(8) UNSIGNED', 1322 'allow_null' => false, 1323 'default' => '0' 1324 ), 1325 'closed' => array( 1326 'datatype' => 'TINYINT(1)', 1327 'allow_null' => false, 1328 'default' => '0' 1329 ), 1330 'sticky' => array( 1331 'datatype' => 'TINYINT(1)', 1332 'allow_null' => false, 1333 'default' => '0' 1334 ), 1335 'moved_to' => array( 1336 'datatype' => 'INT(10) UNSIGNED', 1337 'allow_null' => true 1338 ), 1339 'forum_id' => array( 1340 'datatype' => 'INT(10) UNSIGNED', 1341 'allow_null' => false, 1342 'default' => '0' 1343 ) 1344 ), 1345 'PRIMARY KEY' => array('id'), 1346 'INDEXES' => array( 1347 'forum_id_idx' => array('forum_id'), 1348 'moved_to_idx' => array('moved_to'), 1349 'last_post_idx' => array('last_post'), 1350 'first_post_id_idx' => array('first_post_id') 1351 ) 1352 ); 1353 1354 $db->create_table('topics', $schema) or error('Unable to create topics table', __FILE__, __LINE__, $db->error()); 1355 1356 1357 $schema = array( 1358 'FIELDS' => array( 1359 'id' => array( 1360 'datatype' => 'SERIAL', 1361 'allow_null' => false 1362 ), 1363 'group_id' => array( 1364 'datatype' => 'INT(10) UNSIGNED', 1365 'allow_null' => false, 1366 'default' => '3' 1367 ), 1368 'username' => array( 1369 'datatype' => 'VARCHAR(200)', 1370 'allow_null' => false, 1371 'default' => '\'\'' 1372 ), 1373 'password' => array( 1374 'datatype' => 'VARCHAR(40)', 1375 'allow_null' => false, 1376 'default' => '\'\'' 1377 ), 1378 'email' => array( 1379 'datatype' => 'VARCHAR(80)', 1380 'allow_null' => false, 1381 'default' => '\'\'' 1382 ), 1383 'title' => array( 1384 'datatype' => 'VARCHAR(50)', 1385 'allow_null' => true 1386 ), 1387 'realname' => array( 1388 'datatype' => 'VARCHAR(40)', 1389 'allow_null' => true 1390 ), 1391 'url' => array( 1392 'datatype' => 'VARCHAR(100)', 1393 'allow_null' => true 1394 ), 1395 'jabber' => array( 1396 'datatype' => 'VARCHAR(80)', 1397 'allow_null' => true 1398 ), 1399 'icq' => array( 1400 'datatype' => 'VARCHAR(12)', 1401 'allow_null' => true 1402 ), 1403 'msn' => array( 1404 'datatype' => 'VARCHAR(80)', 1405 'allow_null' => true 1406 ), 1407 'aim' => array( 1408 'datatype' => 'VARCHAR(30)', 1409 'allow_null' => true 1410 ), 1411 'yahoo' => array( 1412 'datatype' => 'VARCHAR(30)', 1413 'allow_null' => true 1414 ), 1415 'location' => array( 1416 'datatype' => 'VARCHAR(30)', 1417 'allow_null' => true 1418 ), 1419 'signature' => array( 1420 'datatype' => 'TEXT', 1421 'allow_null' => true 1422 ), 1423 'disp_topics' => array( 1424 'datatype' => 'TINYINT(3) UNSIGNED', 1425 'allow_null' => true 1426 ), 1427 'disp_posts' => array( 1428 'datatype' => 'TINYINT(3) UNSIGNED', 1429 'allow_null' => true 1430 ), 1431 'email_setting' => array( 1432 'datatype' => 'TINYINT(1)', 1433 'allow_null' => false, 1434 'default' => '1' 1435 ), 1436 'notify_with_post' => array( 1437 'datatype' => 'TINYINT(1)', 1438 'allow_null' => false, 1439 'default' => '0' 1440 ), 1441 'auto_notify' => array( 1442 'datatype' => 'TINYINT(1)', 1443 'allow_null' => false, 1444 'default' => '0' 1445 ), 1446 'show_smilies' => array( 1447 'datatype' => 'TINYINT(1)', 1448 'allow_null' => false, 1449 'default' => '1' 1450 ), 1451 'show_img' => array( 1452 'datatype' => 'TINYINT(1)', 1453 'allow_null' => false, 1454 'default' => '1' 1455 ), 1456 'show_img_sig' => array( 1457 'datatype' => 'TINYINT(1)', 1458 'allow_null' => false, 1459 'default' => '1' 1460 ), 1461 'show_avatars' => array( 1462 'datatype' => 'TINYINT(1)', 1463 'allow_null' => false, 1464 'default' => '1' 1465 ), 1466 'show_sig' => array( 1467 'datatype' => 'TINYINT(1)', 1468 'allow_null' => false, 1469 'default' => '1' 1470 ), 1471 'timezone' => array( 1472 'datatype' => 'FLOAT', 1473 'allow_null' => false, 1474 'default' => '0' 1475 ), 1476 'dst' => array( 1477 'datatype' => 'TINYINT(1)', 1478 'allow_null' => false, 1479 'default' => '0' 1480 ), 1481 'time_format' => array( 1482 'datatype' => 'TINYINT(1)', 1483 'allow_null' => false, 1484 'default' => '0' 1485 ), 1486 'date_format' => array( 1487 'datatype' => 'TINYINT(1)', 1488 'allow_null' => false, 1489 'default' => '0' 1490 ), 1491 'language' => array( 1492 'datatype' => 'VARCHAR(25)', 1493 'allow_null' => false, 1494 'default' => '\''.$db->escape($default_lang).'\'' 1495 ), 1496 'style' => array( 1497 'datatype' => 'VARCHAR(25)', 1498 'allow_null' => false, 1499 'default' => '\''.$db->escape($default_style).'\'' 1500 ), 1501 'num_posts' => array( 1502 'datatype' => 'INT(10) UNSIGNED', 1503 'allow_null' => false, 1504 'default' => '0' 1505 ), 1506 'last_post' => array( 1507 'datatype' => 'INT(10) UNSIGNED', 1508 'allow_null' => true 1509 ), 1510 'last_search' => array( 1511 'datatype' => 'INT(10) UNSIGNED', 1512 'allow_null' => true 1513 ), 1514 'last_email_sent' => array( 1515 'datatype' => 'INT(10) UNSIGNED', 1516 'allow_null' => true 1517 ), 1518 'last_report_sent' => array( 1519 'datatype' => 'INT(10) UNSIGNED', 1520 'allow_null' => true 1521 ), 1522 'registered' => array( 1523 'datatype' => 'INT(10) UNSIGNED', 1524 'allow_null' => false, 1525 'default' => '0' 1526 ), 1527 'registration_ip' => array( 1528 'datatype' => 'VARCHAR(39)', 1529 'allow_null' => false, 1530 'default' => '\'0.0.0.0\'' 1531 ), 1532 'last_visit' => array( 1533 'datatype' => 'INT(10) UNSIGNED', 1534 'allow_null' => false, 1535 'default' => '0' 1536 ), 1537 'admin_note' => array( 1538 'datatype' => 'VARCHAR(30)', 1539 'allow_null' => true 1540 ), 1541 'activate_string' => array( 1542 'datatype' => 'VARCHAR(80)', 1543 'allow_null' => true 1544 ), 1545 'activate_key' => array( 1546 'datatype' => 'VARCHAR(8)', 1547 'allow_null' => true 1548 ), 1549 ), 1550 'PRIMARY KEY' => array('id'), 1551 'UNIQUE KEYS' => array( 1552 'username_idx' => array('username') 1553 ), 1554 'INDEXES' => array( 1555 'registered_idx' => array('registered') 1556 ) 1557 ); 1558 1559 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') 1560 $schema['UNIQUE KEYS']['username_idx'] = array('username(25)'); 1561 1562 $db->create_table('users', $schema) or error('Unable to create users table', __FILE__, __LINE__, $db->error()); 1563 1564 1565 $now = time(); 1277 1566 1278 1567 // Insert the four preset groups 1279 $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()); 1280 $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()); 1281 $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()); 1282 $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()); 1283 1568 $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()); 1569 1570 $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()); 1571 1572 $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()); 1573 1574 $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()); 1575 1576 // Insert guest and first admin user 1577 $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']).'\')') 1578 or error('Unable to add guest user. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1579 1580 $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.')') 1581 or error('Unable to add administrator user. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1582 1583 // Enable/disable avatars depending on file_uploads setting in PHP configuration 1584 $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0; 1284 1585 1285 1586 // Insert config data 1286 1587 $config = array( 1287 'o_cur_version' => "'$punbb_version'", 1288 'o_cur_version_fr' => "'$punbb_version_fr'", 1289 'o_board_title' => "'Mon forum PunBB'", 1290 'o_board_desc' => "'Malheureusement personne ne peut vous dire ce que PunBB est - vous devez le voir par vous-même.'", 1291 'o_server_timezone' => "'0'", 1588 'o_cur_version' => "'".FORUM_VERSION."'", 1589 'o_database_revision' => "'".FORUM_DB_REVISION."'", 1590 'o_searchindex_revision' => "'".FORUM_SI_REVISION."'", 1591 'o_parser_revision' => "'".FORUM_PARSER_REVISION."'", 1592 'o_board_title' => "'".$db->escape($title)."'", 1593 'o_board_desc' => "'".$db->escape($description)."'", 1594 'o_default_timezone' => "'0'", 1292 1595 'o_time_format' => "'H:i:s'", 1293 'o_date_format' => "' d-m-Y'",1294 'o_timeout_visit' => "' 600'",1596 'o_date_format' => "'Y-m-d'", 1597 'o_timeout_visit' => "'1800'", 1295 1598 'o_timeout_online' => "'300'", 1296 1599 'o_redirect_delay' => "'1'", … … 1298 1601 'o_show_user_info' => "'1'", 1299 1602 'o_show_post_count' => "'1'", 1603 'o_signatures' => "'1'", 1300 1604 'o_smilies' => "'1'", 1301 1605 'o_smilies_sig' => "'1'", 1302 1606 'o_make_links' => "'1'", 1303 'o_default_lang' => "' French'",1304 'o_default_style' => "' Oxygen'",1607 'o_default_lang' => "'".$db->escape($default_lang)."'", 1608 'o_default_style' => "'".$db->escape($default_style)."'", 1305 1609 'o_default_user_group' => "'4'", 1306 1610 'o_topic_review' => "'15'", … … 1308 1612 'o_disp_posts_default' => "'25'", 1309 1613 'o_indent_num_spaces' => "'4'", 1614 'o_quote_depth' => "'3'", 1310 1615 'o_quickpost' => "'1'", 1311 1616 'o_users_online' => "'1'", … … 1313 1618 'o_ranks' => "'1'", 1314 1619 'o_show_dot' => "'0'", 1620 'o_topic_views' => "'1'", 1315 1621 'o_quickjump' => "'1'", 1316 1622 'o_gzip' => "'0'", … … 1318 1624 'o_report_method' => "'0'", 1319 1625 'o_regs_report' => "'0'", 1320 'o_mailing_list' => "'$email'", 1321 'o_avatars' => "'1'", 1626 'o_default_email_setting' => "'1'", 1627 'o_mailing_list' => "'".$email."'", 1628 'o_avatars' => "'".$avatars."'", 1322 1629 'o_avatars_dir' => "'img/avatars'", 1323 1630 'o_avatars_width' => "'60'", … … 1325 1632 'o_avatars_size' => "'10240'", 1326 1633 'o_search_all_forums' => "'1'", 1327 'o_base_url' => "'$base_url'", 1328 'o_admin_email' => "'$email'", 1329 'o_webmaster_email' => "'$email'", 1330 'o_subscriptions' => "'1'", 1634 'o_base_url' => "'".$db->escape($base_url)."'", 1635 'o_admin_email' => "'".$email."'", 1636 'o_webmaster_email' => "'".$email."'", 1637 'o_forum_subscriptions' => "'1'", 1638 'o_topic_subscriptions' => "'1'", 1331 1639 'o_smtp_host' => "NULL", 1332 1640 'o_smtp_user' => "NULL", 1333 1641 'o_smtp_pass' => "NULL", 1642 'o_smtp_ssl' => "'0'", 1334 1643 'o_regs_allow' => "'1'", 1335 1644 'o_regs_verify' => "'0'", 1336 1645 'o_announcement' => "'0'", 1337 'o_announcement_message' => "' Saisissez votre annonce ici.'",1646 'o_announcement_message' => "'".$db->escape($lang_install['Announcement'])."'", 1338 1647 'o_rules' => "'0'", 1339 'o_rules_message' => "' Saisissez vos rÚgles ici.'",1648 'o_rules_message' => "'".$db->escape($lang_install['Rules'])."'", 1340 1649 'o_maintenance' => "'0'", 1341 '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'", 1342 'p_mod_edit_users' => "'1'", 1343 'p_mod_rename_users' => "'0'", 1344 'p_mod_change_passwords' => "'0'", 1345 'p_mod_ban_users' => "'0'", 1650 'o_maintenance_message' => "'".$db->escape($lang_install['Maintenance message'])."'", 1651 'o_default_dst' => "'0'", 1652 'o_feed_type' => "'2'", 1653 'o_feed_ttl' => "'0'", 1346 1654 'p_message_bbcode' => "'1'", 1347 1655 'p_message_img_tag' => "'1'", … … 1358 1666 ); 1359 1667 1360 while (list($conf_name, $conf_value) = @each($config))1668 foreach ($config as $conf_name => $conf_value) 1361 1669 { 1362 1670 $db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)") 1363 or error(' Impossible d\'insérer dans la table '.$db_prefix.'config. Veuillez vérifier votre configuration et essayez à nouveau.');1671 or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1364 1672 } 1365 1673 1366 1367 $now = time();1368 // Insert guest and first admin user1369 $db->query('INSERT INTO '.$db_prefix."users (group_id, username, password, email) VALUES(3, 'Invité', 'Invité', 'Invité')")1370 or error('Impossible d\'ajouter l\'utilisateur "invité".');1371 1372 $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.')')1373 or error('Impossible d\'ajouter le compte administrateur.');1374 1375 1674 // Insert some other default data 1376 $db->query('INSERT INTO '.$db_prefix."categories (cat_name, disp_position) VALUES('Catégorie test', 1)") 1377 or error('Impossible d\'insérer dans la table '.$db_prefix.'categories. Veuillez vérifier votre configuration et essayez à nouveau.'); 1378 1379 $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)") 1380 or error('Impossible d\'insérer dans la table '.$db_prefix.'forums. Veuillez vérifier votre configuration et essayez à nouveau.'); 1381 1382 $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)") 1383 or error('Impossible d\'insérer dans la table '.$db_prefix.'topics. Veuillez vérifier votre configuration et essayez à nouveau.'); 1384 1385 $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)') 1386 or error('Impossible d\'insérer dans la table '.$db_prefix.'posts. Veuillez vérifier votre configuration et essayez à nouveau.'); 1387 1388 $db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Nouveau membre', 0)") 1389 or error('Impossible d\'insérer dans la table '.$db_prefix.'ranks. Veuillez vérifier votre configuration et essayez à nouveau.'); 1390 1391 $db->query('INSERT INTO '.$db_prefix."ranks (rank, min_posts) VALUES('Membre', 10)") 1392 or error('Impossible d\'insérer dans la table '.$db_prefix.'ranks. Veuillez vérifier votre configuration et essayez à nouveau.'); 1393 1394 1395 if ($db_type == 'pgsql' || $db_type == 'sqlite') 1396 $db->end_transaction(); 1397 1398 1399 1400 $alerts = ''; 1401 // Check if the cache directory is writable 1402 if (!@is_writable('./cache/')) 1403 $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>'; 1404 1405 // Check if default avatar directory is writable 1406 if (!@is_writable('./img/avatars/')) 1407 $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>'; 1408 1409 1410 /// Display config.php and give further instructions 1411 $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);"; 1675 $subject = $lang_install['Test post']; 1676 $message = $lang_install['Message']; 1677 1678 $db->query('INSERT INTO '.$db_prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($lang_install['New member']).'\', 0)') 1679 or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1680 1681 $db->query('INSERT INTO '.$db_prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($lang_install['Member']).'\', 10)') 1682 or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1683 1684 $db->query('INSERT INTO '.$db_prefix.'categories (cat_name, disp_position) VALUES(\''.$db->escape($lang_install['Test category']).'\', 1)') 1685 or error('Unable to insert into table '.$db_prefix.'categories. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1686 1687 $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)') 1688 or error('Unable to insert into table '.$db_prefix.'forums. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1689 1690 $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)') 1691 or error('Unable to insert into table '.$db_prefix.'topics. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1692 1693 $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)') 1694 or error('Unable to insert into table '.$db_prefix.'posts. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); 1695 1696 // Index the test post so searching for it works 1697 require PUN_ROOT.'include/search_idx.php'; 1698 $pun_config['o_default_lang'] = $default_lang; 1699 update_search_index('post', 1, $message, $subject); 1700 1701 $db->end_transaction(); 1702 1703 1704 $alerts = array(); 1705 1706 // Check if we disabled uploading avatars because file_uploads was disabled 1707 if ($avatars == '0') 1708 $alerts[] = $lang_install['Alert upload']; 1709 1710 // Add some random bytes at the end of the cookie name to prevent collisions 1711 $cookie_name = 'pun_cookie_'.random_key(6, false, true); 1712 1713 // Generate the config.php file data 1714 $config = generate_config_file(); 1715 1716 // Attempt to write config.php and serve it up for download if writing fails 1717 $written = false; 1718 if (is_writable(PUN_ROOT)) 1719 { 1720 $fh = @fopen(PUN_ROOT.'config.php', 'wb'); 1721 if ($fh) 1722 { 1723 fwrite($fh, $config); 1724 fclose($fh); 1725 1726 $written = true; 1727 } 1728 } 1412 1729 1413 1730 … … 1417 1734 <html> 1418 1735 <head> 1419 <meta http-equiv="Content-Type" content="text/html; charset= iso-8859-1" />1420 <title> Installation de PunBB</title>1421 <link rel="stylesheet" type="text/css" href="style/ Oxygen.css" />1736 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 1737 <title><?php echo $lang_install['FluxBB Installation'] ?></title> 1738 <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" /> 1422 1739 </head> 1423 1740 <body> 1424 1741 1425 <div id="puninstall" style="margin: auto 10% auto 10%"> 1426 <div class="pun"> 1742 <div id="puninstall" class="pun"> 1743 <div class="top-box"><div><!-- Top Corners --></div></div> 1744 <div class="punwrap"> 1745 1746 <div id="brdheader" class="block"> 1747 <div class="box"> 1748 <div id="brdtitle" class="inbox"> 1749 <h1><span><?php echo $lang_install['FluxBB Installation'] ?></span></h1> 1750 <div id="brddesc"><p><?php echo $lang_install['FluxBB has been installed'] ?></p></div> 1751 </div> 1752 </div> 1753 </div> 1754 1755 <div id="brdmain"> 1427 1756 1428 1757 <div class="blockform"> 1429 <h2> Instructions finales</h2>1758 <h2><span><?php echo $lang_install['Final instructions'] ?></span></h2> 1430 1759 <div class="box"> 1760 <?php 1761 1762 if (!$written) 1763 { 1764 1765 ?> 1766 <form method="post" action="install.php"> 1767 <div class="inform"> 1768 <div class="forminfo"> 1769 <p><?php echo $lang_install['Info 17'] ?></p> 1770 <p><?php echo $lang_install['Info 18'] ?></p> 1771 </div> 1772 <input type="hidden" name="generate_config" value="1" /> 1773 <input type="hidden" name="db_type" value="<?php echo $db_type; ?>" /> 1774 <input type="hidden" name="db_host" value="<?php echo $db_host; ?>" /> 1775 <input type="hidden" name="db_name" value="<?php echo pun_htmlspecialchars($db_name); ?>" /> 1776 <input type="hidden" name="db_username" value="<?php echo pun_htmlspecialchars($db_username); ?>" /> 1777 <input type="hidden" name="db_password" value="<?php echo pun_htmlspecialchars($db_password); ?>" /> 1778 <input type="hidden" name="db_prefix" value="<?php echo pun_htmlspecialchars($db_prefix); ?>" /> 1779 <input type="hidden" name="cookie_name" value="<?php echo pun_htmlspecialchars($cookie_name); ?>" /> 1780 <input type="hidden" name="cookie_seed" value="<?php echo pun_htmlspecialchars($cookie_seed); ?>" /> 1781 1782 <?php if (!empty($alerts)): ?> <div class="forminfo error-info"> 1783 <ul class="error-list"> 1784 <?php 1785 1786 foreach ($alerts as $cur_alert) 1787 echo "\t\t\t\t\t".'<li>'.$cur_alert.'</li>'."\n"; 1788 ?> 1789 </ul> 1790 </div> 1791 <?php endif; ?> </div> 1792 <p class="buttons"><input type="submit" value="<?php echo $lang_install['Download config.php file'] ?>" /></p> 1793 </form> 1794 1795 <?php 1796 1797 } 1798 else 1799 { 1800 1801 ?> 1431 1802 <div class="fakeform"> 1432 1803 <div class="inform"> 1433 1804 <div class="forminfo"> 1434 <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 <?php et aprÚs ?> 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> 1435 <?php if ($alerts != ''): ?> <?php echo $alerts."\n" ?> 1436 <?php endif; ?> </div> 1437 <fieldset> 1438 <legend>Copiez ce contenu dans config.php</legend> 1439 <div class="infldset"> 1440 <textarea cols="80" rows="20"><?php echo htmlspecialchars($config) ?></textarea> 1441 </div> 1442 </fieldset> 1443 </div> 1444 <div class="inform"> 1445 <div class="forminfo"> 1446 <p>Une fois que vous aurez créé config.php avec le contenu ci-dessus, PunBB sera installé !</p> 1447 <p><a href="index.php">Aller à l'index des forums</a></p> 1805 <p><?php echo $lang_install['FluxBB fully installed'] ?></p> 1448 1806 </div> 1449 1807 </div> 1450 1808 </div> 1809 <?php 1810 1811 } 1812 1813 ?> 1451 1814 </div> 1452 1815 </div> 1453 1816 1454 1817 </div> 1818 1819 </div> 1820 <div class="end-box"><div><!-- Bottom Corners --></div></div> 1455 1821 </div> 1456 1822
Note: See TracChangeset
for help on using the changeset viewer.