[1] | 1 | <?php |
---|
| 2 | |
---|
[3] | 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 | */ |
---|
[1] | 8 | |
---|
[3] | 9 | // The FluxBB version this script installs |
---|
| 10 | define('FORUM_VERSION', '1.4.7'); |
---|
[1] | 11 | |
---|
[3] | 12 | define('FORUM_DB_REVISION', 15); |
---|
| 13 | define('FORUM_SI_REVISION', 2); |
---|
| 14 | define('FORUM_PARSER_REVISION', 2); |
---|
[1] | 15 | |
---|
[3] | 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); |
---|
[1] | 21 | |
---|
| 22 | |
---|
[3] | 23 | define('PUN_ROOT', dirname(__FILE__).'/'); |
---|
[1] | 24 | |
---|
[3] | 25 | // Load the functions script |
---|
| 26 | require PUN_ROOT.'include/functions.php'; |
---|
[1] | 27 | |
---|
[3] | 28 | // Load UTF-8 functions |
---|
| 29 | require PUN_ROOT.'include/utf8/utf8.php'; |
---|
[1] | 30 | |
---|
[3] | 31 | // Strip out "bad" UTF-8 characters |
---|
| 32 | forum_remove_bad_characters(); |
---|
[1] | 33 | |
---|
[3] | 34 | // Reverse the effect of register_globals |
---|
| 35 | forum_unregister_globals(); |
---|
[1] | 36 | |
---|
| 37 | // Disable error reporting for uninitialized variables |
---|
| 38 | error_reporting(E_ALL); |
---|
| 39 | |
---|
[3] | 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 | |
---|
[1] | 61 | // Turn off PHP time limit |
---|
| 62 | @set_time_limit(0); |
---|
| 63 | |
---|
| 64 | |
---|
[3] | 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 | |
---|
[1] | 130 | if (!isset($_POST['form_sent'])) |
---|
| 131 | { |
---|
[3] | 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)) |
---|
| 216 | { |
---|
[1] | 217 | // Determine available database extensions |
---|
| 218 | $dual_mysql = false; |
---|
| 219 | $db_extensions = array(); |
---|
[3] | 220 | $mysql_innodb = false; |
---|
[1] | 221 | if (function_exists('mysqli_connect')) |
---|
[3] | 222 | { |
---|
| 223 | $db_extensions[] = array('mysqli', 'MySQL Improved'); |
---|
| 224 | $db_extensions[] = array('mysqli_innodb', 'MySQL Improved (InnoDB)'); |
---|
| 225 | $mysql_innodb = true; |
---|
| 226 | } |
---|
[1] | 227 | if (function_exists('mysql_connect')) |
---|
| 228 | { |
---|
| 229 | $db_extensions[] = array('mysql', 'MySQL Standard'); |
---|
[3] | 230 | $db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)'); |
---|
| 231 | $mysql_innodb = true; |
---|
[1] | 232 | |
---|
[3] | 233 | if (count($db_extensions) > 2) |
---|
[1] | 234 | $dual_mysql = true; |
---|
| 235 | } |
---|
| 236 | if (function_exists('sqlite_open')) |
---|
| 237 | $db_extensions[] = array('sqlite', 'SQLite'); |
---|
| 238 | if (function_exists('pg_connect')) |
---|
| 239 | $db_extensions[] = array('pgsql', 'PostgreSQL'); |
---|
| 240 | |
---|
| 241 | if (empty($db_extensions)) |
---|
[3] | 242 | error($lang_install['No DB extensions']); |
---|
[1] | 243 | |
---|
[3] | 244 | // Fetch a list of installed languages |
---|
| 245 | $languages = forum_list_langs(); |
---|
| 246 | |
---|
[1] | 247 | ?> |
---|
| 248 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
[3] | 249 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
---|
[1] | 250 | <head> |
---|
[3] | 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" /> |
---|
[1] | 254 | <script type="text/javascript"> |
---|
[3] | 255 | /* <![CDATA[ */ |
---|
[1] | 256 | function process_form(the_form) |
---|
| 257 | { |
---|
[3] | 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 | }; |
---|
[1] | 270 | if (document.all || document.getElementById) |
---|
| 271 | { |
---|
[3] | 272 | for (var i = 0; i < the_form.length; ++i) |
---|
[1] | 273 | { |
---|
[3] | 274 | var elem = the_form.elements[i]; |
---|
| 275 | if (elem.name && (/^req_/.test(elem.name))) |
---|
[1] | 276 | { |
---|
[3] | 277 | if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type))) |
---|
[1] | 278 | { |
---|
[3] | 279 | alert('"' + element_names[elem.name] + '" <?php echo $lang_install['Required field'] ?>'); |
---|
| 280 | elem.focus(); |
---|
| 281 | return false; |
---|
[1] | 282 | } |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | } |
---|
[3] | 286 | return true; |
---|
[1] | 287 | } |
---|
[3] | 288 | /* ]]> */ |
---|
[1] | 289 | </script> |
---|
| 290 | </head> |
---|
[3] | 291 | <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;" onunload=""> |
---|
[1] | 292 | |
---|
[3] | 293 | <div id="puninstall" class="pun"> |
---|
| 294 | <div class="top-box"><div><!-- Top Corners --></div></div> |
---|
| 295 | <div class="punwrap"> |
---|
[1] | 296 | |
---|
[3] | 297 | <div id="brdheader" class="block"> |
---|
[1] | 298 | <div class="box"> |
---|
[3] | 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> |
---|
[1] | 302 | </div> |
---|
| 303 | </div> |
---|
| 304 | </div> |
---|
| 305 | |
---|
[3] | 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 | |
---|
[1] | 340 | <div class="blockform"> |
---|
[3] | 341 | <h2><span><?php echo $lang_install['Install'] ?></span></h2> |
---|
[1] | 342 | <div class="box"> |
---|
| 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;}"> |
---|
[3] | 344 | <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div> |
---|
[1] | 345 | <div class="inform"> |
---|
[3] | 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> |
---|
| 357 | <div class="inform"> |
---|
[1] | 358 | <div class="forminfo"> |
---|
[3] | 359 | <h3><?php echo $lang_install['Database setup'] ?></h3> |
---|
| 360 | <p><?php echo $lang_install['Info 1'] ?></p> |
---|
[1] | 361 | </div> |
---|
| 362 | <fieldset> |
---|
[3] | 363 | <legend><?php echo $lang_install['Select database'] ?></legend> |
---|
[1] | 364 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 369 | <br /><select name="req_db_type"> |
---|
| 370 | <?php |
---|
| 371 | |
---|
[3] | 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 | } |
---|
[1] | 379 | |
---|
| 380 | ?> |
---|
| 381 | </select> |
---|
| 382 | <br /></label> |
---|
| 383 | </div> |
---|
| 384 | </fieldset> |
---|
| 385 | </div> |
---|
| 386 | <div class="inform"> |
---|
| 387 | <fieldset> |
---|
[3] | 388 | <legend><?php echo $lang_install['Database hostname'] ?></legend> |
---|
[1] | 389 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 392 | </div> |
---|
| 393 | </fieldset> |
---|
| 394 | </div> |
---|
| 395 | <div class="inform"> |
---|
| 396 | <fieldset> |
---|
[3] | 397 | <legend><?php echo $lang_install['Database enter name'] ?></legend> |
---|
[1] | 398 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 401 | </div> |
---|
| 402 | </fieldset> |
---|
| 403 | </div> |
---|
| 404 | <div class="inform"> |
---|
| 405 | <fieldset> |
---|
[3] | 406 | <legend><?php echo $lang_install['Database enter informations'] ?></legend> |
---|
[1] | 407 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 411 | <div class="clearer"></div> |
---|
| 412 | </div> |
---|
| 413 | </fieldset> |
---|
| 414 | </div> |
---|
| 415 | <div class="inform"> |
---|
| 416 | <fieldset> |
---|
[3] | 417 | <legend><?php echo $lang_install['Database enter prefix'] ?></legend> |
---|
[1] | 418 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 421 | </div> |
---|
| 422 | </fieldset> |
---|
| 423 | </div> |
---|
| 424 | <div class="inform"> |
---|
| 425 | <div class="forminfo"> |
---|
[3] | 426 | <h3><?php echo $lang_install['Administration setup'] ?></h3> |
---|
| 427 | <p><?php echo $lang_install['Info 7'] ?></p> |
---|
[1] | 428 | </div> |
---|
| 429 | <fieldset> |
---|
[3] | 430 | <legend><?php echo $lang_install['Admin enter username'] ?></legend> |
---|
[1] | 431 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 434 | </div> |
---|
| 435 | </fieldset> |
---|
| 436 | </div> |
---|
| 437 | <div class="inform"> |
---|
| 438 | <fieldset> |
---|
[3] | 439 | <legend><?php echo $lang_install['Admin enter password'] ?></legend> |
---|
[1] | 440 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 444 | <div class="clearer"></div> |
---|
| 445 | </div> |
---|
| 446 | </fieldset> |
---|
| 447 | </div> |
---|
| 448 | <div class="inform"> |
---|
| 449 | <fieldset> |
---|
[3] | 450 | <legend><?php echo $lang_install['Admin enter email'] ?></legend> |
---|
[1] | 451 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 454 | </div> |
---|
| 455 | </fieldset> |
---|
| 456 | </div> |
---|
| 457 | <div class="inform"> |
---|
[3] | 458 | <div class="forminfo"> |
---|
| 459 | <h3><?php echo $lang_install['Board setup'] ?></h3> |
---|
| 460 | <p><?php echo $lang_install['Info 11'] ?></p> |
---|
| 461 | </div> |
---|
[1] | 462 | <fieldset> |
---|
[3] | 463 | <legend><?php echo $lang_install['Enter board title'] ?></legend> |
---|
[1] | 464 | <div class="infldset"> |
---|
[3] | 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> |
---|
[1] | 467 | </div> |
---|
| 468 | </fieldset> |
---|
| 469 | </div> |
---|
[3] | 470 | <div class="inform"> |
---|
| 471 | <fieldset> |
---|
| 472 | <legend><?php echo $lang_install['Enter board description'] ?></legend> |
---|
| 473 | <div class="infldset"> |
---|
| 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> |
---|
| 476 | </div> |
---|
| 477 | </fieldset> |
---|
| 478 | </div> |
---|
| 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> |
---|
[1] | 533 | </form> |
---|
| 534 | </div> |
---|
| 535 | </div> |
---|
[3] | 536 | </div> |
---|
[1] | 537 | |
---|
| 538 | </div> |
---|
[3] | 539 | <div class="end-box"><div><!-- Bottom Corners --></div></div> |
---|
[1] | 540 | </div> |
---|
| 541 | |
---|
| 542 | </body> |
---|
| 543 | </html> |
---|
| 544 | <?php |
---|
| 545 | |
---|
| 546 | } |
---|
| 547 | else |
---|
| 548 | { |
---|
| 549 | // Load the appropriate DB layer class |
---|
| 550 | switch ($db_type) |
---|
| 551 | { |
---|
| 552 | case 'mysql': |
---|
| 553 | require PUN_ROOT.'include/dblayer/mysql.php'; |
---|
| 554 | break; |
---|
| 555 | |
---|
[3] | 556 | case 'mysql_innodb': |
---|
| 557 | require PUN_ROOT.'include/dblayer/mysql_innodb.php'; |
---|
| 558 | break; |
---|
| 559 | |
---|
[1] | 560 | case 'mysqli': |
---|
| 561 | require PUN_ROOT.'include/dblayer/mysqli.php'; |
---|
| 562 | break; |
---|
| 563 | |
---|
[3] | 564 | case 'mysqli_innodb': |
---|
| 565 | require PUN_ROOT.'include/dblayer/mysqli_innodb.php'; |
---|
| 566 | break; |
---|
| 567 | |
---|
[1] | 568 | case 'pgsql': |
---|
| 569 | require PUN_ROOT.'include/dblayer/pgsql.php'; |
---|
| 570 | break; |
---|
| 571 | |
---|
| 572 | case 'sqlite': |
---|
| 573 | require PUN_ROOT.'include/dblayer/sqlite.php'; |
---|
| 574 | break; |
---|
[3] | 575 | |
---|
[1] | 576 | default: |
---|
[3] | 577 | error(sprintf($lang_install['DB type not valid'], pun_htmlspecialchars($db_type))); |
---|
[1] | 578 | } |
---|
| 579 | |
---|
| 580 | // Create the database object (and connect/select db) |
---|
| 581 | $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false); |
---|
| 582 | |
---|
[3] | 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)); |
---|
[1] | 586 | |
---|
| 587 | // Do some DB type specific checks |
---|
| 588 | switch ($db_type) |
---|
| 589 | { |
---|
| 590 | case 'mysql': |
---|
| 591 | case 'mysqli': |
---|
[3] | 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)); |
---|
[1] | 597 | break; |
---|
| 598 | |
---|
| 599 | case 'pgsql': |
---|
[3] | 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)); |
---|
[1] | 603 | break; |
---|
| 604 | |
---|
| 605 | case 'sqlite': |
---|
| 606 | if (strtolower($db_prefix) == 'sqlite_') |
---|
[3] | 607 | error($lang_install['Prefix reserved']); |
---|
[1] | 608 | break; |
---|
| 609 | } |
---|
| 610 | |
---|
| 611 | |
---|
[3] | 612 | // Make sure FluxBB isn't already installed |
---|
[1] | 613 | $result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1'); |
---|
| 614 | if ($db->num_rows($result)) |
---|
[3] | 615 | error(sprintf($lang_install['Existing table error'], $db_prefix, $db_name)); |
---|
[1] | 616 | |
---|
[3] | 617 | // Check if InnoDB is available |
---|
| 618 | if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
---|
[1] | 619 | { |
---|
[3] | 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']); |
---|
[1] | 624 | } |
---|
| 625 | |
---|
| 626 | |
---|
[3] | 627 | // Start a transaction |
---|
| 628 | $db->start_transaction(); |
---|
[1] | 629 | |
---|
| 630 | |
---|
[3] | 631 | // Create all tables |
---|
| 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 | ); |
---|
[1] | 669 | |
---|
[3] | 670 | if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
---|
| 671 | $schema['INDEXES']['username_idx'] = array('username(25)'); |
---|
[1] | 672 | |
---|
[3] | 673 | $db->create_table('bans', $schema) or error('Unable to create bans table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 674 | |
---|
| 675 | |
---|
[3] | 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 | ); |
---|
[1] | 695 | |
---|
[3] | 696 | $db->create_table('categories', $schema) or error('Unable to create categories table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 697 | |
---|
| 698 | |
---|
[3] | 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 | ); |
---|
[1] | 718 | |
---|
[3] | 719 | $db->create_table('censoring', $schema) or error('Unable to create censoring table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 720 | |
---|
| 721 | |
---|
[3] | 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 | ); |
---|
[1] | 736 | |
---|
[3] | 737 | $db->create_table('config', $schema) or error('Unable to create config table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 738 | |
---|
| 739 | |
---|
[3] | 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 | ); |
---|
[1] | 770 | |
---|
[3] | 771 | $db->create_table('forum_perms', $schema) or error('Unable to create forum_perms table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 772 | |
---|
| 773 | |
---|
[3] | 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 | ); |
---|
[1] | 837 | |
---|
[3] | 838 | $db->create_table('forums', $schema) or error('Unable to create forums table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 839 | |
---|
| 840 | |
---|
[3] | 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 | ); |
---|
[1] | 959 | |
---|
[3] | 960 | $db->create_table('groups', $schema) or error('Unable to create groups table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 961 | |
---|
| 962 | |
---|
[3] | 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 | ); |
---|
[1] | 1002 | |
---|
[3] | 1003 | if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
---|
[1] | 1004 | { |
---|
[3] | 1005 | $schema['UNIQUE KEYS']['user_id_ident_idx'] = array('user_id', 'ident(25)'); |
---|
| 1006 | $schema['INDEXES']['ident_idx'] = array('ident(25)'); |
---|
[1] | 1007 | } |
---|
| 1008 | |
---|
[3] | 1009 | if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
---|
| 1010 | $schema['ENGINE'] = 'InnoDB'; |
---|
[1] | 1011 | |
---|
[3] | 1012 | $db->create_table('online', $schema) or error('Unable to create online table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1013 | |
---|
| 1014 | |
---|
[3] | 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 | ); |
---|
[1] | 1073 | |
---|
[3] | 1074 | $db->create_table('posts', $schema) or error('Unable to create posts table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1075 | |
---|
| 1076 | |
---|
[3] | 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 | ); |
---|
[1] | 1096 | |
---|
[3] | 1097 | $db->create_table('ranks', $schema) or error('Unable to create ranks table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1098 | |
---|
| 1099 | |
---|
[3] | 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 | ); |
---|
[1] | 1149 | |
---|
[3] | 1150 | $db->create_table('reports', $schema) or error('Unable to create reports table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1151 | |
---|
| 1152 | |
---|
[3] | 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 | ); |
---|
[1] | 1175 | |
---|
[3] | 1176 | if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb') |
---|
| 1177 | $schema['INDEXES']['ident_idx'] = array('ident(8)'); |
---|
[1] | 1178 | |
---|
[3] | 1179 | $db->create_table('search_cache', $schema) or error('Unable to create search_cache table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1180 | |
---|
| 1181 | |
---|
[3] | 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 | ); |
---|
[1] | 1205 | |
---|
[3] | 1206 | $db->create_table('search_matches', $schema) or error('Unable to create search_matches table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1207 | |
---|
| 1208 | |
---|
[3] | 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 | ); |
---|
[1] | 1227 | |
---|
[3] | 1228 | if ($db_type == 'sqlite') |
---|
[1] | 1229 | { |
---|
[3] | 1230 | $schema['PRIMARY KEY'] = array('id'); |
---|
| 1231 | $schema['UNIQUE KEYS'] = array('word_idx' => array('word')); |
---|
[1] | 1232 | } |
---|
| 1233 | |
---|
[3] | 1234 | $db->create_table('search_words', $schema) or error('Unable to create search_words table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1235 | |
---|
| 1236 | |
---|
[3] | 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 | ); |
---|
[1] | 1252 | |
---|
[3] | 1253 | $db->create_table('topic_subscriptions', $schema) or error('Unable to create topic subscriptions table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1254 | |
---|
| 1255 | |
---|
[3] | 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 | ); |
---|
[1] | 1271 | |
---|
[3] | 1272 | $db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1273 | |
---|
| 1274 | |
---|
[3] | 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 | ); |
---|
[1] | 1353 | |
---|
[3] | 1354 | $db->create_table('topics', $schema) or error('Unable to create topics table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1355 | |
---|
| 1356 | |
---|
[3] | 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 | ); |
---|
[1] | 1558 | |
---|
[3] | 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)'); |
---|
[1] | 1561 | |
---|
[3] | 1562 | $db->create_table('users', $schema) or error('Unable to create users table', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1563 | |
---|
| 1564 | |
---|
[3] | 1565 | $now = time(); |
---|
[1] | 1566 | |
---|
[3] | 1567 | // Insert the four preset groups |
---|
| 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()); |
---|
[1] | 1569 | |
---|
[3] | 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()); |
---|
[1] | 1571 | |
---|
[3] | 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()); |
---|
[1] | 1573 | |
---|
[3] | 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()); |
---|
[1] | 1575 | |
---|
[3] | 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()); |
---|
[1] | 1579 | |
---|
[3] | 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()); |
---|
[1] | 1582 | |
---|
[3] | 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; |
---|
[1] | 1585 | |
---|
| 1586 | // Insert config data |
---|
| 1587 | $config = array( |
---|
[3] | 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'", |
---|
[1] | 1595 | 'o_time_format' => "'H:i:s'", |
---|
[3] | 1596 | 'o_date_format' => "'Y-m-d'", |
---|
| 1597 | 'o_timeout_visit' => "'1800'", |
---|
[1] | 1598 | 'o_timeout_online' => "'300'", |
---|
| 1599 | 'o_redirect_delay' => "'1'", |
---|
| 1600 | 'o_show_version' => "'0'", |
---|
| 1601 | 'o_show_user_info' => "'1'", |
---|
| 1602 | 'o_show_post_count' => "'1'", |
---|
[3] | 1603 | 'o_signatures' => "'1'", |
---|
[1] | 1604 | 'o_smilies' => "'1'", |
---|
| 1605 | 'o_smilies_sig' => "'1'", |
---|
| 1606 | 'o_make_links' => "'1'", |
---|
[3] | 1607 | 'o_default_lang' => "'".$db->escape($default_lang)."'", |
---|
| 1608 | 'o_default_style' => "'".$db->escape($default_style)."'", |
---|
[1] | 1609 | 'o_default_user_group' => "'4'", |
---|
| 1610 | 'o_topic_review' => "'15'", |
---|
| 1611 | 'o_disp_topics_default' => "'30'", |
---|
| 1612 | 'o_disp_posts_default' => "'25'", |
---|
| 1613 | 'o_indent_num_spaces' => "'4'", |
---|
[3] | 1614 | 'o_quote_depth' => "'3'", |
---|
[1] | 1615 | 'o_quickpost' => "'1'", |
---|
| 1616 | 'o_users_online' => "'1'", |
---|
| 1617 | 'o_censoring' => "'0'", |
---|
| 1618 | 'o_ranks' => "'1'", |
---|
| 1619 | 'o_show_dot' => "'0'", |
---|
[3] | 1620 | 'o_topic_views' => "'1'", |
---|
[1] | 1621 | 'o_quickjump' => "'1'", |
---|
| 1622 | 'o_gzip' => "'0'", |
---|
| 1623 | 'o_additional_navlinks' => "''", |
---|
| 1624 | 'o_report_method' => "'0'", |
---|
| 1625 | 'o_regs_report' => "'0'", |
---|
[3] | 1626 | 'o_default_email_setting' => "'1'", |
---|
| 1627 | 'o_mailing_list' => "'".$email."'", |
---|
| 1628 | 'o_avatars' => "'".$avatars."'", |
---|
[1] | 1629 | 'o_avatars_dir' => "'img/avatars'", |
---|
| 1630 | 'o_avatars_width' => "'60'", |
---|
| 1631 | 'o_avatars_height' => "'60'", |
---|
| 1632 | 'o_avatars_size' => "'10240'", |
---|
| 1633 | 'o_search_all_forums' => "'1'", |
---|
[3] | 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'", |
---|
[1] | 1639 | 'o_smtp_host' => "NULL", |
---|
| 1640 | 'o_smtp_user' => "NULL", |
---|
| 1641 | 'o_smtp_pass' => "NULL", |
---|
[3] | 1642 | 'o_smtp_ssl' => "'0'", |
---|
[1] | 1643 | 'o_regs_allow' => "'1'", |
---|
| 1644 | 'o_regs_verify' => "'0'", |
---|
| 1645 | 'o_announcement' => "'0'", |
---|
[3] | 1646 | 'o_announcement_message' => "'".$db->escape($lang_install['Announcement'])."'", |
---|
[1] | 1647 | 'o_rules' => "'0'", |
---|
[3] | 1648 | 'o_rules_message' => "'".$db->escape($lang_install['Rules'])."'", |
---|
[1] | 1649 | 'o_maintenance' => "'0'", |
---|
[3] | 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'", |
---|
[1] | 1654 | 'p_message_bbcode' => "'1'", |
---|
| 1655 | 'p_message_img_tag' => "'1'", |
---|
| 1656 | 'p_message_all_caps' => "'1'", |
---|
| 1657 | 'p_subject_all_caps' => "'1'", |
---|
| 1658 | 'p_sig_all_caps' => "'1'", |
---|
| 1659 | 'p_sig_bbcode' => "'1'", |
---|
| 1660 | 'p_sig_img_tag' => "'0'", |
---|
| 1661 | 'p_sig_length' => "'400'", |
---|
| 1662 | 'p_sig_lines' => "'4'", |
---|
| 1663 | 'p_allow_banned_email' => "'1'", |
---|
| 1664 | 'p_allow_dupe_email' => "'0'", |
---|
| 1665 | 'p_force_guest_email' => "'1'" |
---|
| 1666 | ); |
---|
| 1667 | |
---|
[3] | 1668 | foreach ($config as $conf_name => $conf_value) |
---|
[1] | 1669 | { |
---|
| 1670 | $db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)") |
---|
[3] | 1671 | or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again', __FILE__, __LINE__, $db->error()); |
---|
[1] | 1672 | } |
---|
| 1673 | |
---|
[3] | 1674 | // Insert some other default data |
---|
| 1675 | $subject = $lang_install['Test post']; |
---|
| 1676 | $message = $lang_install['Message']; |
---|
[1] | 1677 | |
---|
[3] | 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()); |
---|
[1] | 1680 | |
---|
[3] | 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()); |
---|
[1] | 1683 | |
---|
[3] | 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()); |
---|
[1] | 1686 | |
---|
[3] | 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()); |
---|
[1] | 1689 | |
---|
[3] | 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()); |
---|
[1] | 1692 | |
---|
[3] | 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()); |
---|
[1] | 1695 | |
---|
[3] | 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); |
---|
[1] | 1700 | |
---|
[3] | 1701 | $db->end_transaction(); |
---|
[1] | 1702 | |
---|
| 1703 | |
---|
[3] | 1704 | $alerts = array(); |
---|
[1] | 1705 | |
---|
[3] | 1706 | // Check if we disabled uploading avatars because file_uploads was disabled |
---|
| 1707 | if ($avatars == '0') |
---|
| 1708 | $alerts[] = $lang_install['Alert upload']; |
---|
[1] | 1709 | |
---|
[3] | 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); |
---|
[1] | 1712 | |
---|
[3] | 1713 | // Generate the config.php file data |
---|
| 1714 | $config = generate_config_file(); |
---|
[1] | 1715 | |
---|
[3] | 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); |
---|
[1] | 1725 | |
---|
[3] | 1726 | $written = true; |
---|
| 1727 | } |
---|
| 1728 | } |
---|
[1] | 1729 | |
---|
| 1730 | |
---|
| 1731 | ?> |
---|
| 1732 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
| 1733 | |
---|
| 1734 | <html> |
---|
| 1735 | <head> |
---|
[3] | 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" /> |
---|
[1] | 1739 | </head> |
---|
| 1740 | <body> |
---|
| 1741 | |
---|
[3] | 1742 | <div id="puninstall" class="pun"> |
---|
| 1743 | <div class="top-box"><div><!-- Top Corners --></div></div> |
---|
| 1744 | <div class="punwrap"> |
---|
[1] | 1745 | |
---|
[3] | 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"> |
---|
| 1756 | |
---|
[1] | 1757 | <div class="blockform"> |
---|
[3] | 1758 | <h2><span><?php echo $lang_install['Final instructions'] ?></span></h2> |
---|
[1] | 1759 | <div class="box"> |
---|
[3] | 1760 | <?php |
---|
| 1761 | |
---|
| 1762 | if (!$written) |
---|
| 1763 | { |
---|
| 1764 | |
---|
| 1765 | ?> |
---|
| 1766 | <form method="post" action="install.php"> |
---|
[1] | 1767 | <div class="inform"> |
---|
| 1768 | <div class="forminfo"> |
---|
[3] | 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 | ?> |
---|
| 1802 | <div class="fakeform"> |
---|
[1] | 1803 | <div class="inform"> |
---|
| 1804 | <div class="forminfo"> |
---|
[3] | 1805 | <p><?php echo $lang_install['FluxBB fully installed'] ?></p> |
---|
[1] | 1806 | </div> |
---|
| 1807 | </div> |
---|
| 1808 | </div> |
---|
[3] | 1809 | <?php |
---|
| 1810 | |
---|
| 1811 | } |
---|
| 1812 | |
---|
| 1813 | ?> |
---|
[1] | 1814 | </div> |
---|
| 1815 | </div> |
---|
| 1816 | |
---|
| 1817 | </div> |
---|
[3] | 1818 | |
---|
[1] | 1819 | </div> |
---|
[3] | 1820 | <div class="end-box"><div><!-- Bottom Corners --></div></div> |
---|
| 1821 | </div> |
---|
[1] | 1822 | |
---|
| 1823 | </body> |
---|
| 1824 | </html> |
---|
| 1825 | <?php |
---|
| 1826 | |
---|
| 1827 | } |
---|