ManageAttachments.template.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2012 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. <div class="content">
  42. <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> |
  43. <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> |
  44. <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>
  45. </div>
  46. </div>
  47. </div>';
  48. template_show_list('file_list');
  49. }
  50. function template_maintenance()
  51. {
  52. global $context, $settings, $options, $scripturl, $txt;
  53. echo '
  54. <div id="manage_attachments">
  55. <div class="cat_bar">
  56. <h3 class="catbg">', $txt['attachment_stats'], '</h3>
  57. </div>
  58. <div class="windowbg">
  59. <div class="content">
  60. <dl class="settings">
  61. <dt><strong>', $txt['attachment_total'], ':</strong></dt><dd>', $context['num_attachments'], '</dd>
  62. <dt><strong>', $txt['attachment_manager_total_avatars'], ':</strong></dt><dd>', $context['num_avatars'], '</dd>
  63. <dt><strong>', $txt['attachmentdir_size' . ($context['attach_multiple_dirs'] ? '_current' : '')], ':</strong></dt><dd>', $context['attachment_total_size'], ' ', $txt['kilobyte'], '</dd>
  64. <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>
  65. </dl>
  66. </div>
  67. </div>
  68. <div class="cat_bar">
  69. <h3 class="catbg">', $txt['attachment_integrity_check'], '</h3>
  70. </div>
  71. <div class="windowbg">
  72. <div class="content">
  73. <form action="', $scripturl, '?action=admin;area=manageattachments;sa=repair;', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  74. <p>', $txt['attachment_integrity_check_desc'], '</p>
  75. <hr class="hrcolor" />
  76. <input type="submit" name="repair" value="', $txt['attachment_check_now'], '" class="button_submit" />
  77. <br class="clear_right" />
  78. </form>
  79. </div>
  80. </div>
  81. <div class="cat_bar">
  82. <h3 class="catbg">', $txt['attachment_pruning'], '</h3>
  83. </div>
  84. <div class="windowbg">
  85. <div class="content">
  86. <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;">
  87. ', $txt['attachment_remove_old'], ' <input type="text" name="age" value="25" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  88. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  89. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  90. <input type="hidden" name="type" value="attachments" />
  91. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  92. <input type="hidden" name="sa" value="byAge" />
  93. <br class="clear_right" />
  94. </form>
  95. <hr />
  96. <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;">
  97. ', $txt['attachment_remove_size'], ' <input type="text" name="size" id="size" value="100" size="4" class="input_text" /> ', $txt['kilobyte'], '<br />
  98. ', $txt['attachment_pruning_message'], ': <input type="text" name="notice" value="', $txt['attachment_delete_admin'], '" size="40" class="input_text" /><br />
  99. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  100. <input type="hidden" name="type" value="attachments" />
  101. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  102. <input type="hidden" name="sa" value="bySize" />
  103. <br class="clear_right" />
  104. </form>
  105. <hr />
  106. <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;">
  107. ', $txt['attachment_manager_avatars_older'], ' <input type="text" name="age" value="45" size="4" class="input_text" /> ', $txt['days_word'], '<br />
  108. <input type="submit" name="remove" value="', $txt['remove'], '" class="button_submit" />
  109. <input type="hidden" name="type" value="avatars" />
  110. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  111. <input type="hidden" name="sa" value="byAge" />
  112. </form>
  113. </div>
  114. </div>
  115. </div>';
  116. }
  117. function template_attachment_repair()
  118. {
  119. global $context, $txt, $scripturl, $settings;
  120. // If we've completed just let them know!
  121. if ($context['completed'])
  122. {
  123. echo '
  124. <div id="manage_attachments">
  125. <div class="cat_bar">
  126. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  127. </div>
  128. <div class="windowbg">
  129. <div class="content">
  130. ', $txt['repair_attachments_complete_desc'], '
  131. </div>
  132. </div>
  133. </div>
  134. <br class="clear" />';
  135. }
  136. // What about if no errors were even found?
  137. elseif (!$context['errors_found'])
  138. {
  139. echo '
  140. <div id="manage_attachments">
  141. <div class="cat_bar">
  142. <h3 class="catbg">', $txt['repair_attachments_complete'], '</h3>
  143. </div>
  144. <div class="windowbg">
  145. <div class="content">
  146. ', $txt['repair_attachments_no_errors'], '
  147. </div>
  148. </div>
  149. </div>
  150. <br class="clear" />';
  151. }
  152. // Otherwise, I'm sad to say, we have a problem!
  153. else
  154. {
  155. echo '
  156. <div id="manage_attachments">
  157. <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'], '">
  158. <div class="cat_bar">
  159. <h3 class="catbg">', $txt['repair_attachments'], '</h3>
  160. </div>
  161. <div class="windowbg">
  162. <div class="content">
  163. <p>', $txt['repair_attachments_error_desc'], '</p>';
  164. // Loop through each error reporting the status
  165. foreach ($context['repair_errors'] as $error => $number)
  166. {
  167. if (!empty($number))
  168. echo '
  169. <input type="checkbox" name="to_fix[]" id="', $error, '" value="', $error, '" class="input_check" />
  170. <label for="', $error, '">', sprintf($txt['attach_repair_' . $error], $number), '</label><br />';
  171. }
  172. echo ' <br />
  173. <input type="submit" value="', $txt['repair_attachments_continue'], '" class="button_submit" />
  174. <input type="submit" name="cancel" value="', $txt['repair_attachments_cancel'], '" class="button_submit" />
  175. </div>
  176. </div>
  177. </form>
  178. </div>
  179. <br class="clear" />';
  180. }
  181. }
  182. function template_attachment_paths()
  183. {
  184. global $modSettings;
  185. if (!empty($modSettings['attachment_basedirectories']))
  186. {
  187. template_show_list('base_paths');
  188. }
  189. template_show_list('attach_paths');
  190. }