ManageMaintenance.template.php 30 KB

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