~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/install/install_install.php

  • Committer: dcoles
  • Date: 2008-02-29 02:11:58 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:624
forum: Removed the subsilver2 style and phpBB installer
Modified prosilver theme to be more IVLE integrated
Added db dumps for setup

setup.py: Added config.php generator code

doc/setup/install_proc.txt: New setup/install details

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/**
3
 
*
4
 
* @package install
5
 
* @version $Id: install_install.php,v 1.180 2007/11/19 16:44:30 acydburn Exp $
6
 
* @copyright (c) 2005 phpBB Group
7
 
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8
 
*
9
 
*/
10
 
 
11
 
/**
12
 
*/
13
 
if (!defined('IN_INSTALL'))
14
 
{
15
 
        // Someone has tried to access the file direct. This is not a good idea, so exit
16
 
        exit;
17
 
}
18
 
 
19
 
if (!empty($setmodules))
20
 
{
21
 
        // If phpBB is already installed we do not include this module
22
 
        if (@file_exists($phpbb_root_path . 'config.' . $phpEx) && !file_exists($phpbb_root_path . 'cache/install_lock'))
23
 
        {
24
 
                include_once($phpbb_root_path . 'config.' . $phpEx);
25
 
 
26
 
                if (defined('PHPBB_INSTALLED'))
27
 
                {
28
 
                        return;
29
 
                }
30
 
        }
31
 
 
32
 
        $module[] = array(
33
 
                'module_type'           => 'install',
34
 
                'module_title'          => 'INSTALL',
35
 
                'module_filename'       => substr(basename(__FILE__), 0, -strlen($phpEx)-1),
36
 
                'module_order'          => 10,
37
 
                'module_subs'           => '',
38
 
                'module_stages'         => array('INTRO', 'REQUIREMENTS', 'DATABASE', 'ADMINISTRATOR', 'CONFIG_FILE', 'ADVANCED', 'CREATE_TABLE', 'FINAL'),
39
 
                'module_reqs'           => ''
40
 
        );
41
 
}
42
 
 
43
 
/**
44
 
* Installation
45
 
* @package install
46
 
*/
47
 
class install_install extends module
48
 
{
49
 
        function install_install(&$p_master)
50
 
        {
51
 
                $this->p_master = &$p_master;
52
 
        }
53
 
 
54
 
        function main($mode, $sub)
55
 
        {
56
 
                global $lang, $template, $language, $phpbb_root_path;
57
 
 
58
 
                switch ($sub)
59
 
                {
60
 
                        case 'intro':
61
 
                                $this->page_title = $lang['SUB_INTRO'];
62
 
 
63
 
                                $template->assign_vars(array(
64
 
                                        'TITLE'                 => $lang['INSTALL_INTRO'],
65
 
                                        'BODY'                  => $lang['INSTALL_INTRO_BODY'],
66
 
                                        'L_SUBMIT'              => $lang['NEXT_STEP'],
67
 
                                        'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select($language) . '</select>',
68
 
                                        'U_ACTION'              => $this->p_master->module_url . "?mode=$mode&amp;sub=requirements&amp;language=$language",
69
 
                                ));
70
 
 
71
 
                        break;
72
 
 
73
 
                        case 'requirements':
74
 
                                $this->check_server_requirements($mode, $sub);
75
 
 
76
 
                        break;
77
 
 
78
 
                        case 'database':
79
 
                                $this->obtain_database_settings($mode, $sub);
80
 
                        
81
 
                        break;
82
 
 
83
 
                        case 'administrator':
84
 
                                $this->obtain_admin_settings($mode, $sub);
85
 
 
86
 
                        break;
87
 
 
88
 
                        case 'config_file':
89
 
                                $this->create_config_file($mode, $sub);
90
 
                        
91
 
                        break;
92
 
 
93
 
                        case 'advanced':
94
 
                                $this->obtain_advanced_settings($mode, $sub);
95
 
 
96
 
                        break;
97
 
 
98
 
                        case 'create_table':
99
 
                                $this->load_schema($mode, $sub);
100
 
                        break;
101
 
 
102
 
                        case 'final':
103
 
                                $this->build_search_index($mode, $sub);
104
 
                                $this->add_modules($mode, $sub);
105
 
                                $this->add_language($mode, $sub);
106
 
                                $this->add_bots($mode, $sub);
107
 
                                $this->email_admin($mode, $sub);
108
 
                                
109
 
                                // Remove the lock file
110
 
                                @unlink($phpbb_root_path . 'cache/install_lock');
111
 
 
112
 
                        break;
113
 
                }
114
 
 
115
 
                $this->tpl_name = 'install_install';
116
 
        }
117
 
 
118
 
        /**
119
 
        * Checks that the server we are installing on meets the requirements for running phpBB
120
 
        */
121
 
        function check_server_requirements($mode, $sub)
122
 
        {
123
 
                global $lang, $template, $phpbb_root_path, $phpEx, $language;
124
 
 
125
 
                $this->page_title = $lang['STAGE_REQUIREMENTS'];
126
 
 
127
 
                $template->assign_vars(array(
128
 
                        'TITLE'         => $lang['REQUIREMENTS_TITLE'],
129
 
                        'BODY'          => $lang['REQUIREMENTS_EXPLAIN'],
130
 
                ));
131
 
 
132
 
                $passed = array('php' => false, 'db' => false, 'files' => false, 'pcre' => false, 'imagesize' => false,);
133
 
 
134
 
                // Test for basic PHP settings
135
 
                $template->assign_block_vars('checks', array(
136
 
                        'S_LEGEND'                      => true,
137
 
                        'LEGEND'                        => $lang['PHP_SETTINGS'],
138
 
                        'LEGEND_EXPLAIN'        => $lang['PHP_SETTINGS_EXPLAIN'],
139
 
                ));
140
 
 
141
 
                // Test the minimum PHP version
142
 
                $php_version = PHP_VERSION;
143
 
 
144
 
                if (version_compare($php_version, '4.3.3') < 0)
145
 
                {
146
 
                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
147
 
                }
148
 
                else
149
 
                {
150
 
                        $passed['php'] = true;
151
 
 
152
 
                        // We also give feedback on whether we're running in safe mode
153
 
                        $result = '<strong style="color:green">' . $lang['YES'];
154
 
                        if (@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on')
155
 
                        {
156
 
                                $result .= ', ' . $lang['PHP_SAFE_MODE'];
157
 
                        }
158
 
                        $result .= '</strong>';
159
 
                }
160
 
 
161
 
                $template->assign_block_vars('checks', array(
162
 
                        'TITLE'                 => $lang['PHP_VERSION_REQD'],
163
 
                        'RESULT'                => $result,
164
 
 
165
 
                        'S_EXPLAIN'             => false,
166
 
                        'S_LEGEND'              => false,
167
 
                ));
168
 
 
169
 
                // Check for register_globals being enabled
170
 
                if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
171
 
                {
172
 
                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
173
 
                }
174
 
                else
175
 
                {
176
 
                        $result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
177
 
                }
178
 
 
179
 
                $template->assign_block_vars('checks', array(
180
 
                        'TITLE'                 => $lang['PHP_REGISTER_GLOBALS'],
181
 
                        'TITLE_EXPLAIN' => $lang['PHP_REGISTER_GLOBALS_EXPLAIN'],
182
 
                        'RESULT'                => $result,
183
 
 
184
 
                        'S_EXPLAIN'             => true,
185
 
                        'S_LEGEND'              => false,
186
 
                ));
187
 
                
188
 
                
189
 
                // Check for url_fopen
190
 
                if (@ini_get('allow_url_fopen') == '1' || strtolower(@ini_get('allow_url_fopen')) == 'on')
191
 
                {
192
 
                        $result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
193
 
                }
194
 
                else
195
 
                {
196
 
                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
197
 
                }
198
 
 
199
 
                $template->assign_block_vars('checks', array(
200
 
                        'TITLE'                 => $lang['PHP_URL_FOPEN_SUPPORT'],
201
 
                        'TITLE_EXPLAIN' => $lang['PHP_URL_FOPEN_SUPPORT_EXPLAIN'],
202
 
                        'RESULT'                => $result,
203
 
 
204
 
                        'S_EXPLAIN'             => true,
205
 
                        'S_LEGEND'              => false,
206
 
                ));
207
 
                
208
 
                
209
 
                // Check for getimagesize
210
 
                if (@function_exists('getimagesize'))
211
 
                {
212
 
                        $passed['imagesize'] = true;
213
 
                        $result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
214
 
                }
215
 
                else
216
 
                {
217
 
                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
218
 
                }
219
 
 
220
 
                $template->assign_block_vars('checks', array(
221
 
                        'TITLE'                 => $lang['PHP_GETIMAGESIZE_SUPPORT'],
222
 
                        'TITLE_EXPLAIN' => $lang['PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'],
223
 
                        'RESULT'                => $result,
224
 
 
225
 
                        'S_EXPLAIN'             => true,
226
 
                        'S_LEGEND'              => false,
227
 
                ));
228
 
 
229
 
                // Check for PCRE UTF-8 support
230
 
                if (@preg_match('//u', ''))
231
 
                {
232
 
                        $passed['pcre'] = true;
233
 
                        $result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
234
 
                }
235
 
                else
236
 
                {
237
 
                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
238
 
                }
239
 
 
240
 
                $template->assign_block_vars('checks', array(
241
 
                        'TITLE'                 => $lang['PCRE_UTF_SUPPORT'],
242
 
                        'TITLE_EXPLAIN' => $lang['PCRE_UTF_SUPPORT_EXPLAIN'],
243
 
                        'RESULT'                => $result,
244
 
 
245
 
                        'S_EXPLAIN'             => true,
246
 
                        'S_LEGEND'              => false,
247
 
                ));
248
 
 
249
 
/**
250
 
*               Better not enabling and adding to the loaded extensions due to the specific requirements needed
251
 
                if (!@extension_loaded('mbstring'))
252
 
                {
253
 
                        can_load_dll('mbstring');
254
 
                }
255
 
*/
256
 
 
257
 
                $passed['mbstring'] = true;
258
 
                if (@extension_loaded('mbstring'))
259
 
                {
260
 
                        // Test for available database modules
261
 
                        $template->assign_block_vars('checks', array(
262
 
                                'S_LEGEND'                      => true,
263
 
                                'LEGEND'                        => $lang['MBSTRING_CHECK'],
264
 
                                'LEGEND_EXPLAIN'        => $lang['MBSTRING_CHECK_EXPLAIN'],
265
 
                        ));
266
 
 
267
 
                        $checks = array(
268
 
                                array('func_overload', '&', MB_OVERLOAD_MAIL|MB_OVERLOAD_STRING),
269
 
                                array('encoding_translation', '!=', 0),
270
 
                                array('http_input', '!=', 'pass'),
271
 
                                array('http_output', '!=', 'pass')
272
 
                        );
273
 
 
274
 
                        foreach ($checks as $mb_checks)
275
 
                        {
276
 
                                $ini_val = @ini_get('mbstring.' . $mb_checks[0]);
277
 
                                switch ($mb_checks[1])
278
 
                                {
279
 
                                        case '&':
280
 
                                                if (intval($ini_val) & $mb_checks[2])
281
 
                                                {
282
 
                                                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
283
 
                                                        $passed['mbstring'] = false;
284
 
                                                }
285
 
                                                else
286
 
                                                {
287
 
                                                        $result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
288
 
                                                }
289
 
                                        break;
290
 
 
291
 
                                        case '!=':
292
 
                                                if ($ini_val != $mb_checks[2])
293
 
                                                {
294
 
                                                        $result = '<strong style="color:red">' . $lang['NO'] . '</strong>';
295
 
                                                        $passed['mbstring'] = false;
296
 
                                                }
297
 
                                                else
298
 
                                                {
299
 
                                                        $result = '<strong style="color:green">' . $lang['YES'] . '</strong>';
300
 
                                                }
301
 
                                        break;
302
 
                                }
303
 
                                $template->assign_block_vars('checks', array(
304
 
                                        'TITLE'                 => $lang['MBSTRING_' . strtoupper($mb_checks[0])],
305
 
                                        'TITLE_EXPLAIN' => $lang['MBSTRING_' . strtoupper($mb_checks[0]) . '_EXPLAIN'],
306
 
                                        'RESULT'                => $result,
307
 
 
308
 
                                        'S_EXPLAIN'             => true,
309
 
                                        'S_LEGEND'              => false,
310
 
                                ));
311
 
                        }
312
 
                }
313
 
 
314
 
                // Test for available database modules
315
 
                $template->assign_block_vars('checks', array(
316
 
                        'S_LEGEND'                      => true,
317
 
                        'LEGEND'                        => $lang['PHP_SUPPORTED_DB'],
318
 
                        'LEGEND_EXPLAIN'        => $lang['PHP_SUPPORTED_DB_EXPLAIN'],
319
 
                ));
320
 
 
321
 
                $available_dbms = get_available_dbms(false, true);
322
 
                $passed['db'] = $available_dbms['ANY_DB_SUPPORT'];
323
 
                unset($available_dbms['ANY_DB_SUPPORT']);
324
 
 
325
 
                foreach ($available_dbms as $db_name => $db_ary)
326
 
                {
327
 
                        if (!$db_ary['AVAILABLE'])
328
 
                        {
329
 
                                $template->assign_block_vars('checks', array(
330
 
                                        'TITLE'         => $lang['DLL_' . strtoupper($db_name)],
331
 
                                        'RESULT'        => '<span style="color:red">' . $lang['UNAVAILABLE'] . '</span>',
332
 
 
333
 
                                        'S_EXPLAIN'     => false,
334
 
                                        'S_LEGEND'      => false,
335
 
                                ));
336
 
                        }
337
 
                        else
338
 
                        {
339
 
                                $template->assign_block_vars('checks', array(
340
 
                                        'TITLE'         => $lang['DLL_' . strtoupper($db_name)],
341
 
                                        'RESULT'        => '<strong style="color:green">' . $lang['AVAILABLE'] . '</strong>',
342
 
 
343
 
                                        'S_EXPLAIN'     => false,
344
 
                                        'S_LEGEND'      => false,
345
 
                                ));
346
 
                        }
347
 
                }
348
 
 
349
 
                // Test for other modules
350
 
                $template->assign_block_vars('checks', array(
351
 
                        'S_LEGEND'                      => true,
352
 
                        'LEGEND'                        => $lang['PHP_OPTIONAL_MODULE'],
353
 
                        'LEGEND_EXPLAIN'        => $lang['PHP_OPTIONAL_MODULE_EXPLAIN'],
354
 
                ));
355
 
 
356
 
                foreach ($this->php_dlls_other as $dll)
357
 
                {
358
 
                        if (!@extension_loaded($dll))
359
 
                        {
360
 
                                if (!can_load_dll($dll))
361
 
                                {
362
 
                                        $template->assign_block_vars('checks', array(
363
 
                                                'TITLE'         => $lang['DLL_' . strtoupper($dll)],
364
 
                                                'RESULT'        => '<strong style="color:red">' . $lang['UNAVAILABLE'] . '</strong>',
365
 
 
366
 
                                                'S_EXPLAIN'     => false,
367
 
                                                'S_LEGEND'      => false,
368
 
                                        ));
369
 
                                        continue;
370
 
                                }
371
 
                        }
372
 
 
373
 
                        $template->assign_block_vars('checks', array(
374
 
                                'TITLE'         => $lang['DLL_' . strtoupper($dll)],
375
 
                                'RESULT'        => '<strong style="color:green">' . $lang['AVAILABLE'] . '</strong>',
376
 
 
377
 
                                'S_EXPLAIN'     => false,
378
 
                                'S_LEGEND'      => false,
379
 
                        ));
380
 
                }
381
 
 
382
 
                // Can we find Imagemagick anywhere on the system?
383
 
                $exe = (DIRECTORY_SEPARATOR == '\\') ? '.exe' : '';
384
 
 
385
 
                $magic_home = getenv('MAGICK_HOME');
386
 
                $img_imagick = '';
387
 
                if (empty($magic_home))
388
 
                {
389
 
                        $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/');
390
 
                        $path_locations = str_replace('\\', '/', (explode(($exe) ? ';' : ':', getenv('PATH'))));
391
 
 
392
 
                        $locations = array_merge($path_locations, $locations);
393
 
                        foreach ($locations as $location)
394
 
                        {
395
 
                                // The path might not end properly, fudge it
396
 
                                if (substr($location, -1, 1) !== '/')
397
 
                                {
398
 
                                        $location .= '/';
399
 
                                }
400
 
 
401
 
                                if (@is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000)
402
 
                                {
403
 
                                        $img_imagick = str_replace('\\', '/', $location);
404
 
                                        continue;
405
 
                                }
406
 
                        }
407
 
                }
408
 
                else
409
 
                {
410
 
                        $img_imagick = str_replace('\\', '/', $magic_home);
411
 
                }
412
 
 
413
 
                $template->assign_block_vars('checks', array(
414
 
                        'TITLE'         => $lang['APP_MAGICK'],
415
 
                        'RESULT'        => ($img_imagick) ? '<strong style="color:green">' . $lang['AVAILABLE'] . ', ' . $img_imagick . '</strong>' : '<strong style="color:blue">' . $lang['NO_LOCATION'] . '</strong>',
416
 
 
417
 
                        'S_EXPLAIN'     => false,
418
 
                        'S_LEGEND'      => false,
419
 
                ));
420
 
 
421
 
                // Check permissions on files/directories we need access to
422
 
                $template->assign_block_vars('checks', array(
423
 
                        'S_LEGEND'                      => true,
424
 
                        'LEGEND'                        => $lang['FILES_REQUIRED'],
425
 
                        'LEGEND_EXPLAIN'        => $lang['FILES_REQUIRED_EXPLAIN'],
426
 
                ));
427
 
 
428
 
                $directories = array('cache/', 'files/', 'store/');
429
 
 
430
 
                umask(0);
431
 
 
432
 
                $passed['files'] = true;
433
 
                foreach ($directories as $dir)
434
 
                {
435
 
                        $exists = $write = false;
436
 
 
437
 
                        // Try to create the directory if it does not exist
438
 
                        if (!file_exists($phpbb_root_path . $dir))
439
 
                        {
440
 
                                @mkdir($phpbb_root_path . $dir, 0777);
441
 
                                @chmod($phpbb_root_path . $dir, 0777);
442
 
                        }
443
 
 
444
 
                        // Now really check
445
 
                        if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir))
446
 
                        {
447
 
                                if (!@is_writable($phpbb_root_path . $dir))
448
 
                                {
449
 
                                        @chmod($phpbb_root_path . $dir, 0777);
450
 
                                }
451
 
                                $exists = true;
452
 
                        }
453
 
 
454
 
                        // Now check if it is writable by storing a simple file
455
 
                        $fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb');
456
 
                        if ($fp !== false)
457
 
                        {
458
 
                                $write = true;
459
 
                        }
460
 
                        @fclose($fp);
461
 
 
462
 
                        @unlink($phpbb_root_path . $dir . 'test_lock');
463
 
 
464
 
                        $passed['files'] = ($exists && $write && $passed['files']) ? true : false;
465
 
 
466
 
                        $exists = ($exists) ? '<strong style="color:green">' . $lang['FOUND'] . '</strong>' : '<strong style="color:red">' . $lang['NOT_FOUND'] . '</strong>';
467
 
                        $write = ($write) ? ', <strong style="color:green">' . $lang['WRITABLE'] . '</strong>' : (($exists) ? ', <strong style="color:red">' . $lang['UNWRITABLE'] . '</strong>' : '');
468
 
 
469
 
                        $template->assign_block_vars('checks', array(
470
 
                                'TITLE'         => $dir,
471
 
                                'RESULT'        => $exists . $write,
472
 
 
473
 
                                'S_EXPLAIN'     => false,
474
 
                                'S_LEGEND'      => false,
475
 
                        ));
476
 
                }
477
 
 
478
 
                // Check permissions on files/directories it would be useful access to
479
 
                $template->assign_block_vars('checks', array(
480
 
                        'S_LEGEND'                      => true,
481
 
                        'LEGEND'                        => $lang['FILES_OPTIONAL'],
482
 
                        'LEGEND_EXPLAIN'        => $lang['FILES_OPTIONAL_EXPLAIN'],
483
 
                ));
484
 
 
485
 
                $directories = array('config.' . $phpEx, 'images/avatars/upload/');
486
 
 
487
 
                foreach ($directories as $dir)
488
 
                {
489
 
                        $write = $exists = true;
490
 
                        if (file_exists($phpbb_root_path . $dir))
491
 
                        {
492
 
                                if (!@is_writable($phpbb_root_path . $dir))
493
 
                                {
494
 
                                        $write = false;
495
 
                                }
496
 
                        }
497
 
                        else
498
 
                        {
499
 
                                $write = $exists = false;
500
 
                        }
501
 
 
502
 
                        $exists_str = ($exists) ? '<strong style="color:green">' . $lang['FOUND'] . '</strong>' : '<strong style="color:red">' . $lang['NOT_FOUND'] . '</strong>';
503
 
                        $write_str = ($write) ? ', <strong style="color:green">' . $lang['WRITABLE'] . '</strong>' : (($exists) ? ', <strong style="color:red">' . $lang['UNWRITABLE'] . '</strong>' : '');
504
 
 
505
 
                        $template->assign_block_vars('checks', array(
506
 
                                'TITLE'         => $dir,
507
 
                                'RESULT'        => $exists_str . $write_str,
508
 
 
509
 
                                'S_EXPLAIN'     => false,
510
 
                                'S_LEGEND'      => false,
511
 
                        ));
512
 
                }
513
 
 
514
 
                // And finally where do we want to go next (well today is taken isn't it :P)
515
 
                $s_hidden_fields = ($img_imagick) ? '<input type="hidden" name="img_imagick" value="' . addslashes($img_imagick) . '" />' : '';
516
 
 
517
 
                $url = (!in_array(false, $passed)) ? $this->p_master->module_url . "?mode=$mode&amp;sub=database&amp;language=$language" : $this->p_master->module_url . "?mode=$mode&amp;sub=requirements&amp;language=$language       ";
518
 
                $submit = (!in_array(false, $passed)) ? $lang['INSTALL_START'] : $lang['INSTALL_TEST'];
519
 
 
520
 
 
521
 
                $template->assign_vars(array(
522
 
                        'L_SUBMIT'      => $submit,
523
 
                        'S_HIDDEN'      => $s_hidden_fields,
524
 
                        'U_ACTION'      => $url,
525
 
                ));
526
 
        }
