SendTopic.template.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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 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, $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="generic_icons mail icon"></span>', $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, $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. <span class="generic_icons mail icon"></span>', $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, $txt, $scripturl;
  186. // Want to see your master piece?
  187. echo '
  188. <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
  189. <div class="cat_bar">
  190. <h3 class="catbg">
  191. <span>', $txt['preview'], '</span>
  192. </h3>
  193. </div>
  194. <div class="windowbg">
  195. <div class="content">
  196. <div class="post" id="preview_body">
  197. ', empty($context['preview_message']) ? '<br>' : $context['preview_message'], '
  198. </div>
  199. </div>
  200. </div>
  201. </div><br>';
  202. echo '
  203. <div id="report_topic">
  204. <form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="', $context['character_set'], '">
  205. <input type="hidden" name="msg" value="' . $context['message_id'] . '">
  206. <div class="cat_bar">
  207. <h3 class="catbg">', $txt['report_to_mod'], '</h3>
  208. </div>
  209. <div class="windowbg">
  210. <div class="content">';
  211. if (!empty($context['post_errors']))
  212. {
  213. echo '
  214. <div id="error_box" class="errorbox">
  215. <ul id="error_list">';
  216. foreach ($context['post_errors'] as $key => $error)
  217. echo '
  218. <li id="error_', $key, '" class="error">', $error, '</li>';
  219. echo '
  220. </ul>';
  221. }
  222. else
  223. echo '
  224. <div style="display:none" id="error_box" class="errorbox">';
  225. echo '
  226. </div>';
  227. echo '
  228. <p class="noticebox">', $txt['report_to_mod_func'], '</p>
  229. <br>
  230. <dl class="settings" id="report_post">';
  231. echo '
  232. <dt>
  233. <label for="report_comment">', $txt['enter_comment'], '</label>:
  234. </dt>
  235. <dd>
  236. <textarea type="text" id="report_comment" name="comment" rows="5">', $context['comment_body'], '</textarea>
  237. </dd>';
  238. echo '
  239. </dl>
  240. <div class="flow_auto">
  241. <input type="submit" name="preview" value="', $txt['preview'] , '" class="button_submit">
  242. <input type="submit" name="save" value="', $txt['rtm10'], '" style="margin-left: 1ex;" class="button_submit">
  243. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  244. </div>
  245. </div>
  246. </div>
  247. </form>
  248. </div>';
  249. }
  250. ?>