-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainfile.php
2363 lines (1829 loc) · 71.4 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 Titanium | Nuke-Evolution Xtreme : PHP-Nuke Web Portal System
=======================================================================*/
/************************************************************************/
/* 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. */
/************************************************************************/
/*****[CHANGES]**********************************************************
-=[Base]=-
NukeSentinel v2.5.08 07/11/2006
Nuke Patched v3.1.0 06/26/2005
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
************************************************************************/
if((defined('NUKE_EVO')) || (defined('NUKE_TITANIUM'))):
return;
endif;
if(realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])):
exit('Access Denied');
endif;
# Define File
define('NUKE_EVO', '2.0.9e');
define('NUKE_TITANIUM', '4.0.3');
define('PHPBB_TITANIUM', '2.0.25');
define('PHPBB_TITANIUM_LAST_UPDATE', 'Sunday Jan 1st, 2023');
define('TITANIUM_BUILD', '20940312032022');
define('CUR_EVO', 'NUKE_EVO');
define('CUR_TITANIUM', 'NUKE_TITANIUM');
define('EVO_EDITION', 'Xtreme');
define('TITANIUM_EDITION', 'AN602');
define('PHPVERS', phpversion());
define('EVO_VERSION', NUKE_EVO . ' ' . EVO_EDITION);
define('TITANIUM_VERSION', NUKE_TITANIUM . ' ' . TITANIUM_EDITION);
define('PHP_5', version_compare(PHPVERS, '5.0.0', '>='));
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 pnt_import_globals($array)
{
foreach ($array as $k => $v):
global $$k;
$$k = $v;
endforeach;
}
if(!empty($_GET)):
pnt_import_globals($_GET);
endif;
if(!empty($_POST)):
pnt_import_globals($_POST);
endif;
if(!empty($_COOKIE)):
pnt_import_globals($_COOKIE);
endif;
endif;
endif;
$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_5 && (!ini_get('register_long_arrays') || ini_get('register_long_arrays') == '0' || strtolower(ini_get('register_long_arrays')) == 'off')):
$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('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');
# Include the required files
require_once(NUKE_DB_DIR.'db.php');
require_once(NUKE_DB_DIR.'MysqliDb.php');
# $db->debug = true;
# Include Error Logger and identify class
require_once(NUKE_CLASSES_DIR.'class.identify.php');
global $agent;
$identify = new identify();
$agent = $identify->identify_agent();
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 (version_compare(PHPVERS, '4.3.0', '>=')): # PHP 4.2.x seems to give memleak
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;
include_once(NUKE_INCLUDE_DIR.'constants.php');
require_once(NUKE_CLASSES_DIR.'class.cache.php');
require_once(NUKE_CLASSES_DIR.'class.debugger.php');
include_once(NUKE_CLASSES_DIR.'class.zip.php');
require_once(NUKE_INCLUDE_DIR.'functions_database.php');
require_once(NUKE_INCLUDE_DIR.'functions_cache.php');
# Network Support START
# PHP-Nuke Titanium v3.0.0 START
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');
# Network Support END
# PHP-Nuke Titanium END
require_once(NUKE_INCLUDE_DIR.'functions_evo.php');
require_once(NUKE_INCLUDE_DIR.'functions_evo_custom.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;
define('NUKE_FILE', true);
$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 = $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
$lock_modules = (int) $evoconfig['lock_modules'];
$queries_count = (int) $evoconfig['queries_count'];
$adminssl = (int) $evoconfig['adminssl'];
$censor_words = $evoconfig['censor_words'];
$censor = (int) $evoconfig['censor'];
$usrclearcache = (int) $evoconfig['usrclearcache'];
$use_colors = (int) $evoconfig['use_colors'];
$lazy_tap = (int) $evoconfig['lazy_tap'];
$img_resize = (int) $evoconfig['img_resize'];
$img_width = (int) $evoconfig['img_width'];
$img_height = (int) $evoconfig['img_height'];
$wysiwyg = $evoconfig['textarea'];
$capfile = $evoconfig['capfile'];
$collapse = (int) $evoconfig['collapse'];
$collapsetype = (int) $evoconfig['collapsetype'];
$module_collapse = (int) $evoconfig['module_collapse'];
$evouserinfo_ec = (int) $evoconfig['evouserinfo_ec'];
$analytics = $evoconfig['analytics'];
$html_auth = $evoconfig['html_auth'];
$more_js = '';
$more_styles = '';
# Mod: Lock Modules v1.0.0 END
# Mod: Queries Count v2.0.0 END
# Other: SSL Administration v1.0.0 END
# Base: Censor v1.0.0 END
# Base: Caching System v3.0.0 END
# Mod: Color Toggle v1.0.0 END
# Mod: Lazy Google Tap v1.0.0 END
# Base: Switch Content Script v2.0.0 END
# Mod: Browsers v1.0 START
# Mod: Lazy Google Tap v1.0.0 START
# Base: Theme Management v1.0.2 START
# Base: NukeSentinel v2.5.08 START
# Mod: Custom Text Area v1.0.0 START
require_once(NUKE_INCLUDE_DIR.'functions_browser.php');
require_once(NUKE_INCLUDE_DIR.'themes.php');
include_once(NUKE_INCLUDE_DIR.'functions_tap.php');
if(!defined('NO_SENTINEL')):
require_once(NUKE_INCLUDE_DIR.'nukesentinel.php');
endif;
require_once(NUKE_CLASSES_DIR.'class.variables.php');
include_once(NUKE_CLASSES_DIR.'class.wysiwyg.php');
# Mod: Browsers v1.0 END
# Mod: Lazy Google Tap v1.0.0 END
# Base: Theme Management v1.0.2 END
# Base: NukeSentinel v2.5.08 END
# Mod: Custom Text Area v1.0.0 END
include_once(NUKE_INCLUDE_DIR.'json.php');
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
# Mod: Shoutbox v8.5.2 START
include_once(NUKE_MODULES_DIR.'Shout_Box/shout.php');
# Mod: Shoutbox v8.5.2 END
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;
# Base: Admin File Check v3.0.0 START
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;
# Base: Admin File Check v3.0.0 END
function define_once($constant, $value)
{
if(!defined($constant)):
define($constant, $value);
endif;
}
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;
}
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;
}
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;
}
function cookiedecode($trash=0)
{
global $cookie;
static $rcookie;
if(isset($rcookie)):
return $rcookie;
endif;
$usercookie = $_COOKIE['user'];
$rcookie = (is_array($usercookie)) ? $usercookie : explode(':', base64_decode((string) $usercookie));
$pass = get_user_field('user_password', $rcookie[1], true);
if($rcookie[2] == $pass && !empty($pass)):
return $cookie = $rcookie;
endif;
return false;
}
/* IMAGE HACK
* You can't run Rector on mainfile.php it has no earthly idea
* what to do when it gets to this function as it has never seen anything
* like this and is unable to factor or refactor from here!
*/
function title($text)
{
return;
global $name;
# Opera Hack as images were not showing up
if($name == 'Advertising'):
$icon = img('AdvertisngFixed.png', $name);
# Opera Hack as images were not showing up
elseif ($name == 'Network_Advertising'):
$icon = img('NetworkAdvertisingFixed.png', $name);
else:
if(!isset($name) || empty($name)):
# Index Hack as images were not showing up
else:
$icon = img($name.'.png', $name);
endif;
endif;
if(!isset($name) || empty($name)):
# Index Hack as images were not showing up
else:
OpenTable();
echo '<br /><div align="center"><a alt="'.$text.'" href="modules.php?name='.$name.'"><img alt="'.$text.'" style="height: 50px;" src="'.$icon.'" border="0"></a></div><br/>';
CloseTable();
endif;
}
/**
* @get active module
* @version 4.0.3
* @cache zf1-future
* @author Ernest Allen Buffington
*/
function is_active($module)
{
global $prefix, $db, $cache;
static $active_modules;
if(is_array($active_modules)):
return(isset($active_modules[$module]) ? 1 : 0);
endif;
if((($active_modules = $cache->load('titanium_active_modules', 'config')) === false) || empty($active_modules)):
$active_modules = [];
$result = $db->sql_query('SELECT `title` FROM `'.$prefix.'_modules` WHERE `active`="1"');
while([$title] = $db->sql_fetchrow($result, SQL_NUM)):
$active_modules[$title] = 1;
endwhile;
$db->sql_freeresult($result);
$cache->save('titanium_active_modules', 'config', $active_modules);
endif;
return (isset($active_modules[$module]) ? 1 : 0);
}
function render_blocks($side, $block)
{
global $plus_minus_images, $currentlang, $collapse, $collapsetype;
define_once('BLOCK_FILE', true);
# Include the block lang files
if(file_exists(NUKE_LANGUAGE_DIR.'blocks/lang-'.$currentlang.'.php')):
include_once(NUKE_LANGUAGE_DIR.'blocks/lang-'.$currentlang.'.php');
else:
include_once(NUKE_LANGUAGE_DIR.'blocks/lang-english.php');
endif;
# Mod: Switch Content Script v2.0.0 START
if($collapse):
if(!$collapsetype):
$block['title'] = $block['title']." <img src=\"".$plus_minus_images['minus']
."\" class=\"showstate\" name=\"minus\" width=\"9\" height=\"9\" border=\"0\" onclick=\"expandcontent(this, 'block".$block['bid']."')\" alt=\"\" style=\"cursor: pointer;\" />";
else:
$block['title'] = "<a href=\"javascript:expandcontent(this, 'block".$block['bid']."')\">".$block['title']."</a>";
endif;
$block['content'] = "<div id=\"block".$block['bid']."\" class=\"switchcontent\">".$block['content']."</div>";
endif;
# Mod: Switch Content Script v2.0.0 END
if (empty($block['url'])):
if (empty($block['blockfile'])):
if ($side == 'c' || $side == 'd'):
themecenterbox($block['title'], decode_bbcode($block['content'], 1, true));
else:
themesidebox($block['title'], decode_bbcode($block['content'], 1, true), $block['bid']);
endif;
else:
blockfileinc($block['title'], $block['blockfile'], $side, $block['bid']);
endif;
else:
headlines($block['bid'], $side, $block);
endif;
}
function blocks_visible($side): bool
{
global $showblocks;
$showblocks = ($showblocks == null) ? 3 : $showblocks;
$side = strtolower((string) $side[0]);
# If there are no blocks for this module && not admin file
if(!$showblocks && !defined('ADMIN_FILE')):
return false;
endif;
# If in the admin show l blocks
if (defined('ADMIN_FILE')):
return true;
endif;
# If set to 3 its all blocks
if($showblocks == 3):
return true;
endif;
# Count the blocks on the side
$blocks = blocks($side, true);
# If there are no blocks
if(!$blocks):
return false;
endif;
# Check for blocks to show
return ($showblocks == 1 && $side == 'l') || ($showblocks == 2 && $side == 'r');
}
/**
* @get blocks information
* @version 4.0.3
* @cache zf1-future
* @author Ernest Allen Buffington
*/
function blocks($side, $count=false)
{
global $prefix, $multilingual, $currentlang, $db, $userinfo, $cache;
static $blocks;
$querylang = ($multilingual) ? 'AND (`blanguage`="'.$currentlang.'" OR `blanguage`="")' : '';
$side = strtolower((string) $side[0]);
if(!($blocks = $cache->load('blocks', 'config'))):
$sql = 'SELECT * FROM `'.$prefix.'_blocks` WHERE `active`="1" '.$querylang.' ORDER BY `weight` ASC';
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result, SQL_ASSOC)):
$blocks[$row['bposition']][] = $row;
endwhile;
$db->sql_freeresult($result);
$cache->save('blocks', 'config', $blocks);
endif;
if($count):
return (isset($blocks[$side]) ? count($blocks[$side]) : 0);
endif;
$blockrow = $blocks[$side] ?? [];
foreach ($blockrow as $i => $singleBlockrow) {
$bid = (int) $singleBlockrow['bid'];
$view = $singleBlockrow['view'];
$expire = isset($singleBlockrow['expire']) ? (int) $singleBlockrow['expire'] : '';
if(isset($singleBlockrow['action'])):
$action = $singleBlockrow['action'];
$action = substr((string) $action, 0,1);
else:
$action = '';
endif;
$now = time();
if($expire != 0 && $expire <= $now):
if($action == 'd'):
$db->sql_query('UPDATE `'.$prefix.'_blocks` SET `active`="0", `expire`="0" WHERE `bid`="'.$bid.'"');
$cache->delete('blocks', 'config');
return;
elseif($action == 'r'):
$db->sql_query('DELETE FROM `'.$prefix.'_blocks` WHERE `bid`="'.$bid.'"');
$cache->delete('blocks', 'config');
return;
endif;
endif;
if(empty($singleBlockrow['bkey'])):
if (($view == '0' || $view == '1') ||
(($view == '3' && is_user())) ||
($view == '4' && is_admin()) ||
(($view == '2' && !is_user()))) {
render_blocks($side, $singleBlockrow);
} elseif (substr((string) $view, strlen((string) $view)-1) == '-') {
$ingroups = explode('-', (string) $view);
if(is_array($ingroups)):
$cnt = 0;
foreach($ingroups as $group):
if(isset($userinfo['groups'][($group)])):
$cnt++;
endif;
endforeach;
if($cnt != 0):
render_blocks($side, $singleBlockrow);
endif;
endif;
}
endif;
}
return;
}
function blockfileinc($blockfiletitle, $blockfile, $side=1,$bid = 0) {
global $collapse;
if (!file_exists(NUKE_BLOCKS_DIR.$blockfile)) {