527
 
 
528
 
        /**
529
 
        * Obtain the information required to connect to the database
530
 
        */
531
 
        function obtain_database_settings($mode, $sub)
532
 
        {
533
 
                global $lang, $template, $phpEx;
534
 
 
535
 
                $this->page_title = $lang['STAGE_DATABASE'];
536
 
 
537
 
                // Obtain any submitted data
538
 
                $data = $this->get_submitted_data();
539
 
 
540
 
                $connect_test = false;
541
 
                $error = array();
542
 
                $available_dbms = get_available_dbms(false, true);
543
 
 
544
 
                // Has the user opted to test the connection?
545
 
                if (isset($_POST['testdb']))
546
 
                {
547
 
                        if (!isset($available_dbms[$data['dbms']]) || !$available_dbms[$data['dbms']]['AVAILABLE'])
548
 
                        {
549
 
                                $error['db'][] = $lang['INST_ERR_NO_DB'];
550
 
                                $connect_test = false;
551
 
                        }
552
 
                        else
553
 
                        {
554
 
                                $connect_test = connect_check_db(true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], $data['dbpasswd'], $data['dbname'], $data['dbport']);
555
 
                        }
556
 
 
557
 
                        $template->assign_block_vars('checks', array(
558
 
                                'S_LEGEND'                      => true,
559
 
                                'LEGEND'                        => $lang['DB_CONNECTION'],
560
 
                                'LEGEND_EXPLAIN'        => false,
561
 
                        ));
562
 
 
563
 
                        if ($connect_test)
564
 
                        {
565
 
                                $template->assign_block_vars('checks', array(
566
 
                                        'TITLE'         => $lang['DB_TEST'],
567
 
                                        'RESULT'        => '<strong style="color:green">' . $lang['SUCCESSFUL_CONNECT'] . '</strong>',
568
 
 
569
 
                                        'S_EXPLAIN'     => false,
570
 
                                        'S_LEGEND'      => false,
571
 
                                ));
572
 
                        }
573
 
                        else
574
 
                        {
575
 
                                $template->assign_block_vars('checks', array(
576
 
                                        'TITLE'         => $lang['DB_TEST'],
577
 
                                        'RESULT'        => '<strong style="color:red">' . implode('<br />', $error) . '</strong>',
578
 
 
579
 
                                        'S_EXPLAIN'     => false,
580
 
                                        'S_LEGEND'      => false,
581
 
                                ));
582
 
                        }
583
 
                }
584
 
 
585
 
                if (!$connect_test)
586
 
                {
587
 
                        // Update the list of available DBMS modules to only contain those which can be used
588
 
                        $available_dbms_temp = array();
589
 
                        foreach ($available_dbms as $type => $dbms_ary)
590
 
                        {
591
 
                                if (!$dbms_ary['AVAILABLE'])
592
 
                                {
593
 
                                        continue;
594
 
                                }
595
 
 
596
 
                                $available_dbms_temp[$type] = $dbms_ary;
597
 
                        }
598
 
 
599
 
                        $available_dbms = &$available_dbms_temp;
600
 
 
601
 
                        // And now for the main part of this page
602
 
                        $data['table_prefix'] = (!empty($data['table_prefix']) ? $data['table_prefix'] : 'phpbb_');
603
 
 
604
 
                        foreach ($this->db_config_options as $config_key => $vars)
605
 
                        {
606
 
                                if (!is_array($vars) && strpos($config_key, 'legend') === false)
607
 
                                {
608
 
                                        continue;
609
 
                                }
610
 
 
611
 
                                if (strpos($config_key, 'legend') !== false)
612
 
                                {
613
 
                                        $template->assign_block_vars('options', array(
614
 
                                                'S_LEGEND'              => true,
615
 
                                                'LEGEND'                => $lang[$vars])
616
 
                                        );
617
 
 
618
 
                                        continue;
619
 
                                }
620
 
 
621
 
                                $options = isset($vars['options']) ? $vars['options'] : '';
622
 
 
623
 
                                $template->assign_block_vars('options', array(
624
 
                                        'KEY'                   => $config_key,
625
 
                                        'TITLE'                 => $lang[$vars['lang']],
626
 
                                        'S_EXPLAIN'             => $vars['explain'],
627
 
                                        'S_LEGEND'              => false,
628
 
                                        'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
629
 
                                        'CONTENT'               => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
630
 
                                        )
631
 
                                );
632
 
                        }
633
 
                }
