Blame view

bitrix_server_test.php 51.7 KB
60c6f0893   root   init
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
  <?php
  #####################################
  define('LAST_MODIFIED','09.10.2017');
  #####################################
  
  ob_implicit_flush(true);
  
  if (@$_REQUEST['debug'])
  {
  	error_reporting(E_ALL & ~E_NOTICE);
  	ini_set("display_errors",1);
  }
  else
  	error_reporting(0);
  
  if (function_exists('mb_internal_encoding'))
  	mb_internal_encoding('ISO-8859-1');
  
  $image_file = "bitrix_test_image.gif";
  
  $bTest = $_REQUEST['start_test'] ? true : false;
  
  $lang=$_REQUEST['lang']?($_REQUEST['lang']=='ru'?'ru':'en'):(@preg_match('#ru#i',$_SERVER['HTTP_ACCEPT_LANGUAGE'])?'ru':'en');
  if ($lang=='ru')
  	header("Content-type:text/html; charset=windows-1251");
  
  $M=array();
  if ($lang=='en')
  {
  	$M['SELF_VERSION']='Test version';
  	$M['SELF_VERSION_DESC']='Can be downloaded from <a href="http://www.bitrixsoft.com/download/scripts/bitrix_server_test.php">http://www.bitrixsoft.com/download/scripts/bitrix_server_test.php</a>';
  	$M['SELF_OLD']='Outdated';
  	$M['SELF_NEW']='Fresh';
  	$M['TITLE']='Bitrix Site Manager Server Test';
  	$M['TOP_MSG']='<font class="install">Server Test</font>&nbsp;<font class="bitrixtitle">Bitrix Site Manager</font>';
  	$M['TOP_DESC']='Here you can find server configuration parameters required for correct management of the product';
  	$M['TOP_SELECT_TYPE']='Select: ';
  	$M['TOP_TAR1']=' Required settings';
  	$M['TOP_TAR2']=' Recommended settings';
  	$M['TOP_LINKS']='<br><a href="http://www.bitrixsoft.com/learning/course/index.php?COURSE_ID=22" target=_blank>Training course “Configuring Web Systems for Best Performance”</a><br><br>'; 
  	$M['START_TEST']='Start testing';
  	$M['CONF_GENERAL']='General';
  	$M['CONF_FS']='File system'; 
  	$M['SENDFILE']='send file';
  	$M['CONF_EXT']='PHP extensions';
  	$M['CONF_MYSQL']='MySQL configuration'; 
  	$M['CONF_ADD']='Additional Information';
  	$M['OPEN']='open';
  	$M['COPY']='&nbsp;&copy; Bitrix Site Manager, 2001-';
  	$M['SUPPORT_LINK']='<a 
  	href="http://www.bitrixsoft.com">www.bitrixsoft.com</a>  |  <a 
  	href="http://www.bitrixsoft.com/support/">Support</a>';
  	$M['OPEN_RESULT']='Show test results';
  	$M['LIMIT']='limit:';
  	$M['TESTING']=' testing...';
  	$M['DEL_TMP_TABLE']='Deleting test table';
  	$M['TEST_MYSQL']='Test MySQL server';
  	$M['SERVER_ANS']='Server response';
  	$M['WRONG_ANS']='Wrong response';
  	$M['NA']="Not determined";
  	$M['WEB_SERVER']="Web-server version";
  	$M['WEB_SERVER_DESC']=" Required: Apache 1.3.0 and higher or IIS 5.0 and higher";
  	$M['SAPI']="PHP interface";
  	$M['SAPI_DESC']="It's recommended to run PHP as the Apache module. It's faster than CGI and allows more flexible settings.";
  	$M['PHP_VER']="PHP version";
  	$M['PHP_VER_DESC']='Required version: 5.3 and higher'; 
  	$M['SAFE_DESC']="Safe Mode is not supported";
  	$M['TEST_SESS']="Sessions saving";
  	$M['TEST_SESS_DESC']='Required for saving authorization';
  	$M['TEST_SESS_UA']="Sessions saving without UserAgent";
  	$M['TEST_SESS_UA_DESC']='Required for file upload plugin';
  	$M['SHORT_TAG']="short_open_tag value"; 
  	$M['SHORT_TAG_DESC']='short_open_tag=off is not supported'; 
  	$M['MEM_LIMIT']="memory_limit value";
  	$M['MEM_LIMIT_DESC']='Memory limit settings should be not less than 32M (64M for "Professional" and higher editions). It is recommended to disable unused PHP modules in php.ini file to increase the memory size available to applications.';
  	$M['MEM_FACT']="Actual memory limit";
  	$M['MEM_FACT_DESC']='Sometimes, actual memory limit differs from PHP settings';
  	$M['SENDMAIL']="Email Sending";
  	$M['SENDMAIL_DESC']='Attempt to call the mail() function'; 
  	$M['MCRYPT_TEST']='Mcrypt module';
  	$M['HASH_TEST']='Hash module';
  	$M['MCRYPT_TEST_DESC']='Required for secure cloud backup';
  	$M['SOCK_TEST']='Functions to work with sockets';
  	$M['SOCK_TEST_DESC']='Required for work of SiteUpdate system';
  	$M['SYSUPDATE']="SiteUpdate system";
  	$M['SYSUPDATE_DESC']='Attempt to connect to the www.bitrixsoft.com 
  	on port 80';
  	$M['NO_CONNECT']='No connection';
  	$M['HTTP_AUTH']="HTTP authorization";
  	$M['1C_1']='Necessary for the integration with MS Outlook. Connecting to<b>'; 
  	$M['1C_2']='</b> on <b>';
  	$M['1C_3']='</b> port';
  	$M['SET_TM']="Setting of set_time_limit";
  	$M['SET_TM_DESC']='For correct work of the SiteUpdate system and system agents it is recommended to allow managing of the max_execution_time parameter value through the set_time_limit function in product scripts.'; 
  	$M['TIME_TEST']="Execution time test";
  	$M['TIME_TEST_CPU']="Execution time test with CPU load";
  	$M['TIME_TEST_CPU_DESC']="";
  	$M['TIME_TEST_DESC']='Attempt to execute the script for 60 seconds';
  	$M['PHP_ACC']='PHP accelerator';
  	$M['PHP_ACC_DESC']='PHP Accelerator is recommended (APC, XCache or any other except deprecated EAccelerator), it allows to greatly reduce the CPU load and PHP scripts execution time. It\'s desirable that the accelerator memory should be sufficient for commonly-used PHP pages.
  	<br>If there is no PHP accelerator, analysis of <a 
  	href="?phpinfo=Y">phpinfo()</a> is required';
  	$M['CONFLICT']='conflict';
  	$M['NOT_FOUND']='not found';
  	$M['D_SPACE']="Disk space";
  	$M['D_SPACE_DESC']='It is recommended to have not less than 50M for the Start Edition and 150M for the Enterprise Edition'; 
  	$M['F_PERM']='Permissions for the current folder';
  	$M['F_CREATE']='Folder creation';
  	$M['F_CREATE_DESC']='Attempt to create a test folder';
  	$M['F_NEW_PERM']='Permissions for the created folder';
  	$M['F_DELETE']='Folder deletion';
  	$M['FL_CREATE']='File creation';
  	$M['FL_CREATE_D']='Attempt to create a test file';
  	$M['FL_PERM']='Permissions for the created file';
  	$M['FL_DEL']="File deletion";
  	$M['FL_EXEC']="File execution (for the created file)";
  	$M['FL_EXEC_D']='Sometimes, there are problems with executing files created with PHP';
  	$M['NOT_TESTED']='not tested';
  	$M['HTACCESS']='Processing .htaccess files';
  	$M['HTACCESS_D']='Attempting to configure 404-error handling for a newly created folder'; 
  	$M['FILE_UPL']='file_uploads value';
  	$M['FILE_UPL_TEST']='File upload';
  	$M['FILE_UPL_TEST_D']='Test upload of GIF image';
  	$M['IMG']='Image';
  	$M['IMG_D']='Image will be displayed after successful upload.';
  	$M['EREGS']='PHP regular expressions';
  	$M['PREG']='Perl regular expressions';
  	$M['ZLIB_D']='Required for correct Compression module work and fast updates loading';
  	$M['GDLIB']='Displaying graphs in the statistics and working with images';
  	$M['GDLIB_D']='Required for CAPTCHA functionality'; 
  	$M['SSL']='SSL support';
  	$M['SSL_D']='Required for correct eStore module work with external payment systems plugins'; 
  	$M['MBSTR']='mbstring support';
  	$M['MBSTR_D']='Required for correct product work with UTF-8'; 
  	$M['MYSQL']='MySQL functions';
  	$M['MYSQL_D']='MySQL functions are mandatory';
  	$M['MYSQL_CONNECT']='Connection to MySQL server';
  	$M['MYSQL_VER']='MySQL server version';
  	$M['MYSQL_REQ']='MySQL 5.0 and higher (No alpha or beta releases are allowed).'; 
  	$M['MYSQL_REQ_D']='';
  	$M['MYSQL_SELECT_DB']='Database selection';
  	$M['INNODB']='InnoDB Support';
  	$M['DB_TEST_TABLE']='Creating a test table';
  	$M['INSERT']='Running Insert query';
  	$M['INSERT_D']='Queries per second: if lower than 2000, it might indicate low DB performance';
  	$M['DB_SELECT']='Database selection';
  	$M['DB_CONNECT']='Connection to MySQL server';
  	$M['MYSQL_TEST']='MySQL test';
  	$M['SQL_MODE_DESC']='`STRICT*` modes are not supported';
  	$M['DB_HOST']='DB Host';
  	$M['DB_NAME']='DB name';
  	$M['DB_USER']='User';
  	$M['DB_PASS']='Password';
  	$M['SHOW_ERR']='Display errors'; 
  	$M['SHOW_ERR_D']='Turns on error displaying for this page and writes the file <a href="bitrix_server_test.log" target="_blank">bitrix_server_test.log</a>'; 
  	$M['POST_MS']="post_max_size value";
  	$M['ERROR']='Error';
  	$M['YES']='Yes';
  	$M['NO']='No';
  	$M['FS_TIME']="Time to create 1000 files (sec)";
  	$M['SEC']="sec.";
  	$M['TIME']="Time";
  	$M['FS_TIME_D']="";
  	$M['SECURE_DBCONN']="";
  	$M["LOADER_LOAD_CANT_OPEN_WRITE"] = "Cannot open file #FILE# for writing";
  	$M["LOADER_NEW_VERSION"] = "Unable to load new version of this script";
  	$M["max_input_vars"] = "Must be 10000 or higher";
  }
  else
  {
  	$M['SELF_VERSION']='Âåðñèÿ òåñòà';
  	$M['SELF_VERSION_DESC']='Ìîæíî ñêà÷àòü ïî ññûëêå: <a href="http://www.1c-bitrix.ru/download/scripts/bitrix_server_test.php">http://www.1c-bitrix.ru/download/scripts/bitrix_server_test.php</a>';
  	$M['SELF_OLD']='Óñòàðåëà';
  	$M['SELF_NEW']='Àêòóàëüíàÿ';
  	$M['TITLE']='Ñåðâåð-òåñò "Áèòðèêñ: Óïðàâëåíèå ñàéòîì"';
  	$M['TOP_MSG']='<font class="install">Ñåðâåð-òåñò </font>&nbsp;<font class="bitrixtitle">&quot;Áèòðèêñ: Óïðàâëåíèå ñàéòîì&quot;</font>';
  	$M['TOP_DESC']='Îòîáðàæàþòñÿ ïàðàìåòðû êîíôèãóðàöèè ñåðâåðà, íåîáõîäèìûå äëÿ èñïîëüçîâàíèÿ âñåõ âîçìîæíîñòåé ïðîãðàììíîãî ïðîäóêòà "Áèòðèêñ: Óïðàâëåíèå Ñàéòîì"';
  	$M['TOP_SELECT_TYPE']='Îòìåòèòü òðåáîâàíèÿ êîíôèãóðàöèè ñåðâåðà äëÿ: ';
  	$M['TOP_TAR1']='îáùåãî òàðèôà';
  	$M['TOP_TAR2']='òàðèôà &quot;Áèòðèêñ&quot;';
  	$M['TOP_LINKS']='
  						<a href="http://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=32&CHAPTER_ID=1139">Ó÷åáíûé êóðñ äëÿ õîñòåðîâ</a><br>
  						<a href="http://partners.1c-bitrix.ru/program/hosting.php">Èíôîðìàöèÿ ïî ñåðòèôèêàöèè õîñòèíãà</a><br>
  						<a href="http://partners.1c-bitrix.ru/program/hosting.php#tab-requirements-link">Òðåáîâàíèÿ ïî íàñòðîéêàì õîñòèíãà</a>';
  	$M['START_TEST']='Íà÷àòü òåñòèðîâàíèå';
  	$M['CONF_GENERAL']='Îáùàÿ êîíôèãóðàöèÿ';
  	$M['CONF_FS']='Ôàéëîâàÿ ñèñòåìà';
  	$M['SENDFILE']="Îòïðàâèòü ôàéë";
  	$M['CONF_EXT']='Ðàñøèðåíèÿ php';
  	$M['CONF_MYSQL']='Êîíôèãóðàöèÿ MySQL';
  	$M['CONF_ADD']='Äîïîëíèòåëüíàÿ èíôîðìàöèÿ';
  	$M['OPEN']='îòêðûòü';
  	$M['COPY']='&nbsp;&copy; &laquo;Áèòðèêñ&raquo;, 2001-';
  	$M['SUPPORT_LINK']='<a href="http://www.bitrixsoft.ru">www.bitrixsoft.ru</a>  |  <a href="http://www.bitrixsoft.ru/support/">Òåõïîääåðæêà</a>';
  	$M['OPEN_RESULT']='Îòêðûòü ðåçóëüòàò òåñòà';
  	$M['LIMIT']='ëèìèò:';
  	$M['TESTING']='òåñòèðóåì...';
  	$M['DEL_TMP_TABLE']="Óäàëåíèå òåñòîâîé òàáëèöû";
  	$M['TEST_MYSQL']="Òåñòèðîâàòü MySQL ñåðâåð";
  
  	$M['SERVER_ANS']="Îòâåò ñåðâåðà";
  	$M['WRONG_ANS']='íåâåðíûé îòâåò';
  	$M['NA']="Íå îïðåäåëåíî";
  	$M['WEB_SERVER']="Âåðñèÿ âåá-ñåðâåðà";
  	$M['WEB_SERVER_DESC']="Òðåáóåòñÿ Apache 1.3.0 è âûøå èëè IIS 5.0 è âûøå";
  	$M['SAPI']="Èíòåðôåéñ php";
  	$M['SAPI_DESC']="Ðåêîìåíäóåòñÿ çàïóñêàòü PHP êàê ìîäóëü Apache, ýòî áûñòðåå ÷åì CGI è äà¸ò áîëåå ãèáêèå íàñòðîéêè";
  	$M['PHP_VER']="Âåðñèÿ php";
  	$M['PHP_VER_DESC']='Òðåáóåòñÿ 5.3 è âûøå';
  	$M['SAFE_DESC']="Ðåæèì safe_mode íå ïîääåðæèâàåòñÿ";
  	$M['TEST_SESS']="Ñîõðàíåíèå ñåññèè";
  	$M['TEST_SESS_DESC']='Íåîáõîäèìî äëÿ ñîõðàíåíèÿ àâòîðèçàöèè';
  	$M['TEST_SESS_UA']="Ñîõðàíåíèå ñåññèé áåç UserAgent";
  	$M['TEST_SESS_UA_DESC']='Íåîáõîäèìî äëÿ àïïëåòà ìíîæåñòâåííîé çàãðóçêè ôàéëîâ è îáìåíà ñ 1Ñ';
  	$M['SHORT_TAG']="Çíà÷åíèå short_open_tag";
  	$M['SHORT_TAG_DESC']='short_open_tag=off íå ïîääåðæèâàåòñÿ';
  	$M['MEM_LIMIT']="Çíà÷åíèå memory_limit";
  	$M['MEM_LIMIT_DESC']='Îãðàíè÷åíèå ïàìÿòè äîëæíî áûòü íå íèæå 32 Ìá (64 Ìá äëÿ ñòàðøèõ ðåäàêöèé íà÷èíàÿ ñ "Ýêñïåðòà"). Íåèñïîëüçóåìûå PHP ìîäóëè â php.ini æåëàòåëüíî îòêëþ÷èòü ÷òîáû óâåëè÷èòü ðàçìåð ïàìÿòè, äîñòóïíîé äëÿ ïðèëîæåíèé.';
  	$M['MEM_FACT']="Ôàêòè÷åñêîå îãðàíè÷åíèå ïàìÿòè";
  	$M['MEM_FACT_DESC']='Èíîãäà ôàêòè÷åñêîå îãðàíè÷åíèå ïàìÿòè ìîæåò îòëè÷àòüñÿ îò óñòàíîâîê php';
  	$M['SENDMAIL']="Îòïðàâêà ïî÷òû";
  	$M['SENDMAIL_DESC']='Ïîïûòêà âûçâàòü ôóíêöèþ mail()';
  	$M['MCRYPT_TEST']='Ìîäóëè øèôðîâàíèÿ';
  	$M['HASH_TEST']='Ìîäóëü Hash';
  	$M['MCRYPT_TEST_DESC']='Òðåáóåòñÿ ðåçåðâíîãî êîïèðîâàíèÿ â îáëàêî';
  	$M['SOCK_TEST']="Ôóíêöèè ðàáîòû ñ ñîêåòàìè";
  	$M['SOCK_TEST_DESC']='Íåîáõîäèìû äëÿ ðàáîòû ñèñòåìû îáíîâëåíèé';
  	$M['SYSUPDATE']="Ñèñòåìà îáíîâëåíèé";
  	$M['SYSUPDATE_DESC']='Îñóùåñòâëÿåòñÿ ïîïûòêà ïîäêëþ÷èòüñÿ ê ñåðâåðó www.bitrixsoft.ru íà ïîðò 80';
  	$M['NO_CONNECT']="íåò ïîäêëþ÷åíèÿ";
  	$M['HTTP_AUTH']="HTTP àâòîðèçàöèÿ";
  	$M['1C_1']='Òðåáóåòñÿ äëÿ èíòåãðàöèåé ñ 1Ñ è MS Outlook. Ïîäêëþ÷åíèå ê <b>';
  	$M['1C_2']='</b> íà <b>';
  	$M['1C_3']='</b> ïîðò';
  	$M['SET_TM']="Óñòàíîâêà set_time_limit";
  	$M['SET_TM_DESC']='Äëÿ îïåðàöèé îáíîâëåíèÿ ïðîäóêòà è ðàáîòû àãåíòîâ ðåêîìåíäóåòñÿ ðàçðåøàòü óïðàâëåíèå çíà÷åíèåì max_execution_time ÷åðåç ôóíêöèþ set_time_limit èç ïðîäóêòà.';
  	$M['TIME_TEST']="Òåñò íà âðåìÿ";
  	$M['TIME_TEST_CPU']="Òåñò íà âðåìÿ ñ íàãðóçêîé íà ïðîöåññîð";
  	$M['TIME_TEST_CPU_DESC']=" ðÿäå ñëó÷àåâ ñêðèïòû îòêëþ÷àþòñÿ ïðè ïðåâûøåíèè íàãðóçêè íà ïðîöåññîð";
  	$M['TIME_TEST_DESC']='Ïîïûòêà âûïîëíÿòü ñêðèïò â òå÷åíèå 60 ñåêóíä';
  	$M['PHP_ACC']="Àêñåëåðàòîð php";
  	$M['PHP_ACC_DESC']='Ðåêîìåíäóåòñÿ íàëè÷èå àêñåëåðàòîðà PHP (APC, XCache èëè ëþáîãî äðóãîãî êðîìå óñòàðåâøåãî EAccelerator), ýòî ïîçâîëÿåò ñíèçèòü íàãðóçêó íà CPU â íåñêîëüêî ðàç è óìåíüøèòü âðåìÿ âûïîëíåíèÿ PHP êîäà. Æåëàòåëüíî, ÷òîáû ïàìÿòè àêñåëåðàòîðà áûëî äîñòàòî÷íî äëÿ ðàçìåùåíèÿ âñåõ ÷àñòî èñïîëüçóåìûõ PHP ñòðàíèö. Ðåêîìåíäóåòñÿ óñòàíîâèòü ôèëüòðû, íàïðèìåð (äëÿ eA): eaccelerator.filter  !*/help/* !*/admin/* !*/bitrix/*cache/* */bitrix/* */.*.php<br>Åñëè àêñåëåðàòîð íå îáíàðóæåí, òðåáóåòñÿ àíàëèç <a href="?phpinfo=Y">phpinfo()</a>';
  	$M['CONFLICT']='êîíôëèêò';
  	$M['NOT_FOUND']='íå îáíàðóæåí';
  	$M['D_SPACE']="Ìåñòî íà äèñêå";
  	$M['D_SPACE_DESC']='Íå ìåíåå 50 Ìá äëÿ ðåäàêöèè "Ñòàðò" è íå ìåíåå 150 Ìá äëÿ ðåäàêöèè "Áèçíåñ"';
  	$M['F_PERM']="Ïðàâà íà òåêóùóþ ïàïêó";
  	$M['F_CREATE']="Ñîçäàíèå ïàïêè";
  	$M['F_CREATE_DESC']='Ïîïûòêà ñîçäàòü òåñòîâóþ ïàïêó';
  	$M['F_NEW_PERM']="Ïðàâà íà ñîçäàííóþ ïàïêó";
  	$M['F_DELETE']="Óäàëåíèå ïàïêè";
  	$M['FL_CREATE']="Ñîçäàíèå ôàéëà";
  	$M['FL_CREATE_D']='Ïîïûòêà ñîçäàòü òåñòîâûé ôàéë';
  	$M['FL_PERM']="Ïðàâà íà ñîçäàííûé ôàéë";
  	$M['FL_DEL']="Óäàëåíèå ôàéëà";
  	$M['FL_EXEC']="Çàïóñê ñîçäàííîãî ôàéëà";
  	$M['FL_EXEC_D']=' ðÿäå ñëó÷àåâ âîçíèêàþò ïðîáëåìû ïðè çàïóñêå ôàéëà, ñîçäàííîãî ñðåäñòâàìè PHP';
  	$M['NOT_TESTED']="íå òåñòèðîâàëîñü";
  	$M['HTACCESS']="Îáðàáîòêà .htaccess";
  	$M['HTACCESS_D']='Îñóùåñòâëÿåòñÿ ïîïûòêà íàñòðîèòü îáðàáîòêó 404-é îøèáêè âî âíîâü ñîçäàííîé ïàïêå';
  	$M['FILE_UPL']="Çíà÷åíèå file_uploads";
  	$M['FILE_UPL_TEST']="Çàãðóçêà ôàéëà";
  	$M['FILE_UPL_TEST_D']='Òåñòîâàÿ çàãðóçêà êàðòèíêè â ôîðìàòå GIF';
  	$M['IMG']="Èçîáðàæåíèå";
  	$M['IMG_D']='Ïðè óñïåøíîé çàãðóçêå îòîáðàæàåòñÿ êàðòèíêà';
  	$M['EREGS']="Ðåãóëÿðíûå âûðàæåíèÿ PHP";
  	$M['PREG']="Ðåãóëÿðíûå âûðàæåíèÿ Perl";
  	$M['ZLIB_D']='Òðåáóåòñÿ äëÿ ðàáîòû ìîäóëÿ êîìïðåññèè è áûñòðîé çàãðóçêè îáíîâëåíèé';
  	$M['GDLIB']='Îòîáðàæåíèå ãðàôèêîâ â ñòàòèñòèêå, ðàáîòà ñ èçîáðàæåíèÿìè';
  	$M['GDLIB_D']='Íåîáõîäèìà äëÿ ðàáîòû CAPTCHA';
  	$M['SSL']="Ïîääåðæêà SSL";
  	$M['SSL_D']='Íåîáõîäèìà äëÿ ðàáîòû èíòåðíåò-ìàãàçèíà ñ ïîäêëþ÷åíèåì âíåøíèõ ïëàò¸æíûõ ñèñòåì';
  	$M['MBSTR']="Ïîääåðæêà mbstring";
  	$M['MBSTR_D']='Íåîáõîäèìà äëÿ ðàáîòû ïðîäóêòà â êîäèðîâêå UTF-8';
  	$M['MYSQL']="Ôóíêöèè MySQL";
  	$M['MYSQL_D']='Îáÿçàòåëüííî íàëè÷èå ôóíêöèé MySQL';
  	$M['MYSQL_CONNECT']="Ïîäêëþ÷åíèå ê ñåðâåðó MySQL";
  	$M['MYSQL_VER']="Âåðñèÿ MySQL ñåðâåðà";
  	$M['MYSQL_REQ']='Ìèíèìàëüíûå òðåáîâàíèÿ: 5.0 è âûøå. Àëüôà è áåòà âåðñèè íå äîïóñêàþòñÿ.';
  	$M['MYSQL_REQ_D']='';
  	$M['MYSQL_SELECT_DB']="Âûáîð áàçû äàííûõ";
  	$M['INNODB']="Ïîääåðæêà InnoDB";
  	$M['DB_TEST_TABLE']="Ñîçäàíèå òåñòîâîé òàáëèöû";
  	$M['INSERT']="Âûïîëíåíèå çàïðîñîâ INSERT";
  	$M['INSERT_D']='×èñëî çàïðîñîâ â ñåêóíäó: çíà÷åíèå íèæå 2000 ìîæåò ñâèäåòåëüñòâîâàòü î íèçêîé ïðîèçâîäèòåëüíîñòè ÁÄ';
  	$M['DB_SELECT']="Âûáîð áàçû äàííûõ";
  	$M['DB_CONNECT']="Ïîäêëþ÷åíèå ê ñåðâåðó MySQL";
  	$M['MYSQL_TEST']="Òåñòèðîâàíèå MySQL";
  	$M['SQL_MODE_DESC']='Ðåæèìû `STRICT*` íå ïîääåðæèâàþòñÿ';
  	$M['DB_HOST']="Õîñò ÁÄ";
  	$M['DB_NAME']="Èìÿ ÁÄ";
  	$M['DB_USER']="Ïîëüçîâàòåëü";
  	$M['DB_PASS']="Ïàðîëü";
  	$M['SHOW_ERR']="Âêëþ÷èòü îòëàäêó";
  	$M['SHOW_ERR_D']='Âêëþ÷àåò îòîáðàæåíèå îøèáîê è ïèøåò ëîã ôàéë <a href="bitrix_server_test.log" target="_blank">bitrix_server_test.log</a>';
  	$M['POST_MS']="Çíà÷åíèå post_max_size";
  	$M['ERROR']='Îøèáêà';
  	$M['YES']="Äà";
  	$M['NO']="Íåò";
  	$M['TIME']="Âðåìÿ";
  	$M['FS_TIME']="Âðåìÿ íà ñîçäàíèå 1000 ôàéëîâ (ñåê)";
  	$M['FS_TIME_D']="Íîðìàëüíîå âðåìÿ - äî 2 ñåêóíä";
  	$M['SEC']="ñåê.";
  	$M['SECURE_DBCONN']="Åñòü ôàéë êîíôèãóðàöèè dbconn.php, íî çíà÷åíèÿ íå ïîêàçûâàþòñÿ â öåëÿõ áåçîïàñíîñòè";
  	$M["LOADER_LOAD_CANT_OPEN_WRITE"] = "Íå ìîãó îòêðûòü ôàéë #FILE# íà çàïèñü";
  	$M["LOADER_NEW_VERSION"] = "Äîñòóïíà íîâàÿ âåðñèÿ ñêðèïòà òåñòèðîâàíèÿ, íî çàãðóçèòü å¸ íå óäàëîñü";
  	$M["max_input_vars"] = "Äîëæíî áûòü íå ìåíüøå 10000";
  }
  
  if (@$_GET['auth_test']) 
  {
  	$remote_user = $_SERVER["REMOTE_USER"] ? $_SERVER["REMOTE_USER"] : $_SERVER["REDIRECT_REMOTE_USER"];
  	$strTmp = base64_decode(substr($remote_user,6));
  	if ($strTmp)
  		list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', $strTmp);
  	
  	if ($_SERVER['PHP_AUTH_USER']=='test_user' && $_SERVER['PHP_AUTH_PW']=='test_password') 
  		die('SUCCESS');
  	else
  	{
  		header('HTTP/1.x 401 Authorization required');
  		header('WWW-Authenticate: Basic realm="Restricted area"');
  		die('<h1>401 Authorization required</h1>');
  	}
  } 
  elseif (@$_GET['session_test']) 
  {
  	session_start();
  	if ($_SESSION['session_test']=='ok') 
  		die('SUCCESS');
  	else
  		die('Fault');
  } 
  elseif (@$_GET['image']) 
  {
  	header("Content-type: image/gif");
  	echo file_get_contents($image_file);
  	@unlink($image_file);
  	die();
  } 
  elseif (@$_GET['phpinfo']) 
  {
  	phpinfo();
  	die();
  } 
  elseif (@$_GET['time_test']) 
  {
  	@set_time_limit(300);
  	@ini_set('max_execution_time',300);
  	$t=time();
  	while(time()-$t < 60) 
  	{
  		if ($_GET['max_cpu'])
  			date('Y-m-d H:i:s');
  		else
  			sleep(1);
  	}
  	die("SUCCESS");
  } 
  elseif (@$_GET['memory_test']) 
  {
  	$max=intval($_GET['max']);
  	if (!$max) $max = 255;
  	for($i=1;$i<=$max;$i++)
  	       $a[]=str_repeat(chr($i),1024*1024); // 1 Mb
  	die("SUCCESS");
  }
  elseif(@$_GET['killme']=='Y')
  {
  	unlink(__FILE__);
  	echo file_exists(__FILE__)?'ERROR!':'OK';
  	die();
  }
  
  session_start();
  
  
  ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <!-- last modified <?php echo LAST_MODIFIED ?> -->
  <html>
  <head>
  <title><?php echo GM('TITLE');?></title>
  <meta http-equiv="Content-Type" content="text/html; charset=Windows-1251">
  <style type="text/css">
  	.text {font-family:Verdana,Arial, Helvetica, sans-serif; font-weight:normal; font-size:12px; color:#365069;}
  	.error_text {font-family: Verdana,Arial, Helvetica, sans-serif; font-size:13px; color:#FF0000; font-weight:bold;}
  	.warning_text {font-family: Verdana,Arial, Helvetica, sans-serif; font-size:13px; color:#990000; font-weight:bold;}
  	.ok_text {font-family: Verdana,Arial,Helvetica,sans-serif; font-size:13px; color:#00FF00; font-weight:bold;}
  
  	.tablehead, .tablehead1, .tablehead2, .tablehead3, .tablehead4, .tablehead5 {background-color:#C2DBED; padding:3px;}
  	.tablehead1, .tablehead2, .tablehead3 {}
  	.tablehead1 {}
  	.tablehead3 {}
  	.tablehead4, .tablehead5 {}
  	.tablehead5 {}
  
  	.tablebody, .tablebody1, .tablebody2, .tablebody3, .tablebody4 {background-color:#E2EFF7; padding:5px;}
  	.tablebody1 {}
  	.tablebody2 {}
  	.tablebody3 {border-bottom:1px solid #C2DBED;}
  	.tablebody4 {}
  
  	.tablebodytext, .tableheadtext, .tablefieldtext {font-family:Verdana,Arial, Helvetica, sans-serif; font-size:12px;}
  	.tableheadtext, .tablebodytext {font-family:Verdana,Arial, Helvetica, sans-serif;color:#000000}
  	.tablefieldtext {font-family:Verdana,Arial, Helvetica, sans-serif;color:#365069;}
  
  	INPUT.button {padding:2px; font-family:Tahoma; font-size:12px; cursor: pointer;}
  	INPUT.typeinput {font-size:12px;}
  	.typeselect {font-family:Verdana,Arial, Helvetica, sans-serif;font-size:12px;}
  
  	h3 {font-family:Verdana,Arial, Helvetica, sans-serif; font-size:14px; font-weight: bold; color: #585858; margin-bottom: 5px;}
  
  
  	.smalltext{font-family:Verdana, Arial, Helvetica, sans-serif; color:#365069; font-size:10px;}
  	.version{font-family:Verdana, Arial, Helvetica, sans-serif; color:#FF9933; size:18px; font-weight:bold;}
  	.bitrixtitle{font-family:Verdana, Arial, Helvetica, sans-serif; color:#4083B5; size:18px; font-weight:bold;}
  	.install{font-family:Verdana, Arial, Helvetica, sans-serif; size:18px; font-weight:bold;}
  	.head{font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:bold; color:#365069; size:18px;}
  	.headbitrix{font-family:Verdana, Arial, Helvetica, sans-serif; color:#365069; font-size:12px; font-weight:bold;}
  	.title{font-family:Verdana, Arial, Helvetica, sans-serif; color:#365069; font-weight:bold; font-size:16px;}
  	.menu{ background-color:#E6F1F9; font-family:Verdana, Arial, Helvetica, sans-serif; color:#B4C0D0; font-size:12px; padding-left:10px; padding-right:5px;}
  	.menuact{background-color:#D8E8F4; font-family:Verdana, Arial, Helvetica, sans-serif; color:#365069; font-size:12px; padding-left:10px; padding-right:5px; font-weight:bold;}
  	.text11 {font-family:Verdana,Arial, Helvetica, sans-serif; font-weight:normal; color:#365069; font-size:12px; margin-bottom: 5px;}
  	
  	a {color:#4182b6;}
  	a:hover {color:#4182f6;}
  </style>
  </head>
  <body link="#6C93AE" alink="#F1555A" vlink="#a4a4a4" style="margin-top:1px; margin-bottom:10px; margin-right:10px; margin-left:10px;" <?php echo $bTest ? ' onload="start_test()"' : ''?>>
  
  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
  	<tr height="50">
  		<td width="100%" align="center" ><?php echo GM('TOP_MSG');?></td>
  	</tr>
  </table>
  
  <table width="100%"  border="0" cellspacing="1" cellpadding="0" bgcolor="#D5E7F3">
  <tr>
  	<td>
  		<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F4FBFF">
  		<tr>
  			<td width="0%" bgcolor="#D5E7F3" rowspan="2"></td>
  			<td width="100%" align="center" valign="top">
  				<table width="100%"  border="0" cellspacing="0" cellpadding="0" style="border-top: 1px solid #B9D2E2; border-bottom: 1px solid #B9D2E2; border-left: 1px solid #B9D2E2; border-right: 1px solid #B9D2E2;">
  				<tr>
  					<td colspan=2 width="100%" bgcolor=#CFDFEF>
  					<div align=center><font class="headbitrix">
  					<?php echo GM('TOP_DESC'); ?>
  	<br>
  					<font class="text11">
  					<?php echo GM('TOP_SELECT_TYPE');?>
  				<?php if (@$_REQUEST['test']==1) echo "<b>".GM('TOP_TAR1')."</b>"; else echo "<a href=\"?test=1&lang=".$lang."\">".GM('TOP_TAR1')."</a>"; ?> /
  				<?php if (@$_REQUEST['test']==2) echo "<b>".GM('TOP_TAR2')."</b>"; else echo "<a href=\"?test=2&lang=".$lang."\">".GM('TOP_TAR2')."</a>"; ?>
  					</font></div>
  					</font>
  					</td>
  				</tr>
  				<tr>
  					<td bgcolor=#CFDFEF>
  	<div style="padding-left:20px; padding-right:20px;" align="left">
  					<font class="text11">
  					<?php echo GM('TOP_LINKS');?>
  					</font></div>
  					</td>
  					<form method=GET>
  					<td bgcolor=#CFDFEF align=center valign=middle width=50%>
  						<input type=hidden name=debug value='<?php echo ($_REQUEST['debug']?'Y':'')?>'>
  						<input type=hidden name=lang value="<?php echo $lang?>">
  						<input type=hidden name=start_test value=Y>
  						<input type=submit value="<?php echo GM('START_TEST')?>" <?php if($bTest) echo "disabled";?>>
  					</td>
  					</form>
  				</tr>
  				<tr>
  					<td colspan=2 width="100%" height="619" valign="top" align="left" bgcolor="#DCE9F2">
  						<div style="padding:20px;">
  <?php // START Tests
  ######################################################################
  ?>
  <div style="padding:5" align=center><font class=headbitrix><?php echo GM('CONF_GENERAL');?></font></div>
  <?php
  // Self version
  debug(__LINE__);
  $val = NULL;
  
  // Check for updates
  $strError = '';
  if (!$_REQUEST['UPDATE_SUCCESS'] && !file_exists(dirname(__FILE__).'/bitrix_server_test.debug'))
  {
  	$this_script_name = basename(__FILE__);
  	$bx_host = 'www.1c-bitrix.ru';
  	$bx_url = '/download/files/scripts/'.$this_script_name;
  	$res = @fsockopen($bx_host, 80, $errno, $errstr, 3);
  
  	if($res) 
  	{
  		$strRequest = "HEAD ".$bx_url." HTTP/1.1\r
  ";
  		$strRequest.= "Host: ".$bx_host."\r
  ";
  		$strRequest.= "\r
  ";
  
  		fputs($res, $strRequest);
  
  		while ($line = fgets($res, 4096))
  		{
  			if (@preg_match("/Content-Length: *([0-9]+)/i", $line, $regs))
  			{
  				if (filesize(__FILE__) != trim($regs[1]))
  				{
  					$tmp_name = $this_script_name.'.tmp';
  					if ($str = file_get_contents('http://'.$bx_host.$bx_url))
  					{
  						if (file_put_contents(__FILE__, $str))
  						{
  							bx_accelerator_reset();
  							echo '<script>document.location="?UPDATE_SUCCESS=Y";</script>';
  							die();
  						}
  						else
  							$strError = str_replace("#FILE#", $this_script_name, GM("LOADER_LOAD_CANT_OPEN_WRITE"));
  					}
  					else
  						$strError = GM('LOADER_NEW_VERSION');
  				}
  				break;
  			}
  		}
  		fclose($res);
  	}
  }
  
  if ($strError)
  	echo '<div style="color:red;padding:10px;border:2px solid red;text-align:center;background:#FFF">'.$strError.'</div>';
  
  // Web server
  debug(__LINE__);
  $strSERVER_SOFTWARE = $_SERVER["SERVER_SOFTWARE"];
  if (strlen($strSERVER_SOFTWARE)<=0)
  	$strSERVER_SOFTWARE = $_SERVER["SERVER_SIGNATURE"];
  
  $strSERVER_SOFTWARE = Trim($strSERVER_SOFTWARE);
  if (@preg_match("#^([a-zA-Z-]+).*?([\d]+\.[\d]+(\.[\d]+)?)#i", $strSERVER_SOFTWARE, $arSERVER_SOFTWARE))
  {
  	$strWebServer = $arSERVER_SOFTWARE[1];
  	$strWebServerVersion = $arSERVER_SOFTWARE[2];
  
  	$val = $strWebServer." ".$strWebServerVersion;
  } else {
  	$val = GM("NA");
  }
  
  $pr=array(GM('WEB_SERVER'),GM('WEB_SERVER_DESC'),1);
  show($pr,$val);
  
  // CGI or not
  debug(__LINE__);
  $pr=array(GM('SAPI'),GM('SAPI_DESC'));
  $sapi = strtolower(php_sapi_name());
  show($pr,$sapi,$sapi=='cgi');
  
  // PHP version
  debug(__LINE__);
  $pr=array(GM('PHP_VER'),GM('PHP_VER_DESC'),1);
  show($pr,phpversion(),version_compare(phpversion(),'5.3.0','<'));
  
  // Safe mode
  debug(__LINE__);
  $val=intval(ini_get("safe_mode"));
  $pr=array("Safe mode",GM('SAFE_DESC'),1);
  show($pr,$val,$val);
  
  // short_open_tag
  debug(__LINE__);
  $val = ini_get("short_open_tag") == 1 || strtoupper(ini_get("short_open_tag")) == 'ON';
  $pr=array(GM('SHORT_TAG'),GM('SHORT_TAG_DESC'),1);
  show($pr,$val,!$val);
  
  // Memory limit
  debug(__LINE__);
  $val=ini_get('memory_limit')?ini_get('memory_limit'):get_cfg_var("memory_limit");
  $pr=array(GM('MEM_LIMIT'),GM('MEM_LIMIT_DESC'),1);
  show($pr,$val);
  
  // Test memory limit
  debug(__LINE__);
  $pr=array(GM('MEM_FACT'),GM('MEM_FACT_DESC'),1);
  show($pr,"<div id=memory_limit><font color=gray>".GM('NOT_TESTED')."</font></div>");
  
  // Mail()
  debug(__LINE__);
  $pr=array(GM('SENDMAIL'),GM('SENDMAIL_DESC'),1);
  if ($bTest)
  {
  	$t = time();
  	$val = mail("hosting_test@bitrix.ru","Bitrix server test","This is test message. Delete it.");
  	$tt = time() - $t;
  	show($pr,($val?GM('YES'):GM('NO')).($tt?" (".GM('TIME').": $tt ".GM('SEC').")":""),!$val||$tt>1);
  }
  else
  	show($pr,'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  // socket
  debug(__LINE__);
  $val = $socket = function_exists('fsockopen');
  $pr=array(GM('SOCK_TEST'),GM('SOCK_TEST_DESC'),1);
  show($pr,$val,!$val);
  
  // Session data
  debug(__LINE__);
  $_SESSION['session_test'] = 'ok';
  $pr=array(GM('TEST_SESS'),GM('TEST_SESS_DESC'),1);
  show($pr,"<div id=session><font color=gray>".GM('NOT_TESTED')."</font></div>");
  session_write_close();
  
  // Session without UserAgent test: for upload applet
  debug(__LINE__);
  $ok = false;
  $host = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : 'localhost';
  $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80;
  
  if ($bTest)
  {
  	$pr=array(GM('TEST_SESS_UA'),GM('TEST_SESS_UA_DESC'),1);
  	if ($socket)
  		$res = fsockopen(($port == 443 ? 'ssl://' : '').$host, $port, $errno, $errstr, 3);
  	else
  		$res = false;
  
  	if($res) 
  	{
  		$strRequest = "GET ".dirname($_SERVER['PHP_SELF'])."/bitrix_server_test.php?session_test=Y HTTP/1.1\r
  ";
  		$strRequest.= "Host: ".$host."\r
  ";
  		$strRequest.= "Cookie: ".session_name()."=".session_id()."\r
  ";
  		$strRequest.= "\r
  ";
  
  		$strRes = getHttpResponse($res, $strRequest);
  		fclose($res);
  
  		if (trim($strRes) == "SUCCESS")
  			$val = $ok = GM('YES');
  		else
  			$val = GM('NO');
  	} 
  	else
  		$val=GM('NO_CONNECT');
  	show($pr,$val,!$ok);
  }
  
  // Update system
  debug(__LINE__);
  $pr=array(GM('SYSUPDATE'),GM('SYSUPDATE_DESC'),1);
  if ($bTest)
  {
  	$ok = 0;
  	if ($socket)
  		$res = fsockopen("www.bitrixsoft.com", "80", $errno, $errstr, 3);
  	else
  		$res = false;
  	if($res) 
  	{
  		$strRequest = "POST /bitrix/updates/sysserver.php HTTP/1.1\r
  ";
  		$strRequest.= "User-Agent: BitrixSMUpdater\r
  ";
  		$strRequest.= "Accept: */*\r
  ";
  		$strRequest.= "Host: www.bitrixsoft.com\r
  ";
  		$strRequest.= "Accept-Language: en\r
  ";
  		$strRequest.= "Content-type: application/x-www-form-urlencoded\r
  ";
  		$strRequest.= "Content-length: 7\r
  \r
  ";
  		$strRequest.= "lang=en";
  		$strRequest.= "\r
  ";
  
  		$strRes = getHttpResponse($res, $strRequest);
  		fclose($res);
  
  		if (strtolower(strip_tags($strRes)) == "license key is invalid")
  			$val = $ok = 1;
  		else
  			$val = GM('WRONG_ANS')." <a href='javascript:alert(\"".addslashes($strRes)."\")' title='".GM('SERVER_ANS')."'>&gt;&gt;</a>";
  	} 
  	else
  		$val=GM('NO_CONNECT');
  	show($pr,$val,!$ok);
  }
  else
  	show($pr,'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  // HTTP Auth
  debug(__LINE__);
  $ok = false;
  $pr=array(GM('HTTP_AUTH'),GM('1C_1').$host.GM('1C_2').$port.GM('1C_3'),2);
  if ($bTest)
  {
  	if ($socket)
  		$res = fsockopen(($port == 443 ? 'ssl://' : '').$host, $port, $errno, $errstr, 3);
  	else
  		$res = false;
  
  	if($res) 
  	{
  		$url = parse_url($_SERVER['REQUEST_URI']);
  		$strRequest = "GET ".$url['path']."?auth_test=Y HTTP/1.1\r
  ";
  		$strRequest.= "Host: ".$host."\r
  ";
  		$strRequest.= "Authorization: Basic dGVzdF91c2VyOnRlc3RfcGFzc3dvcmQ=\r
  ";
  		$strRequest.= "\r
  ";
  
  		$strRes = getHttpResponse($res, $strRequest);
  		fclose($res);
  
  		if (trim($strRes) == "SUCCESS")
  		{
  			$val = $ok = GM('YES');
  			if ($_SERVER['REMOTE_USER'])
  				$val .= ' ($_SERVER["REMOTE_USER"])';
  			elseif ($_SERVER['REDIRECT_REMOTE_USER'])
  				$val .= ' ($_SERVER["REDIRECT_REMOTE_USER"])';
  		}
  		else
  			$val = GM('NO');
  	} 
  	else
  		$val=GM('NO_CONNECT');
  	show($pr,$val,!$ok);
  }
  else
  	show($pr,'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  // Set time limit
  #debug(__LINE__);
  #$pr=array(GM('SET_TM'),GM('SET_TM_DESC'),2);
  #@set_time_limit(300);
  #@ini_set('max_execution_time',300);
  #$tl=(ini_get('max_execution_time')==300);
  #show($pr,$tl,!$tl);
  
  $pr=array(GM('TIME_TEST'),GM('TIME_TEST_DESC'),2);
  show($pr,"<div id=time_test><font color=gray>".GM('NOT_TESTED')."</font></div>");
  
  $pr=array(GM('TIME_TEST_CPU'),GM('TIME_TEST_CPU_DESC'),2);
  show($pr,"<div id=time_test_cpu><font color=gray>".GM('NOT_TESTED')."</font></div>");
  
  // Accelerator
  debug(__LINE__);
  $res = "";
  $pr = array(GM('PHP_ACC'),GM('PHP_ACC_DESC'),2);
  if ($val = function_exists("eaccelerator_info")) 
  {
  	$res = "EAccelerator";
  	$val = false;
  }
  elseif($val = function_exists("accelerator_reset"))
  {
  	$res = 'Zend Accelerator <a href="http://dev.1c-bitrix.ru/community/blogs/howto/the-problem-of-performance-in-version-12.php" target=_blank>åñòü ïðîáëåìà</a>';
  	$val = false;
  }
  elseif($val = function_exists("apc_fetch"))
  	$res = "APC";
  elseif($val = function_exists("xcache_get"))
  	$res = "XCache";
  elseif(($val = function_exists("opcache_reset")) && ini_get('opcache.enable'))
  	$res = "OPcache";
  show($pr,$res?GM('YES').' ('.$res.')':GM('NOT_FOUND'),!$val);
  
  // max_input_vars
  if ($m = ini_get('max_input_vars'))
  {
  	$pr = array('max_input_vars',GM('max_input_vars'),2);
  	show($pr, $m, $m < 10000);
  }
  
  ?>
  
  
  <div style="padding:5" align=center><font class=headbitrix><?php echo GM('CONF_FS');?></font></div>
  <?php
  
  
  // Free space
  debug(__LINE__);
  $pr=array(GM('D_SPACE'),GM('D_SPACE_DESC'),1);
  show($pr,intval(@disk_free_space($_SERVER["DOCUMENT_ROOT"])/1024/1024)." Mb");
  
  // dirinfo
  debug(__LINE__);
  show(GM('F_PERM'),dirinfo("."));
  
  // Folder create
  debug(__LINE__);
  $pr=array(GM('F_CREATE'),GM('F_CREATE_DESC'),1);
  if ($bTest)
  {
  	$dir=create_tmp_folder();
  	show($pr, $dir==false?GM('ERROR'):1, $dir==false);
  }
  else
  	show($pr,'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  
  if ($dir)
  {
  	// dirinfo
  debug(__LINE__);
  	show(GM('F_NEW_PERM'),dirinfo($dir));
  
  	// Folder delete
  debug(__LINE__);
  	$val=rmdir($dir);
  	show(array(GM('F_DELETE'),'',1), $val==false?GM('ERROR'):1, !$val);
  }
  
  
  // File create
  debug(__LINE__);
  $file = false;
  $pr=array(GM('FL_CREATE'),GM('FL_CREATE_D'),1);
  if ($bTest)
  {
  	$file=create_tmp_file();
  	show($pr, $file==false?GM('ERROR'):1, $file==false);
  }
  else
  	show($pr,'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  
  if ($file) 
  {
  	// dirinfo
  debug(__LINE__);
  	show(GM('FL_PERM'),dirinfo($file));
  
  	// File delete
  debug(__LINE__);
  	$del=unlink($file);
  	show(array(GM('FL_DEL'),'',1), $val==false?GM('ERROR'):1, !$val);
  }
  
  // File exec
  debug(__LINE__);
  $pr=array(GM('FL_EXEC'),GM('FL_EXEC_D'),1);
  $ok = false;
  $host = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : 'localhost';
  $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80;
  $val = GM('NOT_TESTED');
  if ($file && $bTest)
  {
  	$fn=$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/bitrix_test_exec.php";
  	$f=fopen($fn,"wb");
  	$data='<?php 
  	echo "SUCCESS";
  	?>';
  	fputs($f,$data);
  	fclose($f);
  
  	if ($socket)
  		$res = fsockopen(($port == 443 ? 'ssl://' : '').$host, $port, $errno, $errstr, 3);
  	else
  		$res = false;
  
  	if($res) 
  	{
  		$strRequest = "GET ".dirname($_SERVER['PHP_SELF'])."/bitrix_test_exec.php HTTP/1.1\r
  ";
  		$strRequest.= "Host: ".$host."\r
  ";
  		$strRequest.= "\r
  ";
  
  		$strRes = getHttpResponse($res, $strRequest);
  		fclose($res);
  
  		if (trim($strRes) == "SUCCESS")
  			$val = $ok = GM('YES');
  		else
  			$val = GM('NO');
  	} 
  	else
  		$val=GM('NO_CONNECT');
  	show($pr,$val,!$ok);
  	unlink($fn);
  }
  else
  	show($pr,$val,!$ok);
  
  // .htaccess
  debug(__LINE__);
  $ok = false;
  $host = $_SERVER['SERVER_NAME'] ? $_SERVER['SERVER_NAME'] : 'localhost';
  $port = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : 80;
  
  $pr=array(GM('HTACCESS'),GM('HTACCESS_D'),1);
  if ($bTest && $file && $dir && prepare_htaccess_test()) 
  {
  	if ($socket)
  		$res = fsockopen(($port == 443 ? 'ssl://' : '').$host, $port, $errno, $errstr, 3);
  	else
  		$res = false;
  
  	if($res) 
  	{
  		$strRequest = "GET ".dirname($_SERVER['PHP_SELF'])."/bitrix_htaccess_test/test_file.php HTTP/1.1\r
  ";
  		$strRequest.= "Host: ".$host."\r
  ";
  		$strRequest.= "\r
  ";
  
  		$strRes = getHttpResponse($res, $strRequest);
  		fclose($res);
  
  		if (false!==strpos($strRes,"SUCCESS"))
  			$val = $ok = GM('YES');
  		else
  			$val = GM('NO');
  	} 
  	else
  		$val=GM('NO_CONNECT');
  	show($pr,$val,!$ok);
  
  	clear_htaccess_test();
  } 
  else 
  	show($pr,GM('NOT_TESTED'),1);
  
  // Filesystem benchmark
  debug(__LINE__);
  $pr=array(GM('FS_TIME'),GM('FS_TIME_D'));
  if ($bTest && $file && $dir) 
  {
  	function xmktime()
  	{
  		list($usec, $sec) = explode(" ", microtime()); 
  		return ((float)$usec + (float)$sec); 
  	}
  
  	$t = xmktime();
  	$path = dirname(__FILE__).'/bx_fs_test'; 
  	mkdir($path);
  	$res = true;
  
  	for($i=0;$i<1000;$i++)
  	{
  		if (!(($f = fopen($path.'/bx_test_file_'.$i,'wb')) && fwrite($f, '<?php #Hello, world! ?>') && fclose($f)))
  		{
  			$res = false;
  			break;
  		}
  		include($path.'/bx_test_file_'.$i);
  	}
  
  	if ($res)
  		for($i=0;$i<1000;$i++)
  			if (!unlink($path.'/bx_test_file_'.$i))
  			{
  				$res = false;
  				break;
  			}
  	rmdir($path);
  	$time = round(xmktime()-$t,2);
  	show($pr,$res ? $time : GM('ERROR'),$time>5);
  }
  else
  	show($pr,GM('NOT_TESTED'),1);
  
  // File uploads
  debug(__LINE__);
  $val=intval(ini_get('file_uploads'));
  show(array(GM('FILE_UPL'),'',1),$val,!$val);
  
  
  $tmp_name=@$_FILES['test_file']['tmp_name'];
  $pr=array(GM('FILE_UPL_TEST'),GM('FILE_UPL_TEST_D'),1);
  
  if (is_uploaded_file($tmp_name)) {
  	$val=move_uploaded_file($tmp_name,$image_file);
  	show($pr,$val==false?GM('ERROR'):1,$val==false);
  	$pr=array(GM('IMG'),GM('IMG_D'));
  	show($pr,"<img src=\"?image=Y\">");
  } else {
  	echo "<form method=post enctype=\"multipart/form-data\">
  		<input type=hidden name=debug value='".($_REQUEST['debug']?'Y':'')."'>
  		<input type=hidden name=lang value='".$lang."'>
  		<input type=hidden name='test' value=\"".htmlspecialchars(@$_REQUEST['test'])."\">";
  	show($pr,"<input type=file name=test_file>");
  	echo"<div align=right><input type=submit value='".GM('SENDFILE')."'></div></form>";
  }
  
  ?>
  <div style="padding:5" align=center><font class=headbitrix><?php echo GM('CONF_EXT');?></font></div>
  <?php
  
  
  // Regex functions
  debug(__LINE__);
  $val=intval(function_exists("preg_match"));
  $pr=array(GM('EREGS'),'',1);
  show($pr,$val,!$val);
  
  // Perl regex functions
  debug(__LINE__);
  $val=intval(function_exists("preg_match"));
  $pr=array(GM('PREG'),'',1);
  show($pr,$val,!$val);
  
  // Zlib
  debug(__LINE__);
  $val=intval(extension_loaded('zlib') && function_exists("gzcompress"));
  $pr=array("Zlib extension",GM('ZLIB_D'),1);
  show($pr,$val,!$val);
  
  // GD lib
  debug(__LINE__);
  $val=intval(function_exists("imagecreate"));
  $pr=array("GD lib extension",GM('GDLIB'),1);
  show($pr,$val,!$val);
  
  // Free type
  debug(__LINE__);
  $val=intval(function_exists("imagettftext"));
  $pr=array("Free Type extension",GM('GDLIB_D'),1);
  show($pr,$val,!$val);
  
  // Mcrypt
  debug(__LINE__);
  $val = function_exists('mcrypt_encrypt') ? 'mcrypt' : (function_exists('openssl_encrypt') ? 'openssl' : '');
  $pr=array(GM('MCRYPT_TEST'),GM('MCRYPT_TEST_DESC'),1);
  show($pr,$val,!$val);
  
  // Hash
  debug(__LINE__);
  $val = function_exists('hash');
  $pr=array(GM('HASH_TEST'),GM('MCRYPT_TEST_DESC'),1);
  show($pr,$val,!$val);
  
  // XML
  debug(__LINE__);
  $val = function_exists('xml_parser_create');
  $pr=array('XML','',1);
  show($pr,$val,!$val);
  
  // JSON
  debug(__LINE__);
  $val = function_exists('json_encode');
  $pr=array('JSON','',1);
  show($pr,$val,!$val);
  
  // SSL
  debug(__LINE__);
  $pr=array(GM('SSL'),GM('SSL_D'),2);
  
  if ($bTest)
  {
  	$f=fsockopen("ssl://www.bitrixsoft.com",443, $errno, $errstr, 10); 
  	$val = $f ? 1 : 0;
  	show($pr,$val,!$val);
  	@fclose($f);
  }
  else
  	show($pr,'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  // mbstring
  debug(__LINE__);
  $val=intval(function_exists("mb_substr"));
  $pr=array(GM('MBSTR'),GM('MBSTR_D'),1);
  show($pr,$val,!$val);
  
  if ($val && $lang=='ru')
  {
  	$utf = false!==strpos(strtolower(ini_get('mbstring.internal_encoding')),'utf') && ini_get('mbstring.func_overload')==2;
  	show(array("Âêëþ÷åí ðåæèì UTF äëÿ mbstring"),$utf);
  
  	/*
  	$text0 = $utf ? "\xd0\xa2\xd0\xb5\xd0\xa1\xd1\x82" : '񌄘';
  	$text1 = $utf ? "\xd1\x82\xd0\xb5\xd1\x81\xd1\x82" : 'òåñò';
  
  	$res = strtolower($text0);
  	$val = $res==$text1 || $res==$text0;
  	show(array("Ðàáîòà ôóíêöèè strtolower",'Òåñòèðóåòñÿ ôóíêöèÿ strtolower äëÿ ðóññêèõ áóêâ. Âàæíî ÷òîáû íå áûëî îáðàòíîãî ïðåîáðàçîâàíèÿ: "ÒåÑò" -&gt; "ÒÅÑÒ" âìåñòî "òåñò"',1),$val,!$val);
  	
  
  	$l = strlen("\xd0\xa2");
  	$val = $utf && $l==1 || !$utf && $l==2;
  	show(array("Ðàáîòà ôóíêöèè strlen",'',1),$val,!$val);
  	*/
  }
  
  
  ?>
  <div style="padding:5" align=center><font class=headbitrix><?php echo GM('CONF_MYSQL');?></font></div>
  <?php
  
  // MySQL functions
  debug(__LINE__);
  $mysql = function_exists("mysql_connect") ? 'mysql' : (function_exists("mysqli_connect") ? 'mysqli' : 0);
  $pr=array(GM('MYSQL'),GM('MYSQL_D'),1);
  show($pr,$mysql,!$mysql);
  
  //////////////////////
  // MySQL benchmarking
  debug(__LINE__);
  
  if ($_GET['host'])
  {
  	$dbconn = false;
  	$DBHost = $_GET['host'];
  	$DBLogin = $_GET['user'];
  	$DBPassword = $_GET['pass'];
  	$DBName = $_GET['dbname'];
  }
  else
  {
  	$file = $_SERVER['DOCUMENT_ROOT'].'/bitrix/php_interface/dbconn.php';
  	if ($dbconn = file_exists($file))
  		@include($file);
  }
  
  $conn = false;
  if ($mysql && ($bTest || $_REQUEST['mysql_test']))
  {
  	if ($mysqli = function_exists('mysqli_connect'))
  		$conn = mysqli_connect($DBHost,$DBLogin,$DBPassword);
  	else
  		$conn = mysql_connect($DBHost,$DBLogin,$DBPassword);
  
  	if ($conn)
  	{
  		show(array(GM('MYSQL_CONNECT'),'',1),1,0);
  		$res=bx_mysql_query("SELECT version()");
  		$f=bx_mysql_fetch_row($res);
  		$pr=array(GM('MYSQL_VER'),GM('MYSQL_REQ'),1);
  		show($pr,$f[0]);
  		list($v1,$v2)=explode(".",$f[0]);
  
  		$res=bx_mysql_query("SHOW VARIABLES LIKE 'sql_mode'");
  		while($f=bx_mysql_fetch_row($res))
  			show(array($f[0],GM('SQL_MODE_DESC'),1),"&nbsp;".$f[1],@preg_match("#strict#i",$f[1]));
  
  		if ($v1 < 5)
  			$warn=GM('MYSQL_REQ_D');
  		else
  			$warn='';
  		$res=bx_mysql_query("SHOW VARIABLES LIKE 'character\_set\_%'");
  		while($f=bx_mysql_fetch_row($res))
  			show(array($f[0],$warn),$f[1]);
  
  		if ($mysqli ? mysqli_select_db($conn, $DBName) : mysql_select_db($DBName))
  		{
  			show(GM('MYSQL_SELECT_DB'),1,0);
  			
  			$name=create_tmp_table(true); // InnoDB
  			$res=bx_mysql_query("SHOW CREATE TABLE $name");
  			$f=bx_mysql_fetch_row($res);
  			$val=preg_match("#ENGINE=InnoDB#",$f[1]);
  			show(array(GM('INNODB'),'',2),$val,!$val);
  			if ($name)
  				bx_mysql_query("DROP TABLE ".$name);
  			
  // Temporary table
  debug(__LINE__);
  			$name=create_tmp_table();
  			if ($name)
  			{
  				show(array(GM('DB_TEST_TABLE'),'',1),1,0);
  
  				
  				$t1=microtime_float();
  				$good=true;
  // Insert 1000 rows
  debug(__LINE__);
  				for($i=0;$i<1000;$i++)
  				{
  					if (!bx_mysql_query("INSERT INTO ".$name." VALUES ('test1','test2','test3','test4')"))
  					{
  						$good=false;
  						break;
  					}
  				}
  				if ($good)
  				{
  					$t2=microtime_float();
  					$pr=array(GM('INSERT'),GM('INSERT_D'));
  					$tmp = round(1000/($t2-$t1));
  					show($pr,$tmp." q/".GM('SEC'),$tmp<2000);
  				}
  				else
  					show(GM("INSERT"),GM("ERROR"),1);
  				$pr = array(GM('DEL_TMP_TABLE'),'',1);
  				if (bx_mysql_query("DROP TABLE ".$name))
  					show($pr,1,0);
  				else
  					show($pr,0,1);
  			} else
  				show(GM('DB_TEST_TABLE'),GM('ERROR'),1);
  		} else
  			show(GM('DB_SELECT'),GM('ERROR'),1);
  	} else
  		show(GM('DB_CONNECT'),GM('ERROR'),1);
  }
  else
  	show(GM('MYSQL_TEST'),'<font color=gray>'.GM('NOT_TESTED').'</font>');
  
  echo "<form method=get>
  	<input type=hidden name=lang value='".$lang."'>
  	<input type=hidden name=debug value='".($_REQUEST['debug']?'Y':'')."'>
  	<input type=hidden name='test' value=\"".htmlspecialchars(@$_REQUEST['test'])."\">";
  @show(array(GM('DB_HOST'),$dbconn?GM('SECURE_DBCONN'):''),"<input name=host value=\"".($_GET['host']?htmlspecialchars(stripslashes($_GET['host'])):'localhost')."\">");
  @show(GM('DB_NAME'),"<input name=dbname value=\"".htmlspecialchars(stripslashes($_GET['dbname']))."\">");
  @show(GM('DB_USER'),"<input name=user value=\"".htmlspecialchars(stripslashes($_GET['user']))."\">");
  @show(GM('DB_PASS'),"<input name=pass type=password value=\"".htmlspecialchars(stripslashes($_GET['pass']))."\">");
  echo"<div align=right><input type=submit name=mysql_test value='".GM('TEST_MYSQL')."'></div></form>";
  
  
  
  
  ?>
  <div style="padding:5" align=center><font class=headbitrix><?php echo GM('CONF_ADD');?></font></div>
  <?php
  // debug
  $pr=array(GM('SHOW_ERR'),GM('SHOW_ERR_D'));
  show($pr,"<a href=?debug=Y&lang=".$lang.">".GM('OPEN')."</a>");
  
  // umask
  $pr=array("umask",'');
  show($pr,sprintf("%03o",umask()));
  
  //post_max_size
  $pr=array(GM('POST_MS'),'');
  $val=ini_get("post_max_size");
  show($pr,$val);
  
  // Display errors
  $val=intval(ini_get('display_errors'));
  if (version_compare(phpversion(), '5.4', '<'))
  	show("Display errors",$val);
  
  show("Server time",date("d.m.Y H:i"));
  show("phpinfo()","<a href=?phpinfo=Y target=_blank>".GM('OPEN')."</a>");
  
  show("Language","<a href='?lang=ru'>ru</a> / <a href='?lang=en'>en</a>");
  
  show("Delete bitrix_server_test.php file","<a href='javascript:if(confirm(\"Delete?\"))document.location=\"?killme=Y\"'>delete</a>");
  
  
  ##############################################
  function show($in_param,$value,$red='no') {
  	if (is_array($in_param)) {
  		$param=$in_param[0];
  		$help=$in_param[1];
  		$lvl=@$in_param[2];
  	} else {
  		$param=$in_param;
  	}
  	if ($red==1)
  		$color='red';
  	elseif (!$red)
  		$color='green';
  	else
  		$color='#000000';
  
  	if ($value=='1')
  		$value=GM('YES');
  	elseif ($value=='0')
  		$value=GM('NO');
  
  	if (@$lvl>0 && $lvl<=@$_REQUEST['test'])
  		$bold='style="font-weight:bold"';
  	else
  		$bold='';
  
  	@print("<table width=100% border=0 cellspacing=0 cellpadding=2>
  		<tr> 
  			<td nowrap align=right valign=top width=30% class=tablebody3>
  				<font class=tablefieldtext $bold>$param:</font>
  			</td>
  			<td width=20% class=tablebody3 valign=top>
  				<font class=tablebodytext style=\"color:$color\">
  				$value
  				</font>
  			</td>
  			<td class=tablebody3 valign=top><font class=smalltext>$help&nbsp;</font></td>
  		</tr>
  		</table>");
  		
  }
  
  function dirinfo($dir) {
  	if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
  		$perm=substr(sprintf('%o', @fileperms($dir)), -4);
  		$user=posix_getpwuid(fileowner($dir));
  		$group=posix_getgrgid(filegroup($dir));
  		return $perm." ".$user['name']." ".$group['name'];
  	} else {
  		return "N/A";
  	}
  }
  
  function microtime_float() {
     list($usec, $sec) = explode(" ", microtime());
     return ((float)$usec + (float)$sec);
  }
  
  function create_tmp_folder()
  {
  	$name=check_file_name(dirname(__FILE__).'/'.'bx_folder_test');
  	mkdir($name);
  	if (file_exists($name))
  		return $name;
  	else
  		return false;
  }
  
  function create_tmp_file()
  {
  	$name=check_file_name(dirname(__FILE__).'/'.'bx_file_test');
  	$f=fopen($name,'wb');
  	if ($f)	fclose($f);
  	if (file_exists($name))
  		return $name;
  	else
  		return false;
  }
  
  function check_file_name($name) 
  {
  	if (file_exists($name))
  		return check_file_name($name."_tmp");
  	else
  		return $name;
  }
  
  function create_tmp_table($innodb=false)
  {
  	$name='bx_test';
  	while (true)
  	{
  		$name.='_tmp';
  		$res=bx_mysql_query("SHOW TABLES LIKE '".$name."'");
  
  		if ($res)
  		{
  			if (!bx_mysql_fetch_row($res))
  			{
  				if ($innodb && bx_mysql_query("CREATE TABLE ".$name." (tst varchar(100), tst2 varchar(50), tst3 varchar(30), tst4 text) ENGINE=INNODB"))
  					return $name;
  				elseif (!$innodb && bx_mysql_query("CREATE TABLE ".$name." (tst varchar(100), tst2 varchar(50), tst3 varchar(30), tst4 text) ENGINE=MYISAM"))
  					return $name;
  				else
  					return false;
  			}
  		} else
  			return false;
  	}
  }
  
  function prepare_htaccess_test()
  {
  	$self = str_replace("\\","/",$_SERVER['PHP_SELF']);
  	$path = dirname($self)."/bitrix_htaccess_test";
  	$dir = $_SERVER['DOCUMENT_ROOT'].$path;
  	clear_htaccess_test();
  
  	if (!mkdir($dir)) return;
  	$f=fopen($dir."/.htaccess","wb");
  	$str = "ErrorDocument 404 ".$path."/404.php
  ".
  	"<IfModule mod_rewrite.c>
  ".
  	"	RewriteEngine Off
  ".
  	"</IfModule>";
  	fputs($f, $str);
  	fclose($f);
  	if (!file_exists($dir."/.htaccess")) return;
  
  	$f=fopen($dir."/404.php","wb");
  	$str = "<?php
  ".
  	"header(\"HTTP/1.1 200 OK\");
  ".
  	"echo 'SUCCESS'; ?".">";
  	fputs($f, $str);
  	fclose($f);
  	if (!file_exists($dir."/404.php")) return;
  
  	return true;
  }
  
  function clear_htaccess_test()
  {
  	$self = str_replace("\\","/",$_SERVER['PHP_SELF']);
  	$dir = $_SERVER['DOCUMENT_ROOT'].dirname($self)."/bitrix_htaccess_test";
  	if (file_exists($dir)) 
  	{
  		unlink($dir."/.htaccess");
  		unlink($dir."/404.php");
  		rmdir($dir);
  	}
  }
  
  function getHttpResponse($res, $strRequest)
  {
  	fputs($res, $strRequest);
  
  	$bChunked = False;
  	while (($line = fgets($res, 4096)) && $line != "\r
  ")
  	{
  		if (@preg_match("/Transfer-Encoding: +chunked/i", $line))
  			$bChunked = True;
  		elseif (@preg_match("/Content-Length: +([0-9]+)/i", $line, $regs))
  			$length = $regs[1];
  	}
  
  	$strRes = "";
  	if ($bChunked)
  	{
  		$maxReadSize = 4096;
  
  		$length = 0;
  		$line = FGets($res, $maxReadSize);
  		$line = StrToLower($line);
  
  		$strChunkSize = "";
  		$i = 0;
  		while ($i < StrLen($line) && in_array($line[$i], array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f")))
  		{
  			$strChunkSize .= $line[$i];
  			$i++;
  		}
  
  		$chunkSize = hexdec($strChunkSize);
  
  		while ($chunkSize > 0)
  		{
  			$processedSize = 0;
  			$readSize = (($chunkSize > $maxReadSize) ? $maxReadSize : $chunkSize);
  
  			while ($readSize > 0 && $line = fread($res, $readSize))
  			{
  				$strRes .= $line;
  				$processedSize += StrLen($line);
  				$newSize = $chunkSize - $processedSize;
  				$readSize = (($newSize > $maxReadSize) ? $maxReadSize : $newSize);
  			}
  			$length += $chunkSize;
  
  			$line = FGets($res, $maxReadSize);
  
  			$line = FGets($res, $maxReadSize);
  			$line = StrToLower($line);
  
  			$strChunkSize = "";
  			$i = 0;
  			while ($i < StrLen($line) && in_array($line[$i], array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f")))
  			{
  				$strChunkSize .= $line[$i];
  				$i++;
  			}
  			$chunkSize = hexdec($strChunkSize);
  		}
  	}
  	elseif ($length)
  		$strRes = fread($res, $length);
  	else
  		while ($line = fread($res, 4096))
  			$strRes .= $line;
  
  	return $strRes;
  }
  
  function GM($code)
  {
  	global $M;
  	return $M[$code];
  }
  
  function debug($line)
  {
  	static $f, $fail, $file;
  	if (!$_REQUEST['debug'] || $fail)
  		return;
  	if (!$f)
  	{
  		if ($f = fopen(dirname(__FILE__).'/bitrix_server_test.log','wb'))
  			$file = @file(__FILE__);
  		else
  			$fail = 1;
  	}
  	fwrite($f,date('H:i:s')."\t".$line."\t".trim($file[$line-2])."
  ");
  }
  ######################################################################?>
  						</div>
  					</td>
  				</tr>
  		<tr>
  			<td align=left nowrap class=smalltext><?php echo GM('COPY');?><?php echo date("Y")?></td>
  			<td align=right nowrap class=smalltext><?php echo GM('SUPPORT_LINK');?>&nbsp;
  		</tr>
  				</table>
  		</table></td>
  </tr>
  </table>
  </body>
  <?php 
  if ($bTest) 
  { 
  ?>
  	<script language=JavaScript>
  		var last_mem = 8;
  		var max_success = 0;
  		var memory_errors = 5;
  		var absolute_max = 999;
  
  		var tmr = 70;
  		var tmr1 = 0;
  		var time_test = document.getElementById('time_test');
  		var time_test_cpu = document.getElementById('time_test_cpu');
  
  		function NewXML()
  		{
  			if(window.XMLHttpRequest) {
  				try {
  					xml = new XMLHttpRequest();
  				} catch(e) {
  				}
  			} else if(window.ActiveXObject) {
  				try {
  					xml = new ActiveXObject("Msxml2.XMLHTTP");
  				} catch(e) {
  					try {
  						xml = new ActiveXObject("Microsoft.XMLHTTP");
  					} catch(e) {
  					}
  				}
  			}
  			return xml;
  		}
  
  		function AjaxSend(xml, url, callback)
  		{
  			if (null!=callback)
  				xml.onreadystatechange = function () 
  				{ 
  					if (xml.readyState == 4 || xml.readyState=="complete")
  						callback(xml.responseText);
  				}
  
  			xml.open("GET", url, true);
  			xml.send("");
  		}
  
  		function memory_test(max_mem)
  		{
  			xml = NewXML();
  			callback = function(a)
  			{
  				if (a == 'SUCCESS')
  				{
  					max_success = last_mem;
  					last_mem *= 2;
  					if (last_mem > absolute_max)
  						last_mem = parseInt((max_success + absolute_max)/2);
  
  					if (max_success == last_mem)
  					{
  						memory_errors = 0;
  						last_mem += 1;
  					}
  
  					if (max_success < 256)
  					{
  						document.getElementById('memory_limit').innerHTML = max_success + '...';
  						memory_test(last_mem - 1);
  					}
  					else
  						document.getElementById('memory_limit').innerHTML = '&gt;256';
  				}
  				else if (memory_errors > 0)
  				{
  					absolute_max = last_mem;
  					last_mem = parseInt((max_success + last_mem)/2);
  					memory_test(last_mem - 1);
  					memory_errors--;
  				}
  				else
  				{
  					link = " <a href='?memory_test=Y&debug=Y&max=" + last_mem + "' target=_blank title='<?php echo GM('OPEN_RESULT')?>'>&gt;&gt;</a>";
  					if (max_success== 0)
  						res = '<font color=red>N/A</font>' + link;
  					else
  						res = max_success + link;
  
  					document.getElementById('memory_limit').innerHTML = res;
  				}
  			}
  			AjaxSend(xml, '?memory_test=Y&debug=Y&max=' + max_mem, callback);
  		}
  
  		function my_timer() 
  		{
  			tmr--;
  			tmr1++;
  			if (tmr < 1)
  			{
  				res = '<font color=red><?php echo GM('NO');?></font>';
  				clearInterval(my_interval);
  			}
  			else 
  				res = '<font color=gray><?php echo GM('TESTING');?> (' + tmr + ')</font>';
  			time_test.innerHTML = res;
  		}
  
  		function start_test()
  		{
  			// time test
  			xml = NewXML();
  			callback = function(a) 
  			{
  				if (a == 'SUCCESS')
  					res = '<font color=green><?php echo GM('YES');?></font>';
  				else
  					res = '<font color=red><?php echo GM('NO');?></font> (<?php echo GM('LIMIT');?> ' + tmr1 + ")  <a href='javascript:alert(\"" + escape(xml.responseText.substr(0,100)) + "\")' title='<?php echo GM('SERVER_ANS');?>'>&gt;&gt;</a>";
  				time_test.innerHTML = res;
  				clearInterval(my_interval);
  			}
  			AjaxSend(xml, "?time_test=Y", callback);
  			
  			// time test with max cpu
  			xml = NewXML();
  			callback = function(a) 
  			{
  				if (a == 'SUCCESS')
  					res = '<font color=green><?php echo GM('YES');?></font>';
  				else
  					res = '<font color=red><?php echo GM('NO');?></font> ' + "<a href='javascript:alert(\"" + escape(a.substr(0,100))  + "\")' title='<?php echo GM('SERVER_ANS');?>'>&gt;&gt;</a>";
  				time_test_cpu.innerHTML = res;
  			}
  			AjaxSend(xml, "?time_test=Y&max_cpu=Y",callback);
  
  			my_interval = setInterval(my_timer, 1000);
  
  			// session test
  			xml = NewXML();
  			callback = function(a)
  			{
  				if (a == 'SUCCESS')
  					res = '<font color=green><?php echo GM('YES');?></font>';
  				else
  					res = '<font color=red><?php echo GM('NO');?></font>';
  
  				document.getElementById('session').innerHTML = res;
  			}
  			AjaxSend(xml, '?session_test=Y',callback);
  			
  			// memory test
  			memory_test(last_mem);
  		}
  	</script>
  <?php 
  }
  
  // Finish
  debug(__LINE__);
  
  function bx_accelerator_reset()
  {
          if(function_exists("accelerator_reset"))
                  accelerator_reset();
          elseif(function_exists("wincache_refresh_if_changed"))
                  wincache_refresh_if_changed();
  }
  
  function bx_mysql_query($query)
  {
  	global $conn;
  	if (function_exists('mysqli_query'))
  		return mysqli_query($conn, $query);
  	else
  		return mysql_query($query);
  }
  
  function bx_mysql_fetch_row($res)
  {
  	global $conn;
  	if (function_exists('mysqli_fetch_row'))
  		return mysqli_fetch_row($res);
  	else
  		return mysql_fetch_row($res);
  
  }
  ?>