ManageMaintenance.template.php 31 KB

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