Admin.template.php 59 KB

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