-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainfile.php
1500 lines (1357 loc) · 57.3 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
/*=======================================================================
Nuke-Evolution Basic: Enhanced 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
-=[Other]=-
SSL Administration v1.0.0 08/29/2005
Validation v1.1.0 10/17/2005
Extra Functions v1.0.0 12/22/2005
NSN Center Blocks v2.2.1 05/26/2009
************************************************************************/
if(defined('NUKE_EVO')) return;
if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) {
exit('Access Denied');
}
// Define File
define_once('NUKE_EVO', '2.0.9e');
define_once('CUR_EVO', 'NUKE_EVO');
define_once('EVO_EDITION', 'xtreme');
define('PHPVERS', @phpversion());
define_once('EVO_VERSION', NUKE_EVO . ' ' . EVO_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 evo_import_globals($array) {
foreach ($array as $k => $v) {
global $$k;
$$k = $v;
}
}
if (!empty($_GET)) {
evo_import_globals($_GET);
}
if (!empty($_POST)) {
evo_import_globals($_POST);
}
if (!empty($_COOKIE)) {
evo_import_globals($_COOKIE);
}
}
}
$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;
}
$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'];
}
$_SERVER['REQUEST_URI'] = $requesturi;
}
// 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;
}
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');
}
# absolute path Mod - Start 01/01/2012 by Ernest Allen Buffington #
$rel_path=array();
$rel_path['file'] = str_replace('\\', "/", realpath(dirname(__FILE__)));
$server_ary = pathinfo(realpath(basename($_SERVER['PHP_SELF'])));
$rel_path['server'] = str_replace('\\', "/", $server_ary['dirname']);
$rel_path['uri'] = realpath(basename(substr($_SERVER['REQUEST_URI'], 0, strpos($_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($_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);
}
}
else
if (strlen($rel_path['file']) == (strlen($_SERVER['DOCUMENT_ROOT']) - 1) )
{
$href_path = '';
}
else
if ( strlen($rel_path['script']) > strlen($_SERVER['DOCUMENT_ROOT']) && (strlen($_SERVER['DOCUMENT_ROOT']) > strlen($rel_path['file'])) )
{
$href_path = '';
}
else
if (strlen($rel_path['file']) > strlen($_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);
}
}
else
{
$href_path='https://'.$_SERVER['SERVER_NAME'];
$href_path_http='http://'.$_SERVER['SERVER_NAME'];
}
unset ($rel_path);
unset ($server_ary);
unset ($script_abs_path);
# BASE Directory
define('TITANIUM_BASE_DIR', dirname(__FILE__) . '/');
# HTTP & HTTPS
define('HTTPS', $href_path . '/');
define('HTTP', $href_path_http . '/');
# HTPPS for Titanium Network
define('HTTPS-MUSIC', 'https://music.86it.us/');
# 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/');
# Coppermine Directory
define('TITANIUM_HREF_COPPERMINE_DIR', $href_path . '/modules/Coppermine/');
define('TITANIUM_COPPERMINE_DIR', TITANIUM_BASE_DIR . 'modules/Coppermine/');
define('TITANIUM_COPPERMINE_IMAGES_DIR', $href_path . '/modules/Coppermine/images/');
# Coppermine Include Directory
define('TITANIUM_HREF_COPPERMINE_INCLUDE_DIR', $href_path . '/modules/Coppermine/include/');
define('TITANIUM_COPPERMINE_INCLUDE_DIR', TITANIUM_BASE_DIR . 'modules/Coppermine/include/');
# Coppermine Java Script Directory
define('TITANIUM_HREF_COPPERMINE_JS_DIR', $href_path . '/modules/Coppermine/js/');
define('TITANIUM_COPPERMINE_JS_DIR', TITANIUM_BASE_DIR . 'modules/Coppermine/js/');
# Coppermine Docs Directory
define('TITANIUM_HREF_COPPERMINE_DOCS_DIR', $href_path . '/modules/Coppermine/docs/');
define('TITANIUM_COPPERMINE_DOCS_DIR', TITANIUM_BASE_DIR . 'modules/Coppermine/docs/');
# Coppermine Fonts Directory
define('TITANIUM_HREF_COPPERMINE_FONTS_DIR', $href_path . '/modules/Coppermine/images/fonts/');
define('TITANIUM_COPPERMINE_FONTS_DIR', TITANIUM_BASE_DIR . 'modules/Coppermine/images/fonts/');
# 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);
# aboslute path Mod - End 01/01/2012 by Ernest Allen Buffington #
//Inspired by phoenix-cms at website-portals.net
//Absolute Nuke directory
define('NUKE_BASE_DIR', dirname(__FILE__) . '/');
//Absolute Nuke directory + includes
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_CLASSES_DIR', NUKE_INCLUDE_DIR . 'classes/');
define('NUKE_ZEND_DIR', NUKE_INCLUDE_DIR . 'Zend/');
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/', $class)) {
$file = NUKE_CLASS_EXCEPTION_DIR . strtolower($class) . '.php';
} else {
$file = NUKE_CLASSES_DIR . 'class.' . strtolower($class) . '.php';
}
if (!class_exists($class, false) && file_exists($file)) {
require_once($file);
}
}
spl_autoload_register('classAutoloader');
}
//Check for these functions to see if we can use the new captcha
// if(function_exists('imagecreatetruecolor') && function_exists('imageftbbox')) {
// define('CAPTCHA',true);
// }
if (CAN_MOD_INI) {
ini_set('magic_quotes_sybase', 0);
ini_set('zlib.output_compression', 0);
}
// Include config file
@require_once(NUKE_BASE_DIR.'config.php');
if(!$directory_mode) {
$directory_mode = 0777;
} else {
$directory_mode = 0755;
}
if (!$file_mode) {
$file_mode = 0666;
} else {
$file_mode = 0644;
}
// 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');
//$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');
}
$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');
}
} else {
ob_start();
ob_implicit_flush(0);
}
include_once(NUKE_INCLUDE_DIR.'constants.php');
@require_once(NUKE_CLASSES_DIR.'class.cache.php');
@require_once(NUKE_CLASSES_DIR.'class.debugger.php');
# added for Titanium Modules support - Ernest Allen Buffington 09/02/2019
require_once(NUKE_INCLUDE_DIR.'function_img.php');
require_once(NUKE_INCLUDE_DIR.'functions_evo.php');
require_once(NUKE_INCLUDE_DIR.'functions_evo_custom.php');
# START added for Titanium addons by Ernest Allen Buffington 09/03/2019
require_once(NUKE_INCLUDE_DIR.'functions_titanium.php');
require_once(NUKE_INCLUDE_DIR.'functions_titanium_custom.php');
# END added for Titanium addons by Ernest Allen Buffington 09/03/2019
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 = array();
$userinfo = get_user_field('*', 'Anonymous', true);
}
# 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();
}
if(stristr($_SERVER['REQUEST_URI'], '.php/')) {
redirect(str_replace('.php/', '.php', $_SERVER['REQUEST_URI']));
}
include_once(NUKE_MODULES_DIR.'Your_Account/includes/mainfileend.php');
if (isset($_POST['clear_cache'])) {
$cache->clear();
}
define('NUKE_FILE', true);
$dbi = $db->db_connect_id;
$badreasons = 4;
$sitekey = md5($_SERVER['HTTP_HOST']);
$gfx_chk = 0;
$tipath = 'modules/Blog/images/Blog_Topics/';
$reasons = array('As Is', 'Offtopic', 'Flamebait', 'Troll', 'Redundant', 'Insighful', 'Interesting', 'Informative', 'Funny', 'Overrated', 'Underrated');
$AllowableHTML = array('b'=>1,
'i'=>1,
'a'=>2,
'em'=>1,
'br'=>1,
'strong'=>1,
'blockquote'=>1,
'tt'=>1,
'li'=>1,
'ol'=>1,
'ul'=>1,
'pre'=>1);
$nukeconfig = load_nukeconfig();
foreach($nukeconfig as $var => $value) {
$$var = $value;
}
/*****[BEGIN]******************************************
[ Base: Language Selector v3.0.0 ]
******************************************************/
@require_once(NUKE_INCLUDE_DIR.'language.php');
/*****[END]********************************************
[ Base: Language Selector v3.0.0 ]
******************************************************/
$adminmail = stripslashes($adminmail);
$foot1 = stripslashes($foot1);
$foot2 = stripslashes($foot2);
$foot3 = stripslashes($foot3);
$commentlimit = intval($commentlimit);
$minpass = intval($minpass);
$pollcomm = intval($pollcomm);
$articlecomm = intval($articlecomm);
$my_headlines = intval($my_headlines);
$top = intval($top);
$storyhome = intval($storyhome);
$user_news = intval($user_news);
$oldnum = intval($oldnum);
$ultramode = intval($ultramode);
$banners = intval($banners);
$multilingual = intval($multilingual);
$useflags = intval($useflags);
$notify = intval($notify);
$moderate = intval($moderate);
$admingraphic = intval($admingraphic);
$httpref = intval($httpref);
$httprefmax = intval($httprefmax);
$domain = str_replace('http://', '', $nukeurl);
if(isset($default_Theme)) $Default_Theme = $default_Theme;
if (CAN_MOD_INI) ini_set('sendmail_from', $adminmail);
/*****[BEGIN]******************************************
[ Base: Evolution Functions v1.5.0 ]
******************************************************/
$evoconfig = load_evoconfig();
$board_config = load_board_config();
/*****[END]********************************************
[ Base: Evolution Functions v1.5.0 ]
******************************************************/
/*****[BEGIN]******************************************
[ Mod: Lock Modules v1.0.0 ]
[ Mod: Queries Count v2.0.0 ]
[ Other: SSL Administration v1.0.0 ]
[ Base: Censor v1.0.0 ]
[ Base: Caching System v3.0.0 ]
[ Mod: Color Toggle v1.0.0 ]
[ Mod: Lazy Google Tap v1.0.0 ]
[ Base: Switch Content Script v2.0.0 ]
******************************************************/
$lock_modules = intval($evoconfig['lock_modules']);
$queries_count = intval($evoconfig['queries_count']);
$adminssl = intval($evoconfig['adminssl']);
$censor_words = $evoconfig['censor_words'];
$censor = intval($evoconfig['censor']);
$usrclearcache = intval($evoconfig['usrclearcache']);
$use_colors = intval($evoconfig['use_colors']);
$lazy_tap = intval($evoconfig['lazy_tap']);
$img_resize = intval($evoconfig['img_resize']);
$img_width = intval($evoconfig['img_width']);
$img_height = intval($evoconfig['img_height']);
$wysiwyg = $evoconfig['textarea'];
$capfile = $evoconfig['capfile'];
$collapse = intval($evoconfig['collapse']);
$collapsetype = intval($evoconfig['collapsetype']);
$module_collapse = intval($evoconfig['module_collapse']);
$evouserinfo_ec = intval($evoconfig['evouserinfo_ec']);
$analytics = $evoconfig['analytics'];
$html_auth = $evoconfig['html_auth'];
$more_js = '';
$more_styles = '';
/*****[END]********************************************
[ Mod: Lock Modules v1.0.0 ]
[ Mod: Queries Count v2.0.0 ]
[ Other: SSL Administration v1.0.0 ]
[ Base: Censor v1.0.0 ]
[ Base: Caching System v3.0.0 ]
[ Mod: Color Toggle v1.0.0 ]
[ Mod: Lazy Google Tap v1.0.0 ]
[ Base: Switch Content Script v2.0.0 ]
******************************************************/
/*****[BEGIN]******************************************
[ Mod: Lazy Google Tap v1.0.0 ]
[ Base: Theme Management v1.0.2 ]
[ Base: NukeSentinel v2.5.08 ]
[ Mod: Custom Text Area v1.0.0 ]
******************************************************/
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');
}
require_once(NUKE_CLASSES_DIR.'class.variables.php');
include_once(NUKE_CLASSES_DIR.'class.wysiwyg.php');
/*****[END]********************************************
[ Mod: Lazy Google Tap v1.0.0 ]
[ Base: Theme Management v1.0.2 ]
[ Base: NukeSentinel v2.5.08 ]
[ Mod: Custom Text Area v1.0.0 ]
******************************************************/
include_once(NUKE_INCLUDE_DIR.'json.php');
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
/*****[BEGIN]******************************************
[ Mod: Shoutbox v8.5.2 ]
******************************************************/
include_once(NUKE_MODULES_DIR.'Shout_Box/shout.php');
/*****[END]********************************************
[ Mod: Shoutbox v8.5.2 ]
******************************************************/
if (file_exists(NUKE_INCLUDE_DIR.'custom_files/custom_mainfile.php')) {
require_once(NUKE_INCLUDE_DIR.'custom_files/custom_mainfile.php');
}
if(!defined('FORUM_ADMIN') && !isset($ThemeSel) && !defined('RSS_FEED')) {
$ThemeSel = get_theme();
include_once(NUKE_THEMES_DIR . $ThemeSel . '/theme.php');
}
/*****[BEGIN]******************************************
[ Base: Admin File Check v3.0.0 ]
******************************************************/
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');
}
}
/*****[END]********************************************
[ Base: Admin File Check v3.0.0 ]
******************************************************/
function define_once($constant, $value) {
if(!defined($constant)) {
define($constant, $value);
}
}
function is_admin($trash=0) {
static $adminstatus;
if(isset($adminstatus)) return $adminstatus;
$admincookie = isset($_COOKIE['admin']) ? $_COOKIE['admin'] : false;
if (!$admincookie) { return $adminstatus = 0; }
$admincookie = (!is_array($admincookie)) ? explode(':', base64_decode($admincookie)) : $admincookie;
$aid = $admincookie[0];
$pwd = $admincookie[1];
$aid = substr(addslashes($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 = (isset($pass['pwd'])) ? $pass['pwd'] : '';
} else {
$pass = get_admin_field('pwd', $aid);
}
if ($pass == $pwd && !empty($pass)) {
return $adminstatus = 1;
}
}
return $adminstatus = 0;
}
function is_user($trash=0) {
static $userstatus;
if(isset($userstatus)) return $userstatus;
$usercookie = isset($_COOKIE['user']) ? $_COOKIE['user'] : false;
if (!$usercookie) { return $userstatus = 0; }
$usercookie = (!is_array($usercookie)) ? explode(':', base64_decode($usercookie)) : $usercookie;
$uid = $usercookie[0];
$pwd = $usercookie[2];
$uid = intval($uid);
if (!empty($uid) AND !empty($pwd)) {
$user_password = get_user_field('user_password', $uid);
if ($user_password == $pwd && !empty($user_password)) {
return $userstatus = 1;
}
}
return $userstatus = 0;
}
function cookiedecode($trash=0) {
global $cookie;
static $rcookie;
if(isset($rcookie)) { return $rcookie; }
$usercookie = $_COOKIE['user'];
$rcookie = (!is_array($usercookie)) ? explode(':', base64_decode($usercookie)) : $usercookie;
$pass = get_user_field('user_password', $rcookie[1], true);
if ($rcookie[2] == $pass && !empty($pass)) {
return $cookie = $rcookie;
}
return false;
}
function title($text) {
OpenTable();
echo '<div class="title" style="text-align: center"><strong>'.$text.'</strong></div>';
CloseTable();
echo '<br />';
}
function is_active($module) {
global $prefix, $db, $cache;
static $active_modules;
if (is_array($active_modules)) {
return(isset($active_modules[$module]) ? 1 : 0);
}
if ((($active_modules = $cache->load('active_modules', 'config')) === false) || empty($active_modules)) {
$active_modules = array();
$result = $db->sql_query('SELECT `title` FROM `'.$prefix.'_modules` WHERE `active`="1"');
while(list($title) = $db->sql_fetchrow($result, SQL_NUM)) {
$active_modules[$title] = 1;
}
$db->sql_freeresult($result);
$cache->save('active_modules', 'config', $active_modules);
}
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');
}
/*****[BEGIN]******************************************
[ Mod: Switch Content Script v2.0.0 ]
******************************************************/
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;\" />";
// $block['title'] = $block['title'].' '.get_evo_icon('evo-sprite minus showstate', false, 'expandcontent(this, \'block'.$block['bid'].'\')');
}
else
{
$block['title'] = "<a href=\"javascript:expandcontent(this, 'block".$block['bid']."')\">".$block['title']."</a>";
}
$block['content'] = "<div id=\"block".$block['bid']."\" class=\"switchcontent\">".$block['content']."</div>";
}
/*****[END]********************************************
[ Mod: Switch Content Script v2.0.0 ]
******************************************************/
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']);
}
} else {
blockfileinc($block['title'], $block['blockfile'], $side, $block['bid']);
}
} else {
headlines($block['bid'], $side, $block);
}
}
function blocks_visible($side) {
global $showblocks;
$showblocks = ($showblocks == null) ? 3 : $showblocks;
$side = strtolower($side[0]);
//If there are no blocks for this module && not admin file
if (!$showblocks && !defined('ADMIN_FILE')) return false;
//If in the admin show l blocks
if (defined('ADMIN_FILE')) {
return true;
}
//If set to 3 its all blocks
if ($showblocks == 3) return true;
//Count the blocks on the side
$blocks = blocks($side, true);
//If there are no blocks
if (!$blocks) {
return false;
}
//Check for blocks to show
if (($showblocks == 1 && $side == 'l') || ($showblocks == 2 && $side == 'r')) {
return true;
}
return false;
}
function blocks($side, $count=false) {
global $prefix, $multilingual, $currentlang, $db, $userinfo, $cache;
static $blocks;
$querylang = ($multilingual) ? 'AND (`blanguage`="'.$currentlang.'" OR `blanguage`="")' : '';
$side = strtolower($side[0]);
if((($blocks = $cache->load('blocks', 'config')) === false) || !isset($blocks)) {
$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;
}
$db->sql_freeresult($result);
$cache->save('blocks', 'config', $blocks);
}
if ($count) {
return (isset($blocks[$side]) ? count($blocks[$side]) : 0);
}
$blockrow = (isset($blocks[$side])) ? $blocks[$side] : array();
for($i=0,$j = count($blockrow); $i < $j; $i++) {
$bid = intval($blockrow[$i]['bid']);
$view = $blockrow[$i]['view'];
if(isset($blockrow[$i]['expire'])) {
$expire = intval($blockrow[$i]['expire']);
} else {
$expire = '';
}
if(isset($blockrow[$i]['action'])) {
$action = $blockrow[$i]['action'];
$action = substr($action, 0,1);
} else {
$action = '';
}
$now = time();
if ($expire != 0 AND $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;
}
}if (empty($blockrow[$i]['bkey'])) {
if ( ($view == '0' || $view == '1') ||
( ($view == '3' AND is_user()) ) ||
( $view == '4' AND is_admin()) ||
( ($view == '2' AND !is_user())) ) {
render_blocks($side, $blockrow[$i]);
} else {
if (substr($view, strlen($view)-1) == '-') {
$ingroups = explode('-', $view);
if (is_array($ingroups)) {
$cnt = 0;
foreach ($ingroups as $group) {
if (isset($userinfo['groups'][($group)])) {
$cnt++;
}
}
if ($cnt != 0){
render_blocks($side, $blockrow[$i]);
}
}
}
}
}
}
return;
}
function blockfileinc($blockfiletitle, $blockfile, $side=1, $bid) {
global $collapse;
if (!file_exists(NUKE_BLOCKS_DIR.$blockfile)) {
$content = _BLOCKPROBLEM;
} else {
include(NUKE_BLOCKS_DIR.$blockfile);
}
if (empty($content)) {
$content = _BLOCKPROBLEM2;
}
/*****[BEGIN]******************************************
[ Mod: Switch Content Script v2.0.0 ]
******************************************************/
if($collapse) {
$content = " <div id=\"block".$bid."\" class=\"switchcontent\">".$content."</div>";
}
/*****[END]********************************************
[ Mod: Switch Content Script v2.0.0 ]
******************************************************/
if ($side == 'r' || $side == 'l') {
themesidebox($blockfiletitle, $content, $bid);
} else {
themecenterbox($blockfiletitle, $content);
}
}
function rss_content($url) {
if (!evo_site_up($url)) return false;
require_once(NUKE_CLASSES_DIR.'class.rss.php');
if ($rss = RSS::read($url)) {
$items =& $rss['items'];
$site_link =& $rss['link'];
$content = '';
for ($i=0,$j = count($items);$i <$j;$i++) {
$link = $items[$i]['link'];
$title2 = $items[$i]['title'];
$content .= "<strong><big>·</big></strong> <a href=\"$link\" target=\"new\">$title2</a><br />\n";
}
if (!empty($site_link)) {
$content .= "<br /><a href=\"$site_link\" target=\"_blank\"><strong>"._HREADMORE.'</strong></a>';
}
return $content;
}
return false;
}
function headlines($bid, $side=0, $row='') {
global $prefix, $db, $my_headlines, $cache;
if(!$my_headlines) return;
$bid = intval($bid);
if (!is_array($row)) {
$row = $db->sql_ufetchrow('SELECT `title`, `content`, `url`, `refresh`, `time` FROM `'.$prefix.'_blocks` WHERE `bid`='.$bid, SQL_ASSOC);
}
$content =& trim($row['content']);
if ($row['time'] < (time()-$row['refresh']) || empty($content)) {
$content = rss_content($row['url']);
$btime = time();
$db->sql_query("UPDATE `".$prefix."_blocks` SET `content`='".Fix_Quotes($content)."', `time`='$btime' WHERE `bid`='$bid'");
$cache->delete('blocks', 'config');
}
if (empty($content)) {
$content = _RSSPROBLEM.' ('.$row['title'].')';
}
$content = '<span class="content">'.$content.'</span>';
if ($side == 'c' || $side == 'd') {
themecenterbox($row['title'], $content);
} else {
themesidebox($row['title'], $content, $bid);
}
}
function ultramode() {
global $db, $prefix, $multilingual, $currentlang;
$querylang = ($multilingual == 1) ? "AND (s.alanguage='".$currentlang."' OR s.alanguage='')" : "";
$sql = "SELECT s.sid, s.catid, s.aid, s.title, s.time, s.hometext, s.comments, s.topic, s.ticon, t.topictext, t.topicimage FROM `".$prefix."_stories` s LEFT JOIN `".$prefix."_topics` t ON t.topicid = s.topic WHERE s.ihome = '0' ".$querylang." ORDER BY s.time DESC LIMIT 0,10";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result, SQL_ASSOC))
{
$rsid = $row['sid'];
$raid = $row['aid'];
$rtitle = htmlspecialchars(stripslashes($row['title']));
$rtime = $row['time'];
$rcomments = $row['comments'];
$topictext = $row['topictext'];
$topicimage = ($row['ticon']) ? stripslashes($row['topicimage']) : '';
$rtime = formatTimestamp($rtime, 'l, F d');
$content .= "%%\n".$rtitle."\n/modules.php?name=Blog&file=article&sid=".$rsid."\n".$rtime."\n".$raid."\n".$topictext."\n".$rcomments."\n".$topicimage."\n";
}
$db->sql_freeresult($result);
if (file_exists(NUKE_BASE_DIR."ultramode.txt") && is_writable(NUKE_BASE_DIR."ultramode.txt"))
{
$file = fopen(NUKE_BASE_DIR."ultramode.txt", "w");
fwrite($file, "General purpose self-explanatory file with news headlines\n".$content);
fclose($file);
}
else
{
global $debugger;
$debugger->handle_error('Unable to write ultramode content to file', 'Error');
}
}
// Adds slashes to string and strips PHP+HTML for SQL insertion and hack prevention
// $str: the string to modify
// $nohtml: strip PHP+HTML tags, false=no, true=yes, default=false
function Fix_Quotes($str, $nohtml=false) {
global $db;
//If there is not supposed to be HTML
if ($nohtml) $str = strip_tags($str);
// Quote if not integer
/*if (!is_numeric($str)) {
$str = str_replace('%27', "'", $str);
$str = $db->sql_addq($str);
}*/
return $str;
}
function Remove_Slashes($str) {
static $magic_quotes;
if (!isset($magic_quotes)) $magic_quotes = get_magic_quotes_gpc();
if ($magic_quotes) $str = stripslashes($str);
return $str;
}
function check_words($message) {
global $censor_words, $censor;
if(empty($message)) {
return '';
}
if($censor == 0 || empty($censor_words)) {
return $message;
}
$censor_words = trim($censor_words);
$words = explode(' ', $censor_words);
for($i=0, $j = count($words);$i < $j;$i++){
$word = trim($words[$i]);
$replace = str_repeat('*', strlen($word));
if($censor == 1) {
$message = preg_replace('/\b'.$word.'\b/i', $replace, $message);
} else if($censor == 2) {
$message = preg_replace('/'.$word.'/i', $replace, $message);
}
}
return $message;
}
function check_html($str, $strip='') {
/*****[BEGIN]******************************************
[ Base: PHP Input Filter v1.2.2 ]
******************************************************/
if(defined('INPUT_FILTER')) {
if ($strip == 'nohtml') {
global $AllowableHTML;
}
if (!is_array($AllowableHTML)) {
$html = '';
} else {
$html = '';
foreach($AllowableHTML as $type => $key) {
if($key == 1) {
$html[] = $type;
}
}
}
$html_filter = new InputFilter($html, "", 0, 0, 1);
$str = $html_filter->process($str);
} else {
/*****[END]********************************************
[ Base: PHP Input Filter v1.2.2 ]
******************************************************/
$str = Fix_Quotes($str, !empty($strip));
/*****[BEGIN]******************************************
[ Base: PHP Input Filter v1.2.2 ]
******************************************************/
}
/*****[END]********************************************