634
 
 
635
 
                // And finally where do we want to go next (well today is taken isn't it :P)
636
 
                $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
637
 
                $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
638
 
                if ($connect_test)
639
 
                {
640
 
                        foreach ($this->db_config_options as $config_key => $vars)
641
 
                        {
642
 
                                if (!is_array($vars))
643
 
                                {
644
 
                                        continue;
645
 
                                }
646
 
                                $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
647
 
                        }
648
 
                }
649
 
 
650
 
                $url = ($connect_test) ? $this->p_master->module_url . "?mode=$mode&amp;sub=administrator" : $this->p_master->module_url . "?mode=$mode&amp;sub=database";
651
 
                $s_hidden_fields .= ($connect_test) ? '' : '<input type="hidden" name="testdb" value="true" />';
652
 
 
653
 
                $submit = $lang['NEXT_STEP'];
654
 
 
655
 
                $template->assign_vars(array(
656
 
                        'L_SUBMIT'      => $submit,
657
 
                        'S_HIDDEN'      => $s_hidden_fields,
658
 
                        'U_ACTION'      => $url,
659
 
                ));
660
 
        }
661
 
 
662
 
        /**
663
 
        * Obtain the administrator's name, password and email address
664
 
        */
665
 
        function obtain_admin_settings($mode, $sub)
666
 
        {
667
 
                global $lang, $template, $phpEx;
668
 
 
669
 
                $this->page_title = $lang['STAGE_ADMINISTRATOR'];
670
 
 
671
 
                // Obtain any submitted data
672
 
                $data = $this->get_submitted_data();
673
 
 
674
 
                if ($data['dbms'] == '')
675
 
                {
676
 
                        // Someone's been silly and tried calling this page direct
677
 
                        // So we send them back to the start to do it again properly
678
 
                        $this->p_master->redirect("index.$phpEx?mode=install");
679
 
                }
680
 
 
681
 
                $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
682
 
                $passed = false;
683
 
 
684
 
                $data['default_lang'] = ($data['default_lang'] !== '') ? $data['default_lang'] : $data['language'];
685
 
 
686
 
                if (isset($_POST['check']))
687
 
                {
688
 
                        $error = array();
689
 
 
690
 
                        // Check the entered email address and password
691
 
                        if ($data['admin_name'] == '' || $data['admin_pass1'] == '' || $data['admin_pass2'] == '' || $data['board_email1'] == '' || $data['board_email2'] == '')
692
 
                        {
693
 
                                $error[] = $lang['INST_ERR_MISSING_DATA'];
694
 
                        }
695
 
 
696
 
                        if ($data['admin_pass1'] != $data['admin_pass2'] && $data['admin_pass1'] != '')
697
 
                        {
698
 
                                $error[] = $lang['INST_ERR_PASSWORD_MISMATCH'];
699
 
                        }
700
 
 
701
 
                        // Test against the default username rules
702
 
                        if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) < 3)
703
 
                        {
704
 
                                $error[] = $lang['INST_ERR_USER_TOO_SHORT'];
705
 
                        }
706
 
 
707
 
                        if ($data['admin_name'] != '' && utf8_strlen($data['admin_name']) > 20)
708
 
                        {
709
 
                                $error[] = $lang['INST_ERR_USER_TOO_LONG'];
710
 
                        }
711
 
 
712
 
                        // Test against the default password rules
713
 
                        if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) < 6)
714
 
                        {
715
 
                                $error[] = $lang['INST_ERR_PASSWORD_TOO_SHORT'];
716
 
                        }
717
 
 
718
 
                        if ($data['admin_pass1'] != '' && utf8_strlen($data['admin_pass1']) > 30)
719
 
                        {
720
 
                                $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG'];
721
 
                        }
722
 
 
723
 
                        if ($data['board_email1'] != $data['board_email2'] && $data['board_email1'] != '')
724
 
                        {
725
 
                                $error[] = $lang['INST_ERR_EMAIL_MISMATCH'];
726
 
                        }
727
 
 
728
 
                        if ($data['board_email1'] != '' && !preg_match('/^' . get_preg_expression('email') . '$/i', $data['board_email1']))
729
 
                        {
730
 
                                $error[] = $lang['INST_ERR_EMAIL_INVALID'];
731
 
                        }
732
 
 
733
 
                        $template->assign_block_vars('checks', array(
734
 
                                'S_LEGEND'                      => true,
735
 
                                'LEGEND'                        => $lang['STAGE_ADMINISTRATOR'],
736
 
                                'LEGEND_EXPLAIN'        => false,
737
 
                        ));
738
 
 
739
 
                        if (!sizeof($error))
740
 
                        {
741
 
                                $passed = true;
742
 
                                $template->assign_block_vars('checks', array(
743
 
                                        'TITLE'         => $lang['ADMIN_TEST'],
744
 
                                        'RESULT'        => '<strong style="color:green">' . $lang['TESTS_PASSED'] . '</strong>',
745
 
 
746
 
                                        'S_EXPLAIN'     => false,
747
 
                                        'S_LEGEND'      => false,
748
 
                                ));
749
 
                        }
750
 
                        else
751
 
                        {
752
 
                                $template->assign_block_vars('checks', array(
753
 
                                        'TITLE'         => $lang['ADMIN_TEST'],
754
 
                                        'RESULT'        => '<strong style="color:red">' . implode('<br />', $error) . '</strong>',
755
 
 
756
 
                                        'S_EXPLAIN'     => false,
757
 
                                        'S_LEGEND'      => false,
758
 
                                ));
759
 
                        }
760
 
                }
761
 
 
762
 
                if (!$passed)
763
 
                {
764
 
                        foreach ($this->admin_config_options as $config_key => $vars)
765
 
                        {
766
 
                                if (!is_array($vars) && strpos($config_key, 'legend') === false)
767
 
                                {
768
 
                                        continue;
769
 
                                }
770
 
 
771
 
                                if (strpos($config_key, 'legend') !== false)
772
 
                                {
773
 
                                        $template->assign_block_vars('options', array(
774
 
                                                'S_LEGEND'              => true,
775
 
                                                'LEGEND'                => $lang[$vars])
776
 
                                        );
777
 
 
778
 
                                        continue;
779
 
                                }
780
 
 
781
 
                                $options = isset($vars['options']) ? $vars['options'] : '';
782
 
 
783
 
                                $template->assign_block_vars('options', array(
784
 
                                        'KEY'                   => $config_key,
785
 
                                        'TITLE'                 => $lang[$vars['lang']],
786
 
                                        'S_EXPLAIN'             => $vars['explain'],
787
 
                                        'S_LEGEND'              => false,
788
 
                                        'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
789
 
                                        'CONTENT'               => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
790
 
                                        )
791
 
                                );
792
 
                        }
793
 
                }
794
 
                else
795
 
                {
796
 
                        foreach ($this->admin_config_options as $config_key => $vars)
797
 
                        {
798
 
                                if (!is_array($vars))
799
 
                                {
800
 
                                        continue;
801
 
                                }
802
 
                                $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
803
 
                        }
804
 
                }
805
 
                
806
 
                $s_hidden_fields .= ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
807
 
                $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
808
 
 
809
 
                foreach ($this->db_config_options as $config_key => $vars)
810
 
                {
811
 
                        if (!is_array($vars))
812
 
                        {
813
 
                                continue;
814
 
                        }
815
 
                        $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
816
 
                }
817
 
 
818
 
                $submit = $lang['NEXT_STEP'];
819
 
 
820
 
                $url = ($passed) ? $this->p_master->module_url . "?mode=$mode&amp;sub=config_file" : $this->p_master->module_url . "?mode=$mode&amp;sub=administrator";
821
 
                $s_hidden_fields .= ($passed) ? '' : '<input type="hidden" name="check" value="true" />';
822
 
 
823
 
                $template->assign_vars(array(
824
 
                        'L_SUBMIT'      => $submit,
825
 
                        'S_HIDDEN'      => $s_hidden_fields,
826
 
                        'U_ACTION'      => $url,
827
 
                ));
828
 
        }
829
 
 
830
 
        /**
831
 
        * Writes the config file to disk, or if unable to do so offers alternative methods
832
 
        */
833
 
        function create_config_file($mode, $sub)
834
 
        {
835
 
                global $lang, $template, $phpbb_root_path, $phpEx;
836
 
 
837
 
                $this->page_title = $lang['STAGE_CONFIG_FILE'];
838
 
 
839
 
                // Obtain any submitted data
840
 
                $data = $this->get_submitted_data();
841
 
 
842
 
                if ($data['dbms'] == '')
843
 
                {
844
 
                        // Someone's been silly and tried calling this page direct
845
 
                        // So we send them back to the start to do it again properly
846
 
                        $this->p_master->redirect("index.$phpEx?mode=install");
847
 
                }
848
 
 
849
 
                $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
850
 
                $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
851
 
                $written = false;
852
 
 
853
 
                // Create a list of any PHP modules we wish to have loaded
854
 
                $load_extensions = array();
855
 
                $available_dbms = get_available_dbms($data['dbms']);
856
 
                $check_exts = array_merge(array($available_dbms[$data['dbms']]['MODULE']), $this->php_dlls_other);
857
 
 
858
 
                foreach ($check_exts as $dll)
859
 
                {
860
 
                        if (!@extension_loaded($dll))
861
 
                        {
862
 
                                if (!can_load_dll($dll))
863
 
                                {
864
 
                                        continue;
865
 
                                }
866
 
 
867
 
                                $load_extensions[] = $dll . '.' . PHP_SHLIB_SUFFIX;
868
 
                        }
869
 
                }
870
 
 
871
 
                // Create a lock file to indicate that there is an install in progress
872
 
                $fp = @fopen($phpbb_root_path . 'cache/install_lock', 'wb');
873
 
                if ($fp === false)
874
 
                {
875
 
                        // We were unable to create the lock file - abort
876
 
                        $this->p_master->error($lang['UNABLE_WRITE_LOCK'], __LINE__, __FILE__);
877
 
                }
878
 
                @fclose($fp);
879
 
 
880
 
                @chmod($phpbb_root_path . 'cache/install_lock', 0666);
881
 
 
882
 
                $load_extensions = implode(',', $load_extensions);
883
 
 
884
 
                // Time to convert the data provided into a config file
885
 
                $config_data = "<?php\n";
886
 
                $config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n";
887
 
                $config_data .= "\$dbms = '" . $available_dbms[$data['dbms']]['DRIVER'] . "';\n";
888
 
                $config_data .= "\$dbhost = '{$data['dbhost']}';\n";
889
 
                $config_data .= "\$dbport = '{$data['dbport']}';\n";
890
 
                $config_data .= "\$dbname = '{$data['dbname']}';\n";
891
 
                $config_data .= "\$dbuser = '{$data['dbuser']}';\n";
892
 
                $config_data .= "\$dbpasswd = '{$data['dbpasswd']}';\n\n";
893
 
                $config_data .= "\$table_prefix = '{$data['table_prefix']}';\n";
894
 
//              $config_data .= "\$acm_type = '" . (($acm_type) ? $acm_type : 'file') . "';\n";
895
 
                $config_data .= "\$acm_type = 'file';\n";
896
 
                $config_data .= "\$load_extensions = '$load_extensions';\n\n";
897
 
                $config_data .= "@define('PHPBB_INSTALLED', true);\n";
898
 
                $config_data .= "// @define('DEBUG', true);\n";
899
 
                $config_data .= "// @define('DEBUG_EXTRA', true);\n";
900
 
                $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
901
 
        
902
 
                // Attempt to write out the config file directly. If it works, this is the easiest way to do it ...
903
 
                if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) || is_writable($phpbb_root_path))
904
 
                {
905
 
                        // Assume it will work ... if nothing goes wrong below
906
 
                        $written = true;
907
 
 
908
 
                        if (!($fp = @fopen($phpbb_root_path . 'config.' . $phpEx, 'w')))
909
 
                        {
910
 
                                // Something went wrong ... so let's try another method
911
 
                                $written = false;
912
 
                        }
913
 
 
914
 
                        if (!(@fwrite($fp, $config_data)))
915
 
                        {
916
 
                                // Something went wrong ... so let's try another method
917
 
                                $written = false;
918
 
                        }
919
 
 
920
 
                        @fclose($fp);
921
 
 
922
 
                        if ($written)
923
 
                        {
924
 
                                @chmod($phpbb_root_path . 'config.' . $phpEx, 0644);
925
 
                        }
926
 
                }
927
 
 
928
 
                if (isset($_POST['dldone']))
