forked from Oyabun1/Support
/
support_info.php
1712 lines (1638 loc) · 61 KB
/
support_info.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
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// Copyright © Oyabun1 2013
// version 1.6.1
// license http://opensource.org/licenses/GPL-2.0 GNU General Public License v2
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
// Try to check if the file is in the right place - board root
if (file_exists($phpbb_root_path . 'common.' . $phpEx))
{
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'config.' . $phpEx);
// Create a HTML5 page to add some form elements and display stuff
echo '<!DOCTYPE html>';
echo '<html>';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
echo '<title>' . basename(__FILE__) . '</title>';
echo '<style type="text/css">
body {
font-size: 1em;
background-color: #FFF8DC;
width: 800px;
}
form {
text-align: center;
line-height: 230%;
}
#selectable {
cursor: copy;
line-height: 110%;
}
fieldset {
-moz-border-radius:7px;
border-radius: 7px;
-webkit-border-radius: 7px;
}
legend.legend_ie {
display: inline-block;
position relative;
height: 30px;
top: -15px;
}
label {
cursor: pointer;
background-color: #b3ffb3;
border-style: outset;
border-width; 1px;
border-radius: 7px;
border-color: #808080;
font-size: 1.1em;
padding: 2px;
margin: 2px;
}
label.disabled {
cursor: not-allowed;
-moz-opacity: .5;
-webkit-opacity: .5;
opacity: .5;
}
input[type="checkbox"]{
cursor: pointer;
}
input[type="checkbox"]:disabled
{
cursor: not-allowed;
-moz-opacity: .6;
-webkit-opacity: .6;
opacity: .6;
}
/* Buttons based on Pressable CSS Buttons by Joshua Hibbert */
.button {
background-image: -webkit-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: -moz-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: -ms-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: -o-linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,0%,.1));
border: none;
border-radius: 1.25em;
box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
inset 0 2px 0 hsla(0,0%,100%,.1),
inset 0 1.2em 0 hsla(0,0%,100%,.05),
inset 0 -.2em 0 hsla(0,0%,100%,.1),
inset 0 -.25em 0 hsla(0,0%,0%,.5),
0 .25em .25em hsla(0,0%,0%,.1);
color: #fff;
text-shadow: 0 -1px 1px hsla(0,0%,0%,.25);
cursor: pointer;
display: inline-block;
font-family: sans-serif;
font-size: 1.1em;
font-weight: bold;
line-height: 150%;
margin: 0 .5em;
padding: .25em .75em .5em;
position: relative;
text-decoration: none;
vertical-align: middle;
}
.button:hover {
outline: none;
}
.button:hover,
.button:focus {
box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
inset 0 2px 0 hsla(0,0%,100%,.1),
inset 0 1.2em 0 hsla(0,0%,100%,.05),
inset 0 -.2em 0 hsla(0,0%,100%,.1),
inset 0 -.25em 0 hsla(0,0%,0%,.5),
inset 0 0 0 3em hsla(0,0%,100%,.2),
0 .25em .25em hsla(0,0%,0%,.1);
}
.button:active {
box-shadow: inset 0 0 0 1px hsla(0,0%,0%,.25),
inset 0 2px 0 hsla(0,0%,100%,.1),
inset 0 1.2em 0 hsla(0,0%,100%,.05),
inset 0 0 0 3em hsla(0,0%,100%,.2),
inset 0 .25em .5em hsla(0,0%,0%,.05),
0 -1px 1px hsla(0,0%,0%,.1),
0 1px 1px hsla(0,0%,100%,.25);
margin-top: .25em;
outline: none;
padding-bottom: .5em;
}
.red {
background-color: #8B0000;
}
.green {
background-color: #228B22;
}
</style>';
echo '</head>';
echo '<body>';
// Some JavaScript used to select all the text to be copied. JavaScript is a tool of demons, but ...
echo '<script type="text/javascript">
function selectText(txt) {
if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") {
var range = document.createRange();
range.selectNodeContents(txt);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (typeof document.selection != "undefined" && typeof document.body.createTextRange != "undefined") {
var textRange = document.body.createTextRange();
textRange.moveToElementText(txt);
textRange.select();
}
}
</script>';
// Create some checkboxes to select info categories
echo '<!--[if IE]>';
echo '<fieldset><legend class="legend_ie"><strong>Select one or more relevant boxes then press the Show button</strong></legend>';
echo '<![endif]-->';
echo '<!--[if !IE]><!-->';
echo '<fieldset><legend style="display:inline-block"><strong>Select one or more relevant boxes then press the Show button</strong></legend>';
echo '<!--<![endif]-->';
echo '<form action="' . basename(__FILE__) . '" method="post">';
echo '<label title="Anonymous user details"><input type="checkbox" name="chkAnon" value="Yes" />
Anonymous </label> ';
echo '<label title="Activation, countermeasure, and ban info"><input type="checkbox" name="chkASpam"
value="Yes" />Anti-Spam </label> ';
echo '<label title="Attachment settings"><input type="checkbox" name="chkAttach" value="Yes" />
Attachments </label> ';
echo '<label title="AutoMOD settings"><input type="checkbox" name="chkAutomod" value="Yes" />
AutoMOD </label> ';
echo '<label title="Avatar settings"><input type="checkbox" name="chkAvatar" value="Yes" />
Avatar </label> ';
echo '<br />';
echo '<label title="Cookie settings from database"><input type="checkbox" name="chkCookies" value="Yes" />
Cookies </label> ';
echo '<label title="Database (config.php) details"><input type="checkbox" name="chkDbase" value="Yes" />
Database </label> ';
echo '<label title="Email settings"><input type="checkbox" name="chkEmail" value="Yes" />
Email </label> ';
echo '<label title="File check"><input type="checkbox" name="chkFile" value="Yes" />
Files </label> ';
echo '<label title="Some basic stats: users, topics, posts, languages, & stuff like that"><input
type="checkbox" name="chkOther" value="Yes" />Other </label> ';
echo '<br />';
echo '<label title="Paths and permissions"><input type="checkbox" name="chkPaths" value="Yes" />
Paths </label> ';
echo '<label title="PHP settings mainly related to files and images"><input type="checkbox" name="chkPHP"
value="Yes" />PHP Info </label> ';
echo '<label title="ACP Search settings">
<input type="checkbox" name="chkSearch" value="Yes" /> Search </label> ';
echo '<label title="ACP Server settings, languages & deactivated modules">
<input type="checkbox" name="chkServer" value="Yes" /> Server </label> ';
echo '<label title="Active and Deactivated styles"><input type="checkbox" name="chkStyles" value="Yes" />
Styles </label> ';
echo '<label title="Version info"><input type="checkbox" name="chkVersion"
value="Yes" />Version </label> ';
echo '<p><button type="submit" class="button green";>Show</button></p>';
echo '</form>';
echo '</fieldset><br />';
echo '<fieldset style="background-color:#F5FCFF; border-color:#00CC00; border-style: solid;"><legend>
<strong>Copy and paste the lines below to the appropriate topic at phpbb.com (click to select text)
</strong></legend>';
// Use the JavaScript from above
echo '<div id="selectable" onclick="selectText(this)">';
// Use request_var() to get the returned values
// since using $_POST() is discouraged (& phpBB 3.1 will have a dummy spit)
$chk_anon = (request_var('chkAnon', ''));
$chk_aspam = (request_var('chkASpam', ''));
$chk_attach = (request_var('chkAttach', ''));
$chk_avatar = (request_var('chkAvatar', ''));
$chk_automod = (request_var('chkAutomod', ''));
$chk_cookies = (request_var('chkCookies', ''));
$chk_dbase = (request_var('chkDbase', ''));
$chk_email = (request_var('chkEmail', ''));
$chk_file = (request_var('chkFile', ''));
$chk_other = (request_var('chkOther', ''));
$chk_paths = (request_var('chkPaths', ''));
$chk_php = (request_var('chkPHP', ''));
$chk_search = (request_var('chkSearch', ''));
$chk_server = (request_var('chkServer', ''));
$chk_styles = (request_var('chkStyles', ''));
$chk_version = (request_var('chkVersion', ''));
$chk_delete = (request_var('chkDelete', ''));
// Some variables to check if 3.1.x
$version = PHPBB_VERSION;
$vers_num = '3.1.';
$ascraeus = strpos($version, $vers_num);
// A function to get around PHP shortcuts in php.ini values
// borrowed from http://www.php.net/manual/de/faq.using.php#78405
function convertBytes($value)
{
if(is_numeric($value))
{
return $value;
}
else
{
$value_length = strlen($value);
$qty = substr($value, 0, $value_length - 1);
$unit = strtolower(substr( $value, $value_length - 1));
switch ($unit)
{
case 'k':
$qty *= 1024;
break;
case 'm':
$qty *= 1048576;
break;
case 'g':
$qty *= 1073741824;
break;
}
return $qty;
}
}
// Create a few variables to shorten lines below
$u_m_f = convertBytes(ini_get('upload_max_filesize'));
$p_m_s = convertBytes(ini_get('post_max_size'));
$m_l = convertBytes(ini_get('memory_limit'));
// Grab the data and display it depending on which checkboxes are selected
if ($chk_anon == 'Yes')
{
echo '<strong>[b]Anonymous User[/b]</strong><br />';
$sql = 'SELECT username, username_clean
FROM ' . USERS_TABLE . '
WHERE user_id = "1"';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if ($row['username_clean'] != 'anonymous')
{
echo 'Database user_id 1 is: ' . $row['username'] .
' || username_clean: ' . $row['username_clean'] . '<br />';
}
}
$db->sql_freeresult($result);
if(defined('ANONYMOUS'))
{
echo 'Constant user_id: ' . ANONYMOUS . '<br />';
}
else
{
echo 'Anonymous constant not defined (constant not accessible)<br />';
}
$sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . '
WHERE username_clean = "anonymous"';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
echo 'DB user_id: ' . $row['user_id'] . '<br />';
echo 'Username: ' . $row['username'] . '<br />';
}
$db->sql_freeresult($result);
$sql = 'SELECT s.style_id, s.style_name
FROM ' . STYLES_TABLE . ' s
LEFT JOIN ' . USERS_TABLE . ' u
ON (s.style_id = u.user_style)
WHERE u.username_clean = "anonymous"';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
echo 'Style used: ' . $row['style_name'] . ' : style_id: ' . $row['style_id'] . '<br >';
}
$db->sql_freeresult($result);
echo '[i]Group(s):[/i]<br />';
$sql = 'SELECT g.group_name
FROM ' . GROUPS_TABLE . ' g
LEFT JOIN ' . USER_GROUP_TABLE . ' ug USING (group_id)
LEFT JOIN ' . USERS_TABLE . ' u USING (user_id)
WHERE u.user_id IN (SELECT user_id FROM ' . USERS_TABLE . ' WHERE username_clean = "anonymous")';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
echo ucfirst(strtolower($row['group_name'])) . '<br />';
}
$db->sql_freeresult($result);
$sql = 'SELECT u.user_id, u.username, u.username_clean
FROM ' . USERS_TABLE . ' u
LEFT JOIN ' . USER_GROUP_TABLE . ' g
ON (g.user_id = u.user_id)
WHERE g.group_id
IN (SELECT group_id
FROM ' . GROUPS_TABLE . '
WHERE group_name = "GUESTS")';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
if ($row['username_clean'] != 'anonymous')
{
echo 'Also in Guests group: ' . $row['username'] . ' || user_id: ' . $row['user_id'] . '<br >';
}
}
echo '<br />';
}
if ($chk_aspam == 'Yes')
{
echo '<strong>[b]Anti-Spam Measures[/b]</strong><br />';
echo 'Authentication method: ' . $config['auth_method'] . '<br />';
echo 'Spambot countermeasures for registrations: ' . ($config['enable_confirm'] ? 'Yes' : 'No') . '<br />';
// Convert config numerical value to appropriate text
switch($config['require_activation'])
{
case 0:
$activation = 'No activation (immediate access)';
break;
case 1:
$activation = 'By user (email verification)';
break;
case 2:
$activation = 'By Admin';
break;
case 3:
$activation = 'Disabled';
break;
}
echo 'Account activation: ' . $activation . '<br />';
echo 'New member post limit: ' . $config['new_member_post_limit'] . '<br />';
$sql = 'SELECT config_name, config_value FROM ' . CONFIG_TABLE . '
WHERE config_name = "captcha_plugin"';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$captcha_id_value = $row['config_value'];
}
switch($captcha_id_value)
{
case 'phpbb_captcha_sortables':
$captcha_id = 'Sortables CAPTCHA Plugin';
break;
case 'phpbb_captcha_qa':
$captcha_id = 'Q&A CAPTCHA Plugin';
break;
case 'phpbb_captcha_gd':
$captcha_id = 'GD Image';
break;
case 'phpbb_captcha_gd_wave':
$captcha_id = 'GD 3D Image';
break;
case 'phpbb_captcha_nogd':
$captcha_id = 'Simple Image';
break;
case 'phpbb_captcha_simplemath':
$captcha_id = 'NV Simplemath CAPTCHA';
break;
case 'phpbb_recaptcha':
$captcha_id = 'ReCAPTCHA';
break;
case 'phpbb_nucaptcha':
$captcha_id = 'NuCaptcha Plugin';
break;
case 'phpbb_imgrotate':
$captcha_id = 'Rotate Image Captcha';
break;
case 'phpbb_peoplesign':
$captcha_id = 'Peoplesign CAPTCHA Plugin';
break;
case 'phpbb_keycaptcha':
$captcha_id = 'KeyCAPTCHA';
break;
case 'phpbb_solvemedia':
$captcha_id = 'Solve Media Captcha Puzzle';
break;
case 'phpbb_captcha_math':
$captcha_id = 'Crazy Maths CAPTCHA';
break;
// May have missed some so ...
default:
$captcha_id = '$captcha_id_value';
break;
}
echo 'Spambot Countermeasure: ' . $captcha_id . '<br />';
$db->sql_freeresult($result);
// Check if GD library loaded and see if .png used by GD Image
if (extension_loaded('gd') && function_exists('gd_info'))
{
$gdinfoarray = gd_info();
$gdversion = $gdinfoarray['GD Version'];
echo 'GD library version: ' . $gdinfoarray['GD Version'] . '<br />';
echo 'GD Image (.png) support: ' . (($gdinfoarray['PNG Support'] == true) ? 'Yes' : 'No') . '<br />';
echo 'PHP imagecreatetruecolor() exists: ' . (function_exists('imagecreatetruecolor') ? 'Yes' : 'No') . '<br />';
}
else
{
echo 'GD library not found<br />';
}
echo ' Username length: ' . $config['min_name_chars'] . ' min ' .
$config['max_name_chars'] . ' max <br />';
switch($config['allow_name_chars'])
{
case 'USERNAME_CHARS_ANY':
$u_complex = 'Any character';
break;
case 'USERNAME_ALPHA_ONLY':
$u_complex = 'Alphanumeric only';
break;
case 'USERNAME_ALPHA_SPACERS':
$u_complex = 'Alphanumeric and spacers';
break;
case 'USERNAME_LETTER_NUM':
$u_complex = 'Any letter and number';
break;
case 'USERNAME_LETTER_NUM_SPACERS':
$u_complex = 'Any letter, number, and spacer';
break;
case 'USERNAME_ASCII':
$u_complex = 'ASCII (no international unicode)';
break;
case '':
$u_complex = 'Unset (incorrect setting)';
break;
default:
$u_complex = 'custom = ' . $config['allow_name_chars'] . '';
break;
}
echo 'Username characters: ' . $u_complex . '<br />';
echo 'Password length: ' . $config['min_pass_chars'] . ' min ' . $config['max_pass_chars'] . ' max <br />';
switch($config['pass_complex'])
{
case 'PASS_TYPE_ANY':
$p_complex = 'No requirements';
break;
case 'PASS_TYPE_CASE':
$p_complex = 'Must be mixed case';
break;
case 'PASS_TYPE_ALPHA':
$p_complex = 'Must contain letters and numbers';
break;
case 'PASS_TYPE_SYMBOL':
$p_complex = 'Must contain symbols';
break;
case '':
$p_complex = 'Unset (incorrect setting)';
break;
default:
$p_complex = ($config['pass_complex']);
break;
}
echo 'Password complexity: ' . $p_complex . '<br />';
if ($config['chg_passforce'] == '0')
{
echo 'Force password change: Disabled<br />';
}
else
{
echo 'Force password change: ' . $config['chg_passforce'] . ' days<br />';
}
echo 'Allow email address re-use: ' . ($config['allow_emailreuse'] ? 'Yes' : 'No') . '<br />';
$sql = 'SELECT COUNT(ban_ip) AS banned_ips FROM ' . BANLIST_TABLE . ' WHERE (ban_ip <> "")';
$result = $db->sql_query($sql);
$banned_ips = (int) $db->sql_fetchfield('banned_ips');
echo 'Banned IPs: ' . $banned_ips . '<br />';
$db->sql_freeresult($result);
$sql = 'SELECT COUNT(ban_email) AS banned_emails FROM ' . BANLIST_TABLE . '
WHERE (ban_email <> "")';
$result = $db->sql_query($sql);
$banned_emails = (int) $db->sql_fetchfield('banned_emails');
echo 'Banned Email Addresses: ' . $banned_emails . '<br />';
$db->sql_freeresult($result);
$connection = @fsockopen("whois.arin.net", 43);
if ($connection)
{
echo 'Port 43 to whois.arin.net is open.<br />';
fclose($connection);
}
else
{
echo 'Port 43 to whois.arin.net is not open.<br />';
}
echo '<br />';
}
if ($chk_attach == 'Yes')
{
echo '<strong>[b]Attachments[/b]</strong><br />';
echo 'Allow attachments: ' . ($config['allow_attachments'] ? 'Yes' : 'No') . '<br />';
echo 'Allow attachments in PMs: ' . ($config['allow_pm_attach'] ? 'Yes' : 'No') . '<br />';
echo 'Upload directory: /' . $config['upload_path'] . '/<br />';
if ($config['upload_path'] != '')
{
echo 'Upload directory permissions: ' . substr(decoct(fileperms($phpbb_root_path .
($config['upload_path']))), 2) . ' <br />';
}
echo 'Attachment display order: ' . ($config['display_order'] ? 'Ascending' : 'Descending') . '<br />';
// Sizes are stored as bytes to convert we use the phpBB get_formatted_filesize()
echo 'Size of posted attachments: ' . get_formatted_filesize($config['upload_dir_size']) . '<br />';
if ($config['attachment_quota'] != '0')
{
$quota1 = get_formatted_filesize($config['attachment_quota']);
}
else
{
$quota1 = 'Host limit';
}
echo 'Total attachment quota: ' . $quota1 . '<br />';
// Determining the actual maximum file size is too difficult and will vary between users so we'll make
// a guesstimate based on the lowest of upload_max_filesize, post_max_size, and memory_limit
$php_max_file = min($u_m_f, $p_m_s, $m_l);
$f_php_max_file = get_formatted_filesize($php_max_file);
if ($config['max_filesize'] != '0')
{
if($config['max_filesize'] > $php_max_file)
{
echo 'Maximum file size of ' . get_formatted_filesize($config['max_filesize']) . '
exceeds estimated server PHP limit of ' . $f_php_max_file .'<br />';
}
elseif ($config['max_filesize'] < $php_max_file)
{
echo 'Maximum file size of ' . get_formatted_filesize($config['max_filesize']) . '
less than estimated server PHP limit of ' . $f_php_max_file .'<br />';
}
else //($config['max_filesize'] == $php_max_file)
{
echo 'Maximum file size of ' . get_formatted_filesize($config['max_filesize']) . '
equals estimated server PHP limit of ' . $f_php_max_file .'<br />';
}
}
else
{
echo 'Maximum file size is unset so will equal estimated server PHP limit of ' . $f_php_max_file .'<br />';
}
if ($config['max_filesize_pm'] != '0')
{
$quota3 = get_formatted_filesize($config['max_filesize_pm']);
}
else
{
$quota3 = 'Unlimited';
}
echo 'Maximum file size PMs: ' . $quota3 . '<br />';
echo 'Maximum attachments per post: ' . $config['max_attachments'] . '<br />';
echo 'Maximum attachments per PM: ' . $config['max_attachments_pm'] . '<br />';
echo 'Check file mimetype: ' . ($config['check_attachment_content'] ? 'Yes' : 'No') . '<br />';
echo 'Secure downloads: ' . ($config['secure_downloads'] ? 'Yes' : 'No') . '<br />';
if ($config['secure_downloads'])
{
echo 'Allow/Deny list: ' . ($config['secure_allow_deny'] ? 'Yes' : 'No') . '<br />';
echo 'Allow empty referrer: ' . ($config['secure_allow_empty_referer'] ? 'Yes' : 'No') . '<br />';
}
echo '[b]Image attachments[/b]<br />';
echo 'Display images inline: ' . ($config['img_display_inlined'] ? 'Yes' : 'No') . '<br />';
echo 'Create thumbnail: ' . ($config['img_create_thumbnail'] ? 'Yes' : 'No') . '<br />';
if ($config['img_create_thumbnail'])
{
echo 'Maximum thumbnail width: ' . $config['img_max_thumb_width'] . ' px<br />';
echo 'Maximum thumbnail file size: ' . get_formatted_filesize($config['img_min_thumb_filesize']) . '<br />';
}
echo 'Imagemagick path: ' . $config['img_imagick'] . '<br />';
echo 'Maximum image dimensions: ' . $config['img_max_width'] . ' × ' . $config['img_max_height'] . '
px (width × height)<br />';
echo 'Image link dimensions: ' . $config['img_link_width'] . ' × ' . $config['img_link_height'] . '
px (width × height)<br /><br />';
$sql = 'SELECT group_name, max_filesize FROM ' . EXTENSION_GROUPS_TABLE . ' WHERE max_filesize > 0 ';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
if ($config['max_filesize'] != '0')
{
if ($row['max_filesize'] > $config['max_filesize'])
{
echo 'Max filesize for extension group ' . (ucfirst(strtolower($row['group_name']))) .
': [color=#FF0000]' . get_formatted_filesize($row['max_filesize']) . '[/color]<br />';
}
elseif ($row['max_filesize'] < $config['max_filesize'])
{
echo 'Max filesize for extension group ' . (ucfirst(strtolower($row['group_name']))) .
': [color=#008000]' . get_formatted_filesize($row['max_filesize']) . '[/color]<br />';
}
else
{
echo 'Max filesize for extension group ' . (ucfirst(strtolower($row['group_name']))) .
': ' . get_formatted_filesize($row['max_filesize']) . '<br />';
}
}
else
{
if ($row['max_filesize'] > $php_max_file)
{
echo 'Max filesize for extension group ' . (ucfirst(strtolower($row['group_name']))) .
': [color=#FF0000]' . get_formatted_filesize($row['max_filesize']) . '[/color]<br />';
}
elseif ($row['max_filesize'] < $php_max_file)
{
echo 'Max filesize for extension group ' . (ucfirst(strtolower($row['group_name']))) .
': [color=#008000]' . get_formatted_filesize($row['max_filesize']) . '[/color]<br />';
}
else
{
echo 'Max filesize for extension group ' . (ucfirst(strtolower($row['group_name']))) .
': ' . get_formatted_filesize($row['max_filesize']) . '<br />';
}
}
}
$db->sql_freeresult($result);
$sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . '';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
if (preg_match("/^[^[:alnum:]]/", $row['extension']))
{
echo 'Extension with non alphanumeric first character: ' . $row['extension'] . '<br />';
}
}
$db->sql_freeresult($result);
echo '<br />';
}
if ($chk_automod == 'Yes')
{
echo '<strong>[b]AutoMOD Settings[/b]</strong><br />';
if (file_exists($phpbb_root_path . 'includes/functions_mods.' . $phpEx))
{
global $table_prefix;
define('MODS_TABLE', $table_prefix . 'mods');
echo 'AutoMOD version: ' . ($config['automod_version'] ? $config['automod_version'] : 'Not found') . '<br />';
switch ($config['write_method'])
{
case 1:
echo 'Write method: Direct<br />';
if (!is_writable("{$phpbb_root_path}common.$phpEx") || !is_writable("{$phpbb_root_path}adm/style/acp_groups.html"))
{
echo 'File system not writable<br />';
}
break;
case 2:
echo 'Write method: FTP<br />';
switch (@$config['ftp_method'])
{
case "ftp":
echo 'Upload method: FTP<br />';
break;
case "ftp_fsock":
echo 'Upload method: Simple Socket<br />';
break;
}
echo 'FTP host: ' . @$config['ftp_host'] . '<br />';
echo 'FTP username: ' . @$config['ftp_username'] . '<br />';
echo 'Path to phpBB: ' . @$config['ftp_root_path'] . '<br />';
echo 'FTP port: ' . @$config['ftp_port'] . '<br />';
echo 'FTP timeout: ' . @$config['ftp_timeout'] . '<br />';
break;
case 3:
echo 'Write method: Compressed File Download<br />';
echo 'Compressed file type: ' . $config['compress_method'] . '<br />';
break;
default:
echo 'Write method: Not known<br />';
break;
}
echo 'File permissions: ' . @$config['am_file_perms'] . '<br />';
echo 'Directory permissions: ' . @$config['am_dir_perms'] . '<br />';
echo 'Preview changes: ' . (@$config['preview_changes'] ? 'Yes' : 'No') . '<br />';
echo '[c]/store/mods/[/c] permissions: ' . substr(decoct(fileperms($phpbb_root_path . 'store/mods')), 2) .
' <br />';
// Count the MODs
$sql = 'SELECT COUNT(*) AS mod_cnt FROM ' . MODS_TABLE . '';
$result = $db->sql_query($sql);
$mod_cnt = (int) $db->sql_fetchfield('mod_cnt');
echo 'MODs in mods table: ' . $mod_cnt . '<br /><br />';
$db->sql_freeresult($result);
}
else
{
echo '[c]/includes/functions_mods.php[/c] not found<br />AutoMOD is not correctly installed<br /><br />';
}
}
if ($chk_avatar == 'Yes')
{
echo '<strong>[b]Avatar Settings[/b]</strong><br />';
echo 'Enable avatars: ' . ($config['allow_avatar'] ? 'Yes' : 'No') . '<br />';
echo 'Gallery avatars: ' . ($config['allow_avatar_local'] ? 'Yes' : 'No') . '<br />';
echo 'Remote avatars: ' . ($config['allow_avatar_remote'] ? 'Yes' : 'No') . '<br />';
echo 'Avatar uploading: ' . ($config['allow_avatar_upload'] ? 'Yes' : 'No') . '<br />';
echo 'Remote avatar uploading: ' . ($config['allow_avatar_remote_upload'] ? 'Yes' : 'No') . '<br />';
if ($config['avatar_filesize'] != '0')
{
echo 'Maximum avatar file size: ' . get_formatted_filesize($config['avatar_filesize']) . '<br />';
}
else
{
echo 'Maximum avatar file size: PHP limit<br />';
}
echo 'Minimum avatar dimensions: ' . $config['avatar_min_width'] . ' × ' .
$config['avatar_min_height'] . ' px (width × height)<br />';
echo 'Maximum avatar dimensions: ' . $config['avatar_max_width'] . ' × ' .
$config['avatar_max_height'] . ' px (width × height)<br />';
echo 'Avatar storage path: ' . $config['avatar_path'] . '<br />';
if ($config['avatar_path'] != '')
{
echo 'Avatar storage folder permissions: ' . substr(decoct(fileperms($phpbb_root_path .
($config['avatar_path']))), 2) . ' <br />';
}
echo 'Avatar gallery path: ' . $config['avatar_gallery_path'] . '<br />';
if ($config['avatar_gallery_path'] != '')
{
echo 'Avatar gallery folder permissions: ' . substr(decoct(fileperms($phpbb_root_path .
($config['avatar_gallery_path']))), 2) . ' <br />';
}
$can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path'])
&& phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && (@ini_get('file_uploads') ||
strtolower(@ini_get('file_uploads')) == 'on')) ? 'Yes' : 'No';
echo 'Can upload avatar: ' . $can_upload . '<br /><br />';
}
if($chk_cookies == 'Yes')
{
echo '<strong>[b]Cookie Settings[/b]</strong><br />';
echo 'Cookie domain: ' . $config['cookie_domain'] . '<br />';
echo 'Cookie name: ' . $config['cookie_name'] . '<br />';
echo 'Cookie path: ' . $config['cookie_path'] . '<br />';
echo 'Cookie secure: ' . ($config['cookie_secure'] ? 'Yes' : 'No') . '<br /><br />';
$sql = 'SELECT config_name, config_value FROM ' . CONFIG_TABLE . ' WHERE config_name = "cookie_domain"
OR config_name = "cookie_name" OR config_name = "cookie_path" OR config_name = "cookie_secure"';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
echo 'DB ' . $row['config_name'] . ': ' . $row['config_value'] . '<br />';
}
$db->sql_freeresult($result);
echo '<br />';
}
if($chk_dbase == 'Yes')
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
echo '<strong>[b]Database Settings[/b]</strong><br />';
echo 'Database system: ' . $db->sql_server_info() . '<br />';
echo 'Database size: ' . get_database_size() . '<br />';
echo 'Database host: ' . $dbhost . '<br />';
echo 'Database port: ' . $dbport . '<br />';
echo 'Database name: ' . $dbname . '<br />';
echo 'Database user: ' . $dbuser . '<br />';
// We don't want the password posted publicly so we'll check if it is blank
if(mb_strlen($dbpasswd, 'UTF-8') > 0)
{
echo 'Database password: {removed}<br />';
}
else
{
echo 'Database password: is blank<br />';
}
echo 'Table prefix: ' . $table_prefix . '<br />';
echo 'Cache ($acm_type): ' . $acm_type . '<br />';
echo 'PHP extensions ($load_extensions): ' . $load_extensions . '<br />';
$config_lc = count(file($phpbb_root_path . 'config.' . $phpEx));
echo 'config.php line count: ' . $config_lc . ' ';
$config_n = ($ascraeus !== false) ? 15 : 16;
if ($config_lc == $config_n)
{
echo '(standard number of lines)<br />';
}
else if ($config_lc < $config_n)
{
echo '(' . ($config_n - $config_lc) . ' lines less than standard)<br />';
}
else
{
echo '(' . ($config_lc - $config_n) . ' lines more than standard)<br />';
}
if (($db->sql_layer = 'mysql4') || ($db->sql_layer = 'mysqli'))
{
$result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
$info = $db->sql_fetchrow($result);
{
$engine = '';
if (isset($info['Engine']))
{
$engine = $info['Engine'];
}
else if (isset($info['Type']))
{
$engine = $info['Type'];
}
}
echo 'Storage engine posts table: ' . $engine . '<br />';
$db->sql_freeresult($result);
$result = $db->sql_query('SHOW TABLE STATUS LIKE \'' . SESSIONS_TABLE . '\'');
$info = $db->sql_fetchrow($result);
{
$engine = '';
if (isset($info['Engine']))
{
$engine = $info['Engine'];
}
else if (isset($info['Type']))
{
$engine = $info['Type'];
}
}
echo 'Storage engine sessions table: ' . $engine . '<br /><br />';
$db->sql_freeresult($result);
}
}
if($chk_email == 'Yes')
{
echo '<strong>[b]Email Settings[/b]</strong><br />';
echo 'Enable board-wide e-mails: ' . ($config['email_enable'] ? 'Enabled' : 'Disabled') . '<br />';
echo 'Users send e-mails via board: ' . ($config['board_email_form'] ? 'Enabled' : 'Disabled') . '<br />';
echo 'E-mail function name: ' . $config['email_function_name'] . '<br />';
echo 'E-mail package size: ' . $config['email_package_size'] . '<br />';
echo 'E-mail chunk size: ' . $config['email_max_chunk_size'] . '<br />';
echo 'E-mail queue interval: ' . $config['queue_interval'] . ' secs<br />';
echo 'Contact e-mail address: ' . $config['board_contact'] . '<br />';
echo 'Return e-mail address: ' . $config['board_email'] . '<br />';
echo 'Hide e-mail addresses: ' . ($config['board_hide_emails'] ? 'Yes' : 'No') . '<br />';
echo 'Use SMTP server for e-mail: ' . ($config['smtp_delivery'] ? 'Yes' : 'No') . '<br />';
// Only include SMTP settings if it is enabled
if ($config['smtp_delivery'] == 1)
{
echo 'SMTP server address: ' . $config['smtp_host'] . '<br />';
echo 'SMTP server port: ' . $config['smtp_port'] . '<br />';
echo 'Authentication method for SMTP: ' . (ucfirst(strtolower($config['smtp_auth_method']))) . '<br />';
$smtp_user = ($config['smtp_username']);
// We'll replace the local part of the email address with asterisks
$smtp_split = strrpos($smtp_user, "@");
$local = preg_replace('(.)', '*', (substr($smtp_user, 0, $smtp_split)));
$domain = substr($smtp_user, $smtp_split);
echo 'SMTP username: ' . $local . $domain . '<br />';
// We probably don't need the actual password either so we'll replace and count the characters in it
$smtp_psd = preg_replace('[.]u', '*', $config['smtp_password']);
echo 'SMTP password: ' . $smtp_psd . ' (' . strlen($smtp_psd) . ' characters) <br />';
}
echo '<br />';
}
if($chk_file == 'Yes')
{
echo '<strong>[b]File Check[/b]</strong><br />';
echo 'Check first 5 characters of PHP files (should be: ' . htmlspecialchars('<?php') . ')<br />';
/**
* Check first line of PHP files to see if it is only "<?php"
* (285 PHP files in installed 3.0.12)
* Just doing a BOM check wouldn't find blank lines, spaces, code mistakenly added at start of file, ...
* Only check the start of the file - that is the most common problem and checking the end is too hard
* Based on some code from php.net
*/
// This iteration method probably won't always be available, so check if class exists
$time_start = microtime(true);
if (class_exists('RecursiveDirectoryIterator'))
{
// SETTINGS
$check_extensions = array('php');
$compare = htmlspecialchars('<?php');
$file = null;
$root = dirname(__FILE__);
// MAIN
$rit = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($phpbb_root_path), RecursiveIteratorIterator::CHILD_FIRST);
try
{
foreach ($rit as $file)
{
if ($file->isFile())
{
$path_parts = pathinfo($file->getRealPath());
if (isset($path_parts['extension']) && in_array($path_parts['extension'],$check_extensions))
{
$object = new SplFileObject($file->getRealPath());
$fchk = htmlspecialchars(file_get_contents($file, NULL, NULL, 0, 5));
if (strncasecmp($fchk, $compare, 5) !== 0)
{
echo str_replace($root, '', $file) . ' first 5 characters: ' . $fchk . ' : [color=#FF0000]NOT correct[/color]<br />';
}
}
}
}
}
catch (Exception $e)
{
die ('Exception caught: '. $e->getMessage());
}
}
elseif (file_get_contents(__FILE__))
// If we can't easily iterate through all files, we'll try with glob, and check 5 nodes
// N.B. 3.1 has files which are 8+ nodes deep, but this method probably won't ever be used for that
{
echo 'First 5 characters of PHP files (should be ' . htmlspecialchars('<?php') . ') of:<br />';
echo '(Only checked first 5 directory nodes)<br />';
// Check if the functions used is available
$compare = htmlspecialchars('<?php');
foreach(glob($phpbb_root_path . '{*.php,*/*.php,*/*/*.php,*/*/*/*.php,*/*/*/*/*.php}', GLOB_BRACE) as $filetochk)
{
$fchk = htmlspecialchars(file_get_contents($filetochk, NULL, NULL, 0, 5));
if (strncasecmp($fchk, $compare, 5) !== 0)
{
echo $filetochk . ' are: ' . $fchk . ' <span style="color:red">NOT correct</span><br />';
}
}
}
else
{
echo 'Tried methods unsupported by server<br />';
}
unset($fchk);
echo '<br />';
$time_end = microtime(true);
$totaltime = round($time_end - $time_start, 2);
// Usually completes in < 10 secs. A check on a board with 100+ MODs and low resources took 124 secs
echo 'File check finished in: ' . $totaltime . ' seconds (wall-clock time)<br /><br />';
}
if ($chk_other == 'Yes')
{
echo '<strong>[b]Other Stats[/b]</strong><br />';
// Count all the files, including images, attachments, MODs, styles, etc.
function getFileCount($path)
{
$size = 0;
$ignore = array('.', '..');
$files = scandir($path);
foreach($files as $t)
{
if(in_array($t, $ignore)) continue;
if (is_dir(rtrim($path, '/') . '/' . $t)) {
$size += getFileCount(rtrim($path, '/') . '/' . $t);
} else {
$size++;
}
}
return $size;
}
echo 'Total files (not just .php files): ' . getFileCount($phpbb_root_path) . '<br />';
$sql = 'SELECT COUNT(*) AS sessions_cnt FROM ' . SESSIONS_TABLE . '';
$result = $db->sql_query($sql);
$sessions_count = (int) $db->sql_fetchfield('sessions_cnt');