-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.php
698 lines (625 loc) · 22.5 KB
/
tools.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.0.8 - Licence Number VBFD20582F
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000–2010 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
error_reporting(E_ALL & ~E_NOTICE);
define('VERSION', '4.0.8');
define('THIS_SCRIPT', 'tools.php');
define('VB_AREA', 'tools');
define('VB_ENTRY', 1);
if (strlen('96c32c41a2e3ed7b6d12a558375c9433') == 32)
{
/**
* @ignore
*/
define('CUSTOMER_NUMBER', '96c32c41a2e3ed7b6d12a558375c9433');
}
else
{
/**
* @ignore
*/
define('CUSTOMER_NUMBER', md5(strtoupper('96c32c41a2e3ed7b6d12a558375c9433')));
}
if (file_exists('./../includes/init.php'))
{ // need to go up a single directory, we must be in includes / admincp / modcp / install
chdir('./../');
}
else
{
die('Please place this file within the admincp / install folder');
}
require_once('./install/init.php');
require_once(DIR . '/includes/adminfunctions.php');
$specialtemplates = array();
$datastore_class = (!empty($vbulletin->config['Datastore']['class'])) ? $vbulletin->config['Datastore']['class'] : 'vB_Datastore';
if ($datastore_class != 'vB_Datastore')
{
require_once(DIR . '/includes/class_datastore.php');
}
$vbulletin->datastore = new $datastore_class($vbulletin, $db);
$vbulletin->datastore->fetch($specialtemplates);
$type = $vbulletin->input->clean_gpc('r', 'type', TYPE_STR);
$customerid = $vbulletin->input->clean_gpc('p', 'customerid', TYPE_STR);
$bbcustomerid = $vbulletin->input->clean_gpc('c', 'bbcustomerid', TYPE_STR);
// #############################################################################
if ($_POST['do'] == 'login')
{
if (md5(strtoupper($vbulletin->GPC['customerid'])) == CUSTOMER_NUMBER)
{
setcookie('bbcustomerid', md5(strtoupper($vbulletin->GPC['customerid'])), 0, '/', '');
$vbulletin->GPC['bbcustomerid'] = CUSTOMER_NUMBER;
$_REQUEST['do'] = '';
}
}
// #############################################################################
if ($vbulletin->GPC['bbcustomerid'] !== CUSTOMER_NUMBER)
{
global $stylevar;
// set the style folder
if (empty($vbulletin->options['cpstylefolder']))
{
$vbulletin->options['cpstylefolder'] = 'vBulletin_3_Silver';
}
// set the forumhome script
if (empty($vbulletin->options['forumhome']))
{
$vbulletin->options['forumhome'] = 'index';
}
// set the version
$vbulletin->options['templateversion'] = VERSION;
define('NO_PAGE_TITLE', true);
print_cp_header('Tools');
?>
<form action="<?php echo THIS_SCRIPT; ?>?do=login" method="post">
<input type="hidden" name="do" value="login" />
<p> </p><p> </p>
<table class="tborder" cellpadding="0" cellspacing="0" border="0" width="450" align="center"><tr><td>
<!-- header -->
<div class="tcat" style="padding:4px; text-align:center"><b>Enter Customer Number</b></div>
<!-- /header -->
<!-- logo and version -->
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="navbody">
<tr valign="bottom">
<td><img src="../cpstyles/<?php echo $vbulletin->options['cpstylefolder']; ?>/cp_logo.gif" alt="" border="0" /></td>
<td>
<b><a href="../<?php echo $vbulletin->options['forumhome']; ?>.php"><?php echo $vbulletin->options['bbtitle']; ?></a></b><br />
<?php echo 'vBulletin ' . $vbulletin->options['templateversion'] . ' Tools'; ?><br />
</td>
</tr>
</table>
<!-- /logo and version -->
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="logincontrols">
<col width="50%" style="text-align:right; white-space:nowrap"></col>
<col></col>
<col width="50%"></col>
<!-- login fields -->
<tr valign="top">
<td> <br />Customer Number<br /> </td>
<td class="smallfont"><input type="text" style="padding-left:5px; font-weight:bold; width:250px" name="customerid" value="" tabindex="1" /><br />This is the number with which you log in to the vBulletin.com Members' Area</td>
<td> </td>
</tr>
<!-- /login fields -->
<!-- submit row -->
<tr>
<td colspan="3" align="center">
<input type="submit" class="button" value="Enter Tools System" accesskey="s" tabindex="3" />
</td>
</tr>
<!-- /submit row -->
</table>
</td></tr></table>
</form>
<?php
unset($debug, $GLOBALS['DEVDEBUG']);
print_cp_footer();
}
#####################################
# phrases for import systems
#####################################
$vbphrase['importing_language'] = 'Importing Language';
$vbphrase['importing_style'] = 'Importing Style';
$vbphrase['importing_admin_help'] = 'Importing Admin Help';
$vbphrase['importing_settings'] = 'Importing Setting';
$vbphrase['please_wait'] = 'Please Wait';
$vbphrase['language'] = 'Language';
$vbphrase['master_language'] = 'Master Language';
$vbphrase['admin_help'] = 'Admin Help';
$vbphrase['style'] = 'Style';
$vbphrase['styles'] = 'Styles';
$vbphrase['settings'] = 'Settings';
$vbphrase['master_style'] = 'MASTER STYLE';
$vbphrase['templates'] = 'Templates';
$vbphrase['css'] = 'CSS';
$vbphrase['stylevars'] = 'Stylevars';
$vbphrase['replacement_variables'] = 'Replacement Variables';
$vbphrase['controls'] = 'Controls';
$vbphrase['rebuild_style_information'] = 'Rebuild Style Information';
$vbphrase['updating_style_information_for_each_style'] = 'Updating style information for each style';
$vbphrase['updating_styles_with_no_parents'] = 'Updating style sets with no parent information';
$vbphrase['updated_x_styles'] = 'Updated %1$s Styles';
$vbphrase['no_styles_needed_updating'] = 'No Styles Needed Updating';
$vbphrase['processing_complete_proceed'] = 'Processing Complete - Proceed';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>vBulletin Tools</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" href="../cpstyles/vBulletin_3_Silver/controlpanel.css" />
<script type="text/javascript">var SESSIONHASH = "";</script>
<script type="text/javascript" src="../clientscript/vbulletin_global.js"></script>
</head>
<body style="margin:0px">
<!-- END CONTROL PANEL HEADER -->
<?php
if (empty($_REQUEST['do']))
{
// Get versions of .xml files for header diagnostics
if ($fp = @fopen('./install/vbulletin-style.xml', 'rb'))
{
$data = fread($fp, 256);
if (preg_match('#vbversion="(.*?)"#', $data, $matches))
{
$style_xml = $matches[1];
}
else
{
$style_xml = 'Unknown';
}
fclose($fp);
}
else
{
$style_xml = 'N/A';
}
if ($fp = @fopen('./install/vbulletin-language.xml', 'rb'))
{
$data = fread($fp, 256);
if (preg_match('#vbversion="(.*?)"#', $data, $matches))
{
$language_xml = $matches[1];
}
else
{
$language_xml = 'Unknown';
}
fclose($fp);
}
else
{
$language_xml = 'N/A';
}
if ($fp = @fopen('./install/vbulletin-settings.xml', 'rb'))
{
$data = fread($fp, 300);
if (preg_match('#<defaultvalue>(.*?)</defaultvalue>#', $data, $matches))
{
$settings_xml = $matches[1];
}
else
{
$settings_xml = 'Unknown';
}
fclose($fp);
}
else
{
$settings_xml = 'N/A';
}
print_form_header();
echo "<h2>vBulletin Tools</h2>";
print_table_header('Import XML Files');
print_column_style_code(array('width:30%'));
print_label_row(construct_link_code('Style', THIS_SCRIPT . '?do=xml&type=style'), "This will take the latest style from ./install/vbulletin-style.xml<dfn>Version: <b>$style_xml</b></dfn>");
print_label_row(construct_link_code('Settings', THIS_SCRIPT . '?do=xml&type=settings'), "This will take the latest settings from ./install/vbulletin-settings.xml<dfn>Version: <b>$settings_xml</b></dfn>");
print_label_row(construct_link_code('Language', THIS_SCRIPT . '?do=xml&type=language'), "This will take the latest language from ./install/vbulletin-language.xml<dfn>Version: <b>$language_xml</b></dfn>");
print_label_row(construct_link_code('Admin Help', THIS_SCRIPT . '?do=xml&type=adminhelp'), 'This will take the latest admin help from ./install/vbulletin-adminhelp.xml');
print_table_break();
print_table_header('Datastore Cache');
print_column_style_code(array('width:30%'));
print_label_row(construct_link_code('Usergroup / Forum Cache', THIS_SCRIPT . '?do=cache&type=forum'), 'Update the forum and usergroup cache');
print_label_row(construct_link_code('Options Cache', THIS_SCRIPT . '?do=cache&type=options'), 'Update the options cache from the setting table');
print_label_row(construct_link_code('Bitfield Cache', THIS_SCRIPT . '?do=bitfields'), 'Update the bitfields cache from the xml/bitfields_<em>???</em>.xml files');
print_table_break();
print_table_header('Cookies');
print_column_style_code(array('width:30%'));
$vbulletin->options['cookiedomain'] = iif($vbulletin->options['cookiedomain'] == '', ' ( blank ) ', '<b>' . htmlspecialchars_uni($vbulletin->options['cookiedomain']) . '</b>');
$vbulletin->options['cookiepath'] = iif($vbulletin->options['cookiepath'] == '', ' ( blank ) ', '<b>' . htmlspecialchars_uni($vbulletin->options['cookiepath']) . '</b>');
print_label_row('Cookie Prefix', '<b>' . htmlspecialchars_uni(COOKIE_PREFIX) . '</b> (<em>set in includes/config.php</em>)');
print_label_row(construct_link_code('Reset Cookie Domain', THIS_SCRIPT . '?do=cookie&type=domain'), 'Reset the cookie domain to be blank<dfn>Currently: ' . $vbulletin->options['cookiedomain'] . '</dfn>');
print_label_row(construct_link_code('Reset Cookie Path', THIS_SCRIPT . '?do=cookie&type=path'), 'Reset the cookie path to be <b>/</b><dfn>Currently: ' . $vbulletin->options['cookiepath'] . '</dfn>');
print_table_break();
print_table_header('MySQL');
print_column_style_code(array('width:30%'));
print_label_row(construct_link_code('Run Query', THIS_SCRIPT . '?do=mysql&type=query'), 'This allows you to run alter and update queries on the database');
print_label_row(construct_link_code('Repair Tables', THIS_SCRIPT . '?do=mysql&type=repair'), 'You can select tables that need repaired here');
print_label_row(construct_link_code('Reset Admin Access', THIS_SCRIPT . '?do=user&type=access'), 'Reset admin access for a user');
print_table_break();
$randnumb = vbrand(0, 100000000);
print_table_header('Other Tools');
print_column_style_code(array('width:30%'));
print_label_row(construct_link_code($vbulletin->options['bbactive'] ? 'Turn Off Forum' : 'Turn On Forum', THIS_SCRIPT . '?do=bbactive'), 'Your forum is <b>' . ($vbulletin->options['bbactive'] ? 'On' : 'Off') . '</b>');
$childcount = $db->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "forum
WHERE childlist = ''
");
if ($childcount['count'])
{
print_label_row(construct_link_code('Rebuild', THIS_SCRIPT . '?do=childlist'), 'You have forum with empty childlists, which is not good.');
}
print_label_row(construct_link_code('Default Language', THIS_SCRIPT . '?do=language'), 'Reset board default language.');
print_table_break();
print_table_header('Time');
print_column_style_code(array('width:30%'));
print_label_row('System Time', $systemdate = date('r T'));
print_label_row('Your Time', $userdate = vbdate('r T'));
print_table_footer();
}
else if ($_REQUEST['do'] == 'xml')
{
switch ($vbulletin->GPC['type'])
{
case 'style':
require_once('./includes/adminfunctions_template.php');
if (!($xml = file_read('./install/vbulletin-style.xml')))
{
echo '<p>Uh oh, ./install/vbulletin-style.xml doesn\'t appear to exist! Upload it and refresh the page.</p>';
break;
}
echo '<p>Importing vbulletin-style.xml</p>';
xml_import_style($xml);
// define those phrases that are used for the import
$vbphrase['style'] = 'Style';
$vbphrase['please_wait'] = 'Please Wait';
build_all_styles(0, 1);
print_cp_redirect('tools.php?do=templatemerge');
break;
case 'settings':
require_once('./includes/adminfunctions_options.php');
if (!($xml = file_read('./install/vbulletin-settings.xml')))
{
echo '<p>Uh oh, ./install/vbulletin-settings.xml doesn\'t appear to exist! Upload it and refresh the page.</p>';
print_cp_footer();
}
echo '<p>Importing vbulletin-settings.xml';
xml_import_settings($xml);
echo '<br /><span class="smallfont"><b>Okay</b></span></p>';
break;
case 'language':
require_once('./includes/adminfunctions_language.php');
if (!($xml = file_read('./install/vbulletin-language.xml')))
{
echo '<p>Uh oh, ./install/vbulletin-language.xml doesn\'t appear to exist! Upload it and refresh the page.</p>';
print_cp_footer();
}
echo '<p>Importing vbulletin-language.xml';
xml_import_language($xml);
build_language();
echo '<br /><span class="smallfont"><b>Okay</b></span></p>';
break;
case 'adminhelp':
require_once('./includes/adminfunctions_help.php');
if (!($xml = file_read('./install/vbulletin-adminhelp.xml')))
{
echo '<p>Uh oh, ./install/vbulletin-adminhelp.xml doesn\'t appear to exist! Upload it and refresh the page.</p>';
print_cp_footer();
}
echo '<p>Importing vbulletin-adminhelp.xml';
xml_import_help_topics($xml);
echo "<br /><span class=\"smallfont\"><b>Okay</b></span></p>";
break;
}
define('SCRIPT_REDIRECT', true);
}
else if ($_REQUEST['do'] == 'templatemerge')
{
$vbulletin->input->clean_array_gpc('r', array(
'startat' => TYPE_UINT,
));
require_once(DIR . '/includes/class_template_merge.php');
$merge_data = new vB_Template_Merge_Data($vbulletin);
$merge_data->start_offset = $vbulletin->GPC['startat'];
$merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')");
$merge = new vB_Template_Merge($vbulletin);
$merge->time_limit = 5;
$completed = $merge->merge_templates($merge_data);
if ($completed)
{
// completed
$vbphrase['style'] = 'Style';
$vbphrase['please_wait'] = 'Please Wait';
build_all_styles();
define('SCRIPT_REDIRECT', true);
}
else
{
// more templates to merge
print_cp_redirect(
'tools.php?do=templatemerge&startat=' . ($merge_data->start_offset + $merge->fetch_processed_count())
);
}
}
else if ($_REQUEST['do'] == 'cache')
{
switch ($vbulletin->GPC['type'])
{
case 'forum':
build_forum_permissions();
define('SCRIPT_REDIRECT', true);
break;
case 'options':
build_options();
define('SCRIPT_REDIRECT', true);
break;
}
}
else if ($_REQUEST['do'] == 'cookie')
{
switch ($vbulletin->GPC['type'])
{
case 'domain':
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = ''
WHERE varname = 'cookiedomain'
");
build_options();
define('SCRIPT_REDIRECT', true);
break;
case 'path':
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = '/'
WHERE varname = 'cookiepath'
");
build_options();
define('SCRIPT_REDIRECT', true);
break;
}
}
else if ($_REQUEST['do'] == 'bitfields')
{
require_once(DIR . '/includes/class_bitfield_builder.php');
vB_Bitfield_Builder::save($db);
build_forum_permissions();
define('SCRIPT_REDIRECT', true);
}
else if ($_REQUEST['do'] == 'mysql')
{
$vbulletin->input->clean_array_gpc('p', array('query' => TYPE_STR, 'tables' => TYPE_ARRAY));
switch ($vbulletin->GPC['type'])
{
case 'query':
if (empty($vbulletin->GPC['query']) OR !preg_match('#^(Alter|Update)#si', $vbulletin->GPC['query']))
{
print_form_header('tools', 'mysql');
construct_hidden_code('type', 'query');
print_table_header('Please paste alter / update query below');
print_textarea_row('Query to run', 'query','', 6, 60, 0, 0);
print_submit_row('Run', '');
}
else
{
$db->query_write($vbulletin->GPC['query']);
define('SCRIPT_REDIRECT', true);
}
break;
case 'repair':
if (empty($vbulletin->GPC['tables']))
{
print_form_header('tools', 'mysql');
construct_hidden_code('type', 'repair');
print_table_header('Please select tables to repair');
print_label_row('Table', "<input type=\"checkbox\" name=\"allbox\" title=\"Check All\" onclick=\"js_check_all(this.form);\" />Check All", 'thead');
$result = $db->query_write("SHOW TABLE STATUS");
while ($currow = $db->fetch_array($result, DBARRAY_NUM))
{
if (!in_array(strtolower($currow[1]), array('heap', 'memory')))
{
print_checkbox_row($currow[0], "tables[$currow[0]]", 0);
}
}
print_submit_row('Repair', '');
}
else
{
foreach($vbulletin->GPC['tables'] AS $key => $val)
{
if ($val == 1)
{
echo "Repairing $key<br />\n";
flush();
$db->query_write("REPAIR TABLE $key");
echo "Repair Complete<br />\n";
}
}
echo "Overall Repair complete<br />";
define('SCRIPT_REDIRECT', true);
}
break;
}
}
else if ($_REQUEST['do'] == 'user')
{
$vbulletin->input->clean_array_gpc('p', array('user' => TYPE_STR));
switch ($vbulletin->GPC['type'])
{
case 'access':
if (empty($vbulletin->GPC['user']))
{
print_form_header('tools', 'user');
construct_hidden_code('type', 'access');
print_table_header('Enter username to restore access to');
print_input_row('User Name', 'user', '');
print_submit_row('Submit', '');
}
else
{
$userid = $db->query_first("SELECT userid, usergroupid FROM " . TABLE_PREFIX . "user WHERE username = '" . $db->escape_string(htmlspecialchars_uni($vbulletin->GPC['user'])) . "'");
if (empty($userid['userid']))
{
echo '<p align="center">Invalid username</p>';
}
else
{
// lets check that usergroupid 6 is still admin
$ugroup = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "usergroup WHERE usergroupid = 6 AND (adminpermissions & " . $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] . ")");
if (empty($ugroup['usergroupid']))
{ // lets give them admin permissions again
$db->query_write("UPDATE " . TABLE_PREFIX . "usergroup SET adminpermissions = 3 WHERE usergroupid = 6");
build_forum_permissions();
}
/*insert query*/
$db->query_write("REPLACE INTO " . TABLE_PREFIX . "administrator
(userid, adminpermissions)
VALUES
($userid[userid], " . (array_sum($vbulletin->bf_ugp_adminpermissions) - 3) . ")
");
$db->query_write("UPDATE " . TABLE_PREFIX . "user SET usergroupid = 6 WHERE userid = $userid[userid]");
define('SCRIPT_REDIRECT', true);
}
}
break;
}
}
if ($_REQUEST['do'] == 'childlist')
{
function construct_child_list($forumid)
{
global $db;
if ($forumid == -1)
{
return '-1';
}
$childlist = $forumid;
$children = $db->query_read("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE parentid = " . intval($forumid));
while ($child = $db->fetch_array($children))
{
$childlist .= ',' . $child['forumid'];
}
$childlist .= ',-1';
return $childlist;
}
$forums = $db->query_read("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE childlist = ''");
$count = 0;
while ($forum = $db->fetch_array($forums))
{
$childlist = construct_child_list($forum['forumid']);
$db->query_write("
UPDATE " . TABLE_PREFIX . "forum
SET childlist = '$childlist'
WHERE forumid = $forum[forumid]
");
$count++;
}
build_forum_permissions();
echo "<p align=\"center\">Updated $count forums</p>";
define('SCRIPT_REDIRECT', true);
}
else if ($_REQUEST['do'] == 'bbactive')
{
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = " . ($vbulletin->options['bbactive'] ? 0 : 1) . "
WHERE varname = 'bbactive'
");
build_options();
define('SCRIPT_REDIRECT', true);
}
else if ($_REQUEST['do'] == 'language')
{
$vbulletin->input->clean_array_gpc('p', array('languageid' => TYPE_UINT));
require_once(DIR . '/includes/adminfunctions_language.php');
$languages = $db->query_read('SELECT * FROM ' . TABLE_PREFIX . 'language');
if ($db->num_rows($languages) == 0)
{
// this is just taken from install.php
$db->query_write("INSERT INTO " . TABLE_PREFIX . "language (title, languagecode, charset, decimalsep, thousandsep) VALUES ('English (US)', 'en', 'ISO-8859-1', '.', ',')");
$_languageid = $db->insert_id();
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = " . $_languageid . "
WHERE varname = 'languageid'
");
$db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET languageid = 0
");
build_options();
build_language($_languageid);
build_language_datastore();
define('SCRIPT_REDIRECT', true);
}
else
{
$sellanguages = array();
while ($language = $db->fetch_array($languages))
{
$sellanguages[$language['languageid']] = $language['title'];
}
$languageids = implode(',', array_keys($sellanguages));
$db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET languageid = 0
WHERE languageid NOT IN ($languageids)
");
if (empty($vbulletin->GPC['languageid']))
{
print_form_header('tools', 'language');
print_table_header('Select the new default language');
print_select_row('Language', 'languageid', $sellanguages, $vbulletin->options['languageid']);
print_submit_row('Submit', '');
}
else
{
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = " . $vbulletin->GPC['languageid'] . "
WHERE varname = 'languageid'
");
build_options();
build_language($vbulletin->GPC['languageid']);
build_language_datastore();
define('SCRIPT_REDIRECT', true);
}
}
}
if (defined('SCRIPT_REDIRECT'))
{
echo '<p align="center" class="smallfont"><a href="tools.php" onclick="javascript:clearTimeout(timerID);">' . $vbphrase['processing_complete_proceed'] . '</a></p>';
echo "\n<script type=\"text/javascript\">\n";
echo "myvar = \"\"; timeout = " . (10) . ";
function exec_refresh()
{
window.status=\"" . $vbphrase['redirecting'] . "\"+myvar; myvar = myvar + \" .\";
timerID = setTimeout(\"exec_refresh();\", 100);
if (timeout > 0)
{ timeout -= 1; }
else { clearTimeout(timerID); window.status=\"\"; window.location=\"tools.php\"; }
}
exec_refresh();";
echo "\n</script>\n";
}
?>
<!-- START CONTROL PANEL FOOTER -->
<p align="center" class="smallfont"><a href="http://www.vbulletin.com/" target="_blank" class="copyright">vBulletin <?php echo VERSION; ?>, Copyright ©2000-<?php echo date('Y'); ?>, vBulletin Solutions Inc.</a></p>
</body>
</html>
<?php
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 15:53, Sat Oct 23rd 2010
|| # CVS: $RCSfile$ - $Revision: 37230 $
|| ####################################################################
\*======================================================================*/
?>