1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Simple Machines Forum (SMF) |
4
|
|
|
* |
5
|
|
|
* @package SMF |
6
|
|
|
* @author Simple Machines http://www.simplemachines.org |
7
|
|
|
* @copyright 2017 Simple Machines and individual contributors |
8
|
|
|
* @license http://www.simplemachines.org/about/smf/license.php BSD |
9
|
|
|
* |
10
|
|
|
* @version 2.1 Beta 3 |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* This is for stuff above the menu in the personal messages section |
15
|
|
|
*/ |
16
|
|
|
function template_pm_above() |
17
|
|
|
{ |
18
|
|
|
global $context, $txt; |
19
|
|
|
|
20
|
|
|
echo ' |
21
|
|
|
<div id="personal_messages">'; |
22
|
|
|
|
23
|
|
|
// Show the capacity bar, if available. |
24
|
|
|
if (!empty($context['limit_bar'])) |
25
|
|
|
echo ' |
26
|
|
|
<div class="cat_bar"> |
27
|
|
|
<h3 class="catbg"> |
28
|
|
|
<span class="floatleft">', $txt['pm_capacity'], ':</span> |
29
|
|
|
<span class="floatleft capacity_bar"> |
30
|
|
|
<span class="', $context['limit_bar']['percent'] > 85 ? 'full' : ($context['limit_bar']['percent'] > 40 ? 'filled' : 'empty'), '" style="width: ', $context['limit_bar']['percent'] / 10, 'em;"></span> |
31
|
|
|
</span> |
32
|
|
|
<span class="floatright', $context['limit_bar']['percent'] > 90 ? ' alert' : '', '">', $context['limit_bar']['text'], '</span> |
33
|
|
|
</h3> |
34
|
|
|
</div>'; |
35
|
|
|
|
36
|
|
|
// Message sent? Show a small indication. |
37
|
|
|
if (isset($context['pm_sent'])) |
38
|
|
|
echo ' |
39
|
|
|
<div class="infobox"> |
40
|
|
|
', $txt['pm_sent'], ' |
41
|
|
|
</div>'; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Just the end of the index bar, nothing special. |
46
|
|
|
*/ |
47
|
|
|
function template_pm_below() |
48
|
|
|
{ |
49
|
|
|
echo ' |
50
|
|
|
</div>'; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
function template_pm_popup() |
54
|
|
|
{ |
55
|
|
|
global $context, $txt, $scripturl; |
56
|
|
|
|
57
|
|
|
// Unlike almost every other template, this is designed to be included into the HTML directly via $().load() |
58
|
|
|
echo ' |
59
|
|
|
<div class="pm_bar"> |
60
|
|
|
<div class="pm_sending block"> |
61
|
|
|
', $context['can_send_pm'] ? '<a href="' . $scripturl . '?action=pm;sa=send">' . $txt['pm_new_short'] . '</a> | ' : '', ' |
62
|
|
|
', $context['can_draft'] ? '<a href="' . $scripturl . '?action=pm;sa=showpmdrafts">' . $txt['pm_drafts_short'] . '</a>' : '', ' |
63
|
|
|
<a href="', $scripturl, '?action=pm;sa=settings" class="floatright">', $txt['pm_settings_short'], '</a> |
64
|
|
|
</div> |
65
|
|
|
<div class="pm_mailbox centertext"> |
66
|
|
|
<a href="', $scripturl, '?action=pm" class="button">', $txt['inbox'], '</a> |
67
|
|
|
</div> |
68
|
|
|
</div> |
69
|
|
|
<div class="pm_unread">'; |
70
|
|
|
|
71
|
|
|
if (empty($context['unread_pms'])) |
72
|
|
|
{ |
73
|
|
|
echo ' |
74
|
|
|
<div class="no_unread">', $txt['pm_no_unread'], '</div>'; |
75
|
|
|
} |
76
|
|
|
else |
77
|
|
|
{ |
78
|
|
|
foreach ($context['unread_pms'] as $id_pm => $pm_details) |
79
|
|
|
{ |
80
|
|
|
echo ' |
81
|
|
|
<div class="unread"> |
82
|
|
|
', !empty($pm_details['member']) ? $pm_details['member']['avatar']['image'] : '', ' |
83
|
|
|
<div class="details"> |
84
|
|
|
<div class="subject">', $pm_details['pm_link'], '</div> |
85
|
|
|
<div class="sender">', $pm_details['replied_to_you'] ? '<span class="generic_icons replied centericon" style="margin-right: 4px" title="' . $txt['pm_you_were_replied_to'] . '"></span>' : '<span class="generic_icons im_off centericon" style="margin-right: 4px" title="' . $txt['pm_was_sent_to_you'] . '"></span>', |
86
|
|
|
!empty($pm_details['member']) ? $pm_details['member']['link'] : $pm_details['member_from'], ' - ', $pm_details['time'], '</div> |
87
|
|
|
</div> |
88
|
|
|
</div>'; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
echo ' |
93
|
|
|
</div>'; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Shows a particular folder (eg inbox or outbox), all the PMs in it, etc. |
98
|
|
|
*/ |
99
|
|
|
function template_folder() |
100
|
|
|
{ |
101
|
|
|
global $context, $settings, $options, $scripturl, $modSettings, $txt; |
102
|
|
|
|
103
|
|
|
// The every helpful javascript! |
104
|
|
|
echo ' |
105
|
|
|
<script> |
106
|
|
|
var allLabels = {}; |
107
|
|
|
var currentLabels = {}; |
108
|
|
|
function loadLabelChoices() |
109
|
|
|
{ |
110
|
|
|
var listing = document.forms.pmFolder.elements; |
111
|
|
|
var theSelect = document.forms.pmFolder.pm_action; |
112
|
|
|
var add, remove, toAdd = {length: 0}, toRemove = {length: 0}; |
113
|
|
|
|
114
|
|
|
if (theSelect.childNodes.length == 0) |
115
|
|
|
return; |
116
|
|
|
|
117
|
|
|
// This is done this way for internationalization reasons. |
118
|
|
|
if (!(\'-1\' in allLabels)) |
119
|
|
|
{ |
120
|
|
|
for (var o = 0; o < theSelect.options.length; o++) |
121
|
|
|
if (theSelect.options[o].value.substr(0, 4) == "rem_") |
122
|
|
|
allLabels[theSelect.options[o].value.substr(4)] = theSelect.options[o].text; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
for (var i = 0; i < listing.length; i++) |
126
|
|
|
{ |
127
|
|
|
if (listing[i].name != "pms[]" || !listing[i].checked) |
128
|
|
|
continue; |
129
|
|
|
|
130
|
|
|
var alreadyThere = [], x; |
131
|
|
|
for (x in currentLabels[listing[i].value]) |
132
|
|
|
{ |
133
|
|
|
if (!(x in toRemove)) |
134
|
|
|
{ |
135
|
|
|
toRemove[x] = allLabels[x]; |
136
|
|
|
toRemove.length++; |
137
|
|
|
} |
138
|
|
|
alreadyThere[x] = allLabels[x]; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
for (x in allLabels) |
142
|
|
|
{ |
143
|
|
|
if (!(x in alreadyThere)) |
144
|
|
|
{ |
145
|
|
|
toAdd[x] = allLabels[x]; |
146
|
|
|
toAdd.length++; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
while (theSelect.options.length > 2) |
152
|
|
|
theSelect.options[2] = null; |
153
|
|
|
|
154
|
|
|
if (toAdd.length != 0) |
155
|
|
|
{ |
156
|
|
|
theSelect.options[theSelect.options.length] = new Option("', $txt['pm_msg_label_apply'], '", ""); |
157
|
|
|
setInnerHTML(theSelect.options[theSelect.options.length - 1], "', $txt['pm_msg_label_apply'], '"); |
158
|
|
|
theSelect.options[theSelect.options.length - 1].disabled = true; |
159
|
|
|
|
160
|
|
|
for (i in toAdd) |
161
|
|
|
{ |
162
|
|
|
if (i != "length") |
163
|
|
|
theSelect.options[theSelect.options.length] = new Option(toAdd[i], "add_" + i); |
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
if (toRemove.length != 0) |
168
|
|
|
{ |
169
|
|
|
theSelect.options[theSelect.options.length] = new Option("', $txt['pm_msg_label_remove'], '", ""); |
170
|
|
|
setInnerHTML(theSelect.options[theSelect.options.length - 1], "', $txt['pm_msg_label_remove'], '"); |
171
|
|
|
theSelect.options[theSelect.options.length - 1].disabled = true; |
172
|
|
|
|
173
|
|
|
for (i in toRemove) |
174
|
|
|
{ |
175
|
|
|
if (i != "length") |
176
|
|
|
theSelect.options[theSelect.options.length] = new Option(toRemove[i], "rem_" + i); |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
} |
180
|
|
|
</script>'; |
181
|
|
|
|
182
|
|
|
echo ' |
183
|
|
|
<form class="flow_hidden" action="', $scripturl, '?action=pm;sa=pmactions;', $context['display_mode'] == 2 ? 'conversation;' : '', 'f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '" method="post" accept-charset="', $context['character_set'], '" name="pmFolder">'; |
184
|
|
|
|
185
|
|
|
// If we are not in single display mode show the subjects on the top! |
186
|
|
|
if ($context['display_mode'] != 1) |
187
|
|
|
{ |
188
|
|
|
template_subject_list(); |
189
|
|
|
echo '<div class="clear_right"><br></div>'; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
// Got some messages to display? |
193
|
|
|
if ($context['get_pmessage']('message', true)) |
194
|
|
|
{ |
195
|
|
|
// Show the helpful titlebar - generally. |
196
|
|
|
if ($context['display_mode'] != 1) |
197
|
|
|
echo ' |
198
|
|
|
<div class="cat_bar"> |
199
|
|
|
<h3 class="catbg"> |
200
|
|
|
<span id="author">', $txt['author'], '</span> |
201
|
|
|
<span id="topic_title">', $txt[$context['display_mode'] == 0 ? 'messages' : 'conversation'], '</span> |
202
|
|
|
</h3> |
203
|
|
|
</div>'; |
204
|
|
|
|
205
|
|
|
// Show a few buttons if we are in conversation mode and outputting the first message. |
206
|
|
View Code Duplication |
if ($context['display_mode'] == 2) |
|
|
|
|
207
|
|
|
{ |
208
|
|
|
// Show the conversation buttons. |
209
|
|
|
echo ' |
210
|
|
|
<div class="pagesection">'; |
211
|
|
|
|
212
|
|
|
template_button_strip($context['conversation_buttons'], 'right'); |
213
|
|
|
|
214
|
|
|
echo ' |
215
|
|
|
</div>'; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
while ($message = $context['get_pmessage']('message')) |
219
|
|
|
{ |
220
|
|
|
|
221
|
|
|
echo ' |
222
|
|
|
<div class="windowbg"> |
223
|
|
|
<div class="poster">'; |
224
|
|
|
|
225
|
|
|
// Are there any custom fields above the member name? |
226
|
|
View Code Duplication |
if (!empty($message['custom_fields']['above_member'])) |
|
|
|
|
227
|
|
|
{ |
228
|
|
|
echo ' |
229
|
|
|
<div class="custom_fields_above_member"> |
230
|
|
|
<ul class="nolist">'; |
231
|
|
|
|
232
|
|
|
foreach ($message['custom_fields']['above_member'] as $custom) |
233
|
|
|
echo ' |
234
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
235
|
|
|
|
236
|
|
|
echo ' |
237
|
|
|
</ul> |
238
|
|
|
</div>'; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
echo ' |
242
|
|
|
<h4> |
243
|
|
|
<a id="msg', $message['id'], '"></a>'; |
244
|
|
|
|
245
|
|
|
// Show online and offline buttons? |
246
|
|
|
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest']) |
247
|
|
|
echo ' |
248
|
|
|
<span class="' . ($message['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $message['member']['online']['text'] . '"></span>'; |
249
|
|
|
|
250
|
|
|
// Show a link to the member's profile (but only if the sender isn't a guest). |
251
|
|
|
echo ' |
252
|
|
|
', $message['member']['link'], ''; |
253
|
|
|
|
254
|
|
|
echo ' |
255
|
|
|
</h4>'; |
256
|
|
|
|
257
|
|
|
echo ' |
258
|
|
|
<ul class="user_info">'; |
259
|
|
|
|
260
|
|
|
// Show the user's avatar. |
261
|
|
View Code Duplication |
if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image'])) |
|
|
|
|
262
|
|
|
echo ' |
263
|
|
|
<li class="avatar"> |
264
|
|
|
<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], '">', $message['member']['avatar']['image'], '</a> |
265
|
|
|
</li>'; |
266
|
|
|
|
267
|
|
|
// Are there any custom fields below the avatar? |
268
|
|
View Code Duplication |
if (!empty($message['custom_fields']['below_avatar'])) |
|
|
|
|
269
|
|
|
foreach ($message['custom_fields']['below_avatar'] as $custom) |
270
|
|
|
echo ' |
271
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
272
|
|
|
|
273
|
|
|
if (!$message['member']['is_guest']) |
274
|
|
|
echo ' |
275
|
|
|
<li class="icons">', $message['member']['group_icons'], '</li>'; |
276
|
|
|
// Show the member's primary group (like 'Administrator') if they have one. |
277
|
|
View Code Duplication |
if (isset($message['member']['group']) && $message['member']['group'] != '') |
|
|
|
|
278
|
|
|
echo ' |
279
|
|
|
<li class="membergroup">', $message['member']['group'], '</li>'; |
280
|
|
|
|
281
|
|
|
// Show the member's custom title, if they have one. |
282
|
|
View Code Duplication |
if (isset($message['member']['title']) && $message['member']['title'] != '') |
|
|
|
|
283
|
|
|
echo ' |
284
|
|
|
<li class="title">', $message['member']['title'], '</li>'; |
285
|
|
|
|
286
|
|
|
// Don't show these things for guests. |
287
|
|
|
if (!$message['member']['is_guest']) |
288
|
|
|
{ |
289
|
|
|
// Show the post group if and only if they have no other group or the option is on, and they are in a post group. |
290
|
|
|
if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '') |
291
|
|
|
echo ' |
292
|
|
|
<li class="postgroup">', $message['member']['post_group'], '</li>'; |
293
|
|
|
|
294
|
|
|
// Show how many posts they have made. |
295
|
|
View Code Duplication |
if (!isset($context['disabled_fields']['posts'])) |
|
|
|
|
296
|
|
|
echo ' |
297
|
|
|
<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>'; |
298
|
|
|
|
299
|
|
|
// Show their personal text? |
300
|
|
View Code Duplication |
if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '') |
|
|
|
|
301
|
|
|
echo ' |
302
|
|
|
<li class="blurb">', $message['member']['blurb'], '</li>'; |
303
|
|
|
|
304
|
|
|
// Any custom fields to show as icons? |
305
|
|
View Code Duplication |
if (!empty($message['custom_fields']['icons'])) |
|
|
|
|
306
|
|
|
{ |
307
|
|
|
echo ' |
308
|
|
|
<li class="im_icons"> |
309
|
|
|
<ol>'; |
310
|
|
|
|
311
|
|
|
foreach ($message['custom_fields']['icons'] as $custom) |
312
|
|
|
echo ' |
313
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
314
|
|
|
|
315
|
|
|
echo ' |
316
|
|
|
</ol> |
317
|
|
|
</li>'; |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
// Show the IP to this user for this post - because you can moderate? |
321
|
|
|
if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip'])) |
322
|
|
|
echo ' |
323
|
|
|
<li class="poster_ip"><a href="', $scripturl, '?action=', !empty($message['member']['is_guest']) ? 'trackip' : 'profile;area=tracking;sa=ip;u=' . $message['member']['id'], ';searchip=', $message['member']['ip'], '">', $message['member']['ip'], '</a> <a href="', $scripturl, '?action=helpadmin;help=see_admin_ip" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></li>'; |
324
|
|
|
|
325
|
|
|
// Or, should we show it because this is you? |
326
|
|
|
elseif ($message['can_see_ip']) |
327
|
|
|
echo ' |
328
|
|
|
<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $message['member']['ip'], '</a></li>'; |
329
|
|
|
|
330
|
|
|
// Okay, you are logged in, then we can show something about why IPs are logged... |
331
|
|
|
else |
332
|
|
|
echo ' |
333
|
|
|
<li class="poster_ip"><a href="', $scripturl, '?action=helpadmin;help=see_member_ip" onclick="return reqOverlayDiv(this.href);" class="help">', $txt['logged'], '</a></li>'; |
334
|
|
|
|
335
|
|
|
// Show the profile, website, email address, and personal message buttons. |
336
|
|
|
if ($message['member']['show_profile_buttons']) |
337
|
|
|
{ |
338
|
|
|
echo ' |
339
|
|
|
<li class="profile"> |
340
|
|
|
<ol class="profile_icons">'; |
341
|
|
|
|
342
|
|
|
// Show the profile button |
343
|
|
|
if ($message['member']['can_view_profile']) |
344
|
|
|
echo ' |
345
|
|
|
<li><a href="', $message['member']['href'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/icons/profile_sm.png" alt="' . $txt['view_profile'] . '" title="' . $txt['view_profile'] . '">' : $txt['view_profile']), '</a></li>'; |
346
|
|
|
|
347
|
|
|
// Don't show an icon if they haven't specified a website. |
348
|
|
View Code Duplication |
if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website'])) |
|
|
|
|
349
|
|
|
echo ' |
350
|
|
|
<li><a href="', $message['member']['website']['url'], '" title="' . $message['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www centericon" title="' . $message['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
351
|
|
|
|
352
|
|
|
// Don't show the email address if they want it hidden. |
353
|
|
View Code Duplication |
if ($message['member']['show_email']) |
|
|
|
|
354
|
|
|
echo ' |
355
|
|
|
<li><a href="mailto:', $message['member']['email'], '" rel="nofollow">', ($settings['use_image_buttons'] ? '<span class="generic_icons mail centericon" title="' . $txt['email'] . '"></span>' : $txt['email']), '</a></li>'; |
356
|
|
|
|
357
|
|
|
// Since we know this person isn't a guest, you *can* message them. |
358
|
|
View Code Duplication |
if ($context['can_send_pm']) |
|
|
|
|
359
|
|
|
echo ' |
360
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=send;u=', $message['member']['id'], '" title="', $message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline'], '">', $settings['use_image_buttons'] ? '<span class="generic_icons im_' . ($message['member']['online']['is_online'] ? 'on' : 'off') . ' centericon" title="' . ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']) . '"></span> ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), '</a></li>'; |
361
|
|
|
|
362
|
|
|
echo ' |
363
|
|
|
</ol> |
364
|
|
|
</li>'; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
// Any custom fields for standard placement? |
368
|
|
View Code Duplication |
if (!empty($message['custom_fields']['standard'])) |
|
|
|
|
369
|
|
|
foreach ($message['custom_fields']['standard'] as $custom) |
370
|
|
|
echo ' |
371
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>'; |
372
|
|
|
|
373
|
|
|
// Are we showing the warning status? |
374
|
|
|
if ($message['member']['can_see_warning']) |
375
|
|
|
echo ' |
376
|
|
|
<li class="warning">', $context['can_issue_warning'] ? '<a href="' . $scripturl . '?action=profile;area=issuewarning;u=' . $message['member']['id'] . '">' : '', '<span class="generic_icons warning_', $message['member']['warning_status'], '"></span>', $context['can_issue_warning'] ? '</a>' : '', '<span class="warn_', $message['member']['warning_status'], '">', $txt['warn_' . $message['member']['warning_status']], '</span></li>'; |
377
|
|
|
|
378
|
|
|
// Are there any custom fields to show at the bottom of the poster info? |
379
|
|
View Code Duplication |
if (!empty($message['custom_fields']['bottom_poster'])) |
|
|
|
|
380
|
|
|
foreach ($message['custom_fields']['bottom_poster'] as $custom) |
381
|
|
|
echo ' |
382
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
// Done with the information about the poster... on to the post itself. |
386
|
|
|
echo ' |
387
|
|
|
</ul> |
388
|
|
|
</div> |
389
|
|
|
<div class="postarea"> |
390
|
|
|
<div class="flow_hidden"> |
391
|
|
|
<div class="keyinfo"> |
392
|
|
|
<h5 id="subject_', $message['id'], '"> |
393
|
|
|
', $message['subject'], ' |
394
|
|
|
</h5>'; |
395
|
|
|
|
396
|
|
|
// Show who the message was sent to. |
397
|
|
|
echo ' |
398
|
|
|
<span class="smalltext">« <strong> ', $txt['sent_to'], ':</strong> '; |
399
|
|
|
|
400
|
|
|
// People it was sent directly to.... |
401
|
|
View Code Duplication |
if (!empty($message['recipients']['to'])) |
|
|
|
|
402
|
|
|
echo implode(', ', $message['recipients']['to']); |
403
|
|
|
// Otherwise, we're just going to say "some people"... |
404
|
|
|
elseif ($context['folder'] != 'sent') |
405
|
|
|
echo '(', $txt['pm_undisclosed_recipients'], ')'; |
406
|
|
|
|
407
|
|
|
echo ' |
408
|
|
|
<strong> ', $txt['on'], ':</strong> ', $message['time'], ' » |
409
|
|
|
</span>'; |
410
|
|
|
|
411
|
|
|
// If we're in the sent items, show who it was sent to besides the "To:" people. |
412
|
|
|
if (!empty($message['recipients']['bcc'])) |
413
|
|
|
echo ' |
414
|
|
|
<br><span class="smalltext">« <strong> ', $txt['pm_bcc'], ':</strong> ', implode(', ', $message['recipients']['bcc']), ' »</span>'; |
415
|
|
|
|
416
|
|
|
if (!empty($message['is_replied_to'])) |
417
|
|
|
echo ' |
418
|
|
|
<br><span class="smalltext">« ', $txt['pm_is_replied_to'], ' »</span> |
419
|
|
|
<br><span class="smalltext">« ', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' »</span>'; |
420
|
|
|
|
421
|
|
|
echo ' |
422
|
|
|
</div> |
423
|
|
|
</div> |
424
|
|
|
<div class="post"> |
425
|
|
|
<div class="inner" id="msg_', $message['id'], '"', '>', $message['body'], '</div>'; |
426
|
|
|
|
427
|
|
|
if ($message['can_report'] || $context['can_send_pm']) |
428
|
|
|
echo ' |
429
|
|
|
<div class="under_message">'; |
430
|
|
|
|
431
|
|
|
if ($message['can_report']) |
432
|
|
|
echo ' |
433
|
|
|
<a href="' . $scripturl . '?action=pm;sa=report;l=' . $context['current_label_id'] . ';pmsg=' . $message['id'] . '" class="floatright">' . $txt['pm_report_to_admin'] . '</a>'; |
434
|
|
|
|
435
|
|
|
echo ' |
436
|
|
|
<ul class="quickbuttons">'; |
437
|
|
|
|
438
|
|
|
// Show reply buttons if you have the permission to send PMs. |
439
|
|
|
if ($context['can_send_pm']) |
440
|
|
|
{ |
441
|
|
|
// You can't really reply if the member is gone. |
442
|
|
|
if (!$message['member']['is_guest']) |
443
|
|
|
{ |
444
|
|
|
// Is there than more than one recipient you can reply to? |
445
|
|
View Code Duplication |
if ($message['number_recipients'] > 1) |
|
|
|
|
446
|
|
|
echo ' |
447
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=all"><span class="generic_icons reply_all_button"></span>', $txt['reply_to_all'], '</a></li>'; |
448
|
|
|
|
449
|
|
|
echo ' |
450
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li> |
451
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote', $context['folder'] == 'sent' ? '' : ';u=' . $message['member']['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
452
|
|
|
} |
453
|
|
|
// This is for "forwarding" - even if the member is gone. |
454
|
|
|
else |
455
|
|
|
echo ' |
456
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote"><span class="generic_icons quote"></span>', $txt['reply_quote'], '</a></li>'; |
457
|
|
|
} |
458
|
|
|
echo ' |
459
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=pmactions;pm_actions%5b', $message['id'], '%5D=delete;f=', $context['folder'], ';start=', $context['start'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', addslashes($txt['remove_message_question']), '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li>'; |
460
|
|
|
|
461
|
|
|
if (empty($context['display_mode'])) |
462
|
|
|
echo ' |
463
|
|
|
<li><input type="checkbox" name="pms[]" id="deletedisplay', $message['id'], '" value="', $message['id'], '" onclick="document.getElementById(\'deletelisting', $message['id'], '\').checked = this.checked;" class="input_check"></li>'; |
464
|
|
|
|
465
|
|
|
echo ' |
466
|
|
|
</ul>'; |
467
|
|
|
|
468
|
|
|
if ($message['can_report'] || $context['can_send_pm']) |
469
|
|
|
echo ' |
470
|
|
|
</div>'; |
471
|
|
|
|
472
|
|
|
// Are there any custom profile fields for above the signature? |
473
|
|
View Code Duplication |
if (!empty($message['custom_fields']['above_signature'])) |
|
|
|
|
474
|
|
|
{ |
475
|
|
|
echo ' |
476
|
|
|
<div class="custom_fields_above_signature"> |
477
|
|
|
<ul class="nolist">'; |
478
|
|
|
|
479
|
|
|
foreach ($message['custom_fields']['above_signature'] as $custom) |
480
|
|
|
echo ' |
481
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
482
|
|
|
|
483
|
|
|
echo ' |
484
|
|
|
</ul> |
485
|
|
|
</div>'; |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
// Show the member's signature? |
489
|
|
|
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled']) |
490
|
|
|
echo ' |
491
|
|
|
<div class="signature">', $message['member']['signature'], '</div>'; |
492
|
|
|
|
493
|
|
|
// Are there any custom profile fields for below the signature? |
494
|
|
View Code Duplication |
if (!empty($message['custom_fields']['below_signature'])) |
|
|
|
|
495
|
|
|
{ |
496
|
|
|
echo ' |
497
|
|
|
<div class="custom_fields_below_signature"> |
498
|
|
|
<ul class="nolist">'; |
499
|
|
|
|
500
|
|
|
foreach ($message['custom_fields']['below_signature'] as $custom) |
501
|
|
|
echo ' |
502
|
|
|
<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>'; |
503
|
|
|
|
504
|
|
|
echo ' |
505
|
|
|
</ul> |
506
|
|
|
</div>'; |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
// Add an extra line at the bottom if we have labels enabled. |
510
|
|
|
if ($context['folder'] != 'sent' && !empty($context['currently_using_labels']) && $context['display_mode'] != 2) |
511
|
|
|
{ |
512
|
|
|
echo ' |
513
|
|
|
<div class="labels righttext flow_auto">'; |
514
|
|
|
// Add the label drop down box. |
515
|
|
|
if (!empty($context['currently_using_labels'])) |
516
|
|
|
{ |
517
|
|
|
echo ' |
518
|
|
|
<select name="pm_actions[', $message['id'], ']" onchange="if (this.options[this.selectedIndex].value) form.submit();"> |
519
|
|
|
<option value="">', $txt['pm_msg_label_title'], ':</option> |
520
|
|
|
<option value="" disabled>---------------</option>'; |
521
|
|
|
|
522
|
|
|
// Are there any labels which can be added to this? |
523
|
|
|
if (!$message['fully_labeled']) |
524
|
|
|
{ |
525
|
|
|
echo ' |
526
|
|
|
<option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
527
|
|
|
foreach ($context['labels'] as $label) |
528
|
|
|
if (!isset($message['labels'][$label['id']])) |
529
|
|
|
echo ' |
530
|
|
|
<option value="', $label['id'], '"> ', $label['name'], '</option>'; |
531
|
|
|
} |
532
|
|
|
// ... and are there any that can be removed? |
533
|
|
|
if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1]))) |
534
|
|
|
{ |
535
|
|
|
echo ' |
536
|
|
|
<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
537
|
|
|
foreach ($message['labels'] as $label) |
538
|
|
|
echo ' |
539
|
|
|
<option value="', $label['id'], '"> ', $label['name'], '</option>'; |
540
|
|
|
} |
541
|
|
|
echo ' |
542
|
|
|
</select> |
543
|
|
|
<noscript> |
544
|
|
|
<input type="submit" value="', $txt['pm_apply'], '" class="button_submit" style="float: none"> |
545
|
|
|
</noscript>'; |
546
|
|
|
} |
547
|
|
|
echo ' |
548
|
|
|
</div>'; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
echo ' |
552
|
|
|
</div> |
553
|
|
|
</div> |
554
|
|
|
<div class="moderatorbar"> |
555
|
|
|
</div> |
556
|
|
|
</div>'; |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
if (empty($context['display_mode'])) |
560
|
|
|
echo ' |
561
|
|
|
|
562
|
|
|
<div class="pagesection"> |
563
|
|
|
<div class="floatleft">', $context['page_index'], '</div> |
564
|
|
|
<div class="floatright"><input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" style="font-weight: normal;" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button_submit"></div> |
565
|
|
|
</div>'; |
566
|
|
|
|
567
|
|
|
// Show a few buttons if we are in conversation mode and outputting the first message. |
568
|
|
View Code Duplication |
elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons'])) |
|
|
|
|
569
|
|
|
{ |
570
|
|
|
echo ' |
571
|
|
|
|
572
|
|
|
<div class="pagesection">'; |
573
|
|
|
|
574
|
|
|
template_button_strip($context['conversation_buttons'], 'right'); |
575
|
|
|
|
576
|
|
|
echo ' |
577
|
|
|
</div>'; |
578
|
|
|
} |
579
|
|
|
|
580
|
|
|
echo ' |
581
|
|
|
<br>'; |
582
|
|
|
} |
583
|
|
|
|
584
|
|
|
// Individual messages = buttom list! |
585
|
|
|
if ($context['display_mode'] == 1) |
586
|
|
|
{ |
587
|
|
|
template_subject_list(); |
588
|
|
|
echo '<br>'; |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
echo ' |
592
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
593
|
|
|
</form>'; |
594
|
|
|
} |
595
|
|
|
|
596
|
|
|
/** |
597
|
|
|
* Just list all the personal message subjects - to make templates easier. |
598
|
|
|
*/ |
599
|
|
|
function template_subject_list() |
600
|
|
|
{ |
601
|
|
|
global $context, $settings, $txt, $scripturl; |
602
|
|
|
|
603
|
|
|
echo ' |
604
|
|
|
<table class="table_grid"> |
605
|
|
|
<thead> |
606
|
|
|
<tr class="title_bar"> |
607
|
|
|
<th class="centercol table_icon"> |
608
|
|
|
<a href="', $scripturl, '?action=pm;view;f=', $context['folder'], ';start=', $context['start'], ';sort=', $context['sort_by'], ($context['sort_direction'] == 'up' ? '' : ';desc'), ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : ''), '"> <span class="generic_icons switch" title="', $txt['pm_change_view'], '"></span></a> |
609
|
|
|
</th> |
610
|
|
|
<th class="lefttext quarter_table"> |
611
|
|
|
<a href="', $scripturl, '?action=pm;f=', $context['folder'], ';start=', $context['start'], ';sort=date', $context['sort_by'] == 'date' && $context['sort_direction'] == 'up' ? ';desc' : '', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '">', $txt['date'], $context['sort_by'] == 'date' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
612
|
|
|
</th> |
613
|
|
|
<th class="lefttext half_table"> |
614
|
|
|
<a href="', $scripturl, '?action=pm;f=', $context['folder'], ';start=', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '">', $txt['subject'], $context['sort_by'] == 'subject' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
615
|
|
|
</th> |
616
|
|
|
<th class="lefttext"> |
617
|
|
|
<a href="', $scripturl, '?action=pm;f=', $context['folder'], ';start=', $context['start'], ';sort=name', $context['sort_by'] == 'name' && $context['sort_direction'] == 'up' ? ';desc' : '', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', '">', ($context['from_or_to'] == 'from' ? $txt['from'] : $txt['to']), $context['sort_by'] == 'name' ? ' <span class="generic_icons sort_' . $context['sort_direction'] . '"></span>' : '', '</a> |
618
|
|
|
</th> |
619
|
|
|
<th class="centercol table_icon"> |
620
|
|
|
<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check"> |
621
|
|
|
</th> |
622
|
|
|
</tr> |
623
|
|
|
</thead> |
624
|
|
|
<tbody>'; |
625
|
|
|
if (!$context['show_delete']) |
626
|
|
|
echo ' |
627
|
|
|
<tr class="windowbg"> |
628
|
|
|
<td colspan="5">', $txt['pm_alert_none'], '</td> |
629
|
|
|
</tr>'; |
630
|
|
|
|
631
|
|
|
while ($message = $context['get_pmessage']('subject')) |
632
|
|
|
{ |
633
|
|
|
echo ' |
634
|
|
|
<tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '','"> |
635
|
|
|
<td class="table_icon"> |
636
|
|
|
<script> |
637
|
|
|
currentLabels[', $message['id'], '] = {'; |
638
|
|
|
|
639
|
|
|
if (!empty($message['labels'])) |
640
|
|
|
{ |
641
|
|
|
$first = true; |
642
|
|
|
foreach ($message['labels'] as $label) |
643
|
|
|
{ |
644
|
|
|
echo $first ? '' : ',', ' |
645
|
|
|
"', $label['id'], '": "', $label['name'], '"'; |
646
|
|
|
$first = false; |
647
|
|
|
} |
648
|
|
|
} |
649
|
|
|
|
650
|
|
|
echo ' |
651
|
|
|
}; |
652
|
|
|
</script> |
653
|
|
|
', $message['is_replied_to'] ? '<span class="generic_icons replied" title="' . $txt['pm_replied'] . '"></span>' : '<span class="generic_icons im_off" title="' . $txt['pm_read'] . '"></span>', '</td> |
654
|
|
|
<td>', $message['time'], '</td> |
655
|
|
|
<td>', ($context['display_mode'] != 0 && $context['current_pm'] == $message['id'] ? '<img src="' . $settings['images_url'] . '/selected.png" alt="*">' : ''), '<a href="', ($context['display_mode'] == 0 || $context['current_pm'] == $message['id'] ? '' : ($scripturl . '?action=pm;pmid=' . $message['id'] . ';kstart;f=' . $context['folder'] . ';start=' . $context['start'] . ';sort=' . $context['sort_by'] . ($context['sort_direction'] == 'up' ? ';' : ';desc') . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : ''))), '#msg', $message['id'], '">', $message['subject'], $message['is_unread'] ? ' <span class="new_posts">' . $txt['new'] . '</span>' : '', '</a></td> |
656
|
|
|
<td>', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '</td> |
657
|
|
|
<td class="centercol table_icon"><input type="checkbox" name="pms[]" id="deletelisting', $message['id'], '" value="', $message['id'], '"', $message['is_selected'] ? ' checked' : '', ' onclick="if (document.getElementById(\'deletedisplay', $message['id'], '\')) document.getElementById(\'deletedisplay', $message['id'], '\').checked = this.checked;" class="input_check"></td> |
658
|
|
|
</tr>'; |
659
|
|
|
} |
660
|
|
|
|
661
|
|
|
echo ' |
662
|
|
|
</tbody> |
663
|
|
|
</table> |
664
|
|
|
<div class="pagesection"> |
665
|
|
|
<div class="floatleft">', $context['page_index'], '</div> |
666
|
|
|
<div class="floatright"> '; |
667
|
|
|
|
668
|
|
|
if ($context['show_delete']) |
669
|
|
|
{ |
670
|
|
|
if (!empty($context['currently_using_labels']) && $context['folder'] != 'sent') |
671
|
|
|
{ |
672
|
|
|
echo ' |
673
|
|
|
<select name="pm_action" onchange="if (this.options[this.selectedIndex].value) this.form.submit();" onfocus="loadLabelChoices();"> |
674
|
|
|
<option value="">', $txt['pm_sel_label_title'], ':</option> |
675
|
|
|
<option value="" disabled>---------------</option>'; |
676
|
|
|
|
677
|
|
|
echo ' |
678
|
|
|
<option value="" disabled>', $txt['pm_msg_label_apply'], ':</option>'; |
679
|
|
|
|
680
|
|
View Code Duplication |
foreach ($context['labels'] as $label) |
|
|
|
|
681
|
|
|
{ |
682
|
|
|
if ($label['id'] != $context['current_label_id']) |
683
|
|
|
echo ' |
684
|
|
|
<option value="add_', $label['id'], '"> ', $label['name'], '</option>'; |
685
|
|
|
} |
686
|
|
|
|
687
|
|
|
echo ' |
688
|
|
|
<option value="" disabled>', $txt['pm_msg_label_remove'], ':</option>'; |
689
|
|
|
|
690
|
|
|
foreach ($context['labels'] as $label) |
691
|
|
|
{ |
692
|
|
|
echo ' |
693
|
|
|
<option value="rem_', $label['id'], '"> ', $label['name'], '</option>'; |
694
|
|
|
} |
695
|
|
|
|
696
|
|
|
echo ' |
697
|
|
|
</select> |
698
|
|
|
<noscript> |
699
|
|
|
<input type="submit" value="', $txt['pm_apply'], '" class="button_submit" style="float: none"> |
700
|
|
|
</noscript>'; |
701
|
|
|
} |
702
|
|
|
|
703
|
|
|
echo ' |
704
|
|
|
<input type="submit" name="del_selected" value="', $txt['quickmod_delete_selected'], '" onclick="if (!confirm(\'', $txt['delete_selected_confirm'], '\')) return false;" class="button_submit" style="float: none">'; |
705
|
|
|
} |
706
|
|
|
|
707
|
|
|
echo ' |
708
|
|
|
</div> |
709
|
|
|
</div>'; |
710
|
|
|
} |
711
|
|
|
|
712
|
|
|
/** |
713
|
|
|
* The form for the PM search feature |
714
|
|
|
*/ |
715
|
|
|
function template_search() |
|
|
|
|
716
|
|
|
{ |
717
|
|
|
global $context, $scripturl, $txt; |
718
|
|
|
|
719
|
|
|
echo ' |
720
|
|
|
<form action="', $scripturl, '?action=pm;sa=search2" method="post" accept-charset="', $context['character_set'], '" name="searchform" id="searchform"> |
721
|
|
|
<div class="cat_bar"> |
722
|
|
|
<h3 class="catbg">', $txt['pm_search_title'], '</h3> |
723
|
|
|
</div>'; |
724
|
|
|
|
725
|
|
View Code Duplication |
if (!empty($context['search_errors'])) |
|
|
|
|
726
|
|
|
{ |
727
|
|
|
echo ' |
728
|
|
|
<div class="errorbox"> |
729
|
|
|
', implode('<br>', $context['search_errors']['messages']), ' |
730
|
|
|
</div>'; |
731
|
|
|
} |
732
|
|
|
|
733
|
|
|
|
734
|
|
|
echo ' |
735
|
|
|
<fieldset id="advanced_search"> |
736
|
|
|
<div class="roundframe"> |
737
|
|
|
<input type="hidden" name="advanced" value="1"> |
738
|
|
|
<span class="enhanced"> |
739
|
|
|
<strong>', $txt['pm_search_text'], ':</strong> |
740
|
|
|
<input type="search" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' size="40" class="input_text"> |
741
|
|
|
<script> |
742
|
|
|
createEventListener(window); |
743
|
|
|
window.addEventListener("load", initSearch, false); |
744
|
|
|
</script> |
745
|
|
|
<select name="searchtype"> |
746
|
|
|
<option value="1"', empty($context['search_params']['searchtype']) ? ' selected' : '', '>', $txt['pm_search_match_all'], '</option> |
747
|
|
|
<option value="2"', !empty($context['search_params']['searchtype']) ? ' selected' : '', '>', $txt['pm_search_match_any'], '</option> |
748
|
|
|
</select> |
749
|
|
|
</span> |
750
|
|
|
<dl id="search_options"> |
751
|
|
|
<dt>', $txt['pm_search_user'], ':</dt> |
752
|
|
|
<dd><input type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text"></dd> |
753
|
|
|
<dt>', $txt['pm_search_order'], ':</dt> |
754
|
|
|
<dd> |
755
|
|
|
<select name="sort"> |
756
|
|
|
<option value="relevance|desc">', $txt['pm_search_orderby_relevant_first'], '</option> |
757
|
|
|
<option value="id_pm|desc">', $txt['pm_search_orderby_recent_first'], '</option> |
758
|
|
|
<option value="id_pm|asc">', $txt['pm_search_orderby_old_first'], '</option> |
759
|
|
|
</select> |
760
|
|
|
</dd> |
761
|
|
|
<dt class="options">', $txt['pm_search_options'], ':</dt> |
762
|
|
|
<dd class="options"> |
763
|
|
|
<label for="show_complete"><input type="checkbox" name="show_complete" id="show_complete" value="1"', !empty($context['search_params']['show_complete']) ? ' checked' : '', ' class="input_check"> ', $txt['pm_search_show_complete'], '</label><br> |
764
|
|
|
<label for="subject_only"><input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked' : '', ' class="input_check"> ', $txt['pm_search_subject_only'], '</label> |
765
|
|
|
</dd> |
766
|
|
|
<dt class="between">', $txt['pm_search_post_age'], ':</dt> |
767
|
|
|
<dd>', $txt['pm_search_between'], ' <input type="number" name="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="5" class="input_text" min="0" max="9999"> ', $txt['pm_search_between_and'], ' <input type="number" name="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="5" class="input_text" min="0" max="9999"> ', $txt['pm_search_between_days'], '</dd> |
768
|
|
|
</dl>'; |
769
|
|
|
if (!$context['currently_using_labels']) |
770
|
|
|
echo ' |
771
|
|
|
<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button_submit">'; |
772
|
|
|
echo ' |
773
|
|
|
<br class="clear_right"> |
774
|
|
|
</div> |
775
|
|
|
</fieldset>'; |
776
|
|
|
|
777
|
|
|
// Do we have some labels setup? If so offer to search by them! |
778
|
|
|
if ($context['currently_using_labels']) |
779
|
|
|
{ |
780
|
|
|
echo ' |
781
|
|
|
<fieldset class="labels"> |
782
|
|
|
<div class="roundframe"> |
783
|
|
|
<div class="cat_bar"> |
784
|
|
|
<h3 class="catbg"> |
785
|
|
|
<span id="advanced_panel_toggle" class="toggle_up floatright" style="display: none;"></span><a href="#" id="advanced_panel_link">', $txt['pm_search_choose_label'], '</a> |
786
|
|
|
</h3> |
787
|
|
|
</div> |
788
|
|
|
<div id="advanced_panel_div"> |
789
|
|
|
<ul id="searchLabelsExpand">'; |
790
|
|
|
|
791
|
|
|
foreach ($context['search_labels'] as $label) |
792
|
|
|
echo ' |
793
|
|
|
<li> |
794
|
|
|
<label for="searchlabel_', $label['id'], '"><input type="checkbox" id="searchlabel_', $label['id'], '" name="searchlabel[', $label['id'], ']" value="', $label['id'], '"', $label['checked'] ? ' checked' : '', ' class="input_check"> |
795
|
|
|
', $label['name'], '</label> |
796
|
|
|
</li>'; |
797
|
|
|
|
798
|
|
|
echo ' |
799
|
|
|
</ul> |
800
|
|
|
</div> |
801
|
|
|
<p> |
802
|
|
|
<span class="floatleft"><input type="checkbox" name="all" id="check_all" value=""', $context['check_all'] ? ' checked' : '', ' onclick="invertAll(this, this.form, \'searchlabel\');" class="input_check"><em> <label for="check_all">', $txt['check_all'], '</label></em></span> |
803
|
|
|
<input type="submit" name="pm_search" value="', $txt['pm_search_go'], '" class="button_submit"> |
804
|
|
|
</p> |
805
|
|
|
<br class="clear_right"> |
806
|
|
|
</div> |
807
|
|
|
</fieldset>'; |
808
|
|
|
|
809
|
|
|
// Some javascript for the advanced toggling |
810
|
|
|
echo ' |
811
|
|
|
<script> |
812
|
|
|
var oAdvancedPanelToggle = new smc_Toggle({ |
813
|
|
|
bToggleEnabled: true, |
814
|
|
|
bCurrentlyCollapsed: true, |
815
|
|
|
aSwappableContainers: [ |
816
|
|
|
\'advanced_panel_div\' |
817
|
|
|
], |
818
|
|
|
aSwapImages: [ |
819
|
|
|
{ |
820
|
|
|
sId: \'advanced_panel_toggle\', |
821
|
|
|
altExpanded: ', JavaScriptEscape($txt['hide']), ', |
822
|
|
|
altCollapsed: ', JavaScriptEscape($txt['show']), ' |
823
|
|
|
} |
824
|
|
|
], |
825
|
|
|
aSwapLinks: [ |
826
|
|
|
{ |
827
|
|
|
sId: \'advanced_panel_link\', |
828
|
|
|
msgExpanded: ', JavaScriptEscape($txt['pm_search_choose_label']), ', |
829
|
|
|
msgCollapsed: ', JavaScriptEscape($txt['pm_search_choose_label']), ' |
830
|
|
|
} |
831
|
|
|
] |
832
|
|
|
}); |
833
|
|
|
</script>'; |
834
|
|
|
} |
835
|
|
|
|
836
|
|
|
echo ' |
837
|
|
|
</form>'; |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
/** |
841
|
|
|
* Displays results from a PM search |
842
|
|
|
*/ |
843
|
|
|
function template_search_results() |
844
|
|
|
{ |
845
|
|
|
global $context, $scripturl, $txt; |
846
|
|
|
|
847
|
|
|
echo ' |
848
|
|
|
<div class="cat_bar"> |
849
|
|
|
<h3 class="catbg">', $txt['pm_search_results'], '</h3> |
850
|
|
|
</div> |
851
|
|
|
<div class="pagesection"> |
852
|
|
|
', $context['page_index'], ' |
853
|
|
|
</div>'; |
854
|
|
|
|
855
|
|
|
// complete results ? |
856
|
|
|
if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
857
|
|
|
echo ' |
858
|
|
|
<table class="table_grid"> |
859
|
|
|
<thead> |
860
|
|
|
<tr class="title_bar"> |
861
|
|
|
<th class="lefttext quarter_table">', $txt['date'], '</th> |
862
|
|
|
<th class="lefttext half_table">', $txt['subject'], '</th> |
863
|
|
|
<th class="lefttext quarter_table">', $txt['from'], '</th> |
864
|
|
|
</tr> |
865
|
|
|
</thead> |
866
|
|
|
<tbody>'; |
867
|
|
|
|
868
|
|
|
// Print each message out... |
869
|
|
|
foreach ($context['personal_messages'] as $message) |
870
|
|
|
{ |
871
|
|
|
// We showing it all? |
872
|
|
|
if (!empty($context['search_params']['show_complete'])) |
873
|
|
|
{ |
874
|
|
|
echo ' |
875
|
|
|
<div class="cat_bar"> |
876
|
|
|
<h3 class="catbg"> |
877
|
|
|
<span class="floatright">', $txt['search_on'], ': ', $message['time'], '</span> |
878
|
|
|
<span class="floatleft">', $message['counter'], ' <a href="', $message['href'], '">', $message['subject'], '</a></span> |
879
|
|
|
</h3> |
880
|
|
|
</div> |
881
|
|
|
<div class="cat_bar"> |
882
|
|
|
<h3 class="catbg">', $txt['from'], ': ', $message['member']['link'], ', ', $txt['to'], ': '; |
883
|
|
|
|
884
|
|
|
// Show the recipients. |
885
|
|
|
// @todo This doesn't deal with the sent item searching quite right for bcc. |
886
|
|
View Code Duplication |
if (!empty($message['recipients']['to'])) |
|
|
|
|
887
|
|
|
echo implode(', ', $message['recipients']['to']); |
888
|
|
|
// Otherwise, we're just going to say "some people"... |
889
|
|
|
elseif ($context['folder'] != 'sent') |
890
|
|
|
echo '(', $txt['pm_undisclosed_recipients'], ')'; |
891
|
|
|
|
892
|
|
|
echo ' |
893
|
|
|
</h3> |
894
|
|
|
</div> |
895
|
|
|
<div class="windowbg"> |
896
|
|
|
', $message['body'], ' |
897
|
|
|
<p class="pm_reply righttext">'; |
898
|
|
|
|
899
|
|
|
if ($context['can_send_pm']) |
900
|
|
|
{ |
901
|
|
|
$quote_button = create_button('quote.png', 'reply_quote', 'reply_quote', 'class="centericon"'); |
902
|
|
|
$reply_button = create_button('im_reply.png', 'reply', 'reply', 'class="centericon"'); |
903
|
|
|
// You can only reply if they are not a guest... |
904
|
|
|
if (!$message['member']['is_guest']) |
905
|
|
|
echo ' |
906
|
|
|
<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], ' |
907
|
|
|
<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator']; |
908
|
|
|
// This is for "forwarding" - even if the member is gone. |
909
|
|
View Code Duplication |
else |
|
|
|
|
910
|
|
|
echo ' |
911
|
|
|
<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator']; |
912
|
|
|
} |
913
|
|
|
|
914
|
|
|
echo ' |
915
|
|
|
</p> |
916
|
|
|
</div>'; |
917
|
|
|
} |
918
|
|
|
// Otherwise just a simple list! |
919
|
|
|
else |
920
|
|
|
{ |
921
|
|
|
// @todo No context at all of the search? |
922
|
|
|
echo ' |
923
|
|
|
<tr class="windowbg"> |
924
|
|
|
<td>', $message['time'], '</td> |
925
|
|
|
<td>', $message['link'], '</td> |
926
|
|
|
<td>', $message['member']['link'], '</td> |
927
|
|
|
</tr>'; |
928
|
|
|
} |
929
|
|
|
} |
930
|
|
|
|
931
|
|
|
// Finish off the page... |
932
|
|
|
if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages'])) |
933
|
|
|
echo ' |
934
|
|
|
</tbody> |
935
|
|
|
</table>'; |
936
|
|
|
|
937
|
|
|
// No results? |
938
|
|
|
if (empty($context['personal_messages'])) |
939
|
|
|
echo ' |
940
|
|
|
<div class="windowbg"> |
941
|
|
|
<p class="centertext">', $txt['pm_search_none_found'], '</p> |
942
|
|
|
</div>'; |
943
|
|
|
|
944
|
|
|
echo ' |
945
|
|
|
<div class="pagesection"> |
946
|
|
|
', $context['page_index'], ' |
947
|
|
|
</div>'; |
948
|
|
|
|
949
|
|
|
} |
950
|
|
|
|
951
|
|
|
/** |
952
|
|
|
* The form for sending a new PM |
953
|
|
|
*/ |
954
|
|
|
function template_send() |
955
|
|
|
{ |
956
|
|
|
global $context, $options, $scripturl, $modSettings, $txt; |
957
|
|
|
|
958
|
|
|
// Show which messages were sent successfully and which failed. |
959
|
|
|
if (!empty($context['send_log'])) |
960
|
|
|
{ |
961
|
|
|
echo ' |
962
|
|
|
<div class="cat_bar"> |
963
|
|
|
<h3 class="catbg">', $txt['pm_send_report'], '</h3> |
964
|
|
|
</div> |
965
|
|
|
<div class="windowbg">'; |
966
|
|
View Code Duplication |
if (!empty($context['send_log']['sent'])) |
|
|
|
|
967
|
|
|
foreach ($context['send_log']['sent'] as $log_entry) |
968
|
|
|
echo '<span class="error">', $log_entry, '</span><br>'; |
969
|
|
View Code Duplication |
if (!empty($context['send_log']['failed'])) |
|
|
|
|
970
|
|
|
foreach ($context['send_log']['failed'] as $log_entry) |
971
|
|
|
echo '<span class="error">', $log_entry, '</span><br>'; |
972
|
|
|
echo ' |
973
|
|
|
</div> |
974
|
|
|
<br>'; |
975
|
|
|
} |
976
|
|
|
|
977
|
|
|
// Show the preview of the personal message. |
978
|
|
|
echo ' |
979
|
|
|
<div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '> |
980
|
|
|
<div class="cat_bar"> |
981
|
|
|
<h3 class="catbg"> |
982
|
|
|
<span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span> |
983
|
|
|
</h3> |
984
|
|
|
</div> |
985
|
|
|
<div class="windowbg noup"> |
986
|
|
|
<div class="post" id="preview_body"> |
987
|
|
|
', empty($context['preview_message']) ? '<br>' : $context['preview_message'], ' |
988
|
|
|
</div> |
989
|
|
|
</div> |
990
|
|
|
<br class="clear"> |
991
|
|
|
</div>'; |
992
|
|
|
|
993
|
|
|
// Main message editing box. |
994
|
|
|
echo ' |
995
|
|
|
<div class="cat_bar"> |
996
|
|
|
<h3 class="catbg"> |
997
|
|
|
<span class="generic_icons inbox icon" title="', $txt['new_message'], '"></span> ', $txt['new_message'], ' |
998
|
|
|
</h3> |
999
|
|
|
</div>'; |
1000
|
|
|
|
1001
|
|
|
echo ' |
1002
|
|
|
<form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);"> |
1003
|
|
|
<div class="roundframe noup"> |
1004
|
|
|
<br class="clear">'; |
1005
|
|
|
|
1006
|
|
|
// If there were errors for sending the PM, show them. |
1007
|
|
|
echo ' |
1008
|
|
|
<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors"> |
1009
|
|
|
<dl> |
1010
|
|
|
<dt> |
1011
|
|
|
<strong id="error_serious">', $txt['error_while_submitting'] , '</strong> |
1012
|
|
|
</dt> |
1013
|
|
|
<dd class="error" id="error_list"> |
1014
|
|
|
', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), ' |
1015
|
|
|
</dd> |
1016
|
|
|
</dl> |
1017
|
|
|
</div>'; |
1018
|
|
|
|
1019
|
|
|
if (!empty($modSettings['drafts_pm_enabled'])) |
1020
|
|
|
echo ' |
1021
|
|
|
<div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>', |
1022
|
|
|
sprintf($txt['draft_pm_saved'], $scripturl . '?action=pm;sa=showpmdrafts'), ' |
1023
|
|
|
', (!empty($modSettings['drafts_keep_days']) ? ' <strong>' . sprintf($txt['draft_save_warning'], $modSettings['drafts_keep_days']) . '</strong>' : ''), ' |
1024
|
|
|
</div>'; |
1025
|
|
|
|
1026
|
|
|
echo ' |
1027
|
|
|
<dl id="post_header">'; |
1028
|
|
|
|
1029
|
|
|
// To and bcc. Include a button to search for members. |
1030
|
|
|
echo ' |
1031
|
|
|
<dt> |
1032
|
|
|
<span', (isset($context['post_error']['no_to']) || isset($context['post_error']['bad_to']) ? ' class="error"' : ''), ' id="caption_to">', $txt['pm_to'], ':</span> |
1033
|
|
|
</dt>'; |
1034
|
|
|
|
1035
|
|
|
// Autosuggest will be added by the JavaScript later on. |
1036
|
|
|
echo ' |
1037
|
|
|
<dd id="pm_to" class="clear_right"> |
1038
|
|
|
<input type="text" name="to" id="to_control" value="', $context['to_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text">'; |
1039
|
|
|
|
1040
|
|
|
// A link to add BCC, only visible with JavaScript enabled. |
1041
|
|
|
echo ' |
1042
|
|
|
<span class="smalltext" id="bcc_link_container" style="display: none;"></span>'; |
1043
|
|
|
|
1044
|
|
|
// A div that'll contain the items found by the autosuggest. |
1045
|
|
|
echo ' |
1046
|
|
|
<div id="to_item_list_container"></div>'; |
1047
|
|
|
|
1048
|
|
|
echo ' |
1049
|
|
|
</dd>'; |
1050
|
|
|
|
1051
|
|
|
// This BCC row will be hidden by default if JavaScript is enabled. |
1052
|
|
|
echo ' |
1053
|
|
|
<dt class="clear_left" id="bcc_div"> |
1054
|
|
|
<span', (isset($context['post_error']['no_to']) || isset($context['post_error']['bad_bcc']) ? ' class="error"' : ''), ' id="caption_bbc">', $txt['pm_bcc'], ':</span> |
1055
|
|
|
</dt> |
1056
|
|
|
<dd id="bcc_div2"> |
1057
|
|
|
<input type="text" name="bcc" id="bcc_control" value="', $context['bcc_value'], '" tabindex="', $context['tabindex']++, '" size="40" style="width: 130px;" class="input_text"> |
1058
|
|
|
<div id="bcc_item_list_container"></div> |
1059
|
|
|
</dd>'; |
1060
|
|
|
|
1061
|
|
|
// The subject of the PM. |
1062
|
|
|
echo ' |
1063
|
|
|
<dt class="clear_left"> |
1064
|
|
|
<span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span> |
1065
|
|
|
</dt> |
1066
|
|
|
<dd id="pm_subject"> |
1067
|
|
|
<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"',isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/> |
1068
|
|
|
</dd> |
1069
|
|
|
</dl><hr>'; |
1070
|
|
|
|
1071
|
|
|
// Showing BBC? |
1072
|
|
|
if ($context['show_bbc']) |
1073
|
|
|
{ |
1074
|
|
|
echo ' |
1075
|
|
|
<div id="bbcBox_message"></div>'; |
1076
|
|
|
} |
1077
|
|
|
|
1078
|
|
|
// What about smileys? |
1079
|
|
View Code Duplication |
if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
|
|
|
1080
|
|
|
echo ' |
1081
|
|
|
<div id="smileyBox_message"></div>'; |
1082
|
|
|
|
1083
|
|
|
// Show BBC buttons, smileys and textbox. |
1084
|
|
|
echo ' |
1085
|
|
|
', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message'); |
|
|
|
|
1086
|
|
|
|
1087
|
|
|
// Require an image to be typed to save spamming? |
1088
|
|
View Code Duplication |
if ($context['require_verification']) |
|
|
|
|
1089
|
|
|
{ |
1090
|
|
|
echo ' |
1091
|
|
|
<div class="post_verification"> |
1092
|
|
|
<strong>', $txt['pm_visual_verification_label'], ':</strong> |
1093
|
|
|
', template_control_verification($context['visual_verification_id'], 'all'), ' |
1094
|
|
|
</div>'; |
1095
|
|
|
} |
1096
|
|
|
|
1097
|
|
|
// Send, Preview, spellcheck buttons. |
1098
|
|
|
echo ' |
1099
|
|
|
<hr> |
1100
|
|
|
<span id="post_confirm_strip" class="righttext"> |
1101
|
|
|
', template_control_richedit_buttons($context['post_box_name']), ' |
1102
|
|
|
</span> |
1103
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1104
|
|
|
<input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '"> |
1105
|
|
|
<input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '"> |
1106
|
|
|
<input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '"> |
1107
|
|
|
<input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '"> |
1108
|
|
|
<input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '"> |
1109
|
|
|
<br class="clear_right"> |
1110
|
|
|
</div> |
1111
|
|
|
</form>'; |
1112
|
|
|
|
1113
|
|
|
// If the admin enabled the pm drafts feature, show a draft selection box |
1114
|
|
View Code Duplication |
if (!empty($context['drafts_pm_save']) && !empty($context['drafts']) && !empty($options['drafts_show_saved_enabled'])) |
|
|
|
|
1115
|
|
|
{ |
1116
|
|
|
echo ' |
1117
|
|
|
<br> |
1118
|
|
|
<div id="postDraftOptionsHeader" class="cat_bar"> |
1119
|
|
|
<h3 class="catbg"> |
1120
|
|
|
<span id="postDraftExpand" class="toggle_up floatright" style="display: none;"></span> <strong><a href="#" id="postDraftExpandLink">', $txt['draft_load'], '</a></strong> |
1121
|
|
|
</h3> |
1122
|
|
|
</div> |
1123
|
|
|
<div id="postDraftOptions" class="load_drafts padding"> |
1124
|
|
|
<dl class="settings"> |
1125
|
|
|
<dt><strong>', $txt['subject'], '</strong></dt> |
1126
|
|
|
<dd><strong>', $txt['draft_saved_on'], '</strong></dd>'; |
1127
|
|
|
|
1128
|
|
|
foreach ($context['drafts'] as $draft) |
1129
|
|
|
echo ' |
1130
|
|
|
<dt>', $draft['link'], '</dt> |
1131
|
|
|
<dd>', $draft['poster_time'], '</dd>'; |
1132
|
|
|
echo ' |
1133
|
|
|
</dl> |
1134
|
|
|
</div>'; |
1135
|
|
|
} |
1136
|
|
|
|
1137
|
|
|
echo ' |
1138
|
|
|
<script>'; |
1139
|
|
|
// The functions used to preview a personal message without loading a new page. |
1140
|
|
|
echo ' |
1141
|
|
|
var txt_preview_title = "', $txt['preview_title'], '"; |
1142
|
|
|
var txt_preview_fetch = "', $txt['preview_fetch'], '"; |
1143
|
|
|
function previewPost() |
1144
|
|
|
{ |
1145
|
|
|
if (window.XMLHttpRequest) |
1146
|
|
|
{ |
1147
|
|
|
// Opera didn\'t support setRequestHeader() before 8.01. |
1148
|
|
|
// @todo Remove support for old browsers |
1149
|
|
|
if (\'opera\' in window) |
1150
|
|
|
{ |
1151
|
|
|
var test = new XMLHttpRequest(); |
1152
|
|
|
if (!(\'setRequestHeader\' in test)) |
1153
|
|
|
return submitThisOnce(document.forms.postmodify); |
1154
|
|
|
} |
1155
|
|
|
// @todo Currently not sending poll options and option checkboxes. |
1156
|
|
|
var x = new Array(); |
1157
|
|
|
var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', \'to\', \'bcc\']; |
1158
|
|
|
var numericFields = [\'recipient_to[]\', \'recipient_bcc[]\']; |
1159
|
|
|
var checkboxFields = []; |
1160
|
|
|
|
1161
|
|
|
for (var i = 0, n = textFields.length; i < n; i++) |
1162
|
|
|
if (textFields[i] in document.forms.postmodify) |
1163
|
|
|
{ |
1164
|
|
|
// Handle the WYSIWYG editor. |
1165
|
|
|
if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && ', JavaScriptEscape('oEditorHandle_' . $context['post_box_name']), ' in window && oEditorHandle_', $context['post_box_name'], '.bRichTextEnabled) |
1166
|
|
|
x[x.length] = \'message_mode=1&\' + textFields[i] + \'=\' + oEditorHandle_', $context['post_box_name'], '.getText(false).replace(/&#/g, \'&#\').php_to8bit().php_urlencode(); |
1167
|
|
|
else |
1168
|
|
|
x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#\').php_to8bit().php_urlencode(); |
1169
|
|
|
} |
1170
|
|
|
for (var i = 0, n = numericFields.length; i < n; i++) |
1171
|
|
|
if (numericFields[i] in document.forms.postmodify && \'value\' in document.forms.postmodify[numericFields[i]]) |
1172
|
|
|
x[x.length] = numericFields[i] + \'=\' + parseInt(document.forms.postmodify.elements[numericFields[i]].value); |
1173
|
|
|
for (var i = 0, n = checkboxFields.length; i < n; i++) |
1174
|
|
|
if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked) |
1175
|
|
|
x[x.length] = checkboxFields[i] + \'=\' + document.forms.postmodify.elements[checkboxFields[i]].value; |
1176
|
|
|
|
1177
|
|
|
sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=pm;sa=send2;preview;xml\', x.join(\'&\'), onDocSent); |
1178
|
|
|
|
1179
|
|
|
document.getElementById(\'preview_section\').style.display = \'\'; |
1180
|
|
|
setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title); |
1181
|
|
|
setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch); |
1182
|
|
|
|
1183
|
|
|
return false; |
1184
|
|
|
} |
1185
|
|
|
else |
1186
|
|
|
return submitThisOnce(document.forms.postmodify); |
1187
|
|
|
} |
1188
|
|
|
function onDocSent(XMLDoc) |
1189
|
|
|
{ |
1190
|
|
|
if (!XMLDoc) |
1191
|
|
|
{ |
1192
|
|
|
document.forms.postmodify.preview.onclick = new function () |
1193
|
|
|
{ |
1194
|
|
|
return true; |
1195
|
|
|
} |
1196
|
|
|
document.forms.postmodify.preview.click(); |
1197
|
|
|
} |
1198
|
|
|
|
1199
|
|
|
// Show the preview section. |
1200
|
|
|
var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0]; |
1201
|
|
|
setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue); |
1202
|
|
|
|
1203
|
|
|
var bodyText = \'\'; |
1204
|
|
|
for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++) |
1205
|
|
|
bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue; |
1206
|
|
|
|
1207
|
|
|
setInnerHTML(document.getElementById(\'preview_body\'), bodyText); |
1208
|
|
|
document.getElementById(\'preview_body\').className = \'post\'; |
1209
|
|
|
|
1210
|
|
|
// Show a list of errors (if any). |
1211
|
|
|
var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0]; |
1212
|
|
|
var errorList = new Array(); |
1213
|
|
|
for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++) |
1214
|
|
|
errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue; |
1215
|
|
|
document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\'; |
1216
|
|
|
setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br>\')); |
1217
|
|
|
|
1218
|
|
|
// Adjust the color of captions if the given data is erroneous. |
1219
|
|
|
var captions = errors.getElementsByTagName(\'caption\'); |
1220
|
|
|
for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++) |
1221
|
|
|
if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\'))) |
1222
|
|
|
document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\'); |
1223
|
|
|
|
1224
|
|
|
if (errors.getElementsByTagName(\'post_error\').length == 1) |
1225
|
|
|
document.forms.postmodify.', $context['post_box_name'], '.style.border = \'1px solid red\'; |
1226
|
|
|
else if (document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\') |
1227
|
|
|
{ |
1228
|
|
|
if (\'runtimeStyle\' in document.forms.postmodify.', $context['post_box_name'], ') |
1229
|
|
|
document.forms.postmodify.', $context['post_box_name'], '.style.borderColor = \'\'; |
1230
|
|
|
else |
1231
|
|
|
document.forms.postmodify.', $context['post_box_name'], '.style.border = null; |
1232
|
|
|
} |
1233
|
|
|
location.hash = \'#\' + \'preview_section\'; |
1234
|
|
|
}'; |
1235
|
|
|
|
1236
|
|
|
// Code for showing and hiding drafts |
1237
|
|
View Code Duplication |
if (!empty($context['drafts'])) |
|
|
|
|
1238
|
|
|
echo ' |
1239
|
|
|
var oSwapDraftOptions = new smc_Toggle({ |
1240
|
|
|
bToggleEnabled: true, |
1241
|
|
|
bCurrentlyCollapsed: true, |
1242
|
|
|
aSwappableContainers: [ |
1243
|
|
|
\'postDraftOptions\', |
1244
|
|
|
], |
1245
|
|
|
aSwapImages: [ |
1246
|
|
|
{ |
1247
|
|
|
sId: \'postDraftExpand\', |
1248
|
|
|
altExpanded: \'-\', |
1249
|
|
|
altCollapsed: \'+\' |
1250
|
|
|
} |
1251
|
|
|
], |
1252
|
|
|
aSwapLinks: [ |
1253
|
|
|
{ |
1254
|
|
|
sId: \'postDraftExpandLink\', |
1255
|
|
|
msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ', |
1256
|
|
|
msgCollapsed: ', JavaScriptEscape($txt['draft_load']), ' |
1257
|
|
|
} |
1258
|
|
|
] |
1259
|
|
|
});'; |
1260
|
|
|
|
1261
|
|
|
echo ' |
1262
|
|
|
</script>'; |
1263
|
|
|
|
1264
|
|
|
// Show the message you're replying to. |
1265
|
|
|
if ($context['reply']) |
1266
|
|
|
echo ' |
1267
|
|
|
<br> |
1268
|
|
|
<br> |
1269
|
|
|
<div class="cat_bar"> |
1270
|
|
|
<h3 class="catbg">', $txt['subject'], ': ', $context['quoted_message']['subject'], '</h3> |
1271
|
|
|
</div> |
1272
|
|
|
<div class="windowbg2"> |
1273
|
|
|
<div class="clear"> |
1274
|
|
|
<span class="smalltext floatright">', $txt['on'], ': ', $context['quoted_message']['time'], '</span> |
1275
|
|
|
<strong>', $txt['from'], ': ', $context['quoted_message']['member']['name'], '</strong> |
1276
|
|
|
</div> |
1277
|
|
|
<hr> |
1278
|
|
|
', $context['quoted_message']['body'], ' |
1279
|
|
|
</div><br class="clear">'; |
1280
|
|
|
|
1281
|
|
|
echo ' |
1282
|
|
|
<script> |
1283
|
|
|
var oPersonalMessageSend = new smf_PersonalMessageSend({ |
1284
|
|
|
sSelf: \'oPersonalMessageSend\', |
1285
|
|
|
sSessionId: smf_session_id, |
1286
|
|
|
sSessionVar: smf_session_var, |
1287
|
|
|
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', |
1288
|
|
|
sToControlId: \'to_control\', |
1289
|
|
|
aToRecipients: ['; |
1290
|
|
View Code Duplication |
foreach ($context['recipients']['to'] as $i => $member) |
|
|
|
|
1291
|
|
|
echo ' |
1292
|
|
|
{ |
1293
|
|
|
sItemId: ', JavaScriptEscape($member['id']), ', |
1294
|
|
|
sItemName: ', JavaScriptEscape($member['name']), ' |
1295
|
|
|
}', $i == count($context['recipients']['to']) - 1 ? '' : ','; |
1296
|
|
|
|
1297
|
|
|
echo ' |
1298
|
|
|
], |
1299
|
|
|
aBccRecipients: ['; |
1300
|
|
View Code Duplication |
foreach ($context['recipients']['bcc'] as $i => $member) |
|
|
|
|
1301
|
|
|
echo ' |
1302
|
|
|
{ |
1303
|
|
|
sItemId: ', JavaScriptEscape($member['id']), ', |
1304
|
|
|
sItemName: ', JavaScriptEscape($member['name']), ' |
1305
|
|
|
}', $i == count($context['recipients']['bcc']) - 1 ? '' : ','; |
1306
|
|
|
|
1307
|
|
|
echo ' |
1308
|
|
|
], |
1309
|
|
|
sBccControlId: \'bcc_control\', |
1310
|
|
|
sBccDivId: \'bcc_div\', |
1311
|
|
|
sBccDivId2: \'bcc_div2\', |
1312
|
|
|
sBccLinkId: \'bcc_link\', |
1313
|
|
|
sBccLinkContainerId: \'bcc_link_container\', |
1314
|
|
|
bBccShowByDefault: ', empty($context['recipients']['bcc']) && empty($context['bcc_value']) ? 'false' : 'true', ', |
1315
|
|
|
sShowBccLinkTemplate: ', JavaScriptEscape(' |
1316
|
|
|
<a href="#" id="bcc_link">' . $txt['make_bcc'] . '</a> <a href="' . $scripturl . '?action=helpadmin;help=pm_bcc" onclick="return reqOverlayDiv(this.href);">(?)</a>' |
1317
|
|
|
), ' |
1318
|
|
|
}); |
1319
|
|
|
'; |
1320
|
|
|
|
1321
|
|
|
echo ' |
1322
|
|
|
</script>'; |
1323
|
|
|
} |
1324
|
|
|
|
1325
|
|
|
/** |
1326
|
|
|
* This template asks the user whether they wish to empty out their folder/messages. |
1327
|
|
|
*/ |
1328
|
|
|
function template_ask_delete() |
1329
|
|
|
{ |
1330
|
|
|
global $context, $scripturl, $txt; |
1331
|
|
|
|
1332
|
|
|
echo ' |
1333
|
|
|
<div class="cat_bar"> |
1334
|
|
|
<h3 class="catbg">', ($context['delete_all'] ? $txt['delete_message'] : $txt['delete_all']), '</h3> |
1335
|
|
|
</div> |
1336
|
|
|
<div class="windowbg"> |
1337
|
|
|
<p>', $txt['delete_all_confirm'], '</p><br> |
1338
|
|
|
<strong><a href="', $scripturl, '?action=pm;sa=removeall2;f=', $context['folder'], ';', $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="javascript:history.go(-1);">', $txt['no'], '</a></strong> |
1339
|
|
|
</div>'; |
1340
|
|
|
} |
1341
|
|
|
|
1342
|
|
|
/** |
1343
|
|
|
* This template asks the user what messages they want to prune. |
1344
|
|
|
*/ |
1345
|
|
|
function template_prune() |
1346
|
|
|
{ |
1347
|
|
|
global $context, $scripturl, $txt; |
1348
|
|
|
|
1349
|
|
|
echo ' |
1350
|
|
|
<div class="cat_bar"> |
1351
|
|
|
<h3 class="catbg">', $txt['pm_prune'], '</h3> |
1352
|
|
|
</div> |
1353
|
|
|
<div class="windowbg"> |
1354
|
|
|
<form action="', $scripturl, '?action=pm;sa=prune" method="post" accept-charset="', $context['character_set'], '" onsubmit="return confirm(\'', $txt['pm_prune_warning'], '\');"> |
1355
|
|
|
<p>', $txt['pm_prune_desc1'], ' <input type="text" name="age" size="3" value="14" class="input_text"> ', $txt['pm_prune_desc2'], '</p> |
1356
|
|
|
<input type="submit" value="', $txt['delete'], '" class="button_submit"> |
1357
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1358
|
|
|
</form> |
1359
|
|
|
</div> |
1360
|
|
|
<div class="windowbg"> |
1361
|
|
|
<form action="', $scripturl, '?action=pm;sa=removeall2" method="post" onsubmit="return confirm(\'', $txt['pm_remove_all_warning'], '\');"> |
1362
|
|
|
<p>', $txt['pm_remove_all'], '</p> |
1363
|
|
|
<input type="submit" value="', $txt['delete_all_prune'], '" class="button_submit"> |
1364
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1365
|
|
|
</form> |
1366
|
|
|
</div>'; |
1367
|
|
|
} |
1368
|
|
|
|
1369
|
|
|
/** |
1370
|
|
|
* Here we allow the user to setup labels, remove labels and change rules for labels (i.e, do quite a bit) |
1371
|
|
|
*/ |
1372
|
|
|
function template_labels() |
1373
|
|
|
{ |
1374
|
|
|
global $context, $scripturl, $txt; |
1375
|
|
|
|
1376
|
|
|
echo ' |
1377
|
|
|
<form action="', $scripturl, '?action=pm;sa=manlabels" method="post" accept-charset="', $context['character_set'], '"> |
1378
|
|
|
<div class="cat_bar"> |
1379
|
|
|
<h3 class="catbg">', $txt['pm_manage_labels'], '</h3> |
1380
|
|
|
</div> |
1381
|
|
|
<div class="information"> |
1382
|
|
|
', $txt['pm_labels_desc'], ' |
1383
|
|
|
</div> |
1384
|
|
|
<table class="table_grid"> |
1385
|
|
|
<thead> |
1386
|
|
|
<tr class="title_bar"> |
1387
|
|
|
<th class="lefttext"> |
1388
|
|
|
', $txt['pm_label_name'], ' |
1389
|
|
|
</th> |
1390
|
|
|
<th class="centertext table_icon">'; |
1391
|
|
|
|
1392
|
|
|
if (count($context['labels']) > 2) |
1393
|
|
|
echo ' |
1394
|
|
|
<input type="checkbox" class="input_check" onclick="invertAll(this, this.form);">'; |
1395
|
|
|
|
1396
|
|
|
echo ' |
1397
|
|
|
</th> |
1398
|
|
|
</tr> |
1399
|
|
|
</thead> |
1400
|
|
|
<tbody>'; |
1401
|
|
|
if (count($context['labels']) < 2) |
1402
|
|
|
echo ' |
1403
|
|
|
<tr class="windowbg"> |
1404
|
|
|
<td colspan="2">', $txt['pm_labels_no_exist'], '</td> |
1405
|
|
|
</tr>'; |
1406
|
|
|
else |
1407
|
|
|
{ |
1408
|
|
View Code Duplication |
foreach ($context['labels'] as $label) |
|
|
|
|
1409
|
|
|
{ |
1410
|
|
|
if ($label['id'] == -1) |
1411
|
|
|
continue; |
1412
|
|
|
|
1413
|
|
|
echo ' |
1414
|
|
|
<tr class="windowbg"> |
1415
|
|
|
<td> |
1416
|
|
|
<input type="text" name="label_name[', $label['id'], ']" value="', $label['name'], '" size="30" maxlength="30" class="input_text"> |
1417
|
|
|
</td> |
1418
|
|
|
<td class="table_icon"><input type="checkbox" class="input_check" name="delete_label[', $label['id'], ']"></td> |
1419
|
|
|
</tr>'; |
1420
|
|
|
} |
1421
|
|
|
} |
1422
|
|
|
echo ' |
1423
|
|
|
</tbody> |
1424
|
|
|
</table>'; |
1425
|
|
|
|
1426
|
|
|
if (!count($context['labels']) < 2) |
1427
|
|
|
echo ' |
1428
|
|
|
<div class="padding"> |
1429
|
|
|
<input type="submit" name="save" value="', $txt['save'], '" class="button_submit"> |
1430
|
|
|
<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button_submit you_sure"> |
1431
|
|
|
</div>'; |
1432
|
|
|
|
1433
|
|
|
echo ' |
1434
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1435
|
|
|
</form> |
1436
|
|
|
<br class="clear"> |
1437
|
|
|
<form action="', $scripturl, '?action=pm;sa=manlabels" method="post" accept-charset="', $context['character_set'], '" style="margin-top: 1ex;"> |
1438
|
|
|
<div class="cat_bar"> |
1439
|
|
|
<h3 class="catbg">', $txt['pm_label_add_new'], '</h3> |
1440
|
|
|
</div> |
1441
|
|
|
<div class="windowbg"> |
1442
|
|
|
<dl class="settings"> |
1443
|
|
|
<dt> |
1444
|
|
|
<strong><label for="add_label">', $txt['pm_label_name'], '</label>:</strong> |
1445
|
|
|
</dt> |
1446
|
|
|
<dd> |
1447
|
|
|
<input type="text" id="add_label" name="label" value="" size="30" maxlength="30" class="input_text"> |
1448
|
|
|
</dd> |
1449
|
|
|
</dl> |
1450
|
|
|
<input type="submit" name="add" value="', $txt['pm_label_add_new'], '" class="button_submit"> |
1451
|
|
|
</div> |
1452
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1453
|
|
|
</form><br>'; |
1454
|
|
|
} |
1455
|
|
|
|
1456
|
|
|
/** |
1457
|
|
|
* Template for reporting a personal message. |
1458
|
|
|
*/ |
1459
|
|
|
function template_report_message() |
1460
|
|
|
{ |
1461
|
|
|
global $context, $txt, $scripturl; |
1462
|
|
|
|
1463
|
|
|
echo ' |
1464
|
|
|
<form action="', $scripturl, '?action=pm;sa=report;l=', $context['current_label_id'], '" method="post" accept-charset="', $context['character_set'], '"> |
1465
|
|
|
<input type="hidden" name="pmsg" value="', $context['pm_id'], '"> |
1466
|
|
|
<div class="cat_bar"> |
1467
|
|
|
<h3 class="catbg">', $txt['pm_report_title'], '</h3> |
1468
|
|
|
</div> |
1469
|
|
|
<div class="information"> |
1470
|
|
|
', $txt['pm_report_desc'], ' |
1471
|
|
|
</div> |
1472
|
|
|
<div class="windowbg"> |
1473
|
|
|
<dl class="settings">'; |
1474
|
|
|
|
1475
|
|
|
// If there is more than one admin on the forum, allow the user to choose the one they want to direct to. |
1476
|
|
|
// @todo Why? |
1477
|
|
|
if ($context['admin_count'] > 1) |
1478
|
|
|
{ |
1479
|
|
|
echo ' |
1480
|
|
|
<dt> |
1481
|
|
|
<strong>', $txt['pm_report_admins'], ':</strong> |
1482
|
|
|
</dt> |
1483
|
|
|
<dd> |
1484
|
|
|
<select name="id_admin"> |
1485
|
|
|
<option value="0">', $txt['pm_report_all_admins'], '</option>'; |
1486
|
|
|
foreach ($context['admins'] as $id => $name) |
1487
|
|
|
echo ' |
1488
|
|
|
<option value="', $id, '">', $name, '</option>'; |
1489
|
|
|
echo ' |
1490
|
|
|
</select> |
1491
|
|
|
</dd>'; |
1492
|
|
|
} |
1493
|
|
|
|
1494
|
|
|
echo ' |
1495
|
|
|
<dt> |
1496
|
|
|
<strong>', $txt['pm_report_reason'], ':</strong> |
1497
|
|
|
</dt> |
1498
|
|
|
<dd> |
1499
|
|
|
<textarea name="reason" rows="4" cols="70" style="width: 80%;"></textarea> |
1500
|
|
|
</dd> |
1501
|
|
|
</dl> |
1502
|
|
|
<div class="righttext"> |
1503
|
|
|
<input type="submit" name="report" value="', $txt['pm_report_message'], '" class="button_submit"> |
1504
|
|
|
</div> |
1505
|
|
|
</div> |
1506
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1507
|
|
|
</form>'; |
1508
|
|
|
} |
1509
|
|
|
|
1510
|
|
|
/** |
1511
|
|
|
* Little template just to say "Yep, it's been submitted" |
1512
|
|
|
*/ |
1513
|
|
|
function template_report_message_complete() |
1514
|
|
|
{ |
1515
|
|
|
global $context, $txt, $scripturl; |
1516
|
|
|
|
1517
|
|
|
echo ' |
1518
|
|
|
<div class="cat_bar"> |
1519
|
|
|
<h3 class="catbg">', $txt['pm_report_title'], '</h3> |
1520
|
|
|
</div> |
1521
|
|
|
<div class="windowbg"> |
1522
|
|
|
<p>', $txt['pm_report_done'], '</p> |
1523
|
|
|
<a href="', $scripturl, '?action=pm;l=', $context['current_label_id'], '">', $txt['pm_report_return'], '</a> |
1524
|
|
|
</div>'; |
1525
|
|
|
} |
1526
|
|
|
|
1527
|
|
|
/** |
1528
|
|
|
* Manage rules. |
1529
|
|
|
*/ |
1530
|
|
|
function template_rules() |
1531
|
|
|
{ |
1532
|
|
|
global $context, $txt, $scripturl; |
1533
|
|
|
|
1534
|
|
|
echo ' |
1535
|
|
|
<form action="', $scripturl, '?action=pm;sa=manrules" method="post" accept-charset="', $context['character_set'], '" name="manRules" id="manrules"> |
1536
|
|
|
<div class="cat_bar"> |
1537
|
|
|
<h3 class="catbg">', $txt['pm_manage_rules'], '</h3> |
1538
|
|
|
</div> |
1539
|
|
|
<div class="information"> |
1540
|
|
|
', $txt['pm_manage_rules_desc'], ' |
1541
|
|
|
</div> |
1542
|
|
|
<table class="table_grid"> |
1543
|
|
|
<thead> |
1544
|
|
|
<tr class="title_bar"> |
1545
|
|
|
<th class="lefttext"> |
1546
|
|
|
', $txt['pm_rule_title'], ' |
1547
|
|
|
</th> |
1548
|
|
|
<th class="centertext table_icon">'; |
1549
|
|
|
|
1550
|
|
|
if (!empty($context['rules'])) |
1551
|
|
|
echo ' |
1552
|
|
|
<input type="checkbox" onclick="invertAll(this, this.form);" class="input_check">'; |
1553
|
|
|
|
1554
|
|
|
echo ' |
1555
|
|
|
</th> |
1556
|
|
|
</tr> |
1557
|
|
|
</thead> |
1558
|
|
|
<tbody>'; |
1559
|
|
|
|
1560
|
|
|
if (empty($context['rules'])) |
1561
|
|
|
echo ' |
1562
|
|
|
<tr class="windowbg"> |
1563
|
|
|
<td colspan="2"> |
1564
|
|
|
', $txt['pm_rules_none'], ' |
1565
|
|
|
</td> |
1566
|
|
|
</tr>'; |
1567
|
|
|
|
1568
|
|
|
foreach ($context['rules'] as $rule) |
1569
|
|
|
{ |
1570
|
|
|
echo ' |
1571
|
|
|
<tr class="windowbg"> |
1572
|
|
|
<td> |
1573
|
|
|
<a href="', $scripturl, '?action=pm;sa=manrules;add;rid=', $rule['id'], '">', $rule['name'], '</a> |
1574
|
|
|
</td> |
1575
|
|
|
<td class="table_icon"> |
1576
|
|
|
<input type="checkbox" name="delrule[', $rule['id'], ']" class="input_check"> |
1577
|
|
|
</td> |
1578
|
|
|
</tr>'; |
1579
|
|
|
} |
1580
|
|
|
|
1581
|
|
|
echo ' |
1582
|
|
|
</tbody> |
1583
|
|
|
</table> |
1584
|
|
|
<div class="righttext"> |
1585
|
|
|
<a class="button_link" href="', $scripturl, '?action=pm;sa=manrules;add;rid=0">', $txt['pm_add_rule'], '</a>'; |
1586
|
|
|
|
1587
|
|
View Code Duplication |
if (!empty($context['rules'])) |
|
|
|
|
1588
|
|
|
echo ' |
1589
|
|
|
[<a href="', $scripturl, '?action=pm;sa=manrules;apply;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['pm_js_apply_rules_confirm'], '\');">', $txt['pm_apply_rules'], '</a>]'; |
1590
|
|
|
|
1591
|
|
View Code Duplication |
if (!empty($context['rules'])) |
|
|
|
|
1592
|
|
|
echo ' |
1593
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1594
|
|
|
<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button_submit smalltext you_sure">'; |
1595
|
|
|
|
1596
|
|
|
echo ' |
1597
|
|
|
</div> |
1598
|
|
|
</form>'; |
1599
|
|
|
|
1600
|
|
|
} |
1601
|
|
|
|
1602
|
|
|
/** |
1603
|
|
|
* Template for adding/editing a rule. |
1604
|
|
|
*/ |
1605
|
|
|
function template_add_rule() |
1606
|
|
|
{ |
1607
|
|
|
global $context, $txt, $scripturl; |
1608
|
|
|
|
1609
|
|
|
echo ' |
1610
|
|
|
<script> |
1611
|
|
|
var criteriaNum = 0; |
1612
|
|
|
var actionNum = 0; |
1613
|
|
|
var groups = new Array() |
1614
|
|
|
var labels = new Array()'; |
1615
|
|
|
|
1616
|
|
|
foreach ($context['groups'] as $id => $title) |
1617
|
|
|
echo ' |
1618
|
|
|
groups[', $id, '] = "', addslashes($title), '";'; |
1619
|
|
|
|
1620
|
|
View Code Duplication |
foreach ($context['labels'] as $label) |
|
|
|
|
1621
|
|
|
if ($label['id'] != -1) |
1622
|
|
|
echo ' |
1623
|
|
|
labels[', ($label['id']), '] = "', addslashes($label['name']), '";'; |
1624
|
|
|
|
1625
|
|
|
echo ' |
1626
|
|
|
function addCriteriaOption() |
1627
|
|
|
{ |
1628
|
|
|
if (criteriaNum == 0) |
1629
|
|
|
{ |
1630
|
|
|
for (var i = 0; i < document.forms.addrule.elements.length; i++) |
1631
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 8) == "ruletype") |
1632
|
|
|
criteriaNum++; |
1633
|
|
|
} |
1634
|
|
|
criteriaNum++ |
1635
|
|
|
|
1636
|
|
|
setOuterHTML(document.getElementById("criteriaAddHere"), \'<br><select name="ruletype[\' + criteriaNum + \']" id="ruletype\' + criteriaNum + \'" onchange="updateRuleDef(\' + criteriaNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_criteria_pick']), ':<\' + \'/option><option value="mid">', addslashes($txt['pm_rule_mid']), '<\' + \'/option><option value="gid">', addslashes($txt['pm_rule_gid']), '<\' + \'/option><option value="sub">', addslashes($txt['pm_rule_sub']), '<\' + \'/option><option value="msg">', addslashes($txt['pm_rule_msg']), '<\' + \'/option><option value="bud">', addslashes($txt['pm_rule_bud']), '<\' + \'/option><\' + \'/select> <span id="defdiv\' + criteriaNum + \'" style="display: none;"><input type="text" name="ruledef[\' + criteriaNum + \']" id="ruledef\' + criteriaNum + \'" onkeyup="rebuildRuleDesc();" value="" class="input_text"><\' + \'/span><span id="defseldiv\' + criteriaNum + \'" style="display: none;"><select name="ruledefgroup[\' + criteriaNum + \']" id="ruledefgroup\' + criteriaNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_group']), '<\' + \'/option>'; |
1637
|
|
|
|
1638
|
|
|
foreach ($context['groups'] as $id => $group) |
1639
|
|
|
echo '<option value="', $id, '">', strtr($group, array("'" => "\'")), '<\' + \'/option>'; |
1640
|
|
|
|
1641
|
|
|
echo '<\' + \'/select><\' + \'/span><span id="criteriaAddHere"><\' + \'/span>\'); |
1642
|
|
|
} |
1643
|
|
|
|
1644
|
|
|
function addActionOption() |
1645
|
|
|
{ |
1646
|
|
|
if (actionNum == 0) |
1647
|
|
|
{ |
1648
|
|
|
for (var i = 0; i < document.forms.addrule.elements.length; i++) |
1649
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 7) == "acttype") |
1650
|
|
|
actionNum++; |
1651
|
|
|
} |
1652
|
|
|
actionNum++ |
1653
|
|
|
|
1654
|
|
|
setOuterHTML(document.getElementById("actionAddHere"), \'<br><select name="acttype[\' + actionNum + \']" id="acttype\' + actionNum + \'" onchange="updateActionDef(\' + actionNum + \'); rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_action']), ':<\' + \'/option><option value="lab">', addslashes($txt['pm_rule_label']), '<\' + \'/option><option value="del">', addslashes($txt['pm_rule_delete']), '<\' + \'/option><\' + \'/select> <span id="labdiv\' + actionNum + \'" style="display: none;"><select name="labdef[\' + actionNum + \']" id="labdef\' + actionNum + \'" onchange="rebuildRuleDesc();"><option value="">', addslashes($txt['pm_rule_sel_label']), '<\' + \'/option>'; |
1655
|
|
|
|
1656
|
|
View Code Duplication |
foreach ($context['labels'] as $label) |
|
|
|
|
1657
|
|
|
if ($label['id'] != -1) |
1658
|
|
|
echo '<option value="', ($label['id']), '">', addslashes($label['name']), '<\' + \'/option>'; |
1659
|
|
|
|
1660
|
|
|
echo '<\' + \'/select><\' + \'/span><span id="actionAddHere"><\' + \'/span>\'); |
1661
|
|
|
} |
1662
|
|
|
|
1663
|
|
|
// Rebuild the rule description! |
1664
|
|
|
function rebuildRuleDesc() |
1665
|
|
|
{ |
1666
|
|
|
// Start with nothing. |
1667
|
|
|
var text = ""; |
1668
|
|
|
var joinText = ""; |
1669
|
|
|
var actionText = ""; |
1670
|
|
|
var hadBuddy = false; |
1671
|
|
|
var foundCriteria = false; |
1672
|
|
|
var foundAction = false; |
1673
|
|
|
var curNum, curVal, curDef; |
1674
|
|
|
|
1675
|
|
|
for (var i = 0; i < document.forms.addrule.elements.length; i++) |
1676
|
|
|
{ |
1677
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 8) == "ruletype") |
1678
|
|
|
{ |
1679
|
|
|
if (foundCriteria) |
1680
|
|
|
joinText = document.getElementById("logic").value == \'and\' ? ', JavaScriptEscape(' ' . $txt['pm_readable_and'] . ' '), ' : ', JavaScriptEscape(' ' . $txt['pm_readable_or'] . ' '), '; |
1681
|
|
|
else |
1682
|
|
|
joinText = \'\'; |
1683
|
|
|
foundCriteria = true; |
1684
|
|
|
|
1685
|
|
|
curNum = document.forms.addrule.elements[i].id.match(/\d+/); |
1686
|
|
|
curVal = document.forms.addrule.elements[i].value; |
1687
|
|
|
if (curVal == "gid") |
1688
|
|
|
curDef = document.getElementById("ruledefgroup" + curNum).value.php_htmlspecialchars(); |
1689
|
|
|
else if (curVal != "bud") |
1690
|
|
|
curDef = document.getElementById("ruledef" + curNum).value.php_htmlspecialchars(); |
1691
|
|
|
else |
1692
|
|
|
curDef = ""; |
1693
|
|
|
|
1694
|
|
|
// What type of test is this? |
1695
|
|
|
if (curVal == "mid" && curDef) |
1696
|
|
|
text += joinText + ', JavaScriptEscape($txt['pm_readable_member']), '.replace("{MEMBER}", curDef); |
1697
|
|
|
else if (curVal == "gid" && curDef && groups[curDef]) |
1698
|
|
|
text += joinText + ', JavaScriptEscape($txt['pm_readable_group']), '.replace("{GROUP}", groups[curDef]); |
1699
|
|
|
else if (curVal == "sub" && curDef) |
1700
|
|
|
text += joinText + ', JavaScriptEscape($txt['pm_readable_subject']), '.replace("{SUBJECT}", curDef); |
1701
|
|
|
else if (curVal == "msg" && curDef) |
1702
|
|
|
text += joinText + ', JavaScriptEscape($txt['pm_readable_body']), '.replace("{BODY}", curDef); |
1703
|
|
|
else if (curVal == "bud" && !hadBuddy) |
1704
|
|
|
{ |
1705
|
|
|
text += joinText + ', JavaScriptEscape($txt['pm_readable_buddy']), '; |
1706
|
|
|
hadBuddy = true; |
1707
|
|
|
} |
1708
|
|
|
} |
1709
|
|
|
if (document.forms.addrule.elements[i].id.substr(0, 7) == "acttype") |
1710
|
|
|
{ |
1711
|
|
|
if (foundAction) |
1712
|
|
|
joinText = ', JavaScriptEscape(' ' . $txt['pm_readable_and'] . ' '), '; |
1713
|
|
|
else |
1714
|
|
|
joinText = ""; |
1715
|
|
|
foundAction = true; |
1716
|
|
|
|
1717
|
|
|
curNum = document.forms.addrule.elements[i].id.match(/\d+/); |
1718
|
|
|
curVal = document.forms.addrule.elements[i].value; |
1719
|
|
|
if (curVal == "lab") |
1720
|
|
|
curDef = document.getElementById("labdef" + curNum).value.php_htmlspecialchars(); |
1721
|
|
|
else |
1722
|
|
|
curDef = ""; |
1723
|
|
|
|
1724
|
|
|
// Now pick the actions. |
1725
|
|
|
if (curVal == "lab" && curDef && labels[curDef]) |
1726
|
|
|
actionText += joinText + ', JavaScriptEscape($txt['pm_readable_label']), '.replace("{LABEL}", labels[curDef]); |
1727
|
|
|
else if (curVal == "del") |
1728
|
|
|
actionText += joinText + ', JavaScriptEscape($txt['pm_readable_delete']), '; |
1729
|
|
|
} |
1730
|
|
|
} |
1731
|
|
|
|
1732
|
|
|
// If still nothing make it default! |
1733
|
|
|
if (text == "" || !foundCriteria) |
1734
|
|
|
text = "', $txt['pm_rule_not_defined'], '"; |
1735
|
|
|
else |
1736
|
|
|
{ |
1737
|
|
|
if (actionText != "") |
1738
|
|
|
text += ', JavaScriptEscape(' ' . $txt['pm_readable_then'] . ' '), ' + actionText; |
1739
|
|
|
text = ', JavaScriptEscape($txt['pm_readable_start']), ' + text + ', JavaScriptEscape($txt['pm_readable_end']), '; |
1740
|
|
|
} |
1741
|
|
|
|
1742
|
|
|
// Set the actual HTML! |
1743
|
|
|
setInnerHTML(document.getElementById("ruletext"), text); |
1744
|
|
|
} |
1745
|
|
|
</script>'; |
1746
|
|
|
|
1747
|
|
|
echo ' |
1748
|
|
|
<form action="', $scripturl, '?action=pm;sa=manrules;save;rid=', $context['rid'], '" method="post" accept-charset="', $context['character_set'], '" name="addrule" id="addrule" class="flow_hidden"> |
1749
|
|
|
<div class="cat_bar"> |
1750
|
|
|
<h3 class="catbg">', $context['rid'] == 0 ? $txt['pm_add_rule'] : $txt['pm_edit_rule'], '</h3> |
1751
|
|
|
</div> |
1752
|
|
|
<div class="windowbg"> |
1753
|
|
|
<dl class="addrules"> |
1754
|
|
|
<dt class="floatleft"> |
1755
|
|
|
<strong>', $txt['pm_rule_name'], ':</strong><br> |
1756
|
|
|
<span class="smalltext">', $txt['pm_rule_name_desc'], '</span> |
1757
|
|
|
</dt> |
1758
|
|
|
<dd class="floatleft"> |
1759
|
|
|
<input type="text" name="rule_name" value="', empty($context['rule']['name']) ? $txt['pm_rule_name_default'] : $context['rule']['name'], '" size="50" class="input_text"> |
1760
|
|
|
</dd> |
1761
|
|
|
</dl> |
1762
|
|
|
<fieldset> |
1763
|
|
|
<legend>', $txt['pm_rule_criteria'], '</legend>'; |
1764
|
|
|
|
1765
|
|
|
// Add a dummy criteria to allow expansion for none js users. |
1766
|
|
|
$context['rule']['criteria'][] = array('t' => '', 'v' => ''); |
1767
|
|
|
|
1768
|
|
|
// For each criteria print it out. |
1769
|
|
|
$isFirst = true; |
1770
|
|
|
foreach ($context['rule']['criteria'] as $k => $criteria) |
1771
|
|
|
{ |
1772
|
|
View Code Duplication |
if (!$isFirst && $criteria['t'] == '') |
|
|
|
|
1773
|
|
|
echo '<div id="removeonjs1">'; |
1774
|
|
|
elseif (!$isFirst) |
1775
|
|
|
echo '<br>'; |
1776
|
|
|
|
1777
|
|
|
echo ' |
1778
|
|
|
<select name="ruletype[', $k, ']" id="ruletype', $k, '" onchange="updateRuleDef(', $k, '); rebuildRuleDesc();"> |
1779
|
|
|
<option value="">', $txt['pm_rule_criteria_pick'], ':</option>'; |
1780
|
|
|
|
1781
|
|
|
foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr) |
1782
|
|
|
echo ' |
1783
|
|
|
<option value="', $cr, '"', $criteria['t'] == $cr ? ' selected' : '', '>', $txt['pm_rule_' . $cr], '</option>'; |
1784
|
|
|
|
1785
|
|
|
echo ' |
1786
|
|
|
</select> |
1787
|
|
|
<span id="defdiv', $k, '" ', !in_array($criteria['t'], array('gid', 'bud')) ? '' : 'style="display: none;"', '> |
1788
|
|
|
<input type="text" name="ruledef[', $k, ']" id="ruledef', $k, '" onkeyup="rebuildRuleDesc();" value="', in_array($criteria['t'], array('mid', 'sub', 'msg')) ? $criteria['v'] : '', '" class="input_text"> |
1789
|
|
|
</span> |
1790
|
|
|
<span id="defseldiv', $k, '" ', $criteria['t'] == 'gid' ? '' : 'style="display: none;"', '> |
1791
|
|
|
<select name="ruledefgroup[', $k, ']" id="ruledefgroup', $k, '" onchange="rebuildRuleDesc();"> |
1792
|
|
|
<option value="">', $txt['pm_rule_sel_group'], '</option>'; |
1793
|
|
|
|
1794
|
|
|
foreach ($context['groups'] as $id => $group) |
1795
|
|
|
echo ' |
1796
|
|
|
<option value="', $id, '"', $criteria['t'] == 'gid' && $criteria['v'] == $id ? ' selected' : '', '>', $group, '</option>'; |
1797
|
|
|
echo ' |
1798
|
|
|
</select> |
1799
|
|
|
</span>'; |
1800
|
|
|
|
1801
|
|
|
// If this is the dummy we add a means to hide for non js users. |
1802
|
|
|
if ($isFirst) |
1803
|
|
|
$isFirst = false; |
1804
|
|
|
elseif ($criteria['t'] == '') |
1805
|
|
|
echo '</div>'; |
1806
|
|
|
} |
1807
|
|
|
|
1808
|
|
|
echo ' |
1809
|
|
|
<span id="criteriaAddHere"></span><br> |
1810
|
|
|
<a href="#" onclick="addCriteriaOption(); return false;" id="addonjs1" style="display: none;">(', $txt['pm_rule_criteria_add'], ')</a> |
1811
|
|
|
<br><br> |
1812
|
|
|
', $txt['pm_rule_logic'], ': |
1813
|
|
|
<select name="rule_logic" id="logic" onchange="rebuildRuleDesc();"> |
1814
|
|
|
<option value="and"', $context['rule']['logic'] == 'and' ? ' selected' : '', '>', $txt['pm_rule_logic_and'], '</option> |
1815
|
|
|
<option value="or"', $context['rule']['logic'] == 'or' ? ' selected' : '', '>', $txt['pm_rule_logic_or'], '</option> |
1816
|
|
|
</select> |
1817
|
|
|
</fieldset> |
1818
|
|
|
<fieldset> |
1819
|
|
|
<legend>', $txt['pm_rule_actions'], '</legend>'; |
1820
|
|
|
|
1821
|
|
|
// As with criteria - add a dummy action for "expansion". |
1822
|
|
|
$context['rule']['actions'][] = array('t' => '', 'v' => ''); |
1823
|
|
|
|
1824
|
|
|
// Print each action. |
1825
|
|
|
$isFirst = true; |
1826
|
|
|
foreach ($context['rule']['actions'] as $k => $action) |
1827
|
|
|
{ |
1828
|
|
View Code Duplication |
if (!$isFirst && $action['t'] == '') |
|
|
|
|
1829
|
|
|
echo '<div id="removeonjs2">'; |
1830
|
|
|
elseif (!$isFirst) |
1831
|
|
|
echo '<br>'; |
1832
|
|
|
|
1833
|
|
|
echo ' |
1834
|
|
|
<select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();"> |
1835
|
|
|
<option value="">', $txt['pm_rule_sel_action'] , ':</option> |
1836
|
|
|
<option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'] , '</option> |
1837
|
|
|
<option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'] , '</option> |
1838
|
|
|
</select> |
1839
|
|
|
<span id="labdiv', $k, '"> |
1840
|
|
|
<select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();"> |
1841
|
|
|
<option value="">', $txt['pm_rule_sel_label'], '</option>'; |
1842
|
|
|
foreach ($context['labels'] as $label) |
1843
|
|
|
if ($label['id'] != -1) |
1844
|
|
|
echo ' |
1845
|
|
|
<option value="', ($label['id']), '"', $action['t'] == 'lab' && $action['v'] == $label['id'] ? ' selected' : '', '>', $label['name'], '</option>'; |
1846
|
|
|
|
1847
|
|
|
echo ' |
1848
|
|
|
</select> |
1849
|
|
|
</span>'; |
1850
|
|
|
|
1851
|
|
|
if ($isFirst) |
1852
|
|
|
$isFirst = false; |
1853
|
|
|
elseif ($action['t'] == '') |
1854
|
|
|
echo ' |
1855
|
|
|
</div>'; |
1856
|
|
|
} |
1857
|
|
|
|
1858
|
|
|
echo ' |
1859
|
|
|
<span id="actionAddHere"></span><br> |
1860
|
|
|
<a href="#" onclick="addActionOption(); return false;" id="addonjs2" style="display: none;">(', $txt['pm_rule_add_action'], ')</a> |
1861
|
|
|
</fieldset> |
1862
|
|
|
<div class="cat_bar"> |
1863
|
|
|
<h3 class="catbg">', $txt['pm_rule_description'], '</h3> |
1864
|
|
|
</div> |
1865
|
|
|
<div class="information"> |
1866
|
|
|
<div id="ruletext">', $txt['pm_rule_js_disabled'], '</div> |
1867
|
|
|
</div> |
1868
|
|
|
<div class="righttext"> |
1869
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1870
|
|
|
<input type="submit" name="save" value="', $txt['pm_rule_save'], '" class="button_submit"> |
1871
|
|
|
</div> |
1872
|
|
|
</div> |
1873
|
|
|
</form>'; |
1874
|
|
|
|
1875
|
|
|
// Now setup all the bits! |
1876
|
|
|
echo ' |
1877
|
|
|
<script>'; |
1878
|
|
|
|
1879
|
|
|
foreach ($context['rule']['criteria'] as $k => $c) |
1880
|
|
|
echo ' |
1881
|
|
|
updateRuleDef(', $k, ');'; |
1882
|
|
|
|
1883
|
|
|
foreach ($context['rule']['actions'] as $k => $c) |
1884
|
|
|
echo ' |
1885
|
|
|
updateActionDef(', $k, ');'; |
1886
|
|
|
|
1887
|
|
|
echo ' |
1888
|
|
|
rebuildRuleDesc();'; |
1889
|
|
|
|
1890
|
|
|
// If this isn't a new rule and we have JS enabled remove the JS compatibility stuff. |
1891
|
|
|
if ($context['rid']) |
1892
|
|
|
echo ' |
1893
|
|
|
document.getElementById("removeonjs1").style.display = "none"; |
1894
|
|
|
document.getElementById("removeonjs2").style.display = "none";'; |
1895
|
|
|
|
1896
|
|
|
echo ' |
1897
|
|
|
document.getElementById("addonjs1").style.display = ""; |
1898
|
|
|
document.getElementById("addonjs2").style.display = "";'; |
1899
|
|
|
|
1900
|
|
|
echo ' |
1901
|
|
|
</script>'; |
1902
|
|
|
} |
1903
|
|
|
|
1904
|
|
|
/** |
1905
|
|
|
* Template for showing all of a user's PM drafts. |
1906
|
|
|
*/ |
1907
|
|
|
function template_showPMDrafts() |
1908
|
|
|
{ |
1909
|
|
|
global $context, $scripturl, $txt; |
1910
|
|
|
|
1911
|
|
|
echo ' |
1912
|
|
|
<div class="cat_bar"> |
1913
|
|
|
<h3 class="catbg"> |
1914
|
|
|
<span class="generic_icons inbox"></span> ', $txt['drafts_show'], ' |
1915
|
|
|
</h3> |
1916
|
|
|
</div> |
1917
|
|
|
<div class="pagesection"> |
1918
|
|
|
<span>', $context['page_index'], '</span> |
1919
|
|
|
</div>'; |
1920
|
|
|
|
1921
|
|
|
// No drafts? Just show an informative message. |
1922
|
|
|
if (empty($context['drafts'])) |
1923
|
|
|
echo ' |
1924
|
|
|
<div class="windowbg2 centertext"> |
1925
|
|
|
', $txt['draft_none'], ' |
1926
|
|
|
</div>'; |
1927
|
|
|
else |
1928
|
|
|
{ |
1929
|
|
|
// For every draft to be displayed, give it its own div, and show the important details of the draft. |
1930
|
|
|
foreach ($context['drafts'] as $draft) |
1931
|
|
|
{ |
1932
|
|
|
echo ' |
1933
|
|
|
<div class="windowbg"> |
1934
|
|
|
<div class="counter">', $draft['counter'], '</div> |
1935
|
|
|
<div class="topic_details"> |
1936
|
|
|
<h5><strong>', $draft['subject'], '</strong> '; |
1937
|
|
|
|
1938
|
|
|
echo ' |
1939
|
|
|
</h5> |
1940
|
|
|
<span class="smalltext">« <strong>', $txt['draft_saved_on'], ':</strong> ', sprintf($txt['draft_days_ago'], $draft['age']), (!empty($draft['remaining']) ? ', ' . sprintf($txt['draft_retain'], $draft['remaining']) : ''), '»</span><br> |
1941
|
|
|
<span class="smalltext">« <strong>', $txt['to'], ':</strong> ', implode(', ', $draft['recipients']['to']), ' »</span><br> |
1942
|
|
|
<span class="smalltext">« <strong>', $txt['pm_bcc'], ':</strong> ', implode(', ', $draft['recipients']['bcc']), ' »</span> |
1943
|
|
|
</div> |
1944
|
|
|
<div class="list_posts"> |
1945
|
|
|
', $draft['body'], ' |
1946
|
|
|
</div> |
1947
|
|
|
<ul class="quickbuttons"> |
1948
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;id_draft=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons modifybutton"></span>', $txt['draft_edit'], '</a></li> |
1949
|
|
|
<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'] ,'?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li> |
1950
|
|
|
</ul> |
1951
|
|
|
</div>'; |
1952
|
|
|
} |
1953
|
|
|
} |
1954
|
|
|
|
1955
|
|
|
// Show page numbers. |
1956
|
|
|
echo ' |
1957
|
|
|
<div class="pagesection"> |
1958
|
|
|
<span>', $context['page_index'], '</span> |
1959
|
|
|
</div>'; |
1960
|
|
|
} |
1961
|
|
|
|
1962
|
|
|
?> |
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.