SendTopic.template.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2013 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 main sub template gets shown from:
  16. '?action=emailuser;sa=sendtopic;topic=##.##'
  17. And should submit to:
  18. '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.' . $context['start']
  19. It should send the following fields:
  20. y_name: sender's name.
  21. y_email: sender's email.
  22. comment: any additional comment.
  23. r_name: receiver's name.
  24. r_email: receiver's email address.
  25. send: this just needs to be set, as by the submit button.
  26. sc: the session id, or $context['session_id'].
  27. The report sub template gets shown from:
  28. '?action=reporttm;topic=##.##;msg=##'
  29. It should submit to:
  30. '?action=reporttm;topic=' . $context['current_topic'] . '.' . $context['start']
  31. It only needs to send the following fields:
  32. comment: an additional comment to give the moderator.
  33. sc: the session id, or $context['session_id'].
  34. */
  35. // This is where we get information about who they want to send the topic to, etc.
  36. function template_main()
  37. {
  38. global $context, $settings, $options, $txt, $scripturl;
  39. echo '
  40. <div id="send_topic">
  41. <form action="', $scripturl, '?action=emailuser;sa=sendtopic;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  42. <div class="cat_bar">
  43. <h3 class="catbg">
  44. <img src="', $settings['images_url'], '/email_sm.png" alt="" class="icon" />', $context['page_title'], '
  45. </h3>
  46. </div>
  47. <div class="windowbg2">
  48. <div class="content">
  49. <fieldset id="sender" class="send_topic">
  50. <dl class="settings send_topic">
  51. <dt>
  52. <label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
  53. </dt>
  54. <dd>
  55. <input type="text" id="y_name" name="y_name" size="30" maxlength="40" value="', $context['user']['name'], '" class="input_text" />
  56. </dd>
  57. <dt>
  58. <label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label>
  59. </dt>
  60. <dd>
  61. <input type="text" id="y_email" name="y_email" size="30" maxlength="50" value="', $context['user']['email'], '" class="input_text" />
  62. </dd>
  63. <dt>
  64. <label for="comment"><strong>', $txt['sendtopic_comment'], ':</strong></label>
  65. </dt>
  66. <dd>
  67. <input type="text" id="comment" name="comment" size="30" maxlength="100" class="input_text" />
  68. </dd>
  69. </dl>
  70. </fieldset>
  71. <fieldset id="recipient" class="send_topic">
  72. <dl class="settings send_topic">
  73. <dt>
  74. <label for="r_name"><strong>', $txt['sendtopic_receiver_name'], ':</strong></label>
  75. </dt>
  76. <dd>
  77. <input type="text" id="r_name" name="r_name" size="30" maxlength="40" class="input_text" />
  78. </dd>
  79. <dt>
  80. <label for="r_email"><strong>', $txt['sendtopic_receiver_email'], ':</strong></label>
  81. </dt>
  82. <dd>
  83. <input type="text" id="r_email" name="r_email" size="30" maxlength="50" class="input_text" />
  84. </dd>
  85. </dl>
  86. </fieldset>
  87. <div class="flow_auto">
  88. <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit" />
  89. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  90. </div>
  91. </div>
  92. </div>
  93. </form>
  94. </div>';
  95. }
  96. // Send an email to a user!
  97. function template_custom_email()
  98. {
  99. global $context, $settings, $options, $txt, $scripturl;
  100. echo '
  101. <div id="send_topic">
  102. <form action="', $scripturl, '?action=emailuser;sa=email" method="post" accept-charset="', $context['character_set'], '">
  103. <div class="cat_bar">
  104. <h3 class="catbg">
  105. <img src="', $settings['images_url'], '/email_sm.png" alt="" class="icon" />', $context['page_title'], '
  106. </h3>
  107. </div>
  108. <div class="windowbg">
  109. <div class="content">
  110. <dl class="settings send_mail">
  111. <dt>
  112. <strong>', $txt['sendtopic_receiver_name'], ':</strong>
  113. </dt>
  114. <dd>
  115. ', $context['recipient']['link'], '
  116. </dd>';
  117. // Can the user see the persons email?
  118. if ($context['can_view_receipient_email'])
  119. echo '
  120. <dt>
  121. <strong>', $txt['sendtopic_receiver_email'], ':</strong>
  122. </dt>
  123. <dd>
  124. ', $context['recipient']['email_link'], '
  125. </dd>
  126. </dl>
  127. <hr />
  128. <dl class="settings send_mail">';
  129. // If it's a guest we need their details.
  130. if ($context['user']['is_guest'])
  131. echo '
  132. <dt>
  133. <label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
  134. </dt>
  135. <dd>
  136. <input type="text" id="y_name" name="y_name" size="24" maxlength="40" value="', $context['user']['name'], '" class="input_text" />
  137. </dd>
  138. <dt>
  139. <label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label><br />
  140. <span class="smalltext">', $txt['send_email_disclosed'], '</span>
  141. </dt>
  142. <dd>
  143. <input type="text" id="y_mail" name="y_email" size="24" maxlength="50" value="', $context['user']['email'], '" class="input_text" />
  144. </dt>';
  145. // Otherwise show the user that we know their email.
  146. else
  147. echo '
  148. <dt>
  149. <strong>', $txt['sendtopic_sender_email'], ':</strong><br />
  150. <span class="smalltext">', $txt['send_email_disclosed'], '</span>
  151. </dt>
  152. <dd>
  153. <em>', $context['user']['email'], '</em>
  154. </dd>';
  155. echo '
  156. <dt>
  157. <label for="email_subject"><strong>', $txt['send_email_subject'], ':</strong></label>
  158. </dt>
  159. <dd>
  160. <input type="text" id="email_subject" name="email_subject" size="50" maxlength="100" class="input_text" />
  161. </dd>
  162. <dt>
  163. <label for="email_body"><strong>', $txt['message'], ':</strong></label>
  164. </dt>
  165. <dd>
  166. <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%') . ';"></textarea>
  167. </dd>
  168. </dl>
  169. <hr class="hrcolor" />
  170. <div class="flow_auto">
  171. <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit" />
  172. </div>
  173. </div>
  174. </div>';
  175. foreach ($context['form_hidden_vars'] as $key => $value)
  176. echo '
  177. <input type="hidden" name="', $key, '" value="', $value, '" />';
  178. echo '
  179. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  180. </form>
  181. </div>';
  182. }
  183. function template_report()
  184. {
  185. global $context, $settings, $options, $txt, $scripturl;
  186. echo '
  187. <div id="report_topic">
  188. <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  189. <input type="hidden" name="msg" value="' . $context['message_id'] . '" />
  190. <div class="cat_bar">
  191. <h3 class="catbg">', $txt['report_to_mod'], '</h3>
  192. </div>
  193. <div class="windowbg">
  194. <div class="content">';
  195. if (!empty($context['post_errors']))
  196. {
  197. echo '
  198. <div id="error_box" class="errorbox">
  199. <ul id="error_list">';
  200. foreach ($context['post_errors'] as $key => $error)
  201. echo '
  202. <li id="error_', $key, '" class="error">', $error, '</li>';
  203. echo '
  204. </ul>';
  205. }
  206. else
  207. echo '
  208. <div style="display:none" id="error_box" class="errorbox">';
  209. echo '
  210. </div>';
  211. echo '
  212. <p class="noticebox">', $txt['report_to_mod_func'], '</p>
  213. <br />
  214. <dl class="settings" id="report_post">';
  215. if ($context['user']['is_guest'])
  216. {
  217. echo '
  218. <dt>
  219. <label for="email_address">', $txt['email'], '</label>:
  220. </dt>
  221. <dd>
  222. <input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" />
  223. </dd>';
  224. }
  225. echo '
  226. <dt>
  227. <label for="report_comment">', $txt['enter_comment'], '</label>:
  228. </dt>
  229. <dd>
  230. <textarea type="text" id="report_comment" name="comment" rows="5">', $context['comment_body'], '</textarea>
  231. </dd>';
  232. if ($context['require_verification'])
  233. {
  234. echo '
  235. <dt>
  236. ', $txt['verification'], ':
  237. </dt>
  238. <dd>
  239. ', template_control_verification($context['visual_verification_id'], 'all'), '
  240. </dd>';
  241. }
  242. echo '
  243. </dl>
  244. <div class="flow_auto">
  245. <input type="submit" name="save" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit" />
  246. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  247. </div>
  248. </div>
  249. </div>
  250. </form>
  251. </div>';
  252. }
  253. ?>