929
 
                {
930
 
                        // Do a basic check to make sure that the file has been uploaded
931
 
                        // Note that all we check is that the file has _something_ in it
932
 
                        // We don't compare the contents exactly - if they can't upload
933
 
                        // a single file correctly, it's likely they will have other problems....
934
 
                        if (filesize($phpbb_root_path . 'config.' . $phpEx) > 10)
935
 
                        {
936
 
                                $written = true;
937
 
                        }
938
 
                }
939
 
 
940
 
                $config_options = array_merge($this->db_config_options, $this->admin_config_options);
941
 
 
942
 
                foreach ($config_options as $config_key => $vars)
943
 
                {
944
 
                        if (!is_array($vars))
945
 
                        {
946
 
                                continue;
947
 
                        }
948
 
                        $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
949
 
                }
950
 
 
951
 
                if (!$written)
952
 
                {
953
 
                        // OK, so it didn't work let's try the alternatives
954
 
 
955
 
                        if (isset($_POST['dlconfig']))
956
 
                        {
957
 
                                // They want a copy of the file to download, so send the relevant headers and dump out the data
958
 
                                header("Content-Type: text/x-delimtext; name=\"config.$phpEx\"");
959
 
                                header("Content-disposition: attachment; filename=config.$phpEx");
960
 
                                echo $config_data;
961
 
                                exit;
962
 
                        }
963
 
 
964
 
                        // The option to download the config file is always available, so output it here
965
 
                        $template->assign_vars(array(
966
 
                                'BODY'                                  => $lang['CONFIG_FILE_UNABLE_WRITE'],
967
 
                                'L_DL_CONFIG'                   => $lang['DL_CONFIG'],
968
 
                                'L_DL_CONFIG_EXPLAIN'   => $lang['DL_CONFIG_EXPLAIN'],
969
 
                                'L_DL_DONE'                             => $lang['DONE'],
970
 
                                'L_DL_DOWNLOAD'                 => $lang['DL_DOWNLOAD'],
971
 
                                'S_HIDDEN'                              => $s_hidden_fields,
972
 
                                'S_SHOW_DOWNLOAD'               => true,
973
 
                                'U_ACTION'                              => $this->p_master->module_url . "?mode=$mode&amp;sub=config_file",
974
 
                        ));
975
 
                        return;
976
 
                }
977
 
                else
978
 
                {
979
 
                        $template->assign_vars(array(
980
 
                                'BODY'          => $lang['CONFIG_FILE_WRITTEN'],
981
 
                                'L_SUBMIT'      => $lang['NEXT_STEP'],
982
 
                                'S_HIDDEN'      => $s_hidden_fields,
983
 
                                'U_ACTION'      => $this->p_master->module_url . "?mode=$mode&amp;sub=advanced",
984
 
                        ));
985
 
                        return;
986
 
                }
987
 
        }
988
 
 
989
 
        /**
990
 
        * Provide an opportunity to customise some advanced settings during the install
991
 
        * in case it is necessary for them to be set to access later
992
 
        */
993
 
        function obtain_advanced_settings($mode, $sub)
994
 
        {
995
 
                global $lang, $template, $phpEx;
996
 
 
997
 
                $this->page_title = $lang['STAGE_ADVANCED'];
998
 
 
999
 
                // Obtain any submitted data
1000
 
                $data = $this->get_submitted_data();
1001
 
 
1002
 
                if ($data['dbms'] == '')
1003
 
                {
1004
 
                        // Someone's been silly and tried calling this page direct
1005
 
                        // So we send them back to the start to do it again properly
1006
 
                        $this->p_master->redirect("index.$phpEx?mode=install");
1007
 
                }
1008
 
 
1009
 
                $s_hidden_fields = ($data['img_imagick']) ? '<input type="hidden" name="img_imagick" value="' . addslashes($data['img_imagick']) . '" />' : '';
1010
 
                $s_hidden_fields .= '<input type="hidden" name="language" value="' . $data['language'] . '" />';
1011
 
 
1012
 
                $data['email_enable'] = ($data['email_enable'] !== '') ? $data['email_enable'] : true;
1013
 
                $data['server_name'] = ($data['server_name'] !== '') ? $data['server_name'] : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
1014
 
                $data['server_port'] = ($data['server_port'] !== '') ? $data['server_port'] : ((!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'));
1015
 
                $data['server_protocol'] = ($data['server_protocol'] !== '') ? $data['server_protocol'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://');
1016
 
                $data['cookie_secure'] = ($data['cookie_secure'] !== '') ? $data['cookie_secure'] : ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true : false);
1017
 
 
1018
 
                if ($data['script_path'] === '')
1019
 
                {
1020
 
                        $name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
1021
 
                        if (!$name)
1022
 
                        {
1023
 
                                $name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
1024
 
                        }
1025
 
 
1026
 
                        // Replace backslashes and doubled slashes (could happen on some proxy setups)
1027
 
                        $name = str_replace(array('\\', '//', '/install'), '/', $name);
1028
 
                        $data['script_path'] = trim(dirname($name));
1029
 
                }
1030
 
 
1031
 
                foreach ($this->advanced_config_options as $config_key => $vars)
1032
 
                {
1033
 
                        if (!is_array($vars) && strpos($config_key, 'legend') === false)
1034
 
                        {
1035
 
                                continue;
1036
 
                        }
1037
 
 
1038
 
                        if (strpos($config_key, 'legend') !== false)
1039
 
                        {
1040
 
                                $template->assign_block_vars('options', array(
1041
 
                                        'S_LEGEND'              => true,
1042
 
                                        'LEGEND'                => $lang[$vars])
1043
 
                                );
1044
 
 
1045
 
                                continue;
1046
 
                        }
1047
 
 
1048
 
                        $options = isset($vars['options']) ? $vars['options'] : '';
1049
 
 
1050
 
                        $template->assign_block_vars('options', array(
1051
 
                                'KEY'                   => $config_key,
1052
 
                                'TITLE'                 => $lang[$vars['lang']],
1053
 
                                'S_EXPLAIN'             => $vars['explain'],
1054
 
                                'S_LEGEND'              => false,
1055
 
                                'TITLE_EXPLAIN' => ($vars['explain']) ? $lang[$vars['lang'] . '_EXPLAIN'] : '',
1056
 
                                'CONTENT'               => $this->p_master->input_field($config_key, $vars['type'], $data[$config_key], $options),
1057
 
                                )
1058
 
                        );
1059
 
                }
1060
 
 
1061
 
                $config_options = array_merge($this->db_config_options, $this->admin_config_options);
1062
 
                foreach ($config_options as $config_key => $vars)
1063
 
                {
1064
 
                        if (!is_array($vars))
1065
 
                        {
1066
 
                                continue;
1067
 
                        }
1068
 
                        $s_hidden_fields .= '<input type="hidden" name="' . $config_key . '" value="' . $data[$config_key] . '" />';
1069
 
                }
1070
 
 
1071
 
                $submit = $lang['NEXT_STEP'];
1072
 
 
1073
 
                $url = $this->p_master->module_url . "?mode=$mode&amp;sub=create_table";
1074
 
 
1075
 
                $template->assign_vars(array(
1076
 
                        'BODY'          => $lang['STAGE_ADVANCED_EXPLAIN'],
1077
 
                        'L_SUBMIT'      => $submit,
1078
 
                        'S_HIDDEN'      => $s_hidden_fields,
1079
 
                        'U_ACTION'      => $url,
1080
 
                ));
1081
 
        }
1082
 
 
1083
 
        /**
1084
 
        * Load the contents of the schema into the database and then alter it based on what has been input during the installation
1085
 
        */
1086
 
        function load_schema($mode, $sub)
1087
 
        {
1088
 
                global $db, $lang, $template, $phpbb_root_path, $phpEx;
1089
 
 
1090
 
                $this->page_title = $lang['STAGE_CREATE_TABLE'];
1091
 
                $s_hidden_fields = '';
1092
 
 
1093
 
                // Obtain any submitted data
1094
 
                $data = $this->get_submitted_data();
1095
 
 
1096
 
                if ($data['dbms'] == '')
1097
 
                {
1098
 
                        // Someone's been silly and tried calling this page direct
1099
 
                        // So we send them back to the start to do it again properly
1100
 
                        $this->p_master->redirect("index.$phpEx?mode=install");
1101
 
                }
1102
 
 
1103
 
                $cookie_domain = ($data['server_name'] != '') ? $data['server_name'] : (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME');
1104
 
 
1105
 
                // Try to come up with the best solution for cookie domain...
1106
 
                if (strpos($cookie_domain, 'www.') === 0)
1107
 
                {
1108
 
                        $cookie_domain = str_replace('www.', '.', $cookie_domain);
1109
 
                }
1110
 
 
1111
 
                // If we get here and the extension isn't loaded it should be safe to just go ahead and load it
1112
 
                $available_dbms = get_available_dbms($data['dbms']);
1113
 
 
1114
 
                if (!isset($available_dbms[$data['dbms']]))
1115
 
                {
1116
 
                        // Someone's been silly and tried providing a non-existant dbms
1117
 
                        $this->p_master->redirect("index.$phpEx?mode=install");
1118
 
                }
1119
 
 
1120
 
                $dbms = $available_dbms[$data['dbms']]['DRIVER'];
1121
 
 
1122
 
                // Load the appropriate database class if not already loaded
1123
 
                include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
1124
 
 
1125
 
                // Instantiate the database
1126
 
                $db = new $sql_db();
1127
 
                $db->sql_connect($data['dbhost'], $data['dbuser'], $data['dbpasswd'], $data['dbname'], $data['dbport'], false, false);
1128
 
 
1129
 
                // NOTE: trigger_error does not work here.
1130
 
                $db->sql_return_on_error(true);
1131
 
 
1132
 
                // If mysql is chosen, we need to adjust the schema filename slightly to reflect the correct version. ;)
1133
 
                if ($data['dbms'] == 'mysql')
1134
 
                {
1135
 
                        if (version_compare($db->mysql_version, '4.1.3', '>='))
1136
 
                        {
1137
 
                                $available_dbms[$data['dbms']]['SCHEMA'] .= '_41';
1138
 
                        }
1139
 
                        else
1140
 
                        {
1141
 
                                $available_dbms[$data['dbms']]['SCHEMA'] .= '_40';
1142
 
                        }
1143
 
                }
1144
 
 
1145
 
                // Ok we have the db info go ahead and read in the relevant schema
1146
 
                // and work on building the table
1147
 
                $dbms_schema = 'schemas/' . $available_dbms[$data['dbms']]['SCHEMA'] . '_schema.sql';
1148
 
 
1149
 
                // How should we treat this schema?
1150
 
                $remove_remarks = $available_dbms[$data['dbms']]['COMMENTS'];
1151
 
                $delimiter = $available_dbms[$data['dbms']]['DELIM'];
1152
 
 
1153
 
                $sql_query = @file_get_contents($dbms_schema);
1154
 
 
1155
 
                $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
1156
 
 
1157
 
                $remove_remarks($sql_query);
1158
 
 
1159
 
                $sql_query = split_sql_file($sql_query, $delimiter);
1160
 
 
1161
 
                foreach ($sql_query as $sql)
1162
 
                {
1163
 
                        //$sql = trim(str_replace('|', ';', $sql));
1164
 
                        if (!$db->sql_query($sql))
1165
 
                        {
1166
 
                                $error = $db->sql_error();
1167
 
                                $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
1168
 
                        }
1169
 
                }
1170
 
                unset($sql_query);
1171
 
 
1172
 
                // Ok tables have been built, let's fill in the basic information
1173
 
                $sql_query = file_get_contents('schemas/schema_data.sql');
1174
 
 
1175
 
                // Deal with any special comments
1176
 
                switch ($data['dbms'])
1177
 
                {
1178
 
                        case 'mssql':
1179
 
                        case 'mssql_odbc':
1180
 
                                $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query);
1181
 
                        break;
1182
 
 
1183
 
                        case 'postgres':
1184
 
                                $sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
1185
 
                        break;
1186
 
                }
1187
 
 
1188
 
                // Change prefix
1189
 
                $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
1190
 
 
1191
 
                // Change language strings...
1192
 
                $sql_query = preg_replace_callback('#\{L_([A-Z0-9\-_]*)\}#s', 'adjust_language_keys_callback', $sql_query);
1193
 
 
1194
 
                // Since there is only one schema file we know the comment style and are able to remove it directly with remove_remarks
1195
 
                remove_remarks($sql_query);
1196
 
                $sql_query = split_sql_file($sql_query, ';');
1197
 
 
1198
 
                foreach ($sql_query as $sql)
1199
 
                {
1200
 
                        //$sql = trim(str_replace('|', ';', $sql));
1201
 
                        if (!$db->sql_query($sql))
1202
 
                        {
1203
 
                                $error = $db->sql_error();
1204
 
                                $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
1205
 
                        }
1206
 
                }
1207
 
                unset($sql_query);
1208
 
 
1209
 
                $current_time = time();
1210
 
 
1211
 
                $user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : '';
1212
 
 
1213
 
                if ($data['script_path'] !== '/')
1214
 
                {
1215
 
                        // Adjust destination path (no trailing slash)
1216
 
                        if (substr($data['script_path'], -1) == '/')
1217
 
                        {
1218
 
                                $data['script_path'] = substr($data['script_path'], 0, -1);
1219
 
                        }
1220
 
 
1221
 
                        $data['script_path'] = str_replace(array('../', './'), '', $data['script_path']);
1222
 
 
1223
 
                        if ($data['script_path'][0] != '/')
1224
 
                        {
1225
 
                                $data['script_path'] = '/' . $data['script_path'];
1226
 
                        }
1227
 
                }
1228
 
 
1229
 
                // Set default config and post data, this applies to all DB's
1230
 
                $sql_ary = array(
1231
 
                        'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value)
1232
 
                                VALUES ('board_startdate', '$current_time')",
1233
 
 
1234
 
                        'INSERT INTO ' . $data['table_prefix'] . "config (config_name, config_value)
1235
 
                                VALUES ('default_lang', '" . $db->sql_escape($data['default_lang']) . "')",
1236
 
 
1237
 
                        'UPDATE ' . $data['table_prefix'] . "config
1238
 
                                SET config_value = '" . $db->sql_escape($data['img_imagick']) . "'
1239
 
                                WHERE config_name = 'img_imagick'",
1240
 
 
1241
 
                        'UPDATE ' . $data['table_prefix'] . "config
1242
 
                                SET config_value = '" . $db->sql_escape($data['server_name']) . "'
1243
 
                                WHERE config_name = 'server_name'",
1244
 
 
1245
 
                        'UPDATE ' . $data['table_prefix'] . "config
1246
 
                                SET config_value = '" . $db->sql_escape($data['server_port']) . "'
1247
 
                                WHERE config_name = 'server_port'",
1248
 
 
1249
 
                        'UPDATE ' . $data['table_prefix'] . "config
1250
 
                                SET config_value = '" . $db->sql_escape($data['board_email1']) . "'
1251
 
                                WHERE config_name = 'board_email'",
1252
 
 
1253
 
                        'UPDATE ' . $data['table_prefix'] . "config
1254
 
                                SET config_value = '" . $db->sql_escape($data['board_email1']) . "'
1255
 
                                WHERE config_name = 'board_contact'",
1256
 
 
1257
 
                        'UPDATE ' . $data['table_prefix'] . "config
1258
 
                                SET config_value = '" . $db->sql_escape($cookie_domain) . "'
1259
 
                                WHERE config_name = 'cookie_domain'",
1260
 
 
1261
 
                        'UPDATE ' . $data['table_prefix'] . "config
1262
 
                                SET config_value = '" . $db->sql_escape($lang['default_dateformat']) . "'
1263
 
                                WHERE config_name = 'default_dateformat'",
1264
 
 
1265
 
                        'UPDATE ' . $data['table_prefix'] . "config
1266
 
                                SET config_value = '" . $db->sql_escape($data['email_enable']) . "'
1267
 
                                WHERE config_name = 'email_enable'",
1268
 
 
1269
 
                        'UPDATE ' . $data['table_prefix'] . "config
1270
 
                                SET config_value = '" . $db->sql_escape($data['smtp_delivery']) . "'
1271
 
                                WHERE config_name = 'smtp_delivery'",
1272
 
 
1273
 
                        'UPDATE ' . $data['table_prefix'] . "config
1274
 
                                SET config_value = '" . $db->sql_escape($data['smtp_host']) . "'
1275
 
                                WHERE config_name = 'smtp_host'",
1276
 
 
1277
 
                        'UPDATE ' . $data['table_prefix'] . "config
1278
 
                                SET config_value = '" . $db->sql_escape($data['smtp_auth']) . "'
1279
 
                                WHERE config_name = 'smtp_auth_method'",
1280
 
 
1281
 
                        'UPDATE ' . $data['table_prefix'] . "config
1282
 
                                SET config_value = '" . $db->sql_escape($data['smtp_user']) . "'
1283
 
                                WHERE config_name = 'smtp_username'",
1284
 
 
1285
 
                        'UPDATE ' . $data['table_prefix'] . "config
1286
 
                                SET config_value = '" . $db->sql_escape($data['smtp_pass']) . "'
1287
 
                                WHERE config_name = 'smtp_password'",
1288
 
 
1289
 
                        'UPDATE ' . $data['table_prefix'] . "config
1290
 
                                SET config_value = '" . $db->sql_escape($data['cookie_secure']) . "'
1291
 
                                WHERE config_name = 'cookie_secure'",
1292
 
 
1293
 
                        'UPDATE ' . $data['table_prefix'] . "config
1294
 
                                SET config_value = '" . $db->sql_escape($data['force_server_vars']) . "'
1295
 
                                WHERE config_name = 'force_server_vars'",
1296
 
 
1297
 
                        'UPDATE ' . $data['table_prefix'] . "config
1298
 
                                SET config_value = '" . $db->sql_escape($data['script_path']) . "'
1299
 
                                WHERE config_name = 'script_path'",
1300
 
 
1301
 
                        'UPDATE ' . $data['table_prefix'] . "config
1302
 
                                SET config_value = '" . $db->sql_escape($data['server_protocol']) . "'
1303
 
                                WHERE config_name = 'server_protocol'",
1304
 
 
1305
 
                        'UPDATE ' . $data['table_prefix'] . "config
1306
 
                                SET config_value = '" . $db->sql_escape($data['admin_name']) . "'
1307
 
                                WHERE config_name = 'newest_username'",
1308
 
                        
1309
 
                        'UPDATE ' . $data['table_prefix'] . "config
1310
 
                                SET config_value = '" . md5(mt_rand()) . "'
1311
 
                                WHERE config_name = 'avatar_salt'",
1312
 
                                
1313
 
                        'UPDATE ' . $data['table_prefix'] . "users
1314
 
                                SET username = '" . $db->sql_escape($data['admin_name']) . "', user_password='" . $db->sql_escape(md5($data['admin_pass1'])) . "', user_ip = '" . $db->sql_escape($user_ip) . "', user_lang = '" . $db->sql_escape($data['default_lang']) . "', user_email='" . $db->sql_escape($data['board_email1']) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = " . (crc32($data['board_email1']) . strlen($data['board_email1'])) . ", username_clean = '" . $db->sql_escape(utf8_clean_string($data['admin_name'])) . "'
1315
 
                                WHERE username = 'Admin'",
1316
 
 
1317
 
                        'UPDATE ' . $data['table_prefix'] . "moderator_cache
1318
 
                                SET username = '" . $db->sql_escape($data['admin_name']) . "'
1319
 
                                WHERE username = 'Admin'",
1320
 
 
1321
 
                        'UPDATE ' . $data['table_prefix'] . "forums
1322
 
                                SET forum_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "'
1323
 
                                WHERE forum_last_poster_name = 'Admin'",
1324
 
 
1325
 
                        'UPDATE ' . $data['table_prefix'] . "topics
1326
 
                                SET topic_first_poster_name = '" . $db->sql_escape($data['admin_name']) . "', topic_last_poster_name = '" . $db->sql_escape($data['admin_name']) . "'
1327
 
                                WHERE topic_first_poster_name = 'Admin'
1328
 
                                        OR topic_last_poster_name = 'Admin'",
1329
 
 
1330
 
                        'UPDATE ' . $data['table_prefix'] . "users
1331
 
                                SET user_regdate = $current_time",
1332
 
 
1333
 
                        'UPDATE ' . $data['table_prefix'] . "posts
1334
 
                                SET post_time = $current_time, poster_ip = '" . $db->sql_escape($user_ip) . "'",
1335
 
 
1336
 
                        'UPDATE ' . $data['table_prefix'] . "topics
1337
 
                                SET topic_time = $current_time, topic_last_post_time = $current_time",
1338
 
 
1339
 
                        'UPDATE ' . $data['table_prefix'] . "forums
1340
 
                                SET forum_last_post_time = $current_time",
1341
 
                );
1342
 
 
1343
 
                if (@extension_loaded('gd') || can_load_dll('gd'))
1344
 
                {
1345
 
                        $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
1346
 
                                SET config_value = '1'
1347
 
                                WHERE config_name = 'captcha_gd'";
1348
 
                }
1349
 
 
1350
 
                // We set a (semi-)unique cookie name to bypass login issues related to the cookie name.
1351
 
                $cookie_name = 'phpbb3_';
1352
 
                $rand_str = md5(mt_rand());
1353
 
                $rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35));
1354
 
                $rand_str = substr($rand_str, 0, 5);
1355
 
                $cookie_name .= strtolower($rand_str);
1356
 
 
1357
 
                $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
1358
 
                        SET config_value = '" . $db->sql_escape($cookie_name) . "'
1359
 
                        WHERE config_name = 'cookie_name'";
1360
 
 
1361
 
                foreach ($sql_ary as $sql)
1362
 
                {
1363
 
                        //$sql = trim(str_replace('|', ';', $sql));
1364
 
 
1365
 
                        if (!$db->sql_query($sql))
1366
 
                        {
1367
 
                                $error = $db->sql_error();
1368
 
                                $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
1369
 
                        }
1370
 
                }
1371
 
 
1372
 
                $submit = $lang['NEXT_STEP'];
1373
 
 
1374
 
                $url = $this->p_master->module_url . "?mode=$mode&amp;sub=final";
1375
 
 
1376
 
                $template->assign_vars(array(
1377
 
                        'BODY'          => $lang['STAGE_CREATE_TABLE_EXPLAIN'],
1378
 
                        'L_SUBMIT'      => $submit,
1379
 
                        'S_HIDDEN'      => build_hidden_fields($data),
1380
 
                        'U_ACTION'      => $url,
1381
 
                ));
1382
 
        }
