-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Admin.template.php
1698 lines (1500 loc) · 60.8 KB
/
Admin.template.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
/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2022 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1.0
*/
/**
* This is the administration center home.
*/
function template_admin()
{
global $context, $scripturl, $txt, $modSettings;
// Is there an update available?
echo '
<div id="update_section"></div>';
echo '
<div id="admin_main_section">';
// Show the user additional information
echo '
<div class="admin_tabs">
<ul class="buttonlist" role="tablist" id="admin_tabs" aria-orientation="vertical">
<li role="presentation">
<button type="button" id="admin_welcome_tab" class="active" role="tab" data-bs-toggle="pill" data-bs-target="#admin_welcome" aria-selected="true" aria-controls="admin_welcome" >', $txt['home'], '</button>
</li>
<li role="presentation">
<button type="button" id="admin_support_tab" role="tab" data-bs-toggle="pill" data-bs-target="#admin_support" aria-selected="false" aria-controls="admin_support" >', $txt['support_title'], '</button>
</li>
<li role="presentation">
<button type="button" id="admin_live_tab" role="tab" data-bs-toggle="pill" data-bs-target="#admin_live" aria-selected="false" aria-controls="admin_live" >', $txt['live'], '</button>
</li>
<li role="presentation">
<button type="button" id="admin_theme_info" role="tab" data-bs-toggle="pill" data-bs-target="#theme_information" aria-selected="false" aria-controls="theme_information" >', $txt['st_theme_information'], '</button>
</li>
</ul>
<div class="windowbg tab-content" id="admin_tabsContent">';
// Show the admin center description
echo '
<div id="admin_welcome" class="tab-pane fade show active" role="tabpanel" aria-labelledby="admin_welcome_tab">
<div class="padding">
', $context[$context['admin_menu_name']]['tab_data']['description'], '
</div>
</div>';
// Show the user version information from their server.
echo '
<div id="admin_support" class="tab-pane fade show" role="tabpanel" aria-labelledby="admin_support_tab">
<div id="version_details" class="padding">
<strong>', $txt['support_versions'], ':</strong><br>
', $txt['support_versions_forum'], ':
<em id="yourVersion">', $context['forum_version'], '</em><br>
', $txt['support_versions_current'], ':
<em id="smfVersion">??</em><br>
', $context['can_admin'] ? '<a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br>';
// Display all the members who can administrate the forum.
echo '
<br>
<strong>', $txt['administrators'], ':</strong>
', implode(', ', $context['administrators']);
// If we have lots of admins... don't show them all.
if (!empty($context['more_admins_link']))
echo '
(', $context['more_admins_link'], ')';
echo '
</div><!-- #version_details -->
</div>';
// Display the "live news" from simplemachines.org.
echo '
<div id="admin_live" class="tab-pane fade" role="tabpanel" aria-labelledby="admin_live_tab">
<div id="smfAnnouncements">', $txt['smf_news_cant_connect'], '</div>
</div>';
// Show the theme information
echo '
<div id="theme_information" class="tab-pane fade" role="tabpanel" aria-labelledby="admin_theme_info">
', themecustoms_themeinfo(),'
</div>
</div>
</div>
<div class="admin_areas">';
foreach ($context[$context['admin_menu_name']]['sections'] as $area_id => $area)
{
echo '
<strong>', $area['title'], '</strong>
<div class="section" id="group_', $area_id, '">';
foreach ($area['areas'] as $item_id => $item)
{
// No point showing the 'home' page here, we're already on it!
if ($area_id == 'forum' && $item_id == 'index')
continue;
$url = isset($item['url']) ? $item['url'] : $scripturl . '?action=admin;area=' . $item_id . (!empty($context[$context['admin_menu_name']]['extra_parameters']) ? $context[$context['admin_menu_name']]['extra_parameters'] : '');
echo '
<a href="', $url, '"', !empty($item['inactive']) ? ' class="inactive"' : '', '>
<span class="windowbg">
', !empty($item['icon_file']) ? '<img class="large_admin_menu_icon_file" src="' . $item['icon_file'] . '" alt="">' : '<span class="main_icons ' . $item['icon_class'] . ' large"></span>', '
</span>
<span class="text-label">', $item['label'], '</span>
</a>';
}
echo '
</div>';
}
echo '
</div><!-- .admin_areas -->
</div><!-- #admin_main_section -->';
// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
if (empty($modSettings['disable_smf_js']))
echo '
<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
// This sets the announcements and current versions themselves ;).
echo '
<script>
var oAdminIndex = new smf_AdminIndex({
sSelf: \'oAdminCenter\',
bLoadAnnouncements: true,
sAnnouncementTemplate: ', JavaScriptEscape('
<dl>
%content%
</dl>
'), ',
sAnnouncementMessageTemplate: ', JavaScriptEscape('
<dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt>
<dd>
%message%
</dd>
'), ',
sAnnouncementContainerId: \'smfAnnouncements\',
bLoadVersions: true,
sSmfVersionContainerId: \'smfVersion\',
sYourVersionContainerId: \'yourVersion\',
sVersionOutdatedTemplate: ', JavaScriptEscape('
<span class="alert">%currentVersion%</span>
'), ',
bLoadUpdateNotification: true,
sUpdateNotificationContainerId: \'update_section\',
sUpdateNotificationDefaultTitle: ', JavaScriptEscape($txt['update_available']), ',
sUpdateNotificationDefaultMessage: ', JavaScriptEscape($txt['update_message']), ',
sUpdateNotificationTemplate: ', JavaScriptEscape('
<h3 id="update_title">
%title%
</h3>
<div id="update_message" class="smalltext">
%message%
</div>
'), ',
sUpdateNotificationLink: smf_scripturl + ', JavaScriptEscape('?action=admin;area=packages;pgdownload;auto;package=%package%;' . $context['session_var'] . '=' . $context['session_id']), '
});
</script>';
}
/**
* Show some support information and credits to those who helped make this.
*/
function template_credits()
{
global $context, $settings, $scripturl, $txt;
// Show the user version information from their server.
echo '
<div class="roundframe noup">
<div class="title_bar">
<h3 class="titlebg">
', $txt['support_title'], '
</h3>
</div>
<div class="padding">
<img src="', $settings['images_url'], '/smflogo.svg" class="floatright" alt="">
<strong>', $txt['support_versions'], ':</strong><br>
', $txt['support_versions_forum'], ':
<em id="yourVersion">', $context['forum_version'], '</em>', $context['can_admin'] ? ' <a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br>
', $txt['support_versions_current'], ':
<em id="smfVersion">??</em><br>';
// Display all the variables we have server information for.
foreach ($context['current_versions'] as $version)
{
echo '
', $version['title'], ':
<em>', $version['version'], '</em>';
// more details for this item, show them a link
if ($context['can_admin'] && isset($version['more']))
echo
' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>';
echo '
<br>';
}
echo '
</div><!-- .padding -->';
// Point the admin to common support resources.
echo '
<div id="support_resources" class="title_bar">
<h3 class="titlebg">
', $txt['support_resources'], '
</h3>
</div>
<div class="padding">
<p>', $txt['support_resources_p1'], '</p>
<p>', $txt['support_resources_p2'], '</p>
</div>';
// The most important part - the credits :P.
echo '
<div id="credits_sections" class="title_bar">
<h3 class="titlebg">
', $txt['admin_credits'], '
</h3>
</div>
<div id="support_credits_list" class="padding">';
foreach ($context['credits'] as $section)
{
if (isset($section['pretext']))
echo '
<p>', $section['pretext'], '</p>
<hr>';
echo '
<dl>';
foreach ($section['groups'] as $group)
{
if (isset($group['title']))
echo '
<dt>
<strong>', $group['title'], ':</strong>
</dt>';
echo '
<dd>', implode(', ', $group['members']), '</dd>';
}
echo '
</dl>';
if (isset($section['posttext']))
echo '
<hr>
<p>', $section['posttext'], '</p>';
}
echo '
</div><!-- .padding -->
</div><!-- #support_credits -->';
// This makes all the support information available to the support script...
echo '
<script>
var smfSupportVersions = {};
smfSupportVersions.forum = "', $context['forum_version'], '";';
// Don't worry, none of this is logged, it's just used to give information that might be of use.
foreach ($context['current_versions'] as $variable => $version)
echo '
smfSupportVersions.', $variable, ' = "', $version['version'], '";';
// Now we just have to include the script and wait ;).
echo '
</script>
<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
// This sets the latest support stuff.
echo '
<script>
function smfCurrentVersion()
{
var smfVer, yourVer;
if (!window.smfVersion)
return;
smfVer = document.getElementById("smfVersion");
yourVer = document.getElementById("yourVersion");
setInnerHTML(smfVer, window.smfVersion);
var currentVersion = getInnerHTML(yourVer);
if (currentVersion != window.smfVersion)
setInnerHTML(yourVer, "<span class=\"alert\">" + currentVersion + "</span>");
}
addLoadEvent(smfCurrentVersion)
</script>';
}
/**
* Displays information about file versions installed, and compares them to current version.
*/
function template_view_versions()
{
global $context, $scripturl, $txt;
echo '
<div id="section_header" class="cat_bar">
<h3 class="catbg">
', $txt['admin_version_check'], '
</h3>
</div>
<div class="information">', $txt['version_check_desc'], '</div>
<div id="versions">
<table class="table_grid">
<thead>
<tr class="title_bar">
<th class="half_table">
<strong>', $txt['admin_smffile'], '</strong>
</th>
<th class="quarter_table">
<strong>', $txt['dvc_your'], '</strong>
</th>
<th class="quarter_table">
<strong>', $txt['dvc_current'], '</strong>
</th>
</tr>
</thead>
<tbody>';
// The current version of the core SMF package.
echo '
<tr class="windowbg">
<td class="half_table">
', $txt['admin_smfpackage'], '
</td>
<td class="quarter_table">
<em id="yourSMF">', $context['forum_version'], '</em>
</td>
<td class="quarter_table">
<em id="currentSMF">??</em>
</td>
</tr>';
// Now list all the source file versions, starting with the overall version (if all match!).
echo '
<tr class="windowbg">
<td class="half_table">
<a href="#" id="Sources-link">', $txt['dvc_sources'], '</a>
</td>
<td class="quarter_table">
<em id="yourSources">??</em>
</td>
<td class="quarter_table">
<em id="currentSources">??</em>
</td>
</tr>
</tbody>
</table>
<table id="Sources" class="table_grid">
<tbody>';
// Loop through every source file displaying its version - using javascript.
foreach ($context['file_versions'] as $filename => $version)
echo '
<tr class="windowbg">
<td class="half_table">
', $filename, '
</td>
<td class="quarter_table">
<em id="yourSources', $filename, '">', $version, '</em>
</td>
<td class="quarter_table">
<em id="currentSources', $filename, '">??</em>
</td>
</tr>';
// Default template files.
echo '
</tbody>
</table>
<table class="table_grid">
<tbody>
<tr class="windowbg">
<td class="half_table">
<a href="#" id="Default-link">', $txt['dvc_default'], '</a>
</td>
<td class="quarter_table">
<em id="yourDefault">??</em>
</td>
<td class="quarter_table">
<em id="currentDefault">??</em>
</td>
</tr>
</tbody>
</table>
<table id="Default" class="table_grid">
<tbody>';
foreach ($context['default_template_versions'] as $filename => $version)
echo '
<tr class="windowbg">
<td class="half_table">
', $filename, '
</td>
<td class="quarter_table">
<em id="yourDefault', $filename, '">', $version, '</em>
</td>
<td class="quarter_table">
<em id="currentDefault', $filename, '">??</em>
</td>
</tr>';
// Now the language files...
echo '
</tbody>
</table>
<table class="table_grid">
<tbody>
<tr class="windowbg">
<td class="half_table">
<a href="#" id="Languages-link">', $txt['dvc_languages'], '</a>
</td>
<td class="quarter_table">
<em id="yourLanguages">??</em>
</td>
<td class="quarter_table">
<em id="currentLanguages">??</em>
</td>
</tr>
</tbody>
</table>
<table id="Languages" class="table_grid">
<tbody>';
foreach ($context['default_language_versions'] as $language => $files)
{
foreach ($files as $filename => $version)
echo '
<tr class="windowbg">
<td class="half_table">
', $filename, '.<em>', $language, '</em>.php
</td>
<td class="quarter_table">
<em id="your', $filename, '.', $language, '">', $version, '</em>
</td>
<td class="quarter_table">
<em id="current', $filename, '.', $language, '">??</em>
</td>
</tr>';
}
echo '
</tbody>
</table>';
// Display the version information for the currently selected theme - if it is not the default one.
if (!empty($context['template_versions']))
{
echo '
<table class="table_grid">
<tbody>
<tr class="windowbg">
<td class="half_table">
<a href="#" id="Templates-link">', $txt['dvc_templates'], '</a>
</td>
<td class="quarter_table">
<em id="yourTemplates">??</em>
</td>
<td class="quarter_table">
<em id="currentTemplates">??</em>
</td>
</tr>
</tbody>
</table>
<table id="Templates" class="table_grid">
<tbody>';
foreach ($context['template_versions'] as $filename => $version)
echo '
<tr class="windowbg">
<td class="half_table">
', $filename, '
</td>
<td class="quarter_table">
<em id="yourTemplates', $filename, '">', $version, '</em>
</td>
<td class="quarter_table">
<em id="currentTemplates', $filename, '">??</em>
</td>
</tr>';
echo '
</tbody>
</table>';
}
// Display the tasks files version.
if (!empty($context['tasks_versions']))
{
echo '
<table class="table_grid">
<tbody>
<tr class="windowbg">
<td class="half_table">
<a href="#" id="Tasks-link">', $txt['dvc_tasks'], '</a>
</td>
<td class="quarter_table">
<em id="yourTasks">??</em>
</td>
<td class="quarter_table">
<em id="currentTasks">??</em>
</td>
</tr>
</tbody>
</table>
<table id="Tasks" class="table_grid">
<tbody>';
foreach ($context['tasks_versions'] as $filename => $version)
echo '
<tr class="windowbg">
<td class="half_table">
', $filename, '
</td>
<td class="quarter_table">
<em id="yourTasks', $filename, '">', $version, '</em>
</td>
<td class="quarter_table">
<em id="currentTasks', $filename, '">??</em>
</td>
</tr>';
echo '
</tbody>
</table>';
}
echo '
</div><!-- #versions -->';
/* Below is the hefty javascript for this. Upon opening the page it checks the current file versions with ones
held at simplemachines.org and works out if they are up to date. If they aren't it colors that files number
red. It also contains the function, swapOption, that toggles showing the detailed information for each of the
file categories. (sources, languages, and templates.) */
echo '
<script src="', $scripturl, '?action=viewsmfile;filename=detailed-version.js"></script>
<script>
var oViewVersions = new smf_ViewVersions({
aKnownLanguages: [
\'.', implode('\',
\'.', $context['default_known_languages']), '\'
],
oSectionContainerIds: {
Sources: \'Sources\',
Default: \'Default\',
Languages: \'Languages\',
Templates: \'Templates\',
Tasks: \'Tasks\'
}
});
</script>';
}
/**
* Form for stopping people using naughty words, etc.
*/
function template_edit_censored()
{
global $context, $scripturl, $txt, $modSettings;
if (!empty($context['saved_successful']))
echo '
<div class="infobox">', $txt['settings_saved'], '</div>';
// First section is for adding/removing words from the censored list.
echo '
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=postsettings;sa=censor" method="post" accept-charset="', $context['character_set'], '">
<div id="section_header" class="cat_bar">
<h3 class="catbg">
', $txt['admin_censored_words'], '
</h3>
</div>
<div class="windowbg">
<p>', $txt['admin_censored_where'], '</p>';
// Show text boxes for censoring [bad ] => [good ].
foreach ($context['censored_words'] as $vulgar => $proper)
echo '
<div class="block">
<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30">
</div>';
// Now provide a way to censor more words.
echo '
<div class="block">
<input type="text" name="censor_vulgar[]" size="30"> => <input type="text" name="censor_proper[]" size="30">
</div>
<div id="moreCensoredWords"></div>
<div class="block hidden" id="moreCensoredWords_link">
<a class="button" href="#" onclick="addNewWord(); return false;">', $txt['censor_clickadd'], '</a><br>
</div>
<script>
document.getElementById("moreCensoredWords_link").classList.remove(\'hidden\');
</script>
<hr>
<dl class="settings">
<dt>
<strong><label for="allow_no_censored">', $txt['allow_no_censored'], ':</label></strong>
</dt>
<dd>
<input type="checkbox" name="allow_no_censored" value="1" id="allow_no_censored"', empty($modSettings['allow_no_censored']) ? '' : ' checked', '>
</dd>
<dt>
<strong><label for="censorWholeWord_check">', $txt['censor_whole_words'], ':</label></strong>
</dt>
<dd>
<input type="checkbox" name="censorWholeWord" value="1" id="censorWholeWord_check"', empty($modSettings['censorWholeWord']) ? '' : ' checked', '>
</dd>
<dt>
<strong><label for="censorIgnoreCase_check">', $txt['censor_case'], ':</label></strong>
</dt>
<dd>
<input type="checkbox" name="censorIgnoreCase" value="1" id="censorIgnoreCase_check"', empty($modSettings['censorIgnoreCase']) ? '' : ' checked', '>
</dd>
</dl>
<input type="submit" name="save_censor" value="', $txt['save'], '" class="button">
</div><!-- .windowbg -->';
// This table lets you test out your filters by typing in rude words and seeing what comes out.
echo '
<div class="cat_bar">
<h3 class="catbg">
', $txt['censor_test'], '
</h3>
</div>
<div class="windowbg">
<p class="centertext">
<input type="text" name="censortest" value="', empty($context['censor_test']) ? '' : $context['censor_test'], '">
<input type="submit" value="', $txt['censor_test_save'], '" class="button">
</p>
</div>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="', $context['admin-censor_token_var'], '" value="', $context['admin-censor_token'], '">
</form>';
}
/**
* This is the page shown when we've temporarily paused things such as during maintenance tasks, sending newsletters, etc.
*/
function template_not_done()
{
global $context, $txt, $scripturl;
echo '
<div id="section_header" class="cat_bar">
<h3 class="catbg">
', $txt['not_done_title'], '
</h3>
</div>
<div class="windowbg">
', $txt['not_done_reason'];
if (!empty($context['continue_percent']))
echo '
<div class="progress_bar">
<span>', $context['continue_percent'], '%</span>
<div class="bar" style="width: ', $context['continue_percent'], '%;"></div>
</div>';
if (!empty($context['substep_enabled']))
echo '
<div class="progress_bar progress_blue">
<span>', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</span>
<div class="bar" style="width: ', $context['substep_continue_percent'], '%;"></div>
</div>';
echo '
<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">';
// Do we have a token?
if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var']))
echo '
<input type="hidden" name="', $context[$context['not_done_token'] . '_token_var'], '" value="', $context[$context['not_done_token'] . '_token'], '">';
echo '
<input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button">
', $context['continue_post_data'], '
</form>
</div><!-- .windowbg -->
<script>
var countdown = ', $context['continue_countdown'], ';
doAutoSubmit();
function doAutoSubmit()
{
if (countdown == 0)
document.forms.autoSubmit.submit();
else if (countdown == -1)
return;
document.forms.autoSubmit.cont.value = "', $txt['not_done_continue'], ' (" + countdown + ")";
countdown--;
setTimeout("doAutoSubmit();", 1000);
}
</script>';
}
/**
* Template for showing settings (Of any kind really!)
*/
function template_show_settings()
{
global $context, $txt, $scripturl;
if (!empty($context['saved_successful']))
echo '
<div class="infobox">', $txt['settings_saved'], '</div>';
elseif (!empty($context['saved_failed']))
echo '
<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>';
if (!empty($context['settings_pre_javascript']))
echo '
<script>', $context['settings_pre_javascript'], '</script>';
if (!empty($context['settings_insert_above']))
echo $context['settings_insert_above'];
echo '
<form id="admin_form_wrapper" action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
// Is there a custom title?
if (isset($context['settings_title']))
echo '
<div class="cat_bar">
<h3 class="catbg">', $context['settings_title'], '</h3>
</div>';
// Have we got a message to display?
if (!empty($context['settings_message']))
{
$tag = !empty($context['settings_message']['tag']) ? $context['settings_message']['tag'] : 'span';
echo '
<div class="information noup">';
if (is_array($context['settings_message']))
echo '
<', $tag, !empty($context['settings_message']['class']) ? ' class="' . $context['settings_message']['class'] . '"' : '', '>
', $context['settings_message']['label'], '
</', $tag, '>';
else
echo $context['settings_message'];
echo '
</div>';
}
// Filter out any redundant separators before we start the loop
$context['config_vars'] = array_filter(
$context['config_vars'],
function ($v) use ($context)
{
static $config_vars, $prev;
$at_start = is_null($config_vars);
$config_vars = $at_start ? $context['config_vars'] : $config_vars;
$next = next($config_vars);
$at_end = key($config_vars) === null;
if (!$at_start && !$at_end)
{
$div_types = array('title', 'desc');
$at_start = isset($prev['type']) && in_array($prev['type'], $div_types);
$at_end = isset($next['type']) && in_array($next['type'], $div_types);
}
$prev = $v;
return ($v === '' && ($at_start || $at_end || $v === $next)) ? false : true;
}
);
// Now actually loop through all the variables.
$is_open = false;
foreach ($context['config_vars'] as $config_var)
{
// Is it a title or a description?
if (is_array($config_var) && ($config_var['type'] == 'title' || $config_var['type'] == 'desc'))
{
// Not a list yet?
if ($is_open)
{
$is_open = false;
echo '
</dl>
</div>';
}
// A title?
if ($config_var['type'] == 'title')
{
echo '
<div class="cat_bar">
<h3 class="', !empty($config_var['class']) ? $config_var['class'] : 'catbg', '"', !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>
', ($config_var['help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $config_var['help'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="main_icons help" title="' . $txt['help'] . '"></span></a>' : ''), '
', $config_var['label'], '
</h3>
</div>';
}
// A description?
else
{
echo '
<div class="information noup">
', $config_var['label'], '
</div>';
}
continue;
}
// Not a list yet?
if (!$is_open)
{
$is_open = true;
echo '
<div class="windowbg noup">
<dl class="settings">';
}
// Hang about? Are you pulling my leg - a callback?!
if (is_array($config_var) && $config_var['type'] == 'callback')
{
if (function_exists('template_callback_' . $config_var['name']))
call_user_func('template_callback_' . $config_var['name']);
continue;
}
if (is_array($config_var))
{
// First off, is this a span like a message?
if (in_array($config_var['type'], array('message', 'warning')))
{
echo '
<dd', $config_var['type'] == 'warning' ? ' class="alert"' : '', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>
', $config_var['label'], '
</dd>';
}
// Otherwise it's an input box of some kind.
else
{
echo '
<dt', is_array($config_var) && !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>';
// Some quick helpers...
$javascript = $config_var['javascript'];
$disabled = !empty($config_var['disabled']) ? ' disabled' : '';
$subtext = !empty($config_var['subtext']) ? '<br><span class="smalltext"> ' . $config_var['subtext'] . '</span>' : '';
// Various HTML5 input types that are basically enhanced textboxes
$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time');
// Show the [?] button.
if ($config_var['help'])
echo '
<a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="main_icons help" title="', $txt['help'], '"></span></a> ';
echo '
<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label', ($config_var['type'] == 'boards' || $config_var['type'] == 'permissions' ? '' : ' for="' . $config_var['name'] . '"'), '>', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
</dt>
<dd', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>',
$config_var['preinput'];
// Show a check box.
if ($config_var['type'] == 'check')
echo '
<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">';
// Escape (via htmlspecialchars.) the text box.
elseif ($config_var['type'] == 'password')
echo '
<input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;"><br>
<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>';
// Show a selection box.
elseif ($config_var['type'] == 'select')
{
echo '
<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), ' size="', $config_var['size'], '">';
foreach ($config_var['data'] as $option)
echo '
<option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';
echo '
</select>';
}
// List of boards? This requires getBoardList() having been run and the results in $context['board_list'].
elseif ($config_var['type'] == 'boards')
{
$first = true;
echo '
<a href="#" class="board_selector">[ ', $txt['select_boards_from_list'], ' ]</a>
<fieldset>
<legend class="board_selector">
<a href="#">', $txt['select_boards_from_list'], '</a>
</legend>';
foreach ($context['board_list'] as $id_cat => $cat)
{
if (!$first)
echo '
<hr>';
echo '
<strong>', $cat['name'], '</strong>
<ul>';
foreach ($cat['boards'] as $id_board => $brd)
echo '
<li><label><input type="checkbox" name="', $config_var['name'], '[', $brd['id'], ']" value="1"', in_array($brd['id'], $config_var['value']) ? ' checked' : '', '> ', $brd['child_level'] > 0 ? str_repeat(' ', $brd['child_level']) : '', $brd['name'], '</label></li>';
echo '
</ul>';
$first = false;
}
echo '
<hr />
<input type="checkbox" onclick="invertAll(this, this.form, \'' . $config_var['name'] . '[\');">
<span>', $txt['check_all'], '</span>
</fieldset>';
}
// Text area?
elseif ($config_var['type'] == 'large_text')
echo '
<textarea rows="', (!empty($config_var['size']) ? $config_var['size'] : (!empty($config_var['rows']) ? $config_var['rows'] : 4)), '" cols="', (!empty($config_var['cols']) ? $config_var['cols'] : 30), '" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
// Permission group?
elseif ($config_var['type'] == 'permissions')
theme_inline_permissions($config_var['name']);
// BBC selection?
elseif ($config_var['type'] == 'bbc')
{
echo '
<fieldset id="', $config_var['name'], '">
<legend>', $context['bbc_sections'][$config_var['name']]['title'], '</legend>
<ul>';
foreach ($context['bbc_sections'][$config_var['name']]['columns'] as $bbcColumn)
{
foreach ($bbcColumn as $bbcTag)
echo '
<li class="list_bbc floatleft">
<input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked' : '', '> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqOverlayDiv(this.href);">?</a>)' : '', '
</li>';
}
echo ' </ul>
<input type="checkbox" id="bbc_', $config_var['name'], '_select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked' : '', '> <label for="bbc_', $config_var['name'], '_select_all"><em>', $txt['enabled_bbc_select_all'], '</em></label>
</fieldset>';
}
// A simple message?
elseif ($config_var['type'] == 'var_message')
echo '
<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>
', $config_var['var_message'], '
</div>';
// Assume it must be a text box
else
{
// Figure out the exact type - use "number" for "float" and "int".
$type = in_array($config_var['type'], $text_types) ? $config_var['type'] : ($config_var['type'] == 'int' || $config_var['type'] == 'float' ? 'number' : 'text');
// Extra options for float/int values - how much to decrease/increase by, the min value and the max value
// The step - only set if incrementing by something other than 1 for int or 0.1 for float
$step = isset($config_var['step']) ? ' step="' . $config_var['step'] . '"' : ($config_var['type'] == 'float' ? ' step="0.1"' : '');