comparison forum/Themes/default/Admin.template.php @ 76:e3e11437ecea website

Add forum code
author Chris Cannam
date Sun, 07 Jul 2013 11:25:48 +0200
parents
children
comparison
equal deleted inserted replaced
75:72f59aa7e503 76:e3e11437ecea
1 <?php
2 /**
3 * Simple Machines Forum (SMF)
4 *
5 * @package SMF
6 * @author Simple Machines
7 * @copyright 2011 Simple Machines
8 * @license http://www.simplemachines.org/about/smf/license.php BSD
9 *
10 * @version 2.0
11 */
12
13 // This is the administration center home.
14 function template_admin()
15 {
16 global $context, $settings, $options, $scripturl, $txt, $modSettings;
17
18 // Welcome message for the admin.
19 echo '
20 <div id="admincenter">
21 <div class="cat_bar">
22 <h3 class="catbg">';
23
24 if ($context['user']['is_admin'])
25 echo '
26 <object id="quick_search">
27 <form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '" class="floatright">
28 <img src="', $settings['images_url'] , '/filter.gif" alt="" />
29 <input type="text" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text" />
30 <select name="search_type">
31 <option value="internal"', (empty($context['admin_preferences']['sb']) || $context['admin_preferences']['sb'] == 'internal' ? ' selected="selected"' : ''), '>', $txt['admin_search_type_internal'], '</option>
32 <option value="member"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'member' ? ' selected="selected"' : ''), '>', $txt['admin_search_type_member'], '</option>
33 <option value="online"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'online' ? ' selected="selected"' : ''), '>', $txt['admin_search_type_online'], '</option>
34 </select>
35 <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit" />
36 </form>
37 </object>';
38
39 echo $txt['admin_center'], '
40 </h3>
41 </div>
42 <span class="upperframe"><span></span></span>
43 <div class="roundframe">
44 <div id="welcome">
45 <strong>', $txt['hello_guest'], ' ', $context['user']['name'], '!</strong>
46 ', sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']), '
47 </div>
48 </div>
49 <span class="lowerframe"><span></span></span>';
50
51 // Is there an update available?
52 echo '
53 <div id="update_section"></div>';
54
55 echo '
56 <div id="admin_main_section">';
57
58 // Display the "live news" from simplemachines.org.
59 echo '
60 <div id="live_news" class="floatleft">
61 <div class="cat_bar">
62 <h3 class="catbg">
63 <span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a> ', $txt['live'], '</span>
64 </h3>
65 </div>
66 <div class="windowbg nopadding">
67 <span class="topslice"><span></span></span>
68 <div class="content">
69 <div id="smfAnnouncements">', $txt['lfyi'], '</div>
70 </div>
71 <span class="botslice"><span></span></span>
72 </div>
73 </div>';
74
75 // Show the user version information from their server.
76 echo '
77 <div id="supportVersionsTable" class="floatright">
78 <div class="cat_bar">
79 <h3 class="catbg">
80 <a href="', $scripturl, '?action=admin;area=credits">', $txt['support_title'], '</a>
81 </h3>
82 </div>
83 <div class="windowbg nopadding">
84 <span class="topslice"><span></span></span>
85 <div class="content">
86 <div id="version_details">
87 <strong>', $txt['support_versions'], ':</strong><br />
88 ', $txt['support_versions_forum'], ':
89 <em id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</em><br />
90 ', $txt['support_versions_current'], ':
91 <em id="smfVersion" style="white-space: nowrap;">??</em><br />
92 ', $context['can_admin'] ? '<a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br />';
93
94 // Display all the members who can administrate the forum.
95 echo '
96 <br />
97 <strong>', $txt['administrators'], ':</strong>
98 ', implode(', ', $context['administrators']);
99 // If we have lots of admins... don't show them all.
100 if (!empty($context['more_admins_link']))
101 echo '
102 (', $context['more_admins_link'], ')';
103
104 echo '
105 </div>
106 </div>
107 <span class="botslice"><span></span></span>
108 </div>
109 </div>
110 </div>';
111
112 echo '
113 <div class="windowbg2 clear_right">
114 <span class="topslice"><span></span></span>
115 <div class="content">
116 <ul id="quick_tasks" class="flow_hidden">';
117
118 foreach ($context['quick_admin_tasks'] as $task)
119 echo '
120 <li>
121 ', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['default_images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '
122 <h5>', $task['link'], '</h5>
123 <span class="task">', $task['description'],'</span>
124 </li>';
125
126 echo '
127 </ul>
128 </div>
129 <span class="botslice clear"><span></span></span>
130 </div>
131 </div>
132 <br class="clear" />';
133
134 // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
135 if (empty($modSettings['disable_smf_js']))
136 echo '
137 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
138 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
139
140 // This sets the announcements and current versions themselves ;).
141 echo '
142 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/admin.js?fin20"></script>
143 <script type="text/javascript"><!-- // --><![CDATA[
144 var oAdminIndex = new smf_AdminIndex({
145 sSelf: \'oAdminCenter\',
146
147 bLoadAnnouncements: true,
148 sAnnouncementTemplate: ', JavaScriptEscape('
149 <dl>
150 %content%
151 </dl>
152 '), ',
153 sAnnouncementMessageTemplate: ', JavaScriptEscape('
154 <dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt>
155 <dd>
156 %message%
157 </dd>
158 '), ',
159 sAnnouncementContainerId: \'smfAnnouncements\',
160
161 bLoadVersions: true,
162 sSmfVersionContainerId: \'smfVersion\',
163 sYourVersionContainerId: \'yourVersion\',
164 sVersionOutdatedTemplate: ', JavaScriptEscape('
165 <span class="alert">%currentVersion%</span>
166 '), ',
167
168 bLoadUpdateNotification: true,
169 sUpdateNotificationContainerId: \'update_section\',
170 sUpdateNotificationDefaultTitle: ', JavaScriptEscape($txt['update_available']), ',
171 sUpdateNotificationDefaultMessage: ', JavaScriptEscape($txt['update_message']), ',
172 sUpdateNotificationTemplate: ', JavaScriptEscape('
173 <div class="cat_bar">
174 <h3 id="update_title" class="catbg">
175 %title%
176 </h3>
177 </div>
178 <div class="windowbg">
179 <span class="topslice"><span></span></span>
180 <div class="content">
181 <div id="update_message" class="smalltext">
182 %message%
183 </div>
184 </div>
185 <span class="botslice"><span></span></span>
186 </div>
187 '), ',
188 sUpdateNotificationLink: ', JavaScriptEscape($scripturl . '?action=admin;area=packages;pgdownload;auto;package=%package%;' . $context['session_var'] . '=' . $context['session_id']), '
189
190 });
191 // ]]></script>';
192 }
193
194 // Show some support information and credits to those who helped make this.
195 function template_credits()
196 {
197 global $context, $settings, $options, $scripturl, $txt;
198
199 // Show the user version information from their server.
200 echo '
201
202 <div id="admincenter">
203 <div class="cat_bar">
204 <h3 class="catbg">
205 ', $txt['support_title'], '
206 </h3>
207 </div>
208 <div class="windowbg">
209 <span class="topslice"><span></span></span>
210 <div class="content">
211 <strong>', $txt['support_versions'], ':</strong><br />
212 ', $txt['support_versions_forum'], ':
213 <em id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</em>', $context['can_admin'] ? ' <a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br />
214 ', $txt['support_versions_current'], ':
215 <em id="smfVersion" style="white-space: nowrap;">??</em><br />';
216
217 // Display all the variables we have server information for.
218 foreach ($context['current_versions'] as $version)
219 echo '
220 ', $version['title'], ':
221 <em>', $version['version'], '</em><br />';
222
223 echo '
224 </div>
225 <span class="botslice"><span></span></span>
226 </div>
227 ';
228
229 // Point the admin to common support resources.
230 echo '
231 <div class="cat_bar">
232 <h3 class="catbg">
233 ', $txt['support_resources'], '
234 </h3>
235 </div>
236 <div class="windowbg2">
237 <span class="topslice"><span></span></span>
238 <div class="content">
239 <p>', $txt['support_resources_p1'], '</p>
240 <p>', $txt['support_resources_p2'], '</p>
241 </div>
242 <span class="botslice"><span></span></span>
243 </div>';
244
245 // Display latest support questions from simplemachines.org.
246 echo '
247 <div class="cat_bar">
248 <h3 class="catbg">
249 <span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=latest_support" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a> ', $txt['support_latest'], '</span>
250 </h3>
251 </div>
252 <div class="windowbg2">
253 <span class="topslice"><span></span></span>
254 <div class="content">
255 <div id="latestSupport">', $txt['support_latest_fetch'], '</div>
256 </div>
257 <span class="botslice"><span></span></span>
258 </div>';
259
260 // The most important part - the credits :P.
261 echo '
262 <div class="cat_bar">
263 <h3 class="catbg">
264 ', $txt['admin_credits'], '
265 </h3>
266 </div>
267 <div class="windowbg">
268 <span class="topslice"><span></span></span>
269 <div class="content">';
270
271 foreach ($context['credits'] as $section)
272 {
273 if (isset($section['pretext']))
274 echo '
275 <p>', $section['pretext'], '</p>';
276
277 echo '
278 <dl>';
279
280 foreach ($section['groups'] as $group)
281 {
282 if (isset($group['title']))
283 echo '
284 <dt>
285 <strong>', $group['title'], ':</strong>
286 </dt>';
287
288 echo '
289 <dd>', implode(', ', $group['members']), '</dd>';
290 }
291
292 echo '
293 </dl>';
294
295 if (isset($section['posttext']))
296 echo '
297 <p>', $section['posttext'], '</p>';
298 }
299
300 echo '
301 </div>
302 <span class="botslice"><span></span></span>
303 </div>
304 </div>
305 <br class="clear" />';
306
307 // This makes all the support information available to the support script...
308 echo '
309 <script type="text/javascript"><!-- // --><![CDATA[
310 var smfSupportVersions = {};
311
312 smfSupportVersions.forum = "', $context['forum_version'], '";';
313
314 // Don't worry, none of this is logged, it's just used to give information that might be of use.
315 foreach ($context['current_versions'] as $variable => $version)
316 echo '
317 smfSupportVersions.', $variable, ' = "', $version['version'], '";';
318
319 // Now we just have to include the script and wait ;).
320 echo '
321 // ]]></script>
322 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
323 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>
324 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-support.js"></script>';
325
326 // This sets the latest support stuff.
327 echo '
328 <script type="text/javascript"><!-- // --><![CDATA[
329 function smfSetLatestSupport()
330 {
331 if (window.smfLatestSupport)
332 setInnerHTML(document.getElementById("latestSupport"), window.smfLatestSupport);
333 }
334
335 function smfCurrentVersion()
336 {
337 var smfVer, yourVer;
338
339 if (!window.smfVersion)
340 return;
341
342 smfVer = document.getElementById("smfVersion");
343 yourVer = document.getElementById("yourVersion");
344
345 setInnerHTML(smfVer, window.smfVersion);
346
347 var currentVersion = getInnerHTML(yourVer);
348 if (currentVersion != window.smfVersion)
349 setInnerHTML(yourVer, "<span class=\"alert\">" + currentVersion + "</span>");
350 }';
351
352 // IE 4 is rather annoying, this wouldn't be necessary...
353 echo '
354 var fSetupCredits = function ()
355 {
356 smfSetLatestSupport();
357 smfCurrentVersion()
358 }
359 addLoadEvent(fSetupCredits);
360 // ]]></script>';
361 }
362
363 // Displays information about file versions installed, and compares them to current version.
364 function template_view_versions()
365 {
366 global $context, $settings, $options, $scripturl, $txt;
367
368 echo '
369 <div id="admincenter">
370 <div class="cat_bar">
371 <h3 class="catbg">
372 ', $txt['admin_version_check'], '
373 </h3>
374 </div>
375 <div class="information">', $txt['version_check_desc'], '</div>
376 <table width="100%" class="table_grid">
377 <thead>
378 <tr class="catbg" align="left">
379 <th class="first_th" scope="col" width="50%">
380 <strong>', $txt['admin_smffile'], '</strong>
381 </th>
382 <th scope="col" width="25%">
383 <strong>', $txt['dvc_your'], '</strong>
384 </th>
385 <th class="last_th" scope="col"" width="25%">
386 <strong>', $txt['dvc_current'], '</strong>
387 </th>
388 </tr>
389 </thead>
390 <tbody>';
391
392 // The current version of the core SMF package.
393 echo '
394 <tr>
395 <td class="windowbg">
396 ', $txt['admin_smfpackage'], '
397 </td>
398 <td class="windowbg">
399 <em id="yourSMF">', $context['forum_version'], '</em>
400 </td>
401 <td class="windowbg">
402 <em id="currentSMF">??</em>
403 </td>
404 </tr>';
405
406 // Now list all the source file versions, starting with the overall version (if all match!).
407 echo '
408 <tr>
409 <td class="windowbg">
410 <a href="#" id="Sources-link">', $txt['dvc_sources'], '</a>
411 </td>
412 <td class="windowbg">
413 <em id="yourSources">??</em>
414 </td>
415 <td class="windowbg">
416 <em id="currentSources">??</em>
417 </td>
418 </tr>
419 </tbody>
420 </table>
421
422 <table id="Sources" width="100%" class="table_grid">
423 <tbody>';
424
425 // Loop through every source file displaying its version - using javascript.
426 foreach ($context['file_versions'] as $filename => $version)
427 echo '
428 <tr>
429 <td class="windowbg2" width="50%" style="padding-left: 3ex;">
430 ', $filename, '
431 </td>
432 <td class="windowbg2" width="25%">
433 <em id="yourSources', $filename, '">', $version, '</em>
434 </td>
435 <td class="windowbg2" width="25%">
436 <em id="currentSources', $filename, '">??</em>
437 </td>
438 </tr>';
439
440 // Default template files.
441 echo '
442 </tbody>
443 </table>
444
445 <table width="100%" class="table_grid">
446 <tbody>
447 <tr>
448 <td class="windowbg" width="50%">
449 <a href="#" id="Default-link">', $txt['dvc_default'], '</a>
450 </td>
451 <td class="windowbg" width="25%">
452 <em id="yourDefault">??</em>
453 </td>
454 <td class="windowbg" width="25%">
455 <em id="currentDefault">??</em>
456 </td>
457 </tr>
458 </tbody>
459 </table>
460
461 <table id="Default" width="100%" class="table_grid">
462 <tbody>';
463
464 foreach ($context['default_template_versions'] as $filename => $version)
465 echo '
466 <tr>
467 <td class="windowbg2" width="50%" style="padding-left: 3ex;">
468 ', $filename, '
469 </td>
470 <td class="windowbg2" width="25%">
471 <em id="yourDefault', $filename, '">', $version, '</em>
472 </td>
473 <td class="windowbg2" width="25%">
474 <em id="currentDefault', $filename, '">??</em>
475 </td>
476 </tr>';
477
478 // Now the language files...
479 echo '
480 </tbody>
481 </table>
482
483 <table width="100%" class="table_grid">
484 <tbody>
485 <tr>
486 <td class="windowbg" width="50%">
487 <a href="#" id="Languages-link">', $txt['dvc_languages'], '</a>
488 </td>
489 <td class="windowbg" width="25%">
490 <em id="yourLanguages">??</em>
491 </td>
492 <td class="windowbg" width="25%">
493 <em id="currentLanguages">??</em>
494 </td>
495 </tr>
496 </tbody>
497 </table>
498
499 <table id="Languages" width="100%" class="table_grid">
500 <tbody>';
501
502 foreach ($context['default_language_versions'] as $language => $files)
503 {
504 foreach ($files as $filename => $version)
505 echo '
506 <tr>
507 <td class="windowbg2" width="50%" style="padding-left: 3ex;">
508 ', $filename, '.<em>', $language, '</em>.php
509 </td>
510 <td class="windowbg2" width="25%">
511 <em id="your', $filename, '.', $language, '">', $version, '</em>
512 </td>
513 <td class="windowbg2" width="25%">
514 <em id="current', $filename, '.', $language, '">??</em>
515 </td>
516 </tr>';
517 }
518
519 echo '
520 </tbody>
521 </table>';
522
523 // Finally, display the version information for the currently selected theme - if it is not the default one.
524 if (!empty($context['template_versions']))
525 {
526 echo '
527 <table width="100%" class="table_grid">
528 <tbody>
529 <tr>
530 <td class="windowbg" width="50%">
531 <a href="#" id="Templates-link">', $txt['dvc_templates'], '</a>
532 </td>
533 <td class="windowbg" width="25%">
534 <em id="yourTemplates">??</em>
535 </td>
536 <td class="windowbg" width="25%">
537 <em id="currentTemplates">??</em>
538 </td>
539 </tr>
540 </tbody>
541 </table>
542
543 <table id="Templates" width="100%" class="table_grid">
544 <tbody>';
545
546 foreach ($context['template_versions'] as $filename => $version)
547 echo '
548 <tr>
549 <td class="windowbg2" width="50%" style="padding-left: 3ex;">
550 ', $filename, '
551 </td>
552 <td class="windowbg2" width="25%">
553 <em id="yourTemplates', $filename, '">', $version, '</em>
554 </td>
555 <td class="windowbg2" width="25%">
556 <em id="currentTemplates', $filename, '">??</em>
557 </td>
558 </tr>';
559
560 echo '
561 </tbody>
562 </table>';
563 }
564
565 echo '
566 </div>
567 <br class="clear" />';
568
569 /* Below is the hefty javascript for this. Upon opening the page it checks the current file versions with ones
570 held at simplemachines.org and works out if they are up to date. If they aren't it colors that files number
571 red. It also contains the function, swapOption, that toggles showing the detailed information for each of the
572 file categories. (sources, languages, and templates.) */
573 echo '
574 <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=detailed-version.js"></script>
575 <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/admin.js?fin20"></script>
576 <script type="text/javascript"><!-- // --><![CDATA[
577 var oViewVersions = new smf_ViewVersions({
578 aKnownLanguages: [
579 \'.', implode('\',
580 \'.', $context['default_known_languages']), '\'
581 ],
582 oSectionContainerIds: {
583 Sources: \'Sources\',
584 Default: \'Default\',
585 Languages: \'Languages\',
586 Templates: \'Templates\'
587 }
588 });
589 // ]]></script>';
590
591 }
592
593 // Form for stopping people using naughty words, etc.
594 function template_edit_censored()
595 {
596 global $context, $settings, $options, $scripturl, $txt, $modSettings;
597
598 // First section is for adding/removing words from the censored list.
599 echo '
600 <div id="admincenter">
601 <form action="', $scripturl, '?action=admin;area=postsettings;sa=censor" method="post" accept-charset="', $context['character_set'], '">
602 <div class="cat_bar">
603 <h3 class="catbg">
604 ', $txt['admin_censored_words'], '
605 </h3>
606 </div>
607 <div class="windowbg2">
608 <span class="topslice"><span></span></span>
609 <div class="content">
610 <p>', $txt['admin_censored_where'], '</p>';
611
612 // Show text boxes for censoring [bad ] => [good ].
613 foreach ($context['censored_words'] as $vulgar => $proper)
614 echo '
615 <div style="margin-top: 1ex;"><input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="20" /> => <input type="text" name="censor_proper[]" value="', $proper, '" size="20" /></div>';
616
617 // Now provide a way to censor more words.
618 echo '
619 <noscript>
620 <div style="margin-top: 1ex;"><input type="text" name="censor_vulgar[]" size="20" class="input_text" /> => <input type="text" name="censor_proper[]" size="20" class="input_text" /></div>
621 </noscript>
622 <div id="moreCensoredWords"></div><div style="margin-top: 1ex; display: none;" id="moreCensoredWords_link"><a href="#;" onclick="addNewWord(); return false;">', $txt['censor_clickadd'], '</a></div>
623 <script type="text/javascript"><!-- // --><![CDATA[
624 document.getElementById("moreCensoredWords_link").style.display = "";
625
626 function addNewWord()
627 {
628 setOuterHTML(document.getElementById("moreCensoredWords"), \'<div style="margin-top: 1ex;"><input type="text" name="censor_vulgar[]" size="20" class="input_text" /> => <input type="text" name="censor_proper[]" size="20" class="input_text" /><\' + \'/div><div id="moreCensoredWords"><\' + \'/div>\');
629 }
630 // ]]></script>
631 <hr width="100%" size="1" class="hrcolor clear" />
632 <dl class="settings">
633 <dt>
634 <strong><label for="censorWholeWord_check">', $txt['censor_whole_words'], ':</label></strong>
635 </dt>
636 <dd>
637 <input type="checkbox" name="censorWholeWord" value="1" id="censorWholeWord_check"', empty($modSettings['censorWholeWord']) ? '' : ' checked="checked"', ' class="input_check" />
638 </dd>
639 <dt>
640 <strong><label for="censorIgnoreCase_check">', $txt['censor_case'], ':</label></strong>
641 </dt>
642 <dd>
643 <input type="checkbox" name="censorIgnoreCase" value="1" id="censorIgnoreCase_check"', empty($modSettings['censorIgnoreCase']) ? '' : ' checked="checked"', ' class="input_check" />
644 </dd>
645 </dl>
646 <input type="submit" name="save_censor" value="', $txt['save'], '" class="button_submit" />
647 </div>
648 <span class="botslice"><span></span></span>
649 </div>';
650
651 // This table lets you test out your filters by typing in rude words and seeing what comes out.
652 echo '
653 <div class="cat_bar">
654 <h3 class="catbg">
655 ', $txt['censor_test'], '
656 </h3>
657 </div>
658 <div class="windowbg">
659 <span class="topslice"><span></span></span>
660 <div class="content">
661 <p class="centertext">
662 <input type="text" name="censortest" value="', empty($context['censor_test']) ? '' : $context['censor_test'], '" class="input_text" />
663 <input type="submit" value="', $txt['censor_test_save'], '" class="button_submit" />
664 </p>
665 </div>
666 <span class="botslice"><span></span></span>
667 </div>
668
669 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
670 </form>
671 </div>
672 <br class="clear" />';
673 }
674
675 // Maintenance is a lovely thing, isn't it?
676 function template_not_done()
677 {
678 global $context, $settings, $options, $txt, $scripturl;
679
680 echo '
681 <div id="admincenter">
682 <div class="cat_bar">
683 <h3 class="catbg">
684 ', $txt['not_done_title'], '
685 </h3>
686 </div>
687 <div class="windowbg">
688 <span class="topslice"><span></span></span>
689 <div class="content">
690 ', $txt['not_done_reason'];
691
692 if (!empty($context['continue_percent']))
693 echo '
694 <div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
695 <div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
696 <div style="padding-top: ', $context['browser']['is_webkit'] || $context['browser']['is_konqueror'] ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['continue_percent'], '%</div>
697 <div style="width: ', $context['continue_percent'], '%; height: 12pt; z-index: 1; background-color: red;">&nbsp;</div>
698 </div>
699 </div>';
700
701 if (!empty($context['substep_enabled']))
702 echo '
703 <div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
704 <span class="smalltext">', $context['substep_title'], '</span>
705 <div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
706 <div style="padding-top: ', $context['browser']['is_webkit'] || $context['browser']['is_konqueror'] ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['substep_continue_percent'], '%</div>
707 <div style="width: ', $context['substep_continue_percent'], '%; height: 12pt; z-index: 1; background-color: blue;">&nbsp;</div>
708 </div>
709 </div>';
710
711 echo '
712 <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;" name="autoSubmit" id="autoSubmit">
713 <div style="margin: 1ex; text-align: right;"><input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button_submit" /></div>
714 ', $context['continue_post_data'], '
715 </form>
716 </div>
717 <span class="botslice"><span></span></span>
718 </div>
719 </div>
720 <br class="clear" />
721 <script type="text/javascript"><!-- // --><![CDATA[
722 var countdown = ', $context['continue_countdown'], ';
723 doAutoSubmit();
724
725 function doAutoSubmit()
726 {
727 if (countdown == 0)
728 document.forms.autoSubmit.submit();
729 else if (countdown == -1)
730 return;
731
732 document.forms.autoSubmit.cont.value = "', $txt['not_done_continue'], ' (" + countdown + ")";
733 countdown--;
734
735 setTimeout("doAutoSubmit();", 1000);
736 }
737 // ]]></script>';
738 }
739
740 // Template for showing settings (Of any kind really!)
741 function template_show_settings()
742 {
743 global $context, $txt, $settings, $scripturl;
744
745 echo '
746 <script type="text/javascript"><!-- // --><![CDATA[';
747
748 if (!empty($context['settings_pre_javascript']))
749 echo $context['settings_pre_javascript'];
750
751 // If we have BBC selection we have a bit of JS.
752 if (!empty($context['bbc_sections']))
753 {
754 echo '
755 function toggleBBCDisabled(section, disable)
756 {
757 for (var i = 0; i < document.forms.bbcForm.length; i++)
758 {
759 if (typeof(document.forms.bbcForm[i].name) == "undefined" || (document.forms.bbcForm[i].name.substr(0, 11) != "enabledTags") || (document.forms.bbcForm[i].name.indexOf(section) != 11))
760 continue;
761
762 document.forms.bbcForm[i].disabled = disable;
763 }
764 document.getElementById("bbc_" + section + "_select_all").disabled = disable;
765 }';
766 }
767 echo '
768 // ]]></script>';
769
770 if (!empty($context['settings_insert_above']))
771 echo $context['settings_insert_above'];
772
773 echo '
774 <div id="admincenter">
775 <form action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
776
777 // Is there a custom title?
778 if (isset($context['settings_title']))
779 echo '
780 <div class="cat_bar">
781 <h3 class="catbg">
782 ', $context['settings_title'], '
783 </h3>
784 </div>';
785
786 // Have we got some custom code to insert?
787 if (!empty($context['settings_message']))
788 echo '
789 <div class="information">', $context['settings_message'], '</div>';
790
791 // Now actually loop through all the variables.
792 $is_open = false;
793 foreach ($context['config_vars'] as $config_var)
794 {
795 // Is it a title or a description?
796 if (is_array($config_var) && ($config_var['type'] == 'title' || $config_var['type'] == 'desc'))
797 {
798 // Not a list yet?
799 if ($is_open)
800 {
801 $is_open = false;
802 echo '
803 </dl>
804 </div>
805 <span class="botslice"><span></span></span>
806 </div>';
807 }
808
809 // A title?
810 if ($config_var['type'] == 'title')
811 {
812 echo '
813 <div class="cat_bar">
814 <h3 class="', !empty($config_var['class']) ? $config_var['class'] : 'catbg', '"', !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>
815 ', ($config_var['help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $config_var['help'] . '" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" class="icon" alt="' . $txt['help'] . '" /></a>' : ''), '
816 ', $config_var['label'], '
817 </h3>
818 </div>';
819 }
820 // A description?
821 else
822 {
823 echo '
824 <p class="description">
825 ', $config_var['label'], '
826 </p>';
827 }
828
829 continue;
830 }
831
832 // Not a list yet?
833 if (!$is_open)
834 {
835 $is_open = true;
836 echo '
837 <div class="windowbg2">
838 <span class="topslice"><span></span></span>
839 <div class="content">
840 <dl class="settings">';
841 }
842
843 // Hang about? Are you pulling my leg - a callback?!
844 if (is_array($config_var) && $config_var['type'] == 'callback')
845 {
846 if (function_exists('template_callback_' . $config_var['name']))
847 call_user_func('template_callback_' . $config_var['name']);
848
849 continue;
850 }
851
852 if (is_array($config_var))
853 {
854 // First off, is this a span like a message?
855 if (in_array($config_var['type'], array('message', 'warning')))
856 {
857 echo '
858 <dd', $config_var['type'] == 'warning' ? ' class="alert"' : '', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>
859 ', $config_var['label'], '
860 </dd>';
861 }
862 // Otherwise it's an input box of some kind.
863 else
864 {
865 echo '
866 <dt', is_array($config_var) && !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>';
867
868 // Some quick helpers...
869 $javascript = $config_var['javascript'];
870 $disabled = !empty($config_var['disabled']) ? ' disabled="disabled"' : '';
871 $subtext = !empty($config_var['subtext']) ? '<br /><span class="smalltext"> ' . $config_var['subtext'] . '</span>' : '';
872
873 // Show the [?] button.
874 if ($config_var['help'])
875 echo '
876 <a id="setting_', $config_var['name'], '" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></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>
877 </dt>';
878 else
879 echo '
880 <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>
881 </dt>';
882
883 echo '
884 <dd', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>',
885 $config_var['preinput'];
886
887 // Show a check box.
888 if ($config_var['type'] == 'check')
889 echo '
890 <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked="checked"' : ''), ' value="1" class="input_check" />';
891 // Escape (via htmlspecialchars.) the text box.
892 elseif ($config_var['type'] == 'password')
893 echo '
894 <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;" class="input_password" /><br />
895 <input type="password" disabled="disabled" id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password" />';
896 // Show a selection box.
897 elseif ($config_var['type'] == 'select')
898 {
899 echo '
900 <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), '>';
901 foreach ($config_var['data'] as $option)
902 echo '
903 <option value="', $option[0], '"', (($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected="selected"' : ''), '>', $option[1], '</option>';
904 echo '
905 </select>';
906 }
907 // Text area?
908 elseif ($config_var['type'] == 'large_text')
909 echo '
910 <textarea rows="', ($config_var['size'] ? $config_var['size'] : 4), '" cols="30" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
911 // Permission group?
912 elseif ($config_var['type'] == 'permissions')
913 theme_inline_permissions($config_var['name']);
914 // BBC selection?
915 elseif ($config_var['type'] == 'bbc')
916 {
917 echo '
918 <fieldset id="', $config_var['name'], '">
919 <legend>', $txt['bbcTagsToUse_select'], '</legend>
920 <ul class="reset">';
921
922 foreach ($context['bbc_columns'] as $bbcColumn)
923 {
924 foreach ($bbcColumn as $bbcTag)
925 echo '
926 <li class="list_bbc floatleft">
927 <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="checked"' : '', ' class="input_check" /> <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 reqWin(this.href);">?</a>)' : '', '
928 </li>';
929 }
930 echo ' </ul>
931 <input type="checkbox" id="select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
932 </fieldset>';
933 }
934 // A simple message?
935 elseif ($config_var['type'] == 'var_message')
936 echo '
937 <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>';
938 // Assume it must be a text box.
939 else
940 echo '
941 <input type="text"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '" value="', $config_var['value'], '"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_text" />';
942
943 echo isset($config_var['postinput']) ? '
944 ' . $config_var['postinput'] : '',
945 '</dd>';
946 }
947 }
948
949 else
950 {
951 // Just show a separator.
952 if ($config_var == '')
953 echo '
954 </dl>
955 <hr class="hrcolor clear" />
956 <dl class="settings">';
957 else
958 echo '
959 <dd>
960 <strong>' . $config_var . '</strong>
961 </dd>';
962 }
963 }
964
965 if ($is_open)
966 echo '
967 </dl>';
968
969 if (empty($context['settings_save_dont_show']))
970 echo '
971 <hr class="hrcolor clear" />
972 <div class="righttext">
973 <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled="disabled"' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit" />
974 </div>';
975
976 if ($is_open)
977 echo '
978 </div>
979 <span class="botslice"><span></span></span>
980 </div>';
981
982 echo '
983 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
984 </form>
985 </div>
986 <br class="clear" />';
987
988 if (!empty($context['settings_post_javascript']))
989 echo '
990 <script type="text/javascript"><!-- // --><![CDATA[
991 ', $context['settings_post_javascript'], '
992 // ]]></script>';
993
994 if (!empty($context['settings_insert_below']))
995 echo $context['settings_insert_below'];
996 }
997
998 // Template for showing custom profile fields.
999 function template_show_custom_profile()
1000 {
1001 global $context, $txt, $settings, $scripturl;
1002
1003 // Standard fields.
1004 template_show_list('standard_profile_fields');
1005
1006 echo '
1007 <script type="text/javascript"><!-- // --><![CDATA[
1008 var iNumChecks = document.forms.standardProfileFields.length;
1009 for (var i = 0; i < iNumChecks; i++)
1010 if (document.forms.standardProfileFields[i].id.indexOf(\'reg_\') == 0)
1011 document.forms.standardProfileFields[i].disabled = document.forms.standardProfileFields[i].disabled || !document.getElementById(\'active_\' + document.forms.standardProfileFields[i].id.substr(4)).checked;
1012 // ]]></script><br />';
1013
1014 // Custom fields.
1015 template_show_list('custom_profile_fields');
1016 }
1017
1018 // Edit a profile field?
1019 function template_edit_profile_field()
1020 {
1021 global $context, $txt, $settings, $scripturl;
1022
1023 // All the javascript for this page - quite a bit!
1024 echo '
1025 <script type="text/javascript"><!-- // --><![CDATA[
1026 function updateInputBoxes()
1027 {
1028 curType = document.getElementById("field_type").value;
1029 privStatus = document.getElementById("private").value;
1030 document.getElementById("max_length_dt").style.display = curType == "text" || curType == "textarea" ? "" : "none";
1031 document.getElementById("max_length_dd").style.display = curType == "text" || curType == "textarea" ? "" : "none";
1032 document.getElementById("dimension_dt").style.display = curType == "textarea" ? "" : "none";
1033 document.getElementById("dimension_dd").style.display = curType == "textarea" ? "" : "none";
1034 document.getElementById("bbc_dt").style.display = curType == "text" || curType == "textarea" ? "" : "none";
1035 document.getElementById("bbc_dd").style.display = curType == "text" || curType == "textarea" ? "" : "none";
1036 document.getElementById("options_dt").style.display = curType == "select" || curType == "radio" ? "" : "none";
1037 document.getElementById("options_dd").style.display = curType == "select" || curType == "radio" ? "" : "none";
1038 document.getElementById("default_dt").style.display = curType == "check" ? "" : "none";
1039 document.getElementById("default_dd").style.display = curType == "check" ? "" : "none";
1040 document.getElementById("mask_dt").style.display = curType == "text" ? "" : "none";
1041 document.getElementById("mask").style.display = curType == "text" ? "" : "none";
1042 document.getElementById("can_search_dt").style.display = curType == "text" || curType == "textarea" ? "" : "none";
1043 document.getElementById("can_search_dd").style.display = curType == "text" || curType == "textarea" ? "" : "none";
1044 document.getElementById("regex_div").style.display = curType == "text" && document.getElementById("mask").value == "regex" ? "" : "none";
1045 document.getElementById("display").disabled = false;
1046 // Cannot show this on the topic
1047 if (curType == "textarea" || privStatus >= 2)
1048 {
1049 document.getElementById("display").checked = false;
1050 document.getElementById("display").disabled = true;
1051 }
1052 }
1053
1054 var startOptID = ', count($context['field']['options']), ';
1055 function addOption()
1056 {
1057 setOuterHTML(document.getElementById("addopt"), \'<br /><input type="radio" name="default_select" value="\' + startOptID + \'" id="\' + startOptID + \'" class="input_radio" /><input type="text" name="select_option[\' + startOptID + \']" value="" class="input_text" /><span id="addopt"></span>\');
1058 startOptID++;
1059 }
1060 // ]]></script>';
1061
1062 echo '
1063 <div id="admincenter">
1064 <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'], '">
1065 <div class="cat_bar">
1066 <h3 class="catbg">
1067 ', $context['page_title'], '
1068 </h3>
1069 </div>
1070 <div class="windowbg">
1071 <span class="topslice"><span></span></span>
1072 <div class="content">
1073 <fieldset>
1074 <legend>', $txt['custom_edit_general'], '</legend>
1075
1076 <dl class="settings">
1077 <dt>
1078 <strong>', $txt['custom_edit_name'], ':</strong>
1079 </dt>
1080 <dd>
1081 <input type="text" name="field_name" value="', $context['field']['name'], '" size="20" maxlength="40" class="input_text" />
1082 </dd>
1083 <dt>
1084 <strong>', $txt['custom_edit_desc'], ':</strong>
1085 </dt>
1086 <dd>
1087 <textarea name="field_desc" rows="3" cols="40">', $context['field']['desc'], '</textarea>
1088 </dd>
1089 <dt>
1090 <strong>', $txt['custom_edit_profile'], ':</strong><br />
1091 <span class="smalltext">', $txt['custom_edit_profile_desc'], '</span>
1092 </dt>
1093 <dd>
1094 <select name="profile_area">
1095 <option value="none"', $context['field']['profile_area'] == 'none' ? ' selected="selected"' : '', '>', $txt['custom_edit_profile_none'], '</option>
1096 <option value="account"', $context['field']['profile_area'] == 'account' ? ' selected="selected"' : '', '>', $txt['account'], '</option>
1097 <option value="forumprofile"', $context['field']['profile_area'] == 'forumprofile' ? ' selected="selected"' : '', '>', $txt['forumprofile'], '</option>
1098 <option value="theme"', $context['field']['profile_area'] == 'theme' ? ' selected="selected"' : '', '>', $txt['theme'], '</option>
1099 </select>
1100 </dd>
1101 <dt>
1102 <strong>', $txt['custom_edit_registration'], ':</strong>
1103 </dt>
1104 <dd>
1105 <select name="reg" id="reg">
1106 <option value="0"', $context['field']['reg'] == 0 ? ' selected="selected"' : '', '>', $txt['custom_edit_registration_disable'], '</option>
1107 <option value="1"', $context['field']['reg'] == 1 ? ' selected="selected"' : '', '>', $txt['custom_edit_registration_allow'], '</option>
1108 <option value="2"', $context['field']['reg'] == 2 ? ' selected="selected"' : '', '>', $txt['custom_edit_registration_require'], '</option>
1109 </select>
1110 </dd>
1111 <dt>
1112 <strong>', $txt['custom_edit_display'], ':</strong>
1113 </dt>
1114 <dd>
1115 <input type="checkbox" name="display" id="display"', $context['field']['display'] ? ' checked="checked"' : '', ' class="input_check" />
1116 </dd>
1117
1118 <dt>
1119 <strong>', $txt['custom_edit_placement'], ':</strong>
1120 </dt>
1121 <dd>
1122 <select name="placement" id="placement">
1123 <option value="0"', $context['field']['placement'] == '0' ? ' selected="selected"' : '', '>', $txt['custom_edit_placement_standard'], '</option>
1124 <option value="1"', $context['field']['placement'] == '1' ? ' selected="selected"' : '', '>', $txt['custom_edit_placement_withicons'], '</option>
1125 <option value="2"', $context['field']['placement'] == '2' ? ' selected="selected"' : '', '>', $txt['custom_edit_placement_abovesignature'], '</option>
1126 </select>
1127 </dd>
1128 <dt>
1129 <a id="field_show_enclosed" href="', $scripturl, '?action=helpadmin;help=field_show_enclosed" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" align="top" /></a>
1130 <strong>', $txt['custom_edit_enclose'], ':</strong><br />
1131 <span class="smalltext">', $txt['custom_edit_enclose_desc'], '</span>
1132 </dt>
1133 <dd>
1134 <textarea name="enclose" rows="10" cols="50">', @$context['field']['enclose'], '</textarea>
1135 </dd>
1136 </dl>
1137 </fieldset>
1138 <fieldset>
1139 <legend>', $txt['custom_edit_input'], '</legend>
1140 <dl class="settings">
1141 <dt>
1142 <strong>', $txt['custom_edit_picktype'], ':</strong>
1143 </dt>
1144 <dd>
1145 <select name="field_type" id="field_type" onchange="updateInputBoxes();">
1146 <option value="text"', $context['field']['type'] == 'text' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_text'], '</option>
1147 <option value="textarea"', $context['field']['type'] == 'textarea' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_textarea'], '</option>
1148 <option value="select"', $context['field']['type'] == 'select' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_select'], '</option>
1149 <option value="radio"', $context['field']['type'] == 'radio' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_radio'], '</option>
1150 <option value="check"', $context['field']['type'] == 'check' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_check'], '</option>
1151 </select>
1152 </dd>
1153 <dt id="max_length_dt">
1154 <strong>', $txt['custom_edit_max_length'], ':</strong><br />
1155 <span class="smalltext">', $txt['custom_edit_max_length_desc'], '</span>
1156 </dt>
1157 <dd id="max_length_dd">
1158 <input type="text" name="max_length" value="', $context['field']['max_length'], '" size="7" maxlength="6" class="input_text" />
1159 </dd>
1160 <dt id="dimension_dt">
1161 <strong>', $txt['custom_edit_dimension'], ':</strong>
1162 </dt>
1163 <dd id="dimension_dd">
1164 <strong>', $txt['custom_edit_dimension_row'], ':</strong> <input type="text" name="rows" value="', $context['field']['rows'], '" size="5" maxlength="3" class="input_text" />
1165 <strong>', $txt['custom_edit_dimension_col'], ':</strong> <input type="text" name="cols" value="', $context['field']['cols'], '" size="5" maxlength="3" class="input_text" />
1166 </dd>
1167 <dt id="bbc_dt">
1168 <strong>', $txt['custom_edit_bbc'], '</strong>
1169 </dt>
1170 <dd id="bbc_dd">
1171 <input type="checkbox" name="bbc"', $context['field']['bbc'] ? ' checked="checked"' : '', ' class="input_check" />
1172 </dd>
1173 <dt id="options_dt">
1174 <a href="', $scripturl, '?action=helpadmin;help=customoptions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a>
1175 <strong>', $txt['custom_edit_options'], ':</strong><br />
1176 <span class="smalltext">', $txt['custom_edit_options_desc'], '</span>
1177 </dt>
1178 <dd id="options_dd">
1179 <div>';
1180
1181 foreach ($context['field']['options'] as $k => $option)
1182 {
1183 echo '
1184 ', $k == 0 ? '' : '<br />', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked="checked"' : '', ' class="input_radio" /><input type="text" name="select_option[', $k, ']" value="', $option, '" class="input_text" />';
1185 }
1186 echo '
1187 <span id="addopt"></span>
1188 [<a href="" onclick="addOption(); return false;">', $txt['custom_edit_options_more'], '</a>]
1189 </div>
1190 </dd>
1191 <dt id="default_dt">
1192 <strong>', $txt['custom_edit_default'], ':</strong>
1193 </dt>
1194 <dd id="default_dd">
1195 <input type="checkbox" name="default_check"', $context['field']['default_check'] ? ' checked="checked"' : '', ' class="input_check" />
1196 </dd>
1197 </dl>
1198 </fieldset>
1199 <fieldset>
1200 <legend>', $txt['custom_edit_advanced'], '</legend>
1201 <dl class="settings">
1202 <dt id="mask_dt">
1203 <a id="custom_mask" href="', $scripturl, '?action=helpadmin;help=custom_mask" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" align="top" /></a>
1204 <strong>', $txt['custom_edit_mask'], ':</strong><br />
1205 <span class="smalltext">', $txt['custom_edit_mask_desc'], '</span>
1206 </dt>
1207 <dd>
1208 <select name="mask" id="mask" onchange="updateInputBoxes();">
1209 <option value="nohtml"', $context['field']['mask'] == 'nohtml' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_nohtml'], '</option>
1210 <option value="email"', $context['field']['mask'] == 'email' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_email'], '</option>
1211 <option value="number"', $context['field']['mask'] == 'number' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_number'], '</option>
1212 <option value="regex"', substr($context['field']['mask'], 0, 5) == 'regex' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_regex'], '</option>
1213 </select>
1214 <br />
1215 <span id="regex_div">
1216 <input type="text" name="regex" value="', $context['field']['regex'], '" size="30" class="input_text" />
1217 </span>
1218 </dd>
1219 <dt>
1220 <strong>', $txt['custom_edit_privacy'], ':</strong>
1221 <span class="smalltext">', $txt['custom_edit_privacy_desc'], '</span>
1222 </dt>
1223 <dd>
1224 <select name="private" id="private" onchange="updateInputBoxes();" style="width: 100%">
1225 <option value="0"', $context['field']['private'] == 0 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_all'], '</option>
1226 <option value="1"', $context['field']['private'] == 1 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_see'], '</option>
1227 <option value="2"', $context['field']['private'] == 2 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_owner'], '</option>
1228 <option value="3"', $context['field']['private'] == 3 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_none'], '</option>
1229 </select>
1230 </dd>
1231 <dt id="can_search_dt">
1232 <strong>', $txt['custom_edit_can_search'], ':</strong><br />
1233 <span class="smalltext">', $txt['custom_edit_can_search_desc'], '</span>
1234 </dt>
1235 <dd id="can_search_dd">
1236 <input type="checkbox" name="can_search"', $context['field']['can_search'] ? ' checked="checked"' : '', ' class="input_check" />
1237 </dd>
1238 <dt>
1239 <strong>', $txt['custom_edit_active'], ':</strong><br />
1240 <span class="smalltext">', $txt['custom_edit_active_desc'], '</span>
1241 </dt>
1242 <dd>
1243 <input type="checkbox" name="active"', $context['field']['active'] ? ' checked="checked"' : '', ' class="input_check" />
1244 </dd>
1245 </dl>
1246 </fieldset>
1247 <div class="righttext">
1248 <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />';
1249
1250 if ($context['fid'])
1251 echo '
1252 <input type="submit" name="delete" value="', $txt['delete'], '" onclick="return confirm(\'', $txt['custom_edit_delete_sure'], '\');" class="button_submit" />';
1253
1254 echo '
1255 </div>
1256 </div>
1257 <span class="botslice"><span></span></span>
1258 </div>
1259 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
1260 </form>
1261 </div>
1262 <br class="clear" />';
1263
1264 // Get the javascript bits right!
1265 echo '
1266 <script type="text/javascript"><!-- // --><![CDATA[
1267 updateInputBoxes();
1268 // ]]></script>';
1269 }
1270
1271 // Results page for an admin search.
1272 function template_admin_search_results()
1273 {
1274 global $context, $txt, $settings, $options, $scripturl;
1275
1276 echo '
1277 <div class="cat_bar">
1278 <h3 class="catbg">
1279 <object id="quick_search">
1280 <form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '" class="floatright">
1281 <input type="text" name="search_term" value="', $context['search_term'], '" class="input_text" />
1282 <input type="hidden" name="search_type" value="', $context['search_type'], '" />
1283 <input type="submit" name="search_go" value="', $txt['admin_search_results_again'], '" class="button_submit" />
1284 </form>
1285 </object>
1286 <span class="ie6_header floatleft"><img src="' . $settings['images_url'] . '/buttons/search.gif" alt="" />&nbsp;', sprintf($txt['admin_search_results_desc'], $context['search_term']), '</span>
1287 </h3>
1288 </div>
1289 <div class="windowbg nopadding">
1290 <span class="topslice"><span></span></span>
1291 <div class="content">';
1292
1293 if (empty($context['search_results']))
1294 {
1295 echo '
1296 <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>';
1297 }
1298 else
1299 {
1300 echo '
1301 <ol class="search_results">';
1302 foreach ($context['search_results'] as $result)
1303 {
1304 // Is it a result from the online manual?
1305 if ($context['search_type'] == 'online')
1306 {
1307 echo '
1308 <li>
1309 <p>
1310 <a href="', $context['doc_scripturl'], '?topic=', $result['topic_id'], '.0" target="_blank" class="new_win"><strong>', $result['messages'][0]['subject'], '</strong></a>
1311 <br /><span class="smalltext"><a href="', $result['category']['href'], '" target="_blank" class="new_win">', $result['category']['name'], '</a> &nbsp;/&nbsp;
1312 <a href="', $result['board']['href'], '" target="_blank" class="new_win">', $result['board']['name'], '</a> /</span>
1313 </p>
1314 <p class="double_height">
1315 ', $result['messages'][0]['body'], '
1316 </p>
1317 </li>';
1318 }
1319 // Otherwise it's... not!
1320 else
1321 {
1322 echo '
1323 <li class="windowbg">
1324 <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'] , ']';
1325
1326 if ($result['help'])
1327 echo '
1328 <p class="double_height">', $result['help'], '</p>';
1329
1330 echo '
1331 </li>';
1332 }
1333 }
1334 echo '
1335 </ol>';
1336 }
1337
1338 echo '
1339 </div>
1340 <span class="botslice"><span></span></span>
1341 </div>
1342 <br class="clear" />';
1343 }
1344
1345 // Turn on and off certain key features.
1346 function template_core_features()
1347 {
1348 global $context, $txt, $settings, $options, $scripturl;
1349
1350 echo '
1351 <script type="text/javascript"><!-- // --><![CDATA[
1352 function toggleItem(itemID)
1353 {
1354 // Toggle the hidden item.
1355 var itemValueHandle = document.getElementById("feature_" + itemID);
1356 itemValueHandle.value = itemValueHandle.value == 1 ? 0 : 1;
1357
1358 // Change the image, alternative text and the title.
1359 document.getElementById("switch_" + itemID).src = \'', $settings['images_url'], '/admin/switch_\' + (itemValueHandle.value == 1 ? \'on\' : \'off\') + \'.png\';
1360 document.getElementById("switch_" + itemID).alt = itemValueHandle.value == 1 ? \'', $txt['core_settings_switch_off'], '\' : \'', $txt['core_settings_switch_on'], '\';
1361 document.getElementById("switch_" + itemID).title = itemValueHandle.value == 1 ? \'', $txt['core_settings_switch_off'], '\' : \'', $txt['core_settings_switch_on'], '\';
1362
1363 // Don\'t reload.
1364 return false;
1365 }
1366 // ]]></script>
1367 <div id="admincenter">';
1368 if ($context['is_new_install'])
1369 {
1370 echo '
1371 <div class="cat_bar">
1372 <h3 class="catbg">
1373 ', $txt['core_settings_welcome_msg'], '
1374 </h3>
1375 </div>
1376 <div class="information">
1377 ', $txt['core_settings_welcome_msg_desc'], '
1378 </div>';
1379 }
1380
1381 echo '
1382 <form action="', $scripturl, '?action=admin;area=corefeatures;" method="post" accept-charset="', $context['character_set'], '">
1383 <div class="cat_bar">
1384 <h3 class="catbg">
1385 ', $txt['core_settings_title'], '
1386 </h3>
1387 </div>';
1388
1389 $alternate = true;
1390 foreach ($context['features'] as $id => $feature)
1391 {
1392 echo '
1393 <div class="windowbg', $alternate ? '2' : '', '">
1394 <span class="topslice"><span></span></span>
1395 <div class="content features">
1396 <img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />
1397 <div class="features_switch" id="js_feature_', $id, '" style="display: none;">
1398 <a href="', $scripturl, '?action=admin;area=featuresettings;sa=core;', $context['session_var'], '=', $context['session_id'], ';toggle=', $id, ';state=', $feature['enabled'] ? 0 : 1, '" onclick="return toggleItem(\'', $id, '\');">
1399 <input type="hidden" name="feature_', $id, '" id="feature_', $id, '" value="', $feature['enabled'] ? 1 : 0, '" /><img src="', $settings['images_url'], '/admin/switch_', $feature['enabled'] ? 'on' : 'off', '.png" id="switch_', $id, '" style="margin-top: 1.3em;" alt="', $txt['core_settings_switch_' . ($feature['enabled'] ? 'off' : 'on')], '" title="', $txt['core_settings_switch_' . ($feature['enabled'] ? 'off' : 'on')], '" />
1400 </a>
1401 </div>
1402 <h4>', ($feature['enabled'] && $feature['url'] ? '<a href="' . $feature['url'] . '">' . $feature['title'] . '</a>' : $feature['title']), '</h4>
1403 <p>', $feature['desc'], '</p>
1404 <div id="plain_feature_', $id, '">
1405 <label for="plain_feature_', $id, '_radio_on"><input type="radio" name="feature_plain_', $id, '" id="plain_feature_', $id, '_radio_on" value="1"', $feature['enabled'] ? ' checked="checked"' : '', ' class="input_radio" />', $txt['core_settings_enabled'], '</label>
1406 <label for="plain_feature_', $id, '_radio_off"><input type="radio" name="feature_plain_', $id, '" id="plain_feature_', $id, '_radio_off" value="0"', !$feature['enabled'] ? ' checked="checked"' : '', ' class="input_radio" />', $txt['core_settings_disabled'], '</label>
1407 </div>
1408 </div>
1409 <span class="botslice clear_right"><span></span></span>
1410 </div>';
1411
1412 $alternate = !$alternate;
1413 }
1414
1415 echo '
1416 <div class="righttext">
1417 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
1418 <input type="hidden" value="0" name="js_worked" id="js_worked" />
1419 <input type="submit" value="', $txt['save'], '" name="save" class="button_submit" />
1420 </div>
1421 </form>
1422 </div>
1423 <br class="clear" />';
1424
1425 // Turn on the pretty javascript if we can!
1426 echo '
1427 <script type="text/javascript"><!-- // --><![CDATA[
1428 document.getElementById(\'js_worked\').value = "1";';
1429 foreach ($context['features'] as $id => $feature)
1430 echo '
1431 document.getElementById(\'js_feature_', $id, '\').style.display = "";
1432 document.getElementById(\'plain_feature_', $id, '\').style.display = "none";';
1433 echo '
1434 // ]]></script>';
1435 }
1436
1437 // Add a new language
1438 function template_add_language()
1439 {
1440 global $context, $settings, $options, $txt, $scripturl;
1441
1442 echo '
1443 <div id="admincenter">
1444 <form action="', $scripturl, '?action=admin;area=languages;sa=add;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
1445 <div class="cat_bar">
1446 <h3 class="catbg">
1447 ', $txt['add_language'], '
1448 </h3>
1449 </div>
1450 <div class="windowbg">
1451 <span class="topslice"><span></span></span>
1452 <div class="content">
1453 <fieldset>
1454 <legend>', $txt['add_language_smf'], '</legend>
1455 <label class="smalltext">', $txt['add_language_smf_browse'], '</label>
1456 <input type="text" name="smf_add" size="40" value="', !empty($context['smf_search_term']) ? $context['smf_search_term'] : '', '" class="input_text" />';
1457
1458 if (!empty($context['smf_error']))
1459 echo '
1460 <div class="smalltext error">', $txt['add_language_error_' . $context['smf_error']], '</div>';
1461
1462 echo '
1463
1464 </fieldset>
1465 <div class="righttext">
1466 ', $context['browser']['is_ie'] ? '<input type="text" name="ie_fix" style="display: none;" class="input_text" /> ' : '', '
1467 <input type="submit" name="smf_add_sub" value="', $txt['search'], '" class="button_submit" />
1468 </div>
1469 </div>
1470 <span class="botslice"><span></span></span>
1471 </div>
1472 ';
1473
1474 // Had some results?
1475 if (!empty($context['smf_languages']))
1476 {
1477 echo '
1478 <div class="information">', $txt['add_language_smf_found'], '</div>
1479
1480 <table class="table_grid" cellspacing="0" width="100%">
1481 <thead>
1482 <tr class="catbg">
1483 <th class="first_th" scope="col">', $txt['name'], '</th>
1484 <th scope="col">', $txt['add_language_smf_desc'], '</th>
1485 <th scope="col">', $txt['add_language_smf_version'], '</th>
1486 <th scope="col">', $txt['add_language_smf_utf8'], '</th>
1487 <th class="last_th" scope="col">', $txt['add_language_smf_install'], '</th>
1488 </tr>
1489 </thead>
1490 <tbody>';
1491
1492 foreach ($context['smf_languages'] as $language)
1493 echo '
1494 <tr class="windowbg2">
1495 <td align="left">', $language['name'], '</td>
1496 <td align="left">', $language['description'], '</td>
1497 <td align="left">', $language['version'], '</td>
1498 <td align="center">', $language['utf8'] ? $txt['yes'] : $txt['no'], '</td>
1499 <td align="left"><a href="', $language['link'], '">', $txt['add_language_smf_install'], '</a></td>
1500 </tr>';
1501
1502 echo '
1503 </tbody>
1504 </table>';
1505 }
1506
1507 echo '
1508 </form>
1509 </div>
1510 <br class="clear" />';
1511 }
1512
1513 // Download a new language file?
1514 function template_download_language()
1515 {
1516 global $context, $settings, $options, $txt, $scripturl, $modSettings;
1517
1518 // Actually finished?
1519 if (!empty($context['install_complete']))
1520 {
1521 echo '
1522 <div id="admincenter">
1523 <div class="cat_bar">
1524 <h3 class="catbg">
1525 ', $txt['languages_download_complete'], '
1526 </h3>
1527 </div>
1528 <div class="windowbg">
1529 <span class="topslice"><span></span></span>
1530 <div class="content">
1531 ', $context['install_complete'], '
1532 </div>
1533 <span class="botslice"><span></span></span>
1534 </div>
1535 </div>
1536 <br class="clear" />';
1537 return;
1538 }
1539
1540 // An error?
1541 if (!empty($context['error_message']))
1542 echo '
1543 <div id="errorbox">
1544 <p>', $context['error_message'], '</p>
1545 </div>';
1546
1547 // Provide something of an introduction...
1548 echo '
1549 <div id="admincenter">
1550 <form action="', $scripturl, '?action=admin;area=languages;sa=downloadlang;did=', $context['download_id'], ';', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
1551 <div class="cat_bar">
1552 <h3 class="catbg">
1553 ', $txt['languages_download'], '
1554 </h3>
1555 </div>
1556 <div class="windowbg">
1557 <span class="topslice"><span></span></span>
1558 <div class="content">
1559 <p>
1560 ', $txt['languages_download_note'], '
1561 </p>
1562 <div class="smalltext">
1563 ', $txt['languages_download_info'], '
1564 </div>
1565 </div>
1566 <span class="botslice"><span></span></span>
1567 </div>';
1568
1569 // Show the main files.
1570 template_show_list('lang_main_files_list');
1571
1572 // Now, all the images and the likes, hidden via javascript 'cause there are so fecking many.
1573 echo '
1574 <br />
1575 <div class="title_bar">
1576 <h3 class="titlebg">
1577 ', $txt['languages_download_theme_files'], '
1578 </h3>
1579 </div>
1580 <table class="table_grid" cellspacing="0" width="100%">
1581 <thead>
1582 <tr class="catbg">
1583 <th class="first_th" scope="col">
1584 ', $txt['languages_download_filename'], '
1585 </th>
1586 <th scope="col" width="100">
1587 ', $txt['languages_download_writable'], '
1588 </th>
1589 <th scope="col" width="100">
1590 ', $txt['languages_download_exists'], '
1591 </th>
1592 <th class="last_th" scope="col" width="50">
1593 ', $txt['languages_download_copy'], '
1594 </th>
1595 </tr>
1596 </thead>
1597 <tbody>';
1598
1599 foreach ($context['files']['images'] as $theme => $group)
1600 {
1601 $count = 0;
1602 echo '
1603 <tr class="titlebg">
1604 <td colspan="4">
1605 <img src="', $settings['images_url'], '/sort_down.gif" id="toggle_image_', $theme, '" alt="*" />&nbsp;', isset($context['theme_names'][$theme]) ? $context['theme_names'][$theme] : $theme, '
1606 </td>
1607 </tr>';
1608
1609 $alternate = false;
1610 foreach ($group as $file)
1611 {
1612 echo '
1613 <tr class="windowbg', $alternate ? '2' : '', '" id="', $theme, '-', $count++, '">
1614 <td>
1615 <strong>', $file['name'], '</strong><br />
1616 <span class="smalltext">', $txt['languages_download_dest'], ': ', $file['destination'], '</span>
1617 </td>
1618 <td>
1619 <span style="color: ', ($file['writable'] ? 'green' : 'red'), ';">', ($file['writable'] ? $txt['yes'] : $txt['no']), '</span>
1620 </td>
1621 <td>
1622 ', $file['exists'] ? ($file['exists'] == 'same' ? $txt['languages_download_exists_same'] : $txt['languages_download_exists_different']) : $txt['no'], '
1623 </td>
1624 <td>
1625 <input type="checkbox" name="copy_file[]" value="', $file['generaldest'], '"', ($file['default_copy'] ? ' checked="checked"' : ''), ' class="input_check" />
1626 </td>
1627 </tr>';
1628 $alternate = !$alternate;
1629 }
1630 }
1631
1632 echo '
1633 </tbody>
1634 </table>';
1635
1636 // Do we want some FTP baby?
1637 if (!empty($context['still_not_writable']))
1638 {
1639 if (!empty($context['package_ftp']['error']))
1640 echo '
1641 <div id="errorbox">
1642 <tt>', $context['package_ftp']['error'], '</tt>
1643 </div>';
1644
1645 echo '
1646 <div class="cat_bar">
1647 <h3 class="catbg">
1648 ', $txt['package_ftp_necessary'], '
1649 </h3>
1650 </div>
1651 <div class="windowbg">
1652 <span class="topslice"><span></span></span>
1653 <div class="content">
1654 <p>', $txt['package_ftp_why'],'</p>
1655 <dl class="settings">
1656 <dt
1657 <label for="ftp_server">', $txt['package_ftp_server'], ':</label>
1658 </dt>
1659 <dd>
1660 <div class="floatright" style="margin-right: 1px;"><label for="ftp_port" style="padding-top: 2px; padding-right: 2ex;">', $txt['package_ftp_port'], ':&nbsp;</label> <input type="text" size="3" name="ftp_port" id="ftp_port" value="', isset($context['package_ftp']['port']) ? $context['package_ftp']['port'] : (isset($modSettings['package_port']) ? $modSettings['package_port'] : '21'), '" class="input_text" /></div>
1661 <input type="text" size="30" name="ftp_server" id="ftp_server" value="', isset($context['package_ftp']['server']) ? $context['package_ftp']['server'] : (isset($modSettings['package_server']) ? $modSettings['package_server'] : 'localhost'), '" style="width: 70%;" class="input_text" />
1662 </dd>
1663
1664 <dt>
1665 <label for="ftp_username">', $txt['package_ftp_username'], ':</label>
1666 </dt>
1667 <dd>
1668 <input type="text" size="50" name="ftp_username" id="ftp_username" value="', isset($context['package_ftp']['username']) ? $context['package_ftp']['username'] : (isset($modSettings['package_username']) ? $modSettings['package_username'] : ''), '" style="width: 99%;" class="input_text" />
1669 </dd>
1670
1671 <dt>
1672 <label for="ftp_password">', $txt['package_ftp_password'], ':</label>
1673 </dt>
1674 <dd>
1675 <input type="password" size="50" name="ftp_password" id="ftp_password" style="width: 99%;" class="input_text" />
1676 </dd>
1677
1678 <dt>
1679 <label for="ftp_path">', $txt['package_ftp_path'], ':</label>
1680 </dt>
1681 <dd>
1682 <input type="text" size="50" name="ftp_path" id="ftp_path" value="', $context['package_ftp']['path'], '" style="width: 99%;" class="input_text" />
1683 </dd>
1684 </dl>
1685 </div>
1686 <span class="botslice"><span></span></span>
1687 </div>';
1688 }
1689
1690 // Install?
1691 echo '
1692 <div class="righttext padding">
1693 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
1694 <input type="submit" name="do_install" value="', $txt['add_language_smf_install'], '" class="button_submit" />
1695 </div>
1696 </form>
1697 </div>
1698 <br class="clear" />';
1699
1700 // The javascript for expand and collapse of sections.
1701 echo '
1702 <script type="text/javascript"><!-- // --><![CDATA[';
1703
1704 // Each theme gets its own handler.
1705 foreach ($context['files']['images'] as $theme => $group)
1706 {
1707 $count = 0;
1708 echo '
1709 var oTogglePanel_', $theme, ' = new smc_Toggle({
1710 bToggleEnabled: true,
1711 bCurrentlyCollapsed: true,
1712 aSwappableContainers: [';
1713 foreach ($group as $file)
1714 echo '
1715 ', JavaScriptEscape($theme . '-' . $count++), ',';
1716 echo '
1717 null
1718 ],
1719 aSwapImages: [
1720 {
1721 sId: \'toggle_image_', $theme, '\',
1722 srcExpanded: smf_images_url + \'/sort_down.gif\',
1723 altExpanded: \'*\',
1724 srcCollapsed: smf_images_url + \'/selected.gif\',
1725 altCollapsed: \'*\'
1726 }
1727 ]
1728 });';
1729 }
1730
1731 echo '
1732 // ]]></script>';
1733 }
1734
1735 // Edit some language entries?
1736 function template_modify_language_entries()
1737 {
1738 global $context, $settings, $options, $txt, $scripturl;
1739
1740 echo '
1741 <div id="admincenter">
1742 <form action="', $scripturl, '?action=admin;area=languages;sa=editlang;lid=', $context['lang_id'], '" method="post" accept-charset="', $context['character_set'], '">
1743 <div class="cat_bar">
1744 <h3 class="catbg">
1745 ', $txt['edit_languages'], '
1746 </h3>
1747 </div>';
1748
1749 // Not writable?
1750 if ($context['lang_file_not_writable_message'])
1751 echo '
1752 <div id="errorbox">
1753 <p class="alert">', $context['lang_file_not_writable_message'], '</p>
1754 </div>';
1755
1756 echo '
1757 <div class="information">
1758 ', $txt['edit_language_entries_primary'], '
1759 </div>
1760 <div class="windowbg">
1761 <span class="topslice"><span></span></span>
1762 <div class="content">
1763 <fieldset>
1764 <legend>', $context['primary_settings']['name'], '</legend>
1765 <dl class="settings">
1766 <dt>
1767 ', $txt['languages_character_set'], ':
1768 </dt>
1769 <dd>
1770 <input type="text" name="character_set" size="20" value="', $context['primary_settings']['character_set'], '"', (empty($context['file_entries']) ? '' : ' disabled="disabled"'), ' class="input_text" />
1771 </dd>
1772 <dt>
1773 ', $txt['languages_locale'], ':
1774 </dt>
1775 <dd>
1776 <input type="text" name="locale" size="20" value="', $context['primary_settings']['locale'], '"', (empty($context['file_entries']) ? '' : ' disabled="disabled"'), ' class="input_text" />
1777 </dd>
1778 <dt>
1779 ', $txt['languages_dictionary'], ':
1780 </dt>
1781 <dd>
1782 <input type="text" name="dictionary" size="20" value="', $context['primary_settings']['dictionary'], '"', (empty($context['file_entries']) ? '' : ' disabled="disabled"'), ' class="input_text" />
1783 </dd>
1784 <dt>
1785 ', $txt['languages_spelling'], ':
1786 </dt>
1787 <dd>
1788 <input type="text" name="spelling" size="20" value="', $context['primary_settings']['spelling'], '"', (empty($context['file_entries']) ? '' : ' disabled="disabled"'), ' class="input_text" />
1789 </dd>
1790 <dt>
1791 ', $txt['languages_rtl'], ':
1792 </dt>
1793 <dd>
1794 <input type="checkbox" name="rtl"', $context['primary_settings']['rtl'] ? ' checked="checked"' : '', ' class="input_check"', (empty($context['file_entries']) ? '' : ' disabled="disabled"'), ' />
1795 </dd>
1796 </dl>
1797 </fieldset>
1798 <div class="righttext">
1799 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
1800 <input type="submit" name="save_main" value="', $txt['save'], '"', $context['lang_file_not_writable_message'] || !empty($context['file_entries']) ? ' disabled="disabled"' : '', ' class="button_submit" />';
1801
1802 // English can't be deleted.
1803 if ($context['lang_id'] != 'english')
1804 echo '
1805 <input type="submit" name="delete_main" value="', $txt['delete'], '"', $context['lang_file_not_writable_message'] || !empty($context['file_entries']) ? ' disabled="disabled"' : '', ' onclick="confirm(\'', $txt['languages_delete_confirm'], '\');" class="button_submit" />';
1806
1807 echo '
1808 </div>
1809 </div>
1810 <span class="botslice"><span></span></span>
1811 </div>
1812 </form>
1813
1814 <form action="', $scripturl, '?action=admin;area=languages;sa=editlang;lid=', $context['lang_id'], ';entries" id="entry_form" method="post" accept-charset="', $context['character_set'], '">
1815 <div class="title_bar">
1816 <h3 class="titlebg">
1817 ', $txt['edit_language_entries'], '
1818 </h3>
1819 </div>
1820 <div id="taskpad" class="floatright">
1821 ', $txt['edit_language_entries_file'], ':
1822 <select name="tfid" onchange="if (this.value != -1) document.forms.entry_form.submit();">';
1823 foreach ($context['possible_files'] as $id_theme => $theme)
1824 {
1825 echo '
1826 <option value="-1">', $theme['name'], '</option>';
1827
1828 foreach ($theme['files'] as $file)
1829 echo '
1830 <option value="', $id_theme, '+', $file['id'], '"', $file['selected'] ? ' selected="selected"' : '', '> =&gt; ', $file['name'], '</option>';
1831 }
1832
1833 echo '
1834 </select>
1835 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
1836 <input type="submit" value="', $txt['go'], '" class="button_submit" />
1837 </div>';
1838
1839 // Is it not writable?
1840 if (!empty($context['entries_not_writable_message']))
1841 echo '
1842 <div id="errorbox">
1843 <span class="alert">', $context['entries_not_writable_message'], '</span>
1844 </div>';
1845
1846 // Already have some?
1847 if (!empty($context['file_entries']))
1848 {
1849 echo '
1850 <div class="windowbg2">
1851 <span class="topslice"><span></span></span>
1852 <div class="content">
1853 <dl class="settings">';
1854
1855 $cached = array();
1856 foreach ($context['file_entries'] as $entry)
1857 {
1858 // Do it in two's!
1859 if (empty($cached))
1860 {
1861 $cached = $entry;
1862 continue;
1863 }
1864
1865 echo '
1866 <dt>
1867 <span class="smalltext">', $cached['key'], '</span>
1868 </dt>
1869 <dd>
1870 <span class="smalltext">', $entry['key'], '</span>
1871 </dd>
1872 <dt>
1873 <input type="hidden" name="comp[', $cached['key'], ']" value="', $cached['value'], '" />
1874 <textarea name="entry[', $cached['key'], ']" cols="40" rows="', $cached['rows'] < 2 ? 2 : $cached['rows'], '" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 96%; min-width: 96%' : 'width: 96%') . ';">', $cached['value'], '</textarea>
1875 </dt>
1876 <dd>
1877 <input type="hidden" name="comp[', $entry['key'], ']" value="', $entry['value'], '" />
1878 <textarea name="entry[', $entry['key'], ']" cols="40" rows="', $entry['rows'] < 2 ? 2 : $entry['rows'], '" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 96%; min-width: 96%' : 'width: 96%') . ';">', $entry['value'], '</textarea>
1879 </dd>';
1880 $cached = array();
1881 }
1882
1883 // Odd number?
1884 if (!empty($cached))
1885 echo '
1886
1887 <dt>
1888 <span class="smalltext">', $cached['key'], '</span>
1889 </dt>
1890 <dd>
1891 </dd>
1892 <dt>
1893 <input type="hidden" name="comp[', $cached['key'], ']" value="', $cached['value'], '" />
1894 <textarea name="entry[', $cached['key'], ']" cols="40" rows="2" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 96%; min-width: 96%' : 'width: 96%') . ';">', $cached['value'], '</textarea>
1895 </dt>
1896 <dd>
1897 </dd>';
1898
1899 echo '
1900 </dl>
1901 <input type="submit" name="save_entries" value="', $txt['save'], '"', !empty($context['entries_not_writable_message']) ? ' disabled="disabled"' : '', ' class="button_submit" />';
1902
1903 echo '
1904 </div>
1905 <span class="botslice"><span></span></span>
1906 </div>';
1907 }
1908 echo '
1909 </form>
1910 </div>
1911 <br class="clear" />';
1912 }
1913
1914 // This little beauty shows questions and answer from the captcha type feature.
1915 function template_callback_question_answer_list()
1916 {
1917 global $txt, $context;
1918
1919 echo '
1920 <dt>
1921 <strong>', $txt['setup_verification_question'], '</strong>
1922 </dt>
1923 <dd>
1924 <strong>', $txt['setup_verification_answer'], '</strong>
1925 </dd>';
1926
1927 foreach ($context['question_answers'] as $data)
1928 echo '
1929
1930 <dt>
1931 <input type="text" name="question[', $data['id'], ']" value="', $data['question'], '" size="50" class="input_text verification_question" />
1932 </dt>
1933 <dd>
1934 <input type="text" name="answer[', $data['id'], ']" value="', $data['answer'], '" size="50" class="input_text verification_answer" />
1935 </dd>';
1936
1937 // Some blank ones.
1938 for ($count = 0; $count < 3; $count++)
1939 echo '
1940 <dt>
1941 <input type="text" name="question[]" size="50" class="input_text verification_question" />
1942 </dt>
1943 <dd>
1944 <input type="text" name="answer[]" size="50" class="input_text verification_answer" />
1945 </dd>';
1946
1947 echo '
1948 <dt id="add_more_question_placeholder" style="display: none;"></dt><dd></dd>
1949 <dt id="add_more_link_div" style="display: none;">
1950 <a href="#" onclick="addAnotherQuestion(); return false;">&#171; ', $txt['setup_verification_add_more'], ' &#187;</a>
1951
1952 </dt><dd></dd>';
1953
1954 // The javascript needs to go at the end but we'll put it in this template for looks.
1955 $context['settings_post_javascript'] .= '
1956 // Create a named element dynamically - thanks to: http://www.thunderguy.com/semicolon/2005/05/23/setting-the-name-attribute-in-internet-explorer/
1957 function createNamedElement(type, name, customFields)
1958 {
1959 var element = null;
1960
1961 if (!customFields)
1962 customFields = "";
1963
1964 // Try the IE way; this fails on standards-compliant browsers
1965 try
1966 {
1967 element = document.createElement("<" + type + \' name="\' + name + \'" \' + customFields + ">");
1968 }
1969 catch (e)
1970 {
1971 }
1972 if (!element || element.nodeName != type.toUpperCase())
1973 {
1974 // Non-IE browser; use canonical method to create named element
1975 element = document.createElement(type);
1976 element.name = name;
1977 }
1978
1979 return element;
1980 }
1981
1982 var placeHolder = document.getElementById(\'add_more_question_placeholder\');
1983
1984 function addAnotherQuestion()
1985 {
1986 var newDT = document.createElement("dt");
1987
1988 var newInput = createNamedElement("input", "question[]");
1989 newInput.type = "text";
1990 newInput.className = "input_text";
1991 newInput.size = "50";
1992 newInput.setAttribute("class", "verification_question");
1993 newDT.appendChild(newInput);
1994
1995 newDD = document.createElement("dd");
1996
1997 newInput = createNamedElement("input", "answer[]");
1998 newInput.type = "text";
1999 newInput.className = "input_text";
2000 newInput.size = "50";
2001 newInput.setAttribute("class", "verification_answer");
2002 newDD.appendChild(newInput);
2003
2004 placeHolder.parentNode.insertBefore(newDT, placeHolder);
2005 placeHolder.parentNode.insertBefore(newDD, placeHolder);
2006 }
2007 document.getElementById(\'add_more_link_div\').style.display = \'\';
2008 ';
2009 }
2010
2011 // Repairing boards.
2012 function template_repair_boards()
2013 {
2014 global $context, $txt, $scripturl;
2015
2016 echo '
2017 <div id="admincenter">
2018 <div class="cat_bar">
2019 <h3 class="catbg">',
2020 $context['error_search'] ? $txt['errors_list'] : $txt['errors_fixing'] , '
2021 </h3>
2022 </div>
2023 <div class="windowbg">
2024 <span class="topslice"><span></span></span>
2025 <div class="content">';
2026
2027 // Are we actually fixing them, or is this just a prompt?
2028 if ($context['error_search'])
2029 {
2030 if (!empty($context['to_fix']))
2031 {
2032 echo '
2033 ', $txt['errors_found'], ':
2034 <ul>';
2035
2036 foreach ($context['repair_errors'] as $error)
2037 echo '
2038 <li>
2039 ', $error, '
2040 </li>';
2041
2042 echo '
2043 </ul>
2044 <p>
2045 ', $txt['errors_fix'], '
2046 </p>
2047 <p class="padding">
2048 <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>
2049 </p>';
2050 }
2051 else
2052 echo '
2053 <p>', $txt['maintain_no_errors'], '</p>
2054 <p class="padding">
2055 <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
2056 </p>';
2057
2058 }
2059 else
2060 {
2061 if (!empty($context['redirect_to_recount']))
2062 {
2063 echo '
2064 <p>
2065 ', $txt['errors_do_recount'], '
2066 </p>
2067 <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=recount" id="recount_form" method="post">
2068 <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
2069 <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '" />
2070 </form>';
2071 }
2072 else
2073 {
2074 echo '
2075 <p>', $txt['errors_fixed'], '</p>
2076 <p class="padding">
2077 <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
2078 </p>';
2079 }
2080 }
2081
2082 echo '
2083 </div>
2084 <span class="botslice"><span></span></span>
2085 </div>
2086 </div>
2087 <br class="clear" />';
2088
2089 if (!empty($context['redirect_to_recount']))
2090 {
2091 echo '
2092 <script type="text/javascript"><!-- // --><![CDATA[
2093 var countdown = 5;
2094 doAutoSubmit();
2095
2096 function doAutoSubmit()
2097 {
2098 if (countdown == 0)
2099 document.forms.recount_form.submit();
2100 else if (countdown == -1)
2101 return;
2102
2103 document.forms.recount_form.recount_now.value = "', $txt['errors_recount_now'], ' (" + countdown + ")";
2104 countdown--;
2105
2106 setTimeout("doAutoSubmit();", 1000);
2107 }
2108 // ]]></script>';
2109 }
2110 }
2111
2112 ?>