ManageMaintenance.template.php 28 KB

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