1383
 
 
1384
 
        /**
1385
 
        * Build the search index...
1386
 
        */
1387
 
        function build_search_index($mode, $sub)
1388
 
        {
1389
 
                global $db, $lang, $phpbb_root_path, $phpEx, $config;
1390
 
 
1391
 
                // Obtain any submitted data
1392
 
                $data = $this->get_submitted_data();
1393
 
                $table_prefix = $data['table_prefix'];
1394
 
 
1395
 
                // If we get here and the extension isn't loaded it should be safe to just go ahead and load it
1396
 
                $available_dbms = get_available_dbms($data['dbms']);
1397
 
 
1398
 
                if (!isset($available_dbms[$data['dbms']]))
1399
 
                {
1400
 
                        // Someone's been silly and tried providing a non-existant dbms
1401
 
                        $this->p_master->redirect("index.$phpEx?mode=install");
1402
 
                }
1403
 
 
1404
 
                $dbms = $available_dbms[$data['dbms']]['DRIVER'];
1405
 
 
1406
 
                // Load the appropriate database class if not already loaded
1407
 
                include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
1408
 
 
1409
 
                // Instantiate the database
1410
 
                $db = new $sql_db();
1411
 
                $db->sql_connect($data['dbhost'], $data['dbuser'], $data['dbpasswd'], $data['dbname'], $data['dbport'], false, false);
1412
 
 
1413
 
                // NOTE: trigger_error does not work here.
1414
 
                $db->sql_return_on_error(true);
1415
 
 
1416
 
                include_once($phpbb_root_path . 'includes/constants.' . $phpEx);
1417
 
                include_once($phpbb_root_path . 'includes/search/fulltext_native.' . $phpEx);
1418
 
 
1419
 
                // Fill the config array - it is needed by those functions we call
1420
 
                $sql = 'SELECT *
1421
 
                        FROM ' . CONFIG_TABLE;
1422
 
                $result = $db->sql_query($sql);
1423
 
 
1424
 
                $config = array();
1425
 
                while ($row = $db->sql_fetchrow($result))
1426
 
                {
1427
 
                        $config[$row['config_name']] = $row['config_value'];
1428
 
                }
1429
 
                $db->sql_freeresult($result);
1430
 
 
1431
 
                $error = false;
1432
 
                $search = new fulltext_native($error);
1433
 
 
1434
 
                $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
1435
 
                        FROM ' . POSTS_TABLE;
1436
 
                $result = $db->sql_query($sql);
1437
 
 
1438
 
                while ($row = $db->sql_fetchrow($result))
1439
 
                {
1440
 
                        $search->index('post', $row['post_id'], $row['post_text'], $row['post_subject'], $row['poster_id'], $row['forum_id']);
1441
 
                }
1442
 
                $db->sql_freeresult($result);
1443
 
        }
1444
 
 
1445
 
        /**
1446
 
        * Populate the module tables
1447
 
        */
1448
 
        function add_modules($mode, $sub)
