ManageMaintenance.template.php 30 KB

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