SendTopic.template.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. //------------------------------------------------------------------------------
  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="righttext">
  88. <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit" />
  89. </div>
  90. </div>
  91. </div>
  92. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  93. </form>
  94. </div>
  95. <br class="clear" />';
  96. }
  97. // Send an email to a user!
  98. function template_custom_email()
  99. {
  100. global $context, $settings, $options, $txt, $scripturl;
  101. echo '
  102. <div id="send_topic">
  103. <form action="', $scripturl, '?action=emailuser;sa=email" method="post" accept-charset="', $context['character_set'], '">
  104. <div class="cat_bar">
  105. <h3 class="catbg">
  106. <img src="', $settings['images_url'], '/email_sm.png" alt="" class="icon" />', $context['page_title'], '
  107. </h3>
  108. </div>
  109. <div class="windowbg">
  110. <div class="content">
  111. <dl class="settings send_mail">
  112. <dt>
  113. <strong>', $txt['sendtopic_receiver_name'], ':</strong>
  114. </dt>
  115. <dd>
  116. ', $context['recipient']['link'], '
  117. </dd>';
  118. // Can the user see the persons email?
  119. if ($context['can_view_receipient_email'])
  120. echo '
  121. <dt>
  122. <strong>', $txt['sendtopic_receiver_email'], ':</strong>
  123. </dt>
  124. <dd>
  125. ', $context['recipient']['email_link'], '
  126. </dd>
  127. </dl>
  128. <hr />
  129. <dl class="settings send_mail">';
  130. // If it's a guest we need their details.
  131. if ($context['user']['is_guest'])
  132. echo '
  133. <dt>
  134. <label for="y_name"><strong>', $txt['sendtopic_sender_name'], ':</strong></label>
  135. </dt>
  136. <dd>
  137. <input type="text" id="y_name" name="y_name" size="24" maxlength="40" value="', $context['user']['name'], '" class="input_text" />
  138. </dd>
  139. <dt>
  140. <label for="y_email"><strong>', $txt['sendtopic_sender_email'], ':</strong></label><br />
  141. <span class="smalltext">', $txt['send_email_disclosed'], '</span>
  142. </dt>
  143. <dd>
  144. <input type="text" id="y_mail" name="y_email" size="24" maxlength="50" value="', $context['user']['email'], '" class="input_text" />
  145. </dt>';
  146. // Otherwise show the user that we know their email.
  147. else
  148. echo '
  149. <dt>
  150. <strong>', $txt['sendtopic_sender_email'], ':</strong><br />
  151. <span class="smalltext">', $txt['send_email_disclosed'], '</span>
  152. </dt>
  153. <dd>
  154. <em>', $context['user']['email'], '</em>
  155. </dd>';
  156. echo '
  157. <dt>
  158. <label for="email_subject"><strong>', $txt['send_email_subject'], ':</strong></label>
  159. </dt>
  160. <dd>
  161. <input type="text" id="email_subject" name="email_subject" size="50" maxlength="100" class="input_text" />
  162. </dd>
  163. <dt>
  164. <label for="email_body"><strong>', $txt['message'], ':</strong></label>
  165. </dt>
  166. <dd>
  167. <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>
  168. </dd>
  169. </dl>
  170. <hr class="hrcolor" />
  171. <input type="submit" name="send" value="', $txt['sendtopic_send'], '" class="button_submit" />
  172. <br class="clear_right" />
  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. <br class="clear" />';
  183. }
  184. function template_report()
  185. {
  186. global $context, $settings, $options, $txt, $scripturl;
  187. echo '
  188. <div id="report_topic">
  189. <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  190. <input type="hidden" name="msg" value="' . $context['message_id'] . '" />
  191. <div class="cat_bar">
  192. <h3 class="catbg">', $txt['report_to_mod'], '</h3>
  193. </div>
  194. <div class="windowbg">
  195. <div class="content">';
  196. if (!empty($context['post_errors']))
  197. {
  198. echo '
  199. <div class="errorbox">
  200. <ul>';
  201. foreach ($context['post_errors'] as $error)
  202. echo '
  203. <li class="error">', $error, '</li>';
  204. echo '
  205. </ul>
  206. </div>';
  207. }
  208. echo '
  209. <p>', $txt['report_to_mod_func'], '</p>
  210. <br />
  211. <dl class="settings" id="report_post">';
  212. if ($context['user']['is_guest'])
  213. {
  214. echo '
  215. <dt>
  216. <label for="email_address">', $txt['email'], '</label>:
  217. </dt>
  218. <dd>
  219. <input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" />
  220. </dd>';
  221. }
  222. echo '
  223. <dt>
  224. <label for="report_comment">', $txt['enter_comment'], '</label>:
  225. </dt>
  226. <dd>
  227. <input type="text" id="report_comment" name="comment" size="50" value="', $context['comment_body'], '" maxlength="255" />
  228. </dd>';
  229. if ($context['require_verification'])
  230. {
  231. echo '
  232. <dt>
  233. ', $txt['verification'], ':
  234. </dt>
  235. <dd>
  236. ', template_control_verification($context['visual_verification_id'], 'all'), '
  237. </dd>';
  238. }
  239. echo '
  240. </dl>
  241. <div class="righttext">
  242. <input type="submit" name="save" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit" />
  243. </div>
  244. </div>
  245. <br class="clear" />
  246. </div>
  247. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  248. </form>
  249. </div>';
  250. }
  251. ?>