1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Simple Machines Forum (SMF) |
4
|
|
|
* |
5
|
|
|
* @package SMF |
6
|
|
|
* @author Simple Machines http://www.simplemachines.org |
7
|
|
|
* @copyright 2018 Simple Machines and individual contributors |
8
|
|
|
* @license http://www.simplemachines.org/about/smf/license.php BSD |
9
|
|
|
* |
10
|
|
|
* @version 2.1 Beta 4 |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* This is the administration center home. |
15
|
|
|
*/ |
16
|
|
|
function template_admin() |
17
|
|
|
{ |
18
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
|
|
|
19
|
|
|
|
20
|
|
|
// Welcome message for the admin. |
21
|
|
|
echo ' |
22
|
|
|
<div id="admincenter">'; |
23
|
|
|
|
24
|
|
|
// Is there an update available? |
25
|
|
|
echo ' |
26
|
|
|
<div id="update_section"></div>'; |
27
|
|
|
|
28
|
|
|
echo ' |
29
|
|
|
<div id="admin_main_section">'; |
30
|
|
|
|
31
|
|
|
// Display the "live news" from simplemachines.org. |
32
|
|
|
echo ' |
33
|
|
|
<div id="live_news" class="floatleft"> |
34
|
|
|
<div class="cat_bar"> |
35
|
|
|
<h3 class="catbg"> |
36
|
|
|
<a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> ', $txt['live'], ' |
37
|
|
|
</h3> |
38
|
|
|
</div> |
39
|
|
|
<div class="windowbg nopadding"> |
40
|
|
|
<div id="smfAnnouncements">', $txt['lfyi'], '</div> |
41
|
|
|
</div> |
42
|
|
|
</div>'; |
43
|
|
|
|
44
|
|
|
// Show the user version information from their server. |
45
|
|
|
echo ' |
46
|
|
|
<div id="supportVersionsTable" class="floatright"> |
47
|
|
|
<div class="cat_bar"> |
48
|
|
|
<h3 class="catbg"> |
49
|
|
|
<a href="', $scripturl, '?action=admin;area=credits">', $txt['support_title'], '</a> |
50
|
|
|
</h3> |
51
|
|
|
</div> |
52
|
|
|
<div class="windowbg nopadding"> |
53
|
|
|
<div id="version_details" class="padding"> |
54
|
|
|
<strong>', $txt['support_versions'], ':</strong><br> |
55
|
|
|
', $txt['support_versions_forum'], ': |
56
|
|
|
<em id="yourVersion">', $context['forum_version'], '</em><br> |
57
|
|
|
', $txt['support_versions_current'], ': |
58
|
|
|
<em id="smfVersion">??</em><br> |
59
|
|
|
', $context['can_admin'] ? '<a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br>'; |
60
|
|
|
|
61
|
|
|
// Display all the members who can administrate the forum. |
62
|
|
|
echo ' |
63
|
|
|
<br> |
64
|
|
|
<strong>', $txt['administrators'], ':</strong> |
65
|
|
|
', implode(', ', $context['administrators']); |
66
|
|
|
|
67
|
|
|
// If we have lots of admins... don't show them all. |
68
|
|
|
if (!empty($context['more_admins_link'])) |
69
|
|
|
echo ' |
70
|
|
|
(', $context['more_admins_link'], ')'; |
71
|
|
|
|
72
|
|
|
echo ' |
73
|
|
|
</div><!-- #version_details --> |
74
|
|
|
</div><!-- .windowbg --> |
75
|
|
|
</div><!-- #supportVersionsTable --> |
76
|
|
|
</div><!-- #admin_main_section -->'; |
77
|
|
|
|
78
|
|
|
foreach ($context[$context['admin_menu_name']]['sections'] as $area_id => $area) |
79
|
|
|
{ |
80
|
|
|
echo ' |
81
|
|
|
<fieldset id="group_', $area_id, '" class="windowbg admin_group"> |
82
|
|
|
<legend>', $area['title'], '</legend>'; |
83
|
|
|
|
84
|
|
|
foreach ($area['areas'] as $item_id => $item) |
85
|
|
|
{ |
86
|
|
|
// No point showing the 'home' page here, we're already on it! |
87
|
|
|
if ($area_id == 'forum' && $item_id == 'index') |
88
|
|
|
continue; |
89
|
|
|
|
90
|
|
|
$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'] : ''); |
91
|
|
|
|
92
|
|
|
if (!empty($item['icon_file'])) |
93
|
|
|
echo ' |
94
|
|
|
<a href="', $url, '" class="admin_group', !empty($item['inactive']) ? ' inactive' : '', '"><img class="large_admin_menu_icon_file" src="', $item['icon_file'], '" alt="">', $item['label'], '</a>'; |
95
|
|
|
else |
96
|
|
|
echo ' |
97
|
|
|
<a href="', $url, '"><span class="large_', $item['icon_class'], !empty($item['inactive']) ? ' inactive' : '', '"></span>', $item['label'], '</a>'; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
echo ' |
101
|
|
|
</fieldset>'; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
echo ' |
105
|
|
|
</div><!-- #admincenter -->'; |
106
|
|
|
|
107
|
|
|
// The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization. |
108
|
|
|
if (empty($modSettings['disable_smf_js'])) |
109
|
|
|
echo ' |
110
|
|
|
<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
111
|
|
|
<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
112
|
|
|
|
113
|
|
|
// This sets the announcements and current versions themselves ;). |
114
|
|
|
echo ' |
115
|
|
|
<script> |
116
|
|
|
var oAdminIndex = new smf_AdminIndex({ |
117
|
|
|
sSelf: \'oAdminCenter\', |
118
|
|
|
|
119
|
|
|
bLoadAnnouncements: true, |
120
|
|
|
sAnnouncementTemplate: ', JavaScriptEscape(' |
121
|
|
|
<dl> |
122
|
|
|
%content% |
123
|
|
|
</dl> |
124
|
|
|
'), ', |
125
|
|
|
sAnnouncementMessageTemplate: ', JavaScriptEscape(' |
126
|
|
|
<dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt> |
127
|
|
|
<dd> |
128
|
|
|
%message% |
129
|
|
|
</dd> |
130
|
|
|
'), ', |
131
|
|
|
sAnnouncementContainerId: \'smfAnnouncements\', |
132
|
|
|
|
133
|
|
|
bLoadVersions: true, |
134
|
|
|
sSmfVersionContainerId: \'smfVersion\', |
135
|
|
|
sYourVersionContainerId: \'yourVersion\', |
136
|
|
|
sVersionOutdatedTemplate: ', JavaScriptEscape(' |
137
|
|
|
<span class="alert">%currentVersion%</span> |
138
|
|
|
'), ', |
139
|
|
|
|
140
|
|
|
bLoadUpdateNotification: true, |
141
|
|
|
sUpdateNotificationContainerId: \'update_section\', |
142
|
|
|
sUpdateNotificationDefaultTitle: ', JavaScriptEscape($txt['update_available']), ', |
143
|
|
|
sUpdateNotificationDefaultMessage: ', JavaScriptEscape($txt['update_message']), ', |
144
|
|
|
sUpdateNotificationTemplate: ', JavaScriptEscape(' |
145
|
|
|
<h3 id="update_title"> |
146
|
|
|
%title% |
147
|
|
|
</h3> |
148
|
|
|
<div id="update_message" class="smalltext"> |
149
|
|
|
%message% |
150
|
|
|
</div> |
151
|
|
|
'), ', |
152
|
|
|
sUpdateNotificationLink: smf_scripturl + ', JavaScriptEscape('?action=admin;area=packages;pgdownload;auto;package=%package%;' . $context['session_var'] . '=' . $context['session_id']), ' |
153
|
|
|
}); |
154
|
|
|
</script>'; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Show some support information and credits to those who helped make this. |
159
|
|
|
*/ |
160
|
|
|
function template_credits() |
161
|
|
|
{ |
162
|
|
|
global $context, $settings, $scripturl, $txt; |
|
|
|
|
163
|
|
|
|
164
|
|
|
// Show the user version information from their server. |
165
|
|
|
echo ' |
166
|
|
|
|
167
|
|
|
<div id="admincenter"> |
168
|
|
|
<div id="support_credits" class="roundframe"> |
169
|
|
|
<div class="sub_bar"> |
170
|
|
|
<h3 class="subbg"> |
171
|
|
|
', $txt['support_title'], ' <img src="', $settings['images_url'], '/smflogo.svg" id="credits_logo" alt=""> |
172
|
|
|
</h3> |
173
|
|
|
</div> |
174
|
|
|
<div class="padding"> |
175
|
|
|
<strong>', $txt['support_versions'], ':</strong><br> |
176
|
|
|
', $txt['support_versions_forum'], ': |
177
|
|
|
<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> |
178
|
|
|
', $txt['support_versions_current'], ': |
179
|
|
|
<em id="smfVersion">??</em><br>'; |
180
|
|
|
|
181
|
|
|
// Display all the variables we have server information for. |
182
|
|
|
foreach ($context['current_versions'] as $version) |
183
|
|
|
{ |
184
|
|
|
echo ' |
185
|
|
|
', $version['title'], ': |
186
|
|
|
<em>', $version['version'], '</em>'; |
187
|
|
|
|
188
|
|
|
// more details for this item, show them a link |
189
|
|
|
if ($context['can_admin'] && isset($version['more'])) |
190
|
|
|
echo |
191
|
|
|
' <a href="', $scripturl, $version['more'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['version_check_more'], '</a>'; |
192
|
|
|
echo ' |
193
|
|
|
<br>'; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
echo ' |
197
|
|
|
</div><!-- .padding -->'; |
198
|
|
|
|
199
|
|
|
// Point the admin to common support resources. |
200
|
|
|
echo ' |
201
|
|
|
<div id="support_resources" class="sub_bar"> |
202
|
|
|
<h3 class="subbg"> |
203
|
|
|
', $txt['support_resources'], ' |
204
|
|
|
</h3> |
205
|
|
|
</div> |
206
|
|
|
<div class="padding"> |
207
|
|
|
<p>', $txt['support_resources_p1'], '</p> |
208
|
|
|
<p>', $txt['support_resources_p2'], '</p> |
209
|
|
|
</div>'; |
210
|
|
|
|
211
|
|
|
// The most important part - the credits :P. |
212
|
|
|
echo ' |
213
|
|
|
<div id="credits_sections" class="sub_bar"> |
214
|
|
|
<h3 class="subbg"> |
215
|
|
|
', $txt['admin_credits'], ' |
216
|
|
|
</h3> |
217
|
|
|
</div> |
218
|
|
|
<div class="padding">'; |
219
|
|
|
|
220
|
|
|
foreach ($context['credits'] as $section) |
221
|
|
|
{ |
222
|
|
|
if (isset($section['pretext'])) |
223
|
|
|
echo ' |
224
|
|
|
<p>', $section['pretext'], '</p> |
225
|
|
|
<hr>'; |
226
|
|
|
|
227
|
|
|
echo ' |
228
|
|
|
<dl>'; |
229
|
|
|
|
230
|
|
|
foreach ($section['groups'] as $group) |
231
|
|
|
{ |
232
|
|
|
if (isset($group['title'])) |
233
|
|
|
echo ' |
234
|
|
|
<dt> |
235
|
|
|
<strong>', $group['title'], ':</strong> |
236
|
|
|
</dt>'; |
237
|
|
|
|
238
|
|
|
echo ' |
239
|
|
|
<dd>', implode(', ', $group['members']), '</dd>'; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
echo ' |
243
|
|
|
</dl>'; |
244
|
|
|
|
245
|
|
|
if (isset($section['posttext'])) |
246
|
|
|
echo ' |
247
|
|
|
<hr> |
248
|
|
|
<p>', $section['posttext'], '</p>'; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
echo ' |
252
|
|
|
</div><!-- .padding --> |
253
|
|
|
</div><!-- #support_credits --> |
254
|
|
|
</div><!-- #admincenter -->'; |
255
|
|
|
|
256
|
|
|
// This makes all the support information available to the support script... |
257
|
|
|
echo ' |
258
|
|
|
<script> |
259
|
|
|
var smfSupportVersions = {}; |
260
|
|
|
|
261
|
|
|
smfSupportVersions.forum = "', $context['forum_version'], '";'; |
262
|
|
|
|
263
|
|
|
// Don't worry, none of this is logged, it's just used to give information that might be of use. |
264
|
|
|
foreach ($context['current_versions'] as $variable => $version) |
265
|
|
|
echo ' |
266
|
|
|
smfSupportVersions.', $variable, ' = "', $version['version'], '";'; |
267
|
|
|
|
268
|
|
|
// Now we just have to include the script and wait ;). |
269
|
|
|
echo ' |
270
|
|
|
</script> |
271
|
|
|
<script src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script> |
272
|
|
|
<script src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>'; |
273
|
|
|
|
274
|
|
|
// This sets the latest support stuff. |
275
|
|
|
echo ' |
276
|
|
|
<script> |
277
|
|
|
function smfCurrentVersion() |
278
|
|
|
{ |
279
|
|
|
var smfVer, yourVer; |
280
|
|
|
|
281
|
|
|
if (!window.smfVersion) |
282
|
|
|
return; |
283
|
|
|
|
284
|
|
|
smfVer = document.getElementById("smfVersion"); |
285
|
|
|
yourVer = document.getElementById("yourVersion"); |
286
|
|
|
|
287
|
|
|
setInnerHTML(smfVer, window.smfVersion); |
288
|
|
|
|
289
|
|
|
var currentVersion = getInnerHTML(yourVer); |
290
|
|
|
if (currentVersion != window.smfVersion) |
291
|
|
|
setInnerHTML(yourVer, "<span class=\"alert\">" + currentVersion + "</span>"); |
292
|
|
|
} |
293
|
|
|
addLoadEvent(smfCurrentVersion) |
294
|
|
|
</script>'; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* Displays information about file versions installed, and compares them to current version. |
299
|
|
|
*/ |
300
|
|
|
function template_view_versions() |
301
|
|
|
{ |
302
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
303
|
|
|
|
304
|
|
|
echo ' |
305
|
|
|
<div id="admincenter"> |
306
|
|
|
<div id="section_header" class="cat_bar"> |
307
|
|
|
<h3 class="catbg"> |
308
|
|
|
', $txt['admin_version_check'], ' |
309
|
|
|
</h3> |
310
|
|
|
</div> |
311
|
|
|
<div class="information">', $txt['version_check_desc'], '</div> |
312
|
|
|
<div id="versions"> |
313
|
|
|
<table class="table_grid"> |
314
|
|
|
<thead> |
315
|
|
|
<tr class="title_bar"> |
316
|
|
|
<th class="half_table"> |
317
|
|
|
<strong>', $txt['admin_smffile'], '</strong> |
318
|
|
|
</th> |
319
|
|
|
<th class="quarter_table"> |
320
|
|
|
<strong>', $txt['dvc_your'], '</strong> |
321
|
|
|
</th> |
322
|
|
|
<th class="quarter_table"> |
323
|
|
|
<strong>', $txt['dvc_current'], '</strong> |
324
|
|
|
</th> |
325
|
|
|
</tr> |
326
|
|
|
</thead> |
327
|
|
|
<tbody>'; |
328
|
|
|
|
329
|
|
|
// The current version of the core SMF package. |
330
|
|
|
echo ' |
331
|
|
|
<tr class="windowbg"> |
332
|
|
|
<td class="half_table"> |
333
|
|
|
', $txt['admin_smfpackage'], ' |
334
|
|
|
</td> |
335
|
|
|
<td class="quarter_table"> |
336
|
|
|
<em id="yourSMF">', $context['forum_version'], '</em> |
337
|
|
|
</td> |
338
|
|
|
<td class="quarter_table"> |
339
|
|
|
<em id="currentSMF">??</em> |
340
|
|
|
</td> |
341
|
|
|
</tr>'; |
342
|
|
|
|
343
|
|
|
// Now list all the source file versions, starting with the overall version (if all match!). |
344
|
|
|
echo ' |
345
|
|
|
<tr class="windowbg"> |
346
|
|
|
<td class="half_table"> |
347
|
|
|
<a href="#" id="Sources-link">', $txt['dvc_sources'], '</a> |
348
|
|
|
</td> |
349
|
|
|
<td class="quarter_table"> |
350
|
|
|
<em id="yourSources">??</em> |
351
|
|
|
</td> |
352
|
|
|
<td class="quarter_table"> |
353
|
|
|
<em id="currentSources">??</em> |
354
|
|
|
</td> |
355
|
|
|
</tr> |
356
|
|
|
</tbody> |
357
|
|
|
</table> |
358
|
|
|
|
359
|
|
|
<table id="Sources" class="table_grid"> |
360
|
|
|
<tbody>'; |
361
|
|
|
|
362
|
|
|
// Loop through every source file displaying its version - using javascript. |
363
|
|
|
foreach ($context['file_versions'] as $filename => $version) |
364
|
|
|
echo ' |
365
|
|
|
<tr class="windowbg"> |
366
|
|
|
<td class="half_table"> |
367
|
|
|
', $filename, ' |
368
|
|
|
</td> |
369
|
|
|
<td class="quarter_table"> |
370
|
|
|
<em id="yourSources', $filename, '">', $version, '</em> |
371
|
|
|
</td> |
372
|
|
|
<td class="quarter_table"> |
373
|
|
|
<em id="currentSources', $filename, '">??</em> |
374
|
|
|
</td> |
375
|
|
|
</tr>'; |
376
|
|
|
|
377
|
|
|
// Default template files. |
378
|
|
|
echo ' |
379
|
|
|
</tbody> |
380
|
|
|
</table> |
381
|
|
|
|
382
|
|
|
<table class="table_grid"> |
383
|
|
|
<tbody> |
384
|
|
|
<tr class="windowbg"> |
385
|
|
|
<td class="half_table"> |
386
|
|
|
<a href="#" id="Default-link">', $txt['dvc_default'], '</a> |
387
|
|
|
</td> |
388
|
|
|
<td class="quarter_table"> |
389
|
|
|
<em id="yourDefault">??</em> |
390
|
|
|
</td> |
391
|
|
|
<td class="quarter_table"> |
392
|
|
|
<em id="currentDefault">??</em> |
393
|
|
|
</td> |
394
|
|
|
</tr> |
395
|
|
|
</tbody> |
396
|
|
|
</table> |
397
|
|
|
|
398
|
|
|
<table id="Default" class="table_grid"> |
399
|
|
|
<tbody>'; |
400
|
|
|
|
401
|
|
|
foreach ($context['default_template_versions'] as $filename => $version) |
402
|
|
|
echo ' |
403
|
|
|
<tr class="windowbg"> |
404
|
|
|
<td class="half_table"> |
405
|
|
|
', $filename, ' |
406
|
|
|
</td> |
407
|
|
|
<td class="quarter_table"> |
408
|
|
|
<em id="yourDefault', $filename, '">', $version, '</em> |
409
|
|
|
</td> |
410
|
|
|
<td class="quarter_table"> |
411
|
|
|
<em id="currentDefault', $filename, '">??</em> |
412
|
|
|
</td> |
413
|
|
|
</tr>'; |
414
|
|
|
|
415
|
|
|
// Now the language files... |
416
|
|
|
echo ' |
417
|
|
|
</tbody> |
418
|
|
|
</table> |
419
|
|
|
|
420
|
|
|
<table class="table_grid"> |
421
|
|
|
<tbody> |
422
|
|
|
<tr class="windowbg"> |
423
|
|
|
<td class="half_table"> |
424
|
|
|
<a href="#" id="Languages-link">', $txt['dvc_languages'], '</a> |
425
|
|
|
</td> |
426
|
|
|
<td class="quarter_table"> |
427
|
|
|
<em id="yourLanguages">??</em> |
428
|
|
|
</td> |
429
|
|
|
<td class="quarter_table"> |
430
|
|
|
<em id="currentLanguages">??</em> |
431
|
|
|
</td> |
432
|
|
|
</tr> |
433
|
|
|
</tbody> |
434
|
|
|
</table> |
435
|
|
|
|
436
|
|
|
<table id="Languages" class="table_grid"> |
437
|
|
|
<tbody>'; |
438
|
|
|
|
439
|
|
|
foreach ($context['default_language_versions'] as $language => $files) |
440
|
|
|
{ |
441
|
|
|
foreach ($files as $filename => $version) |
442
|
|
|
echo ' |
443
|
|
|
<tr class="windowbg"> |
444
|
|
|
<td class="half_table"> |
445
|
|
|
', $filename, '.<em>', $language, '</em>.php |
446
|
|
|
</td> |
447
|
|
|
<td class="quarter_table"> |
448
|
|
|
<em id="your', $filename, '.', $language, '">', $version, '</em> |
449
|
|
|
</td> |
450
|
|
|
<td class="quarter_table"> |
451
|
|
|
<em id="current', $filename, '.', $language, '">??</em> |
452
|
|
|
</td> |
453
|
|
|
</tr>'; |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
echo ' |
457
|
|
|
</tbody> |
458
|
|
|
</table>'; |
459
|
|
|
|
460
|
|
|
// Display the version information for the currently selected theme - if it is not the default one. |
461
|
|
View Code Duplication |
if (!empty($context['template_versions'])) |
462
|
|
|
{ |
463
|
|
|
echo ' |
464
|
|
|
<table class="table_grid"> |
465
|
|
|
<tbody> |
466
|
|
|
<tr class="windowbg"> |
467
|
|
|
<td class="half_table"> |
468
|
|
|
<a href="#" id="Templates-link">', $txt['dvc_templates'], '</a> |
469
|
|
|
</td> |
470
|
|
|
<td class="quarter_table"> |
471
|
|
|
<em id="yourTemplates">??</em> |
472
|
|
|
</td> |
473
|
|
|
<td class="quarter_table"> |
474
|
|
|
<em id="currentTemplates">??</em> |
475
|
|
|
</td> |
476
|
|
|
</tr> |
477
|
|
|
</tbody> |
478
|
|
|
</table> |
479
|
|
|
|
480
|
|
|
<table id="Templates" class="table_grid"> |
481
|
|
|
<tbody>'; |
482
|
|
|
|
483
|
|
|
foreach ($context['template_versions'] as $filename => $version) |
484
|
|
|
echo ' |
485
|
|
|
<tr class="windowbg"> |
486
|
|
|
<td class="half_table"> |
487
|
|
|
', $filename, ' |
488
|
|
|
</td> |
489
|
|
|
<td class="quarter_table"> |
490
|
|
|
<em id="yourTemplates', $filename, '">', $version, '</em> |
491
|
|
|
</td> |
492
|
|
|
<td class="quarter_table"> |
493
|
|
|
<em id="currentTemplates', $filename, '">??</em> |
494
|
|
|
</td> |
495
|
|
|
</tr>'; |
496
|
|
|
|
497
|
|
|
echo ' |
498
|
|
|
</tbody> |
499
|
|
|
</table>'; |
500
|
|
|
} |
501
|
|
|
|
502
|
|
|
// Display the tasks files version. |
503
|
|
View Code Duplication |
if (!empty($context['tasks_versions'])) |
504
|
|
|
{ |
505
|
|
|
echo ' |
506
|
|
|
<table class="table_grid"> |
507
|
|
|
<tbody> |
508
|
|
|
<tr class="windowbg"> |
509
|
|
|
<td class="half_table"> |
510
|
|
|
<a href="#" id="Tasks-link">', $txt['dvc_tasks'], '</a> |
511
|
|
|
</td> |
512
|
|
|
<td class="quarter_table"> |
513
|
|
|
<em id="yourTasks">??</em> |
514
|
|
|
</td> |
515
|
|
|
<td class="quarter_table"> |
516
|
|
|
<em id="currentTasks">??</em> |
517
|
|
|
</td> |
518
|
|
|
</tr> |
519
|
|
|
</tbody> |
520
|
|
|
</table> |
521
|
|
|
|
522
|
|
|
<table id="Tasks" class="table_grid"> |
523
|
|
|
<tbody>'; |
524
|
|
|
|
525
|
|
|
foreach ($context['tasks_versions'] as $filename => $version) |
526
|
|
|
echo ' |
527
|
|
|
<tr class="windowbg"> |
528
|
|
|
<td class="half_table"> |
529
|
|
|
', $filename, ' |
530
|
|
|
</td> |
531
|
|
|
<td class="quarter_table"> |
532
|
|
|
<em id="yourTasks', $filename, '">', $version, '</em> |
533
|
|
|
</td> |
534
|
|
|
<td class="quarter_table"> |
535
|
|
|
<em id="currentTasks', $filename, '">??</em> |
536
|
|
|
</td> |
537
|
|
|
</tr>'; |
538
|
|
|
|
539
|
|
|
echo ' |
540
|
|
|
</tbody> |
541
|
|
|
</table>'; |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
echo ' |
545
|
|
|
</div><!-- #versions --> |
546
|
|
|
</div><!-- #admincenter -->'; |
547
|
|
|
|
548
|
|
|
/* Below is the hefty javascript for this. Upon opening the page it checks the current file versions with ones |
549
|
|
|
held at simplemachines.org and works out if they are up to date. If they aren't it colors that files number |
550
|
|
|
red. It also contains the function, swapOption, that toggles showing the detailed information for each of the |
551
|
|
|
file categories. (sources, languages, and templates.) */ |
552
|
|
|
echo ' |
553
|
|
|
<script src="', $scripturl, '?action=viewsmfile;filename=detailed-version.js"></script> |
554
|
|
|
<script> |
555
|
|
|
var oViewVersions = new smf_ViewVersions({ |
556
|
|
|
aKnownLanguages: [ |
557
|
|
|
\'.', implode('\', |
558
|
|
|
\'.', $context['default_known_languages']), '\' |
559
|
|
|
], |
560
|
|
|
oSectionContainerIds: { |
561
|
|
|
Sources: \'Sources\', |
562
|
|
|
Default: \'Default\', |
563
|
|
|
Languages: \'Languages\', |
564
|
|
|
Templates: \'Templates\', |
565
|
|
|
Tasks: \'Tasks\' |
566
|
|
|
} |
567
|
|
|
}); |
568
|
|
|
</script>'; |
569
|
|
|
|
570
|
|
|
} |
571
|
|
|
|
572
|
|
|
/** |
573
|
|
|
* Form for stopping people using naughty words, etc. |
574
|
|
|
*/ |
575
|
|
|
function template_edit_censored() |
576
|
|
|
{ |
577
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
|
|
|
578
|
|
|
|
579
|
|
|
if (!empty($context['saved_successful'])) |
580
|
|
|
echo ' |
581
|
|
|
<div class="infobox">', $txt['settings_saved'], '</div>'; |
582
|
|
|
|
583
|
|
|
// First section is for adding/removing words from the censored list. |
584
|
|
|
echo ' |
585
|
|
|
<div id="admincenter"> |
586
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=postsettings;sa=censor" method="post" accept-charset="', $context['character_set'], '"> |
587
|
|
|
<div id="section_header" class="cat_bar"> |
588
|
|
|
<h3 class="catbg"> |
589
|
|
|
', $txt['admin_censored_words'], ' |
590
|
|
|
</h3> |
591
|
|
|
</div> |
592
|
|
|
<div class="windowbg"> |
593
|
|
|
<p>', $txt['admin_censored_where'], '</p>'; |
594
|
|
|
|
595
|
|
|
// Show text boxes for censoring [bad ] => [good ]. |
596
|
|
|
foreach ($context['censored_words'] as $vulgar => $proper) |
597
|
|
|
echo ' |
598
|
|
|
<div class="block"> |
599
|
|
|
<input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="30"> => <input type="text" name="censor_proper[]" value="', $proper, '" size="30"> |
600
|
|
|
</div>'; |
601
|
|
|
|
602
|
|
|
// Now provide a way to censor more words. |
603
|
|
|
echo ' |
604
|
|
|
<div class="block"> |
605
|
|
|
<input type="text" name="censor_vulgar[]" size="30"> => <input type="text" name="censor_proper[]" size="30"> |
606
|
|
|
</div> |
607
|
|
|
<div id="moreCensoredWords"></div> |
608
|
|
|
<div class="block" style="display: none;" id="moreCensoredWords_link"> |
609
|
|
|
<a class="button" href="#" onclick="addNewWord(); return false;">', $txt['censor_clickadd'], '</a><br> |
610
|
|
|
</div> |
611
|
|
|
<script> |
612
|
|
|
document.getElementById("moreCensoredWords_link").style.display = ""; |
613
|
|
|
</script> |
614
|
|
|
<hr> |
615
|
|
|
<dl class="settings"> |
616
|
|
|
<dt> |
617
|
|
|
<strong><label for="allow_no_censored">', $txt['allow_no_censored'], ':</label></strong> |
618
|
|
|
</dt> |
619
|
|
|
<dd> |
620
|
|
|
<input type="checkbox" name="allow_no_censored" value="1" id="allow_no_censored"', empty($modSettings['allow_no_censored']) ? '' : ' checked', '> |
621
|
|
|
</dd> |
622
|
|
|
<dt> |
623
|
|
|
<strong><label for="censorWholeWord_check">', $txt['censor_whole_words'], ':</label></strong> |
624
|
|
|
</dt> |
625
|
|
|
<dd> |
626
|
|
|
<input type="checkbox" name="censorWholeWord" value="1" id="censorWholeWord_check"', empty($modSettings['censorWholeWord']) ? '' : ' checked', '> |
627
|
|
|
</dd> |
628
|
|
|
<dt> |
629
|
|
|
<strong><label for="censorIgnoreCase_check">', $txt['censor_case'], ':</label></strong> |
630
|
|
|
</dt> |
631
|
|
|
<dd> |
632
|
|
|
<input type="checkbox" name="censorIgnoreCase" value="1" id="censorIgnoreCase_check"', empty($modSettings['censorIgnoreCase']) ? '' : ' checked', '> |
633
|
|
|
</dd> |
634
|
|
|
</dl> |
635
|
|
|
<input type="submit" name="save_censor" value="', $txt['save'], '" class="button"> |
636
|
|
|
</div><!-- .windowbg -->'; |
637
|
|
|
|
638
|
|
|
// This table lets you test out your filters by typing in rude words and seeing what comes out. |
639
|
|
|
echo ' |
640
|
|
|
<div class="cat_bar"> |
641
|
|
|
<h3 class="catbg"> |
642
|
|
|
', $txt['censor_test'], ' |
643
|
|
|
</h3> |
644
|
|
|
</div> |
645
|
|
|
<div class="windowbg"> |
646
|
|
|
<p class="centertext"> |
647
|
|
|
<input type="text" name="censortest" value="', empty($context['censor_test']) ? '' : $context['censor_test'], '"> |
648
|
|
|
<input type="submit" value="', $txt['censor_test_save'], '" class="button"> |
649
|
|
|
</p> |
650
|
|
|
</div> |
651
|
|
|
|
652
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
653
|
|
|
<input type="hidden" name="', $context['admin-censor_token_var'], '" value="', $context['admin-censor_token'], '"> |
654
|
|
|
</form> |
655
|
|
|
</div><!-- #admincenter -->'; |
656
|
|
|
} |
657
|
|
|
|
658
|
|
|
/** |
659
|
|
|
* This is the page shown when we've temporarily paused things such as during maintenance tasks, sending newsletters, etc. |
660
|
|
|
*/ |
661
|
|
|
function template_not_done() |
662
|
|
|
{ |
663
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
664
|
|
|
|
665
|
|
|
echo ' |
666
|
|
|
<div id="admincenter"> |
667
|
|
|
<div id="section_header" class="cat_bar"> |
668
|
|
|
<h3 class="catbg"> |
669
|
|
|
', $txt['not_done_title'], ' |
670
|
|
|
</h3> |
671
|
|
|
</div> |
672
|
|
|
<div class="windowbg"> |
673
|
|
|
', $txt['not_done_reason']; |
674
|
|
|
|
675
|
|
|
if (!empty($context['continue_percent'])) |
676
|
|
|
echo ' |
677
|
|
|
<div class="progress_bar"> |
678
|
|
|
<span>', $context['continue_percent'], '%</span> |
679
|
|
|
<div class="bar" style="width: ', $context['continue_percent'], '%;"></div> |
680
|
|
|
</div>'; |
681
|
|
|
|
682
|
|
|
if (!empty($context['substep_enabled'])) |
683
|
|
|
echo ' |
684
|
|
|
<div class="progress_bar progress_blue"> |
685
|
|
|
<span>', $context['substep_title'], ' (', $context['substep_continue_percent'], '%)</span> |
686
|
|
|
<div class="bar" style="width: ', $context['substep_continue_percent'], '%;"></div> |
687
|
|
|
</div>'; |
688
|
|
|
|
689
|
|
|
echo ' |
690
|
|
|
<form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">'; |
691
|
|
|
|
692
|
|
|
// Do we have a token? |
693
|
|
|
if (isset($context['not_done_token']) && isset($context[$context['not_done_token'] . '_token'], $context[$context['not_done_token'] . '_token_var'])) |
694
|
|
|
echo ' |
695
|
|
|
<input type="hidden" name="', $context[$context['not_done_token'] . '_token_var'], '" value="', $context[$context['not_done_token'] . '_token'], '">'; |
696
|
|
|
|
697
|
|
|
echo ' |
698
|
|
|
<input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button"> |
699
|
|
|
', $context['continue_post_data'], ' |
700
|
|
|
</form> |
701
|
|
|
</div><!-- .windowbg --> |
702
|
|
|
</div><!-- #admincenter --> |
703
|
|
|
<script> |
704
|
|
|
var countdown = ', $context['continue_countdown'], '; |
705
|
|
|
doAutoSubmit(); |
706
|
|
|
|
707
|
|
|
function doAutoSubmit() |
708
|
|
|
{ |
709
|
|
|
if (countdown == 0) |
710
|
|
|
document.forms.autoSubmit.submit(); |
711
|
|
|
else if (countdown == -1) |
712
|
|
|
return; |
713
|
|
|
|
714
|
|
|
document.forms.autoSubmit.cont.value = "', $txt['not_done_continue'], ' (" + countdown + ")"; |
715
|
|
|
countdown--; |
716
|
|
|
|
717
|
|
|
setTimeout("doAutoSubmit();", 1000); |
718
|
|
|
} |
719
|
|
|
</script>'; |
720
|
|
|
} |
721
|
|
|
|
722
|
|
|
/** |
723
|
|
|
* Template for showing settings (Of any kind really!) |
724
|
|
|
*/ |
725
|
|
|
function template_show_settings() |
726
|
|
|
{ |
727
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
728
|
|
|
|
729
|
|
View Code Duplication |
if (!empty($context['saved_successful'])) |
730
|
|
|
echo ' |
731
|
|
|
<div class="infobox">', $txt['settings_saved'], '</div>'; |
732
|
|
|
elseif (!empty($context['saved_failed'])) |
733
|
|
|
echo ' |
734
|
|
|
<div class="errorbox">', sprintf($txt['settings_not_saved'], $context['saved_failed']), '</div>'; |
735
|
|
|
|
736
|
|
|
if (!empty($context['settings_pre_javascript'])) |
737
|
|
|
echo ' |
738
|
|
|
<script>', $context['settings_pre_javascript'], '</script>'; |
739
|
|
|
|
740
|
|
|
if (!empty($context['settings_insert_above'])) |
741
|
|
|
echo $context['settings_insert_above']; |
742
|
|
|
|
743
|
|
|
echo ' |
744
|
|
|
<div id="admincenter"> |
745
|
|
|
<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'] . '"' : '', '>'; |
746
|
|
|
|
747
|
|
|
// Is there a custom title? |
748
|
|
|
if (isset($context['settings_title'])) |
749
|
|
|
echo ' |
750
|
|
|
<div class="cat_bar"> |
751
|
|
|
<h3 class="catbg">', $context['settings_title'], '</h3> |
752
|
|
|
</div>'; |
753
|
|
|
|
754
|
|
|
// Have we got a message to display? |
755
|
|
|
if (!empty($context['settings_message'])) |
756
|
|
|
echo ' |
757
|
|
|
<div class="information">', $context['settings_message'], '</div>'; |
758
|
|
|
|
759
|
|
|
// Now actually loop through all the variables. |
760
|
|
|
$is_open = false; |
761
|
|
|
foreach ($context['config_vars'] as $config_var) |
762
|
|
|
{ |
763
|
|
|
// Is it a title or a description? |
764
|
|
|
if (is_array($config_var) && ($config_var['type'] == 'title' || $config_var['type'] == 'desc')) |
765
|
|
|
{ |
766
|
|
|
// Not a list yet? |
767
|
|
|
if ($is_open) |
768
|
|
|
{ |
769
|
|
|
$is_open = false; |
770
|
|
|
echo ' |
771
|
|
|
</dl> |
772
|
|
|
</div>'; |
773
|
|
|
} |
774
|
|
|
|
775
|
|
|
// A title? |
776
|
|
|
if ($config_var['type'] == 'title') |
777
|
|
|
{ |
778
|
|
|
echo ' |
779
|
|
|
<div class="cat_bar"> |
780
|
|
|
<h3 class="', !empty($config_var['class']) ? $config_var['class'] : 'catbg', '"', !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '> |
781
|
|
|
', ($config_var['help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $config_var['help'] . '" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a>' : ''), ' |
782
|
|
|
', $config_var['label'], ' |
783
|
|
|
</h3> |
784
|
|
|
</div>'; |
785
|
|
|
} |
786
|
|
|
// A description? |
787
|
|
|
else |
788
|
|
|
{ |
789
|
|
|
echo ' |
790
|
|
|
<div class="information noup"> |
791
|
|
|
', $config_var['label'], ' |
792
|
|
|
</div>'; |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
continue; |
796
|
|
|
} |
797
|
|
|
|
798
|
|
|
// Not a list yet? |
799
|
|
|
if (!$is_open) |
800
|
|
|
{ |
801
|
|
|
$is_open = true; |
802
|
|
|
echo ' |
803
|
|
|
<div class="windowbg noup"> |
804
|
|
|
<dl class="settings">'; |
805
|
|
|
} |
806
|
|
|
|
807
|
|
|
// Hang about? Are you pulling my leg - a callback?! |
808
|
|
|
if (is_array($config_var) && $config_var['type'] == 'callback') |
809
|
|
|
{ |
810
|
|
|
if (function_exists('template_callback_' . $config_var['name'])) |
811
|
|
|
call_user_func('template_callback_' . $config_var['name']); |
812
|
|
|
|
813
|
|
|
continue; |
814
|
|
|
} |
815
|
|
|
|
816
|
|
|
if (is_array($config_var)) |
817
|
|
|
{ |
818
|
|
|
// First off, is this a span like a message? |
819
|
|
|
if (in_array($config_var['type'], array('message', 'warning'))) |
820
|
|
|
{ |
821
|
|
|
echo ' |
822
|
|
|
<dd', $config_var['type'] == 'warning' ? ' class="alert"' : '', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '> |
823
|
|
|
', $config_var['label'], ' |
824
|
|
|
</dd>'; |
825
|
|
|
} |
826
|
|
|
// Otherwise it's an input box of some kind. |
827
|
|
|
else |
828
|
|
|
{ |
829
|
|
|
echo ' |
830
|
|
|
<dt', is_array($config_var) && !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>'; |
831
|
|
|
|
832
|
|
|
// Some quick helpers... |
833
|
|
|
$javascript = $config_var['javascript']; |
834
|
|
|
$disabled = !empty($config_var['disabled']) ? ' disabled' : ''; |
835
|
|
|
$subtext = !empty($config_var['subtext']) ? '<br><span class="smalltext"> ' . $config_var['subtext'] . '</span>' : ''; |
836
|
|
|
|
837
|
|
|
// Various HTML5 input types that are basically enhanced textboxes |
838
|
|
|
$text_types = array('color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'time'); |
839
|
|
|
|
840
|
|
|
// Show the [?] button. |
841
|
|
|
if ($config_var['help']) |
842
|
|
|
echo ' |
843
|
|
|
<a id="setting_', $config_var['name'], '_help" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help" title="', $txt['help'], '"></span></a> '; |
844
|
|
|
|
845
|
|
|
echo ' |
846
|
|
|
<a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span> |
847
|
|
|
</dt> |
848
|
|
|
<dd', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>', |
849
|
|
|
$config_var['preinput']; |
850
|
|
|
|
851
|
|
|
// Show a check box. |
852
|
|
|
if ($config_var['type'] == 'check') |
853
|
|
|
echo ' |
854
|
|
|
<input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked' : ''), ' value="1">'; |
855
|
|
|
// Escape (via htmlspecialchars.) the text box. |
856
|
|
|
elseif ($config_var['type'] == 'password') |
857
|
|
|
echo ' |
858
|
|
|
<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> |
859
|
|
|
<input type="password" disabled id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
860
|
|
|
// Show a selection box. |
861
|
|
|
elseif ($config_var['type'] == 'select') |
862
|
|
|
{ |
863
|
|
|
echo ' |
864
|
|
|
<select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), (!empty($config_var['multiple']) && !empty($config_var['size']) ? ' size="' . $config_var['size'] . '"' : ''), '>'; |
865
|
|
|
|
866
|
|
|
foreach ($config_var['data'] as $option) |
867
|
|
|
echo ' |
868
|
|
|
<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>'; |
869
|
|
|
echo ' |
870
|
|
|
</select>'; |
871
|
|
|
} |
872
|
|
|
// List of boards? This requires getBoardList() having been run and the results in $context['board_list']. |
873
|
|
|
elseif ($config_var['type'] == 'boards') |
874
|
|
|
{ |
875
|
|
|
$first = true; |
876
|
|
|
echo ' |
877
|
|
|
<a href="#" class="board_selector">[ ', $txt['select_boards_from_list'], ' ]</a> |
878
|
|
|
<fieldset> |
879
|
|
|
<legend class="board_selector"> |
880
|
|
|
<a href="#">', $txt['select_boards_from_list'], '</a> |
881
|
|
|
</legend>'; |
882
|
|
|
|
883
|
|
|
foreach ($context['board_list'] as $id_cat => $cat) |
884
|
|
|
{ |
885
|
|
|
if (!$first) |
886
|
|
|
echo ' |
887
|
|
|
<hr>'; |
888
|
|
|
echo ' |
889
|
|
|
<strong>', $cat['name'], '</strong> |
890
|
|
|
<ul>'; |
891
|
|
|
|
892
|
|
|
foreach ($cat['boards'] as $id_board => $brd) |
893
|
|
|
echo ' |
894
|
|
|
<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>'; |
895
|
|
|
|
896
|
|
|
echo ' |
897
|
|
|
</ul>'; |
898
|
|
|
$first = false; |
899
|
|
|
} |
900
|
|
|
echo ' |
901
|
|
|
</fieldset>'; |
902
|
|
|
} |
903
|
|
|
// Text area? |
904
|
|
|
elseif ($config_var['type'] == 'large_text') |
905
|
|
|
echo ' |
906
|
|
|
<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>'; |
907
|
|
|
// Permission group? |
908
|
|
|
elseif ($config_var['type'] == 'permissions') |
909
|
|
|
theme_inline_permissions($config_var['name']); |
910
|
|
|
|
911
|
|
|
// BBC selection? |
912
|
|
|
elseif ($config_var['type'] == 'bbc') |
913
|
|
|
{ |
914
|
|
|
echo ' |
915
|
|
|
<fieldset id="', $config_var['name'], '"> |
916
|
|
|
<legend>', $txt['bbcTagsToUse_select'], '</legend> |
917
|
|
|
<ul>'; |
918
|
|
|
|
919
|
|
|
foreach ($context['bbc_columns'] as $bbcColumn) |
920
|
|
|
{ |
921
|
|
|
foreach ($bbcColumn as $bbcTag) |
922
|
|
|
echo ' |
923
|
|
|
<li class="list_bbc floatleft"> |
924
|
|
|
<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>)' : '', ' |
925
|
|
|
</li>'; |
926
|
|
|
} |
927
|
|
|
echo ' </ul> |
928
|
|
|
<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['bbcTagsToUse_select_all'], '</em></label> |
929
|
|
|
</fieldset>'; |
930
|
|
|
} |
931
|
|
|
// A simple message? |
932
|
|
|
elseif ($config_var['type'] == 'var_message') |
933
|
|
|
echo ' |
934
|
|
|
<div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '> |
935
|
|
|
', $config_var['var_message'], ' |
936
|
|
|
</div>'; |
937
|
|
|
// Assume it must be a text box |
938
|
|
|
else |
939
|
|
|
{ |
940
|
|
|
// Figure out the exact type - use "number" for "float" and "int". |
941
|
|
|
$type = in_array($config_var['type'], $text_types) ? $config_var['type'] : ($config_var['type'] == 'int' || $config_var['type'] == 'float' ? 'number' : 'text'); |
942
|
|
|
|
943
|
|
|
// Extra options for float/int values - how much to decrease/increase by, the min value and the max value |
944
|
|
|
// The step - only set if incrementing by something other than 1 for int or 0.1 for float |
945
|
|
|
$step = isset($config_var['step']) ? ' step="' . $config_var['step'] . '"' : ($config_var['type'] == 'float' ? ' step="0.1"' : ''); |
946
|
|
|
|
947
|
|
|
// Minimum allowed value for this setting. SMF forces a default of 0 if not specified in the settings |
948
|
|
|
$min = isset($config_var['min']) ? ' min="' . $config_var['min'] . '"' : ''; |
949
|
|
|
|
950
|
|
|
// Maximum allowed value for this setting. |
951
|
|
|
$max = isset($config_var['max']) ? ' max="' . $config_var['max'] . '"' : ''; |
952
|
|
|
|
953
|
|
|
echo ' |
954
|
|
|
<input type="', $type, '"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '" value="', $config_var['value'], '"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), '', $min . $max . $step, '>'; |
955
|
|
|
} |
956
|
|
|
|
957
|
|
|
echo isset($config_var['postinput']) ? ' |
958
|
|
|
' . $config_var['postinput'] : '',' |
959
|
|
|
</dd>'; |
960
|
|
|
} |
961
|
|
|
} |
962
|
|
|
else |
963
|
|
|
{ |
964
|
|
|
// Just show a separator. |
965
|
|
|
if ($config_var == '') |
966
|
|
|
echo ' |
967
|
|
|
</dl> |
968
|
|
|
<hr> |
969
|
|
|
<dl class="settings">'; |
970
|
|
|
else |
971
|
|
|
echo ' |
972
|
|
|
<dd> |
973
|
|
|
<strong>' . $config_var . '</strong> |
974
|
|
|
</dd>'; |
975
|
|
|
} |
976
|
|
|
} |
977
|
|
|
|
978
|
|
|
if ($is_open) |
979
|
|
|
echo ' |
980
|
|
|
</dl>'; |
981
|
|
|
|
982
|
|
|
if (empty($context['settings_save_dont_show'])) |
983
|
|
|
echo ' |
984
|
|
|
<input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button">'; |
985
|
|
|
|
986
|
|
|
if ($is_open) |
987
|
|
|
echo ' |
988
|
|
|
</div><!-- .windowbg -->'; |
989
|
|
|
|
990
|
|
|
|
991
|
|
|
// At least one token has to be used! |
992
|
|
|
if (isset($context['admin-ssc_token'])) |
993
|
|
|
echo ' |
994
|
|
|
<input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '">'; |
995
|
|
|
|
996
|
|
|
if (isset($context['admin-dbsc_token'])) |
997
|
|
|
echo ' |
998
|
|
|
<input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '">'; |
999
|
|
|
|
1000
|
|
|
if (isset($context['admin-mp_token'])) |
1001
|
|
|
echo ' |
1002
|
|
|
<input type="hidden" name="', $context['admin-mp_token_var'], '" value="', $context['admin-mp_token'], '">'; |
1003
|
|
|
|
1004
|
|
|
echo ' |
1005
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1006
|
|
|
</form> |
1007
|
|
|
</div><!-- #admincenter -->'; |
1008
|
|
|
|
1009
|
|
|
if (!empty($context['settings_post_javascript'])) |
1010
|
|
|
echo ' |
1011
|
|
|
<script> |
1012
|
|
|
', $context['settings_post_javascript'], ' |
1013
|
|
|
</script>'; |
1014
|
|
|
|
1015
|
|
|
if (!empty($context['settings_insert_below'])) |
1016
|
|
|
echo $context['settings_insert_below']; |
1017
|
|
|
|
1018
|
|
|
// We may have added a board listing. If we did, we need to make it work. |
1019
|
|
|
addInlineJavascript(' |
1020
|
|
|
$("legend.board_selector").closest("fieldset").hide(); |
1021
|
|
|
$("a.board_selector").click(function(e) { |
1022
|
|
|
e.preventDefault(); |
1023
|
|
|
$(this).hide().next("fieldset").show(); |
1024
|
|
|
}); |
1025
|
|
|
$("fieldset legend.board_selector a").click(function(e) { |
1026
|
|
|
e.preventDefault(); |
1027
|
|
|
$(this).closest("fieldset").hide().prev("a").show(); |
1028
|
|
|
}); |
1029
|
|
|
', true); |
1030
|
|
|
} |
1031
|
|
|
|
1032
|
|
|
/** |
1033
|
|
|
* Template for showing custom profile fields. |
1034
|
|
|
*/ |
1035
|
|
|
function template_show_custom_profile() |
1036
|
|
|
{ |
1037
|
|
|
global $context, $txt; |
|
|
|
|
1038
|
|
|
|
1039
|
|
|
if (!empty($context['saved_successful'])) |
1040
|
|
|
echo ' |
1041
|
|
|
<div class="infobox">', $txt['settings_saved'], '</div>'; |
1042
|
|
|
|
1043
|
|
|
// Standard fields. |
1044
|
|
|
template_show_list('standard_profile_fields'); |
1045
|
|
|
|
1046
|
|
|
echo ' |
1047
|
|
|
<script> |
1048
|
|
|
var iNumChecks = document.forms.standardProfileFields.length; |
1049
|
|
|
for (var i = 0; i < iNumChecks; i++) |
1050
|
|
|
if (document.forms.standardProfileFields[i].id.indexOf(\'reg_\') == 0) |
1051
|
|
|
document.forms.standardProfileFields[i].disabled = document.forms.standardProfileFields[i].disabled || !document.getElementById(\'active_\' + document.forms.standardProfileFields[i].id.substr(4)).checked; |
1052
|
|
|
</script> |
1053
|
|
|
<br>'; |
1054
|
|
|
|
1055
|
|
|
// Custom fields. |
1056
|
|
|
template_show_list('custom_profile_fields'); |
1057
|
|
|
} |
1058
|
|
|
|
1059
|
|
|
// Edit a profile field? |
1060
|
|
|
function template_edit_profile_field() |
1061
|
|
|
{ |
1062
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
1063
|
|
|
|
1064
|
|
|
// All the javascript for this page - quite a bit in script.js! |
1065
|
|
|
echo ' |
1066
|
|
|
<script> |
1067
|
|
|
var startOptID = ', count($context['field']['options']), '; |
1068
|
|
|
</script>'; |
1069
|
|
|
|
1070
|
|
|
// any errors messages to show? |
1071
|
|
|
if (isset($_GET['msg'])) |
1072
|
|
|
{ |
1073
|
|
|
loadLanguage('Errors'); |
1074
|
|
|
|
1075
|
|
|
if (isset($txt['custom_option_' . $_GET['msg']])) |
1076
|
|
|
echo ' |
1077
|
|
|
<div class="errorbox">', |
1078
|
|
|
$txt['custom_option_' . $_GET['msg']], ' |
1079
|
|
|
</div>'; |
1080
|
|
|
} |
1081
|
|
|
|
1082
|
|
|
echo ' |
1083
|
|
|
<div id="admincenter"> |
1084
|
|
|
<form action="', $scripturl, '?action=admin;area=featuresettings;sa=profileedit;fid=', $context['fid'], ';', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '"> |
1085
|
|
|
<div id="section_header" class="cat_bar"> |
1086
|
|
|
<h3 class="catbg">', $context['page_title'], '</h3> |
1087
|
|
|
</div> |
1088
|
|
|
<div class="windowbg"> |
1089
|
|
|
<fieldset> |
1090
|
|
|
<legend>', $txt['custom_edit_general'], '</legend> |
1091
|
|
|
|
1092
|
|
|
<dl class="settings"> |
1093
|
|
|
<dt> |
1094
|
|
|
<strong><label for="field_name">', $txt['custom_edit_name'], ':</label></strong> |
1095
|
|
|
</dt> |
1096
|
|
|
<dd> |
1097
|
|
|
<input type="text" name="field_name" id="field_name" value="', $context['field']['name'], '" size="20" maxlength="40"> |
1098
|
|
|
</dd> |
1099
|
|
|
<dt> |
1100
|
|
|
<strong><label for="field_desc">', $txt['custom_edit_desc'], ':</label></strong> |
1101
|
|
|
</dt> |
1102
|
|
|
<dd> |
1103
|
|
|
<textarea name="field_desc" id="field_desc" rows="3" cols="40">', $context['field']['desc'], '</textarea> |
1104
|
|
|
</dd> |
1105
|
|
|
<dt> |
1106
|
|
|
<strong><label for="profile_area">', $txt['custom_edit_profile'], ':</label></strong><br> |
1107
|
|
|
<span class="smalltext">', $txt['custom_edit_profile_desc'], '</span> |
1108
|
|
|
</dt> |
1109
|
|
|
<dd> |
1110
|
|
|
<select name="profile_area" id="profile_area"> |
1111
|
|
|
<option value="none"', $context['field']['profile_area'] == 'none' ? ' selected' : '', '>', $txt['custom_edit_profile_none'], '</option> |
1112
|
|
|
<option value="account"', $context['field']['profile_area'] == 'account' ? ' selected' : '', '>', $txt['account'], '</option> |
1113
|
|
|
<option value="forumprofile"', $context['field']['profile_area'] == 'forumprofile' ? ' selected' : '', '>', $txt['forumprofile'], '</option> |
1114
|
|
|
<option value="theme"', $context['field']['profile_area'] == 'theme' ? ' selected' : '', '>', $txt['theme'], '</option> |
1115
|
|
|
</select> |
1116
|
|
|
</dd> |
1117
|
|
|
<dt> |
1118
|
|
|
<a id="field_reg_require" href="', $scripturl, '?action=helpadmin;help=field_reg_require" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> |
1119
|
|
|
<strong><label for="reg">', $txt['custom_edit_registration'], ':</label></strong> |
1120
|
|
|
</dt> |
1121
|
|
|
<dd> |
1122
|
|
|
<select name="reg" id="reg"> |
1123
|
|
|
<option value="0"', $context['field']['reg'] == 0 ? ' selected' : '', '>', $txt['custom_edit_registration_disable'], '</option> |
1124
|
|
|
<option value="1"', $context['field']['reg'] == 1 ? ' selected' : '', '>', $txt['custom_edit_registration_allow'], '</option> |
1125
|
|
|
<option value="2"', $context['field']['reg'] == 2 ? ' selected' : '', '>', $txt['custom_edit_registration_require'], '</option> |
1126
|
|
|
</select> |
1127
|
|
|
</dd> |
1128
|
|
|
<dt> |
1129
|
|
|
<strong><label for="display">', $txt['custom_edit_display'], ':</label></strong> |
1130
|
|
|
</dt> |
1131
|
|
|
<dd> |
1132
|
|
|
<input type="checkbox" name="display" id="display"', $context['field']['display'] ? ' checked' : '', '> |
1133
|
|
|
</dd> |
1134
|
|
|
<dt> |
1135
|
|
|
<strong><label for="mlist">', $txt['custom_edit_mlist'], ':</label></strong> |
1136
|
|
|
</dt> |
1137
|
|
|
<dd> |
1138
|
|
|
<input type="checkbox" name="mlist" id="show_mlist"', $context['field']['mlist'] ? ' checked' : '', '> |
1139
|
|
|
</dd> |
1140
|
|
|
<dt> |
1141
|
|
|
<strong><label for="placement">', $txt['custom_edit_placement'], ':</label></strong> |
1142
|
|
|
</dt> |
1143
|
|
|
<dd> |
1144
|
|
|
<select name="placement" id="placement">'; |
1145
|
|
|
|
1146
|
|
|
foreach ($context['cust_profile_fields_placement'] as $order => $name) |
1147
|
|
|
echo ' |
1148
|
|
|
<option value="', $order, '"', $context['field']['placement'] == $order ? ' selected' : '', '>', $txt['custom_profile_placement_' . $name], '</option>'; |
1149
|
|
|
|
1150
|
|
|
echo ' |
1151
|
|
|
</select> |
1152
|
|
|
</dd> |
1153
|
|
|
<dt> |
1154
|
|
|
<a id="field_show_enclosed" href="', $scripturl, '?action=helpadmin;help=field_show_enclosed" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> |
1155
|
|
|
<strong><label for="enclose">', $txt['custom_edit_enclose'], ':</label></strong><br> |
1156
|
|
|
<span class="smalltext">', $txt['custom_edit_enclose_desc'], '</span> |
1157
|
|
|
</dt> |
1158
|
|
|
<dd> |
1159
|
|
|
<textarea name="enclose" id="enclose" rows="10" cols="50">', @$context['field']['enclose'], '</textarea> |
1160
|
|
|
</dd> |
1161
|
|
|
</dl> |
1162
|
|
|
</fieldset> |
1163
|
|
|
<fieldset> |
1164
|
|
|
<legend>', $txt['custom_edit_input'], '</legend> |
1165
|
|
|
<dl class="settings"> |
1166
|
|
|
<dt> |
1167
|
|
|
<strong><label for="field_type">', $txt['custom_edit_picktype'], ':</label></strong> |
1168
|
|
|
</dt> |
1169
|
|
|
<dd> |
1170
|
|
|
<select name="field_type" id="field_type" onchange="updateInputBoxes();">'; |
1171
|
|
|
|
1172
|
|
|
foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type) |
1173
|
|
|
echo ' |
1174
|
|
|
<option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>'; |
1175
|
|
|
|
1176
|
|
|
echo ' |
1177
|
|
|
</select> |
1178
|
|
|
</dd> |
1179
|
|
|
<dt id="max_length_dt"> |
1180
|
|
|
<strong><label for="max_length_dd">', $txt['custom_edit_max_length'], ':</label></strong><br> |
1181
|
|
|
<span class="smalltext">', $txt['custom_edit_max_length_desc'], '</span> |
1182
|
|
|
</dt> |
1183
|
|
|
<dd> |
1184
|
|
|
<input type="text" name="max_length" id="max_length_dd" value="', $context['field']['max_length'], '" size="7" maxlength="6"> |
1185
|
|
|
</dd> |
1186
|
|
|
<dt id="dimension_dt"> |
1187
|
|
|
<strong><label for="dimension_dd">', $txt['custom_edit_dimension'], ':</label></strong> |
1188
|
|
|
</dt> |
1189
|
|
|
<dd id="dimension_dd"> |
1190
|
|
|
<strong>', $txt['custom_edit_dimension_row'], ':</strong> <input type="text" name="rows" value="', $context['field']['rows'], '" size="5" maxlength="3"> |
1191
|
|
|
<strong>', $txt['custom_edit_dimension_col'], ':</strong> <input type="text" name="cols" value="', $context['field']['cols'], '" size="5" maxlength="3"> |
1192
|
|
|
</dd> |
1193
|
|
|
<dt id="bbc_dt"> |
1194
|
|
|
<strong><label for="bbc_dd">', $txt['custom_edit_bbc'], '</label></strong> |
1195
|
|
|
</dt> |
1196
|
|
|
<dd > |
1197
|
|
|
<input type="checkbox" name="bbc" id="bbc_dd"', $context['field']['bbc'] ? ' checked' : '', '> |
1198
|
|
|
</dd> |
1199
|
|
|
<dt id="options_dt"> |
1200
|
|
|
<a href="', $scripturl, '?action=helpadmin;help=customoptions" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> |
1201
|
|
|
<strong><label for="options_dd">', $txt['custom_edit_options'], ':</label></strong><br> |
1202
|
|
|
<span class="smalltext">', $txt['custom_edit_options_desc'], '</span> |
1203
|
|
|
</dt> |
1204
|
|
|
<dd id="options_dd">'; |
1205
|
|
|
|
1206
|
|
|
foreach ($context['field']['options'] as $k => $option) |
1207
|
|
|
echo ' |
1208
|
|
|
', $k == 0 ? '' : '<br>', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked' : '', '><input type="text" name="select_option[', $k, ']" value="', $option, '">'; |
1209
|
|
|
|
1210
|
|
|
echo ' |
1211
|
|
|
<span id="addopt"></span> |
1212
|
|
|
[<a href="" onclick="addOption(); return false;">', $txt['custom_edit_options_more'], '</a>] |
1213
|
|
|
</dd> |
1214
|
|
|
<dt id="default_dt"> |
1215
|
|
|
<strong><label for="default_dd">', $txt['custom_edit_default'], ':</label></strong> |
1216
|
|
|
</dt> |
1217
|
|
|
<dd> |
1218
|
|
|
<input type="checkbox" name="default_check" id="default_dd"', $context['field']['default_check'] ? ' checked' : '', '> |
1219
|
|
|
</dd> |
1220
|
|
|
</dl> |
1221
|
|
|
</fieldset> |
1222
|
|
|
<fieldset> |
1223
|
|
|
<legend>', $txt['custom_edit_advanced'], '</legend> |
1224
|
|
|
<dl class="settings"> |
1225
|
|
|
<dt id="mask_dt"> |
1226
|
|
|
<a id="custom_mask" href="', $scripturl, '?action=helpadmin;help=custom_mask" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> |
1227
|
|
|
<strong><label for="mask">', $txt['custom_edit_mask'], ':</label></strong><br> |
1228
|
|
|
<span class="smalltext">', $txt['custom_edit_mask_desc'], '</span> |
1229
|
|
|
</dt> |
1230
|
|
|
<dd> |
1231
|
|
|
<select name="mask" id="mask" onchange="updateInputBoxes();"> |
1232
|
|
|
<option value="nohtml"', $context['field']['mask'] == 'nohtml' ? ' selected' : '', '>', $txt['custom_edit_mask_nohtml'], '</option> |
1233
|
|
|
<option value="email"', $context['field']['mask'] == 'email' ? ' selected' : '', '>', $txt['custom_edit_mask_email'], '</option> |
1234
|
|
|
<option value="number"', $context['field']['mask'] == 'number' ? ' selected' : '', '>', $txt['custom_edit_mask_number'], '</option> |
1235
|
|
|
<option value="regex"', strpos($context['field']['mask'], 'regex') === 0 ? ' selected' : '', '>', $txt['custom_edit_mask_regex'], '</option> |
1236
|
|
|
</select> |
1237
|
|
|
<br> |
1238
|
|
|
<span id="regex_div"> |
1239
|
|
|
<input type="text" name="regex" value="', $context['field']['regex'], '" size="30"> |
1240
|
|
|
</span> |
1241
|
|
|
</dd> |
1242
|
|
|
<dt> |
1243
|
|
|
<strong><label for="private">', $txt['custom_edit_privacy'], ':</label></strong> |
1244
|
|
|
<span class="smalltext">', $txt['custom_edit_privacy_desc'], '</span> |
1245
|
|
|
</dt> |
1246
|
|
|
<dd> |
1247
|
|
|
<select name="private" id="private" onchange="updateInputBoxes();"> |
1248
|
|
|
<option value="0"', $context['field']['private'] == 0 ? ' selected' : '', '>', $txt['custom_edit_privacy_all'], '</option> |
1249
|
|
|
<option value="1"', $context['field']['private'] == 1 ? ' selected' : '', '>', $txt['custom_edit_privacy_see'], '</option> |
1250
|
|
|
<option value="2"', $context['field']['private'] == 2 ? ' selected' : '', '>', $txt['custom_edit_privacy_owner'], '</option> |
1251
|
|
|
<option value="3"', $context['field']['private'] == 3 ? ' selected' : '', '>', $txt['custom_edit_privacy_none'], '</option> |
1252
|
|
|
</select> |
1253
|
|
|
</dd> |
1254
|
|
|
<dt id="can_search_dt"> |
1255
|
|
|
<strong><label for="can_search_dd">', $txt['custom_edit_can_search'], ':</label></strong><br> |
1256
|
|
|
<span class="smalltext">', $txt['custom_edit_can_search_desc'], '</span> |
1257
|
|
|
</dt> |
1258
|
|
|
<dd> |
1259
|
|
|
<input type="checkbox" name="can_search" id="can_search_dd"', $context['field']['can_search'] ? ' checked' : '', '> |
1260
|
|
|
</dd> |
1261
|
|
|
<dt> |
1262
|
|
|
<strong><label for="can_search_check">', $txt['custom_edit_active'], ':</label></strong><br> |
1263
|
|
|
<span class="smalltext">', $txt['custom_edit_active_desc'], '</span> |
1264
|
|
|
</dt> |
1265
|
|
|
<dd> |
1266
|
|
|
<input type="checkbox" name="active" id="can_search_check"', $context['field']['active'] ? ' checked' : '', '> |
1267
|
|
|
</dd> |
1268
|
|
|
</dl> |
1269
|
|
|
</fieldset> |
1270
|
|
|
<input type="submit" name="save" value="', $txt['save'], '" class="button">'; |
1271
|
|
|
|
1272
|
|
|
if ($context['fid']) |
1273
|
|
|
echo ' |
1274
|
|
|
<input type="submit" name="delete" value="', $txt['delete'], '" data-confirm="', $txt['custom_edit_delete_sure'], '" class="button you_sure">'; |
1275
|
|
|
|
1276
|
|
|
echo ' |
1277
|
|
|
</div><!-- .windowbg --> |
1278
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1279
|
|
|
<input type="hidden" name="', $context['admin-ecp_token_var'], '" value="', $context['admin-ecp_token'], '"> |
1280
|
|
|
</form> |
1281
|
|
|
</div><!-- #admincenter -->'; |
1282
|
|
|
|
1283
|
|
|
// Get the javascript bits right! |
1284
|
|
|
echo ' |
1285
|
|
|
<script> |
1286
|
|
|
updateInputBoxes(); |
1287
|
|
|
</script>'; |
1288
|
|
|
} |
1289
|
|
|
|
1290
|
|
|
/** |
1291
|
|
|
* Results page for an admin search. |
1292
|
|
|
*/ |
1293
|
|
|
function template_admin_search_results() |
1294
|
|
|
{ |
1295
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
1296
|
|
|
|
1297
|
|
|
echo ' |
1298
|
|
|
<div id="section_header" class="cat_bar"> |
1299
|
|
|
<form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '"> |
1300
|
|
|
<h3 class="catbg"> |
1301
|
|
|
<span id="quick_search" class="floatright"> |
1302
|
|
|
<input type="search" name="search_term" value="', $context['search_term'], '"> |
1303
|
|
|
<input type="hidden" name="search_type" value="', $context['search_type'], '"> |
1304
|
|
|
<input type="submit" name="search_go" value="', $txt['admin_search_results_again'], '" class="button"> |
1305
|
|
|
</span> |
1306
|
|
|
<span class="generic_icons filter"></span> |
1307
|
|
|
<span id="quick_search_results"> |
1308
|
|
|
', sprintf($txt['admin_search_results_desc'], $context['search_term']), ' |
1309
|
|
|
</span> |
1310
|
|
|
</h3> |
1311
|
|
|
</form> |
1312
|
|
|
</div><!-- #section_header --> |
1313
|
|
|
<div class="windowbg generic_list_wrapper">'; |
1314
|
|
|
|
1315
|
|
|
if (empty($context['search_results'])) |
1316
|
|
|
{ |
1317
|
|
|
echo ' |
1318
|
|
|
<p class="centertext"> |
1319
|
|
|
<strong>', $txt['admin_search_results_none'], '</strong> |
1320
|
|
|
</p>'; |
1321
|
|
|
} |
1322
|
|
|
else |
1323
|
|
|
{ |
1324
|
|
|
echo ' |
1325
|
|
|
<ol class="search_results">'; |
1326
|
|
|
|
1327
|
|
|
foreach ($context['search_results'] as $result) |
1328
|
|
|
{ |
1329
|
|
|
// Is it a result from the online manual? |
1330
|
|
|
if ($context['search_type'] == 'online') |
1331
|
|
|
{ |
1332
|
|
|
echo ' |
1333
|
|
|
<li> |
1334
|
|
|
<p> |
1335
|
|
|
<a href="', $context['doc_scripturl'], str_replace(' ', '_', $result['title']), '" target="_blank" rel="noopener"><strong>', $result['title'], '</strong></a> |
1336
|
|
|
</p> |
1337
|
|
|
<p class="double_height"> |
1338
|
|
|
', $result['snippet'], ' |
1339
|
|
|
</p> |
1340
|
|
|
</li>'; |
1341
|
|
|
} |
1342
|
|
|
// Otherwise it's... not! |
1343
|
|
|
else |
1344
|
|
|
{ |
1345
|
|
|
echo ' |
1346
|
|
|
<li> |
1347
|
|
|
<a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'], ']'; |
1348
|
|
|
|
1349
|
|
|
if ($result['help']) |
1350
|
|
|
echo ' |
1351
|
|
|
<p class="double_height">', $result['help'], '</p>'; |
1352
|
|
|
|
1353
|
|
|
echo ' |
1354
|
|
|
</li>'; |
1355
|
|
|
} |
1356
|
|
|
} |
1357
|
|
|
echo ' |
1358
|
|
|
</ol>'; |
1359
|
|
|
} |
1360
|
|
|
|
1361
|
|
|
echo ' |
1362
|
|
|
</div><!-- .generic_list_wrapper -->'; |
1363
|
|
|
} |
1364
|
|
|
|
1365
|
|
|
/** |
1366
|
|
|
* This little beauty shows questions and answer from the captcha type feature. |
1367
|
|
|
*/ |
1368
|
|
|
function template_callback_question_answer_list() |
1369
|
|
|
{ |
1370
|
|
|
global $txt, $context; |
|
|
|
|
1371
|
|
|
|
1372
|
|
|
foreach ($context['languages'] as $lang_id => $lang) |
1373
|
|
|
{ |
1374
|
|
|
$lang_id = strtr($lang_id, array('-utf8' => '')); |
1375
|
|
|
$lang['name'] = strtr($lang['name'], array('-utf8' => '')); |
1376
|
|
|
|
1377
|
|
|
echo ' |
1378
|
|
|
<dt id="qa_dt_', $lang_id, '" class="qa_link"> |
1379
|
|
|
<a href="javascript:void(0);">[ ', $lang['name'], ' ]</a> |
1380
|
|
|
</dt> |
1381
|
|
|
<fieldset id="qa_fs_', $lang_id, '" class="qa_fieldset"> |
1382
|
|
|
<legend><a href="javascript:void(0);">', $lang['name'], '</a></legend> |
1383
|
|
|
<dl class="settings"> |
1384
|
|
|
<dt> |
1385
|
|
|
<strong>', $txt['setup_verification_question'], '</strong> |
1386
|
|
|
</dt> |
1387
|
|
|
<dd> |
1388
|
|
|
<strong>', $txt['setup_verification_answer'], '</strong> |
1389
|
|
|
</dd>'; |
1390
|
|
|
|
1391
|
|
|
if (!empty($context['qa_by_lang'][$lang_id])) |
1392
|
|
|
foreach ($context['qa_by_lang'][$lang_id] as $q_id) |
1393
|
|
|
{ |
1394
|
|
|
$question = $context['question_answers'][$q_id]; |
1395
|
|
|
|
1396
|
|
|
echo ' |
1397
|
|
|
<dt> |
1398
|
|
|
<input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="verification_question"> |
1399
|
|
|
</dt> |
1400
|
|
|
<dd>'; |
1401
|
|
|
|
1402
|
|
|
foreach ($question['answers'] as $answer) |
1403
|
|
|
echo ' |
1404
|
|
|
<input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="verification_answer">'; |
1405
|
|
|
|
1406
|
|
|
echo ' |
1407
|
|
|
<div class="qa_add_answer"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div> |
1408
|
|
|
</dd>'; |
1409
|
|
|
} |
1410
|
|
|
|
1411
|
|
|
echo ' |
1412
|
|
|
<dt class="qa_add_question"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_more'], ' ]</a></dt> |
1413
|
|
|
</dl> |
1414
|
|
|
</fieldset>'; |
1415
|
|
|
} |
1416
|
|
|
} |
1417
|
|
|
|
1418
|
|
|
/** |
1419
|
|
|
* Repairing boards. |
1420
|
|
|
*/ |
1421
|
|
|
function template_repair_boards() |
1422
|
|
|
{ |
1423
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
1424
|
|
|
|
1425
|
|
|
echo ' |
1426
|
|
|
<div id="admincenter"> |
1427
|
|
|
<div id="section_header" class="cat_bar"> |
1428
|
|
|
<h3 class="catbg">', |
1429
|
|
|
$context['error_search'] ? $txt['errors_list'] : $txt['errors_fixing'], ' |
1430
|
|
|
</h3> |
1431
|
|
|
</div> |
1432
|
|
|
<div class="windowbg">'; |
1433
|
|
|
|
1434
|
|
|
// Are we actually fixing them, or is this just a prompt? |
1435
|
|
|
if ($context['error_search']) |
1436
|
|
|
{ |
1437
|
|
|
if (!empty($context['to_fix'])) |
1438
|
|
|
{ |
1439
|
|
|
echo ' |
1440
|
|
|
', $txt['errors_found'], ': |
1441
|
|
|
<ul>'; |
1442
|
|
|
|
1443
|
|
|
foreach ($context['repair_errors'] as $error) |
1444
|
|
|
echo ' |
1445
|
|
|
<li> |
1446
|
|
|
', $error, ' |
1447
|
|
|
</li>'; |
1448
|
|
|
|
1449
|
|
|
echo ' |
1450
|
|
|
</ul> |
1451
|
|
|
<p> |
1452
|
|
|
', $txt['errors_fix'], ' |
1453
|
|
|
</p> |
1454
|
|
|
<p class="padding"> |
1455
|
|
|
<strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong> |
1456
|
|
|
</p>'; |
1457
|
|
|
} |
1458
|
|
|
else |
1459
|
|
|
echo ' |
1460
|
|
|
<p>', $txt['maintain_no_errors'], '</p> |
1461
|
|
|
<p class="padding"> |
1462
|
|
|
<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1463
|
|
|
</p>'; |
1464
|
|
|
} |
1465
|
|
|
else |
1466
|
|
|
{ |
1467
|
|
|
if (!empty($context['redirect_to_recount'])) |
1468
|
|
|
{ |
1469
|
|
|
echo ' |
1470
|
|
|
<p> |
1471
|
|
|
', $txt['errors_do_recount'], ' |
1472
|
|
|
</p> |
1473
|
|
|
<form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=recount" id="recount_form" method="post"> |
1474
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1475
|
|
|
<input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '"> |
1476
|
|
|
</form>'; |
1477
|
|
|
} |
1478
|
|
|
else |
1479
|
|
|
{ |
1480
|
|
|
echo ' |
1481
|
|
|
<p>', $txt['errors_fixed'], '</p> |
1482
|
|
|
<p class="padding"> |
1483
|
|
|
<a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a> |
1484
|
|
|
</p>'; |
1485
|
|
|
} |
1486
|
|
|
} |
1487
|
|
|
|
1488
|
|
|
echo ' |
1489
|
|
|
</div><!-- .windowbg --> |
1490
|
|
|
</div><!-- #admincenter -->'; |
1491
|
|
|
|
1492
|
|
|
if (!empty($context['redirect_to_recount'])) |
1493
|
|
|
{ |
1494
|
|
|
echo ' |
1495
|
|
|
<script> |
1496
|
|
|
var countdown = 5; |
1497
|
|
|
doAutoSubmit(); |
1498
|
|
|
|
1499
|
|
|
function doAutoSubmit() |
1500
|
|
|
{ |
1501
|
|
|
if (countdown == 0) |
1502
|
|
|
document.forms.recount_form.submit(); |
1503
|
|
|
else if (countdown == -1) |
1504
|
|
|
return; |
1505
|
|
|
|
1506
|
|
|
document.forms.recount_form.recount_now.value = "', $txt['errors_recount_now'], ' (" + countdown + ")"; |
1507
|
|
|
countdown--; |
1508
|
|
|
|
1509
|
|
|
setTimeout("doAutoSubmit();", 1000); |
1510
|
|
|
} |
1511
|
|
|
</script>'; |
1512
|
|
|
} |
1513
|
|
|
} |
1514
|
|
|
|
1515
|
|
|
/** |
1516
|
|
|
* Retrieves info from the php_info function, scrubs and preps it for display |
1517
|
|
|
*/ |
1518
|
|
|
function template_php_info() |
1519
|
|
|
{ |
1520
|
|
|
global $context, $txt; |
|
|
|
|
1521
|
|
|
|
1522
|
|
|
echo ' |
1523
|
|
|
<div id="admin_form_wrapper"> |
1524
|
|
|
<div id="section_header" class="cat_bar"> |
1525
|
|
|
<h3 class="catbg"> |
1526
|
|
|
', $txt['phpinfo_settings'], ' |
1527
|
|
|
</h3> |
1528
|
|
|
</div>'; |
1529
|
|
|
|
1530
|
|
|
// for each php info area |
1531
|
|
|
foreach ($context['pinfo'] as $area => $php_area) |
1532
|
|
|
{ |
1533
|
|
|
echo ' |
1534
|
|
|
<table id="', str_replace(' ', '_', $area), '" class="table_grid"> |
1535
|
|
|
<thead> |
1536
|
|
|
<tr class="title_bar"> |
1537
|
|
|
<th class="equal_table" scope="col"></th> |
1538
|
|
|
<th class="centercol equal_table" scope="col"><strong>', $area, '</strong></th> |
1539
|
|
|
<th class="equal_table" scope="col"></th> |
1540
|
|
|
</tr> |
1541
|
|
|
</thead> |
1542
|
|
|
<tbody>'; |
1543
|
|
|
|
1544
|
|
|
$localmaster = true; |
1545
|
|
|
|
1546
|
|
|
// and for each setting in this category |
1547
|
|
|
foreach ($php_area as $key => $setting) |
1548
|
|
|
{ |
1549
|
|
|
// start of a local / master setting (3 col) |
1550
|
|
|
if (is_array($setting)) |
1551
|
|
|
{ |
1552
|
|
|
if ($localmaster) |
1553
|
|
|
{ |
1554
|
|
|
// heading row for the settings section of this categorys settings |
1555
|
|
|
echo ' |
1556
|
|
|
<tr class="title_bar"> |
1557
|
|
|
<td class="equal_table"><strong>', $txt['phpinfo_itemsettings'], '</strong></td> |
1558
|
|
|
<td class="equal_table"><strong>', $txt['phpinfo_localsettings'], '</strong></td> |
1559
|
|
|
<td class="equal_table"><strong>', $txt['phpinfo_defaultsettings'], '</strong></td> |
1560
|
|
|
</tr>'; |
1561
|
|
|
|
1562
|
|
|
$localmaster = false; |
1563
|
|
|
} |
1564
|
|
|
|
1565
|
|
|
echo ' |
1566
|
|
|
<tr class="windowbg"> |
1567
|
|
|
<td class="equal_table">', $key, '</td>'; |
1568
|
|
|
|
1569
|
|
|
foreach ($setting as $key_lm => $value) |
1570
|
|
|
echo ' |
1571
|
|
|
<td class="equal_table">', $value, '</td>'; |
1572
|
|
|
|
1573
|
|
|
echo ' |
1574
|
|
|
</tr>'; |
1575
|
|
|
} |
1576
|
|
|
// just a single setting (2 col) |
1577
|
|
|
else |
1578
|
|
|
{ |
1579
|
|
|
echo ' |
1580
|
|
|
<tr class="windowbg"> |
1581
|
|
|
<td class="equal_table">', $key, '</td> |
1582
|
|
|
<td colspan="2">', $setting, '</td> |
1583
|
|
|
</tr>'; |
1584
|
|
|
} |
1585
|
|
|
} |
1586
|
|
|
echo ' |
1587
|
|
|
</tbody> |
1588
|
|
|
</table> |
1589
|
|
|
<br>'; |
1590
|
|
|
} |
1591
|
|
|
|
1592
|
|
|
echo ' |
1593
|
|
|
</div><!-- #admin_form_wrapper -->'; |
1594
|
|
|
} |
1595
|
|
|
|
1596
|
|
|
/** |
1597
|
|
|
* |
1598
|
|
|
*/ |
1599
|
|
|
function template_clean_cache_button_above() |
1600
|
|
|
{ |
1601
|
|
|
} |
1602
|
|
|
|
1603
|
|
|
/** |
1604
|
|
|
* Content shown below the clean cache button? |
1605
|
|
|
*/ |
1606
|
|
|
function template_clean_cache_button_below() |
1607
|
|
|
{ |
1608
|
|
|
global $txt, $scripturl, $context; |
|
|
|
|
1609
|
|
|
|
1610
|
|
|
echo ' |
1611
|
|
|
<div class="cat_bar"> |
1612
|
|
|
<h3 class="catbg">', $txt['maintain_cache'], '</h3> |
1613
|
|
|
</div> |
1614
|
|
|
<div class="windowbg"> |
1615
|
|
|
<form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=cleancache" method="post" accept-charset="', $context['character_set'], '"> |
1616
|
|
|
<p>', $txt['maintain_cache_info'], '</p> |
1617
|
|
|
<span><input type="submit" value="', $txt['maintain_run_now'], '" class="button"></span> |
1618
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1619
|
|
|
<input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '"> |
1620
|
|
|
</form> |
1621
|
|
|
</div>'; |
1622
|
|
|
} |
1623
|
|
|
|
1624
|
|
|
/** |
1625
|
|
|
* This shows the admin search form |
1626
|
|
|
*/ |
1627
|
|
|
function template_admin_quick_search() |
1628
|
|
|
{ |
1629
|
|
|
global $context, $txt; |
|
|
|
|
1630
|
|
|
|
1631
|
|
|
if ($context['user']['is_admin']) |
1632
|
|
|
echo ' |
1633
|
|
|
<span class="floatright admin_search"> |
1634
|
|
|
<span class="generic_icons filter centericon"></span> |
1635
|
|
|
<input type="search" name="search_term" placeholder="', $txt['admin_search'], '"> |
1636
|
|
|
<select name="search_type"> |
1637
|
|
|
<option value="internal"', (empty($context['admin_preferences']['sb']) || $context['admin_preferences']['sb'] == 'internal' ? ' selected' : ''), '>', $txt['admin_search_type_internal'], '</option> |
1638
|
|
|
<option value="member"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'member' ? ' selected' : ''), '>', $txt['admin_search_type_member'], '</option> |
1639
|
|
|
<option value="online"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'online' ? ' selected' : ''), '>', $txt['admin_search_type_online'], '</option> |
1640
|
|
|
</select> |
1641
|
|
|
<input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button"> |
1642
|
|
|
</span>'; |
1643
|
|
|
} |
1644
|
|
|
|
1645
|
|
|
?> |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state