Admin.template.php 56 KB

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