/
cms.php
1354 lines (1208 loc) · 30.7 KB
/
cms.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
/**
* The main file of CMSimple_XH.
*
* @category CMSimple_XH
* @package XH
* @author Peter Harteg <peter@harteg.dk>
* @author The CMSimple_XH developers <devs@cmsimple-xh.org>
* @copyright 1999-2009 Peter Harteg
* @copyright 2009-2017 The CMSimple_XH developers <http://cmsimple-xh.org/?The_Team>
* @license http://www.gnu.org/licenses/gpl-3.0.en.html GNU GPLv3
* @link http://cmsimple-xh.org/
*/
/*
======================================
@CMSIMPLE_XH_VERSION@, @CMSIMPLE_XH_BUILD@
@CMSIMPLE_XH_DATE@
based on CMSimple version 3.3 - December 31. 2009
For changelog, downloads and information please see http://www.cmsimple-xh.org/
======================================
[Please note: URLs in the following Copyright Notice are either void or
lead to different information as Mr. Harteg sold the code and website
in Nov. 2012. Of the four mentioned licenses only the first (GPL 3)
applies to CMSimple_XH.]
-- COPYRIGHT INFORMATION START --
CMSimple version 3.3 - December 31. 2009
Small - simple - smart
(c) 1999-2009 Peter Andreas Harteg - peter@harteg.dk
-- COPYRIGHT INFORMATION END --
-- LICENCE TYPES SECTION START --
CMSimple is available under four different licenses:
1) GPL 3
From December 31. 2009 CMSimple is released under the GPL 3 licence with no
link requirments. You may not remove copyright information from the files, and
any modifications will fall under the copyleft conditions in the GPL 3.
2) AGPL 3
You must keep a convenient and prominently visible feature on every generated
page that displays the CMSimple Legal Notices. The required link to the
CMSimple Legal Notices must be static, visible and readable, and the text in
the CMSimple Legal Notices may not be altered. See
http://www.cmsimple.org/?Licence:CMSimple_Legal_Notices
3) Linkware / CMSimple Link Requirement Licence
Same as AGPL, but instead of keeping a link to the CMSimple Legal Notices, you
must place a static, visible and readable link to www.cmsimple.org with the
text or an image stating "Powered by CMSimple" on every generated page (place
it in the template). See
http://www.cmsimple.org/?Licence:CMSimple_Link_Requirement_Licence
4) Commercial Licence
This licence will allow you to remove the CMSimple Legal Notices / "Powered by
CMSimple"-link at one specific domain. This licence will also protect your
modifications against the copyleft requirements in AGPL 3 and give access to
registering in user support forum.
You may change this LICENCE TYPES SECTION to relevant information, if you have
purchased a commercial licence, but then the files may not be distributed to
any other domain not covered by a commercial licence.
For further informaion about the licence types, please see
http://www.cmsimple.org/?Licence and /cmsimple/legal.txt
-- LICENCE TYPES SECTION END --
======================================
*/
// prevent direct access
if (preg_match('/cms.php/i', $_SERVER['PHP_SELF'])) {
die('Access Denied');
}
/**
* The separator for urichar_org/new.
*
* @since 1.6
*/
define('XH_URICHAR_SEPARATOR', '|');
/**
* The title of the current page.
*
* This <i>read-write</i> variable can be used to set the page title in the
* plugin administration and for special extension pages.
*
* @global string $title
*
* @access public
*/
$title = '';
/**
* The HTML for the contents area.
*
* This <i>read-write</i> variable is used to buffer the output, which is
* prepended to the contents of the current page (if any). Usually you will
* only append to this variable.
*
* @global string $o
*
* @access public
*/
$o = '';
/**
* The HTML for the <li>s holding error messages.
*
* This <i>read-write</i> variable can be used to add error messages above the
* content. Usually you will only append to this variable.
*
* @global string $e
*
* @access public
*
* @see e()
*/
$e = '';
/**
* HTML that will be inserted to the <head> section.
*
* This <i>read-write</i> variable can be used to add script, style, meta and link
* elements etc. to the head element. Usually you will only append to this variable.
*
* @global string $hjs
*
* @access public
*
* @see $bjs
*/
$hjs = '';
/**
* HTML that will be inserted right before the </body> tag.
*
* This <i>read-write</i> variable can be used to add script elements to the end
* of the body element. Usually you will only append to this variable.
*
* @global string $bjs
*
* @access public
*
* @see $hjs
*
* @link http://www.cmsimple-xh.org/wiki/doku.php/plugin_interfaces#bjs
*
* @since 1.5.4
*/
$bjs = '';
/**
* JavaScript for the onload attribute of the body element.
*
* This <i>read-write</i> variable can be used to register window onload event
* handlers. Usually you will only append to this variable.
*
* @global string $onload
*
* @access public
*/
$onload = '';
/**
* A temporary value.
*
* This <i>read-write</i> variable can be used to avoid polluting the global scope.
*
* @global mixed $temp
*
* @access public
*/
$temp = null;
/**
* A temporary (loop) value.
*
* This <i>read-write</i> variable can be used to avoid polluting the global scope.
*
* @global mixed $i
*
* @access public
*/
$i = null;
/**
* A temporary (loop) value.
*
* This <i>read-write</i> variable can be used to avoid polluting the global scope.
*
* @global mixed $j
*
* @access public
*/
$j = null;
/**
* The version in textual representation, e.g. CMSimple_XH 1.6
*/
define('CMSIMPLE_XH_VERSION', '@CMSIMPLE_XH_VERSION@');
/**
* The build number as integer: YYYYMMDDBB
*/
define('CMSIMPLE_XH_BUILD', '@CMSIMPLE_XH_BUILD@');
/**
* The release date in ISO 8601 format: YYYY-MM-DD
*/
define('CMSIMPLE_XH_DATE', '@CMSIMPLE_XH_DATE@');
/**
* A two dimensional array that holds the paths of important files and folders.
*
* Should be treated as <i>read-only</i>.
*
* @global array $pth
*
* @access public
*
* @link http://www.cmsimple-xh.org/wiki/doku.php/core_variables#pth
*/
$pth = array();
$pth['file']['execute'] = './index.php';
$pth['folder']['base'] = is_dir('./cmsimple') ? './' : '../';
$pth['folder']['cmsimple'] = $pth['folder']['base'] . 'cmsimple/';
$pth['folder']['classes'] = $pth['folder']['cmsimple'] . 'classes/';
$pth['folder']['plugins'] = $pth['folder']['base'] . 'plugins/';
$pth['file']['log'] = $pth['folder']['cmsimple'] . 'log.txt';
$pth['file']['cms'] = $pth['folder']['cmsimple'] . 'cms.php';
$pth['file']['config'] = $pth['folder']['cmsimple'] . 'config.php';
// include general utility functions and classes
require_once $pth['folder']['cmsimple'] . 'functions.php';
spl_autoload_register('XH_autoload');
require_once $pth['folder']['cmsimple'] . 'tplfuncs.php';
require_once $pth['folder']['cmsimple'] . 'utf8.php';
if (!function_exists('password_hash') || !function_exists('random_bytes')) {
include_once $pth['folder']['cmsimple'] . 'password.php';
}
/**
* The controller.
*
* @var XH\Controller
*
* @access private
*/
$_XH_controller = new XH\Controller();
/**
* The configuration of the core.
*
* Should be treated as <i>read-only</i>.
*
* @global array $cf
*
* @access public
*
* @see $plugin_cf
*/
$cf = XH_readConfiguration();
if (!$cf) {
die("Config file {$pth['file']['config']} missing");
}
// removed from the core in XH 1.6, but left for compatibility with plugins.
$cf['security']['type'] = 'page';
$cf['scripting']['regexp'] = '#CMSimple (.*?)#';
// removed from the core in XH 1.7, but left for compatibility with extensions
$cf['xhtml']['endtags'] = '';
$cf['xhtml']['amp'] = 'true';
foreach (array('userfiles', 'downloads', 'images', 'media') as $temp) {
// for compatibility with older version's config files
if (!isset($cf['folders'][$temp])) {
$cf['folders'][$temp] = $temp != 'media' ? "$temp/" : 'downloads/';
}
if ($temp == 'userfiles') {
$pth['folder'][$temp] = $pth['folder']['base'] . $cf['folders'][$temp];
} else {
$pth['folder'][$temp] = $pth['folder']['userfiles'] . $cf['folders'][$temp];
}
}
$pth['folder']['flags'] = $pth['folder']['images'] . 'flags/';
if ($cf['site']['compat']) {
include_once $pth['folder']['cmsimple'] . 'compat.php';
}
/**
* Debug output generated by PHP according to debug mode.
*
* @global array $errors
*
* @access private
*/
$errors = array();
xh_debugmode();
$pth['folder']['language'] = $pth['folder']['cmsimple'] . 'languages/';
if (!isset($cf['folders']['content'])) {
$cf['folders']['content'] = 'content/';
}
if ($cf['site']['timezone'] !== '' && function_exists('date_default_timezone_set')) {
date_default_timezone_set($cf['site']['timezone']);
}
/**
* The current language.
*
* This <i>read-only</i> variable contains an ISO 639-1 language code.
*
* @global string $sl
*
* @access public
*/
if (preg_match('/\/([A-z]{2})\/index.php$/', sv('SCRIPT_NAME'), $temp)
&& XH_isLanguageFolder($temp = strtolower($temp[1]))
) {
$sl = $temp;
$pth['folder']['content']
= $pth['folder']['base'] . $cf['folders']['content'] . $sl . '/';
} else {
$sl = $cf['language']['default'];
$pth['folder']['content'] = $pth['folder']['base'] . $cf['folders']['content'];
}
$pth['file']['content'] = $pth['folder']['content'] . 'content.htm';
$pth['file']['pagedata'] = $pth['folder']['content'] . 'pagedata.php';
$pth['file']['language'] = $pth['folder']['language'] . basename($sl) . '.php';
$pth['folder']['corestyle'] = $pth['folder']['base'] . 'assets/css/';
$pth['file']['corestyle'] = $pth['folder']['corestyle'] . 'core.css';
$pth['file']['adminjs'] = $pth['folder']['base'] . 'assets/js/admin.min.js';
XH_createLanguageFile($pth['file']['language']);
/**
* The localization of the core.
*
* Should be treated as <i>read-only</i>.
*
* @global array $tx
*
* @access public
*
* @see $plugin_tx
*/
$tx = XH_readConfiguration(false, true);
if (!$tx) {
die("Language file {$pth['file']['language']} missing");
}
if ($tx['locale']['all'] != '') {
setlocale(LC_ALL, $tx['locale']['all']);
}
/*
* Register shutdown handler.
*/
register_shutdown_function('XH_onShutdown');
// removed from the core in XH 1.6, but left for compatibility with plugins.
$tx['meta']['codepage']='UTF-8';
/**
* The language configuration.
*
* @global array $txc
*
* @access public
*
* @deprecated since 1.6 (use $cf resp. $tx instead).
*/
$txc = array('template' => $tx['template']);
$_XH_controller->initTemplatePaths();
/*
* Additional security measure. However, we can neither check cookies,
* as these might be set from non UTF-8 scripts on the domain, nor server
* variables (<http://cmsimpleforum.com/viewtopic.php?f=10&t=8052>).
*/
XH_checkValidUtf8(
array($_GET, $_POST, array_keys($_POST))
);
/**
* Whether the webserver is IIS.
*
* Should be treated as <i>read-only</i>.
*
* @access public
*
* @global bool $iis
*/
$iis = strpos(sv('SERVER_SOFTWARE'), "IIS");
/**
* Whether PHP is executed as (F)CGI.
*
* Should be treated as <i>read-only</i>.
*
* @access public
*
* @global bool $cgi
*/
$cgi = (php_sapi_name() == 'cgi' || php_sapi_name() == 'cgi-fcgi');
/**
* The relative path of the root folder, i.e. the script name.
*
* Should be treated as <i>read-only</i>.
*
* @global string $sn
*
* @access public
*
* @see CMSIMPLE_URL
*/
$sn = preg_replace('/([^\?]*)\?.*/', '$1', sv(($iis ? 'SCRIPT_NAME' : 'REQUEST_URI')));
/**
* The requested plugin administration part.
*
* This <i>read-only</i> variable is initialized from an <var>admin</var>
* GET/POST parameter, and is usually used in combination with
* {@link $action} to request some functionality of a plugin back-end.
*
* @global string $admin
*
* @access public
*/
$admin = null;
/**
* The requested action.
*
* This <i>read-only</i> variable is initialized from an <var>action</var>
* GET/POST parameter, and is usually used in combination with
* {@link $admin} to request some functionality of a plugin back-end.
*
* @global string $action
*
* @access public
*/
$action = null;
/**
* The requested function.
*
* This variable is set from a <var>function</var> GET/POST parameter, which
* denotes some special functionality. If set from your extension treat it as
* <i>read-write</i>; otherwise ignore it.
*
* @global string $function
*
* @access public
*/
$function = null;
/**
* Whether login is requested.
*
* This variable is initialized from a <var>login</var> GET/POST parameter.
* If the login has been successful, {@link $f} == 'login'; otherwise {@link $f}
* == 'xh_login_failed'.
*
* @global string $login
*
* @access private
*/
$login = null;
/**
* The admin password.
*
* This variable is initialized from a <var>keycut</var> GET/POST parameter.
*
* This variable has been renamed from <var>$passwd</var> since CMSimple_XH 1.6
* to avoid trouble with mod_security.
*
* @global string $keycut
*
* @access private
*/
$keycut = null;
/**
* Whether logout is requested.
*
* This variable is initialized from a <var>logout</var> GET/POST parameter.
* On logout {@link $f} == 'xh_loggedout'.
*
* @global string $logout
*
* @access private
*/
$logout = null;
/**
* Whether the mailform is requested.
*
* This variable is initialized from a <var>mailform</var> GET/POST parameter.
* If the mailform has been requested {@link $f} == 'mailform'.
*
* @global string $mailform
*
* @access private
*/
$mailform = null;
/**
* The filename requested for download.
*
* This variable is initialized from a <var>download</var> GET/POST parameter.
*
* @global string $download
*
* @access private
*/
$download = null;
/**
* Whether the file browser is requested to show the download folder.
*
* This variable is initialized from a <var>downloads</var> GET/POST parameter,
* and should only be used by file browsers and similar extensions, which may
* treat it as <i>read-write</i>.
*
* @global string $downloads
*
* @access public
*/
$downloads = null;
/**
* Whether the file browser is requested to show the image folder.
*
* This variable is initialized from a <var>images</var> GET/POST parameter,
* and should only be used by file browsers and similar extensions, which may
* treat it as <i>read-write</i>.
*
* @global string $images
*
* @access public
*/
$images = null;
/**
* Whether the file browser is requested to show the media folder.
*
* This variable is initialized from a <var>media</var> GET/POST parameter,
* and should only be used by file browsers and similar extensions, which may
* treat it as <i>read-write</i>.
*
* @global string $media
*
* @access public
*/
$media = null;
/**
* Whether the file browser is requested to show the userfiles folder.
*
* This variable is initialized from a <var>userfiles</var> GET/POST parameter,
* and should only be used by file browsers and similar extensions, which may
* treat it as <i>read-write</i>.
*
* @global string $userfiles
*
* @access public
*/
$userfiles = null;
/**
* Whether edit mode is requested.
*
* This <i>read-only</i> variable is initialized from a <var>edit</var>
* GET/POST parameter or the <var>mode</var> cookie. If you want to switch to
* edit or view mode, you should set the <var>edit</var> GET parameter.
*
* @global string $edit
*
* @access public
*
* @see $normal
*/
$edit = null;
/**
* Whether normal mode is requested.
*
* This <i>read-only</i> variable is initialized from a <var>normal</var>
* GET/POST parameter or the <var>mode</var> cookie. If you want to switch to
* edit or view mode, you should set the <var>normal</var> GET parameter.
*
* @global string $normal
*
* @access public
*
* @see $edit
*/
$normal = null;
/**
* Whether print mode is requested.
*
* This <i>read-only</i> variable is initialized from a <var>print</var> GET/POST
* parameter.
*
* @global string $print
*
* @access public
*/
$print = null;
/**
* The name of a special file to be handled in the back-end.
*
* This variable is initialized from a <var>file</var> GET/POST parameter.
*
* @global string $file
*
* @access private
*/
$file = null;
/**
* The current search string.
*
* This <i>read-only</i> variable is initialized from a <var>search</var>
* GET/POST parameter.
*
* @global string $search
*
* @access public
*/
$search = null;
/**
* The URL of the requested page.
*
* This variable is initialized from a <var>selected</var> GET/POST parameter.
* If present {@link $su} is set accordingly.
*
* @global string $selected
*
* @access private
*/
$selected = null;
/**
* Whether the settings page is requested.
*
* This variable is initialized from a <var>settings</var> GET/POST parameter.
*
* @global string $settings
*
* @access private
*/
$settings = null;
/**
* Whether the sitemap is requested.
*
* This variable is initialized from a <var>sitemap</var> GET/POST parameter.
* If the sitemap is requested {@link $f} == 'sitemap'.
*
* @global string $sitemap
*
* @access private
*/
$sitemap = null;
/**
* The text of the editor on save.
*
* This variable is initialized from a <var>text</var> GET/POST parameter.
*
* @global string $text
*
* @access private
*/
$text = null;
/**
* Whether the link check is requested.
*
* This variable is initialized from a <var>validate</var> GET/POST parameter.
*
* @global string $validate
*
* @access private
*/
$validate = null;
/**
* Whether the page manager is requested.
*
* This variable is initialized from a <var>xhpages</var> GET/POST parameter,
* and should only be used by page managers, which may treat it as
* <i>read-write</i>.
*
* @global string $xhpages
*
* @access public
*
* @link http://www.cmsimple-xh.org/wiki/doku.php/plugin_interfaces#page_managers
*/
$xhpages = null;
$temp = array(
'action', 'admin', 'download', 'downloads', 'edit', 'file', 'function', 'images',
'login', 'logout', 'keycut', 'mailform', 'media', 'normal', 'phpinfo', 'print', 'search',
'selected', 'settings', 'sitemap', 'sysinfo', 'text', 'userfiles', 'validate', 'xhpages',
'xh_backups', 'xh_change_password', 'xh_do_validate', 'xh_pagedata', 'xh_plugins'
);
foreach ($temp as $i) {
if (!isset($GLOBALS[$i])) {
if (isset($_GET[$i])) {
$GLOBALS[$i] = $_GET[$i];
} elseif (isset($_POST[$i])) {
$GLOBALS[$i] = $_POST[$i];
} else {
$GLOBALS[$i] = '';
}
}
}
/**
* The absolute path of the root folder.
*/
define('CMSIMPLE_ROOT', XH_getRootFolder());
/**
* The relative path of the root folder.
*/
define('CMSIMPLE_BASE', $pth['folder']['base']);
/**
* The fully qualified absolute URL of the installation (main or current language).
*
* @since 1.6
*
* @see $sn
*/
define(
'CMSIMPLE_URL',
'http'
. (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '')
. '://' . $_SERVER['HTTP_HOST'] . $sn
);
/**
* The current page's URL (selected URL).
*
* Should be treated as <i>read-only</i>.
*
* @global string $su
*
* @access public
*
* @see $selected
* @see $u
*/
$su = '';
if (sv('QUERY_STRING') != '') {
$j = explode('&', sv('QUERY_STRING'));
if (!strpos($j[0], '=')) {
$su = $j[0];
}
if ($su == '' && $selected != '') {
if (isset($_GET['selected'])) {
header('Location: ' . XH_redirectSelectedUrl(), true, 301);
exit;
} else {
$su = $selected;
}
}
foreach ($j as $i) {
if (!strpos($i, '=') && in_array($i, $temp)) {
$GLOBALS[$i] = 'true';
}
}
} else {
$su = $selected;
}
if (!isset($cf['uri']['length'])) {
$cf['uri']['length'] = 200;
}
$su = utf8_substr($su, 0, $cf['uri']['length']);
if ($download != '') {
download($pth['folder']['downloads'] . basename(stsl($download)));
}
$pth['file']['search'] = $pth['folder']['cmsimple'] . 'search.php';
$pth['file']['mailform'] = $pth['folder']['cmsimple'] . 'mailform.php';
/**
* Whether admin mode is active.
*
* This variable is strictly <i>read-only</i>.
*
* @global bool $adm
*
* @access public
*
* @see XH_ADM
*/
$adm = 0;
/**
* The requested function.
*
* This <i>read-write</i> variable is initialized from different GET/POST
* parameters. Usually you will want to treat it as <i>read-only</i> or even as
* <i>private</i>.
*
* @global string $f
*
* @access public
*/
$f = '';
/**
* The plugin menu builder.
*
* @global XH\ClassicPluginMenu $_XH_pluginMenu
*
* @access private
*/
$_XH_pluginMenu = new XH\ClassicPluginMenu();
/**
* The currently loaded plugin.
*
* Should be treated as <i>read-only</i>.
*
* @global string $plugin
*
* @access public
*/
$plugin = null;
/*
* Include required_classes of all plugins.
*/
foreach (XH_plugins() as $plugin) {
pluginFiles($plugin);
if (is_readable($pth['file']['plugin_classes'])) {
include_once $pth['file']['plugin_classes'];
}
}
/**
* The CRSF protection object.
*
* Should be treated as <i>read-only</i>.
*
* @global XH\CSRFProtection $_XH_csrfProtection
*
* @access public
*
* @tutorial CSRFProtection.cls
*/
$_XH_csrfProtection = null;
if (isset($_COOKIE['status']) && $_COOKIE['status'] == 'adm'
|| isset($_POST['keycut'])
) {
$_XH_csrfProtection = new XH\CSRFProtection();
}
$_XH_controller->handleLoginAndLogout();
/**
* Whether admin mode is active.
*
* @since 1.5.4
*
* @link http://www.cmsimple-xh.org/wiki/doku.php/plugin_interfaces#xh_adm
*
* @see $adm
*/
define('XH_ADM', $adm);
if (XH_ADM) {
include_once $pth['folder']['cmsimple'] . 'adminfuncs.php';
if (isset($_GET['xh_keep_alive'])) {
$_XH_controller->handleKeepAlive();
}
$_XH_controller->outputAdminScripts();
}
$_XH_controller->setFunctionsAsPermitted();
/**
* The number of pages.
*
* Treat as <i>read-only</i>.
*
* @global int $cl
*
* @access public
*/
$cl = 0;
/**
* The page data router.
*
* Treat as <i>read-only</i>.
*
* @global XH\PageDataRouter $pd_router
*
* @access public
*/
$pd_router = null;
/**
* The publisher instance.
*
* @global int $xh_publisher
*
* @access public
*
* @since 1.7.0
*/
$xh_publisher = null;
/**
* The index of the currently requested page.
*
* Treat as <i>read-only</i>. Note that $s is not properly set for the start
* page until all plugins are loaded. If you need the know the index of the
* currently requested page during plugin loading, consider to use {@link $pd_s}.
*
* @global int $s
*
* @access public
*/
$s = -1;
/**
* The content of the pages.
*
* Treat as <i>read-only</i> when in edit mode.
*
* @global array $c
*
* @access public
*/
$c = null;
/**
* The headings of the pages.
*
* Treat as <i>read-only</i>.
*
* @global array $h
*
* @access public
*
* @see h()
*/
$h = null;
/**
* The URLs of the pages.
*
* Treat as <i>read-only</i>.
*
* @global array $u
*
* @access public
*
* @see $su
*/
$u = null;
/**
* The menu levels of the pages.
*
* Treat as <i>read-only</i>.
*
* @global array $l
*
* @access public
*
* @see l()