Skip to content
Newer
Older
100644 1818 lines (1628 sloc) 57.8 KB
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1 <?php
2
3 /**
8637b8a @reines Updating the copyright notices to 2011.
reines authored
4 * Copyright (C) 2008-2011 FluxBB
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
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
7378efa @franzliedke Change version number to 1.4.5.
franzliedke authored
10 define('FORUM_VERSION', '1.4.5');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
11
d95bfba @reines Adding caching for syndication.
reines authored
12 define('FORUM_DB_REVISION', 11);
93b4980 @reines Changing the regular expressions to use \p{L} instead of \w and \P{L}…
reines authored
13 define('FORUM_SI_REVISION', 2);
14 define('FORUM_PARSER_REVISION', 2);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
15
93b4980 @reines Changing the regular expressions to use \p{L} instead of \w and \P{L}…
reines authored
16 define('MIN_PHP_VERSION', '4.4.0');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
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
f5ee836 @reines Changing PUN_ROOT to use absolute paths, this solves some issues with…
reines authored
23 define('PUN_ROOT', dirname(__FILE__).'/');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
24
44ba15d @reines Making a start on a more user friendly install message that allows la…
reines authored
25 // If we've been passed a default language, use it
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
26 $install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English';
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
27
28 // If such a language pack doesn't exist, or isn't up-to-date enough to translate this page, default to English
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
29 if (!file_exists(PUN_ROOT.'lang/'.$install_lang.'/install.php'))
30 $install_lang = 'English';
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
31
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
32 require PUN_ROOT.'lang/'.$install_lang.'/install.php';
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
33
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
34 if (file_exists(PUN_ROOT.'config.php'))
35 {
36 // Check to see whether FluxBB is already installed
37 include PUN_ROOT.'config.php';
38
39 // 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
40 if (defined('FORUM'))
41 define('PUN', FORUM);
42
43 // If PUN is defined, config.php is probably valid and thus the software is installed
44 if (defined('PUN'))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
45 exit($lang_install['Already installed']);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
46 }
47
48 // Define PUN because email.php requires it
49 define('PUN', 1);
50
f7ba34a @reines Defining FORUM_CACHE_DIR in install.php as it is required by search_idx.
reines authored
51 // If the cache directory is not specified, we use the default setting
52 if (!defined('FORUM_CACHE_DIR'))
53 define('FORUM_CACHE_DIR', PUN_ROOT.'cache/');
54
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
55 // Make sure we are running at least MIN_PHP_VERSION
56 if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
57 exit(sprintf($lang_install['You are running error'], 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
58
59 // Load the functions script
60 require PUN_ROOT.'include/functions.php';
61
62 // Load UTF-8 functions
63 require PUN_ROOT.'include/utf8/utf8.php';
64
65 // Strip out "bad" UTF-8 characters
66 forum_remove_bad_characters();
67
68 // Reverse the effect of register_globals
69 forum_unregister_globals();
70
71 // Disable error reporting for uninitialized variables
72 error_reporting(E_ALL);
73
74 // Force POSIX locale (to prevent functions such as strtolower() from messing up UTF-8 strings)
75 setlocale(LC_CTYPE, 'C');
76
77 // Turn off magic_quotes_runtime
78 if (get_magic_quotes_runtime())
79 set_magic_quotes_runtime(0);
80
81 // Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
82 if (get_magic_quotes_gpc())
83 {
84 function stripslashes_array($array)
85 {
86 return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
87 }
88
89 $_GET = stripslashes_array($_GET);
90 $_POST = stripslashes_array($_POST);
91 $_COOKIE = stripslashes_array($_COOKIE);
92 $_REQUEST = stripslashes_array($_REQUEST);
93 }
94
95 // Turn off PHP time limit
96 @set_time_limit(0);
97
98 //
99 // Generate output to be used for config.php
100 //
101 function generate_config_file()
102 {
3502425 Removed the database password confirmation in install.php.
sexyprout authored
103 global $db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix, $cookie_name, $cookie_seed;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
104
3502425 Removed the database password confirmation in install.php.
sexyprout authored
105 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";
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
106 }
107
108
109 if (isset($_POST['generate_config']))
110 {
111 header('Content-Type: text/x-delimtext; name="config.php"');
112 header('Content-disposition: attachment; filename=config.php');
113
114 $db_type = $_POST['db_type'];
115 $db_host = $_POST['db_host'];
116 $db_name = $_POST['db_name'];
117 $db_username = $_POST['db_username'];
a7a07c2 @reines Fixing wrong variable name in install.php
reines authored
118 $db_password = $_POST['db_password'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
119 $db_prefix = $_POST['db_prefix'];
120 $cookie_name = $_POST['cookie_name'];
121 $cookie_seed = $_POST['cookie_seed'];
122
123 echo generate_config_file();
124 exit;
125 }
126
127
128 if (!isset($_POST['form_sent']))
129 {
130 // Make an educated guess regarding base_url
131 $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol
132 $base_url .= preg_replace('/:(80|443)$/', '', $_SERVER['HTTP_HOST']); // host[:port]
133 $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path
134
135 if (substr($base_url, -1) == '/')
136 $base_url = substr($base_url, 0, -1);
137
982711f @franzliedke Don't fill out password fields again in the install script. This migh…
franzliedke authored
138 $db_type = $db_name = $db_username = $db_prefix = $username = $email = '';
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
139 $db_host = 'localhost';
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
140 $title = $lang_install['My FluxBB Forum'];
141 $description = '<p><span>'.$lang_install['Description'].'</span></p>';
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
142 $default_lang = $install_lang;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
143 $default_style = 'Air';
144 }
145 else
146 {
147 $db_type = $_POST['req_db_type'];
148 $db_host = pun_trim($_POST['req_db_host']);
149 $db_name = pun_trim($_POST['req_db_name']);
150 $db_username = pun_trim($_POST['db_username']);
3502425 Removed the database password confirmation in install.php.
sexyprout authored
151 $db_password = pun_trim($_POST['db_password']);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
152 $db_prefix = pun_trim($_POST['db_prefix']);
153 $username = pun_trim($_POST['req_username']);
154 $email = strtolower(pun_trim($_POST['req_email']));
155 $password1 = pun_trim($_POST['req_password1']);
156 $password2 = pun_trim($_POST['req_password2']);
157 $title = pun_trim($_POST['req_title']);
158 $description = pun_trim($_POST['desc']);
159 $base_url = pun_trim($_POST['req_base_url']);
160 $default_lang = pun_trim($_POST['req_default_lang']);
161 $default_style = pun_trim($_POST['req_default_style']);
162 $alerts = array();
163
164 // Make sure base_url doesn't end with a slash
165 if (substr($base_url, -1) == '/')
166 $base_url = substr($base_url, 0, -1);
167
168 // Validate username and passwords
169 if (pun_strlen($username) < 2)
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
170 $alerts[] = $lang_install['Username 1'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
171 else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
172 $alerts[] = $lang_install['Username 2'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
173 else if (!strcasecmp($username, 'Guest'))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
174 $alerts[] = $lang_install['Username 3'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
175 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))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
176 $alerts[] = $lang_install['Username 4'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
177 else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
178 $alerts[] = $lang_install['Username 5'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
179 else if (preg_match('/(?:\[\/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)/i', $username))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
180 $alerts[] = $lang_install['Username 6'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
181
182 if (pun_strlen($password1) < 4)
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
183 $alerts[] = $lang_install['Short password'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
184 else if ($password1 != $password2)
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
185 $alerts[] = $lang_install['Passwords not match'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
186
187 // Validate email
188 require PUN_ROOT.'include/email.php';
189
190 if (!is_valid_email($email))
88611a5 @reines Fixing indentation and a couple language entries in install script.
reines authored
191 $alerts[] = $lang_install['Wrong email'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
192
193 if ($title == '')
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
194 $alerts[] = $lang_install['No board title'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
195
476486a @reines Updating the language and style checks to match elsewhere.
reines authored
196 $languages = forum_list_langs();
197 if (!in_array($default_lang, $languages))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
198 $alerts[] = $lang_install['Error default language'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
199
476486a @reines Updating the language and style checks to match elsewhere.
reines authored
200 $styles = forum_list_styles();
201 if (!in_array($default_style, $styles))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
202 $alerts[] = $lang_install['Error default style'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
203 }
204
06732db @reines Check the cache directory and avatar directory are writable at the st…
reines authored
205 // Check if the cache directory is writable
206 if (!@is_writable(FORUM_CACHE_DIR))
207 $alerts[] = sprintf($lang_install['Alert cache'], FORUM_CACHE_DIR);
208
209 // Check if default avatar directory is writable
210 if (!@is_writable(PUN_ROOT.'img/avatars/'))
211 $alerts[] = sprintf($lang_install['Alert avatar'], PUN_ROOT.'img/avatars/');
212
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
213 if (!isset($_POST['form_sent']) || !empty($alerts))
214 {
215 // Determine available database extensions
216 $dual_mysql = false;
217 $db_extensions = array();
218 $mysql_innodb = false;
219 if (function_exists('mysqli_connect'))
220 {
221 $db_extensions[] = array('mysqli', 'MySQL Improved');
222 $db_extensions[] = array('mysqli_innodb', 'MySQL Improved (InnoDB)');
223 $mysql_innodb = true;
224 }
225 if (function_exists('mysql_connect'))
226 {
227 $db_extensions[] = array('mysql', 'MySQL Standard');
228 $db_extensions[] = array('mysql_innodb', 'MySQL Standard (InnoDB)');
229 $mysql_innodb = true;
230
231 if (count($db_extensions) > 2)
232 $dual_mysql = true;
233 }
234 if (function_exists('sqlite_open'))
235 $db_extensions[] = array('sqlite', 'SQLite');
236 if (function_exists('pg_connect'))
237 $db_extensions[] = array('pgsql', 'PostgreSQL');
238
239 if (empty($db_extensions))
eeddfd0 @reines Changing some calls to exit to error instead.
reines authored
240 error($lang_install['No DB extensions']);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
241
75fd0d1 @reines If no installation is found redirect to install.php instead of displa…
reines authored
242 // Fetch a list of installed languages
243 $languages = forum_list_langs();
244
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
245 ?>
246 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
247 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
248 <head>
249 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
250 <title><?php echo $lang_install['FluxBB Installation'] ?></title>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
251 <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" />
252 <script type="text/javascript">
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
253 /* <![CDATA[ */
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
254 function process_form(the_form)
255 {
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
256 var element_names = {
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
257 "req_db_type": "<?php echo $lang_install['Database type'] ?>",
258 "req_db_host": "<?php echo $lang_install['Database server hostname'] ?>",
259 "req_db_name": "<?php echo $lang_install['Database name'] ?>",
260 "db_prefix": "<?php echo $lang_install['Table prefix'] ?>",
261 "req_username": "<?php echo $lang_install['Administrator username'] ?>",
262 "req_password1": "<?php echo $lang_install['Administrator password 1'] ?>",
263 "req_password2": "<?php echo $lang_install['Administrator password 2'] ?>",
264 "req_email": "<?php echo $lang_install['Administrator email'] ?>",
265 "req_title": "<?php echo $lang_install['Board title'] ?>",
266 "req_base_url": "<?php echo $lang_install['Base URL'] ?>"
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
267 };
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
268 if (document.all || document.getElementById)
269 {
270 for (var i = 0; i < the_form.length; ++i)
271 {
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
272 var elem = the_form.elements[i];
273 if (elem.name && (/^req_/.test(elem.name)))
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
274 {
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
275 if (!elem.value && elem.type && (/^(?:text(?:area)?|password|file)$/i.test(elem.type)))
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
276 {
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
277 alert('"' + element_names[elem.name] + '" <?php echo $lang_install['Required field'] ?>');
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
278 elem.focus();
279 return false;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
280 }
281 }
282 }
283 }
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
284 return true;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
285 }
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
286 /* ]]> */
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
287 </script>
288 </head>
289 <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;">
290
291 <div id="puninstall" class="pun">
292 <div class="top-box"><div><!-- Top Corners --></div></div>
293 <div class="punwrap">
294
295 <div id="brdheader" class="block">
296 <div class="box">
297 <div id="brdtitle" class="inbox">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
298 <h1><span><?php echo $lang_install['FluxBB Installation'] ?></span></h1>
75fd0d1 @reines If no installation is found redirect to install.php instead of displa…
reines authored
299 <div id="brddesc"><p><?php echo $lang_install['Install message'] ?></p><p><?php echo $lang_install['Welcome'] ?></p></div>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
300 </div>
301 </div>
302 </div>
303
304 <div id="brdmain">
75fd0d1 @reines If no installation is found redirect to install.php instead of displa…
reines authored
305 <?php if (count($languages) > 1): ?><div class="blockform">
306 <h2><span><?php echo $lang_install['Choose install language'] ?></span></h2>
307 <div class="box">
308 <form id="install" method="post" action="install.php">
309 <div class="inform">
310 <fieldset>
311 <legend><?php echo $lang_install['Install language'] ?></legend>
312 <div class="infldset">
313 <p><?php echo $lang_install['Choose install language info'] ?></p>
314 <label><strong><?php echo $lang_install['Install language'] ?></strong>
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
315 <br /><select name="install_lang">
75fd0d1 @reines If no installation is found redirect to install.php instead of displa…
reines authored
316 <?php
317
318 foreach ($languages as $temp)
319 {
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
320 if ($temp == $install_lang)
75fd0d1 @reines If no installation is found redirect to install.php instead of displa…
reines authored
321 echo "\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
322 else
323 echo "\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
324 }
325
326 ?>
327 </select>
328 <br /></label>
329 </div>
330 </fieldset>
331 </div>
332 <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_install['Change language'] ?>" /></p>
333 </form>
334 </div>
335 </div>
336 <?php endif; ?>
337
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
338 <div class="blockform">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
339 <h2><span><?php echo $lang_install['Install'] ?></span></h2>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
340 <div class="box">
341 <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;}">
4b14352 @reines Fixing the install language being lost upon errors on the second inst…
reines authored
342 <div><input type="hidden" name="form_sent" value="1" /><input type="hidden" name="install_lang" value="<?php echo pun_htmlspecialchars($install_lang) ?>" /></div>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
343 <div class="inform">
344 <?php if (!empty($alerts)): ?> <div class="forminfo error-info">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
345 <h3><?php echo $lang_install['Errors'] ?></h3>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
346 <ul class="error-list">
347 <?php
348
349 foreach ($alerts as $cur_alert)
350 echo "\t\t\t\t\t\t".'<li><strong>'.$cur_alert.'</strong></li>'."\n";
351 ?>
352 </ul>
353 </div>
354 <?php endif; ?> </div>
355 <div class="inform">
356 <div class="forminfo">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
357 <h3><?php echo $lang_install['Database setup'] ?></h3>
358 <p><?php echo $lang_install['Info 1'] ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
359 </div>
360 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
361 <legend><?php echo $lang_install['Select database'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
362 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
363 <p><?php echo $lang_install['Info 2'] ?></p>
364 <?php if ($dual_mysql): ?> <p><?php echo $lang_install['Dual MySQL'] ?></p>
365 <?php endif; ?><?php if ($mysql_innodb): ?> <p><?php echo $lang_install['InnoDB'] ?></p>
366 <?php endif; ?> <label class="required"><strong><?php echo $lang_install['Database type'] ?> <span><?php echo $lang_install['Required'] ?></span></strong>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
367 <br /><select name="req_db_type">
368 <?php
369
370 foreach ($db_extensions as $temp)
371 {
372 if ($temp[0] == $db_type)
373 echo "\t\t\t\t\t\t\t".'<option value="'.$temp[0].'" selected="selected">'.$temp[1].'</option>'."\n";
374 else
375 echo "\t\t\t\t\t\t\t".'<option value="'.$temp[0].'">'.$temp[1].'</option>'."\n";
376 }
377
378 ?>
379 </select>
380 <br /></label>
381 </div>
382 </fieldset>
383 </div>
384 <div class="inform">
385 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
386 <legend><?php echo $lang_install['Database hostname'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
387 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
388 <p><?php echo $lang_install['Info 3'] ?></p>
3512a8a @reines Removing some maxlengths from database related fields in install.php,…
reines authored
389 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
390 </div>
391 </fieldset>
392 </div>
393 <div class="inform">
394 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
395 <legend><?php echo $lang_install['Database enter name'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
396 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
397 <p><?php echo $lang_install['Info 4'] ?></p>
3512a8a @reines Removing some maxlengths from database related fields in install.php,…
reines authored
398 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
399 </div>
400 </fieldset>
401 </div>
402 <div class="inform">
403 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
404 <legend><?php echo $lang_install['Database enter informations'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
405 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
406 <p><?php echo $lang_install['Info 5'] ?></p>
3512a8a @reines Removing some maxlengths from database related fields in install.php,…
reines authored
407 <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>
408 <label class="conl"><?php echo $lang_install['Database password'] ?><br /><input type="password" name="db_password" size="30" /><br /></label>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
409 <div class="clearer"></div>
410 </div>
411 </fieldset>
412 </div>
413 <div class="inform">
414 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
415 <legend><?php echo $lang_install['Database enter prefix'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
416 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
417 <p><?php echo $lang_install['Info 6'] ?></p>
418 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
419 </div>
420 </fieldset>
421 </div>
422 <div class="inform">
423 <div class="forminfo">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
424 <h3><?php echo $lang_install['Administration setup'] ?></h3>
425 <p><?php echo $lang_install['Info 7'] ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
426 </div>
427 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
428 <legend><?php echo $lang_install['Admin enter username'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
429 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
430 <p><?php echo $lang_install['Info 8'] ?></p>
431 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
432 </div>
433 </fieldset>
434 </div>
435 <div class="inform">
436 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
437 <legend><?php echo $lang_install['Admin enter password'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
438 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
439 <p><?php echo $lang_install['Info 9'] ?></p>
440 <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>
441 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
442 <div class="clearer"></div>
443 </div>
444 </fieldset>
445 </div>
446 <div class="inform">
447 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
448 <legend><?php echo $lang_install['Admin enter email'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
449 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
450 <p><?php echo $lang_install['Info 10'] ?></p>
451 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
452 </div>
453 </fieldset>
454 </div>
455 <div class="inform">
456 <div class="forminfo">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
457 <h3><?php echo $lang_install['Board setup'] ?></h3>
458 <p><?php echo $lang_install['Info 11'] ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
459 </div>
460 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
461 <legend><?php echo $lang_install['Enter board title'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
462 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
463 <p><?php echo $lang_install['Info 12'] ?></p>
464 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
465 </div>
466 </fieldset>
467 </div>
468 <div class="inform">
469 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
470 <legend><?php echo $lang_install['Enter board description'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
471 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
472 <p><?php echo $lang_install['Info 13'] ?></p>
35b89b5 @Quy Removed an unnecessary <strong> tag in install.php.
Quy authored
473 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
474 </div>
475 </fieldset>
476 </div>
477 <div class="inform">
478 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
479 <legend><?php echo $lang_install['Enter base URL'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
480 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
481 <p><?php echo $lang_install['Info 14'] ?></p>
482 <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>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
483 </div>
484 </fieldset>
485 </div>
486 <div class="inform">
487 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
488 <legend><?php echo $lang_install['Choose the default language'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
489 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
490 <p><?php echo $lang_install['Info 15'] ?></p>
491 <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">
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
492 <?php
493
494 $languages = forum_list_langs();
495 foreach ($languages as $temp)
496 {
497 if ($temp == $default_lang)
498 echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
499 else
500 echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
501 }
502
503 ?>
504 </select><br /></label>
505 </div>
506 </fieldset>
507 </div>
508 <div class="inform">
509 <fieldset>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
510 <legend><?php echo $lang_install['Choose the default style'] ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
511 <div class="infldset">
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
512 <p><?php echo $lang_install['Info 16'] ?></p>
513 <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">
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
514 <?php
515
516 $styles = forum_list_styles();
517 foreach ($styles as $temp)
518 {
519 if ($temp == $default_style)
520 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n";
521 else
522 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
523 }
524
525 ?>
526 </select><br /></label>
527 </div>
528 </fieldset>
529 </div>
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
530 <p class="buttons"><input type="submit" name="start" value="<?php echo $lang_install['Start install'] ?>" /></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
531 </form>
532 </div>
533 </div>
534 </div>
535
536 </div>
537 <div class="end-box"><div><!-- Bottom Corners --></div></div>
538 </div>
539
540 </body>
541 </html>
542 <?php
543
544 }
545 else
546 {
547 // Load the appropriate DB layer class
548 switch ($db_type)
549 {
550 case 'mysql':
551 require PUN_ROOT.'include/dblayer/mysql.php';
552 break;
553
554 case 'mysql_innodb':
555 require PUN_ROOT.'include/dblayer/mysql_innodb.php';
556 break;
557
558 case 'mysqli':
559 require PUN_ROOT.'include/dblayer/mysqli.php';
560 break;
561
562 case 'mysqli_innodb':
563 require PUN_ROOT.'include/dblayer/mysqli_innodb.php';
564 break;
565
566 case 'pgsql':
567 require PUN_ROOT.'include/dblayer/pgsql.php';
568 break;
569
570 case 'sqlite':
571 require PUN_ROOT.'include/dblayer/sqlite.php';
572 break;
573
574 default:
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
575 error(sprintf($lang_install['DB type not valid'], pun_htmlspecialchars($db_type)));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
576 }
577
578 // Create the database object (and connect/select db)
3502425 Removed the database password confirmation in install.php.
sexyprout authored
579 $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
580
581 // Validate prefix
582 if (strlen($db_prefix) > 0 && (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $db_prefix) || strlen($db_prefix) > 40))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
583 error(sprintf($lang_install['Table prefix error'], $db->prefix));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
584
585 // Do some DB type specific checks
586 switch ($db_type)
587 {
588 case 'mysql':
589 case 'mysqli':
590 case 'mysql_innodb':
591 case 'mysqli_innodb':
592 $mysql_info = $db->get_version();
593 if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<'))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
594 error(sprintf($lang_install['You are running error'], 'MySQL', $mysql_info['version'], FORUM_VERSION, MIN_MYSQL_VERSION));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
595 break;
596
597 case 'pgsql':
598 $pgsql_info = $db->get_version();
599 if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<'))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
600 error(sprintf($lang_install['You are running error'], 'PostgreSQL', $pgsql_info['version'], FORUM_VERSION, MIN_PGSQL_VERSION));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
601 break;
602
603 case 'sqlite':
604 if (strtolower($db_prefix) == 'sqlite_')
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
605 error($lang_install['Prefix reserved']);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
606 break;
607 }
608
609
610 // Make sure FluxBB isn't already installed
611 $result = $db->query('SELECT 1 FROM '.$db_prefix.'users WHERE id=1');
612 if ($db->num_rows($result))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
613 error(sprintf($lang_install['Existing table error'], $db_prefix, $db_name));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
614
615 // Check if InnoDB is available
616 if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
617 {
618 $result = $db->query('SHOW VARIABLES LIKE \'have_innodb\'');
619 list (, $result) = $db->fetch_row($result);
620 if ((strtoupper($result) != 'YES'))
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
621 error($lang_install['InnoDB off']);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
622 }
623
624
625 // Start a transaction
626 $db->start_transaction();
627
628
629 // Create all tables
630 $schema = array(
631 'FIELDS' => array(
632 'id' => array(
633 'datatype' => 'SERIAL',
634 'allow_null' => false
635 ),
636 'username' => array(
637 'datatype' => 'VARCHAR(200)',
638 'allow_null' => true
639 ),
640 'ip' => array(
641 'datatype' => 'VARCHAR(255)',
642 'allow_null' => true
643 ),
644 'email' => array(
645 'datatype' => 'VARCHAR(80)',
646 'allow_null' => true
647 ),
648 'message' => array(
649 'datatype' => 'VARCHAR(255)',
650 'allow_null' => true
651 ),
652 'expire' => array(
653 'datatype' => 'INT(10) UNSIGNED',
654 'allow_null' => true
655 ),
656 'ban_creator' => array(
657 'datatype' => 'INT(10) UNSIGNED',
658 'allow_null' => false,
659 'default' => '0'
660 )
661 ),
662 'PRIMARY KEY' => array('id'),
663 'INDEXES' => array(
664 'username_idx' => array('username')
665 )
666 );
667
668 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
669 $schema['INDEXES']['username_idx'] = array('username(25)');
670
671 $db->create_table('bans', $schema) or error('Unable to create bans table', __FILE__, __LINE__, $db->error());
672
673
674 $schema = array(
675 'FIELDS' => array(
676 'id' => array(
677 'datatype' => 'SERIAL',
678 'allow_null' => false
679 ),
680 'cat_name' => array(
681 'datatype' => 'VARCHAR(80)',
682 'allow_null' => false,
683 'default' => '\'New Category\''
684 ),
685 'disp_position' => array(
686 'datatype' => 'INT(10)',
687 'allow_null' => false,
688 'default' => '0'
689 )
690 ),
691 'PRIMARY KEY' => array('id')
692 );
693
694 $db->create_table('categories', $schema) or error('Unable to create categories table', __FILE__, __LINE__, $db->error());
695
696
697 $schema = array(
698 'FIELDS' => array(
699 'id' => array(
700 'datatype' => 'SERIAL',
701 'allow_null' => false
702 ),
703 'search_for' => array(
704 'datatype' => 'VARCHAR(60)',
705 'allow_null' => false,
706 'default' => '\'\''
707 ),
708 'replace_with' => array(
709 'datatype' => 'VARCHAR(60)',
710 'allow_null' => false,
711 'default' => '\'\''
712 )
713 ),
714 'PRIMARY KEY' => array('id')
715 );
716
717 $db->create_table('censoring', $schema) or error('Unable to create censoring table', __FILE__, __LINE__, $db->error());
718
719
720 $schema = array(
721 'FIELDS' => array(
722 'conf_name' => array(
723 'datatype' => 'VARCHAR(255)',
724 'allow_null' => false,
725 'default' => '\'\''
726 ),
727 'conf_value' => array(
728 'datatype' => 'TEXT',
729 'allow_null' => true
730 )
731 ),
732 'PRIMARY KEY' => array('conf_name')
733 );
734
735 $db->create_table('config', $schema) or error('Unable to create config table', __FILE__, __LINE__, $db->error());
736
737
738 $schema = array(
739 'FIELDS' => array(
740 'group_id' => array(
741 'datatype' => 'INT(10)',
742 'allow_null' => false,
743 'default' => '0'
744 ),
745 'forum_id' => array(
746 'datatype' => 'INT(10)',
747 'allow_null' => false,
748 'default' => '0'
749 ),
750 'read_forum' => array(
751 'datatype' => 'TINYINT(1)',
752 'allow_null' => false,
753 'default' => '1'
754 ),
755 'post_replies' => array(
756 'datatype' => 'TINYINT(1)',
757 'allow_null' => false,
758 'default' => '1'
759 ),
760 'post_topics' => array(
761 'datatype' => 'TINYINT(1)',
762 'allow_null' => false,
763 'default' => '1'
764 )
765 ),
766 'PRIMARY KEY' => array('group_id', 'forum_id')
767 );
768
769 $db->create_table('forum_perms', $schema) or error('Unable to create forum_perms table', __FILE__, __LINE__, $db->error());
770
771
772 $schema = array(
773 'FIELDS' => array(
774 'id' => array(
775 'datatype' => 'SERIAL',
776 'allow_null' => false
777 ),
778 'forum_name' => array(
779 'datatype' => 'VARCHAR(80)',
780 'allow_null' => false,
781 'default' => '\'New forum\''
782 ),
783 'forum_desc' => array(
784 'datatype' => 'TEXT',
785 'allow_null' => true
786 ),
787 'redirect_url' => array(
788 'datatype' => 'VARCHAR(100)',
789 'allow_null' => true
790 ),
791 'moderators' => array(
792 'datatype' => 'TEXT',
793 'allow_null' => true
794 ),
795 'num_topics' => array(
796 'datatype' => 'MEDIUMINT(8) UNSIGNED',
797 'allow_null' => false,
798 'default' => '0'
799 ),
800 'num_posts' => array(
801 'datatype' => 'MEDIUMINT(8) UNSIGNED',
802 'allow_null' => false,
803 'default' => '0'
804 ),
805 'last_post' => array(
806 'datatype' => 'INT(10) UNSIGNED',
807 'allow_null' => true
808 ),
809 'last_post_id' => array(
810 'datatype' => 'INT(10) UNSIGNED',
811 'allow_null' => true
812 ),
813 'last_poster' => array(
814 'datatype' => 'VARCHAR(200)',
815 'allow_null' => true
816 ),
817 'sort_by' => array(
818 'datatype' => 'TINYINT(1)',
819 'allow_null' => false,
820 'default' => '0'
821 ),
822 'disp_position' => array(
823 'datatype' => 'INT(10)',
824 'allow_null' => false,
825 'default' => '0'
826 ),
827 'cat_id' => array(
828 'datatype' => 'INT(10) UNSIGNED',
829 'allow_null' => false,
830 'default' => '0'
831 )
832 ),
833 'PRIMARY KEY' => array('id')
834 );
835
836 $db->create_table('forums', $schema) or error('Unable to create forums table', __FILE__, __LINE__, $db->error());
837
838
839 $schema = array(
840 'FIELDS' => array(
841 'g_id' => array(
842 'datatype' => 'SERIAL',
843 'allow_null' => false
844 ),
845 'g_title' => array(
846 'datatype' => 'VARCHAR(50)',
847 'allow_null' => false,
848 'default' => '\'\''
849 ),
850 'g_user_title' => array(
851 'datatype' => 'VARCHAR(50)',
852 'allow_null' => true
853 ),
854 'g_moderator' => array(
855 'datatype' => 'TINYINT(1)',
856 'allow_null' => false,
857 'default' => '0'
858 ),
859 'g_mod_edit_users' => array(
860 'datatype' => 'TINYINT(1)',
861 'allow_null' => false,
862 'default' => '0'
863 ),
864 'g_mod_rename_users' => array(
865 'datatype' => 'TINYINT(1)',
866 'allow_null' => false,
867 'default' => '0'
868 ),
869 'g_mod_change_passwords' => array(
870 'datatype' => 'TINYINT(1)',
871 'allow_null' => false,
872 'default' => '0'
873 ),
874 'g_mod_ban_users' => array(
875 'datatype' => 'TINYINT(1)',
876 'allow_null' => false,
877 'default' => '0'
878 ),
879 'g_read_board' => array(
880 'datatype' => 'TINYINT(1)',
881 'allow_null' => false,
882 'default' => '1'
883 ),
884 'g_view_users' => array(
885 'datatype' => 'TINYINT(1)',
886 'allow_null' => false,
887 'default' => '1'
888 ),
889 'g_post_replies' => array(
890 'datatype' => 'TINYINT(1)',
891 'allow_null' => false,
892 'default' => '1'
893 ),
894 'g_post_topics' => array(
895 'datatype' => 'TINYINT(1)',
896 'allow_null' => false,
897 'default' => '1'
898 ),
899 'g_edit_posts' => array(
900 'datatype' => 'TINYINT(1)',
901 'allow_null' => false,
902 'default' => '1'
903 ),
904 'g_delete_posts' => array(
905 'datatype' => 'TINYINT(1)',
906 'allow_null' => false,
907 'default' => '1'
908 ),
909 'g_delete_topics' => array(
910 'datatype' => 'TINYINT(1)',
911 'allow_null' => false,
912 'default' => '1'
913 ),
914 'g_set_title' => array(
915 'datatype' => 'TINYINT(1)',
916 'allow_null' => false,
917 'default' => '1'
918 ),
919 'g_search' => array(
920 'datatype' => 'TINYINT(1)',
921 'allow_null' => false,
922 'default' => '1'
923 ),
924 'g_search_users' => array(
925 'datatype' => 'TINYINT(1)',
926 'allow_null' => false,
927 'default' => '1'
928 ),
929 'g_send_email' => array(
930 'datatype' => 'TINYINT(1)',
931 'allow_null' => false,
932 'default' => '1'
933 ),
934 'g_post_flood' => array(
935 'datatype' => 'SMALLINT(6)',
936 'allow_null' => false,
937 'default' => '30'
938 ),
939 'g_search_flood' => array(
940 'datatype' => 'SMALLINT(6)',
941 'allow_null' => false,
942 'default' => '30'
943 ),
944 'g_email_flood' => array(
945 'datatype' => 'SMALLINT(6)',
946 'allow_null' => false,
947 'default' => '60'
948 )
949 ),
950 'PRIMARY KEY' => array('g_id')
951 );
952
953 $db->create_table('groups', $schema) or error('Unable to create groups table', __FILE__, __LINE__, $db->error());
954
955
956 $schema = array(
957 'FIELDS' => array(
958 'user_id' => array(
959 'datatype' => 'INT(10) UNSIGNED',
960 'allow_null' => false,
961 'default' => '1'
962 ),
963 'ident' => array(
964 'datatype' => 'VARCHAR(200)',
965 'allow_null' => false,
966 'default' => '\'\''
967 ),
968 'logged' => array(
969 'datatype' => 'INT(10) UNSIGNED',
970 'allow_null' => false,
971 'default' => '0'
972 ),
973 'idle' => array(
974 'datatype' => 'TINYINT(1)',
975 'allow_null' => false,
976 'default' => '0'
977 ),
978 'last_post' => array(
979 'datatype' => 'INT(10) UNSIGNED',
980 'allow_null' => true
981 ),
982 'last_search' => array(
983 'datatype' => 'INT(10) UNSIGNED',
984 'allow_null' => true
985 ),
986 ),
987 'UNIQUE KEYS' => array(
988 'user_id_ident_idx' => array('user_id', 'ident')
989 ),
990 'INDEXES' => array(
991 'ident_idx' => array('ident'),
992 'logged_idx' => array('logged')
993 ),
994 'ENGINE' => 'HEAP'
995 );
996
997 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
998 {
999 $schema['UNIQUE KEYS']['user_id_ident_idx'] = array('user_id', 'ident(25)');
1000 $schema['INDEXES']['ident_idx'] = array('ident(25)');
1001 }
1002
1003 if ($db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
1004 $schema['ENGINE'] = 'InnoDB';
1005
1006 $db->create_table('online', $schema) or error('Unable to create online table', __FILE__, __LINE__, $db->error());
1007
1008
1009 $schema = array(
1010 'FIELDS' => array(
1011 'id' => array(
1012 'datatype' => 'SERIAL',
1013 'allow_null' => false
1014 ),
1015 'poster' => array(
1016 'datatype' => 'VARCHAR(200)',
1017 'allow_null' => false,
1018 'default' => '\'\''
1019 ),
1020 'poster_id' => array(
1021 'datatype' => 'INT(10) UNSIGNED',
1022 'allow_null' => false,
1023 'default' => '1'
1024 ),
1025 'poster_ip' => array(
1026 'datatype' => 'VARCHAR(39)',
1027 'allow_null' => true
1028 ),
1029 'poster_email' => array(
1030 'datatype' => 'VARCHAR(80)',
1031 'allow_null' => true
1032 ),
1033 'message' => array(
eab8fec @reines Updating the posts message field to be MEDIUMTEXT rather than TEXT. T…
reines authored
1034 'datatype' => 'MEDIUMTEXT',
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1035 'allow_null' => true
1036 ),
1037 'hide_smilies' => array(
1038 'datatype' => 'TINYINT(1)',
1039 'allow_null' => false,
1040 'default' => '0'
1041 ),
1042 'posted' => array(
1043 'datatype' => 'INT(10) UNSIGNED',
1044 'allow_null' => false,
1045 'default' => '0'
1046 ),
1047 'edited' => array(
1048 'datatype' => 'INT(10) UNSIGNED',
1049 'allow_null' => true
1050 ),
1051 'edited_by' => array(
1052 'datatype' => 'VARCHAR(200)',
1053 'allow_null' => true
1054 ),
1055 'topic_id' => array(
1056 'datatype' => 'INT(10) UNSIGNED',
1057 'allow_null' => false,
1058 'default' => '0'
1059 )
1060 ),
1061 'PRIMARY KEY' => array('id'),
1062 'INDEXES' => array(
1063 'topic_id_idx' => array('topic_id'),
1064 'multi_idx' => array('poster_id', 'topic_id')
1065 )
1066 );
1067
1068 $db->create_table('posts', $schema) or error('Unable to create posts table', __FILE__, __LINE__, $db->error());
1069
1070
1071 $schema = array(
1072 'FIELDS' => array(
1073 'id' => array(
1074 'datatype' => 'SERIAL',
1075 'allow_null' => false
1076 ),
1077 'rank' => array(
1078 'datatype' => 'VARCHAR(50)',
1079 'allow_null' => false,
1080 'default' => '\'\''
1081 ),
1082 'min_posts' => array(
1083 'datatype' => 'MEDIUMINT(8) UNSIGNED',
1084 'allow_null' => false,
1085 'default' => '0'
1086 )
1087 ),
1088 'PRIMARY KEY' => array('id')
1089 );
1090
1091 $db->create_table('ranks', $schema) or error('Unable to create ranks table', __FILE__, __LINE__, $db->error());
1092
1093
1094 $schema = array(
1095 'FIELDS' => array(
1096 'id' => array(
1097 'datatype' => 'SERIAL',
1098 'allow_null' => false
1099 ),
1100 'post_id' => array(
1101 'datatype' => 'INT(10) UNSIGNED',
1102 'allow_null' => false,
1103 'default' => '0'
1104 ),
1105 'topic_id' => array(
1106 'datatype' => 'INT(10) UNSIGNED',
1107 'allow_null' => false,
1108 'default' => '0'
1109 ),
1110 'forum_id' => array(
1111 'datatype' => 'INT(10) UNSIGNED',
1112 'allow_null' => false,
1113 'default' => '0'
1114 ),
1115 'reported_by' => array(
1116 'datatype' => 'INT(10) UNSIGNED',
1117 'allow_null' => false,
1118 'default' => '0'
1119 ),
1120 'created' => array(
1121 'datatype' => 'INT(10) UNSIGNED',
1122 'allow_null' => false,
1123 'default' => '0'
1124 ),
1125 'message' => array(
1126 'datatype' => 'TEXT',
1127 'allow_null' => true
1128 ),
1129 'zapped' => array(
1130 'datatype' => 'INT(10) UNSIGNED',
1131 'allow_null' => true
1132 ),
1133 'zapped_by' => array(
1134 'datatype' => 'INT(10) UNSIGNED',
1135 'allow_null' => true
1136 )
1137 ),
1138 'PRIMARY KEY' => array('id'),
1139 'INDEXES' => array(
1140 'zapped_idx' => array('zapped')
1141 )
1142 );
1143
1144 $db->create_table('reports', $schema) or error('Unable to create reports table', __FILE__, __LINE__, $db->error());
1145
1146
1147 $schema = array(
1148 'FIELDS' => array(
1149 'id' => array(
1150 'datatype' => 'INT(10) UNSIGNED',
1151 'allow_null' => false,
1152 'default' => '0'
1153 ),
1154 'ident' => array(
1155 'datatype' => 'VARCHAR(200)',
1156 'allow_null' => false,
1157 'default' => '\'\''
1158 ),
1159 'search_data' => array(
1160 'datatype' => 'MEDIUMTEXT',
1161 'allow_null' => true
1162 )
1163 ),
1164 'PRIMARY KEY' => array('id'),
1165 'INDEXES' => array(
1166 'ident_idx' => array('ident')
1167 )
1168 );
1169
1170 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
1171 $schema['INDEXES']['ident_idx'] = array('ident(8)');
1172
1173 $db->create_table('search_cache', $schema) or error('Unable to create search_cache table', __FILE__, __LINE__, $db->error());
1174
1175
1176 $schema = array(
1177 'FIELDS' => array(
1178 'post_id' => array(
1179 'datatype' => 'INT(10) UNSIGNED',
1180 'allow_null' => false,
1181 'default' => '0'
1182 ),
1183 'word_id' => array(
1184 'datatype' => 'INT(10) UNSIGNED',
1185 'allow_null' => false,
1186 'default' => '0'
1187 ),
1188 'subject_match' => array(
1189 'datatype' => 'TINYINT(1)',
1190 'allow_null' => false,
1191 'default' => '0'
1192 )
1193 ),
1194 'INDEXES' => array(
1195 'word_id_idx' => array('word_id'),
1196 'post_id_idx' => array('post_id')
1197 )
1198 );
1199
1200 $db->create_table('search_matches', $schema) or error('Unable to create search_matches table', __FILE__, __LINE__, $db->error());
1201
1202
1203 $schema = array(
1204 'FIELDS' => array(
1205 'id' => array(
1206 'datatype' => 'SERIAL',
1207 'allow_null' => false
1208 ),
1209 'word' => array(
1210 'datatype' => 'VARCHAR(20)',
1211 'allow_null' => false,
1212 'default' => '\'\'',
1213 'collation' => 'bin'
1214 )
1215 ),
1216 'PRIMARY KEY' => array('word'),
1217 'INDEXES' => array(
1218 'id_idx' => array('id')
1219 )
1220 );
1221
1222 if ($db_type == 'sqlite')
1223 {
1224 $schema['PRIMARY KEY'] = array('id');
1225 $schema['UNIQUE KEYS'] = array('word_idx' => array('word'));
1226 }
1227
1228 $db->create_table('search_words', $schema) or error('Unable to create search_words table', __FILE__, __LINE__, $db->error());
1229
1230
1231 $schema = array(
1232 'FIELDS' => array(
1233 'user_id' => array(
1234 'datatype' => 'INT(10) UNSIGNED',
1235 'allow_null' => false,
1236 'default' => '0'
1237 ),
1238 'topic_id' => array(
1239 'datatype' => 'INT(10) UNSIGNED',
1240 'allow_null' => false,
1241 'default' => '0'
1242 )
1243 ),
1244 'PRIMARY KEY' => array('user_id', 'topic_id')
1245 );
1246
68b3934 @reines Adding forum subscriptions, see #142
reines authored
1247 $db->create_table('topic_subscriptions', $schema) or error('Unable to create topic subscriptions table', __FILE__, __LINE__, $db->error());
1248
1249
1250 $schema = array(
1251 'FIELDS' => array(
1252 'user_id' => array(
1253 'datatype' => 'INT(10) UNSIGNED',
1254 'allow_null' => false,
1255 'default' => '0'
1256 ),
1257 'forum_id' => array(
1258 'datatype' => 'INT(10) UNSIGNED',
1259 'allow_null' => false,
1260 'default' => '0'
1261 )
1262 ),
1263 'PRIMARY KEY' => array('user_id', 'forum_id')
1264 );
1265
1266 $db->create_table('forum_subscriptions', $schema) or error('Unable to create forum subscriptions table', __FILE__, __LINE__, $db->error());
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1267
1268
1269 $schema = array(
1270 'FIELDS' => array(
1271 'id' => array(
1272 'datatype' => 'SERIAL',
1273 'allow_null' => false
1274 ),
1275 'poster' => array(
1276 'datatype' => 'VARCHAR(200)',
1277 'allow_null' => false,
1278 'default' => '\'\''
1279 ),
1280 'subject' => array(
1281 'datatype' => 'VARCHAR(255)',
1282 'allow_null' => false,
1283 'default' => '\'\''
1284 ),
1285 'posted' => array(
1286 'datatype' => 'INT(10) UNSIGNED',
1287 'allow_null' => false,
1288 'default' => '0'
1289 ),
1290 'first_post_id' => array(
1291 'datatype' => 'INT(10) UNSIGNED',
1292 'allow_null' => false,
1293 'default' => '0'
1294 ),
1295 'last_post' => array(
1296 'datatype' => 'INT(10) UNSIGNED',
1297 'allow_null' => false,
1298 'default' => '0'
1299 ),
1300 'last_post_id' => array(
1301 'datatype' => 'INT(10) UNSIGNED',
1302 'allow_null' => false,
1303 'default' => '0'
1304 ),
1305 'last_poster' => array(
1306 'datatype' => 'VARCHAR(200)',
1307 'allow_null' => true
1308 ),
1309 'num_views' => array(
1310 'datatype' => 'MEDIUMINT(8) UNSIGNED',
1311 'allow_null' => false,
1312 'default' => '0'
1313 ),
1314 'num_replies' => array(
1315 'datatype' => 'MEDIUMINT(8) UNSIGNED',
1316 'allow_null' => false,
1317 'default' => '0'
1318 ),
1319 'closed' => array(
1320 'datatype' => 'TINYINT(1)',
1321 'allow_null' => false,
1322 'default' => '0'
1323 ),
1324 'sticky' => array(
1325 'datatype' => 'TINYINT(1)',
1326 'allow_null' => false,
1327 'default' => '0'
1328 ),
1329 'moved_to' => array(
1330 'datatype' => 'INT(10) UNSIGNED',
1331 'allow_null' => true
1332 ),
1333 'forum_id' => array(
1334 'datatype' => 'INT(10) UNSIGNED',
1335 'allow_null' => false,
1336 'default' => '0'
1337 )
1338 ),
1339 'PRIMARY KEY' => array('id'),
1340 'INDEXES' => array(
1341 'forum_id_idx' => array('forum_id'),
1342 'moved_to_idx' => array('moved_to'),
1343 'last_post_idx' => array('last_post'),
1344 'first_post_id_idx' => array('first_post_id')
1345 )
1346 );
1347
1348 $db->create_table('topics', $schema) or error('Unable to create topics table', __FILE__, __LINE__, $db->error());
1349
1350
1351 $schema = array(
1352 'FIELDS' => array(
1353 'id' => array(
1354 'datatype' => 'SERIAL',
1355 'allow_null' => false
1356 ),
1357 'group_id' => array(
1358 'datatype' => 'INT(10) UNSIGNED',
1359 'allow_null' => false,
1360 'default' => '3'
1361 ),
1362 'username' => array(
1363 'datatype' => 'VARCHAR(200)',
1364 'allow_null' => false,
1365 'default' => '\'\''
1366 ),
1367 'password' => array(
1368 'datatype' => 'VARCHAR(40)',
1369 'allow_null' => false,
1370 'default' => '\'\''
1371 ),
1372 'email' => array(
1373 'datatype' => 'VARCHAR(80)',
1374 'allow_null' => false,
1375 'default' => '\'\''
1376 ),
1377 'title' => array(
1378 'datatype' => 'VARCHAR(50)',
1379 'allow_null' => true
1380 ),
1381 'realname' => array(
1382 'datatype' => 'VARCHAR(40)',
1383 'allow_null' => true
1384 ),
1385 'url' => array(
1386 'datatype' => 'VARCHAR(100)',
1387 'allow_null' => true
1388 ),
1389 'jabber' => array(
1390 'datatype' => 'VARCHAR(80)',
1391 'allow_null' => true
1392 ),
1393 'icq' => array(
1394 'datatype' => 'VARCHAR(12)',
1395 'allow_null' => true
1396 ),
1397 'msn' => array(
1398 'datatype' => 'VARCHAR(80)',
1399 'allow_null' => true
1400 ),
1401 'aim' => array(
1402 'datatype' => 'VARCHAR(30)',
1403 'allow_null' => true
1404 ),
1405 'yahoo' => array(
1406 'datatype' => 'VARCHAR(30)',
1407 'allow_null' => true
1408 ),
1409 'location' => array(
1410 'datatype' => 'VARCHAR(30)',
1411 'allow_null' => true
1412 ),
1413 'signature' => array(
1414 'datatype' => 'TEXT',
1415 'allow_null' => true
1416 ),
1417 'disp_topics' => array(
1418 'datatype' => 'TINYINT(3) UNSIGNED',
1419 'allow_null' => true
1420 ),
1421 'disp_posts' => array(
1422 'datatype' => 'TINYINT(3) UNSIGNED',
1423 'allow_null' => true
1424 ),
1425 'email_setting' => array(
1426 'datatype' => 'TINYINT(1)',
1427 'allow_null' => false,
1428 'default' => '1'
1429 ),
1430 'notify_with_post' => array(
1431 'datatype' => 'TINYINT(1)',
1432 'allow_null' => false,
1433 'default' => '0'
1434 ),
1435 'auto_notify' => array(
1436 'datatype' => 'TINYINT(1)',
1437 'allow_null' => false,
1438 'default' => '0'
1439 ),
1440 'show_smilies' => array(
1441 'datatype' => 'TINYINT(1)',
1442 'allow_null' => false,
1443 'default' => '1'
1444 ),
1445 'show_img' => array(
1446 'datatype' => 'TINYINT(1)',
1447 'allow_null' => false,
1448 'default' => '1'
1449 ),
1450 'show_img_sig' => array(
1451 'datatype' => 'TINYINT(1)',
1452 'allow_null' => false,
1453 'default' => '1'
1454 ),
1455 'show_avatars' => array(
1456 'datatype' => 'TINYINT(1)',
1457 'allow_null' => false,
1458 'default' => '1'
1459 ),
1460 'show_sig' => array(
1461 'datatype' => 'TINYINT(1)',
1462 'allow_null' => false,
1463 'default' => '1'
1464 ),
1465 'timezone' => array(
1466 'datatype' => 'FLOAT',
1467 'allow_null' => false,
1468 'default' => '0'
1469 ),
1470 'dst' => array(
1471 'datatype' => 'TINYINT(1)',
1472 'allow_null' => false,
1473 'default' => '0'
1474 ),
1475 'time_format' => array(
1476 'datatype' => 'TINYINT(1)',
1477 'allow_null' => false,
1478 'default' => '0'
1479 ),
1480 'date_format' => array(
1481 'datatype' => 'TINYINT(1)',
1482 'allow_null' => false,
1483 'default' => '0'
1484 ),
1485 'language' => array(
1486 'datatype' => 'VARCHAR(25)',
1487 'allow_null' => false,
1488 'default' => '\'English\''
1489 ),
1490 'style' => array(
1491 'datatype' => 'VARCHAR(25)',
1492 'allow_null' => false,
1493 'default' => '\''.$db->escape($default_style).'\''
1494 ),
1495 'num_posts' => array(
1496 'datatype' => 'INT(10) UNSIGNED',
1497 'allow_null' => false,
1498 'default' => '0'
1499 ),
1500 'last_post' => array(
1501 'datatype' => 'INT(10) UNSIGNED',
1502 'allow_null' => true
1503 ),
1504 'last_search' => array(
1505 'datatype' => 'INT(10) UNSIGNED',
1506 'allow_null' => true
1507 ),
1508 'last_email_sent' => array(
1509 'datatype' => 'INT(10) UNSIGNED',
1510 'allow_null' => true
1511 ),
1512 'registered' => array(
1513 'datatype' => 'INT(10) UNSIGNED',
1514 'allow_null' => false,
1515 'default' => '0'
1516 ),
1517 'registration_ip' => array(
1518 'datatype' => 'VARCHAR(39)',
1519 'allow_null' => false,
1520 'default' => '\'0.0.0.0\''
1521 ),
1522 'last_visit' => array(
1523 'datatype' => 'INT(10) UNSIGNED',
1524 'allow_null' => false,
1525 'default' => '0'
1526 ),
1527 'admin_note' => array(
1528 'datatype' => 'VARCHAR(30)',
1529 'allow_null' => true
1530 ),
1531 'activate_string' => array(
1532 'datatype' => 'VARCHAR(80)',
1533 'allow_null' => true
1534 ),
1535 'activate_key' => array(
1536 'datatype' => 'VARCHAR(8)',
1537 'allow_null' => true
1538 ),
1539 ),
1540 'PRIMARY KEY' => array('id'),
1541 'UNIQUE KEYS' => array(
1542 'username_idx' => array('username')
1543 ),
1544 'INDEXES' => array(
1545 'registered_idx' => array('registered')
1546 )
1547 );
1548
1549 if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
1550 $schema['UNIQUE KEYS']['username_idx'] = array('username(25)');
1551
1552 $db->create_table('users', $schema) or error('Unable to create users table', __FILE__, __LINE__, $db->error());
1553
1554
1555 $now = time();
1556
1557 // Insert the four preset groups
28a2c1a @Quy Fixed install to use language entries "Administrator(s)".
Quy authored
1558 $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) 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)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1559
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
1560 $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) 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)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1561
d55266d @franzliedke #272: Add new language string to install.php for default name of Gues…
franzliedke authored
1562 $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) 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)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1563
e529c41 @franzliedke #272: Add new language string to install.php for default name of Memb…
franzliedke authored
1564 $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) 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)') or error('Unable to add group', __FILE__, __LINE__, $db->error());
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1565
1566 // Insert guest and first admin user
7dd337f @reines Fixing wrong language variable when inserting the guest user in insta…
reines authored
1567 $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']).'\')')
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1568 or error('Unable to add guest user. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
1569
96ab312 @reines Updating the install script to use the proper IP address, and the def…
reines authored
1570 $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.')')
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1571 or error('Unable to add administrator user. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
1572
1573 // Enable/disable avatars depending on file_uploads setting in PHP configuration
1574 $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0;
1575
1576 // Insert config data
1577 $config = array(
1578 'o_cur_version' => "'".FORUM_VERSION."'",
1579 'o_database_revision' => "'".FORUM_DB_REVISION."'",
1580 'o_searchindex_revision' => "'".FORUM_SI_REVISION."'",
1581 'o_parser_revision' => "'".FORUM_PARSER_REVISION."'",
1582 'o_board_title' => "'".$db->escape($title)."'",
1583 'o_board_desc' => "'".$db->escape($description)."'",
1584 'o_default_timezone' => "'0'",
1585 'o_time_format' => "'H:i:s'",
1586 'o_date_format' => "'Y-m-d'",
1587 'o_timeout_visit' => "'1800'",
1588 'o_timeout_online' => "'300'",
1589 'o_redirect_delay' => "'1'",
1590 'o_show_version' => "'0'",
1591 'o_show_user_info' => "'1'",
1592 'o_show_post_count' => "'1'",
1593 'o_signatures' => "'1'",
1594 'o_smilies' => "'1'",
1595 'o_smilies_sig' => "'1'",
1596 'o_make_links' => "'1'",
1597 'o_default_lang' => "'".$db->escape($default_lang)."'",
1598 'o_default_style' => "'".$db->escape($default_style)."'",
1599 'o_default_user_group' => "'4'",
1600 'o_topic_review' => "'15'",
1601 'o_disp_topics_default' => "'30'",
1602 'o_disp_posts_default' => "'25'",
1603 'o_indent_num_spaces' => "'4'",
1604 'o_quote_depth' => "'3'",
1605 'o_quickpost' => "'1'",
1606 'o_users_online' => "'1'",
1607 'o_censoring' => "'0'",
1608 'o_ranks' => "'1'",
1609 'o_show_dot' => "'0'",
1610 'o_topic_views' => "'1'",
1611 'o_quickjump' => "'1'",
1612 'o_gzip' => "'0'",
1613 'o_additional_navlinks' => "''",
1614 'o_report_method' => "'0'",
1615 'o_regs_report' => "'0'",
1616 'o_default_email_setting' => "'1'",
1617 'o_mailing_list' => "'".$email."'",
1618 'o_avatars' => "'".$avatars."'",
1619 'o_avatars_dir' => "'img/avatars'",
1620 'o_avatars_width' => "'60'",
1621 'o_avatars_height' => "'60'",
1622 'o_avatars_size' => "'10240'",
1623 'o_search_all_forums' => "'1'",
1624 'o_base_url' => "'".$db->escape($base_url)."'",
1625 'o_admin_email' => "'".$email."'",
1626 'o_webmaster_email' => "'".$email."'",
1016a03 @franzliedke Ticket #142: Add option for switching forum subscriptions on/off.
franzliedke authored
1627 'o_forum_subscriptions' => "'1'",
1628 'o_topic_subscriptions' => "'1'",
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1629 'o_smtp_host' => "NULL",
1630 'o_smtp_user' => "NULL",
1631 'o_smtp_pass' => "NULL",
1632 'o_smtp_ssl' => "'0'",
1633 'o_regs_allow' => "'1'",
1634 'o_regs_verify' => "'0'",
1635 'o_announcement' => "'0'",
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
1636 'o_announcement_message' => "'".$db->escape($lang_install['Announcement'])."'",
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1637 'o_rules' => "'0'",
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
1638 'o_rules_message' => "'".$db->escape($lang_install['Rules'])."'",
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1639 'o_maintenance' => "'0'",
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
1640 'o_maintenance_message' => "'".$db->escape($lang_install['Maintenance message'])."'",
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1641 'o_default_dst' => "'0'",
1642 'o_feed_type' => "'2'",
d95bfba @reines Adding caching for syndication.
reines authored
1643 'o_feed_ttl' => "'0'",
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1644 'p_message_bbcode' => "'1'",
1645 'p_message_img_tag' => "'1'",
1646 'p_message_all_caps' => "'1'",
1647 'p_subject_all_caps' => "'1'",
1648 'p_sig_all_caps' => "'1'",
1649 'p_sig_bbcode' => "'1'",
1650 'p_sig_img_tag' => "'0'",
1651 'p_sig_length' => "'400'",
1652 'p_sig_lines' => "'4'",
1653 'p_allow_banned_email' => "'1'",
1654 'p_allow_dupe_email' => "'0'",
1655 'p_force_guest_email' => "'1'"
1656 );
1657
1658 foreach ($config as $conf_name => $conf_value)
1659 {
1660 $db->query('INSERT INTO '.$db_prefix."config (conf_name, conf_value) VALUES('$conf_name', $conf_value)")
1661 or error('Unable to insert into table '.$db_prefix.'config. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
1662 }
1663
1664 // Insert some other default data
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
1665 $subject = $lang_install['Test post'];
1666 $message = $lang_install['Message'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1667
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored
1668 $db->query('INSERT INTO '.$db_prefix.'ranks (rank, min_posts) VALUES(\''.$db->escape($lang_install['New member']).'\', 0)')
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1669 or error('Unable to insert into table '.$db_prefix.'ranks. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
1670
5578ed0 @reines Importing localized version of install.php, done by adaur.
reines authored