ManageMaintenance.template.php 28 KB

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