ManageMaintenance.template.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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="infobox">
  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="infobox">
  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="infobox">
  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="infobox">
  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. <p>
  382. <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 />
  383. </p>
  384. <p>
  385. <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>
  386. </p>
  387. <div style="display: none;" id="rotPanel" class="flow_hidden">
  388. <div class="floatleft" style="width: 49%">';
  389. // This is the "middle" of the list.
  390. $middle = ceil(count($context['categories']) / 2);
  391. $i = 0;
  392. foreach ($context['categories'] as $category)
  393. {
  394. echo '
  395. <fieldset>
  396. <legend>', $category['name'], '</legend>
  397. <ul class="reset">';
  398. // Display a checkbox with every board.
  399. foreach ($category['boards'] as $board)
  400. echo '
  401. <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>';
  402. echo '
  403. </ul>
  404. </fieldset>';
  405. // Increase $i, and check if we're at the middle yet.
  406. if (++$i == $middle)
  407. echo '
  408. </div>
  409. <div class="floatright" style="width: 49%;">';
  410. }
  411. echo '
  412. </div>
  413. </div>
  414. <input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_confirm'], '\');" class="button_submit" />
  415. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  416. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  417. </form>
  418. </div>
  419. </div>
  420. <div class="cat_bar">
  421. <h3 class="catbg">', $txt['maintain_old_drafts'], '</h3>
  422. </div>
  423. <div class="windowbg">
  424. <div class="content">
  425. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=olddrafts" method="post" accept-charset="', $context['character_set'], '">
  426. <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>
  427. <input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_drafts_confirm'], '\');" class="button_submit" />
  428. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  429. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  430. </form>
  431. </div>
  432. </div>
  433. <div class="cat_bar">
  434. <h3 class="catbg">', $txt['move_topics_maintenance'], '</h3>
  435. </div>
  436. <div class="windowbg2">
  437. <div class="content">
  438. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=massmove" method="post" accept-charset="', $context['character_set'], '">
  439. <p><label for="id_board_from">', $txt['move_topics_from'], ' </label>
  440. <select name="id_board_from" id="id_board_from">
  441. <option disabled="disabled">(', $txt['move_topics_select_board'], ')</option>';
  442. // From board
  443. foreach ($context['categories'] as $category)
  444. {
  445. echo '
  446. <option disabled="disabled">--------------------------------------</option>
  447. <option disabled="disabled">', $category['name'], '</option>
  448. <option disabled="disabled">--------------------------------------</option>';
  449. foreach ($category['boards'] as $board)
  450. echo '
  451. <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
  452. }
  453. echo '
  454. </select>
  455. <label for="id_board_to">', $txt['move_topics_to'], '</label>
  456. <select name="id_board_to" id="id_board_to">
  457. <option disabled="disabled">(', $txt['move_topics_select_board'], ')</option>';
  458. // To board
  459. foreach ($context['categories'] as $category)
  460. {
  461. echo '
  462. <option disabled="disabled">--------------------------------------</option>
  463. <option disabled="disabled">', $category['name'], '</option>
  464. <option disabled="disabled">--------------------------------------</option>';
  465. foreach ($category['boards'] as $board)
  466. echo '
  467. <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
  468. }
  469. echo '
  470. </select></p>
  471. <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" />
  472. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  473. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  474. </form>
  475. </div>
  476. </div>
  477. </div>';
  478. }
  479. // Simple template for showing results of our optimization...
  480. function template_optimize()
  481. {
  482. global $context, $settings, $options, $txt, $scripturl;
  483. echo '
  484. <div id="manage_maintenance">
  485. <div class="cat_bar">
  486. <h3 class="catbg">', $txt['maintain_optimize'], '</h3>
  487. </div>
  488. <div class="windowbg">
  489. <div class="content">
  490. <p>
  491. ', $txt['database_numb_tables'], '<br />
  492. ', $txt['database_optimize_attempt'], '<br />';
  493. // List each table being optimized...
  494. foreach ($context['optimized_tables'] as $table)
  495. echo '
  496. ', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br />';
  497. // How did we go?
  498. echo '
  499. <br />', $context['num_tables_optimized'] == 0 ? $txt['database_already_optimized'] : $context['num_tables_optimized'] . ' ' . $txt['database_optimized'];
  500. echo '
  501. </p>
  502. <p><a href="', $scripturl, '?action=admin;area=maintain">', $txt['maintain_return'], '</a></p>
  503. </div>
  504. </div>
  505. </div>';
  506. }
  507. function template_convert_utf8()
  508. {
  509. global $context, $txt, $settings, $scripturl;
  510. echo '
  511. <div id="manage_maintenance">
  512. <div class="cat_bar">
  513. <h3 class="catbg">', $txt['utf8_title'], '</h3>
  514. </div>
  515. <div class="windowbg">
  516. <div class="content">
  517. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertutf8" method="post" accept-charset="', $context['character_set'], '">
  518. <p>', $txt['utf8_introduction'], '</p>
  519. <div>', $txt['utf8_warning'], '</div>
  520. <dl class="settings">
  521. <dt><strong>', $txt['utf8_source_charset'], ':</strong></dt>
  522. <dd><select name="src_charset">';
  523. foreach ($context['charset_list'] as $charset)
  524. echo '
  525. <option value="', $charset, '"', $charset === $context['charset_detected'] ? ' selected="selected"' : '', '>', $charset, '</option>';
  526. echo '
  527. </select></dd>
  528. <dt><strong>', $txt['utf8_database_charset'], ':</strong></dt>
  529. <dd>', $context['database_charset'], '</dd>
  530. <dt><strong>', $txt['utf8_target_charset'], ': </strong></dt>
  531. <dd>', $txt['utf8_utf8'], '</dd>
  532. </dl>
  533. <input type="submit" value="', $txt['utf8_proceed'], '" class="button_submit" />
  534. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  535. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  536. <input type="hidden" name="proceed" value="1" />
  537. </form>
  538. </div>
  539. </div>
  540. </div>';
  541. }
  542. function template_convert_entities()
  543. {
  544. global $context, $txt, $settings, $scripturl;
  545. echo '
  546. <div id="manage_maintenance">
  547. <div class="cat_bar">
  548. <h3 class="catbg">', $txt['entity_convert_title'], '</h3>
  549. </div>
  550. <div class="windowbg">
  551. <div class="content">
  552. <p>', $txt['entity_convert_introduction'], '</p>
  553. <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'], '">
  554. <input type="submit" value="', $txt['entity_convert_proceed'], '" class="button_submit" />
  555. </form>
  556. </div>
  557. </div>
  558. </div>';
  559. }
  560. function template_convert_msgbody()
  561. {
  562. global $context, $txt, $settings, $scripturl;
  563. echo '
  564. <div id="manage_maintenance">
  565. <div class="cat_bar">
  566. <h3 class="catbg">', $txt[$context['convert_to'] . '_title'], '</h3>
  567. </div>
  568. <div class="windowbg">
  569. <div class="content">
  570. <p>', $txt['body_checking_introduction'], '</p>';
  571. if (!empty($context['exceeding_messages']))
  572. {
  573. echo '
  574. <p class="noticebox">', $txt['exceeding_messages'], '
  575. <ul>
  576. <li>
  577. ', implode('</li><li>', $context['exceeding_messages']), '
  578. </li>
  579. </ul>';
  580. if (!empty($context['exceeding_messages_morethan']))
  581. echo '
  582. <p>', $context['exceeding_messages_morethan'], '</p>';
  583. }
  584. else
  585. echo '
  586. <p class="infobox">', $txt['convert_to_text'], '</p>';
  587. echo '
  588. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" method="post" accept-charset="', $context['character_set'], '">
  589. <hr class="hrcolor" />
  590. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  591. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '" />
  592. <input type="submit" name="do_conversion" value="', $txt['entity_convert_proceed'], '" class="button_submit" />
  593. </form>
  594. </div>
  595. </div>
  596. </div>';
  597. }
  598. ?>