2
0

ManageMaintenance.template.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 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, $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' : '', '/><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, $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, $txt, $scripturl;
  185. echo '
  186. <script><!-- // --><![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 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 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>', $txt['maintain_members_activated'], '</option>
  287. <option value="logged">', $txt['maintain_members_logged_in'], '</option>
  288. </select> ', $txt['maintain_members_since2'], ' <input type="number" 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 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><!-- // --><![CDATA[
  318. var oAttributeMemberSuggest = new smc_AutoSuggest({
  319. sSelf: \'oAttributeMemberSuggest\',
  320. sSessionId: smf_session_id,
  321. sSessionVar: smf_session_var,
  322. sSuggestId: \'attributeMember\',
  323. sControlId: \'to\',
  324. sSearchType: \'member\',
  325. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  326. bItemList: false
  327. });
  328. // ]]></script>';
  329. }
  330. // Template for the topic maintenance tasks.
  331. function template_maintain_topics()
  332. {
  333. global $scripturl, $txt, $context, $settings, $modSettings;
  334. // If maintenance has finished tell the user.
  335. if (!empty($context['maintenance_finished']))
  336. echo '
  337. <div class="infobox">
  338. ', sprintf($txt['maintain_done'], $context['maintenance_finished']), '
  339. </div>';
  340. // Bit of javascript for showing which boards to prune in an otherwise hidden list.
  341. echo '
  342. <script><!-- // --><![CDATA[
  343. var rotSwap = false;
  344. function swapRot()
  345. {
  346. rotSwap = !rotSwap;
  347. // Toggle icon
  348. document.getElementById("rotIcon").src = smf_images_url + (rotSwap ? "/selected_open.png" : "/selected.png");
  349. setInnerHTML(document.getElementById("rotText"), rotSwap ? ', JavaScriptEscape($txt['maintain_old_choose']), ' : ', JavaScriptEscape($txt['maintain_old_all']), ');
  350. // Toggle panel
  351. $("#rotPanel").slideToggle(300);
  352. // Toggle checkboxes
  353. var rotPanel = document.getElementById(\'rotPanel\');
  354. var oBoardCheckBoxes = rotPanel.getElementsByTagName(\'input\');
  355. for (var i = 0; i < oBoardCheckBoxes.length; i++)
  356. {
  357. if (oBoardCheckBoxes[i].type.toLowerCase() == "checkbox")
  358. oBoardCheckBoxes[i].checked = !rotSwap;
  359. }
  360. }
  361. // ]]></script>';
  362. echo '
  363. <div id="manage_maintenance">
  364. <div class="cat_bar">
  365. <h3 class="catbg">', $txt['maintain_old'], '</h3>
  366. </div>
  367. <div class="windowbg">
  368. <div class="content flow_auto">
  369. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=pruneold" method="post" accept-charset="', $context['character_set'], '">';
  370. // The otherwise hidden "choose which boards to prune".
  371. echo '
  372. <p>
  373. <a id="rotLink"></a>', $txt['maintain_old_since_days1'], '<input type="number" name="maxdays" value="30" size="3">', $txt['maintain_old_since_days2'], '
  374. </p>
  375. <p>
  376. <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>
  377. <label for="delete_type_moved"><input type="radio" name="delete_type" id="delete_type_moved" value="moved" class="input_radio" checked> ', $txt['maintain_old_are_moved'], '</label><br>
  378. <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>
  379. </p>
  380. <p>
  381. <label for="delete_old_not_sticky"><input type="checkbox" name="delete_old_not_sticky" id="delete_old_not_sticky" class="input_check" checked> ', $txt['maintain_old_are_not_stickied'], '</label><br>
  382. </p>
  383. <p>
  384. <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>
  385. </p>
  386. <div style="display: none;" id="rotPanel" class="flow_hidden">
  387. <div class="floatleft" style="width: 49%">';
  388. // This is the "middle" of the list.
  389. $middle = ceil(count($context['categories']) / 2);
  390. $i = 0;
  391. foreach ($context['categories'] as $category)
  392. {
  393. echo '
  394. <fieldset>
  395. <legend>', $category['name'], '</legend>
  396. <ul class="reset">';
  397. // Display a checkbox with every board.
  398. foreach ($category['boards'] as $board)
  399. echo '
  400. <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 class="input_check">', $board['name'], '</label></li>';
  401. echo '
  402. </ul>
  403. </fieldset>';
  404. // Increase $i, and check if we're at the middle yet.
  405. if (++$i == $middle)
  406. echo '
  407. </div>
  408. <div class="floatright" style="width: 49%;">';
  409. }
  410. echo '
  411. </div>
  412. </div>
  413. <input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_confirm'], '\');" class="button_submit">
  414. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  415. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
  416. </form>
  417. </div>
  418. </div>
  419. <div class="cat_bar">
  420. <h3 class="catbg">', $txt['maintain_old_drafts'], '</h3>
  421. </div>
  422. <div class="windowbg">
  423. <div class="content">
  424. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=olddrafts" method="post" accept-charset="', $context['character_set'], '">
  425. <p>', $txt['maintain_old_drafts_days'], '&nbsp;<input type="number" name="draftdays" value="', (!empty($modSettings['drafts_keep_days']) ? $modSettings['drafts_keep_days'] : 30), '" size="3">&nbsp;', $txt['days_word'], '</p>
  426. <input type="submit" value="', $txt['maintain_old_remove'], '" onclick="return confirm(\'', $txt['maintain_old_drafts_confirm'], '\');" class="button_submit">
  427. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  428. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
  429. </form>
  430. </div>
  431. </div>
  432. <div class="cat_bar">
  433. <h3 class="catbg">', $txt['move_topics_maintenance'], '</h3>
  434. </div>
  435. <div class="windowbg2">
  436. <div class="content">
  437. <form action="', $scripturl, '?action=admin;area=maintain;sa=topics;activity=massmove" method="post" accept-charset="', $context['character_set'], '">
  438. <p><label for="id_board_from">', $txt['move_topics_from'], ' </label>
  439. <select name="id_board_from" id="id_board_from">
  440. <option disabled>(', $txt['move_topics_select_board'], ')</option>';
  441. // From board
  442. foreach ($context['categories'] as $category)
  443. {
  444. echo '
  445. <optgroup label="', $category['name'], '">';
  446. foreach ($category['boards'] as $board)
  447. echo '
  448. <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
  449. echo '
  450. </optgroup>';
  451. }
  452. echo '
  453. </select>
  454. <label for="id_board_to">', $txt['move_topics_to'], '</label>
  455. <select name="id_board_to" id="id_board_to">
  456. <option disabled>(', $txt['move_topics_select_board'], ')</option>';
  457. // To board
  458. foreach ($context['categories'] as $category)
  459. {
  460. echo '
  461. <optgroup label="', $category['name'], '">';
  462. foreach ($category['boards'] as $board)
  463. echo '
  464. <option value="', $board['id'], '"> ', str_repeat('==', $board['child_level']), '=&gt;&nbsp;', $board['name'], '</option>';
  465. echo '
  466. </optgroup>';
  467. }
  468. echo '
  469. </select></p>
  470. <p>
  471. ', $txt['move_topics_older_than'], '<input type="number" name="maxdays" value="30" size="3">', $txt['manageposts_days'], '&nbsp;(', $txt['move_zero_all'], ')
  472. </p>
  473. <p>
  474. <label for="move_type_locked"><input type="checkbox" name="move_type_locked" id="move_type_locked" class="input_check" checked> ', $txt['move_type_locked'], '</label><br>
  475. <label for="move_type_sticky"><input type="checkbox" name="move_type_sticky" id="move_type_sticky" class="input_check"> ', $txt['move_type_sticky'], '</label><br>
  476. </p>
  477. <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">
  478. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  479. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
  480. </form>
  481. </div>
  482. </div>
  483. </div>';
  484. }
  485. // Simple template for showing results of our optimization...
  486. function template_optimize()
  487. {
  488. global $context, $txt, $scripturl;
  489. echo '
  490. <div id="manage_maintenance">
  491. <div class="cat_bar">
  492. <h3 class="catbg">', $txt['maintain_optimize'], '</h3>
  493. </div>
  494. <div class="windowbg">
  495. <div class="content">
  496. <p>
  497. ', $txt['database_numb_tables'], '<br>
  498. ', $txt['database_optimize_attempt'], '<br>';
  499. // List each table being optimized...
  500. foreach ($context['optimized_tables'] as $table)
  501. echo '
  502. ', sprintf($txt['database_optimizing'], $table['name'], $table['data_freed']), '<br>';
  503. // How did we go?
  504. echo '
  505. <br>', $context['num_tables_optimized'] == 0 ? $txt['database_already_optimized'] : $context['num_tables_optimized'] . ' ' . $txt['database_optimized'];
  506. echo '
  507. </p>
  508. <p><a href="', $scripturl, '?action=admin;area=maintain">', $txt['maintain_return'], '</a></p>
  509. </div>
  510. </div>
  511. </div>';
  512. }
  513. function template_convert_utf8()
  514. {
  515. global $context, $txt, $scripturl;
  516. echo '
  517. <div id="manage_maintenance">
  518. <div class="cat_bar">
  519. <h3 class="catbg">', $txt['utf8_title'], '</h3>
  520. </div>
  521. <div class="windowbg">
  522. <div class="content">
  523. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertutf8" method="post" accept-charset="', $context['character_set'], '">
  524. <p>', $txt['utf8_introduction'], '</p>
  525. <div>', $txt['utf8_warning'], '</div>
  526. <dl class="settings">
  527. <dt><strong>', $txt['utf8_source_charset'], ':</strong></dt>
  528. <dd><select name="src_charset">';
  529. foreach ($context['charset_list'] as $charset)
  530. echo '
  531. <option value="', $charset, '"', $charset === $context['charset_detected'] ? ' selected' : '', '>', $charset, '</option>';
  532. echo '
  533. </select></dd>
  534. <dt><strong>', $txt['utf8_database_charset'], ':</strong></dt>
  535. <dd>', $context['database_charset'], '</dd>
  536. <dt><strong>', $txt['utf8_target_charset'], ': </strong></dt>
  537. <dd>', $txt['utf8_utf8'], '</dd>
  538. </dl>
  539. <input type="submit" value="', $txt['utf8_proceed'], '" class="button_submit">
  540. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  541. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
  542. <input type="hidden" name="proceed" value="1">
  543. </form>
  544. </div>
  545. </div>
  546. </div>';
  547. }
  548. function template_convert_entities()
  549. {
  550. global $context, $txt, $scripturl;
  551. echo '
  552. <div id="manage_maintenance">
  553. <div class="cat_bar">
  554. <h3 class="catbg">', $txt['entity_convert_title'], '</h3>
  555. </div>
  556. <div class="windowbg">
  557. <div class="content">
  558. <p>', $txt['entity_convert_introduction'], '</p>
  559. <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'], '">
  560. <input type="submit" value="', $txt['entity_convert_proceed'], '" class="button_submit">
  561. </form>
  562. </div>
  563. </div>
  564. </div>';
  565. }
  566. function template_convert_msgbody()
  567. {
  568. global $context, $txt, $scripturl;
  569. echo '
  570. <div id="manage_maintenance">
  571. <div class="cat_bar">
  572. <h3 class="catbg">', $txt[$context['convert_to'] . '_title'], '</h3>
  573. </div>
  574. <div class="windowbg">
  575. <div class="content">
  576. <p>', $txt['body_checking_introduction'], '</p>';
  577. if (!empty($context['exceeding_messages']))
  578. {
  579. echo '
  580. <p class="noticebox">', $txt['exceeding_messages'], '
  581. <ul>
  582. <li>
  583. ', implode('</li><li>', $context['exceeding_messages']), '
  584. </li>
  585. </ul>';
  586. if (!empty($context['exceeding_messages_morethan']))
  587. echo '
  588. <p>', $context['exceeding_messages_morethan'], '</p>';
  589. }
  590. else
  591. echo '
  592. <p class="infobox">', $txt['convert_to_text'], '</p>';
  593. echo '
  594. <form action="', $scripturl, '?action=admin;area=maintain;sa=database;activity=convertmsgbody" method="post" accept-charset="', $context['character_set'], '">
  595. <hr class="hrcolor">
  596. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  597. <input type="hidden" name="', $context['admin-maint_token_var'], '" value="', $context['admin-maint_token'], '">
  598. <input type="submit" name="do_conversion" value="', $txt['entity_convert_proceed'], '" class="button_submit">
  599. </form>
  600. </div>
  601. </div>
  602. </div>';
  603. }
  604. ?>