|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @package ElkArte Forum |
|
5
|
|
|
* @copyright ElkArte Forum contributors |
|
6
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file) |
|
7
|
|
|
* |
|
8
|
|
|
* This file contains code covered by: |
|
9
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
|
10
|
|
|
* |
|
11
|
|
|
* @version 2.0 dev |
|
12
|
|
|
* |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* The report subtemplate needs some error stuff |
|
17
|
|
|
*/ |
|
18
|
|
|
function template_Emailuser_init() |
|
19
|
|
|
{ |
|
20
|
|
|
global $context, $txt; |
|
21
|
|
|
|
|
22
|
|
|
if (!empty($context['sub_template']) && $context['sub_template'] == 'report') |
|
23
|
|
|
{ |
|
24
|
|
|
theme()->addInlineJavascript(' |
|
25
|
|
|
error_txts[\'post_too_long\'] = ' . JavaScriptEscape($txt['error_post_too_long']) . '; |
|
26
|
|
|
|
|
27
|
|
|
var report_errors = new errorbox_handler({ |
|
28
|
|
|
self: \'report_errors\', |
|
29
|
|
|
error_box_id: \'report_error\', |
|
30
|
|
|
error_checks: [{ |
|
31
|
|
|
code: \'post_too_long\', |
|
32
|
|
|
efunction: function(box_value) { |
|
33
|
|
|
if (box_value.length > 254) |
|
34
|
|
|
return true; |
|
35
|
|
|
else |
|
36
|
|
|
return false; |
|
37
|
|
|
} |
|
38
|
|
|
}], |
|
39
|
|
|
check_id: "report_comment" |
|
40
|
|
|
});', true); |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* This is where we get information about who they want to send the topic to, etc. |
|
46
|
|
|
* |
|
47
|
|
|
* The template gets shown from: |
|
48
|
|
|
* '?action=emailuser;sa=sendtopic;topic=##.##' |
|
49
|
|
|
* And should submit to: |
|
50
|
|
|
* '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.' . $context['start'] |
|
51
|
|
|
* |
|
52
|
|
|
* It should send the following fields: |
|
53
|
|
|
* y_name: sender's name. |
|
54
|
|
|
* y_email: sender's email. |
|
55
|
|
|
* comment: any additional comment. |
|
56
|
|
|
* r_name: receiver's name. |
|
57
|
|
|
* r_email: receiver's email address. |
|
58
|
|
|
* send: this just needs to be set, as by the submit button. |
|
59
|
|
|
* sc: the session id, or $context['session_id']. |
|
60
|
|
|
*/ |
|
61
|
|
|
function template_send_topic() |
|
62
|
|
|
{ |
|
63
|
|
|
global $context, $txt, $scripturl; |
|
64
|
|
|
|
|
65
|
|
|
template_show_error('sendtopic_error'); |
|
66
|
|
|
|
|
67
|
|
|
echo ' |
|
68
|
|
|
<div id="send_topic"> |
|
69
|
|
|
<form action="', $scripturl, '?action=emailuser;sa=sendtopic;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="UTF-8"> |
|
70
|
|
|
<h2 class="category_header hdicon cat_img_mail"> |
|
71
|
|
|
', $context['page_title'], ' |
|
72
|
|
|
</h2> |
|
73
|
|
|
<div class="content"> |
|
74
|
|
|
<fieldset id="sender" class="send_topic"> |
|
75
|
|
|
<dl class="settings send_topic"> |
|
76
|
|
|
<dt> |
|
77
|
|
|
<label for="y_name">', $txt['sendtopic_sender_name'], ':</label> |
|
78
|
|
|
</dt> |
|
79
|
|
|
<dd class="y_name"> |
|
80
|
|
|
<input required="required" type="text" id="y_name" name="y_name" size="30" maxlength="40" value="', $context['user']['name'], '" class="input_text" /> |
|
81
|
|
|
</dd> |
|
82
|
|
|
<dt> |
|
83
|
|
|
<label for="y_email">', $txt['sendtopic_sender_email'], ':</label> |
|
84
|
|
|
</dt> |
|
85
|
|
|
<dd class="y_email"> |
|
86
|
|
|
<input required="required" type="text" id="y_email" name="y_email" size="30" maxlength="50" value="', $context['user']['email'], '" class="input_text" /> |
|
87
|
|
|
</dd> |
|
88
|
|
|
<dt> |
|
89
|
|
|
<label for="comment">', $txt['sendtopic_comment'], ':</label> |
|
90
|
|
|
</dt> |
|
91
|
|
|
<dd class="comment"> |
|
92
|
|
|
<input type="text" id="comment" name="comment" size="30" maxlength="100" class="input_text" /> |
|
93
|
|
|
</dd> |
|
94
|
|
|
</dl> |
|
95
|
|
|
</fieldset> |
|
96
|
|
|
<fieldset id="recipient" class="send_topic"> |
|
97
|
|
|
<dl class="settings send_topic"> |
|
98
|
|
|
<dt> |
|
99
|
|
|
<label for="r_name">', $txt['sendtopic_receiver_name'], ':</label> |
|
100
|
|
|
</dt> |
|
101
|
|
|
<dd class="r_name"> |
|
102
|
|
|
<input required="required" type="text" id="r_name" name="r_name" size="30" maxlength="40" class="input_text" /> |
|
103
|
|
|
</dd> |
|
104
|
|
|
<dt> |
|
105
|
|
|
<label for="r_email">', $txt['sendtopic_receiver_email'], ':</label> |
|
106
|
|
|
</dt> |
|
107
|
|
|
<dd class="r_email"> |
|
108
|
|
|
<input required="required" type="text" id="r_email" name="r_email" size="30" maxlength="50" class="input_text" /> |
|
109
|
|
|
</dd> |
|
110
|
|
|
</dl> |
|
111
|
|
|
</fieldset> |
|
112
|
|
|
<div class="submitbutton"> |
|
113
|
|
|
<input type="submit" name="send" value="', $txt['sendtopic_send'], '" /> |
|
114
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
115
|
|
|
</div> |
|
116
|
|
|
</div> |
|
117
|
|
|
</form> |
|
118
|
|
|
</div>'; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Send an email to a user! |
|
123
|
|
|
*/ |
|
124
|
|
|
function template_custom_email() |
|
125
|
|
|
{ |
|
126
|
|
|
global $context, $txt, $scripturl; |
|
127
|
|
|
|
|
128
|
|
|
template_show_error('sendemail_error'); |
|
129
|
|
|
|
|
130
|
|
|
echo ' |
|
131
|
|
|
<div id="send_topic"> |
|
132
|
|
|
<form action="', $scripturl, '?action=emailuser;sa=email" method="post" accept-charset="UTF-8"> |
|
133
|
|
|
<h2 class="category_header hdicon cat_img_mail"> |
|
134
|
|
|
', $context['page_title'], ' |
|
135
|
|
|
</h2> |
|
136
|
|
|
<div class="content"> |
|
137
|
|
|
<dl class="settings send_mail"> |
|
138
|
|
|
<dt> |
|
139
|
|
|
<strong>', $txt['sendtopic_receiver_name'], ':</strong> |
|
140
|
|
|
</dt> |
|
141
|
|
|
<dd> |
|
142
|
|
|
', $context['recipient']['link'], ' |
|
143
|
|
|
</dd>'; |
|
144
|
|
|
|
|
145
|
|
|
// Can the user see the persons email? |
|
146
|
|
|
if ($context['can_view_recipient_email']) |
|
147
|
|
|
{ |
|
148
|
|
|
echo ' |
|
149
|
|
|
<dt> |
|
150
|
|
|
<strong>', $txt['sendtopic_receiver_email'], ':</strong> |
|
151
|
|
|
</dt> |
|
152
|
|
|
<dd> |
|
153
|
|
|
', $context['recipient']['email_link'], ' |
|
154
|
|
|
</dd> |
|
155
|
|
|
</dl> |
|
156
|
|
|
<hr /> |
|
157
|
|
|
<dl class="settings send_mail">'; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
// If it's a guest we need their details. |
|
161
|
|
|
if ($context['user']['is_guest']) |
|
162
|
|
|
{ |
|
163
|
|
|
echo ' |
|
164
|
|
|
<dt> |
|
165
|
|
|
<label for="y_name">', $txt['sendtopic_sender_name'], ':</label> |
|
166
|
|
|
</dt> |
|
167
|
|
|
<dd> |
|
168
|
|
|
<input type="text" id="y_name" name="y_name" size="24" maxlength="40" value="', $context['user']['name'], '" class="input_text" /> |
|
169
|
|
|
</dd> |
|
170
|
|
|
<dt> |
|
171
|
|
|
<label for="y_email">', $txt['sendtopic_sender_email'], ':</label><br /> |
|
172
|
|
|
<span class="smalltext">', $txt['send_email_disclosed'], '</span> |
|
173
|
|
|
</dt> |
|
174
|
|
|
<dd> |
|
175
|
|
|
<input type="text" id="y_mail" name="y_email" size="24" maxlength="50" value="', $context['user']['email'], '" class="input_text" /> |
|
176
|
|
|
</dt>'; |
|
177
|
|
|
} |
|
178
|
|
|
// Otherwise show the user that we know their email. |
|
179
|
|
|
else |
|
180
|
|
|
{ |
|
181
|
|
|
echo ' |
|
182
|
|
|
<dt> |
|
183
|
|
|
<strong>', $txt['sendtopic_sender_email'], ':</strong><br /> |
|
184
|
|
|
<span class="smalltext">', $txt['send_email_disclosed'], '</span> |
|
185
|
|
|
</dt> |
|
186
|
|
|
<dd> |
|
187
|
|
|
<em>', $context['user']['email'], '</em> |
|
188
|
|
|
</dd>'; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
echo ' |
|
192
|
|
|
<dt> |
|
193
|
|
|
<label for="email_subject">', $txt['send_email_subject'], ':</label> |
|
194
|
|
|
</dt> |
|
195
|
|
|
<dd> |
|
196
|
|
|
<input type="text" id="email_subject" name="email_subject" size="50" maxlength="100" class="input_text" /> |
|
197
|
|
|
</dd> |
|
198
|
|
|
<dt> |
|
199
|
|
|
<label for="email_body">', $txt['message'], ':</label> |
|
200
|
|
|
</dt> |
|
201
|
|
|
<dd> |
|
202
|
|
|
<textarea id="email_body" name="email_body" rows="10" cols="20"></textarea> |
|
203
|
|
|
</dd> |
|
204
|
|
|
</dl> |
|
205
|
|
|
<hr /> |
|
206
|
|
|
<div class="submitbutton"> |
|
207
|
|
|
<input type="submit" name="send" value="', $txt['sendtopic_send'], '" />'; |
|
208
|
|
|
|
|
209
|
|
|
|
|
210
|
|
|
foreach ($context['form_hidden_vars'] as $key => $value) |
|
211
|
|
|
{ |
|
212
|
|
|
echo ' |
|
213
|
|
|
<input type="hidden" name="', $key, '" value="', $value, '" />'; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
echo ' |
|
217
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
218
|
|
|
</div> |
|
219
|
|
|
</div> |
|
220
|
|
|
</form> |
|
221
|
|
|
</div>'; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
/** |
|
225
|
|
|
* The report sub template gets shown from: |
|
226
|
|
|
* '?action=reporttm;topic=##.##;msg=##' |
|
227
|
|
|
* It should submit to: |
|
228
|
|
|
* '?action=reporttm;topic=' . $context['current_topic'] . '.' . $context['start'] |
|
229
|
|
|
* |
|
230
|
|
|
* It only needs to send the following fields: |
|
231
|
|
|
* comment: an additional comment to give the moderator. |
|
232
|
|
|
* sc: the session id, or $context['session_id']. |
|
233
|
|
|
*/ |
|
234
|
|
|
function template_report() |
|
235
|
|
|
{ |
|
236
|
|
|
global $context, $txt, $scripturl; |
|
237
|
|
|
|
|
238
|
|
|
echo ' |
|
239
|
|
|
<div id="report_topic"> |
|
240
|
|
|
<form action="', $scripturl, '?action=reporttm;topic=', $context['current_topic'], '.', $context['start'], '" method="post" accept-charset="UTF-8"> |
|
241
|
|
|
<h2 class="category_header">', $txt['report_to_mod'], '</h2> |
|
242
|
|
|
<div class="content">'; |
|
243
|
|
|
|
|
244
|
|
|
template_show_error('report_error'); |
|
245
|
|
|
|
|
246
|
|
|
echo ' |
|
247
|
|
|
<p class="warningbox">', $txt['report_to_mod_func'], '</p> |
|
248
|
|
|
<br /> |
|
249
|
|
|
<dl class="settings" id="report_post">'; |
|
250
|
|
|
|
|
251
|
|
|
if ($context['user']['is_guest']) |
|
252
|
|
|
{ |
|
253
|
|
|
echo ' |
|
254
|
|
|
<dt> |
|
255
|
|
|
<label for="email_address">', $txt['email'], '</label>: |
|
256
|
|
|
</dt> |
|
257
|
|
|
<dd> |
|
258
|
|
|
<input type="text" id="email_address" name="email" value="', $context['email_address'], '" size="25" maxlength="255" /> |
|
259
|
|
|
</dd>'; |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
echo ' |
|
263
|
|
|
<dt> |
|
264
|
|
|
<label for="report_comment">', $txt['enter_comment'], '</label>: |
|
265
|
|
|
</dt> |
|
266
|
|
|
<dd> |
|
267
|
|
|
<textarea id="report_comment" name="comment">', $context['comment_body'], '</textarea> |
|
268
|
|
|
</dd>'; |
|
269
|
|
|
|
|
270
|
|
|
if (!empty($context['require_verification'])) |
|
271
|
|
|
{ |
|
272
|
|
|
template_verification_controls($context['visual_verification_id'], ' |
|
273
|
|
|
<dt> |
|
274
|
|
|
' . $txt['verification'] . ': |
|
275
|
|
|
</dt> |
|
276
|
|
|
<dd> |
|
277
|
|
|
', ' |
|
278
|
|
|
</dd>'); |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
echo ' |
|
282
|
|
|
</dl> |
|
283
|
|
|
<div class="submitbutton"> |
|
284
|
|
|
<input type="hidden" name="msg" value="' . $context['message_id'] . '" /> |
|
285
|
|
|
<input type="submit" name="save" value="', $txt['rtm10'], '" /> |
|
286
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
|
287
|
|
|
</div> |
|
288
|
|
|
</div> |
|
289
|
|
|
</form> |
|
290
|
|
|
</div>'; |
|
291
|
|
|
} |
|
292
|
|
|
|