Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 1205 lines (1019 sloc) 55.152 kb
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1 <?php
2
3 /**
7c5edc2 @reines Updating copyright notices for 2012
reines authored
4 * Copyright (C) 2008-2012 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
60643e4 @reines Bumping version number to 1.4.8
reines authored
10 define('FORUM_VERSION', '1.4.8');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
11
c7ed3fd @franzliedke Add latest database changes to install.php, too.
franzliedke authored
12 define('FORUM_DB_REVISION', 15);
93b4980 @reines Changing the regular expressions to use \p{L} instead of \w and \P{L} in...
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} in...
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 AP...
reines authored
23 define('PUN_ROOT', dirname(__FILE__).'/');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
24
25 // Load the functions script
26 require PUN_ROOT.'include/functions.php';
27
28 // Load UTF-8 functions
8299d49 @reines Moving modules into a modules folder instead.
reines authored
29 require PUN_ROOT.'modules/utf8/php-utf8.php';
30 require PUN_ROOT.'modules/utf8/functions/trim.php';
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
31
32 // Strip out "bad" UTF-8 characters
33 forum_remove_bad_characters();
34
35 // Reverse the effect of register_globals
36 forum_unregister_globals();
37
38 // Disable error reporting for uninitialized variables
39 error_reporting(E_ALL);
40
41 // Force POSIX locale (to prevent functions such as strtolower() from messing up UTF-8 strings)
42 setlocale(LC_CTYPE, 'C');
43
44 // Turn off magic_quotes_runtime
45 if (get_magic_quotes_runtime())
46 set_magic_quotes_runtime(0);
47
48 // Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
49 if (get_magic_quotes_gpc())
50 {
51 function stripslashes_array($array)
52 {
53 return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
54 }
55
56 $_GET = stripslashes_array($_GET);
57 $_POST = stripslashes_array($_POST);
58 $_COOKIE = stripslashes_array($_COOKIE);
59 $_REQUEST = stripslashes_array($_REQUEST);
60 }
61
62 // Turn off PHP time limit
63 @set_time_limit(0);
64
60d300b @franzliedke #399: Move around some code in install.php to prevent forum_unregister_g...
franzliedke authored
65
66 if (file_exists(PUN_ROOT.'config.php'))
67 {
68 // Check to see whether FluxBB is already installed
69 include PUN_ROOT.'config.php';
70
71 // 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
72 if (defined('FORUM'))
73 define('PUN', FORUM);
74 }
75
76 // If the cache directory is not specified, we use the default setting
77 if (!defined('FORUM_CACHE_DIR'))
78 define('FORUM_CACHE_DIR', PUN_ROOT.'cache/');
79
acd62d7 @daris Cache system needs to be loaded before language system in install.php (r...
daris authored
80 // Load the cache module
f90f415 @reines Updating cache module, now uses namespaces.
reines authored
81 require PUN_ROOT.'modules/cache/src/cache.php';
82 // Use a dummy cache since we don't know what cache type the user wants to use yet
83 $cache = \fluxbb\cache\Cache::load('Dummy', array(), 'VarExport', array());
acd62d7 @daris Cache system needs to be loaded before language system in install.php (r...
daris authored
84
4a96df3 @daris Fix the error in install.php: Call to a member function setLanguage() on...
daris authored
85 // Load the language system
86 require PUN_ROOT.'include/classes/lang.php';
87 $lang = new Flux_Lang();
88
89 // If we've been passed a default language, use it
90 $install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English';
91 $lang->setLanguage($install_lang);
92
93 // Load the install.php language file
94 $lang->load('install');
95
96 // If PUN is defined, config.php is probably valid and thus the software is installed
97 if (defined('PUN'))
98 exit($lang->t('Already installed'));
99
100 // Define PUN because email.php requires it
101 define('PUN', 1);
102
60d300b @franzliedke #399: Move around some code in install.php to prevent forum_unregister_g...
franzliedke authored
103 // Make sure we are running at least MIN_PHP_VERSION
104 if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<'))
a5a577f @daris Use $lang->t() instead of sprintf/printf
daris authored
105 exit($lang->t('You are running error', 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION));
60d300b @franzliedke #399: Move around some code in install.php to prevent forum_unregister_g...
franzliedke authored
106
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
107 // Load the DB module
108 require PUN_ROOT.'modules/database/src/Database/Adapter.php';
109
60d300b @franzliedke #399: Move around some code in install.php to prevent forum_unregister_g...
franzliedke authored
110
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
111 //
112 // Generate output to be used for config.php
113 //
114 function generate_config_file()
115 {
9ed575a @daris #543 Move base_url variable from database to config.php
daris authored
116 global $db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix, $cookie_name, $cookie_seed, $base_url;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
117
ee03b6f @daris #550 Apply changes in cache module to the core
daris authored
118 return '<?php'."\n\n".'$flux_config = array();'."\n\n".'$flux_config[\'db\'][\'type\'] = \''.$db_type."';\n".'$flux_config[\'db\'][\'host\'] = \''.$db_host."';\n".'$flux_config[\'db\'][\'dbname\'] = \''.addslashes($db_name)."';\n".'$flux_config[\'db\'][\'username\'] = \''.addslashes($db_username)."';\n".'$flux_config[\'db\'][\'password\'] = \''.addslashes($db_password)."';\n".'$flux_config[\'db\'][\'prefix\'] = \''.addslashes($db_prefix)."';\n\n".'$flux_config[\'cache\'][\'type\'] = '."'File';\n".'$flux_config[\'cache\'][\'dir\'] = PUN_ROOT.\'cache/\';'."\n\n".'$flux_config[\'cookie\'][\'name\'] = '."'".$cookie_name."';\n".'$flux_config[\'cookie\'][\'domain\'] = '."'';\n".'$flux_config[\'cookie\'][\'path\'] = '."'/';\n".'$flux_config[\'cookie\'][\'secure\'] = 0;'."\n".'$flux_config[\'cookie\'][\'seed\'] = \''.random_key(16, false, true).'\';'."\n\n".'$flux_config[\'base_url\'] = \''.$base_url.'\';'."\n\n".'define(\'PUN\', 1);'."\n";
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
119 }
120
121
122 if (isset($_POST['generate_config']))
123 {
124 header('Content-Type: text/x-delimtext; name="config.php"');
125 header('Content-disposition: attachment; filename=config.php');
126
127 $db_type = $_POST['db_type'];
128 $db_host = $_POST['db_host'];
129 $db_name = $_POST['db_name'];
130 $db_username = $_POST['db_username'];
a7a07c2 @reines Fixing wrong variable name in install.php
reines authored
131 $db_password = $_POST['db_password'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
132 $db_prefix = $_POST['db_prefix'];
133 $cookie_name = $_POST['cookie_name'];
134 $cookie_seed = $_POST['cookie_seed'];
9ed575a @daris #543 Move base_url variable from database to config.php
daris authored
135 $base_url = $_POST['base_url'];
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
136
137 echo generate_config_file();
138 exit;
139 }
140
141
142 if (!isset($_POST['form_sent']))
143 {
144 // Make an educated guess regarding base_url
145 $base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://'; // protocol
b1deb69 @reines Updating all the regular expressions to use % as a delimiter. Before we ...
reines authored
146 $base_url .= preg_replace('%:(80|443)$%', '', $_SERVER['HTTP_HOST']); // host[:port]
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
147 $base_url .= str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])); // path
148
149 if (substr($base_url, -1) == '/')
150 $base_url = substr($base_url, 0, -1);
151
982711f @franzliedke Don't fill out password fields again in the install script. This might b...
franzliedke authored
152 $db_type = $db_name = $db_username = $db_prefix = $username = $email = '';
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
153 $db_host = 'localhost';
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
154 $title = $lang->t('My FluxBB Forum');
155 $description = '<p><span>'.$lang->t('Description').'</span></p>';
4b14352 @reines Fixing the install language being lost upon errors on the second install...
reines authored
156 $default_lang = $install_lang;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
157 $default_style = 'Air';
158 }
159 else
160 {
161 $db_type = $_POST['req_db_type'];
162 $db_host = pun_trim($_POST['req_db_host']);
163 $db_name = pun_trim($_POST['req_db_name']);
164 $db_username = pun_trim($_POST['db_username']);
3502425 Removed the database password confirmation in install.php.
sexyprout authored
165 $db_password = pun_trim($_POST['db_password']);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
166 $db_prefix = pun_trim($_POST['db_prefix']);
167 $username = pun_trim($_POST['req_username']);
168 $email = strtolower(pun_trim($_POST['req_email']));
169 $password1 = pun_trim($_POST['req_password1']);
170 $password2 = pun_trim($_POST['req_password2']);
171 $title = pun_trim($_POST['req_title']);
172 $description = pun_trim($_POST['desc']);
173 $base_url = pun_trim($_POST['req_base_url']);
174 $default_lang = pun_trim($_POST['req_default_lang']);
175 $default_style = pun_trim($_POST['req_default_style']);
176 $alerts = array();
177
178 // Make sure base_url doesn't end with a slash
179 if (substr($base_url, -1) == '/')
180 $base_url = substr($base_url, 0, -1);
181
182 // Validate username and passwords
183 if (pun_strlen($username) < 2)
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
184 $alerts[] = $lang->t('Username 1');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
185 else if (pun_strlen($username) > 25) // This usually doesn't happen since the form element only accepts 25 characters
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
186 $alerts[] = $lang->t('Username 2');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
187 else if (!strcasecmp($username, 'Guest'))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
188 $alerts[] = $lang->t('Username 3');
b1deb69 @reines Updating all the regular expressions to use % as a delimiter. Before we ...
reines authored
189 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))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
190 $alerts[] = $lang->t('Username 4');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
191 else if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
192 $alerts[] = $lang->t('Username 5');
b1deb69 @reines Updating all the regular expressions to use % as a delimiter. Before we ...
reines authored
193 else if (preg_match('%(?:\[/?(?:b|u|i|h|colou?r|quote|code|img|url|email|list)\]|\[(?:code|quote|list)=)%i', $username))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
194 $alerts[] = $lang->t('Username 6');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
195
196 if (pun_strlen($password1) < 4)
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
197 $alerts[] = $lang->t('Short password');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
198 else if ($password1 != $password2)
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
199 $alerts[] = $lang->t('Passwords not match');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
200
201 // Validate email
202 require PUN_ROOT.'include/email.php';
203
204 if (!is_valid_email($email))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
205 $alerts[] = $lang->t('Wrong email');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
206
207 if ($title == '')
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
208 $alerts[] = $lang->t('No board title');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
209
376cbdc @franzliedke #502: Add and use some utility functions for handling existing languages...
franzliedke authored
210 if (!Flux_Lang::languageExists($default_lang))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
211 $alerts[] = $lang->t('Error default language');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
212
476486a @reines Updating the language and style checks to match elsewhere.
reines authored
213 $styles = forum_list_styles();
214 if (!in_array($default_style, $styles))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
215 $alerts[] = $lang->t('Error default style');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
216 }
217
06732db @reines Check the cache directory and avatar directory are writable at the start...
reines authored
218 // Check if the cache directory is writable
1f50478 @franzliedke #509: Provide a Windows-ACL-safe implementation of is_writable().
franzliedke authored
219 if (!forum_is_writable(FORUM_CACHE_DIR))
a5a577f @daris Use $lang->t() instead of sprintf/printf
daris authored
220 $alerts[] = $lang->t('Alert cache', FORUM_CACHE_DIR);
06732db @reines Check the cache directory and avatar directory are writable at the start...
reines authored
221
222 // Check if default avatar directory is writable
1f50478 @franzliedke #509: Provide a Windows-ACL-safe implementation of is_writable().
franzliedke authored
223 if (!forum_is_writable(PUN_ROOT.'img/avatars/'))
a5a577f @daris Use $lang->t() instead of sprintf/printf
daris authored
224 $alerts[] = $lang->t('Alert avatar', PUN_ROOT.'img/avatars/');
06732db @reines Check the cache directory and avatar directory are writable at the start...
reines authored
225
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
226 if (!isset($_POST['form_sent']) || !empty($alerts))
227 {
228 // Determine available database extensions
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
229 $db_extensions = Flux_Database_Adapter::getDriverList();
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
230
231 if (empty($db_extensions))
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
232 error($lang->t('No DB extensions'));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
233
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
234 // Fetch a list of installed languages
376cbdc @franzliedke #502: Add and use some utility functions for handling existing languages...
franzliedke authored
235 $languages = Flux_Lang::getLanguageList();
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
236
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
237 ?>
238 <!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
239 <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
240 <head>
241 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
242 <title><?php echo $lang->t('FluxBB Installation') ?></title>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
243 <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" />
244 <script type="text/javascript">
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
245 /* <![CDATA[ */
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
246 function process_form(the_form)
247 {
52208b8 @daris #522 Apply required fields changes to the install.php
daris authored
248 var required_fields = {
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
249 "req_db_type": "<?php echo $lang->t('Database type') ?>",
250 "req_db_host": "<?php echo $lang->t('Database server hostname') ?>",
251 "req_db_name": "<?php echo $lang->t('Database name') ?>",
252 "req_username": "<?php echo $lang->t('Administrator username') ?>",
253 "req_password1": "<?php echo $lang->t('Administrator password 1') ?>",
254 "req_password2": "<?php echo $lang->t('Administrator password 2') ?>",
255 "req_email": "<?php echo $lang->t('Administrator email') ?>",
256 "req_title": "<?php echo $lang->t('Board title') ?>",
257 "req_base_url": "<?php echo $lang->t('Base URL') ?>"
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
258 };
6bde987 @reines Merge branch 'fluxbb-1.4' into fluxbb-2.0
reines authored
259
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
260 if (document.all || document.getElementById)
261 {
262 for (var i = 0; i < the_form.length; ++i)
263 {
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
264 var elem = the_form.elements[i];
52208b8 @daris #522 Apply required fields changes to the install.php
daris authored
265 if (elem.name && required_fields[elem.name] && !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
266 {
52208b8 @daris #522 Apply required fields changes to the install.php
daris authored
267 alert('"' + required_fields[elem.name] + '" <?php echo $lang_install['Required field'] ?>');
268 elem.focus();
269 return false;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
270 }
271 }
272 }
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
273 return true;
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
274 }
0152ebe @ridgerunner Streamlined process_form() Javascript function.
ridgerunner authored
275 /* ]]> */
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
276 </script>
277 </head>
8026f00 @reines Fixing the onload behaviour when pressing the back button in firefox. Se...
reines authored
278 <body onload="document.getElementById('install').req_db_type.focus();document.getElementById('install').start.disabled=false;" onunload="">
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
279
280 <div id="puninstall" class="pun">
281 <div class="top-box"><div><!-- Top Corners --></div></div>
282 <div class="punwrap">
283
284 <div id="brdheader" class="block">
285 <div class="box">
286 <div id="brdtitle" class="inbox">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
287 <h1><span><?php echo $lang->t('FluxBB Installation') ?></span></h1>
288 <div id="brddesc"><p><?php echo $lang->t('Install message') ?></p><p><?php echo $lang->t('Welcome') ?></p></div>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
289 </div>
290 </div>
291 </div>
292
293 <div id="brdmain">
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
294 <?php if (count($languages) > 1): ?><div class="blockform">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
295 <h2><span><?php echo $lang->t('Choose install language') ?></span></h2>
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
296 <div class="box">
297 <form id="install" method="post" action="install.php">
298 <div class="inform">
299 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
300 <legend><?php echo $lang->t('Install language') ?></legend>
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
301 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
302 <p><?php echo $lang->t('Choose install language info') ?></p>
303 <label><strong><?php echo $lang->t('Install language') ?></strong>
4b14352 @reines Fixing the install language being lost upon errors on the second install...
reines authored
304 <br /><select name="install_lang">
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
305 <?php
306
307 foreach ($languages as $temp)
308 {
4b14352 @reines Fixing the install language being lost upon errors on the second install...
reines authored
309 if ($temp == $install_lang)
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
310 echo "\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
311 else
312 echo "\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
313 }
314
315 ?>
316 </select>
317 <br /></label>
318 </div>
319 </fieldset>
320 </div>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
321 <p class="buttons"><input type="submit" name="start" value="<?php echo $lang->t('Change language') ?>" /></p>
75fd0d1 @reines If no installation is found redirect to install.php instead of displayin...
reines authored
322 </form>
323 </div>
324 </div>
325 <?php endif; ?>
326
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
327 <div class="blockform">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
328 <h2><span><?php echo $lang->t('Install') ?></span></h2>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
329 <div class="box">
330 <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 install...
reines authored
331 <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
332 <div class="inform">
333 <?php if (!empty($alerts)): ?> <div class="forminfo error-info">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
334 <h3><?php echo $lang->t('Errors') ?></h3>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
335 <ul class="error-list">
336 <?php
337
338 foreach ($alerts as $cur_alert)
339 echo "\t\t\t\t\t\t".'<li><strong>'.$cur_alert.'</strong></li>'."\n";
340 ?>
341 </ul>
342 </div>
343 <?php endif; ?> </div>
344 <div class="inform">
345 <div class="forminfo">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
346 <h3><?php echo $lang->t('Database setup') ?></h3>
347 <p><?php echo $lang->t('Info 1') ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
348 </div>
349 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
350 <legend><?php echo $lang->t('Select database') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
351 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
352 <p><?php echo $lang->t('Info 2') ?></p>
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
353 <?php /*if ($dual_mysql): ?> <p><?php echo $lang->t('Dual MySQL') ?></p>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
354 <?php endif; ?><?php if ($mysql_innodb): ?> <p><?php echo $lang->t('InnoDB') ?></p>
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
355 <?php endif;*/ ?> <label class="required"><strong><?php echo $lang->t('Database type') ?> <span><?php echo $lang->t('Required') ?></span></strong>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
356 <br /><select name="req_db_type">
357 <?php
358
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
359 foreach ($db_extensions as $cur_extension)
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
360 {
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
361 if ($cur_extension == $db_type)
362 echo "\t\t\t\t\t\t\t".'<option value="'.$cur_extension.'" selected="selected">'.$cur_extension.'</option>'."\n";
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
363 else
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
364 echo "\t\t\t\t\t\t\t".'<option value="'.$cur_extension.'">'.$cur_extension.'</option>'."\n";
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
365 }
366
367 ?>
368 </select>
369 <br /></label>
370 </div>
371 </fieldset>
372 </div>
373 <div class="inform">
374 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
375 <legend><?php echo $lang->t('Database hostname') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
376 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
377 <p><?php echo $lang->t('Info 3') ?></p>
378 <label class="required"><strong><?php echo $lang->t('Database server hostname') ?> <span><?php echo $lang->t('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
379 </div>
380 </fieldset>
381 </div>
382 <div class="inform">
383 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
384 <legend><?php echo $lang->t('Database enter name') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
385 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
386 <p><?php echo $lang->t('Info 4') ?></p>
387 <label class="required"><strong><?php echo $lang->t('Database name') ?> <span><?php echo $lang->t('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
388 </div>
389 </fieldset>
390 </div>
391 <div class="inform">
392 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
393 <legend><?php echo $lang->t('Database enter informations') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
394 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
395 <p><?php echo $lang->t('Info 5') ?></p>
396 <label class="conl"><?php echo $lang->t('Database username') ?><br /><input type="text" name="db_username" value="<?php echo pun_htmlspecialchars($db_username) ?>" size="30" /><br /></label>
397 <label class="conl"><?php echo $lang->t('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
398 <div class="clearer"></div>
399 </div>
400 </fieldset>
401 </div>
402 <div class="inform">
403 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
404 <legend><?php echo $lang->t('Database enter prefix') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
405 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
406 <p><?php echo $lang->t('Info 6') ?></p>
407 <label><?php echo $lang->t('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
408 </div>
409 </fieldset>
410 </div>
411 <div class="inform">
412 <div class="forminfo">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
413 <h3><?php echo $lang->t('Administration setup') ?></h3>
414 <p><?php echo $lang->t('Info 7') ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
415 </div>
416 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
417 <legend><?php echo $lang->t('Admin enter username') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
418 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
419 <p><?php echo $lang->t('Info 8') ?></p>
420 <label class="required"><strong><?php echo $lang->t('Administrator username') ?> <span><?php echo $lang->t('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
421 </div>
422 </fieldset>
423 </div>
424 <div class="inform">
425 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
426 <legend><?php echo $lang->t('Admin enter password') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
427 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
428 <p><?php echo $lang->t('Info 9') ?></p>
429 <label class="conl required"><strong><?php echo $lang->t('Password') ?> <span><?php echo $lang->t('Required') ?></span></strong><br /><input id="req_password1" type="password" name="req_password1" size="16" /><br /></label>
430 <label class="conl required"><strong><?php echo $lang->t('Confirm password') ?> <span><?php echo $lang->t('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
431 <div class="clearer"></div>
432 </div>
433 </fieldset>
434 </div>
435 <div class="inform">
436 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
437 <legend><?php echo $lang->t('Admin enter email') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
438 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
439 <p><?php echo $lang->t('Info 10') ?></p>
440 <label class="required"><strong><?php echo $lang->t('Administrator email') ?> <span><?php echo $lang->t('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
441 </div>
442 </fieldset>
443 </div>
444 <div class="inform">
445 <div class="forminfo">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
446 <h3><?php echo $lang->t('Board setup') ?></h3>
447 <p><?php echo $lang->t('Info 11') ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
448 </div>
449 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
450 <legend><?php echo $lang->t('Enter board title') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
451 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
452 <p><?php echo $lang->t('Info 12') ?></p>
453 <label class="required"><strong><?php echo $lang->t('Board title') ?> <span><?php echo $lang->t('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
454 </div>
455 </fieldset>
456 </div>
457 <div class="inform">
458 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
459 <legend><?php echo $lang->t('Enter board description') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
460 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
461 <p><?php echo $lang->t('Info 13') ?></p>
462 <label><?php echo $lang->t('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
463 </div>
464 </fieldset>
465 </div>
466 <div class="inform">
467 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
468 <legend><?php echo $lang->t('Enter base URL') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
469 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
470 <p><?php echo $lang->t('Info 14') ?></p>
471 <label class="required"><strong><?php echo $lang->t('Base URL') ?> <span><?php echo $lang->t('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
472 </div>
473 </fieldset>
474 </div>
475 <div class="inform">
476 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
477 <legend><?php echo $lang->t('Choose the default language') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
478 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
479 <p><?php echo $lang->t('Info 15') ?></p>
480 <label class="required"><strong><?php echo $lang->t('Default language') ?> <span><?php echo $lang->t('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
481 <?php
482
376cbdc @franzliedke #502: Add and use some utility functions for handling existing languages...
franzliedke authored
483 $languages = Flux_Lang::getLanguageList();
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
484 foreach ($languages as $temp)
485 {
486 if ($temp == $default_lang)
487 echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.$temp.'</option>'."\n";
488 else
489 echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.$temp.'</option>'."\n";
490 }
491
492 ?>
493 </select><br /></label>
494 </div>
495 </fieldset>
496 </div>
497 <div class="inform">
498 <fieldset>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
499 <legend><?php echo $lang->t('Choose the default style') ?></legend>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
500 <div class="infldset">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
501 <p><?php echo $lang->t('Info 16') ?></p>
502 <label class="required"><strong><?php echo $lang->t('Default style') ?> <span><?php echo $lang->t('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
503 <?php
504
505 $styles = forum_list_styles();
506 foreach ($styles as $temp)
507 {
508 if ($temp == $default_style)
509 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n";
510 else
511 echo "\t\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n";
512 }
513
514 ?>
515 </select><br /></label>
516 </div>
517 </fieldset>
518 </div>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
519 <p class="buttons"><input type="submit" name="start" value="<?php echo $lang->t('Start install') ?>" /></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
520 </form>
521 </div>
522 </div>
523 </div>
524
525 </div>
526 <div class="end-box"><div><!-- Bottom Corners --></div></div>
527 </div>
528
529 </body>
530 </html>
531 <?php
532
533 }
534 else
535 {
40650c6 @daris Use getDriverList() to get the available db drivers in install script
daris authored
536 if (!Flux_Database_Adapter::driverExists($db_type))
537 error($lang->t('DB type not valid', pun_htmlspecialchars($db_type)));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
538
539 // Create the database object (and connect/select db)
c0fc4d8 @daris Update install.php to use new database layer
daris authored
540 $options = array('host' => $db_host, 'dbname' => $db_name, 'username' => $db_username, 'password' => $db_password, 'prefix' => $db_prefix);
541 $db = Flux_Database_Adapter::factory($db_type, $options);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
542
543 // Validate prefix
b1deb69 @reines Updating all the regular expressions to use % as a delimiter. Before we ...
reines authored
544 if (strlen($db_prefix) > 0 && (!preg_match('%^[a-zA-Z_][a-zA-Z0-9_]*$%', $db_prefix) || strlen($db_prefix) > 40))
a5a577f @daris Use $lang->t() instead of sprintf/printf
daris authored
545 error($lang->t('Table prefix error', $db->prefix));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
546
547 // Do some DB type specific checks
548 switch ($db_type)
549 {
c0fc4d8 @daris Update install.php to use new database layer
daris authored
550 // TODO: fix the version checks
551 // case 'mysql':
552 // case 'mysqli':
553 // case 'mysql_innodb':
554 // case 'mysqli_innodb':
555 // $mysql_info = $db->getVersion();
556 // if (version_compare($mysql_info['version'], MIN_MYSQL_VERSION, '<'))
557 // error($lang->t('You are running error', 'MySQL', $mysql_info['version'], FORUM_VERSION, MIN_MYSQL_VERSION));
558 // break;
559
560 // case 'pgsql':
561 // $pgsql_info = $db->getVersion();
562 // if (version_compare($pgsql_info['version'], MIN_PGSQL_VERSION, '<'))
563 // error($lang->t('You are running error', 'PostgreSQL', $pgsql_info['version'], FORUM_VERSION, MIN_PGSQL_VERSION));
564 // break;
565
566 case 'SQLite':
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
567 if (strtolower($db_prefix) == 'sqlite_')
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
568 error($lang->t('Prefix reserved'));
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
569 break;
570 }
571
c0fc4d8 @daris Update install.php to use new database layer
daris authored
572 if ($db->tableExists('users')->run())
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
573 {
c0fc4d8 @daris Update install.php to use new database layer
daris authored
574 // Make sure FluxBB isn't already installed
6a0fd56 @franzliedke Convert another query to the proper object-oriented system in install.ph...
franzliedke authored
575 $query = $db->select(array('1' => '1'), 'users AS u');
576 $query->where = 'id = :id';
577 $params = array(':id' => 1);
f918587 @franzliedke Fix query in install.php.
franzliedke authored
578 $result = $query->run($params);
e8a97f6 @daris Fix the table name for the existing table error in install.php
daris authored
579
f918587 @franzliedke Fix query in install.php.
franzliedke authored
580 if (!empty($result))
e8a97f6 @daris Fix the table name for the existing table error in install.php
daris authored
581 error($lang->t('Existing table error', $db->prefix.'users', $db_name));
582
f918587 @franzliedke Fix query in install.php.
franzliedke authored
583 unset($query, $params, $result);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
584 }
585
586 // Start a transaction
7c97871 @daris Updating to use new db layer
daris authored
587 $db->startTransaction();
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
588
589 // Create all tables
c0fc4d8 @daris Update install.php to use new database layer
daris authored
590 $query = $db->createTable('bans');
591 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
592 $query->field('username', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200));
593 $query->field('ip', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(255));
594 $query->field('email', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80));
595 $query->field('message', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(255));
41e9e50 @daris Use new column types in install.php
daris authored
596 $query->field('expire', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
597 $query->field('ban_creator', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
598
41e9e50 @daris Use new column types in install.php
daris authored
599 $query->index('username_idx', array('username' => 'username(25)'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
600 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
601 $query->run();
602
603 unset ($query);
604
605 $query = $db->createTable('categories');
606 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
607 $query->field('cat_name', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80), 'New Category', false);
608 $query->field('disp_position', Flux_Database_Query_Helper_TableColumn::TYPE_INT, 0, false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
609 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
610 $query->run();
611
612 unset ($query);
613
614 $query = $db->createTable('censoring');
615 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
616 $query->field('search_for', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(60), '', false);
617 $query->field('replace_with', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(60), '', false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
618 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
619 $query->run();
620
621 unset ($query);
622
623 $query = $db->createTable('config');
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
624 $query->field('conf_name', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(255), '', true);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
625 $query->field('conf_value', Flux_Database_Query_Helper_TableColumn::TYPE_TEXT);
943bf19 @daris Set primary keys for tables in install.php
daris authored
626
627 $query->index('PRIMARY', array('conf_name'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
628 $query->run();
629
630 unset ($query);
631
632 $query = $db->createTable('forum_perms');
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
633 $query->field('group_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT, 0, true);
634 $query->field('forum_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
635 $query->field('read_forum', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
636 $query->field('post_replies', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
637 $query->field('post_topics', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
638
639 $query->index('PRIMARY', array('group_id', 'forum_id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
640 $query->run();
641
642 unset ($query);
643
644 $query = $db->createTable('forums');
645 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
646 $query->field('forum_name', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80), 'New forum', false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
647 $query->field('forum_desc', Flux_Database_Query_Helper_TableColumn::TYPE_TEXT);
648 $query->field('redirect_url', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(100));
649 $query->field('moderators', Flux_Database_Query_Helper_TableColumn::TYPE_TEXT);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
650 $query->field('num_topics', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMINT_UNSIGNED, 0, false);
651 $query->field('num_posts', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMINT_UNSIGNED, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
652 $query->field('last_post', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
653 $query->field('last_post_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
654 $query->field('last_poster', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200));
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
655 $query->field('sort_by', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
656 $query->field('disp_position', Flux_Database_Query_Helper_TableColumn::TYPE_INT, 0, false);
657 $query->field('cat_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
658 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
659 $query->run();
660
661 unset ($query);
662
663 $query = $db->createTable('groups');
664 $query->field('g_id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
665 $query->field('g_title', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(50), '', false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
666 $query->field('g_user_title', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(50));
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
667 $query->field('g_moderator', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
668 $query->field('g_mod_edit_users', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
669 $query->field('g_mod_rename_users', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
670 $query->field('g_mod_change_passwords', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
671 $query->field('g_mod_ban_users', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
672 $query->field('g_read_board', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
673 $query->field('g_view_users', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
674 $query->field('g_post_replies', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
675 $query->field('g_post_topics', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
676 $query->field('g_edit_posts', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
677 $query->field('g_delete_posts', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
678 $query->field('g_delete_topics', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
679 $query->field('g_set_title', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
680 $query->field('g_search', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
681 $query->field('g_search_users', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
682 $query->field('g_send_email', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
683 $query->field('g_post_flood', Flux_Database_Query_Helper_TableColumn::TYPE_SMALLINT, 30, false);
684 $query->field('g_search_flood', Flux_Database_Query_Helper_TableColumn::TYPE_SMALLINT, 30, false);
685 $query->field('g_email_flood', Flux_Database_Query_Helper_TableColumn::TYPE_SMALLINT, 60, false);
686 $query->field('g_report_flood', Flux_Database_Query_Helper_TableColumn::TYPE_SMALLINT, 60, false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
687 $query->index('PRIMARY', array('g_id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
688 $query->run();
689
690 unset ($query);
691
692 $query = $db->createTable('online');
41e9e50 @daris Use new column types in install.php
daris authored
693 $query->field('user_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 1, false);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
694 $query->field('ident', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200), '', false);
695 $query->field('logged', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
696 $query->field('idle', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
697 $query->field('last_post', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
698 $query->field('last_search', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
699
41e9e50 @daris Use new column types in install.php
daris authored
700 $query->index('user_id_ident_idx', array('user_id', 'ident' => 'ident(25)'), true);
701 $query->index('ident_idx', array('ident' => 'ident(25)'));
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
702 $query->index('logged_idx', array('logged'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
703 $query->run();
704
705 unset ($query);
706
707 $query = $db->createTable('posts');
708 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
709 $query->field('poster', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200), '', false);
41e9e50 @daris Use new column types in install.php
daris authored
710 $query->field('poster_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 1, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
711 $query->field('poster_ip', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(39));
712 $query->field('poster_email', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80));
41e9e50 @daris Use new column types in install.php
daris authored
713 $query->field('message', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMTEXT);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
714 $query->field('hide_smilies', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
715 $query->field('posted', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
716 $query->field('edited', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
717 $query->field('edited_by', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200));
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
718 $query->field('topic_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
719
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
720 $query->index('topic_id_idx', array('topic_id'));
721 $query->index('multi_idx', array('poster_id', 'topic_id'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
722 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
723 $query->run();
724
725 unset ($query);
726
727 $query = $db->createTable('ranks');
728 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
729 $query->field('rank', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(50), '', false);
730 $query->field('min_posts', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMINT_UNSIGNED, 0, false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
731 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
732 $query->run();
733
734 unset ($query);
735
736 $query = $db->createTable('reports');
737 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
738 $query->field('post_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
739 $query->field('topic_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
740 $query->field('forum_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
741 $query->field('reported_by', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
742 $query->field('created', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
743 $query->field('message', Flux_Database_Query_Helper_TableColumn::TYPE_TEXT);
41e9e50 @daris Use new column types in install.php
daris authored
744 $query->field('zapped', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
745 $query->field('zapped_by', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
746
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
747 $query->index('zapped_idx', array('zapped'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
748 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
749 $query->run();
750
751 unset ($query);
752
753 $query = $db->createTable('search_cache');
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
754 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
755 $query->field('ident', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200), '', false);
41e9e50 @daris Use new column types in install.php
daris authored
756 $query->field('search_data', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMTEXT);
757 $query->index('ident_idx', array('ident' => 'ident(8)'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
758 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
759 $query->run();
760
761 unset ($query);
762
763 $query = $db->createTable('search_matches');
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
764 $query->field('post_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
765 $query->field('word_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
766 $query->field('subject_match', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
767 $query->index('word_id_idx', array('word_id'));
768 $query->index('post_id_idx', array('post_id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
769 $query->run();
770
771 unset ($query);
772
773 $query = $db->createTable('search_words');
774 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
775 $query->field('word', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(20), '', true, 'bin');
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
776 $query->index('id_idx', array('id'));
41e9e50 @daris Use new column types in install.php
daris authored
777 $query->index('PRIMARY', array('word'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
778
779 if ($db_type == 'SQLite')
780 {
781 $query->primary = array('id');
41e9e50 @daris Use new column types in install.php
daris authored
782 $query->index('word_idx', array('word'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
783 }
c0fc4d8 @daris Update install.php to use new database layer
daris authored
784
943bf19 @daris Set primary keys for tables in install.php
daris authored
785 $query->run();
c0fc4d8 @daris Update install.php to use new database layer
daris authored
786
787 unset ($query);
788
789 $query = $db->createTable('topic_subscriptions');
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
790 $query->field('user_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
791 $query->field('topic_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
943bf19 @daris Set primary keys for tables in install.php
daris authored
792
793 $query->index('PRIMARY', array('user_id', 'topic_id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
794 $query->run();
795
796 unset ($query);
797
798 $query = $db->createTable('forum_subscriptions');
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
799 $query->field('user_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
800 $query->field('forum_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
943bf19 @daris Set primary keys for tables in install.php
daris authored
801
802 $query->index('PRIMARY', array('user_id', 'forum_id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
803 $query->run();
804
805 unset ($query);
806
807 $query = $db->createTable('topics');
808 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
809 $query->field('poster', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200), '', false);
810 $query->field('subject', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(255), '', false);
811 $query->field('posted', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
812 $query->field('first_post_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
813 $query->field('last_post', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
814 $query->field('last_post_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
815 $query->field('last_poster', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200));
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
816 $query->field('num_views', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMINT_UNSIGNED, 0, false);
817 $query->field('num_replies', Flux_Database_Query_Helper_TableColumn::TYPE_MEDIUMINT_UNSIGNED, 0, false);
818 $query->field('closed', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
819 $query->field('sticky', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
820 $query->field('moved_to', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
821 $query->field('forum_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
822
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
823 $query->index('forum_id_idx', array('forum_id'));
824 $query->index('moved_to_idx', array('moved_to'));
825 $query->index('last_post_idx', array('last_post'));
826 $query->index('first_post_id_idx', array('first_post_id'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
827 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
828 $query->run();
829
830 unset ($query);
831
832 $query = $db->createTable('users');
833 $query->field('id', Flux_Database_Query_Helper_TableColumn::TYPE_SERIAL);
41e9e50 @daris Use new column types in install.php
daris authored
834 $query->field('group_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 3, false);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
835 $query->field('username', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(200), '', false);
836 $query->field('password', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(40), '', false);
837 $query->field('email', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80), '', false);
838 $query->field('title', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(50), NULL);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
839 $query->field('realname', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(40));
840 $query->field('url', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(100));
841 $query->field('jabber', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80));
842 $query->field('icq', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(12));
843 $query->field('msn', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80));
844 $query->field('aim', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(30));
845 $query->field('yahoo', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(30));
846 $query->field('location', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(30));
847 $query->field('signature', Flux_Database_Query_Helper_TableColumn::TYPE_TEXT);
41e9e50 @daris Use new column types in install.php
daris authored
848 $query->field('disp_topics', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT_UNSIGNED);
849 $query->field('disp_posts', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT_UNSIGNED);
850
851 $query->field('email_setting', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
852 $query->field('notify_with_post', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
853 $query->field('auto_notify', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
854 $query->field('show_smilies', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
855 $query->field('show_img', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
856 $query->field('show_img_sig', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
857 $query->field('show_avatars', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
858 $query->field('show_sig', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 1, false);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
859 $query->field('timezone', Flux_Database_Query_Helper_TableColumn::TYPE_FLOAT, 0, false);
860 $query->field('dst', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
861 $query->field('time_format', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
862 $query->field('date_format', Flux_Database_Query_Helper_TableColumn::TYPE_TINYINT, 0, false);
863 $query->field('language', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(25),$default_lang, false);
864 $query->field('style', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(25), $default_style, false);
865 $query->field('num_posts', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
41e9e50 @daris Use new column types in install.php
daris authored
866 $query->field('last_post', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
867 $query->field('last_search', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
868 $query->field('last_email_sent', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
869 $query->field('last_report_sent', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED);
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
870 $query->field('registered', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
871 $query->field('registration_ip', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(39), '0.0.0.0', false);
872 $query->field('last_visit', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0, false);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
873 $query->field('admin_note', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(30));
874 $query->field('activate_string', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(80));
875 $query->field('activate_key', Flux_Database_Query_Helper_TableColumn::TYPE_VARCHAR(8));
3ecdf0a @daris Update default values for topic tracking tables
daris authored
876 $query->field('last_mark', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
877
41e9e50 @daris Use new column types in install.php
daris authored
878 $query->index('username_idx', array('username' => 'username(25)'), true);
ced1964 @daris Rewrite assigning indices to the new structure in install.php
daris authored
879 $query->index('registered_idx', array('registered'));
943bf19 @daris Set primary keys for tables in install.php
daris authored
880 $query->index('PRIMARY', array('id'));
c0fc4d8 @daris Update install.php to use new database layer
daris authored
881 $query->run();
882
883 unset ($query);
884
d76b16a @daris Implement read tracking system from phpbb3 - next part (not done fully y...
daris authored
885 $query = $db->createTable('forums_track');
3ecdf0a @daris Update default values for topic tracking tables
daris authored
886 $query->field('user_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
887 $query->field('forum_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
888 $query->field('mark_time', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
d76b16a @daris Implement read tracking system from phpbb3 - next part (not done fully y...
daris authored
889
890 $query->index('PRIMARY', array('user_id', 'forum_id'));
891 $query->run();
892
893 unset ($query);
894
895 $query = $db->createTable('topics_track');
3ecdf0a @daris Update default values for topic tracking tables
daris authored
896 $query->field('user_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
897 $query->field('topic_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
898 $query->field('forum_id', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
899 $query->field('mark_time', Flux_Database_Query_Helper_TableColumn::TYPE_INT_UNSIGNED, 0);
d76b16a @daris Implement read tracking system from phpbb3 - next part (not done fully y...
daris authored
900
901 $query->index('PRIMARY', array('user_id', 'topic_id'));
69ba317 @daris Add index for the forum_id field of the topics_track table
daris authored
902 $query->index('forum_id_idx', array('forum_id'));
d76b16a @daris Implement read tracking system from phpbb3 - next part (not done fully y...
daris authored
903 $query->run();
904
905 unset ($query);
906
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
907
908 $now = time();
909
910 // Insert the four preset groups
c0fc4d8 @daris Update install.php to use new database layer
daris authored
911 // TODO: should g_id be removed for the pgsql?
912 $query = $db->insert(array('g_id' => ':g_id', 'g_title' => ':g_title', 'g_user_title' => ':g_user_title', 'g_moderator' => ':g_moderator', 'g_mod_edit_users' => ':g_mod_edit_users', 'g_mod_rename_users' => ':g_mod_rename_users', 'g_mod_change_passwords' => ':g_mod_change_passwords', 'g_mod_ban_users' => ':g_mod_ban_users', 'g_read_board' => ':g_read_board', 'g_view_users' => ':g_view_users', 'g_post_replies' => ':g_post_replies', 'g_post_topics' => ':g_post_topics', 'g_edit_posts' => ':g_edit_posts', 'g_delete_posts' => ':g_delete_posts', 'g_delete_topics' => ':g_delete_topics', 'g_set_title' => ':g_set_title', 'g_search' => ':g_search', 'g_search_users' => ':g_search_users', 'g_send_email' => ':g_send_email', 'g_post_flood' => ':g_post_flood', 'g_search_flood' => ':g_search_flood', 'g_email_flood' => ':g_email_flood', 'g_report_flood' => ':g_report_flood'), 'groups');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
913
c0fc4d8 @daris Update install.php to use new database layer
daris authored
914 $params = array(':g_id' => 1, ':g_title' => $lang->t('Administrators'), ':g_user_title' => $lang->t('Administrator'), ':g_moderator' => 0, ':g_mod_edit_users' => 0, ':g_mod_rename_users' => 0, ':g_mod_change_passwords' => 0, ':g_mod_ban_users' => 0, ':g_read_board' => 1, ':g_view_users' => 1, ':g_post_replies' => 1, ':g_post_topics' => 1, ':g_edit_posts' => 1, ':g_delete_posts' => 1, ':g_delete_topics' => 1, ':g_set_title' => 1, ':g_search' => 1, ':g_search_users' => 1, ':g_send_email' => 1, ':g_post_flood' => 0, ':g_search_flood' => 0, ':g_email_flood' => 0, ':g_report_flood' => 0);
915 $query->run($params);
916 unset($params);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
917
c0fc4d8 @daris Update install.php to use new database layer
daris authored
918 $params = array(':g_id' => 2, ':g_title' => $lang->t('Moderators'), ':g_user_title' => $lang->t('Moderator'), ':g_moderator' => 1, ':g_mod_edit_users' => 1, ':g_mod_rename_users' => 1, ':g_mod_change_passwords' => 1, ':g_mod_ban_users' => 1, ':g_read_board' => 1, ':g_view_users' => 1, ':g_post_replies' => 1, ':g_post_topics' => 1, ':g_edit_posts' => 1, ':g_delete_posts' => 1, ':g_delete_topics' => 1, ':g_set_title' => 1, ':g_search' => 1, ':g_search_users' => 1, ':g_send_email' => 1, ':g_post_flood' => 0, ':g_search_flood' => 0, ':g_email_flood' => 0, ':g_report_flood' => 0);
919 $query->run($params);
920 unset($params);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
921
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
922 $params = array(':g_id' => 3, ':g_title' => $lang->t('Guests'), ':g_user_title' => NULL, ':g_moderator' => 0, ':g_mod_edit_users' => 0, ':g_mod_rename_users' => 0, ':g_mod_change_passwords' => 0, ':g_mod_ban_users' => 0, ':g_read_board' => 1, ':g_view_users' => 1, ':g_post_replies' => 0, ':g_post_topics' => 0, ':g_edit_posts' => 0, ':g_delete_posts' => 0, ':g_delete_topics' => 0, ':g_set_title' => 0, ':g_search' => 1, ':g_search_users' => 1, ':g_send_email' => 0, ':g_post_flood' => 60, ':g_search_flood' => 30, ':g_email_flood' => 0, ':g_report_flood' => 0);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
923 $query->run($params);
924 unset($params);
925
7a1373f @daris Do not quote default values in install.php as the database layer is doin...
daris authored
926 $params = array(':g_id' => 4, ':g_title' => $lang->t('Members'), ':g_user_title' => NULL, ':g_moderator' => 0, ':g_mod_edit_users' => 0, ':g_mod_rename_users' => 0, ':g_mod_change_passwords' => 0, ':g_mod_ban_users' => 0, ':g_read_board' => 1, ':g_view_users' => 1, ':g_post_replies' => 1, ':g_post_topics' => 1, ':g_edit_posts' => 1, ':g_delete_posts' => 1, ':g_delete_topics' => 1, ':g_set_title' => 0, ':g_search' => 1, ':g_search_users' => 1, ':g_send_email' => 1, ':g_post_flood' => 60, ':g_search_flood' => 30, ':g_email_flood' => 60, ':g_report_flood' => 60);
c0fc4d8 @daris Update install.php to use new database layer
daris authored
927 $query->run($params);
928 unset($params);
929
930 unset($query);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
931
932 // Insert guest and first admin user
7c97871 @daris Updating to use new db layer
daris authored
933 $query = $db->insert(array('group_id' => ':group_id', 'username' => ':username', 'password' => ':password', 'email' => ':email'), 'users');
c0fc4d8 @daris Update install.php to use new database layer
daris authored
934 $params = array(':group_id' => 3, ':username' => $lang->t('Guest'), ':password' => $lang->t('Guest'), ':email' => $lang->t('Guest'));
7c97871 @daris Updating to use new db layer
daris authored
935 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
936 unset($query, $params);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
937
7c97871 @daris Updating to use new db layer
daris authored
938 $query = $db->insert(array('group_id' => ':group_id', 'username' => ':username', 'password' => ':password', 'email' => ':email', 'language' => ':language', 'style' => ':style', 'num_posts' => ':num_posts', 'last_post' => ':last_post', 'registered' => ':registered', 'registration_ip' => ':registration_ip', 'last_visit' => ':last_visit'), 'users');
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
939 $params = array(':group_id' => 1, ':username' => $username, ':password' => pun_hash($password1), ':email' => $email, ':language' => $default_lang, ':style' => $default_style, ':num_posts' => 1, ':last_post' => $now, ':registered' => $now, ':registration_ip' => get_remote_address(), ':last_visit' => $now);
7c97871 @daris Updating to use new db layer
daris authored
940 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
941 unset($query, $params);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
942
943 // Enable/disable avatars depending on file_uploads setting in PHP configuration
944 $avatars = in_array(strtolower(@ini_get('file_uploads')), array('on', 'true', '1')) ? 1 : 0;
945
946 // Insert config data
9c7b56a @daris #501 Set the $pun_config variable during installation to avoid showing u...
daris authored
947 $pun_config = array(
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
948 'o_cur_version' => FORUM_VERSION,
949 'o_database_revision' => FORUM_DB_REVISION,
950 'o_searchindex_revision' => FORUM_SI_REVISION,
951 'o_parser_revision' => FORUM_PARSER_REVISION,
952 'o_board_title' => $title,
953 'o_board_desc' => $description,
954 'o_default_timezone' => 0,
955 'o_time_format' => 'H:i:s',
956 'o_date_format' => 'Y-m-d',
957 'o_timeout_visit' => 1800,
958 'o_timeout_online' => 300,
959 'o_redirect_delay' => 1,
960 'o_show_version' => 0,
961 'o_show_user_info' => 1,
962 'o_show_post_count' => 1,
963 'o_signatures' => 1,
964 'o_smilies' => 1,
965 'o_smilies_sig' => 1,
966 'o_make_links' => 1,
967 'o_default_lang' => $default_lang,
968 'o_default_style' => $default_style,
969 'o_default_user_group' => 4,
970 'o_topic_review' => 15,
971 'o_disp_topics_default' => 30,
972 'o_disp_posts_default' => 25,
973 'o_indent_num_spaces' => 4,
974 'o_quote_depth' => 3,
975 'o_quickpost' => 1,
976 'o_users_online' => 1,
977 'o_censoring' => 0,
978 'o_ranks' => 1,
979 'o_show_dot' => 0,
980 'o_topic_views' => 1,
981 'o_quickjump' => 1,
982 'o_gzip' => 0,
983 'o_additional_navlinks' => '',
984 'o_report_method' => 0,
985 'o_regs_report' => 0,
986 'o_default_email_setting' => 1,
987 'o_mailing_list' => $email,
988 'o_avatars' => $avatars,
989 'o_avatars_dir' => 'img/avatars',
990 'o_avatars_width' => 60,
991 'o_avatars_height' => 60,
992 'o_avatars_size' => 10240,
993 'o_search_all_forums' => 1,
994 'o_admin_email' => $email,
995 'o_webmaster_email' => $email,
996 'o_forum_subscriptions' => 1,
997 'o_topic_subscriptions' => 1,
998 'o_smtp_host' => NULL,
999 'o_smtp_user' => NULL,
1000 'o_smtp_pass' => NULL,
1001 'o_smtp_ssl' => 0,
1002 'o_regs_allow' => 1,
1003 'o_regs_verify' => 0,
1004 'o_announcement' => 0,
e3775ac @franzliedke #532: Fix some duplicate language keys.
franzliedke authored
1005 'o_announcement_message' => $lang->t('Enter announcement'),
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1006 'o_rules' => 0,
e3775ac @franzliedke #532: Fix some duplicate language keys.
franzliedke authored
1007 'o_rules_message' => $lang->t('Enter rules'),
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1008 'o_maintenance' => 0,
586bc04 @franzliedke Merge branch 'fluxbb-2.0-db' into fluxbb-2.0
franzliedke authored
1009 'o_maintenance_message' => $lang->t('Maintenance message'),
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1010 'o_default_dst' => 0,
1011 'o_feed_type' => 2,
1012 'o_feed_ttl' => 0,
1013 'p_message_bbcode' => 1,
1014 'p_message_img_tag' => 1,
1015 'p_message_all_caps' => 1,
1016 'p_subject_all_caps' => 1,
1017 'p_sig_all_caps' => 1,
1018 'p_sig_bbcode' => 1,
1019 'p_sig_img_tag' => 0,
1020 'p_sig_length' => 400,
1021 'p_sig_lines' => 4,
1022 'p_allow_banned_email' => 1,
1023 'p_allow_dupe_email' => 0,
1024 'p_force_guest_email' => 1
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1025 );
1026
7c97871 @daris Updating to use new db layer
daris authored
1027 $query = $db->insert(array('conf_name' => ':conf_name', 'conf_value' => ':conf_value'), 'config');
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1028
9c7b56a @daris #501 Set the $pun_config variable during installation to avoid showing u...
daris authored
1029 foreach ($pun_config as $conf_name => $conf_value)
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1030 {
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1031 $params = array(':conf_name' => $conf_name, ':conf_value' => $conf_value);
7c97871 @daris Updating to use new db layer
daris authored
1032 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1033 unset($params);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1034 }
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1035 unset($query);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1036
1037 // Insert some other default data
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1038 $subject = $lang->t('Test post');
e3775ac @franzliedke #532: Fix some duplicate language keys.
franzliedke authored
1039 $message = $lang->t('Test post example');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1040
7c97871 @daris Updating to use new db layer
daris authored
1041 $query = $db->insert(array('rank' => ':rank', 'min_posts' => ':min_posts'), 'ranks');
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1042
1043 // Insert default ranks
586bc04 @franzliedke Merge branch 'fluxbb-2.0-db' into fluxbb-2.0
franzliedke authored
1044 $params = array(':rank' => $lang->t('New member'), ':min_posts' => 0);
7c97871 @daris Updating to use new db layer
daris authored
1045 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1046
586bc04 @franzliedke Merge branch 'fluxbb-2.0-db' into fluxbb-2.0
franzliedke authored
1047 $params = array(':rank' => $lang->t('Member'), ':min_posts' => 10);
7c97871 @daris Updating to use new db layer
daris authored
1048 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1049 unset($query, $params);
1050
1051 // Insert first category and forum
7c97871 @daris Updating to use new db layer
daris authored
1052 $query = $db->insert(array('cat_name' => ':cat_name', 'disp_position' => ':disp_position'), 'categories');
586bc04 @franzliedke Merge branch 'fluxbb-2.0-db' into fluxbb-2.0
franzliedke authored
1053 $params = array(':cat_name' => $lang->t('Test category'), ':disp_position' => 1);
7c97871 @daris Updating to use new db layer
daris authored
1054 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1055 unset($query, $params);
1056
7c97871 @daris Updating to use new db layer
daris authored
1057 $query = $db->insert(array('forum_name' => ':forum_name', 'forum_desc' => ':forum_desc', 'num_topics' => ':num_topics', 'num_posts' => ':num_posts', 'last_post' => ':last_post', 'last_post_id' => ':last_post_id', 'last_poster' => ':last_poster', 'disp_position' => ':disp_position', 'cat_id' => ':cat_id'), 'forums');
586bc04 @franzliedke Merge branch 'fluxbb-2.0-db' into fluxbb-2.0
franzliedke authored
1058 $params = array(':forum_name' => $lang->t('Test forum'), ':forum_desc' => $lang->t('This is just a test forum'), ':num_topics' => 1, ':num_posts' => 1, ':last_post' => $now, ':last_post_id' => 1, ':last_poster' => $username, ':disp_position' => 1, ':cat_id' => 1);
7c97871 @daris Updating to use new db layer
daris authored
1059 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1060 unset($query, $params);
1061
1062 // Insert first topic and post
7c97871 @daris Updating to use new db layer
daris authored
1063 $query = $db->insert(array('poster' => ':poster', 'subject' => ':subject', 'posted' => ':posted', 'first_post_id' => ':first_post_id', 'last_post' => ':last_post', 'last_post_id' => ':last_post_id', 'last_poster' => ':last_poster', 'forum_id' => ':forum_id'), 'topics');
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1064 $params = array(':poster' => $username, ':subject' => $subject, ':posted' => $now, ':first_post_id' => 1, ':last_post' => $now, ':last_post_id' => 1, ':last_poster' => $username, ':forum_id' => 1);
7c97871 @daris Updating to use new db layer
daris authored
1065 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1066 unset($query, $params);
1067
7c97871 @daris Updating to use new db layer
daris authored
1068 $query = $db->insert(array('poster' => ':poster', 'poster_id' => ':poster_id', 'poster_ip' => ':poster_ip', 'message' => ':message', 'posted' => ':posted', 'topic_id' => ':topic_id'), 'posts');
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1069 $params = array(':poster' => $username, ':poster_id' => 2, ':poster_ip' => get_remote_address(), ':message' => $message, ':posted' => $now, ':topic_id' => 1);
7c97871 @daris Updating to use new db layer
daris authored
1070 $query->run($params);
8a25bf8 @franzliedke Convert a bunch of insert queries in install.php.
franzliedke authored
1071 unset($query, $params);
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1072
1073 // Index the test post so searching for it works
1074 require PUN_ROOT.'include/search_idx.php';
1075 update_search_index('post', 1, $message, $subject);
1076
c0fc4d8 @daris Update install.php to use new database layer
daris authored
1077 $db->commitTransaction();
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1078
1079
1080 $alerts = array();
1081
1082 // Check if we disabled uploading avatars because file_uploads was disabled
1083 if ($avatars == '0')
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1084 $alerts[] = $lang->t('Alert upload');
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1085
1086 // Add some random bytes at the end of the cookie name to prevent collisions
1087 $cookie_name = 'pun_cookie_'.random_key(6, false, true);
1088
1089 // Generate the config.php file data
1090 $config = generate_config_file();
1091
1092 // Attempt to write config.php and serve it up for download if writing fails
1093 $written = false;
1f50478 @franzliedke #509: Provide a Windows-ACL-safe implementation of is_writable().
franzliedke authored
1094 if (forum_is_writable(PUN_ROOT))
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1095 {
1096 $fh = @fopen(PUN_ROOT.'config.php', 'wb');
1097 if ($fh)
1098 {
1099 fwrite($fh, $config);
1100 fclose($fh);
1101
1102 $written = true;
1103 }
1104 }
1105
1106
1107 ?>
1108 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
1109
1110 <html>
1111 <head>
1112 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1113 <title><?php echo $lang->t('FluxBB Installation') ?></title>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1114 <link rel="stylesheet" type="text/css" href="style/<?php echo $default_style ?>.css" />
1115 </head>
1116 <body>
1117
1118 <div id="puninstall" class="pun">
1119 <div class="top-box"><div><!-- Top Corners --></div></div>
1120 <div class="punwrap">
1121
1122 <div id="brdheader" class="block">
1123 <div class="box">
1124 <div id="brdtitle" class="inbox">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1125 <h1><span><?php echo $lang->t('FluxBB Installation') ?></span></h1>
1126 <div id="brddesc"><p><?php echo $lang->t('FluxBB has been installed') ?></p></div>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1127 </div>
1128 </div>
1129 </div>
1130
1131 <div id="brdmain">
1132
1133 <div class="blockform">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1134 <h2><span><?php echo $lang->t('Final instructions') ?></span></h2>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1135 <div class="box">
1136 <?php
1137
1138 if (!$written)
1139 {
1140
1141 ?>
1142 <form method="post" action="install.php">
1143 <div class="inform">
1144 <div class="forminfo">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1145 <p><?php echo $lang->t('Info 17') ?></p>
1146 <p><?php echo $lang->t('Info 18') ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1147 </div>
1148 <input type="hidden" name="generate_config" value="1" />
1149 <input type="hidden" name="db_type" value="<?php echo $db_type; ?>" />
1150 <input type="hidden" name="db_host" value="<?php echo $db_host; ?>" />
1151 <input type="hidden" name="db_name" value="<?php echo pun_htmlspecialchars($db_name); ?>" />
1152 <input type="hidden" name="db_username" value="<?php echo pun_htmlspecialchars($db_username); ?>" />
3502425 Removed the database password confirmation in install.php.
sexyprout authored
1153 <input type="hidden" name="db_password" value="<?php echo pun_htmlspecialchars($db_password); ?>" />
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1154 <input type="hidden" name="db_prefix" value="<?php echo pun_htmlspecialchars($db_prefix); ?>" />
1155 <input type="hidden" name="cookie_name" value="<?php echo pun_htmlspecialchars($cookie_name); ?>" />
1156 <input type="hidden" name="cookie_seed" value="<?php echo pun_htmlspecialchars($cookie_seed); ?>" />
9ed575a @daris #543 Move base_url variable from database to config.php
daris authored
1157 <input type="hidden" name="base_url" value="<?php echo pun_htmlspecialchars($base_url); ?>" />
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1158
1159 <?php if (!empty($alerts)): ?> <div class="forminfo error-info">
1160 <ul class="error-list">
1161 <?php
1162
1163 foreach ($alerts as $cur_alert)
1164 echo "\t\t\t\t\t".'<li>'.$cur_alert.'</li>'."\n";
1165 ?>
1166 </ul>
1167 </div>
1168 <?php endif; ?> </div>
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1169 <p class="buttons"><input type="submit" value="<?php echo $lang->t('Download config.php file') ?>" /></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1170 </form>
1171
1172 <?php
1173
1174 }
1175 else
1176 {
1177
1178 ?>
1179 <div class="fakeform">
1180 <div class="inform">
1181 <div class="forminfo">
89d19d2 @franzliedke #498: Convert remaining front-end files to use the new language system.
franzliedke authored
1182 <p><?php echo $lang->t('FluxBB fully installed') ?></p>
5e978fb @franzliedke Fix Windows linebreaks from my last commit. Thanks, Pierre.
franzliedke authored
1183 </div>
1184 </div>
1185 </div>
1186 <?php
1187
1188 }
1189
1190 ?>
1191 </div