1449
 
        {
1450
 
                global $db, $lang, $phpbb_root_path, $phpEx;
1451
 
 
1452
 
                include_once($phpbb_root_path . 'includes/acp/acp_modules.' . $phpEx);
1453
 
 
1454
 
                $_module = &new acp_modules();
1455
 
                $module_classes = array('acp', 'mcp', 'ucp');
1456
 
 
1457
 
                // Add categories
1458
 
                foreach ($module_classes as $module_class)
1459
 
                {
1460
 
                        $categories = array();
1461
 
 
1462
 
                        // Set the module class
1463
 
                        $_module->module_class = $module_class;
1464
 
 
1465
 
                        foreach ($this->module_categories[$module_class] as $cat_name => $subs)
1466
 
                        {
1467
 
                                $module_data = array(
1468
 
                                        'module_basename'       => '',
1469
 
                                        'module_enabled'        => 1,
1470
 
                                        'module_display'        => 1,
1471
 
                                        'parent_id'                     => 0,
1472
 
                                        'module_class'          => $module_class,
1473
 
                                        'module_langname'       => $cat_name,
1474
 
                                        'module_mode'           => '',
1475
 
                                        'module_auth'           => '',
1476
 
                                );
1477
 
 
1478
 
                                // Add category
1479
 
                                $_module->update_module_data($module_data, true);
1480
 
 
1481
 
                                // Check for last sql error happened
1482
 
                                if ($db->sql_error_triggered)
1483
 
                                {
1484
 
                                        $error = $db->sql_error($db->sql_error_sql);
1485
 
                                        $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
1486
 
                                }
1487
 
 
1488
 
                                $categories[$cat_name]['id'] = (int) $module_data['module_id'];
1489
 
                                $categories[$cat_name]['parent_id'] = 0;
1490
 
 
1491
 
                                // Create sub-categories...
1492
 
                                if (is_array($subs))
1493
 
                                {
1494
 
                                        foreach ($subs as $level2_name)
1495
 
                                        {
1496
 
                                                $module_data = array(
1497
 
                                                        'module_basename'       => '',
1498
 
                                                        'module_enabled'        => 1,
1499
 
                                                        'module_display'        => 1,
1500
 
                                                        'parent_id'                     => (int) $categories[$cat_name]['id'],
1501
 
                                                        'module_class'          => $module_class,
1502
 
                                                        'module_langname'       => $level2_name,
1503
 
                                                        'module_mode'           => '',
1504
 
                                                        'module_auth'           => '',
1505
 
                                                );
1506
 
 
1507
 
                                                $_module->update_module_data($module_data, true);
1508
 
 
1509
 
                                                // Check for last sql error happened
1510
 
                                                if ($db->sql_error_triggered)
1511
 
                                                {
1512
 
                                                        $error = $db->sql_error($db->sql_error_sql);
1513
 
                                                        $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
1514
 
                                                }
1515
 
 
1516
 
                                                $categories[$level2_name]['id'] = (int) $module_data['module_id'];
1517
 
                                                $categories[$level2_name]['parent_id'] = (int) $categories[$cat_name]['id'];
1518
 
                                        }
1519
 
                                }
1520
 
                        }
1521
 
 
1522
 
                        // Get the modules we want to add... returned sorted by name
1523
 
                        $module_info = $_module->get_module_infos('', $module_class);
1524
 
 
1525
 
                        foreach ($module_info as $module_basename => $fileinfo)
1526
 
                        {
1527
 
                                foreach ($fileinfo['modes'] as $module_mode => $row)
1528
 
                                {
1529
 
                                        foreach ($row['cat'] as $cat_name)
1530
 
                                        {
1531
 
                                                if (!isset($categories[$cat_name]))
1532
 
                                                {
1533
 
                                                        continue;
1534
 
                                                }
1535
 
 
1536
 
                                                $module_data = array(
1537
 
                                                        'module_basename'       => $module_basename,
1538
 
                                                        'module_enabled'        => 1,
1539
 
                                                        'module_display'        => (isset($row['display'])) ? (int) $row['display'] : 1,
1540
 
                                                        'parent_id'                     => (int) $categories[$cat_name]['id'],
1541
 
                                                        'module_class'          => $module_class,
1542
 
                                                        'module_langname'       => $row['title'],
1543
 
                                                        'module_mode'           => $module_mode,
1544
 
                                                        'module_auth'           => $row['auth'],
1545
 
                                                );
1546
 
 
1547
 
                                                $_module->update_module_data($module_data, true);
1548
 
 
1549
 
                                                // Check for last sql error happened
1550
 
                                                if ($db->sql_error_triggered)
1551
 
                                                {
1552
 
                                                        $error = $db->sql_error($db->sql_error_sql);
1553
 
                                                        $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
1554
 
                                                }
1555
 
                                        }
1556
 
                                }
1557
 
                        }
1558
 
 
1559
 
                        // Move some of the modules around since the code above will put them in the wrong place
1560
 
                        if ($module_class == 'acp')
1561
 
                        {
1562
 
                                // Move main module 4 up...
1563
 
                                $sql = 'SELECT *
1564
 
                                        FROM ' . MODULES_TABLE . "
1565
 
                                        WHERE module_basename = 'main'
1566
 
                                                AND module_class = 'acp'
1567
 
                                                AND module_mode = 'main'";
1568
 
                                $result = $db->sql_query($sql);
1569
 
                                $row = $db->sql_fetchrow($result);
1570
 
                                $db->sql_freeresult($result);
1571
 
        
1572
 
                                $_module->move_module_by($row, 'move_up', 4);
1573
 
 
1574
 
                                // Move permissions intro screen module 4 up...
1575
 
                                $sql = 'SELECT *
1576
 
                                        FROM ' . MODULES_TABLE . "
1577
 
                                        WHERE module_basename = 'permissions'
1578
 
                                                AND module_class = 'acp'
1579
 
                                                AND module_mode = 'intro'";
1580
 
                                $result = $db->sql_query($sql);
1581
 
                                $row = $db->sql_fetchrow($result);
1582
 
                                $db->sql_freeresult($result);
1583
 
        
1584
 
                                $_module->move_module_by($row, 'move_up', 4);
1585
 
 
1586
 
                                // Move manage users screen module 5 up...
1587
 
                                $sql = 'SELECT *
1588
 
                                        FROM ' . MODULES_TABLE . "
1589
 
                                        WHERE module_basename = 'users'
1590
 
                                                AND module_class = 'acp'
1591
 
                                                AND module_mode = 'overview'";
1592
 
                                $result = $db->sql_query($sql);
1593
 
                                $row = $db->sql_fetchrow($result);
1594
 
                                $db->sql_freeresult($result);
1595
 
        
1596
 
                                $_module->move_module_by($row, 'move_up', 5);
1597
 
                        }
1598
 
 
1599
 
                        if ($module_class == 'ucp')
1600
 
                        {
1601
 
                                // Move attachment module 4 down...
1602
 
                                $sql = 'SELECT *
1603
 
                                        FROM ' . MODULES_TABLE . "
1604
 
                                        WHERE module_basename = 'attachments'
1605
 
                                                AND module_class = 'ucp'
1606
 
                                                AND module_mode = 'attachments'";
1607
 
                                $result = $db->sql_query($sql);
1608
 
                                $row = $db->sql_fetchrow($result);
1609
 
                                $db->sql_freeresult($result);
1610
 
        
1611
 
                                $_module->move_module_by($row, 'move_down', 4);
1612
 
                        }
1613
 
 
1614
 
                        // And now for the special ones
1615
 
                        // (these are modules which appear in multiple categories and thus get added manually to some for more control)
1616
 
                        if (isset($this->module_extras[$module_class]))
1617
 
                        {
1618
 
                                foreach ($this->module_extras[$module_class] as $cat_name => $mods)
1619
 
                                {
1620
 
                                        $sql = 'SELECT module_id, left_id, right_id
1621
 
                                                FROM ' . MODULES_TABLE . "
1622
 
                                                WHERE module_langname = '" . $db->sql_escape($cat_name) . "'
1623
 
                                                        AND module_class = '" . $db->sql_escape($module_class) . "'";
1624
 
                                        $result = $db->sql_query_limit($sql, 1);
1625
 
                                        $row2 = $db->sql_fetchrow($result);
1626
 
                                        $db->sql_freeresult($result);
1627
 
 
1628
 
                                        foreach ($mods as $mod_name)
1629
 
                                        {
1630
 
                                                $sql = 'SELECT *
1631
 
                                                        FROM ' . MODULES_TABLE . "
1632
 
                                                        WHERE module_langname = '" . $db->sql_escape($mod_name) . "'
1633
 
                                                                AND module_class = '" . $db->sql_escape($module_class) . "'
1634
 
                                                                AND module_basename <> ''";
1635
 
                                                $result = $db->sql_query_limit($sql, 1);
1636
 
                                                $row = $db->sql_fetchrow($result);
1637
 
                                                $db->sql_freeresult($result);
1638
 
 
1639
 
                                                $module_data = array(
1640
 
                                                        'module_basename'       => $row['module_basename'],
1641
 
                                                        'module_enabled'        => (int) $row['module_enabled'],
1642
 
                                                        'module_display'        => (int) $row['module_display'],
1643
 
                                                        'parent_id'                     => (int) $row2['module_id'],
1644
 
                                                        'module_class'          => $row['module_class'],
1645
 
                                                        'module_langname'       => $row['module_langname'],
1646
 
                                                        'module_mode'           => $row['module_mode'],
1647
 
                                                        'module_auth'           => $row['module_auth'],
1648
 
                                                );
1649
 
 
1650
 
                                                $_module->update_module_data($module_data, true);
1651
 
 
1652
 
                                                // Check for last sql error happened
1653
 
                                                if ($db->sql_error_triggered)
1654
 
                                                {
1655
 
                                                        $error = $db->sql_error($db->sql_error_sql);
1656
 
                                                        $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
1657
 
                                                }
1658
 
                                        }
1659
 
                                }
1660
 
                        }
1661
 
 
1662
 
                        $_module->remove_cache_file();
1663
 
                }
1664
 
        }
1665
 
 
1666
 
        /**
1667
 
        * Populate the language tables
1668
 
        */
1669
 
        function add_language($mode, $sub)
1670
 
        {
1671
 
                global $db, $lang, $phpbb_root_path, $phpEx;
1672
 
 
1673
 
                $dir = @opendir($phpbb_root_path . 'language');
1674
 
 
1675
 
                if (!$dir)
1676
 
                {
1677
 
                        $this->error('Unable to access the language directory', __LINE__, __FILE__);
1678
 
                }
1679
 
 
1680
 
                while (($file = readdir($dir)) !== false)
1681
 
                {
1682
 
                        $path = $phpbb_root_path . 'language/' . $file;
1683
 
 
1684
 
                        if ($file == '.' || $file == '..' || is_link($path) || is_file($path) || $file == 'CVS')
1685
 
                        {
1686
 
                                continue;
1687
 
                        }
1688
 
 
1689
 
                        if (is_dir($path) && file_exists($path . '/iso.txt'))
1690
 
                        {
1691
 
                                $lang_file = file("{$phpbb_root_path}language/$path/iso.txt");
1692
 
 
1693
 
                                $lang_pack = array(
1694
 
                                        'lang_iso'                      => basename($path),
1695
 
                                        'lang_dir'                      => basename($path),
1696
 
                                        'lang_english_name'     => trim(htmlspecialchars($lang_file[0])),
1697
 
                                        'lang_local_name'       => trim(htmlspecialchars($lang_file[1], ENT_COMPAT, 'UTF-8')),
1698
 
                                        'lang_author'           => trim(htmlspecialchars($lang_file[2], ENT_COMPAT, 'UTF-8')),
1699
 
                                );
1700
 
 
1701
 
                                $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $lang_pack));
1702
 
 
1703
 
                                if ($db->sql_error_triggered)
1704
 
                                {
1705
 
                                        $error = $db->sql_error($db->sql_error_sql);
1706
 
                                        $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
1707
 
                                }
1708
 
 
1709
 
                                $valid_localized = array(
1710
 
                                        'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',
1711
 
                                );
1712
 
 
1713
 
                                $sql_ary = array();
1714
 
 
1715
 
                                $sql = 'SELECT *
1716
 
                                        FROM ' . STYLES_IMAGESET_TABLE;
1717
 
                                $result = $db->sql_query($sql);
1718
 
 
1719
 
                                while ($imageset_row = $db->sql_fetchrow($result))
1720
 
                                {
1721
 
                                        if (@file_exists("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg"))
1722
 
                                        {
1723
 
                                                $cfg_data_imageset_data = parse_cfg_file("{$phpbb_root_path}styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['lang_iso']}/imageset.cfg");
1724
 
                                                foreach ($cfg_data_imageset_data as $image_name => $value)
1725
 
                                                {
1726
 
                                                        if (strpos($value, '*') !== false)
1727
 
                                                        {
1728
 
                                                                if (substr($value, -1, 1) === '*')
1729
 
                                                                {
1730
 
                                                                        list($image_filename, $image_height) = explode('*', $value);
1731
 
                                                                        $image_width = 0;
1732
 
                                                                }
1733
 
                                                                else
1734
 
                                                                {
1735
 
                                                                        list($image_filename, $image_height, $image_width) = explode('*', $value);
1736
 
                                                                }
1737
 
                                                        }
1738
 
                                                        else
1739
 
                                                        {
1740
 
                                                                $image_filename = $value;
1741
 
                                                                $image_height = $image_width = 0;
1742
 
                                                        }
1743
 
 
1744
 
                                                        if (strpos($image_name, 'img_') === 0 && $image_filename)
1745
 
                                                        {
1746
 
                                                                $image_name = substr($image_name, 4);
1747
 
                                                                if (in_array($image_name, $valid_localized))
1748
 
                                                                {
1749
 
                                                                        $sql_ary[] = array(
1750
 
                                                                                'image_name'            => (string) $image_name,
1751
 
                                                                                'image_filename'        => (string) $image_filename,
1752
 
                                                                                'image_height'          => (int) $image_height,
1753
 
                                                                                'image_width'           => (int) $image_width,
1754
 
                                                                                'imageset_id'           => (int) $imageset_row['imageset_id'],
1755
 
                                                                                'image_lang'            => (string) $lang_pack['lang_iso'],
1756
 
                                                                        );
1757
 
                                                                }
1758
 
                                                        }
1759
 
                                                }
1760
 
                                        }
1761
 
                                }
1762
 
                                $db->sql_freeresult($result);
1763
 
 
1764
 
                                if (sizeof($sql_ary))
1765
 
                                {
1766
 
                                        $db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
1767
 
 
1768
 
                                        if ($db->sql_error_triggered)
1769
 
                                        {
1770
 
                                                $error = $db->sql_error($db->sql_error_sql);
1771
 
                                                $this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
1772
 
                                        }
1773
 
                                }
1774
 
                        }
