-
Notifications
You must be signed in to change notification settings - Fork 3
/
mainfile.php
2696 lines (2130 loc) · 82.9 KB
/
mainfile.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
/************************************************************************/
/* PHP-NUKE: Advanced Content Management System */
/* ============================================ */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
/* Applied rules:
* AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
* EregToPregMatchRector (http://php.net/reference.pcre.pattern.posix https://stackoverflow.com/a/17033826/1348344 https://docstore.mik.ua/orelly/webprog/pcook/ch13_02.htm)
* RandomFunctionRector
* SetCookieRector (https://www.php.net/setcookie https://wiki.php.net/rfc/same-site-cookie)
* StringifyStrNeedlesRector (https://wiki.php.net/rfc/deprecations_php_7_3#string_search_functions_with_integer_needle)
* StrStartsWithRector (https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions)
*/
/*****[CHANGES]**********************************************************
-=[Base]=-
NukeSentinel v2.6.16 07/11/2021
PHP Patched v8.2.4 04/11/2023
Language Selector v3.0.0 12/11/2005
Admin File Check v3.0.0 11/19/2005
PHP Input Filter v1.2.2 10/14/2005
HTML Parser v1.2.0 10/27/2005
Caching System v1.0.0 10/29/2005
Debugger v1.0.0 11/14/2005
Module Simplifications v1.0.0 11/17/2005
Evolution Functions v1.5.0 11/24/2005
Theme Management v1.0.2 12/14/2005
-=[Mod]=-
Admin Icon/Link Pos v1.0.0 06/02/2005
Advanced Username Color v1.0.5 06/11/2005
Evolution Version Checker v1.0.0 06/16/2005
Lock Modules v1.0.0 08/04/2005
Group Colors v1.0.0 10/20/2005
Censor v1.0.0 10/20/2005
NBBCode v9.26.0 11/23/2005
Color Toggle v1.0.0 11/25/2005
Lazy Google Tap v1.0.0 01/27/2005
Switch Content Script v2.0.0 03/30/2006
-=[Module]=-
CNB Your Account v4.4.2 06/15/2005
Network Projects v11.11.11 02/12/2017
-=[Other]=-
SSL Administration v1.0.0 08/29/2005
Validation v1.1.0 10/17/2005
Extra Functions v1.0.0 12/22/2005
Titanium Functions v1.1.1 01/01/2010
NSN Center Blocks v2.2.1 05/26/2009
Theme Fly Kit v1.0.0 09/02/2019
Network Advertising v7.8.3.1 06/05/2019
Blog Signature v1.0.0 04/24/2021
SiteMap Mod v1.0.0 04/26/2021
Dynamic CSS, JS and PHPCSS v1.0.0 04/29/2021
************************************************************************/
define('NUKE_FILE', true);
/* Adopted from PHP-Nuke Titanium
* Version Settings for phpBB Titanium
* @date 04/10/2023 9:47 PM Ernest Allen Buffington
*/
define('PHPBB_TITANIUM', '2.0.25');
define('PHPBB_TITANIUM_LAST_UPDATE', 'Tuesday Jan 28th, 2023');
/* Adopted from Nuke Evo
* Version Settings for Nuke Evolution Xtreme
* @date 04/10/2023 9:47 PM Ernest Allen Buffington
*/
define('NUKE_EVO', '2.0.9e');
define('EVO_EDITION', 'Xtreme');
define('EVO_VERSION', NUKE_EVO . ' ' . EVO_EDITION);
define('CUR_EVO', 'NUKE_EVO');
/* Adopted from PHP-Nuke Titanium
* Version Settings for PHP-Nuke Titanium
* @date 04/10/2023 9:47 PM Ernest Allen Buffington
*/
define('NUKE_TITANIUM', '4.0.4');
define('TITANIUM_EDITION', 'AN602');
define('TITANIUM_VERSION', NUKE_TITANIUM . ' ' . TITANIUM_EDITION);
define('CUR_TITANIUM', 'NUKE_TITANIUM');
/* Adopted from PHP-Nuke Platinum
* Version Settings for PHP-Nuke Platinum
* @date 04/10/2023 9:47 PM Ernest Allen Buffington
*/
define('NUKE_PLATINUM', '3.0.0');
define('PLATINUM_EDITION', 'AN602');
define('PLATINUM_VERSION', NUKE_PLATINUM . ' ' . PLATINUM_EDITION);
define('CUR_PLATINUM', 'NUKE_PLATINUM');
/* Adopted from PHP-Nuke Raven
* Version Settings for PHP-Nuke Raven
* @date 04/10/2023 9:47 PM Ernest Allen Buffington
*/
define('NUKE_RAVEN', 'x.x.x');
define('RAVEN_EDITION', 'xxxxxxx');
define('RAVEN_VERSION', NUKE_RAVEN . ' ' . RAVEN_EDITION);
define('CUR_RAVEN', 'NUKE_RAVEN');
define('NUKE_VERSION', '8.3.3');
define('NUKE_MOD', 'PHP-Nuke');
define('NUKE_VERSION_CHECKING', 'https://phpnuke.coders.exchange/versions/nuke-version.json');
define('NUKE_LIVE_FEED', 'https://phpnuke.coders.exchange/versions/nuke-live-feed.json');
define('NUKE_DEVELOPER_FEED', 'https://phpnuke.coders.exchange/versions/feed.php');
// Get php file extension
$phpEx = "php";
// Get php version
$phpver = phpversion();
define('PHPVERS', $phpver);
define('PHP_7', version_compare($phpver, '7.0.0', '>='));
# idea based on Nuke Evolution
# override old superglobals
if(!ini_get('register_globals')){
$import = true;
# Need register_globals so try the built in import function
if (function_exists('import_request_variables')){
import_request_variables('GPC');
} else {
function php_nuke_import_globals($array)
{
foreach ($array as $k => $v):
global ${$k};
${$k} = $v;
endforeach;
}
if(!empty($_GET)){
php_nuke_import_globals($_GET);
}
if(!empty($_POST)){
php_nuke_import_globals($_POST);
}
if(!empty($_COOKIE)){
php_nuke_import_globals($_COOKIE);
}
}
}
// After doing those superglobals we can now use one
// and check if this file isn't being accessed directly
if (stristr(htmlentities($_SERVER['PHP_SELF']), "mainfile.php")) {
header("Location: index.php");
exit();
}
if (!function_exists("floatval")) {
function floatval($inputval) {
return (float)$inputval;
}
}
function include_secure($file_name)
{
$file_name = preg_replace("/\.[\.\/]*\//", "", $file_name);
include_once($file_name);
}
# define anything only once
function define_once($constant, $value)
{
if(!defined($constant)):
define($constant, $value);
endif;
}
# add 3rd party microtime
function get_microtime()
{
[$usec, $sec] = explode(' ', microtime());
return ($usec + $sec);
}
$sanitize_rules = array("newlang"=>"/[a-z][a-z]/i","redirect"=>"/[a-z0-9]*/i");
foreach($_REQUEST as $key=>$value)
{
if (!isset($values))
$values = '';
if(!isset($sanitize_rules[$key]) || preg_match($sanitize_rules[$key], $values))
{
$GLOBALS[$key] = $value;
}
}
if(!function_exists('stripos')) {
function stripos_clone($haystack, $needle, $offset=0) {
$return = strpos(strtoupper($haystack), strtoupper($needle), $offset);
if ($return === false) {
return false;
} else {
return true;
}
}
} else {
// But when this is PHP5, we use the original function
function stripos_clone($haystack, $needle, $offset=0) {
$return = stripos($haystack, (string) $needle, $offset=0);
if ($return === false) {
return false;
} else {
return true;
}
}
}
// Die message for not allowed HTML tags
$htmltags = "<div align=\"center\"><img src=\"images/logo.gif\"><br><br><b>";
$htmltags .= "The html tags you attempted to use is forbidden!</b><br><br>";
$htmltags .= "[ <a href=\"javascript:history.go(-1)\"><b>Go Back</b></a> ]</div>";
// samesite cookie array
$arr_cookie_options = array (
'expires' => time() + 60*60*24*30,
'path' => '/',
'domain' => ''.$_SERVER['HTTP_HOST'].'', // get the server host automaticly
'secure' => true, // or false
'httponly' => true, // or false
'samesite' => 'None' // None || Lax || Strict
);
$admin = (isset($_COOKIE['admin'])) ? $_COOKIE['admin'] : false;
$user = (isset($_COOKIE['user'])) ? $_COOKIE['user'] : false;
if((isset($_POST['name']) && !empty($_POST['name'])) && (isset($_GET['name']) && !empty($_GET['name']))):
$name = (isset($_GET['name']) && !stristr($_GET['name'],'..') && !stristr($_GET['name'],'://')) ? addslashes(trim($_GET['name'])) : false;
else:
$name = (isset($_REQUEST['name']) && !stristr($_REQUEST['name'],'..') && !stristr($_REQUEST['name'],'://')) ? addslashes(trim($_REQUEST['name'])) : false;
endif;
$start_mem = function_exists('memory_get_usage') ? memory_get_usage() : 0;
$start_time = get_microtime();
# Stupid handle to create REQUEST_URI for IIS 5 servers
if(preg_match('/IIS/', $_SERVER['SERVER_SOFTWARE']) && isset($_SERVER['SCRIPT_NAME'])):
$requesturi = $_SERVER['SCRIPT_NAME'];
if (isset($_SERVER['QUERY_STRING'])):
$requesturi .= '?'.$_SERVER['QUERY_STRING'];
endif;
$_SERVER['REQUEST_URI'] = $requesturi;
endif;
# PHP5 with register_long_arrays off?
if(PHP_7):
$HTTP_POST_VARS =& $_POST;
$HTTP_GET_VARS =& $_GET;
$HTTP_SERVER_VARS =& $_SERVER;
$HTTP_COOKIE_VARS =& $_COOKIE;
$HTTP_ENV_VARS =& $_ENV;
$HTTP_POST_FILES =& $_FILES;
if(isset($_SESSION)):
$HTTP_SESSION_VARS =& $_SESSION;
endif;
endif;
if(isset($_COOKIE['DONATION'])):
setcookie('DONATION', null, time()-3600);
$type = preg_match('/IIS|Microsoft|WebSTAR|Xitami/', $_SERVER['SERVER_SOFTWARE']) ? 'Refresh: 0; URL=' : 'Location: ';
$url = str_replace('&', "&", $url);
header($type . 'modules.php?name=Donations&op=thankyou');
endif;
# Absolute Path Mod - 01/01/2012 by Ernest Allen Buffington START
$rel_path=[];
$rel_path['file'] = str_replace('\\', "/", realpath(__DIR__));
$server_ary = pathinfo(realpath(basename((string) $_SERVER['PHP_SELF'])));
$rel_path['server'] = str_replace('\\', "/", $server_ary['dirname']);
$rel_path['uri'] = realpath(basename(substr((string) $_SERVER['REQUEST_URI'], 0, strpos((string) $_SERVER['REQUEST_URI'], '?'))));
$script_abs_path = pathinfo(realpath($_SERVER['SCRIPT_FILENAME']));
$rel_path['script'] = str_replace('\\', "/",$script_abs_path['dirname']);
if(($rel_path['file'] === $rel_path['script']) && (strlen((string) $_SERVER['DOCUMENT_ROOT']) < strlen($script_abs_path['dirname']))):
$href_path = '/'.str_replace($_SERVER['DOCUMENT_ROOT'], '', $rel_path['script']);
if (substr($href_path, 0, 2) == '//'):
$href_path = substr($href_path, 1);
endif;
elseif(strlen($rel_path['file']) == (strlen((string) $_SERVER['DOCUMENT_ROOT']) - 1)):
$href_path = '';
elseif(strlen($rel_path['script']) > strlen((string) $_SERVER['DOCUMENT_ROOT']) && (strlen((string) $_SERVER['DOCUMENT_ROOT']) > strlen($rel_path['file']))):
$href_path = '';
elseif(strlen($rel_path['file']) > strlen((string) $_SERVER['DOCUMENT_ROOT'])):
$href_path = '/'.str_replace($_SERVER['DOCUMENT_ROOT'], '', $rel_path['file']);
if(substr($href_path, 0, 2) == '//'):
$href_path = substr($href_path, 1);
endif;
else:
$href_path = 'https://'.$_SERVER['SERVER_NAME'];
$href_path_http = 'http://'.$_SERVER['SERVER_NAME'];
endif;
unset ($rel_path);
unset ($server_ary);
unset ($script_abs_path);
# BASE Directory
define('TITANIUM_BASE_DIR', __DIR__ . '/');
# HTTP & HTTPS
define('HTTPS', $href_path . '/');
define('HTTP', $href_path_http . '/');
# Modules Directory
define('MODULES', TITANIUM_BASE_DIR . 'modules/');
# ADMIN Directory
define('TITANIUM_ADMIN_DIR', TITANIUM_BASE_DIR . 'admin/');
define('TITANIUM_ADMIN_MODULE_DIR', TITANIUM_ADMIN_DIR . 'modules/');
# INCLUDES Directories
define('TITANIUM_INCLUDE_DIR', TITANIUM_BASE_DIR . 'includes/');
define('TITANIUM_INCLUDE_HREF_DIR', $href_path . '/includes/');
# CSS Directory
define('TITANIUM_CSS_DIR', TITANIUM_INCLUDE_DIR . 'css/');
# CERT Directory
define('TITANIUM_CERT_DIR', TITANIUM_INCLUDE_DIR . 'certs'); // pem directory
# GLOBAL CSS DIR
define('TITANIUM_CSS_HREF_DIR', $href_path . '/includes/css/');
# lytebox
define('TITANIUM_LYTEBOX_HREF_DIR', $href_path . '/includes/lytebox/');
# lightbox
define('TITANIUM_LIGHTBOX_HREF_DIR', $href_path . '/includes/lightbox/');
# cache
define('TITANIUM_CACHE_DIR', TITANIUM_INCLUDE_DIR . 'cache/');
# classes
define('TITANIUM_CLASSES_DIR', TITANIUM_INCLUDE_DIR . 'classes/');
# DB Directory
define('TITANIUM_DB_DIR', TITANIUM_INCLUDE_DIR . 'db/');
# MODULES Directory
define('TITANIUM_HREF_MODULES_DIR', $href_path . '/modules/');
define('TITANIUM_MODULES_DIR', TITANIUM_BASE_DIR . 'modules/');
define('TITANIUM_MODULES_IMAGE_DIR', $href_path . '/modules/');
# BLOCKS Directory
define('TITANIUM_BLOCKS_DIR', TITANIUM_BASE_DIR . 'blocks/');
# IMAGES Directory
define('TITANIUM_IMAGES_DIR', TITANIUM_BASE_DIR . '/images/');
define('TITANIUM_IMAGES_BASE_DIR', $href_path . '/images/');
# LANGUAGE Directory
define('TITANIUM_LANGUAGE_DIR', TITANIUM_BASE_DIR . 'language/');
define('TITANIUM_LANGUAGE_CUSTOM_DIR', TITANIUM_LANGUAGE_DIR . 'custom/');
# STYLE Directory
define('TITANIUM_THEMES_DIR', TITANIUM_BASE_DIR . 'themes/');
define('TITANIUM_THEMES_IMAGE_DIR', $href_path . '/themes/');
define('TITANIUM_THEMES_MAIN_DIR', $href_path . '/themes/');
# FORUMS Directory
define('TITANIUM_FORUMS_DIR', TITANIUM_MODULES_DIR . 'Forums/');
define('TITANIUM_FORUMS_ADMIN_DIR', TITANIUM_FORUMS_DIR . 'admin/');
define('TITANIUM_FORUMS_ADMIN_HREF_DIR', $href_path . '/modules/Forums/admin/');
# OTHER Directories
define('TITANIUM_RSS_DIR', TITANIUM_INCLUDE_DIR . 'rss/');
define('TITANIUM_STATS_DIR', TITANIUM_THEMES_DIR);
# Absolute Path Mod - 01/01/2012 by Ernest Allen Buffington END
# Inspired by phoenix-cms at website-portals.net
# Absolute Nuke directory
define('NUKE_BASE_DIR', __DIR__ . '/');
# Absolute Nuke directory + includes
define('NUKE_VENDOR_DIR', NUKE_BASE_DIR . 'includes/vendor/');
define('NUKE_ZEND_DIR', NUKE_BASE_DIR . 'includes/Zend/');
define('NUKE_BLOCKS_DIR', NUKE_BASE_DIR . 'blocks/');
define('NUKE_CSS_DIR', 'includes/css/');
define('NUKE_IMAGES_DIR', NUKE_BASE_DIR . 'images/');
define('NUKE_INCLUDE_DIR', NUKE_BASE_DIR . 'includes/');
define('PHPBB3_ROOT_DIR', NUKE_BASE_DIR . 'modules/phpBB3/');
define('PHPBB3_INCLUDE_DIR', NUKE_BASE_DIR . 'includes/mods/phpbb3/');
define('PHPBB3_ADMIN_DIR', NUKE_BASE_DIR . 'modules/phpBB3/adm/');
define('PHPBB2_INCLUDE_DIR', NUKE_BASE_DIR . 'includes/mods/phpbb2/');
define('EVO_INCLUDE_DIR', NUKE_BASE_DIR . 'includes/mods/Evo/');
define('RAVEN_INCLUDE_DIR', NUKE_BASE_DIR . 'includes/mods/Raven/');
define('NUKE_JQUERY_INCLUDE_DIR', 'includes/js/');
define('NUKE_JQUERY_SCRIPTS_DIR', 'includes/js/scripts/');
define('NUKE_LANGUAGE_DIR', NUKE_BASE_DIR . 'language/');
define('NUKE_MODULES_DIR', NUKE_BASE_DIR . 'modules/');
define('NUKE_THEMES_DIR', NUKE_BASE_DIR . 'themes/');
define('NUKE_THEMES_SAVE_DIR', NUKE_INCLUDE_DIR . 'saved_themes/');
define('NUKE_ADMIN_DIR', NUKE_BASE_DIR . 'admin/');
define('NUKE_RSS_DIR', NUKE_INCLUDE_DIR . 'rss/');
define('NUKE_DB_DIR', NUKE_INCLUDE_DIR . 'db/');
define('NUKE_ADMIN_MODULE_DIR', NUKE_ADMIN_DIR . 'modules/');
define('NUKE_FORUMS_DIR', (defined("IN_ADMIN") ? './../' : 'modules/Forums/'));
define('NUKE_CACHE_DIR', NUKE_INCLUDE_DIR . 'cache/');
define('NUKE_CACHE_DELETE_DIR', NUKE_INCLUDE_DIR . 'cache');
define('NUKE_CLASSES_DIR', NUKE_INCLUDE_DIR . 'classes/');
define('NUKE_CLASS_EXCEPTION_DIR', NUKE_CLASSES_DIR . 'exceptions/');
# define the INCLUDE PATH
define('INCLUDE_PATH', NUKE_BASE_DIR);
define('GZIPSUPPORT', extension_loaded('zlib'));
define('GDSUPPORT', extension_loaded('gd'));
define('CAN_MOD_INI', !stristr(ini_get('disable_functions'), 'ini_set'));
# If a class hasn't been loaded yet find the required file on the server and load
# it in using the special autoloader detection built into PHP5+
if(!function_exists('classAutoloader')):
function classAutoloader($class)
{
# Set the class file path
if(preg_match('/Exception/', (string) $class)):
$file = NUKE_CLASS_EXCEPTION_DIR . strtolower((string) $class) . '.php';
else:
$file = NUKE_CLASSES_DIR . 'class.' . strtolower((string) $class) . '.php';
endif;
if(!class_exists($class, false) && file_exists($file)):
require_once($file);
endif;
}
spl_autoload_register('classAutoloader');
endif;
if(CAN_MOD_INI):
ini_set('zlib.output_compression', 0);
endif;
# Vendor Autoload - only if vendor directory exists with an autoload file! START
if(file_exists(NUKE_VENDOR_DIR.'autoload.php')):
require_once(NUKE_VENDOR_DIR.'autoload.php');
endif;
# Vendor Autoload - only if vendor directory exists with an autoload file! END
use function PHP81_BC\strftime;
# Enable 86it Network Support START
if (file_exists(NUKE_BASE_DIR.'nconfig.php')):
global $dbpass2, $dbhost2, $dbname2, $dbuname2, $db2, $network_prefix;
require_once(NUKE_BASE_DIR.'nconfig.php');
if(defined('network')):
if(!isset($dbname2) || empty($dbname2)):
die('$dbname2 <- your network database name is not configured in your ROOT nbconfig.php file!');
endif;
if(!isset($dbuname2) || empty($dbuname2)):
die('$dbuname2 <- your network database user name is not configured in your ROOT nbconfig.php file!');
endif;
if(!isset($dbpass2) || empty($dbpass2)):
die('$dbpass2 <- your network database password is not configured in your ROOT nbconfig.php file!');
endif;
if(!isset($network_prefix) || empty($network_prefix)):
die('$network_prefix <- your network prefix is not configured in your ROOT nbconfig.php file!');
endif;
endif;
endif;
# Enable 86it Network Support END
# Include config file
require_once(NUKE_BASE_DIR.'config.php');
if(!$directory_mode):
$directory_mode = 0777;
else:
$directory_mode = 0755;
endif;
if(!$file_mode):
$file_mode = 0666;
else:
$file_mode = 0644;
endif;
# Core exceptions handler
include_once(NUKE_INCLUDE_DIR . 'exception.php');
include_once(NUKE_INCLUDE_DIR . 'abstract/abstract.exception.php');
if(!$dbname) {
die("<br><br><div align=\"center\"><img src=images/logo.gif><br><br><b>It seems that PHP-Nuke isn't installed yet.<br>(The values in the config.php file are the default ones)<br><br>You can proceed with the <a href='./install/index.php'>web installation</a> now.</div></b>");
}
# Include the required files
require_once(NUKE_DB_DIR.'db.php');
# $db->debug = true;
/*
* functions added to support dynamic and ordered loading of CSS, PHPCSS, and JS in <head> and before </body>
* Code origin Raven Nuke CMS (http://www.ravenphpscripts.com)
* loader addons by Ernest Buffington aka TheGhost https://theghost.86it.us
*/
if (file_exists(RAVEN_INCLUDE_DIR."dynamic_loader_functions.php")) {
require_once(RAVEN_INCLUDE_DIR."dynamic_loader_functions.php");
}
/*
* Get user ip and try to detect bots
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_CLASSES_DIR.'class.identify.php');
global $agent;
$identify = new identify();
$agent = $identify->identify_agent();
/*
* Error Logging
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_INCLUDE_DIR.'log.php');
if(ini_get('output_buffering') && !isset($agent['bot'])):
ob_end_clean();
header('Content-Encoding: none');
endif;
$do_gzip_compress = false;
if (GZIPSUPPORT && !ini_get('zlib.output_compression')
&& isset($_SERVER['HTTP_ACCEPT_ENCODING'])
&& preg_match('/gzip/i', $_SERVER['HTTP_ACCEPT_ENCODING'])):
if (PHP_7):
ob_end_clean();
ob_start('ob_gzhandler');
else:
$do_gzip_compress = true;
ob_start();
ob_implicit_flush(0);
header('Content-Encoding: gzip');
endif;
else:
ob_start();
ob_implicit_flush(0);
endif;
/*
* Code origin phpBB2
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
include_once(NUKE_INCLUDE_DIR.'constants.php');
/*
* Added for Zend Zf1 future
* Code origin Nuke Titanium v4.0.4
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_CLASSES_DIR.'class.cache.php');
/*
* Added for Evo debugger support
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_CLASSES_DIR.'class.debugger.php');
/*
* Adopted Nuke Evo database functions
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_INCLUDE_DIR.'functions_database.php');
/*
* Adopted Nuke Titanium functions
* Code origin PHP-Nuke Titanium v4.0.4
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_INCLUDE_DIR.'function_img.php');
require_once(NUKE_INCLUDE_DIR.'functions_titanium.php');
require_once(NUKE_INCLUDE_DIR.'functions_titanium_custom.php');
/*
* Adopted Nuke Evo functions
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_INCLUDE_DIR.'functions_evo.php');
require_once(NUKE_INCLUDE_DIR.'functions_evo_custom.php');
require_once(NUKE_INCLUDE_DIR.'functions_cache.php');
include_once(NUKE_INCLUDE_DIR.'validation.php');
/*
* We globalize the $cookie and $userinfo variables,
* so that they dont have to be called each time
* And as you can see, getusrinfo() is now deprecated.
* Because you dont have to call it anymore, just call $userinfo
*/
if(is_user()):
$cookie = cookiedecode();
$userinfo = get_user_field('*', $cookie[1], true);
else:
$cookie = [];
$userinfo = get_user_field('*', 'Anonymous', true);
endif;
# If they have been deactivated send them to logout to kill their cookie and sessions
if (is_array($userinfo) && isset($userinfo['user_active'])
&& $userinfo['user_id'] != 1 && $userinfo['user_id'] != 0
&& $userinfo['user_active'] == 0 && $_GET['name'] != 'Your_Account'):
redirect('modules.php?name=Your_Account&op=logout');
die();
endif;
if(stristr($_SERVER['REQUEST_URI'], '.php/')):
redirect(str_replace('.php/', '.php', $_SERVER['REQUEST_URI']));
endif;
include_once(NUKE_MODULES_DIR.'Your_Account/includes/mainfileend.php');
if(isset($_POST['clear_cache'])):
$cache->clear();
endif;
$dbi = $db->db_connect_id;
$badreasons = 4;
$sitekey = md5((string) $_SERVER['HTTP_HOST']);
$gfx_chk = 0;
$tipath = 'modules/Blog_Topics/images/topics/';
$reasons = ['As Is', 'Offtopic', 'Flamebait', 'Troll', 'Redundant', 'Insighful', 'Interesting', 'Informative', 'Funny', 'Overrated', 'Underrated'];
$AllowableHTML = ['p'=>1, 'b'=>1, 'i'=>1, 'a'=>2, 'em'=>1, 'br'=>1, 'strong'=>1, 'figure'=>1, 'blockquote'=>1, 'tt'=>1, 'li'=>1, 'ol'=>1, 'ul'=>1, 'pre'=>1];
$nukeconfig = load_nukeconfig();
foreach($nukeconfig as $var => $value):
$$var = $value;
endforeach;
# Base: Language Selector v3.0.0 START
require_once(NUKE_INCLUDE_DIR.'language.php');
# Base: Language Selector v3.0.0 END
$adminmail = stripslashes((string) $adminmail);
$foot1 = stripslashes((string) $foot1);
$foot2 = stripslashes((string) $foot2);
$foot3 = stripslashes((string) $foot3);
$commentlimit = (int) $commentlimit;
$minpass = (int) $minpass;
$pollcomm = (int) $pollcomm;
$articlecomm = (int) $articlecomm;
$my_headlines = (int) $my_headlines;
$top = (int) $top;
$storyhome = (int) $storyhome;
$user_news = (int) $user_news;
$oldnum = (int) $oldnum;
$ultramode = (int) $ultramode;
$banners = (int) $banners;
$multilingual = (int) $multilingual;
$useflags = (int) $useflags;
$notify = (int) $notify;
$moderate = (int) $moderate;
$admingraphic = (int) $admingraphic;
$httpref = (int) $httpref;
$httprefmax = (int) $httprefmax;
$domain = str_replace('http://', '', (string) $nukeurl);
if(isset($default_Theme)):
$Default_Theme = stripslashes((string) $default_Theme);
endif;
if(CAN_MOD_INI):
ini_set('sendmail_from', $adminmail);
endif;
# Base: Evolution Functions v1.5.0 START
$evoconfig = load_evoconfig();
$board_config = load_board_config();
# Base: Evolution Functions v1.5.0 END
/*
* Mod: Lock Modules v1.0.0 START
* Mod: Queries Count v2.0.0 START
* Other: SSL Administration v1.0.0 START
* Base: Censor v1.0.0 START
* Base: Caching System v3.0.0 START
* Mod: Color Toggle v1.0.0 START
* Mod: Lazy Google Tap v1.0.0 START
* Base: Switch Content Script v2.0.0 START
*/
if(isset($evoconfig['lock_modules']))
$lock_modules = (int) $evoconfig['lock_modules'];
if(isset($evoconfig['queries_count']))
$queries_count = (int) $evoconfig['queries_count'];
if(isset($evoconfig['adminssl']))
$adminssl = (int) $evoconfig['adminssl'];
if(isset($evoconfig['censor_words']))
$censor_words = $evoconfig['censor_words'];
if(isset($evoconfig['censor']))
$censor = (int) $evoconfig['censor'];
if(isset($evoconfig['usrclearcache']))
$usrclearcache = (int) $evoconfig['usrclearcache'];
if(isset($evoconfig['use_colors']))
$use_colors = (int) $evoconfig['use_colors'];
if(isset($evoconfig['lazy_tap']))
$lazy_tap = (int) $evoconfig['lazy_tap'];
if(isset($evoconfig['img_resize']))
$img_resize = (int) $evoconfig['img_resize'];
if(isset($evoconfig['img_width']))
$img_width = (int) $evoconfig['img_width'];
if(isset($evoconfig['img_height']))
$img_height = (int) $evoconfig['img_height'];
if(isset($evoconfig['textarea']))
$wysiwyg = $evoconfig['textarea'];
if(isset($evoconfig['capfile']))
$capfile = $evoconfig['capfile'];
if(isset($evoconfig['collapse']))
$collapse = (int) $evoconfig['collapse'];
if(isset($evoconfig['collapsetype']))
$collapsetype = (int) $evoconfig['collapsetype'];
if(isset($evoconfig['module_collapse']))
$module_collapse = (int) $evoconfig['module_collapse'];
if(isset($evoconfig['evouserinfo_ec']))
$evouserinfo_ec = (int) $evoconfig['evouserinfo_ec'];
if(isset($evoconfig['analytics']))
$analytics = $evoconfig['analytics'];
if(isset($evoconfig['html_auth']))
$html_auth = $evoconfig['html_auth'];
$more_js = '';
$more_styles = '';
/*
* @version v2.8.41
* @package PegasusPHP
* Code origin Nuke Titanium v4.0.4
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_INCLUDE_DIR.'functions_browser.php');
/*
* @version Theme Management v1.0.2
* @package Nuke Evo Xtreme
* Code origin Nuke Evolution v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_INCLUDE_DIR.'themes.php');
/*
* @version Google Tap Functions v1.0.0
* @package Nuke Evo Xtreme
* Code origin Nuke Evolution v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
include_once(NUKE_INCLUDE_DIR.'functions_tap.php');
/*
* @version NukeSentinel v1.0.0
* @package NukeSentinel by Bob Marion
* Code origin Nuke Evolution v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
if(!defined('NO_SENTINEL')):
require_once(NUKE_INCLUDE_DIR.'nukesentinel.php');
endif;
/*
* Adopted Evo Variable Functions
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
require_once(NUKE_CLASSES_DIR.'class.variables.php');
/*
* Adopted Evo Input Filtering
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
if (!defined('ADMIN_FILE')) {
require_once(NUKE_CLASSES_DIR."class.inputfilter.php");
}
/*
* Adopted Evo WYSIWYG functions
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
include_once(NUKE_CLASSES_DIR.'class.wysiwyg.php');
/*
* @package Services_JSON
* @author Michal Migurski <mike-json@teczno.com>
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
* @copyright 2005 Michal Migurski
* @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
* @license http://www.opensource.org/licenses/bsd-license.php
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
*/
include_once(NUKE_INCLUDE_DIR.'json.php');
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
/* ShoutBox v4.2.0
* Copyright (c) 2003-2005 by Aric Bolf (SuperCat)
* http://www.OurScripts.net
*
* Copyright (c) 2002 by Quiecom
* http://www.Quiecom.com
*/
include_once(NUKE_MODULES_DIR.'Shout_Box/shout.php');
/* Custom Mainfile
* You can create a custom_mainfile.php in the
* includes/custom_files directory.
* This will save space in the original mainfile.php
*/
if(file_exists(NUKE_INCLUDE_DIR.'custom_files/custom_mainfile.php')):
require_once(NUKE_INCLUDE_DIR.'custom_files/custom_mainfile.php');
endif;
if(!defined('FORUM_ADMIN') && !isset($ThemeSel) && !defined('RSS_FEED')):
$ThemeSel = get_theme();
include_once(NUKE_THEMES_DIR . $ThemeSel . '/theme.php');
endif;
/*
* Adopted Evo Admin File Check v3.0.0
* Code origin Nuke Evolution / Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
if(!defined('FORUM_ADMIN')):
global $admin_file;
if(!isset($admin_file) || empty($admin_file)):
die('You must set a value for $admin_file in config.php');
elseif(!empty($admin_file) && !file_exists(NUKE_BASE_DIR.$admin_file.'.php')):
die('The $admin_file you defined in config.php does not exist');
endif;
endif;
/*
* Adopted Nuke Titanium function is_admin
* Code origin PHP-Nuke Titanium v4.0.4
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
function is_admin($trash=0)
{
static $adminstatus;
if(isset($adminstatus)):
return $adminstatus;
endif;
$admincookie = $_COOKIE['admin'] ?? false;
if(!$admincookie):
return $adminstatus = 0;
endif;
$admincookie = (is_array($admincookie)) ? $admincookie : explode(':', base64_decode((string) $admincookie));
$aid = $admincookie[0];
$pwd = $admincookie[1];
$aid = substr(addslashes((string) $aid), 0, 25);
if(!empty($aid) && !empty($pwd)):
if (!function_exists('get_admin_field')):
global $db, $prefix;
$pass = $db->sql_ufetchrow("SELECT `pwd` FROM `" . $prefix . "_authors` WHERE `aid` = '" . str_replace("\'", "''", $aid) . "'", SQL_ASSOC);
$pass = $pass['pwd'] ?? '';
else:
$pass = get_admin_field('pwd', $aid);
endif;
if($pass == $pwd && !empty($pass)):
return $adminstatus = 1;
endif;
endif;
return $adminstatus = 0;
}
/*
* Adopted Evo function is_god_admin
* Code origin Evo Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
function is_god_admin($trash=0)
{
static $godadminstatus;
if(isset($godadminstatus)):
return $godadminstatus;
endif;
$godadmincookie = $_COOKIE['admin'] ?? false;
if(!$godadmincookie):
return $godadminstatus = 0;
endif;
$godadmincookie = (is_array($godadmincookie)) ? $godadmincookie : explode(':', base64_decode((string) $godadmincookie));
$aid = $godadmincookie[0];
$pwd = $godadmincookie[1];
$godaid = substr(addslashes((string) $aid), 0, 25);
if(!empty($godaid) && !empty($pwd)):
if (!function_exists('get_admin_field')):
global $db;
$pass = $db->sql_ufetchrow("SELECT `pwd` FROM `" . _AUTHOR_TABLE."` WHERE `aid` = '" . str_replace("\'", "''", $godaid) . "'", SQL_ASSOC);
$godname = $db->sql_ufetchrow("SELECT `name` FROM `" . _AUTHOR_TABLE."` WHERE `aid` = '" . str_replace("\'", "''", $godaid) . "'", SQL_ASSOC);
$pass = $pass['pwd'] ?? '';
$godname = $godname['name'] ?? '';
else:
$pass = get_admin_field('pwd', $godaid);
$godname = get_admin_field('name', $godaid);
endif;
if(($pass == $pwd && !empty($pass)) && ( $godname == 'God')):
return $godadminstatus = 1;
endif;
endif;
return $godadminstatus = 0;
}
/*
* Adopted Nuke Titanium function is_user
* Code origin PHP-Nuke Titanium v4.0.4
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
function is_user($trash=0)
{
static $userstatus;
if(isset($userstatus)):
return $userstatus;
endif;
$usercookie = $_COOKIE['user'] ?? false;
if(!$usercookie):
return $userstatus = 0;
endif;
$usercookie = (is_array($usercookie)) ? $usercookie : explode(':', base64_decode((string) $usercookie));
$uid = $usercookie[0];
$pwd = $usercookie[2];
$uid = (int) $uid;
if(!empty($uid) && !empty($pwd)):
$user_password = get_user_field('user_password', $uid);
if($user_password == $pwd && !empty($user_password)):
return $userstatus = 1;
endif;
endif;
return $userstatus = 0;
}
/*
* Adopted Evo function cookiedecode
* Code origin Evo Xtreme v2.0.9e
* @date 03/28/2023 8:23 AM Ernest Allen Buffington
*/
function cookiedecode($trash=0)
{
global $cookie;
static $rcookie;
if(isset($rcookie)):
return $rcookie;
endif;