ManageMaintenance.template.php 29 KB

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