ManageAttachments.template.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 template wraps around the simple settings page to add javascript functionality.
  13. function template_avatar_settings_above()
  14. {
  15. }
  16. function template_avatar_settings_below()
  17. {
  18. echo '
  19. <script type="text/javascript"><!-- // --><![CDATA[
  20. var fUpdateStatus = function ()
  21. {
  22. document.getElementById("avatar_max_width_external").disabled = document.getElementById("avatar_download_external").checked;
  23. document.getElementById("avatar_max_height_external").disabled = document.getElementById("avatar_download_external").checked;
  24. document.getElementById("avatar_action_too_large").disabled = document.getElementById("avatar_download_external").checked;
  25. document.getElementById("custom_avatar_dir").disabled = document.getElementById("custom_avatar_enabled").value == 0;
  26. document.getElementById("custom_avatar_url").disabled = document.getElementById("custom_avatar_enabled").value == 0;
  27. }
  28. addLoadEvent(fUpdateStatus);
  29. // ]]></script>
  30. ';
  31. }
  32. function template_browse()
  33. {
  34. global $context, $settings, $options, $scripturl, $txt;
  35. echo '
  36. <div id="manage_attachments">
  37. <div class="cat_bar">
  38. <h3 class="catbg">', $txt['attachment_manager_browse_files'], '</h3>
  39. </div>
  40. <div class="windowbg2">
  41. <span class="topslice"><span></span></span>
  42. <div class="content">
  43. <a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse">', $context['browse_type'] === 'attachments' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_attachments'], '</a> |
  44. <a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse;avatars">', $context['browse_type'] === 'avatars' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_avatars'], '</a> |
  45. <a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse;thumbs">', $context['browse_type'] === 'thumbs' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_thumbs'], '</a>
  46. </div>
  47. <span class="botslice"><span></span></span>
  48. </div>
  49. </div>';
  50. template_show_list('file_list');
  51. echo '
  52. <br class="clear" />';
  53. }
  54. function template_maintenance()
  55. {
  56. global $context, $settings, $options, $scripturl, $txt;
  57. echo '
  58. <div id="manage_attachments">
  59. <div class="cat_bar">
  60. <h3 class="catbg">', $txt['attachment_stats'], '</h3>
  61. </div>
  62. <div class="windowbg">
  63. <span class="topslice"><span></span></span>
  64. <div class="content">
  65. <dl class="settings">
  66. <dt><strong>', $txt['attachment_total'], ':</strong></dt><dd>', $context['num_attachments'], '</dd>
  67. <dt><strong>', $txt['attachment_manager_total_avatars'], ':</strong></dt><dd>', $context['num_avatars'], '</dd>
  68. <dt><strong>', $txt['attachmentdir_size' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
  69. <dt><strong>', $txt['attachment_space' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', isset($context['attachment_space']) ? $context['attachment_space'] . ' ' . $txt['kilobyte'] : $txt['attachmentdir_size_not_set'], '</dd>
  70. </dl>
  71. </div>
  72. <span class="botslice"><span></span></span>
  73. </div>
  74. <br class="clear" />
  75. <div class="cat_bar">
  76. <h3 class="catbg">', $txt['attachment_integrity_check'], '</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=manageattachments;sa=repair;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  82. <p>', $txt['attachment_integrity_check_desc'], '</p>
  83. <hr class="hrcolor" />
  84. <input type="submit" name="repair" value="', $txt['attachment_check_now'], '" class="button_submit" />
  85. <br class="clear_right" />
  86. </form>
  87. </div>
  88. <span class="botslice"><span></span></span>
  89. </div>
  90. <br class="clear" />
  91. <div class="cat_bar">
  92. <h3 class="catbg">', $txt['attachment_pruning'], '</h3>
  93. </div>
  94. <div class="windowbg">
  95. <span class="topslice"><span></span></span>
  96. <div class="content">
  97. <form action="', $scripturl, '?action=admin;area=manageattachments" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['attachment_pruning_warning'], '\');" style="margin: 0 0 2ex 0;">
  98. ', $txt['attachment_remove_old'], ' <input type="text" name="age" value="25" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  99. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  100. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  101. <input type="hidden" name="type" value="attachments" />
  102. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  103. <input type="hidden" name="sa" value="byAge" />
  104. <br class="clear_right" />
  105. </form>
  106. <hr />
  107. <form action="', $scripturl, '?action=admin;area=manageattachments" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['attachment_pruning_warning'], '\');" style="margin: 0 0 2ex 0;">
  108. ', $txt['attachment_remove_size'], ' <input type="text" name="size" id="size" value="100" size="4" class="input_text" /> ', $txt['kilobyte'], '<br />
  109. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  110. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  111. <input type="hidden" name="type" value="attachments" />
  112. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  113. <input type="hidden" name="sa" value="bySize" />
  114. <br class="clear_right" />
  115. </form>
  116. <hr />
  117. <form action="', $scripturl, '?action=admin;area=manageattachments" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['attachment_pruning_warning'], '\');" style="margin: 0 0 2ex 0;">
  118. ', $txt['attachment_manager_avatars_older'], ' <input type="text" name="age" value="45" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  119. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  120. <input type="hidden" name="type" value="avatars" />
  121. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  122. <input type="hidden" name="sa" value="byAge" />
  123. <br class="clear_right" />
  124. </form>
  125. </div>
  126. <span class="botslice"><span></span></span>
  127. </div>
  128. </div>
  129. <br class="clear" />';
  130. }
  131. function template_attachment_repair()
  132. {
  133. global $context, $txt, $scripturl, $settings;
  134. // If we've completed just let them know!
  135. if ($context['completed'])
  136. {
  137. echo '
  138. <div id="manage_attachments">
  139. <div class="cat_bar">
  140. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  141. </div>
  142. <div class="windowbg">
  143. <span class="topslice"><span></span></span>
  144. <div class="content">
  145. ', $txt['repair_attachments_complete_desc'], '
  146. </div>
  147. <span class="botslice"><span></span></span>
  148. </div>
  149. </div>
  150. <br class="clear" />';
  151. }
  152. // What about if no errors were even found?
  153. elseif (!$context['errors_found'])
  154. {
  155. echo '
  156. <div id="manage_attachments">
  157. <div class="cat_bar">
  158. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  159. </div>
  160. <div class="windowbg">
  161. <span class="topslice"><span></span></span>
  162. <div class="content">
  163. ', $txt['repair_attachments_no_errors'], '
  164. </div>
  165. <span class="botslice"><span></span></span>
  166. </div>
  167. </div>
  168. <br class="clear" />';
  169. }
  170. // Otherwise, I'm sad to say, we have a problem!
  171. else
  172. {
  173. echo '
  174. <div id="manage_attachments">
  175. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=repair;fixErrors=1;step=0;substep=0;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  176. <div class="cat_bar">
  177. <h3 class="catbg">', $txt['repair_attachments'], '</h3>
  178. </div>
  179. <div class="windowbg">
  180. <span class="topslice"><span></span></span>
  181. <div class="content">
  182. <p>', $txt['repair_attachments_error_desc'], '</p>';
  183. // Loop through each error reporting the status
  184. foreach ($context['repair_errors'] as $error => $number)
  185. {
  186. if (!empty($number))
  187. echo '
  188. <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '" class="input_check" />
  189. <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br />';
  190. }
  191. echo ' <br />
  192. <input type="submit" value="', $txt['repair_attachments_continue'], '" class="button_submit" />
  193. <input type="submit" name="cancel" value="', $txt['repair_attachments_cancel'], '" class="button_submit" />
  194. </div>
  195. <span class="botslice"><span></span></span>
  196. </div>
  197. </form>
  198. </div>
  199. <br class="clear" />';
  200. }
  201. }
  202. function template_attachment_paths()
  203. {
  204. template_show_list('attach_paths');
  205. }
  206. ?>