2
0

SendTopic.template.php 9.0 KB

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