Admin.template.php 59 KB

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