1775
 
                }
1776
 
                closedir($dir);
1777
 
        }
1778
 
 
1779
 
        /**
1780
 
        * Add search robots to the database
1781
 
        */
1782
 
        function add_bots($mode, $sub)
1783
 
        {
1784
 
                global $db, $lang, $phpbb_root_path, $phpEx, $config;
1785
 
 
1786
 
                // Obtain any submitted data
1787
 
                $data = $this->get_submitted_data();
1788
 
 
1789
 
                // Fill the config array - it is needed by those functions we call
1790
 
                $sql = 'SELECT *
1791
 
                        FROM ' . CONFIG_TABLE;
1792
 
                $result = $db->sql_query($sql);
1793
 
 
1794
 
                $config = array();
1795
 
                while ($row = $db->sql_fetchrow($result))
1796
 
                {
1797
 
                        $config[$row['config_name']] = $row['config_value'];
1798
 
                }
1799
 
                $db->sql_freeresult($result);
1800
 
 
1801
 
                $sql = 'SELECT group_id
1802
 
                        FROM ' . GROUPS_TABLE . "
1803
 
                        WHERE group_name = 'BOTS'";
1804
 
                $result = $db->sql_query($sql);
1805
 
                $group_id = (int) $db->sql_fetchfield('group_id');
1806
 
                $db->sql_freeresult($result);
1807
 
 
1808
 
                if (!$group_id)
1809
 
                {
1810
 
                        // If we reach this point then something has gone very wrong
1811
 
                        $this->p_master->error($lang['NO_GROUP'], __LINE__, __FILE__);
1812
 
                }
1813
 
 
1814
 
                if (!function_exists('user_add'))
1815
 
                {
1816
 
                        include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
1817
 
                }
1818
 
 
1819
 
                foreach ($this->bot_list as $bot_name => $bot_ary)
1820
 
                {
1821
 
                        $user_row = array(
1822
 
                                'user_type'                             => USER_IGNORE,
1823
 
                                'group_id'                              => $group_id,
1824
 
                                'username'                              => $bot_name,
1825
 
                                'user_regdate'                  => time(),
1826
 
                                'user_password'                 => '',
1827
 
                                'user_colour'                   => '9E8DA7',
1828
 
                                'user_email'                    => '',
1829
 
                                'user_lang'                             => $data['default_lang'],
1830
 
                                'user_style'                    => 1,
1831
 
                                'user_timezone'                 => 0,
1832
 
                                'user_dateformat'               => $lang['default_dateformat'],
1833
 
                                'user_allow_massemail'  => 0,
1834
 
                        );
1835
 
                        
1836
 
                        $user_id = user_add($user_row);
1837
 
 
1838
 
                        if (!$user_id)
1839
 
                        {
1840
 
                                // If we can't insert this user then continue to the next one to avoid inconsistant data
1841
 
                                $this->p_master->db_error('Unable to insert bot into users table', $db->sql_error_sql, __LINE__, __FILE__, true);
1842
 
                                continue;
1843
 
                        }
1844
 
 
1845
 
                        $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
1846
 
                                'bot_active'    => 1,
1847
 
                                'bot_name'              => (string) $bot_name,
1848
 
                                'user_id'               => (int) $user_id,
1849
 
                                'bot_agent'             => (string) $bot_ary[0],
1850
 
                                'bot_ip'                => (string) $bot_ary[1],
1851
 
                        ));
1852
 
 
1853
 
                        $result = $db->sql_query($sql);
1854
 
                }
1855
 
        }
1856
 
 
1857
 
        /**
1858
 
        * Sends an email to the board administrator with their password and some useful links
1859
 
        */
1860
 
        function email_admin($mode, $sub)
