SendTopic.template.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. echo '
  114. <div id="report_topic">
  115. <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  116. <input type="hidden" name="msg" value="' . $context['message_id'] . '">
  117. <div class="cat_bar">
  118. <h3 class="catbg">', $txt['report_to_mod'], '</h3>
  119. </div>
  120. <div class="windowbg">
  121. <div class="content">';
  122. if (!empty($context['post_errors']))
  123. {
  124. echo '
  125. <div id="error_box" class="errorbox">
  126. <ul id="error_list">';
  127. foreach ($context['post_errors'] as $key => $error)
  128. echo '
  129. <li id="error_', $key, '" class="error">', $error, '</li>';
  130. echo '
  131. </ul>';
  132. }
  133. else
  134. echo '
  135. <div style="display:none" id="error_box" class="errorbox">';
  136. echo '
  137. </div>';
  138. echo '
  139. <p class="noticebox">', $txt['report_to_mod_func'], '</p>
  140. <br>
  141. <dl class="settings" id="report_post">';
  142. echo '
  143. <dt>
  144. <label for="report_comment">', $txt['enter_comment'], '</label>:
  145. </dt>
  146. <dd>
  147. <textarea type="text" id="report_comment" name="comment" rows="5">', $context['comment_body'], '</textarea>
  148. </dd>';
  149. echo '
  150. </dl>
  151. <div class="flow_auto">
  152. <input type="submit" name="save" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit">
  153. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  154. </div>
  155. </div>
  156. </div>
  157. </form>
  158. </div>';
  159. }
  160. ?>