Admin.template.php 62 KB

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