1861
 
        {
1862
 
                global $auth, $config, $db, $lang, $template, $user, $phpbb_root_path, $phpEx;
1863
 
 
1864
 
                $this->page_title = $lang['STAGE_FINAL'];
1865
 
 
1866
 
                // Obtain any submitted data
1867
 
                $data = $this->get_submitted_data();
1868
 
 
1869
 
                $sql = 'SELECT *
1870
 
                        FROM ' . CONFIG_TABLE;
1871
 
                $result = $db->sql_query($sql);
1872
 
 
1873
 
                $config = array();
1874
 
                while ($row = $db->sql_fetchrow($result))
1875
 
                {
1876
 
                        $config[$row['config_name']] = $row['config_value'];
1877
 
                }
1878
 
                $db->sql_freeresult($result);
1879
 
 
1880
 
                $user->session_begin();
1881
 
                $auth->login($data['admin_name'], $data['admin_pass1'], false, true, true);
1882
 
 
1883
 
                // OK, Now that we've reached this point we can be confident that everything
1884
 
                // is installed and working......I hope :)
1885
 
                // So it's time to send an email to the administrator confirming the details
1886
 
                // they entered
1887
 
 
1888
 
                if ($config['email_enable'])
1889
 
                {
1890
 
                        include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
1891
 
 
1892
 
                        $messenger = new messenger(false);
1893
 
 
1894
 
                        $messenger->template('installed', $data['language']);
1895
 
 
1896
 
                        $messenger->to($data['board_email1'], $data['admin_name']);
1897
 
 
1898
 
                        $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
1899
 
                        $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
1900
 
                        $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
1901
 
                        $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
1902
 
 
1903
 
                        $messenger->assign_vars(array(
1904
 
                                'USERNAME'              => htmlspecialchars_decode($data['admin_name']),
1905
 
                                'PASSWORD'              => htmlspecialchars_decode($data['admin_pass1']))
1906
 
                        );
1907
 
 
1908
 
                        $messenger->send(NOTIFY_EMAIL);
1909
 
                }
1910
 
 
1911
 
                // And finally, add a note to the log
1912
 
                add_log('admin', 'LOG_INSTALL_INSTALLED', $config['version']);
1913
 
 
1914
 
                $template->assign_vars(array(
1915
 
                        'TITLE'         => $lang['INSTALL_CONGRATS'],
1916
 
                        'BODY'          => sprintf($lang['INSTALL_CONGRATS_EXPLAIN'], $config['version'], append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=convert&amp;language=' . $data['language']), '../docs/README.html'),
1917
 
                        'L_SUBMIT'      => $lang['INSTALL_LOGIN'],
1918
 
                        'U_ACTION'      => append_sid($phpbb_root_path . 'adm/index.' . $phpEx),
1919
 
                ));
1920
 
        }
1921
 
 
1922
 
        /**
1923
 
        * Generate a list of available mail server authentication methods
1924
 
        */
1925
 
        function mail_auth_select($selected_method)
1926
 
        {
1927
 
                global $lang;
1928
 
 
1929
 
                $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP');
1930
 
                $s_smtp_auth_options = '';
1931
 
 
1932
 
                foreach ($auth_methods as $method)
1933
 
                {
1934
 
                        $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $lang['SMTP_' . str_replace('-', '_', $method)] . '</option>';
1935
 
                }
1936
 
 
1937
 
                return $s_smtp_auth_options;
1938
 
        }
1939
 
 
1940
 
        /**
1941
 
        * Get submitted data
1942
 
        */
1943
 
        function get_submitted_data()
1944
 
        {
1945
 
                return array(
1946
 
                        'language'              => basename(request_var('language', '')),
1947
 
                        'dbms'                  => request_var('dbms', ''),
1948
 
                        'dbhost'                => request_var('dbhost', ''),
1949
 
                        'dbport'                => request_var('dbport', ''),
1950
 
                        'dbuser'                => request_var('dbuser', ''),
1951
 
                        'dbpasswd'              => htmlspecialchars_decode(request_var('dbpasswd', '', true)),
1952
 
                        'dbname'                => request_var('dbname', ''),
1953
 
                        'table_prefix'  => request_var('table_prefix', ''),
1954
 
                        'default_lang'  => basename(request_var('default_lang', '')),
1955
 
                        'admin_name'    => utf8_normalize_nfc(request_var('admin_name', '', true)),
1956
 
                        'admin_pass1'   => request_var('admin_pass1', '', true),
1957
 
                        'admin_pass2'   => request_var('admin_pass2', '', true),
1958
 
                        'board_email1'  => strtolower(request_var('board_email1', '')),
1959
 
                        'board_email2'  => strtolower(request_var('board_email2', '')),
1960
 
                        'img_imagick'   => request_var('img_imagick', ''),
1961
 
                        'ftp_path'              => request_var('ftp_path', ''),
1962
 
                        'ftp_user'              => request_var('ftp_user', ''),
1963
 
                        'ftp_pass'              => request_var('ftp_pass', ''),
1964
 
                        'email_enable'  => request_var('email_enable', ''),
1965
 
                        'smtp_delivery' => request_var('smtp_delivery', ''),
1966
 
                        'smtp_host'             => request_var('smtp_host', ''),
1967
 
                        'smtp_auth'             => request_var('smtp_auth', ''),
1968
 
                        'smtp_user'             => request_var('smtp_user', ''),
1969
 
                        'smtp_pass'             => request_var('smtp_pass', ''),
1970
 
                        'cookie_secure' => request_var('cookie_secure', ''),
1971
 
                        'force_server_vars'     => request_var('force_server_vars', ''),
1972
 
                        'server_protocol'       => request_var('server_protocol', ''),
1973
 
                        'server_name'   => request_var('server_name', ''),
1974
 
                        'server_port'   => request_var('server_port', ''),
1975
 
                        'script_path'   => request_var('script_path', ''),
1976
 
                );
1977
 
        }
1978
 
 
1979
 
        /**
1980
 
        * The information below will be used to build the input fields presented to the user
1981
 
        */
1982
 
        var $db_config_options = array(
1983
 
                'legend1'                               => 'DB_CONFIG',
1984
 
                'dbms'                                  => array('lang' => 'DBMS',                      'type' => 'select', 'options' => 'dbms_select(\'{VALUE}\')', 'explain' => false),
1985
 
                'dbhost'                                => array('lang' => 'DB_HOST',           'type' => 'text:25:100', 'explain' => true),
1986
 
                'dbport'                                => array('lang' => 'DB_PORT',           'type' => 'text:25:100', 'explain' => true),
1987
 
                'dbname'                                => array('lang' => 'DB_NAME',           'type' => 'text:25:100', 'explain' => false),
1988
 
                'dbuser'                                => array('lang' => 'DB_USERNAME',       'type' => 'text:25:100', 'explain' => false),
1989
 
                'dbpasswd'                              => array('lang' => 'DB_PASSWORD',       'type' => 'password:25:100', 'explain' => false),
1990
 
                'table_prefix'                  => array('lang' => 'TABLE_PREFIX',      'type' => 'text:25:100', 'explain' => false),
1991
 
        );
1992
 
        var $admin_config_options = array(
1993
 
                'legend1'                               => 'ADMIN_CONFIG',
1994
 
                'default_lang'                  => array('lang' => 'DEFAULT_LANG',                              'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false),
1995
 
                'admin_name'                    => array('lang' => 'ADMIN_USERNAME',                    'type' => 'text:25:100', 'explain' => true),
1996
 
                'admin_pass1'                   => array('lang' => 'ADMIN_PASSWORD',                    'type' => 'password:25:100', 'explain' => true),
1997
 
                'admin_pass2'                   => array('lang' => 'ADMIN_PASSWORD_CONFIRM',    'type' => 'password:25:100', 'explain' => false),
1998
 
                'board_email1'                  => array('lang' => 'CONTACT_EMAIL',                             'type' => 'text:25:100', 'explain' => false),
1999
 
                'board_email2'                  => array('lang' => 'CONTACT_EMAIL_CONFIRM',             'type' => 'text:25:100', 'explain' => false),
2000
 
        );
2001
 
        var $advanced_config_options = array(
2002
 
                'legend1'                               => 'ACP_EMAIL_SETTINGS',
2003
 
                'email_enable'                  => array('lang' => 'ENABLE_EMAIL',              'type' => 'radio:enabled_disabled', 'explain' => true),
2004
 
                'smtp_delivery'                 => array('lang' => 'USE_SMTP',                  'type' => 'radio:yes_no', 'explain' => true),
2005
 
                'smtp_host'                             => array('lang' => 'SMTP_SERVER',               'type' => 'text:25:50', 'explain' => false),
2006
 
                'smtp_auth'                             => array('lang' => 'SMTP_AUTH_METHOD',  'type' => 'select', 'options' => '$this->module->mail_auth_select(\'{VALUE}\')', 'explain' => true),
2007
 
                'smtp_user'                             => array('lang' => 'SMTP_USERNAME',             'type' => 'text:25:255', 'explain' => true),
2008
 
                'smtp_pass'                             => array('lang' => 'SMTP_PASSWORD',             'type' => 'password:25:255', 'explain' => true),
2009
 
 
2010
 
                'legend2'                               => 'SERVER_URL_SETTINGS',
2011
 
                'cookie_secure'                 => array('lang' => 'COOKIE_SECURE',             'type' => 'radio:enabled_disabled', 'explain' => true),
2012
 
                'force_server_vars'             => array('lang' => 'FORCE_SERVER_VARS', 'type' => 'radio:yes_no', 'explain' => true),
2013
 
                'server_protocol'               => array('lang' => 'SERVER_PROTOCOL',   'type' => 'text:10:10', 'explain' => true),
2014
 
                'server_name'                   => array('lang' => 'SERVER_NAME',               'type' => 'text:40:255', 'explain' => true),
2015
 
                'server_port'                   => array('lang' => 'SERVER_PORT',               'type' => 'text:5:5', 'explain' => true),
2016
 
                'script_path'                   => array('lang' => 'SCRIPT_PATH',               'type' => 'text::255', 'explain' => true),
2017
 
        );
2018
 
 
2019
 
        /**
2020
 
        * Specific PHP modules we may require for certain optional or extended features
2021
 
        */
2022
 
        var $php_dlls_other = array('zlib', 'ftp', 'gd', 'xml');
2023
 
 
2024
 
        /**
2025
 
        * A list of the web-crawlers/bots we recognise by default
2026
 
        *
2027
 
        * Candidates but not included:
2028
 
        * 'Accoona [Bot]'                               'Accoona-AI-Agent/'
2029
 
        * 'ASPseek [Crawler]'                   'ASPseek/'
2030
 
        * 'Boitho [Crawler]'                    'boitho.com-dc/'
2031
 
        * 'Bunnybot [Bot]'                              'powered by www.buncat.de'
2032
 
        * 'Cosmix [Bot]'                                'cfetch/'
2033
 
        * 'Crawler Search [Crawler]'    '.Crawler-Search.de'
2034
 
        * 'Findexa [Crawler]'                   'Findexa Crawler ('
2035
 
        * 'GBSpider [Spider]'                   'GBSpider v'
2036
 
        * 'genie [Bot]'                                 'genieBot ('
2037
 
        * 'Hogsearch [Bot]'                             'oegp v. 1.3.0'
2038
 
        * 'Insuranco [Bot]'                             'InsurancoBot'
2039
 
        * 'IRLbot [Bot]'                                'http://irl.cs.tamu.edu/crawler'
2040
 
        * 'ISC Systems [Bot]'                   'ISC Systems iRc Search'
2041
 
        * 'Jyxobot [Bot]'                               'Jyxobot/'
2042
 
        * 'Kraehe [Metasuche]'                  '-DIE-KRAEHE- META-SEARCH-ENGINE/'
2043
 
        * 'LinkWalker'                                  'LinkWalker'
2044
 
        * 'MMSBot [Bot]'                                'http://www.mmsweb.at/bot.html'
2045
 
        * 'Naver [Bot]'                                 'nhnbot@naver.com)'
2046
 
        * 'NetResearchServer'                   'NetResearchServer/'
2047
 
        * 'Nimble [Crawler]'                    'NimbleCrawler'
2048
 
        * 'Ocelli [Bot]'                                'Ocelli/'
2049
 
        * 'Onsearch [Bot]'                              'onCHECK-Robot'
2050
 
        * 'Orange [Spider]'                             'OrangeSpider'
2051
 
        * 'Sproose [Bot]'                               'http://www.sproose.com/bot'
2052
 
        * 'Susie [Sync]'                                '!Susie (http://www.sync2it.com/susie)'
2053
 
        * 'Tbot [Bot]'                                  'Tbot/'
2054
 
        * 'Thumbshots [Capture]'                'thumbshots-de-Bot'
2055
 
        * 'Vagabondo [Crawler]'                 'http://webagent.wise-guys.nl/'
2056
 
        * 'Walhello [Bot]'                              'appie 1.1 (www.walhello.com)'
2057
 
        * 'WissenOnline [Bot]'                  'WissenOnline-Bot'
2058
 
        * 'WWWeasel [Bot]'                              'WWWeasel Robot v'
2059
 
        * 'Xaldon [Spider]'                             'Xaldon WebSpider'
2060
 
        */
2061
 
        var $bot_list = array(
2062
 
                'AdsBot [Google]'                       => array('AdsBot-Google', ''),
2063
 
                'Alexa [Bot]'                           => array('ia_archiver', ''),
2064
 
                'Alta Vista [Bot]'                      => array('Scooter/', ''),
2065
 
                'Ask Jeeves [Bot]'                      => array('Ask Jeeves', ''),
2066
 
                'Baidu [Spider]'                        => array('Baiduspider+(', ''),
2067
 
                'Exabot [Bot]'                          => array('Exabot/', ''),
2068
 
                'FAST Enterprise [Crawler]'     => array('FAST Enterprise Crawler', ''),
2069
 
                'FAST WebCrawler [Crawler]'     => array('FAST-WebCrawler/', ''),
2070
 
                'Francis [Bot]'                         => array('http://www.neomo.de/', ''),
2071
 
                'Gigabot [Bot]'                         => array('Gigabot/', ''),
2072
 
                'Google Adsense [Bot]'          => array('Mediapartners-Google', ''),
2073
 
                'Google Desktop'                        => array('Google Desktop', ''),
2074
 
                'Google Feedfetcher'            => array('Feedfetcher-Google', ''),
2075
 
                'Google [Bot]'                          => array('Googlebot', ''),
2076
 
                'Heise IT-Markt [Crawler]'      => array('heise-IT-Markt-Crawler', ''),
2077
 
                'Heritrix [Crawler]'            => array('heritrix/1.', ''),
2078
 
                'IBM Research [Bot]'            => array('ibm.com/cs/crawler', ''),
2079
 
                'ICCrawler - ICjobs'            => array('ICCrawler - ICjobs', ''),
2080
 
                'ichiro [Crawler]'                      => array('ichiro/2', ''),
2081
 
                'Majestic-12 [Bot]'                     => array('MJ12bot/', ''),
2082
 
                'Metager [Bot]'                         => array('MetagerBot/', ''),
2083
 
                'MSN NewsBlogs'                         => array('msnbot-NewsBlogs/', ''),
2084
 
                'MSN [Bot]'                                     => array('msnbot/', ''),
2085
 
                'MSNbot Media'                          => array('msnbot-media/', ''),
2086
 
                'NG-Search [Bot]'                       => array('NG-Search/', ''),
2087
 
                'Nutch [Bot]'                           => array('http://lucene.apache.org/nutch/', ''),
2088
 
                'Nutch/CVS [Bot]'                       => array('NutchCVS/', ''),
2089
 
                'OmniExplorer [Bot]'            => array('OmniExplorer_Bot/', ''),
2090
 
                'Online link [Validator]'       => array('online link validator', ''),
2091
 
                'psbot [Picsearch]'                     => array('psbot/0', ''),
2092
 
                'Seekport [Bot]'                        => array('Seekbot/', ''),
2093
 
                'Sensis [Crawler]'                      => array('Sensis Web Crawler', ''),
2094
 
                'SEO Crawler'                           => array('SEO search Crawler/', ''),
2095
 
                'Seoma [Crawler]'                       => array('Seoma [SEO Crawler]', ''),
2096
 
                'SEOSearch [Crawler]'           => array('SEOsearch/', ''),
2097
 
                'Snappy [Bot]'                          => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''),
2098
 
                'Steeler [Crawler]'                     => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''),
2099
 
                'Synoo [Bot]'                           => array('SynooBot/', ''),
2100
 
                'Telekom [Bot]'                         => array('crawleradmin.t-info@telekom.de', ''),
2101
 
                'TurnitinBot [Bot]'                     => array('TurnitinBot/', ''),
2102
 
                'Voyager [Bot]'                         => array('voyager/1.0', ''),
2103
 
                'W3 [Sitesearch]'                       => array('W3 SiteSearch Crawler', ''),
2104
 
                'W3C [Linkcheck]'                       => array('W3C-checklink/', ''),
2105
 
                'W3C [Validator]'                       => array('W3C_*Validator', ''),
2106
 
                'WiseNut [Bot]'                         => array('http://www.WISEnutbot.com', ''),
2107
 
                'YaCy [Bot]'                            => array('yacybot', ''),
2108
 
                'Yahoo MMCrawler [Bot]'         => array('Yahoo-MMCrawler/', ''),
2109
 
                'Yahoo Slurp [Bot]'                     => array('Yahoo! DE Slurp', ''),
2110
 
                'Yahoo [Bot]'                           => array('Yahoo! Slurp', ''),
2111
 
                'YahooSeeker [Bot]'                     => array('YahooSeeker/', ''),
2112
 
        );
2113
 
 
2114
 
        /**
2115
 
        * Define the module structure so that we can populate the database without
2116
 
        * needing to hard-code module_id values
2117
 
        */
2118
 
        var $module_categories = array(
2119
 
                'acp'   => array(
2120
 
                        'ACP_CAT_GENERAL'               => array(
2121
 
                                'ACP_QUICK_ACCESS',
2122
 
                                'ACP_BOARD_CONFIGURATION',
2123
 
                                'ACP_CLIENT_COMMUNICATION',
2124
 
                                'ACP_SERVER_CONFIGURATION',
2125
 
                        ),
2126
 
                        'ACP_CAT_FORUMS'                => array(
2127
 
                                'ACP_MANAGE_FORUMS',
2128
 
                                'ACP_FORUM_BASED_PERMISSIONS',
2129
 
                        ),
2130
 
                        'ACP_CAT_POSTING'               => array(
2131
 
                                'ACP_MESSAGES',
2132
 
                                'ACP_ATTACHMENTS',
2133
 
                        ),
2134
 
                        'ACP_CAT_USERGROUP'             => array(
2135
 
                                'ACP_CAT_USERS',
2136
 
                                'ACP_GROUPS',
2137
 
                                'ACP_USER_SECURITY',
2138
 
                        ),
2139
 
                        'ACP_CAT_PERMISSIONS'   => array(
2140
 
                                'ACP_GLOBAL_PERMISSIONS',
2141
 
                                'ACP_FORUM_BASED_PERMISSIONS',
2142
 
                                'ACP_PERMISSION_ROLES',
2143
 
                                'ACP_PERMISSION_MASKS',
2144
 
                        ),
2145
 
                        'ACP_CAT_STYLES'                => array(
2146
 
                                'ACP_STYLE_MANAGEMENT',
2147
 
                                'ACP_STYLE_COMPONENTS',
2148
 
                        ),
2149
 
                        'ACP_CAT_MAINTENANCE'   => array(
2150
 
                                'ACP_FORUM_LOGS',
2151
 
                                'ACP_CAT_DATABASE',
2152
 
                        ),
2153
 
                        'ACP_CAT_SYSTEM'                => array(
2154
 
                                'ACP_AUTOMATION',
2155
 
                                'ACP_GENERAL_TASKS',
2156
 
                                'ACP_MODULE_MANAGEMENT',
2157
 
                        ),
2158
 
                        'ACP_CAT_DOT_MODS'              => null,
2159
 
                ),
2160
 
                'mcp'   => array(
2161
 
                        'MCP_MAIN'              => null,
2162
 
                        'MCP_QUEUE'             => null,
2163
 
                        'MCP_REPORTS'   => null,
2164
 
                        'MCP_NOTES'             => null,
2165
 
                        'MCP_WARN'              => null,
2166
 
                        'MCP_LOGS'              => null,
2167
 
                        'MCP_BAN'               => null,
2168
 
                ),
2169
 
                'ucp'   => array(
2170
 
                        'UCP_MAIN'                      => null,
2171
 
                        'UCP_PROFILE'           => null,
2172
 
                        'UCP_PREFS'                     => null,
2173
 
                        'UCP_PM'                        => null,
2174
 
                        'UCP_USERGROUPS'        => null,
2175
 
                        'UCP_ZEBRA'                     => null,
2176
 
                ),
2177
 
        );
2178
 
 
2179
 
        var $module_extras = array(
2180
 
                'acp'   => array(
2181
 
                        'ACP_QUICK_ACCESS' => array(
2182
 
                                'ACP_MANAGE_USERS',
2183
 
                                'ACP_GROUPS_MANAGE',
2184
 
                                'ACP_MANAGE_FORUMS',
2185
 
                                'ACP_MOD_LOGS',
2186
 
                                'ACP_BOTS',
2187
 
                                'ACP_PHP_INFO',
2188
 
                        ),
2189
 
                        'ACP_FORUM_BASED_PERMISSIONS' => array(
2190
 
                                'ACP_FORUM_PERMISSIONS',
2191
 
                                'ACP_FORUM_MODERATORS',
2192
 
                                'ACP_USERS_FORUM_PERMISSIONS',
2193
 
                                'ACP_GROUPS_FORUM_PERMISSIONS',
2194
 
                        ),
2195
 
                ),
2196
 
        );
2197
 
}
2198
 
 
2199
 
?>
 
 
b'\\ No newline at end of file'