Admin.template.php 58 KB

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