ManageMaintenance.template.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. // Template for the database maintenance tasks.
  13. function template_maintain_database()
  14. {
  15. global $context, $settings, $options, $txt, $scripturl, $db_type, $modSettings;
  16. // If maintenance has finished tell the user.
  17. if (!empty($context['maintenance_finished']))
  18. echo '
  19. <div class="maintenance_finished">
  20. ', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
  21. </div>';
  22. echo '
  23. <div id="manage_maintenance">
  24. <div class="cat_bar">
  25. <h3 class="catbg">', $txt['maintain_optimize'], '</h3>
  26. </div>
  27. <div class="windowbg">
  28. <span class="topslice"><span></span></span>
  29. <div class="content">
  30. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=optimize" method="post" accept-charset="', $context['character_set'], '">
  31. <p>', $txt['maintain_optimize_info'], '</p>
  32. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  33. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  34. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  35. </form>
  36. </div>
  37. <span class="botslice"><span></span></span>
  38. </div>
  39. <div class="cat_bar">
  40. <h3 class="catbg">
  41. <span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=maintenance_backup" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" /></a> ', $txt['maintain_backup'], '</span>
  42. </h3>
  43. </div>
  44. <div class="windowbg2">
  45. <span class="topslice"><span></span></span>
  46. <div class="content">
  47. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=backup" method="post" accept-charset="', $context['character_set'], '">
  48. <p>', $txt['maintain_backup_info'], '</p>';
  49. if ($db_type == 'sqlite')
  50. echo '
  51. <p><input type="submit" value="', $txt['maintain_backup_save'], '" id="submitDump" class="button_submit" /></p>';
  52. else
  53. echo '
  54. <p><label for="struct"><input type="checkbox" name="struct" id="struct" onclick="document.getElementById(\'submitDump\').disabled = !document.getElementById(\'struct\').checked &amp;&amp; !document.getElementById(\'data\').checked;" class="input_check" checked="checked" /> ', $txt['maintain_backup_struct'], '</label><br />
  55. <label for="data"><input type="checkbox" name="data" id="data" onclick="document.getElementById(\'submitDump\').disabled = !document.getElementById(\'struct\').checked &amp;&amp; !document.getElementById(\'data\').checked;" checked="checked" class="input_check" /> ', $txt['maintain_backup_data'], '</label><br />
  56. <label for="compress"><input type="checkbox" name="compress" id="compress" value="gzip" checked="checked" class="input_check" /> ', $txt['maintain_backup_gz'], '</label></p>
  57. <p><input type="submit" value="', $txt['maintain_backup_save'], '" id="submitDump" onclick="return document.getElementById(\'struct\').checked || document.getElementById(\'data\').checked;" class="button_submit" /></p>';
  58. echo '
  59. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  60. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  61. </form>
  62. </div>
  63. <span class="botslice"><span></span></span>
  64. </div>';
  65. // Show an option to convert to UTF-8 if we're not on UTF-8 yet.
  66. if ($context['convert_utf8'])
  67. {
  68. echo '
  69. <div class="cat_bar">
  70. <h3 class="catbg">', $txt['utf8_title'], '</h3>
  71. </div>
  72. <div class="windowbg">
  73. <span class="topslice"><span></span></span>
  74. <div class="content">
  75. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertutf8" method="post" accept-charset="', $context['character_set'], '">
  76. <p>', $txt['utf8_introduction'], '</p>
  77. ', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext' ? '<p class="error">' . $txt['utf8_cannot_convert_fulltext'] . '</p>' : '', '
  78. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" ', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext' ? 'disabled="disabled"' : '', '/></span>
  79. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  80. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  81. </form>
  82. </div>
  83. <span class="botslice"><span></span></span>
  84. </div>';
  85. }
  86. // We might want to convert entities if we're on UTF-8.
  87. if ($context['convert_entities'])
  88. {
  89. echo '
  90. <div class="cat_bar">
  91. <h3 class="catbg">', $txt['entity_convert_title'], '</h3>
  92. </div>
  93. <div class="windowbg">
  94. <span class="topslice"><span></span></span>
  95. <div class="content">
  96. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertentities" method="post" accept-charset="', $context['character_set'], '">
  97. <p>', $txt['entity_convert_introduction'], '</p>
  98. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  99. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  100. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  101. </form>
  102. </div>
  103. <span class="botslice"><span></span></span>
  104. </div>';
  105. }
  106. echo '
  107. </div>
  108. <br class="clear" />';
  109. }
  110. // Template for the routine maintenance tasks.
  111. function template_maintain_routine()
  112. {
  113. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  114. // If maintenance has finished tell the user.
  115. if (!empty($context['maintenance_finished']))
  116. echo '
  117. <div class="maintenance_finished">
  118. ', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
  119. </div>';
  120. // Starts off with general maintenance procedures.
  121. echo '
  122. <div id="manage_maintenance">
  123. <div class="cat_bar">
  124. <h3 class="catbg">', $txt['maintain_version'], '</h3>
  125. </div>
  126. <div class="windowbg">
  127. <span class="topslice"><span></span></span>
  128. <div class="content">
  129. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=version" method="post" accept-charset="', $context['character_set'], '">
  130. <p>', $txt['maintain_version_info'], '</p>
  131. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  132. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  133. </form>
  134. </div>
  135. <span class="botslice"><span></span></span>
  136. </div>
  137. <div class="cat_bar">
  138. <h3 class="catbg">', $txt['maintain_errors'], '</h3>
  139. </div>
  140. <div class="windowbg2">
  141. <span class="topslice"><span></span></span>
  142. <div class="content">
  143. <form action="', $scripturl, '?action=admin;area=repairboards" method="post" accept-charset="', $context['character_set'], '">
  144. <p>', $txt['maintain_errors_info'], '</p>
  145. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  146. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  147. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  148. </form>
  149. </div>
  150. <span class="botslice"><span></span></span>
  151. </div>
  152. <div class="cat_bar">
  153. <h3 class="catbg">', $txt['maintain_recount'], '</h3>
  154. </div>
  155. <div class="windowbg">
  156. <span class="topslice"><span></span></span>
  157. <div class="content">
  158. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=recount" method="post" accept-charset="', $context['character_set'], '">
  159. <p>', $txt['maintain_recount_info'], '</p>
  160. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  161. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  162. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  163. </form>
  164. </div>
  165. <span class="botslice"><span></span></span>
  166. </div>
  167. <div class="cat_bar">
  168. <h3 class="catbg">', $txt['maintain_logs'], '</h3>
  169. </div>
  170. <div class="windowbg2">
  171. <span class="topslice"><span></span></span>
  172. <div class="content">
  173. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=logs" method="post" accept-charset="', $context['character_set'], '">
  174. <p>', $txt['maintain_logs_info'], '</p>
  175. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  176. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  177. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  178. </form>
  179. </div>
  180. <span class="botslice"><span></span></span>
  181. </div>
  182. <div class="cat_bar">
  183. <h3 class="catbg">', $txt['maintain_cache'], '</h3>
  184. </div>
  185. <div class="windowbg">
  186. <span class="topslice"><span></span></span>
  187. <div class="content">
  188. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=cleancache" method="post" accept-charset="', $context['character_set'], '">
  189. <p>', $txt['maintain_cache_info'], '</p>
  190. <span><input type="submit" value="', $txt['maintain_run_now'], '" class="button_submit" /></span>
  191. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  192. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  193. </form>
  194. </div>
  195. <span class="botslice"><span></span></span>
  196. </div>
  197. </div>
  198. <br class="clear" />';
  199. }
  200. // Template for the member maintenance tasks.
  201. function template_maintain_members()
  202. {
  203. global $context, $settings, $options, $txt, $scripturl;
  204. // If maintenance has finished tell the user.
  205. if (!empty($context['maintenance_finished']))
  206. echo '
  207. <div class="maintenance_finished">
  208. ', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
  209. </div>';
  210. echo '
  211. <script type="text/javascript"><!-- // --><![CDATA[
  212. var warningMessage = \'\';
  213. var membersSwap = false;
  214. function swapMembers()
  215. {
  216. membersSwap = !membersSwap;
  217. var membersForm = document.getElementById(\'membersForm\');
  218. document.getElementById("membersIcon").src = smf_images_url + (membersSwap ? "/collapse.gif" : "/expand.gif");
  219. setInnerHTML(document.getElementById("membersText"), membersSwap ? "', $txt['maintain_members_choose'], '" : "', $txt['maintain_members_all'], '");
  220. document.getElementById("membersPanel").style.display = (membersSwap ? "block" : "none");
  221. for (var i = 0; i < membersForm.length; i++)
  222. {
  223. if (membersForm.elements[i].type.toLowerCase() == "checkbox")
  224. membersForm.elements[i].checked = !membersSwap;
  225. }
  226. }
  227. function checkAttributeValidity()
  228. {
  229. origText = \'', $txt['reattribute_confirm'], '\';
  230. valid = true;
  231. // Do all the fields!
  232. if (!document.getElementById(\'to\').value)
  233. valid = false;
  234. warningMessage = origText.replace(/%member_to%/, document.getElementById(\'to\').value);
  235. if (document.getElementById(\'type_email\').checked)
  236. {
  237. if (!document.getElementById(\'from_email\').value)
  238. valid = false;
  239. warningMessage = warningMessage.replace(/%type%/, \'', addcslashes($txt['reattribute_confirm_email'], "'"), '\').replace(/%find%/, document.getElementById(\'from_email\').value);
  240. }
  241. else
  242. {
  243. if (!document.getElementById(\'from_name\').value)
  244. valid = false;
  245. warningMessage = warningMessage.replace(/%type%/, \'', addcslashes($txt['reattribute_confirm_username'], "'"), '\').replace(/%find%/, document.getElementById(\'from_name\').value);
  246. }
  247. document.getElementById(\'do_attribute\').disabled = valid ? \'\' : \'disabled\';
  248. setTimeout("checkAttributeValidity();", 500);
  249. return valid;
  250. }
  251. setTimeout("checkAttributeValidity();", 500);
  252. // ]]></script>
  253. <div id="manage_maintenance">
  254. <div class="cat_bar">
  255. <h3 class="catbg">', $txt['maintain_reattribute_posts'], '</h3>
  256. </div>
  257. <div class="windowbg2">
  258. <span class="topslice"><span></span></span>
  259. <div class="content">
  260. <form action="', $scripturl, '?action=admin;area=maintain;sa=members;activity=reattribute" method="post" accept-charset="', $context['character_set'], '">
  261. <p><strong>', $txt['reattribute_guest_posts'], '</strong></p>
  262. <dl class="settings">
  263. <dt>
  264. <label for="type_email"><input type="radio" name="type" id="type_email" value="email" checked="checked" class="input_radio" />', $txt['reattribute_email'], '</label>
  265. </dt>
  266. <dd>
  267. <input type="text" name="from_email" id="from_email" value="" onclick="document.getElementById(\'type_email\').checked = \'checked\'; document.getElementById(\'from_name\').value = \'\';" />
  268. </dd>
  269. <dt>
  270. <label for="type_name"><input type="radio" name="type" id="type_name" value="name" class="input_radio" />', $txt['reattribute_username'], '</label>
  271. </dt>
  272. <dd>
  273. <input type="text" name="from_name" id="from_name" value="" onclick="document.getElementById(\'type_name\').checked = \'checked\'; document.getElementById(\'from_email\').value = \'\';" class="input_text" />
  274. </dd>
  275. </dl>
  276. <dl class="settings">
  277. <dt>
  278. <label for="to"><strong>', $txt['reattribute_current_member'], ':</strong></label>
  279. </dt>
  280. <dd>
  281. <input type="text" name="to" id="to" value="" class="input_text" />
  282. </dd>
  283. </dl>
  284. <p class="maintain_members">
  285. <input type="checkbox" name="posts" id="posts" checked="checked" class="input_check" />
  286. <label for="posts">', $txt['reattribute_increase_posts'], '</label>
  287. </p>
  288. <span><input type="submit" id="do_attribute" value="', $txt['reattribute'], '" onclick="if (!checkAttributeValidity()) return false; return confirm(warningMessage);" class="button_submit" /></span>
  289. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  290. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  291. </form>
  292. </div>
  293. <span class="botslice"><span></span></span>
  294. </div>
  295. <div class="cat_bar">
  296. <h3 class="catbg">
  297. <span class="ie6_header floatleft">
  298. <a href="', $scripturl, '?action=helpadmin;help=maintenance_members" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" /></a> ', $txt['maintain_members'], '
  299. </span>
  300. </h3>
  301. </div>
  302. <div class="windowbg">
  303. <span class="topslice"><span></span></span>
  304. <div class="content">
  305. <form action="', $scripturl, '?action=admin;area=maintain;sa=members;activity=purgeinactive" method="post" accept-charset="', $context['character_set'], '" id="membersForm">
  306. <p><a id="membersLink"></a>', $txt['maintain_members_since1'], '
  307. <select name="del_type">
  308. <option value="activated" selected="selected">', $txt['maintain_members_activated'], '</option>
  309. <option value="logged">', $txt['maintain_members_logged_in'], '</option>
  310. </select> ', $txt['maintain_members_since2'], ' <input type="text" name="maxdays" value="30" size="3" class="input_text" />', $txt['maintain_members_since3'], '</p>';
  311. echo '
  312. <p><a href="#membersLink" onclick="swapMembers();"><img src="', $settings['images_url'], '/expand.gif" alt="+" id="membersIcon" /></a> <a href="#membersLink" onclick="swapMembers();" id="membersText" style="font-weight: bold;">', $txt['maintain_members_all'], '</a></p>
  313. <div style="display: none; padding: 3px" id="membersPanel">';
  314. foreach ($context['membergroups'] as $group)
  315. echo '
  316. <label for="groups', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups', $group['id'], '" checked="checked" class="input_check" /> ', $group['name'], '</label><br />';
  317. echo '
  318. </div>
  319. <span><input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_members_confirm'], '\');" class="button_submit" /></span>
  320. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  321. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  322. </form>
  323. </div>
  324. <span class="botslice"><span></span></span>
  325. </div>
  326. </div>
  327. <br class="clear" />
  328. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  329. <script type="text/javascript"><!-- // --><![CDATA[
  330. var oAttributeMemberSuggest = new smc_AutoSuggest({
  331. sSelf: \'oAttributeMemberSuggest\',
  332. sSessionId: \'', $context['session_id'], '\',
  333. sSessionVar: \'', $context['session_var'], '\',
  334. sSuggestId: \'attributeMember\',
  335. sControlId: \'to\',
  336. sSearchType: \'member\',
  337. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  338. bItemList: false
  339. });
  340. // ]]></script>';
  341. }
  342. // Template for the topic maintenance tasks.
  343. function template_maintain_topics()
  344. {
  345. global $scripturl, $txt, $context, $settings, $modSettings;
  346. // If maintenance has finished tell the user.
  347. if (!empty($context['maintenance_finished']))
  348. echo '
  349. <div class="maintenance_finished">
  350. ', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
  351. </div>';
  352. // Bit of javascript for showing which boards to prune in an otherwise hidden list.
  353. echo '
  354. <script type="text/javascript"><!-- // --><![CDATA[
  355. var rotSwap = false;
  356. function swapRot()
  357. {
  358. rotSwap = !rotSwap;
  359. // Toggle icon
  360. document.getElementById("rotIcon").src = smf_images_url + (rotSwap ? "/collapse.gif" : "/expand.gif");
  361. setInnerHTML(document.getElementById("rotText"), rotSwap ? ', JavaScriptEscape($txt['maintain_old_choose']), ' : ', JavaScriptEscape($txt['maintain_old_all']), ');
  362. // Toggle panel
  363. document.getElementById("rotPanel").style.display = !rotSwap ? "none" : "";
  364. // Toggle checkboxes
  365. var rotPanel = document.getElementById(\'rotPanel\');
  366. var oBoardCheckBoxes = rotPanel.getElementsByTagName(\'input\');
  367. for (var i = 0; i < oBoardCheckBoxes.length; i++)
  368. {
  369. if (oBoardCheckBoxes[i].type.toLowerCase() == "checkbox")
  370. oBoardCheckBoxes[i].checked = !rotSwap;
  371. }
  372. }
  373. // ]]></script>';
  374. echo '
  375. <div id="manage_maintenance">
  376. <div class="cat_bar">
  377. <h3 class="catbg">', $txt['maintain_old'], '</h3>
  378. </div>
  379. <div class="windowbg">
  380. <span class="topslice"><span></span></span>
  381. <div class="content flow_auto">
  382. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=pruneold" method="post" accept-charset="', $context['character_set'], '">';
  383. // The otherwise hidden "choose which boards to prune".
  384. echo '
  385. <p>
  386. <a id="rotLink"></a>', $txt['maintain_old_since_days1'], '<input type="text" name="maxdays" value="30" size="3" />', $txt['maintain_old_since_days2'], '
  387. </p>
  388. <p>
  389. <label for="delete_type_nothing"><input type="radio" name="delete_type" id="delete_type_nothing" value="nothing" class="input_radio" /> ', $txt['maintain_old_nothing_else'], '</label><br />
  390. <label for="delete_type_moved"><input type="radio" name="delete_type" id="delete_type_moved" value="moved" class="input_radio" checked="checked" /> ', $txt['maintain_old_are_moved'], '</label><br />
  391. <label for="delete_type_locked"><input type="radio" name="delete_type" id="delete_type_locked" value="locked" class="input_radio" /> ', $txt['maintain_old_are_locked'], '</label><br />
  392. </p>';
  393. if (!empty($modSettings['enableStickyTopics']))
  394. echo '
  395. <p>
  396. <label for="delete_old_not_sticky"><input type="checkbox" name="delete_old_not_sticky" id="delete_old_not_sticky" class="input_check" checked="checked" /> ', $txt['maintain_old_are_not_stickied'], '</label><br />
  397. </p>';
  398. echo '
  399. <p>
  400. <a href="#rotLink" onclick="swapRot();"><img src="', $settings['images_url'], '/expand.gif" alt="+" id="rotIcon" /></a> <a href="#rotLink" onclick="swapRot();" id="rotText" style="font-weight: bold;">', $txt['maintain_old_all'], '</a>
  401. </p>
  402. <div style="display: none;" id="rotPanel" class="flow_hidden">
  403. <div class="floatleft" style="width: 49%">';
  404. // This is the "middle" of the list.
  405. $middle = ceil(count($context['categories']) / 2);
  406. $i = 0;
  407. foreach ($context['categories'] as $category)
  408. {
  409. echo '
  410. <fieldset>
  411. <legend>', $category['name'], '</legend>
  412. <ul class="reset">';
  413. // Display a checkbox with every board.
  414. foreach ($category['boards'] as $board)
  415. echo '
  416. <li style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'] * 1.5, 'em;"><label for="boards_', $board['id'], '"><input type="checkbox" name="boards[', $board['id'], ']" id="boards_', $board['id'], '" checked="checked" class="input_check" />', $board['name'], '</label></li>';
  417. echo '
  418. </ul>
  419. </fieldset>';
  420. // Increase $i, and check if we're at the middle yet.
  421. if (++$i == $middle)
  422. echo '
  423. </div>
  424. <div class="floatright" style="width: 49%;">';
  425. }
  426. echo '
  427. </div>
  428. </div>
  429. <span><input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_confirm'], '\');" class="button_submit" /></span>
  430. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  431. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  432. </form>
  433. </div>
  434. <span class="botslice"><span></span></span>
  435. </div>
  436. <div class="cat_bar">
  437. <h3 class="catbg">', $txt['move_topics_maintenance'], '</h3>
  438. </div>
  439. <div class="windowbg2">
  440. <span class="topslice"><span></span></span>
  441. <div class="content">
  442. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=massmove" method="post" accept-charset="', $context['character_set'], '">
  443. <p><label for="id_board_from">', $txt['move_topics_from'], ' </label>
  444. <select name="id_board_from" id="id_board_from">
  445. <option disabled="disabled">(', $txt['move_topics_select_board'], ')</option>';
  446. // From board
  447. foreach ($context['categories'] as $category)
  448. {
  449. echo '
  450. <option disabled="disabled">--------------------------------------</option>
  451. <option disabled="disabled">', $category['name'], '</option>
  452. <option disabled="disabled">--------------------------------------</option>';
  453. foreach ($category['boards'] as $board)
  454. echo '
  455. <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
  456. }
  457. echo '
  458. </select>
  459. <label for="id_board_to">', $txt['move_topics_to'], '</label>
  460. <select name="id_board_to" id="id_board_to">
  461. <option disabled="disabled">(', $txt['move_topics_select_board'], ')</option>';
  462. // To board
  463. foreach ($context['categories'] as $category)
  464. {
  465. echo '
  466. <option disabled="disabled">--------------------------------------</option>
  467. <option disabled="disabled">', $category['name'], '</option>
  468. <option disabled="disabled">--------------------------------------</option>';
  469. foreach ($category['boards'] as $board)
  470. echo '
  471. <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
  472. }
  473. echo '
  474. </select></p>
  475. <span><input type="submit" value="', $txt['move_topics_now'], '" onclick="if (document.getElementById(\'id_board_from\').options[document.getElementById(\'id_board_from\').selectedIndex].disabled || document.getElementById(\'id_board_from\').options[document.getElementById(\'id_board_to\').selectedIndex].disabled) return false; var confirmText = \'', $txt['move_topics_confirm'] . '\'; return confirm(confirmText.replace(/%board_from%/, document.getElementById(\'id_board_from\').options[document.getElementById(\'id_board_from\').selectedIndex].text.replace(/^=+&gt;&nbsp;/, \'\')).replace(/%board_to%/, document.getElementById(\'id_board_to\').options[document.getElementById(\'id_board_to\').selectedIndex].text.replace(/^=+&gt;&nbsp;/, \'\')));" class="button_submit" /></span>
  476. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  477. </form>
  478. </div>
  479. <span class="botslice"><span></span></span>
  480. </div>
  481. </div>
  482. <br class="clear" />';
  483. }
  484. // Simple template for showing results of our optimization...
  485. function template_optimize()
  486. {
  487. global $context, $settings, $options, $txt, $scripturl;
  488. echo '
  489. <div id="manage_maintenance">
  490. <div class="cat_bar">
  491. <h3 class="catbg">', $txt['maintain_optimize'], '</h3>
  492. </div>
  493. <div class="windowbg">
  494. <span class="topslice"><span></span></span>
  495. <div class="content">
  496. <p>
  497. ', $txt['database_numb_tables'], '<br />
  498. ', $txt['database_optimize_attempt'], '<br />';
  499. // List each table being optimized...
  500. foreach ($context['optimized_tables'] as $table)
  501. echo '
  502. ', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br />';
  503. // How did we go?
  504. echo '
  505. <br />', $context['num_tables_optimized'] == 0 ? $txt['database_already_optimized'] : $context['num_tables_optimized'] . ' ' . $txt['database_optimized'];
  506. echo '
  507. </p>
  508. <p><a href="', $scripturl, '?action=admin;area=maintain">', $txt['maintain_return'], '</a></p>
  509. </div>
  510. <span class="botslice"><span></span></span>
  511. </div>
  512. </div>
  513. <br class="clear" />';
  514. }
  515. function template_convert_utf8()
  516. {
  517. global $context, $txt, $settings, $scripturl;
  518. echo '
  519. <div id="manage_maintenance">
  520. <div class="cat_bar">
  521. <h3 class="catbg">', $txt['utf8_title'], '</h3>
  522. </div>
  523. <div class="windowbg">
  524. <span class="topslice"><span></span></span>
  525. <div class="content">
  526. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertutf8" method="post" accept-charset="', $context['character_set'], '">
  527. <p>', $txt['utf8_introduction'], '</p>
  528. <div>', $txt['utf8_warning'], '</div>
  529. <dl class="settings">
  530. <dt><strong>', $txt['utf8_source_charset'], ':</strong></dt>
  531. <dd><select name="src_charset">';
  532. foreach ($context['charset_list'] as $charset)
  533. echo '
  534. <option value="', $charset, '"', $charset === $context['charset_detected'] ? ' selected="selected"' : '', '>', $charset, '</option>';
  535. echo '
  536. </select></dd>
  537. <dt><strong>', $txt['utf8_database_charset'], ':</strong></dt>
  538. <dd>', $context['database_charset'], '</dd>
  539. <dt><strong>', $txt['utf8_target_charset'], ': </strong></dt>
  540. <dd>', $txt['utf8_utf8'], '</dd>
  541. </dl>
  542. <input type="submit" value="', $txt['utf8_proceed'], '" class="button_submit" />
  543. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  544. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  545. <input type="hidden" name="proceed" value="1" />
  546. </form>
  547. </div>
  548. <span class="botslice"><span></span></span>
  549. </div>
  550. </div>
  551. <br class="clear" />';
  552. }
  553. function template_convert_entities()
  554. {
  555. global $context, $txt, $settings, $scripturl;
  556. echo '
  557. <div id="manage_maintenance">
  558. <div class="cat_bar">
  559. <h3 class="catbg">', $txt['entity_convert_title'], '</h3>
  560. </div>
  561. <div class="windowbg">
  562. <span class="topslice"><span></span></span>
  563. <div class="content">
  564. <p>', $txt['entity_convert_introduction'], '</p>
  565. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertentities;start=0;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  566. <input type="submit" value="', $txt['entity_convert_proceed'], '" class="button_submit" />
  567. </form>
  568. </div>
  569. <span class="botslice"><span></span></span>
  570. </div>
  571. </div>
  572. <br class="clear" />';
  573. }
  574. ?>