ManageMaintenance.template.php 28 KB

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