SendTopic.template.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines http://www.simplemachines.org
  7. * @copyright 2014 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. //------------------------------------------------------------------------------
  13. /* This template contains two humble sub templates - main. Its job is pretty
  14. simple: it collects the information we need to actually send the topic.
  15. The report sub template gets shown from:
  16. '?action=reporttm;topic=##.##;msg=##'
  17. It should submit to:
  18. '?action=reporttm;topic=' . $context['current_topic'] . '.' . $context['start']
  19. It only needs to send the following fields:
  20. comment: an additional comment to give the moderator.
  21. sc: the session id, or $context['session_id'].
  22. */
  23. // Send an email to a user!
  24. function template_custom_email()
  25. {
  26. global $context, $txt, $scripturl;
  27. echo '
  28. <div id="send_topic">
  29. <form action="', $scripturl, '?action=emailuser;sa=email" method="post" accept-charset="', $context['character_set'], '">
  30. <div class="cat_bar">
  31. <h3 class="catbg">
  32. <span class="generic_icons mail icon"></span>', $context['page_title'], '
  33. </h3>
  34. </div>
  35. <div class="windowbg">
  36. <div class="content">
  37. <dl class="settings send_mail">
  38. <dt>
  39. <strong>', $txt['sendtopic_receiver_name'], ':</strong>
  40. </dt>
  41. <dd>
  42. ', $context['recipient']['link'], '
  43. </dd>';
  44. // Can the user see the persons email?
  45. if ($context['can_view_receipient_email'])
  46. echo '
  47. <dt>
  48. <strong>', $txt['sendtopic_receiver_email'], ':</strong>
  49. </dt>
  50. <dd>
  51. ', $context['recipient']['email_link'], '
  52. </dd>
  53. </dl>
  54. <hr>
  55. <dl class="settings send_mail">';
  56. // If it's a guest we need their details.
  57. if ($context['user']['is_guest'])
  58. echo '
  59. <dt>
  60. <label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
  61. </dt>
  62. <dd>
  63. <input type="text" id="y_name" name="y_name" size="24" maxlength="40" value="', $context['user']['name'], '" class="input_text">
  64. </dd>
  65. <dt>
  66. <label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label><br>
  67. <span class="smalltext">', $txt['send_email_disclosed'], '</span>
  68. </dt>
  69. <dd>
  70. <input type="email" id="y_mail" name="y_email" size="24" maxlength="50" value="', $context['user']['email'], '" class="input_text" required>
  71. </dt>';
  72. // Otherwise show the user that we know their email.
  73. else
  74. echo '
  75. <dt>
  76. <strong>', $txt['sendtopic_sender_email'], ':</strong><br>
  77. <span class="smalltext">', $txt['send_email_disclosed'], '</span>
  78. </dt>
  79. <dd>
  80. <em>', $context['user']['email'], '</em>
  81. </dd>';
  82. echo '
  83. <dt>
  84. <label for="email_subject"><strong>', $txt['send_email_subject'], ':</strong></label>
  85. </dt>
  86. <dd>
  87. <input type="text" id="email_subject" name="email_subject" size="50" maxlength="100" class="input_text" required>
  88. </dd>
  89. <dt>
  90. <label for="email_body"><strong>', $txt['message'], ':</strong></label>
  91. </dt>
  92. <dd>
  93. <textarea id="email_body" name="email_body" rows="10" cols="20" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 90%; min-width: 90%' : 'width: 90%') . ';" required></textarea>
  94. </dd>
  95. </dl>
  96. <hr class="hrcolor">
  97. <div class="flow_auto">
  98. <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit">
  99. </div>
  100. </div>
  101. </div>';
  102. foreach ($context['form_hidden_vars'] as $key => $value)
  103. echo '
  104. <input type="hidden" name="', $key, '" value="', $value, '">';
  105. echo '
  106. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  107. </form>
  108. </div>';
  109. }
  110. function template_report()
  111. {
  112. global $context, $txt, $scripturl;
  113. // Want to see your master piece?
  114. echo '
  115. <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
  116. <div class="cat_bar">
  117. <h3 class="catbg">
  118. <span>', $txt['preview'], '</span>
  119. </h3>
  120. </div>
  121. <div class="windowbg">
  122. <div class="content">
  123. <div class="post" id="preview_body">
  124. ', empty($context['preview_message']) ? '<br>' : $context['preview_message'], '
  125. </div>
  126. </div>
  127. </div>
  128. </div><br>';
  129. echo '
  130. <div id="report_topic">
  131. <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  132. <input type="hidden" name="msg" value="' . $context['message_id'] . '">
  133. <div class="cat_bar">
  134. <h3 class="catbg">', $txt['report_to_mod'], '</h3>
  135. </div>
  136. <div class="windowbg">
  137. <div class="content">';
  138. if (!empty($context['post_errors']))
  139. {
  140. echo '
  141. <div id="error_box" class="errorbox">
  142. <ul id="error_list">';
  143. foreach ($context['post_errors'] as $key => $error)
  144. echo '
  145. <li id="error_', $key, '" class="error">', $error, '</li>';
  146. echo '
  147. </ul>';
  148. }
  149. else
  150. echo '
  151. <div style="display:none" id="error_box" class="errorbox">';
  152. echo '
  153. </div>';
  154. echo '
  155. <p class="noticebox">', $txt['report_to_mod_func'], '</p>
  156. <br>
  157. <dl class="settings" id="report_post">';
  158. echo '
  159. <dt>
  160. <label for="report_comment">', $txt['enter_comment'], '</label>:
  161. </dt>
  162. <dd>
  163. <textarea type="text" id="report_comment" name="comment" rows="5">', $context['comment_body'], '</textarea>
  164. </dd>';
  165. echo '
  166. </dl>
  167. <div class="flow_auto">
  168. <input type="submit" name="preview" value="', $txt['preview'] , '" class="button_submit">
  169. <input type="submit" name="save" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit">
  170. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  171. </div>
  172. </div>
  173. </div>
  174. </form>
  175. </div>';
  176. }
  177. ?>