2
0

Admin.template.php 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577
  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="placement">', $txt['custom_edit_placement'], ':</label></strong>
  961. </dt>
  962. <dd>
  963. <select name="placement" id="placement">
  964. <option value="0"', $context['field']['placement'] == '0' ? ' selected' : '', '>', $txt['custom_edit_placement_standard'], '</option>
  965. <option value="1"', $context['field']['placement'] == '1' ? ' selected' : '', '>', $txt['custom_edit_placement_withicons'], '</option>
  966. <option value="2"', $context['field']['placement'] == '2' ? ' selected' : '', '>', $txt['custom_edit_placement_abovesignature'], '</option>
  967. </select>
  968. </dd>
  969. <dt>
  970. <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>
  971. <strong><label for="enclose">', $txt['custom_edit_enclose'], ':</label></strong><br>
  972. <span class="smalltext">', $txt['custom_edit_enclose_desc'], '</span>
  973. </dt>
  974. <dd>
  975. <textarea name="enclose" id="enclose" rows="10" cols="50">', @$context['field']['enclose'], '</textarea>
  976. </dd>
  977. </dl>
  978. </fieldset>
  979. <fieldset>
  980. <legend>', $txt['custom_edit_input'], '</legend>
  981. <dl class="settings">
  982. <dt>
  983. <strong><label for="field_type">', $txt['custom_edit_picktype'], ':</label></strong>
  984. </dt>
  985. <dd>
  986. <select name="field_type" id="field_type" onchange="updateInputBoxes();">';
  987. foreach (array('text', 'textarea', 'select', 'radio', 'check') as $field_type)
  988. echo '
  989. <option value="', $field_type, '"', $context['field']['type'] == $field_type ? ' selected' : '', '>', $txt['custom_profile_type_' . $field_type], '</option>';
  990. echo '
  991. </select>
  992. </dd>
  993. <dt id="max_length_dt">
  994. <strong><label for="max_length_dd">', $txt['custom_edit_max_length'], ':</label></strong><br>
  995. <span class="smalltext">', $txt['custom_edit_max_length_desc'], '</span>
  996. </dt>
  997. <dd>
  998. <input type="text" name="max_length" id="max_length_dd" value="', $context['field']['max_length'], '" size="7" maxlength="6" class="input_text">
  999. </dd>
  1000. <dt id="dimension_dt">
  1001. <strong><label for="dimension_dd">', $txt['custom_edit_dimension'], ':</label></strong>
  1002. </dt>
  1003. <dd id="dimension_dd">
  1004. <strong>', $txt['custom_edit_dimension_row'], ':</strong> <input type="text" name="rows" value="', $context['field']['rows'], '" size="5" maxlength="3" class="input_text">
  1005. <strong>', $txt['custom_edit_dimension_col'], ':</strong> <input type="text" name="cols" value="', $context['field']['cols'], '" size="5" maxlength="3" class="input_text">
  1006. </dd>
  1007. <dt id="bbc_dt">
  1008. <strong><label for="bbc_dd">', $txt['custom_edit_bbc'], '</label></strong>
  1009. </dt>
  1010. <dd >
  1011. <input type="checkbox" name="bbc" id="bbc_dd"', $context['field']['bbc'] ? ' checked' : '', ' class="input_check">
  1012. </dd>
  1013. <dt id="options_dt">
  1014. <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>
  1015. <strong><label for="options_dd">', $txt['custom_edit_options'], ':</label></strong><br>
  1016. <span class="smalltext">', $txt['custom_edit_options_desc'], '</span>
  1017. </dt>
  1018. <dd id="options_dd">
  1019. <div>';
  1020. foreach ($context['field']['options'] as $k => $option)
  1021. {
  1022. echo '
  1023. ', $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">';
  1024. }
  1025. echo '
  1026. <span id="addopt"></span>
  1027. [<a href="" onclick="addOption(); return false;">', $txt['custom_edit_options_more'], '</a>]
  1028. </div>
  1029. </dd>
  1030. <dt id="default_dt">
  1031. <strong><label for="default_dd">', $txt['custom_edit_default'], ':</label></strong>
  1032. </dt>
  1033. <dd>
  1034. <input type="checkbox" name="default_check" id="default_dd"', $context['field']['default_check'] ? ' checked' : '', ' class="input_check">
  1035. </dd>
  1036. </dl>
  1037. </fieldset>
  1038. <fieldset>
  1039. <legend>', $txt['custom_edit_advanced'], '</legend>
  1040. <dl class="settings">
  1041. <dt id="mask_dt">
  1042. <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>
  1043. <strong><label for="mask">', $txt['custom_edit_mask'], ':</label></strong><br>
  1044. <span class="smalltext">', $txt['custom_edit_mask_desc'], '</span>
  1045. </dt>
  1046. <dd>
  1047. <select name="mask" id="mask" onchange="updateInputBoxes();">
  1048. <option value="nohtml"', $context['field']['mask'] == 'nohtml' ? ' selected' : '', '>', $txt['custom_edit_mask_nohtml'], '</option>
  1049. <option value="email"', $context['field']['mask'] == 'email' ? ' selected' : '', '>', $txt['custom_edit_mask_email'], '</option>
  1050. <option value="number"', $context['field']['mask'] == 'number' ? ' selected' : '', '>', $txt['custom_edit_mask_number'], '</option>
  1051. <option value="regex"', strpos($context['field']['mask'], 'regex') === 0 ? ' selected' : '', '>', $txt['custom_edit_mask_regex'], '</option>
  1052. </select>
  1053. <br>
  1054. <span id="regex_div">
  1055. <input type="text" name="regex" value="', $context['field']['regex'], '" size="30" class="input_text">
  1056. </span>
  1057. </dd>
  1058. <dt>
  1059. <strong><label for="private">', $txt['custom_edit_privacy'], ':</label></strong>
  1060. <span class="smalltext">', $txt['custom_edit_privacy_desc'], '</span>
  1061. </dt>
  1062. <dd>
  1063. <select name="private" id="private" onchange="updateInputBoxes();">
  1064. <option value="0"', $context['field']['private'] == 0 ? ' selected' : '', '>', $txt['custom_edit_privacy_all'], '</option>
  1065. <option value="1"', $context['field']['private'] == 1 ? ' selected' : '', '>', $txt['custom_edit_privacy_see'], '</option>
  1066. <option value="2"', $context['field']['private'] == 2 ? ' selected' : '', '>', $txt['custom_edit_privacy_owner'], '</option>
  1067. <option value="3"', $context['field']['private'] == 3 ? ' selected' : '', '>', $txt['custom_edit_privacy_none'], '</option>
  1068. </select>
  1069. </dd>
  1070. <dt id="can_search_dt">
  1071. <strong><label for="can_search_dd">', $txt['custom_edit_can_search'], ':</label></strong><br>
  1072. <span class="smalltext">', $txt['custom_edit_can_search_desc'], '</span>
  1073. </dt>
  1074. <dd>
  1075. <input type="checkbox" name="can_search" id="can_search_dd"', $context['field']['can_search'] ? ' checked' : '', ' class="input_check">
  1076. </dd>
  1077. <dt>
  1078. <strong><label for="can_search_check">', $txt['custom_edit_active'], ':</label></strong><br>
  1079. <span class="smalltext">', $txt['custom_edit_active_desc'], '</span>
  1080. </dt>
  1081. <dd>
  1082. <input type="checkbox" name="active" id="can_search_check"', $context['field']['active'] ? ' checked' : '', ' class="input_check">
  1083. </dd>
  1084. </dl>
  1085. </fieldset>
  1086. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit">';
  1087. if ($context['fid'])
  1088. echo '
  1089. <input type="submit" name="delete" value="', $txt['delete'], '" onclick="return confirm(\'', $txt['custom_edit_delete_sure'], '\');" class="button_submit">';
  1090. echo '
  1091. </div>
  1092. </div>
  1093. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  1094. <input type="hidden" name="', $context['admin-ecp_token_var'], '" value="', $context['admin-ecp_token'], '">
  1095. </form>
  1096. </div>';
  1097. // Get the javascript bits right!
  1098. echo '
  1099. <script><!-- // --><![CDATA[
  1100. updateInputBoxes();
  1101. // ]]></script>';
  1102. }
  1103. // Results page for an admin search.
  1104. function template_admin_search_results()
  1105. {
  1106. global $context, $txt, $settings, $scripturl;
  1107. echo '
  1108. <div id="section_header" class="cat_bar">
  1109. <h3 class="catbg">
  1110. <object id="quick_search">
  1111. <form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '" class="floatright">
  1112. <input type="search" name="search_term" value="', $context['search_term'], '" class="input_text">
  1113. <input type="hidden" name="search_type" value="', $context['search_type'], '">
  1114. <input type="submit" name="search_go" value="', $txt['admin_search_results_again'], '" class="button_submit">
  1115. </form>
  1116. </object>
  1117. <img class="icon" src="' . $settings['images_url'] . '/buttons/search.png" alt="">&nbsp;', sprintf($txt['admin_search_results_desc'], $context['search_term']), '
  1118. </h3>
  1119. </div>
  1120. <div class="windowbg2 generic_list_wrapper">
  1121. <div class="content">';
  1122. if (empty($context['search_results']))
  1123. {
  1124. echo '
  1125. <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>';
  1126. }
  1127. else
  1128. {
  1129. echo '
  1130. <ol class="search_results">';
  1131. foreach ($context['search_results'] as $result)
  1132. {
  1133. // Is it a result from the online manual?
  1134. if ($context['search_type'] == 'online')
  1135. {
  1136. echo '
  1137. <li>
  1138. <p>
  1139. <a href="', $context['doc_scripturl'], str_replace(' ', '_', $result['title']), '" target="_blank" class="new_win"><strong>', $result['title'], '</strong></a>
  1140. </p>
  1141. <p class="double_height">
  1142. ', $result['snippet'], '
  1143. </p>
  1144. </li>';
  1145. }
  1146. // Otherwise it's... not!
  1147. else
  1148. {
  1149. echo '
  1150. <li class="windowbg2">
  1151. <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'] , ']';
  1152. if ($result['help'])
  1153. echo '
  1154. <p class="double_height">', $result['help'], '</p>';
  1155. echo '
  1156. </li>';
  1157. }
  1158. }
  1159. echo '
  1160. </ol>';
  1161. }
  1162. echo '
  1163. </div>
  1164. </div>';
  1165. }
  1166. // This little beauty shows questions and answer from the captcha type feature.
  1167. function template_callback_question_answer_list()
  1168. {
  1169. global $txt, $context;
  1170. foreach ($context['languages'] as $lang_id => $lang)
  1171. {
  1172. $lang_id = strtr($lang_id, array('-utf8' => ''));
  1173. $lang['name'] = strtr($lang['name'], array('-utf8' => ''));
  1174. echo '
  1175. <dt id="qa_dt_', $lang_id, '" class="qa_link">
  1176. <a href="javascript:void(0);">[ ', $lang['name'], ' ]</a>
  1177. </dt>
  1178. <fieldset id="qa_fs_', $lang_id, '" class="qa_fieldset">
  1179. <legend><a href="javascript:void(0);">', $lang['name'], '</a></legend>
  1180. <dl class="settings">
  1181. <dt>
  1182. <strong>', $txt['setup_verification_question'], '</strong>
  1183. </dt>
  1184. <dd>
  1185. <strong>', $txt['setup_verification_answer'], '</strong>
  1186. </dd>';
  1187. if (!empty($context['qa_by_lang'][$lang_id]))
  1188. foreach ($context['qa_by_lang'][$lang_id] as $q_id)
  1189. {
  1190. $question = $context['question_answers'][$q_id];
  1191. echo '
  1192. <dt>
  1193. <input type="text" name="question[', $lang_id, '][', $q_id, ']" value="', $question['question'], '" size="50" class="input_text verification_question">
  1194. </dt>
  1195. <dd>';
  1196. foreach ($question['answers'] as $answer)
  1197. echo '
  1198. <input type="text" name="answer[', $lang_id, '][', $q_id, '][]" value="', $answer, '" size="50" class="input_text verification_answer">';
  1199. echo '
  1200. <div class="qa_add_answer"><a href="javascript:void(0);" onclick="return addAnswer(this);">[ ', $txt['setup_verification_add_answer'], ' ]</a></div>
  1201. </dd>';
  1202. }
  1203. echo '
  1204. <dt class="qa_add_question"><a href="javascript:void(0);">[ ', $txt['setup_verification_add_more'], ' ]</a></dt>
  1205. </dl>
  1206. </fieldset>';
  1207. }
  1208. }
  1209. // Repairing boards.
  1210. function template_repair_boards()
  1211. {
  1212. global $context, $txt, $scripturl;
  1213. echo '
  1214. <div id="admincenter">
  1215. <div id="section_header" class="cat_bar">
  1216. <h3 class="catbg">',
  1217. $context['error_search'] ? $txt['errors_list'] : $txt['errors_fixing'] , '
  1218. </h3>
  1219. </div>
  1220. <div class="windowbg">
  1221. <div class="content">';
  1222. // Are we actually fixing them, or is this just a prompt?
  1223. if ($context['error_search'])
  1224. {
  1225. if (!empty($context['to_fix']))
  1226. {
  1227. echo '
  1228. ', $txt['errors_found'], ':
  1229. <ul>';
  1230. foreach ($context['repair_errors'] as $error)
  1231. echo '
  1232. <li>
  1233. ', $error, '
  1234. </li>';
  1235. echo '
  1236. </ul>
  1237. <p>
  1238. ', $txt['errors_fix'], '
  1239. </p>
  1240. <p class="padding">
  1241. <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>
  1242. </p>';
  1243. }
  1244. else
  1245. echo '
  1246. <p>', $txt['maintain_no_errors'], '</p>
  1247. <p class="padding">
  1248. <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
  1249. </p>';
  1250. }
  1251. else
  1252. {
  1253. if (!empty($context['redirect_to_recount']))
  1254. {
  1255. echo '
  1256. <p>
  1257. ', $txt['errors_do_recount'], '
  1258. </p>
  1259. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=recount" id="recount_form" method="post">
  1260. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  1261. <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '">
  1262. </form>';
  1263. }
  1264. else
  1265. {
  1266. echo '
  1267. <p>', $txt['errors_fixed'], '</p>
  1268. <p class="padding">
  1269. <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
  1270. </p>';
  1271. }
  1272. }
  1273. echo '
  1274. </div>
  1275. </div>
  1276. </div>';
  1277. if (!empty($context['redirect_to_recount']))
  1278. {
  1279. echo '
  1280. <script><!-- // --><![CDATA[
  1281. var countdown = 5;
  1282. doAutoSubmit();
  1283. function doAutoSubmit()
  1284. {
  1285. if (countdown == 0)
  1286. document.forms.recount_form.submit();
  1287. else if (countdown == -1)
  1288. return;
  1289. document.forms.recount_form.recount_now.value = "', $txt['errors_recount_now'], ' (" + countdown + ")";
  1290. countdown--;
  1291. setTimeout("doAutoSubmit();", 1000);
  1292. }
  1293. // ]]></script>';
  1294. }
  1295. }
  1296. // Retrieves info from the php_info function, scrubs and preps it for display
  1297. function template_php_info()
  1298. {
  1299. global $context, $txt;
  1300. echo '
  1301. <div id="admin_form_wrapper">
  1302. <div id="section_header" class="cat_bar">
  1303. <h3 class="catbg">',
  1304. $txt['phpinfo_settings'], '
  1305. </h3>
  1306. </div>';
  1307. // for each php info area
  1308. foreach ($context['pinfo'] as $area => $php_area)
  1309. {
  1310. echo '
  1311. <table id="', str_replace(' ', '_', $area), '" class="table_grid">
  1312. <thead>
  1313. <tr class="catbg">
  1314. <th class="first_th" scope="col" width="33%"></th>
  1315. <th scope="col" width="33%" class="centercol"><strong>', $area, '</strong></th>
  1316. <th class="last_th" scope="col" width="33%"></th>
  1317. </tr>
  1318. </thead>
  1319. <tbody>';
  1320. $alternate = true;
  1321. $localmaster = true;
  1322. // and for each setting in this category
  1323. foreach ($php_area as $key => $setting)
  1324. {
  1325. // start of a local / master setting (3 col)
  1326. if (is_array($setting))
  1327. {
  1328. if ($localmaster)
  1329. {
  1330. // heading row for the settings section of this categorys settings
  1331. echo '
  1332. <tr class="catbg">
  1333. <td align="center" width="33%"><strong>', $txt['phpinfo_itemsettings'], '</strong></td>
  1334. <td align="center" width="33%"><strong>', $txt['phpinfo_localsettings'], '</strong></td>
  1335. <td align="center" width="33%"><strong>', $txt['phpinfo_defaultsettings'], '</strong></td>
  1336. </tr>';
  1337. $localmaster = false;
  1338. }
  1339. echo '
  1340. <tr>
  1341. <td align="left" width="33%" class="windowbg', $alternate ? '2' : '', '">', $key, '</td>';
  1342. foreach ($setting as $key_lm => $value)
  1343. {
  1344. echo '
  1345. <td align="left" width="33%" class="windowbg', $alternate ? '2' : '', '">', $value, '</td>';
  1346. }
  1347. echo '
  1348. </tr>';
  1349. }
  1350. // just a single setting (2 col)
  1351. else
  1352. {
  1353. echo '
  1354. <tr>
  1355. <td align="left" width="33%" class="windowbg', $alternate ? '2' : '', '">', $key, '</td>
  1356. <td align="left" class="windowbg', $alternate ? '2' : '', '" colspan="2">', $setting, '</td>
  1357. </tr>';
  1358. }
  1359. $alternate = !$alternate;
  1360. }
  1361. echo '
  1362. </tbody>
  1363. </table>
  1364. <br>';
  1365. }
  1366. echo '
  1367. </div>';
  1368. }
  1369. function template_clean_cache_button_above()
  1370. {
  1371. }
  1372. function template_clean_cache_button_below()
  1373. {
  1374. global $txt, $scripturl, $context;
  1375. echo '
  1376. <div class="cat_bar">
  1377. <h3 class="catbg">', $txt['maintain_cache'], '</h3>
  1378. </div>
  1379. <div class="windowbg">
  1380. <div class="content">
  1381. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=cleancache" method="post" accept-charset="', $context['character_set'], '">
  1382. <p>', $txt['maintain_cache_info'], '</p>
  1383. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit"></span>
  1384. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  1385. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
  1386. </form>
  1387. </div>
  1388. </div>';
  1389. }
  1390. function template_admin_quick_search()
  1391. {
  1392. global $context, $txt, $scripturl;
  1393. if ($context['user']['is_admin'])
  1394. echo '
  1395. <object id="quick_search">
  1396. <form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '" class="floatright">
  1397. <span class="generic_icons filter centericon"></span>
  1398. <input type="text" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text">
  1399. <select name="search_type">
  1400. <option value="internal"', (empty($context['admin_preferences']['sb']) || $context['admin_preferences']['sb'] == 'internal' ? ' selected' : ''), '>', $txt['admin_search_type_internal'], '</option>
  1401. <option value="member"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'member' ? ' selected' : ''), '>', $txt['admin_search_type_member'], '</option>
  1402. <option value="online"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'online' ? ' selected' : ''), '>', $txt['admin_search_type_online'], '</option>
  1403. </select>
  1404. <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit">
  1405. </form>
  1406. </object>';
  1407. }
  1408. ?>