2
0

ManageMaintenance.template.php 30 KB

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