ManageMaintenance.template.php 29 KB

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