1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Simple Machines Forum (SMF) |
4
|
|
|
* |
5
|
|
|
* @package SMF |
6
|
|
|
* @author Simple Machines http://www.simplemachines.org |
7
|
|
|
* @copyright 2018 Simple Machines and individual contributors |
8
|
|
|
* @license http://www.simplemachines.org/about/smf/license.php BSD |
9
|
|
|
* |
10
|
|
|
* @version 2.1 Beta 4 |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Minor stuff shown above the main profile - mostly used for error messages and showing that the profile update was successful. |
15
|
|
|
*/ |
16
|
|
|
function template_profile_above() |
17
|
|
|
{ |
18
|
|
|
global $context; |
|
|
|
|
19
|
|
|
|
20
|
|
|
// Prevent Chrome from auto completing fields when viewing/editing other members profiles |
21
|
|
|
if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
22
|
|
|
echo ' |
23
|
|
|
<script> |
24
|
|
|
disableAutoComplete(); |
25
|
|
|
</script>'; |
26
|
|
|
|
27
|
|
|
// If an error occurred while trying to save previously, give the user a clue! |
28
|
|
|
echo ' |
29
|
|
|
', template_error_message(); |
30
|
|
|
|
31
|
|
|
// If the profile was update successfully, let the user know this. |
32
|
|
|
if (!empty($context['profile_updated'])) |
33
|
|
|
echo ' |
34
|
|
|
<div class="infobox"> |
35
|
|
|
', $context['profile_updated'], ' |
36
|
|
|
</div>'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Template for any HTML needed below the profile (closing off divs/tables, etc.) |
41
|
|
|
*/ |
42
|
|
|
function template_profile_below() |
43
|
|
|
{ |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Template for showing off the spiffy popup of the menu |
48
|
|
|
*/ |
49
|
|
|
function template_profile_popup() |
50
|
|
|
{ |
51
|
|
|
global $context, $scripturl; |
|
|
|
|
52
|
|
|
|
53
|
|
|
// Unlike almost every other template, this is designed to be included into the HTML directly via $().load() |
54
|
|
|
|
55
|
|
|
echo ' |
56
|
|
|
<div class="profile_user_avatar floatleft"> |
57
|
|
|
<a href="', $scripturl, '?action=profile;u=', $context['user']['id'], '">', $context['member']['avatar']['image'], '</a> |
58
|
|
|
</div> |
59
|
|
|
<div class="profile_user_info floatleft"> |
60
|
|
|
<span class="profile_username"><a href="', $scripturl, '?action=profile;u=', $context['user']['id'], '">', $context['user']['name'], '</a></span> |
61
|
|
|
<span class="profile_group">', $context['member']['group'], '</span> |
62
|
|
|
</div> |
63
|
|
|
<div class="profile_user_links"> |
64
|
|
|
<ol>'; |
65
|
|
|
|
66
|
|
|
$menu_context = &$context[$context['profile_menu_name']]; |
67
|
|
|
foreach ($context['profile_items'] as $item) |
68
|
|
|
{ |
69
|
|
|
$area = &$menu_context['sections'][$item['menu']]['areas'][$item['area']]; |
70
|
|
|
$item_url = (isset($item['url']) ? $item['url'] : (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $item['area'])) . $menu_context['extra_parameters']; |
71
|
|
|
echo ' |
72
|
|
|
<li> |
73
|
|
|
', $area['icon'], '<a href="', $item_url, '">', !empty($item['title']) ? $item['title'] : $area['label'], '</a> |
74
|
|
|
</li>'; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
echo ' |
78
|
|
|
</ol> |
79
|
|
|
</div><!-- .profile_user_links -->'; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* The "popup" showing the user's alerts |
84
|
|
|
*/ |
85
|
|
|
function template_alerts_popup() |
86
|
|
|
{ |
87
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
88
|
|
|
|
89
|
|
|
// Unlike almost every other template, this is designed to be included into the HTML directly via $().load() |
90
|
|
|
echo ' |
91
|
|
|
<div class="alert_bar"> |
92
|
|
|
<div class="alerts_opts block"> |
93
|
|
|
<a href="' . $scripturl . '?action=profile;area=notification;sa=markread;', $context['session_var'], '=', $context['session_id'], '" onclick="return markAlertsRead(this)">', $txt['mark_alerts_read'], '</a> |
94
|
|
|
<a href="', $scripturl, '?action=profile;area=notification;sa=alerts" class="floatright">', $txt['alert_settings'], '</a> |
95
|
|
|
</div> |
96
|
|
|
<div class="alerts_box centertext"> |
97
|
|
|
<a href="', $scripturl, '?action=profile;area=showalerts" class="button">', $txt['all_alerts'], '</a> |
98
|
|
|
</div> |
99
|
|
|
</div> |
100
|
|
|
<div class="alerts_unread">'; |
101
|
|
|
|
102
|
|
|
if (empty($context['unread_alerts'])) |
103
|
|
|
template_alerts_all_read(); |
104
|
|
|
|
105
|
|
|
else |
106
|
|
|
{ |
107
|
|
|
foreach ($context['unread_alerts'] as $id_alert => $details) |
108
|
|
|
echo ' |
109
|
|
|
<div class="unread"> |
110
|
|
|
', !empty($details['sender']) ? $details['sender']['avatar']['image'] : '', ' |
111
|
|
|
<div class="details"> |
112
|
|
|
', !empty($details['icon']) ? $details['icon'] : '', '<span>', $details['text'], '</span> - ', $details['time'], ' |
113
|
|
|
</div> |
114
|
|
|
</div>'; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
echo ' |
118
|
|
|
</div><!-- .alerts_unread --> |
119
|
|
|
<script> |
120
|
|
|
function markAlertsRead(obj) { |
121
|
|
|
ajax_indicator(true); |
122
|
|
|
$.get( |
123
|
|
|
obj.href, |
124
|
|
|
function(data) { |
125
|
|
|
ajax_indicator(false); |
126
|
|
|
$("#alerts_menu_top span.amt").remove(); |
127
|
|
|
$("#alerts_menu div.alerts_unread").html(data); |
128
|
|
|
} |
129
|
|
|
); |
130
|
|
|
return false; |
131
|
|
|
} |
132
|
|
|
</script>'; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* A simple template to say "You don't have any unread alerts". |
137
|
|
|
*/ |
138
|
|
|
function template_alerts_all_read() |
139
|
|
|
{ |
140
|
|
|
global $txt; |
|
|
|
|
141
|
|
|
|
142
|
|
|
echo '<div class="no_unread">', $txt['alerts_no_unread'], '</div>'; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* This template displays a user's details without any option to edit them. |
147
|
|
|
*/ |
148
|
|
|
function template_summary() |
149
|
|
|
{ |
150
|
|
|
global $context, $settings, $scripturl, $modSettings, $txt; |
|
|
|
|
151
|
|
|
|
152
|
|
|
// Display the basic information about the user |
153
|
|
|
echo ' |
154
|
|
|
<div id="profileview" class="roundframe flow_auto noup"> |
155
|
|
|
<div id="basicinfo">'; |
156
|
|
|
|
157
|
|
|
// Are there any custom profile fields for above the name? |
158
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['above_member'])) |
159
|
|
|
{ |
160
|
|
|
$fields = ''; |
161
|
|
|
foreach ($context['print_custom_fields']['above_member'] as $field) |
162
|
|
|
if (!empty($field['output_html'])) |
163
|
|
|
$fields .= ' |
164
|
|
|
<li>' . $field['output_html'] . '</li>'; |
165
|
|
|
|
166
|
|
|
if (!empty($fields)) |
167
|
|
|
echo ' |
168
|
|
|
<div class="custom_fields_above_name"> |
169
|
|
|
<ul>', $fields, ' |
170
|
|
|
</ul> |
171
|
|
|
</div>'; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
echo ' |
175
|
|
|
<div class="username clear"> |
176
|
|
|
<h4>'; |
177
|
|
|
|
178
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['before_member'])) |
179
|
|
|
foreach ($context['print_custom_fields']['before_member'] as $field) |
180
|
|
|
if (!empty($field['output_html'])) |
181
|
|
|
echo ' |
182
|
|
|
<span>', $field['output_html'], '</span>'; |
183
|
|
|
|
184
|
|
|
echo ' |
185
|
|
|
', $context['member']['name']; |
186
|
|
|
|
187
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['after_member'])) |
188
|
|
|
foreach ($context['print_custom_fields']['after_member'] as $field) |
189
|
|
|
if (!empty($field['output_html'])) |
190
|
|
|
echo ' |
191
|
|
|
<span>', $field['output_html'], '</span>'; |
192
|
|
|
|
193
|
|
|
|
194
|
|
|
echo ' |
195
|
|
|
<span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span> |
196
|
|
|
</h4> |
197
|
|
|
</div> |
198
|
|
|
', $context['member']['avatar']['image']; |
199
|
|
|
|
200
|
|
|
// Are there any custom profile fields for below the avatar? |
201
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['below_avatar'])) |
202
|
|
|
{ |
203
|
|
|
$fields = ''; |
204
|
|
|
foreach ($context['print_custom_fields']['below_avatar'] as $field) |
205
|
|
|
if (!empty($field['output_html'])) |
206
|
|
|
$fields .= ' |
207
|
|
|
<li>' . $field['output_html'] . '</li>'; |
208
|
|
|
|
209
|
|
|
if (!empty($fields)) |
210
|
|
|
echo ' |
211
|
|
|
<div class="custom_fields_below_avatar"> |
212
|
|
|
<ul>', $fields, ' |
213
|
|
|
</ul> |
214
|
|
|
</div>'; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
echo ' |
218
|
|
|
<ul class="icon_fields clear">'; |
219
|
|
|
|
220
|
|
|
// Email is only visible if it's your profile or you have the moderate_forum permission |
221
|
|
View Code Duplication |
if ($context['member']['show_email']) |
222
|
|
|
echo ' |
223
|
|
|
<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
224
|
|
|
|
225
|
|
|
// Don't show an icon if they haven't specified a website. |
226
|
|
View Code Duplication |
if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
227
|
|
|
echo ' |
228
|
|
|
<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
229
|
|
|
|
230
|
|
|
// Are there any custom profile fields as icons? |
231
|
|
|
if (!empty($context['print_custom_fields']['icons'])) |
232
|
|
|
{ |
233
|
|
|
foreach ($context['print_custom_fields']['icons'] as $field) |
234
|
|
|
if (!empty($field['output_html'])) |
235
|
|
|
echo ' |
236
|
|
|
<li class="custom_field">', $field['output_html'], '</li>'; |
237
|
|
|
} |
238
|
|
|
|
239
|
|
|
echo ' |
240
|
|
|
</ul> |
241
|
|
|
<span id="userstatus"> |
242
|
|
|
', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
243
|
|
|
|
244
|
|
|
// Can they add this member as a buddy? |
245
|
|
|
if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
246
|
|
|
echo ' |
247
|
|
|
<br> |
248
|
|
|
<a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
249
|
|
|
|
250
|
|
|
echo ' |
251
|
|
|
</span>'; |
252
|
|
|
|
253
|
|
|
if (!$context['user']['is_owner'] && $context['can_send_pm']) |
254
|
|
|
echo ' |
255
|
|
|
<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
256
|
|
|
|
257
|
|
|
echo ' |
258
|
|
|
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
259
|
|
|
|
260
|
|
|
if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
261
|
|
|
echo ' |
262
|
|
|
<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
263
|
|
|
|
264
|
|
|
echo ' |
265
|
|
|
<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
266
|
|
|
|
267
|
|
|
// Are there any custom profile fields for bottom? |
268
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['bottom_poster'])) |
269
|
|
|
{ |
270
|
|
|
$fields = ''; |
271
|
|
|
foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
272
|
|
|
if (!empty($field['output_html'])) |
273
|
|
|
$fields .= ' |
274
|
|
|
<li>' . $field['output_html'] . '</li>'; |
275
|
|
|
|
276
|
|
|
if (!empty($fields)) |
277
|
|
|
echo ' |
278
|
|
|
<div class="custom_fields_bottom"> |
279
|
|
|
<ul class="nolist">', $fields, ' |
280
|
|
|
</ul> |
281
|
|
|
</div>'; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
echo ' |
285
|
|
|
</div><!-- #basicinfo --> |
286
|
|
|
|
287
|
|
|
<div id="detailedinfo"> |
288
|
|
|
<dl class="settings">'; |
289
|
|
|
|
290
|
|
|
if ($context['user']['is_owner'] || $context['user']['is_admin']) |
291
|
|
|
echo ' |
292
|
|
|
<dt>', $txt['username'], ': </dt> |
293
|
|
|
<dd>', $context['member']['username'], '</dd>'; |
294
|
|
|
|
295
|
|
|
if (!isset($context['disabled_fields']['posts'])) |
296
|
|
|
echo ' |
297
|
|
|
<dt>', $txt['profile_posts'], ': </dt> |
298
|
|
|
<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
299
|
|
|
|
300
|
|
View Code Duplication |
if ($context['member']['show_email']) |
301
|
|
|
echo ' |
302
|
|
|
<dt>', $txt['email'], ': </dt> |
303
|
|
|
<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
304
|
|
|
|
305
|
|
|
if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
306
|
|
|
echo ' |
307
|
|
|
<dt>', $txt['custom_title'], ': </dt> |
308
|
|
|
<dd>', $context['member']['title'], '</dd>'; |
309
|
|
|
|
310
|
|
|
if (!empty($context['member']['blurb'])) |
311
|
|
|
echo ' |
312
|
|
|
<dt>', $txt['personal_text'], ': </dt> |
313
|
|
|
<dd>', $context['member']['blurb'], '</dd>'; |
314
|
|
|
|
315
|
|
|
echo ' |
316
|
|
|
<dt>', $txt['age'], ':</dt> |
317
|
|
|
<dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' <img src="' . $settings['images_url'] . '/cake.png" alt="">' : ''), '</dd>'; |
318
|
|
|
|
319
|
|
|
echo ' |
320
|
|
|
</dl>'; |
321
|
|
|
|
322
|
|
|
// Any custom fields for standard placement? |
323
|
|
|
if (!empty($context['print_custom_fields']['standard'])) |
324
|
|
|
{ |
325
|
|
|
$fields = array(); |
326
|
|
|
|
327
|
|
|
foreach ($context['print_custom_fields']['standard'] as $field) |
328
|
|
|
if (!empty($field['output_html'])) |
329
|
|
|
$fields[] = $field; |
330
|
|
|
|
331
|
|
|
if (count($fields) > 0) |
332
|
|
|
{ |
333
|
|
|
echo ' |
334
|
|
|
<dl class="settings">'; |
335
|
|
|
|
336
|
|
|
foreach ($fields as $field) |
337
|
|
|
echo ' |
338
|
|
|
<dt>', $field['name'], ':</dt> |
339
|
|
|
<dd>', $field['output_html'], '</dd>'; |
340
|
|
|
|
341
|
|
|
echo ' |
342
|
|
|
</dl>'; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
echo ' |
348
|
|
|
<dl class="settings noborder">'; |
349
|
|
|
|
350
|
|
|
// Can they view/issue a warning? |
351
|
|
|
if ($context['can_view_warning'] && $context['member']['warning']) |
352
|
|
|
{ |
353
|
|
|
echo ' |
354
|
|
|
<dt>', $txt['profile_warning_level'], ': </dt> |
355
|
|
|
<dd> |
356
|
|
|
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
357
|
|
|
|
358
|
|
|
// Can we provide information on what this means? |
359
|
|
|
if (!empty($context['warning_status'])) |
360
|
|
|
echo ' |
361
|
|
|
<span class="smalltext">(', $context['warning_status'], ')</span>'; |
362
|
|
|
|
363
|
|
|
echo ' |
364
|
|
|
</dd>'; |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
// Is this member requiring activation and/or banned? |
368
|
|
|
if (!empty($context['activate_message']) || !empty($context['member']['bans'])) |
369
|
|
|
{ |
370
|
|
|
|
371
|
|
|
// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
372
|
|
|
if (!empty($context['activate_message'])) |
373
|
|
|
echo ' |
374
|
|
|
<dt class="clear"> |
375
|
|
|
<span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>) |
376
|
|
|
</dt>'; |
377
|
|
|
|
378
|
|
|
// If the current member is banned, show a message and possibly a link to the ban. |
379
|
|
|
if (!empty($context['member']['bans'])) |
380
|
|
|
{ |
381
|
|
|
echo ' |
382
|
|
|
<dt class="clear"> |
383
|
|
|
<span class="alert">', $txt['user_is_banned'], '</span> [<a href="#" onclick="document.getElementById(\'ban_info\').style.display = document.getElementById(\'ban_info\').style.display == \'none\' ? \'\' : \'none\';return false;">' . $txt['view_ban'] . '</a>] |
384
|
|
|
</dt> |
385
|
|
|
<dt class="clear" id="ban_info" style="display: none;"> |
386
|
|
|
<strong>', $txt['user_banned_by_following'], ':</strong>'; |
387
|
|
|
|
388
|
|
|
foreach ($context['member']['bans'] as $ban) |
389
|
|
|
echo ' |
390
|
|
|
<br> |
391
|
|
|
<span class="smalltext">', $ban['explanation'], '</span>'; |
392
|
|
|
|
393
|
|
|
echo ' |
394
|
|
|
</dt>'; |
395
|
|
|
} |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
echo ' |
399
|
|
|
<dt>', $txt['date_registered'], ': </dt> |
400
|
|
|
<dd>', $context['member']['registered'], '</dd>'; |
401
|
|
|
|
402
|
|
|
// If the person looking is allowed, they can check the members IP address and hostname. |
403
|
|
|
if ($context['can_see_ip']) |
404
|
|
|
{ |
405
|
|
|
if (!empty($context['member']['ip'])) |
406
|
|
|
echo ' |
407
|
|
|
<dt>', $txt['ip'], ': </dt> |
408
|
|
|
<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
409
|
|
|
|
410
|
|
|
if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
411
|
|
|
echo ' |
412
|
|
|
<dt>', $txt['hostname'], ': </dt> |
413
|
|
|
<dd>', $context['member']['hostname'], '</dd>'; |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
echo ' |
417
|
|
|
<dt>', $txt['local_time'], ':</dt> |
418
|
|
|
<dd>', $context['member']['local_time'], '</dd>'; |
419
|
|
|
|
420
|
|
|
if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
421
|
|
|
echo ' |
422
|
|
|
<dt>', $txt['language'], ':</dt> |
423
|
|
|
<dd>', $context['member']['language'], '</dd>'; |
424
|
|
|
|
425
|
|
|
if ($context['member']['show_last_login']) |
426
|
|
|
echo ' |
427
|
|
|
<dt>', $txt['lastLoggedIn'], ': </dt> |
428
|
|
|
<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
429
|
|
|
|
430
|
|
|
echo ' |
431
|
|
|
</dl>'; |
432
|
|
|
|
433
|
|
|
// Are there any custom profile fields for above the signature? |
434
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['above_signature'])) |
435
|
|
|
{ |
436
|
|
|
$fields = ''; |
437
|
|
|
foreach ($context['print_custom_fields']['above_signature'] as $field) |
438
|
|
|
if (!empty($field['output_html'])) |
439
|
|
|
$fields .= ' |
440
|
|
|
<li>' . $field['output_html'] . '</li>'; |
441
|
|
|
|
442
|
|
|
if (!empty($fields)) |
443
|
|
|
echo ' |
444
|
|
|
<div class="custom_fields_above_signature"> |
445
|
|
|
<ul class="nolist">', $fields, ' |
446
|
|
|
</ul> |
447
|
|
|
</div>'; |
448
|
|
|
} |
449
|
|
|
|
450
|
|
|
// Show the users signature. |
451
|
|
View Code Duplication |
if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
452
|
|
|
echo ' |
453
|
|
|
<div class="signature"> |
454
|
|
|
<h5>', $txt['signature'], ':</h5> |
455
|
|
|
', $context['member']['signature'], ' |
456
|
|
|
</div>'; |
457
|
|
|
|
458
|
|
|
// Are there any custom profile fields for below the signature? |
459
|
|
View Code Duplication |
if (!empty($context['print_custom_fields']['below_signature'])) |
460
|
|
|
{ |
461
|
|
|
$fields = ''; |
462
|
|
|
foreach ($context['print_custom_fields']['below_signature'] as $field) |
463
|
|
|
if (!empty($field['output_html'])) |
464
|
|
|
$fields .= ' |
465
|
|
|
<li>' . $field['output_html'] . '</li>'; |
466
|
|
|
|
467
|
|
|
if (!empty($fields)) |
468
|
|
|
echo ' |
469
|
|
|
<div class="custom_fields_below_signature"> |
470
|
|
|
<ul class="nolist">', $fields, ' |
471
|
|
|
</ul> |
472
|
|
|
</div>'; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
echo ' |
476
|
|
|
</div><!-- #detailedinfo --> |
477
|
|
|
</div><!-- #profileview -->'; |
478
|
|
|
} |
479
|
|
|
|
480
|
|
|
/** |
481
|
|
|
* Template for showing all the posts of the user, in chronological order. |
482
|
|
|
*/ |
483
|
|
|
function template_showPosts() |
484
|
|
|
{ |
485
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
486
|
|
|
|
487
|
|
|
echo ' |
488
|
|
|
<div class="cat_bar"> |
489
|
|
|
<h3 class="catbg"> |
490
|
|
|
', (!isset($context['attachments']) && empty($context['is_topics']) ? $txt['showMessages'] : (!empty($context['is_topics']) ? $txt['showTopics'] : $txt['showAttachments'])), ' - ', $context['member']['name'], ' |
491
|
|
|
</h3> |
492
|
|
|
</div>', !empty($context['page_index']) ? ' |
493
|
|
|
<div class="pagesection"> |
494
|
|
|
<div class="pagelinks">' . $context['page_index'] . '</div> |
495
|
|
|
</div>' : ''; |
496
|
|
|
|
497
|
|
|
// Are we displaying posts or attachments? |
498
|
|
|
if (!isset($context['attachments'])) |
499
|
|
|
{ |
500
|
|
|
// For every post to be displayed, give it its own div, and show the important details of the post. |
501
|
|
|
foreach ($context['posts'] as $post) |
502
|
|
|
{ |
503
|
|
|
echo ' |
504
|
|
|
<div class="', $post['css_class'], '"> |
505
|
|
|
<div class="counter">', $post['counter'], '</div> |
506
|
|
|
<div class="topic_details"> |
507
|
|
|
<h5> |
508
|
|
|
<strong><a href="', $scripturl, '?board=', $post['board']['id'], '.0">', $post['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $post['topic'], '.', $post['start'], '#msg', $post['id'], '">', $post['subject'], '</a></strong> |
509
|
|
|
</h5> |
510
|
|
|
<span class="smalltext">', $post['time'], '</span> |
511
|
|
|
</div> |
512
|
|
|
<div class="list_posts">'; |
513
|
|
|
|
514
|
|
|
if (!$post['approved']) |
515
|
|
|
echo ' |
516
|
|
|
<div class="approve_post"> |
517
|
|
|
<em>', $txt['post_awaiting_approval'], '</em> |
518
|
|
|
</div>'; |
519
|
|
|
|
520
|
|
|
echo ' |
521
|
|
|
', $post['body'], ' |
522
|
|
|
</div>'; |
523
|
|
|
|
524
|
|
|
if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
525
|
|
|
echo ' |
526
|
|
|
<div class="floatright"> |
527
|
|
|
<ul class="quickbuttons">'; |
528
|
|
|
|
529
|
|
|
// If they *can* reply? |
530
|
|
View Code Duplication |
if ($post['can_reply']) |
531
|
|
|
echo ' |
532
|
|
|
<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
533
|
|
|
|
534
|
|
|
// If they *can* quote? |
535
|
|
View Code Duplication |
if ($post['can_quote']) |
536
|
|
|
echo ' |
537
|
|
|
<li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
538
|
|
|
|
539
|
|
|
// How about... even... remove it entirely?! |
540
|
|
View Code Duplication |
if ($post['can_delete']) |
541
|
|
|
echo ' |
542
|
|
|
<li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
543
|
|
|
|
544
|
|
|
if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
545
|
|
|
echo ' |
546
|
|
|
</ul> |
547
|
|
|
</div><!-- .floatright -->'; |
548
|
|
|
|
549
|
|
|
echo ' |
550
|
|
|
</div><!-- $post[css_class] -->'; |
551
|
|
|
} |
552
|
|
|
} |
553
|
|
|
else |
554
|
|
|
template_show_list('attachments'); |
555
|
|
|
|
556
|
|
|
// No posts? Just end with a informative message. |
557
|
|
|
if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
558
|
|
|
echo ' |
559
|
|
|
<div class="windowbg2"> |
560
|
|
|
', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
561
|
|
|
</div>'; |
562
|
|
|
|
563
|
|
|
// Show more page numbers. |
564
|
|
|
if (!empty($context['page_index'])) |
565
|
|
|
echo ' |
566
|
|
|
<div class="pagesection"> |
567
|
|
|
<div class="pagelinks">', $context['page_index'], '</div> |
568
|
|
|
</div>'; |
569
|
|
|
} |
570
|
|
|
|
571
|
|
|
/** |
572
|
|
|
* Template for showing alerts within the alerts popup |
573
|
|
|
*/ |
574
|
|
|
function template_showAlerts() |
575
|
|
|
{ |
576
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
577
|
|
|
|
578
|
|
|
// Do we have an update message? |
579
|
|
|
if (!empty($context['update_message'])) |
580
|
|
|
echo ' |
581
|
|
|
<div class="infobox"> |
582
|
|
|
', $context['update_message'], ' |
583
|
|
|
</div>'; |
584
|
|
|
|
585
|
|
|
echo ' |
586
|
|
|
<div class="cat_bar"> |
587
|
|
|
<h3 class="catbg"> |
588
|
|
|
', $txt['alerts'], ' - ', $context['member']['name'], ' |
589
|
|
|
</h3> |
590
|
|
|
</div>'; |
591
|
|
|
|
592
|
|
|
if (empty($context['alerts'])) |
593
|
|
|
echo ' |
594
|
|
|
<div class="information"> |
595
|
|
|
', $txt['alerts_none'], ' |
596
|
|
|
</div>'; |
597
|
|
|
|
598
|
|
|
else |
599
|
|
|
{ |
600
|
|
|
// Start the form. |
601
|
|
|
echo ' |
602
|
|
|
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;save" method="post" accept-charset="', $context['character_set'], '" id="mark_all"> |
603
|
|
|
<table id="alerts" class="table_grid">'; |
604
|
|
|
|
605
|
|
|
foreach ($context['alerts'] as $id => $alert) |
606
|
|
|
{ |
607
|
|
|
echo ' |
608
|
|
|
<tr class="windowbg"> |
609
|
|
|
<td>', $alert['text'], '</td> |
610
|
|
|
<td>', $alert['time'], '</td> |
611
|
|
|
<td> |
612
|
|
|
<ul class="quickbuttons"> |
613
|
|
|
<li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=remove;aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['delete'], '</a></li> |
614
|
|
|
<li><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;do=', ($alert['is_read'] != 0 ? 'unread' : 'read'), ';aid=', $id, ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons ', $alert['is_read'] != 0 ? 'unread_button' : 'read_button', '"></span>', ($alert['is_read'] != 0 ? $txt['mark_unread'] : $txt['mark_read_short']), '</a></li> |
615
|
|
|
<li><input type="checkbox" name="mark[', $id, ']" value="', $id, '"></li> |
616
|
|
|
</ul> |
617
|
|
|
</td> |
618
|
|
|
</tr>'; |
619
|
|
|
} |
620
|
|
|
|
621
|
|
|
echo ' |
622
|
|
|
</table> |
623
|
|
|
<div class="pagesection"> |
624
|
|
|
<div class="floatleft"> |
625
|
|
|
', $context['pagination'], ' |
626
|
|
|
</div> |
627
|
|
|
<div class="floatright"> |
628
|
|
|
', $txt['check_all'], ': <input type="checkbox" name="select_all" id="select_all"> |
629
|
|
|
<select name="mark_as"> |
630
|
|
|
<option value="read">', $txt['quick_mod_markread'], '</option> |
631
|
|
|
<option value="unread">', $txt['quick_mod_markunread'], '</option> |
632
|
|
|
<option value="remove">', $txt['quick_mod_remove'], '</option> |
633
|
|
|
</select> |
634
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
635
|
|
|
<input type="submit" name="req" value="', $txt['quick_mod_go'], '" class="button you_sure"> |
636
|
|
|
</div> |
637
|
|
|
</div> |
638
|
|
|
</form>'; |
639
|
|
|
} |
640
|
|
|
} |
641
|
|
|
|
642
|
|
|
/** |
643
|
|
|
* Template for showing all of a user's drafts |
644
|
|
|
*/ |
645
|
|
|
function template_showDrafts() |
646
|
|
|
{ |
647
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
648
|
|
|
|
649
|
|
|
echo ' |
650
|
|
|
<div class="cat_bar"> |
651
|
|
|
<h3 class="catbg"> |
652
|
|
|
', $txt['drafts'], ' - ', $context['member']['name'], ' |
653
|
|
|
</h3> |
654
|
|
|
</div>', !empty($context['page_index']) ? ' |
655
|
|
|
<div class="pagesection"> |
656
|
|
|
<div class="pagelinks">' . $context['page_index'] . '</div> |
657
|
|
|
</div>' : ''; |
658
|
|
|
|
659
|
|
|
// No drafts? Just show an informative message. |
660
|
|
|
if (empty($context['drafts'])) |
661
|
|
|
echo ' |
662
|
|
|
<div class="windowbg2 centertext"> |
663
|
|
|
', $txt['draft_none'], ' |
664
|
|
|
</div>'; |
665
|
|
|
else |
666
|
|
|
{ |
667
|
|
|
// For every draft to be displayed, give it its own div, and show the important details of the draft. |
668
|
|
|
foreach ($context['drafts'] as $draft) |
669
|
|
|
{ |
670
|
|
|
echo ' |
671
|
|
|
<div class="windowbg"> |
672
|
|
|
<div class="counter">', $draft['counter'], '</div> |
673
|
|
|
<div class="topic_details"> |
674
|
|
|
<h5> |
675
|
|
|
<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
676
|
|
|
|
677
|
|
|
if (!empty($draft['sticky'])) |
678
|
|
|
echo ' |
679
|
|
|
<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
680
|
|
|
|
681
|
|
|
if (!empty($draft['locked'])) |
682
|
|
|
echo ' |
683
|
|
|
<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
684
|
|
|
|
685
|
|
|
echo ' |
686
|
|
|
</h5> |
687
|
|
|
<span class="smalltext">« <strong>', $txt['on'], ':</strong> ', $draft['time'], ' »</span> |
688
|
|
|
</div><!-- .topic_details --> |
689
|
|
|
<div class="list_posts"> |
690
|
|
|
', $draft['body'], ' |
691
|
|
|
</div> |
692
|
|
|
<div class="floatright"> |
693
|
|
|
<ul class="quickbuttons"> |
694
|
|
|
<li><a href="', $scripturl, '?action=post;', (empty($draft['topic']['id']) ? 'board=' . $draft['board']['id'] : 'topic=' . $draft['topic']['id']), '.0;id_draft=', $draft['id_draft'], '"><span class="generic_icons reply_button"></span>', $txt['draft_edit'], '</a></li> |
695
|
|
|
<li><a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=showdrafts;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> |
696
|
|
|
</ul> |
697
|
|
|
</div><!-- .floatright --> |
698
|
|
|
</div><!-- .windowbg -->'; |
699
|
|
|
} |
700
|
|
|
} |
701
|
|
|
|
702
|
|
|
// Show page numbers. |
703
|
|
|
echo ' |
704
|
|
|
<div class="pagesection"> |
705
|
|
|
<div class="pagelinks">', $context['page_index'], '</div> |
706
|
|
|
</div>'; |
707
|
|
|
} |
708
|
|
|
|
709
|
|
|
/** |
710
|
|
|
* Template for showing and managing the buddy list. |
711
|
|
|
*/ |
712
|
|
|
function template_editBuddies() |
713
|
|
|
{ |
714
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
715
|
|
|
|
716
|
|
View Code Duplication |
if (!empty($context['saved_successful'])) |
717
|
|
|
echo ' |
718
|
|
|
<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
719
|
|
|
|
720
|
|
|
elseif (!empty($context['saved_failed'])) |
721
|
|
|
echo ' |
722
|
|
|
<div class="errorbox">', $context['saved_failed'], '</div>'; |
723
|
|
|
|
724
|
|
|
echo ' |
725
|
|
|
<div id="edit_buddies"> |
726
|
|
|
<div class="cat_bar"> |
727
|
|
|
<h3 class="catbg"> |
728
|
|
|
<span class="generic_icons people icon"></span> ', $txt['editBuddies'], ' |
729
|
|
|
</h3> |
730
|
|
|
</div> |
731
|
|
|
<table class="table_grid"> |
732
|
|
|
<thead> |
733
|
|
|
<tr class="title_bar"> |
734
|
|
|
<th scope="col" class="quarter_table">', $txt['name'], '</th> |
735
|
|
|
<th scope="col">', $txt['status'], '</th>'; |
736
|
|
|
|
737
|
|
|
if (allowedTo('moderate_forum')) |
738
|
|
|
echo ' |
739
|
|
|
<th scope="col">', $txt['email'], '</th>'; |
740
|
|
|
|
741
|
|
View Code Duplication |
if (!empty($context['custom_pf'])) |
742
|
|
|
foreach ($context['custom_pf'] as $column) |
743
|
|
|
echo ' |
744
|
|
|
<th scope="col">', $column['label'], '</th>'; |
745
|
|
|
|
746
|
|
|
echo ' |
747
|
|
|
<th scope="col">', $txt['remove'], '</th> |
748
|
|
|
</tr> |
749
|
|
|
</thead> |
750
|
|
|
<tbody>'; |
751
|
|
|
|
752
|
|
|
// If they don't have any buddies don't list them! |
753
|
|
|
if (empty($context['buddies'])) |
754
|
|
|
echo ' |
755
|
|
|
<tr class="windowbg"> |
756
|
|
|
<td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"> |
757
|
|
|
<strong>', $txt['no_buddies'], '</strong> |
758
|
|
|
</td> |
759
|
|
|
</tr>'; |
760
|
|
|
|
761
|
|
|
// Now loop through each buddy showing info on each. |
762
|
|
|
else |
763
|
|
|
{ |
764
|
|
|
foreach ($context['buddies'] as $buddy) |
765
|
|
|
{ |
766
|
|
|
echo ' |
767
|
|
|
<tr class="windowbg"> |
768
|
|
|
<td>', $buddy['link'], '</td> |
769
|
|
|
<td> |
770
|
|
|
<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a> |
771
|
|
|
</td>'; |
772
|
|
|
|
773
|
|
View Code Duplication |
if ($buddy['show_email']) |
774
|
|
|
echo ' |
775
|
|
|
<td> |
776
|
|
|
<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a> |
777
|
|
|
</td>'; |
778
|
|
|
|
779
|
|
|
// Show the custom profile fields for this user. |
780
|
|
View Code Duplication |
if (!empty($context['custom_pf'])) |
781
|
|
|
foreach ($context['custom_pf'] as $key => $column) |
782
|
|
|
echo ' |
783
|
|
|
<td class="lefttext">', $buddy['options'][$key], '</td>'; |
784
|
|
|
|
785
|
|
|
echo ' |
786
|
|
|
<td> |
787
|
|
|
<a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['buddy_remove'], '"></span></a> |
788
|
|
|
</td> |
789
|
|
|
</tr>'; |
790
|
|
|
} |
791
|
|
|
} |
792
|
|
|
|
793
|
|
|
echo ' |
794
|
|
|
</tbody> |
795
|
|
|
</table> |
796
|
|
|
</div><!-- #edit_buddies -->'; |
797
|
|
|
|
798
|
|
|
// Add a new buddy? |
799
|
|
|
echo ' |
800
|
|
|
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=buddies" method="post" accept-charset="', $context['character_set'], '"> |
801
|
|
|
<div class="cat_bar"> |
802
|
|
|
<h3 class="catbg">', $txt['buddy_add'], '</h3> |
803
|
|
|
</div> |
804
|
|
|
<div class="information"> |
805
|
|
|
<dl class="settings"> |
806
|
|
|
<dt> |
807
|
|
|
<label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label> |
808
|
|
|
</dt> |
809
|
|
|
<dd> |
810
|
|
|
<input type="text" name="new_buddy" id="new_buddy" size="30"> |
811
|
|
|
<input type="submit" value="', $txt['buddy_add_button'], '" class="button floatnone"> |
812
|
|
|
</dd> |
813
|
|
|
</dl> |
814
|
|
|
</div>'; |
815
|
|
|
|
816
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
817
|
|
|
echo ' |
818
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
819
|
|
|
|
820
|
|
|
echo ' |
821
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
822
|
|
|
</form> |
823
|
|
|
<script> |
824
|
|
|
var oAddBuddySuggest = new smc_AutoSuggest({ |
825
|
|
|
sSelf: \'oAddBuddySuggest\', |
826
|
|
|
sSessionId: smf_session_id, |
827
|
|
|
sSessionVar: smf_session_var, |
828
|
|
|
sSuggestId: \'new_buddy\', |
829
|
|
|
sControlId: \'new_buddy\', |
830
|
|
|
sSearchType: \'member\', |
831
|
|
|
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', |
832
|
|
|
bItemList: false |
833
|
|
|
}); |
834
|
|
|
</script>'; |
835
|
|
|
} |
836
|
|
|
|
837
|
|
|
/** |
838
|
|
|
* Template for showing the ignore list of the current user. |
839
|
|
|
*/ |
840
|
|
|
function template_editIgnoreList() |
841
|
|
|
{ |
842
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
843
|
|
|
|
844
|
|
View Code Duplication |
if (!empty($context['saved_successful'])) |
845
|
|
|
echo ' |
846
|
|
|
<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
847
|
|
|
|
848
|
|
|
elseif (!empty($context['saved_failed'])) |
849
|
|
|
echo ' |
850
|
|
|
<div class="errorbox">', $context['saved_failed'], '</div>'; |
851
|
|
|
|
852
|
|
|
echo ' |
853
|
|
|
<div id="edit_buddies"> |
854
|
|
|
<div class="cat_bar"> |
855
|
|
|
<h3 class="catbg profile_hd"> |
856
|
|
|
', $txt['editIgnoreList'], ' |
857
|
|
|
</h3> |
858
|
|
|
</div> |
859
|
|
|
<table class="table_grid"> |
860
|
|
|
<thead> |
861
|
|
|
<tr class="title_bar"> |
862
|
|
|
<th scope="col" class="quarter_table">', $txt['name'], '</th> |
863
|
|
|
<th scope="col">', $txt['status'], '</th>'; |
864
|
|
|
|
865
|
|
|
if (allowedTo('moderate_forum')) |
866
|
|
|
echo ' |
867
|
|
|
<th scope="col">', $txt['email'], '</th>'; |
868
|
|
|
|
869
|
|
|
echo ' |
870
|
|
|
<th scope="col">', $txt['ignore_remove'], '</th> |
871
|
|
|
</tr> |
872
|
|
|
</thead> |
873
|
|
|
<tbody>'; |
874
|
|
|
|
875
|
|
|
// If they don't have anyone on their ignore list, don't list it! |
876
|
|
|
if (empty($context['ignore_list'])) |
877
|
|
|
echo ' |
878
|
|
|
<tr class="windowbg"> |
879
|
|
|
<td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"> |
880
|
|
|
<strong>', $txt['no_ignore'], '</strong> |
881
|
|
|
</td> |
882
|
|
|
</tr>'; |
883
|
|
|
|
884
|
|
|
// Now loop through each buddy showing info on each. |
885
|
|
|
foreach ($context['ignore_list'] as $member) |
886
|
|
|
{ |
887
|
|
|
echo ' |
888
|
|
|
<tr class="windowbg"> |
889
|
|
|
<td>', $member['link'], '</td> |
890
|
|
|
<td> |
891
|
|
|
<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a> |
892
|
|
|
</td>'; |
893
|
|
|
|
894
|
|
View Code Duplication |
if ($member['show_email']) |
895
|
|
|
echo ' |
896
|
|
|
<td> |
897
|
|
|
<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a> |
898
|
|
|
</td>'; |
899
|
|
|
echo ' |
900
|
|
|
<td> |
901
|
|
|
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a> |
902
|
|
|
</td> |
903
|
|
|
</tr>'; |
904
|
|
|
} |
905
|
|
|
|
906
|
|
|
echo ' |
907
|
|
|
</tbody> |
908
|
|
|
</table> |
909
|
|
|
</div><!-- #edit_buddies -->'; |
910
|
|
|
|
911
|
|
|
// Add to the ignore list? |
912
|
|
|
echo ' |
913
|
|
|
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore" method="post" accept-charset="', $context['character_set'], '"> |
914
|
|
|
<div class="cat_bar"> |
915
|
|
|
<h3 class="catbg">', $txt['ignore_add'], '</h3> |
916
|
|
|
</div> |
917
|
|
|
<div class="information"> |
918
|
|
|
<dl class="settings"> |
919
|
|
|
<dt> |
920
|
|
|
<label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label> |
921
|
|
|
</dt> |
922
|
|
|
<dd> |
923
|
|
|
<input type="text" name="new_ignore" id="new_ignore" size="25"> |
924
|
|
|
</dd> |
925
|
|
|
</dl> |
926
|
|
|
</div>'; |
927
|
|
|
|
928
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
929
|
|
|
echo ' |
930
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
931
|
|
|
|
932
|
|
|
echo ' |
933
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
934
|
|
|
<input type="submit" value="', $txt['ignore_add_button'], '" class="button"> |
935
|
|
|
</form> |
936
|
|
|
<script> |
937
|
|
|
var oAddIgnoreSuggest = new smc_AutoSuggest({ |
938
|
|
|
sSelf: \'oAddIgnoreSuggest\', |
939
|
|
|
sSessionId: \'', $context['session_id'], '\', |
940
|
|
|
sSessionVar: \'', $context['session_var'], '\', |
941
|
|
|
sSuggestId: \'new_ignore\', |
942
|
|
|
sControlId: \'new_ignore\', |
943
|
|
|
sSearchType: \'member\', |
944
|
|
|
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\', |
945
|
|
|
bItemList: false |
946
|
|
|
}); |
947
|
|
|
</script>'; |
948
|
|
|
} |
949
|
|
|
|
950
|
|
|
/** |
951
|
|
|
* This template shows an admin information on a users IP addresses used and errors attributed to them. |
952
|
|
|
*/ |
953
|
|
|
function template_trackActivity() |
954
|
|
|
{ |
955
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
956
|
|
|
|
957
|
|
|
// The first table shows IP information about the user. |
958
|
|
|
echo ' |
959
|
|
|
<div class="cat_bar"> |
960
|
|
|
<h3 class="catbg">', $txt['view_ips_by'], ' ', $context['member']['name'], '</h3> |
961
|
|
|
</div>'; |
962
|
|
|
|
963
|
|
|
// The last IP the user used. |
964
|
|
|
echo ' |
965
|
|
|
<div id="tracking" class="windowbg2 noup"> |
966
|
|
|
<dl class="settings noborder"> |
967
|
|
|
<dt> |
968
|
|
|
', $txt['most_recent_ip'], ': |
969
|
|
|
', (empty($context['last_ip2']) ? '' : '<br> |
970
|
|
|
<span class="smalltext">(<a href="' . $scripturl . '?action=helpadmin;help=whytwoip" onclick="return reqOverlayDiv(this.href);">' . $txt['why_two_ip_address'] . '</a>)</span>'), ' |
971
|
|
|
</dt> |
972
|
|
|
<dd> |
973
|
|
|
<a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
974
|
|
|
|
975
|
|
|
// Second address detected? |
976
|
|
View Code Duplication |
if (!empty($context['last_ip2'])) |
977
|
|
|
echo ' |
978
|
|
|
, <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
979
|
|
|
|
980
|
|
|
echo ' |
981
|
|
|
</dd>'; |
982
|
|
|
|
983
|
|
|
// Lists of IP addresses used in messages / error messages. |
984
|
|
|
echo ' |
985
|
|
|
<dt>', $txt['ips_in_messages'], ':</dt> |
986
|
|
|
<dd> |
987
|
|
|
', (count($context['ips']) > 0 ? implode(', ', $context['ips']) : '(' . $txt['none'] . ')'), ' |
988
|
|
|
</dd> |
989
|
|
|
<dt>', $txt['ips_in_errors'], ':</dt> |
990
|
|
|
<dd> |
991
|
|
|
', (count($context['error_ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), ' |
992
|
|
|
</dd>'; |
993
|
|
|
|
994
|
|
|
// List any members that have used the same IP addresses as the current member. |
995
|
|
|
echo ' |
996
|
|
|
<dt>', $txt['members_in_range'], ':</dt> |
997
|
|
|
<dd> |
998
|
|
|
', (count($context['members_in_range']) > 0 ? implode(', ', $context['members_in_range']) : '(' . $txt['none'] . ')'), ' |
999
|
|
|
</dd> |
1000
|
|
|
</dl> |
1001
|
|
|
</div><!-- #tracking -->'; |
1002
|
|
|
|
1003
|
|
|
// Show the track user list. |
1004
|
|
|
template_show_list('track_user_list'); |
1005
|
|
|
} |
1006
|
|
|
|
1007
|
|
|
/** |
1008
|
|
|
* The template for trackIP, allowing the admin to see where/who a certain IP has been used. |
1009
|
|
|
*/ |
1010
|
|
|
function template_trackIP() |
1011
|
|
|
{ |
1012
|
|
|
global $context, $txt; |
|
|
|
|
1013
|
|
|
|
1014
|
|
|
// This function always defaults to the last IP used by a member but can be set to track any IP. |
1015
|
|
|
// The first table in the template gives an input box to allow the admin to enter another IP to track. |
1016
|
|
|
echo ' |
1017
|
|
|
<div class="cat_bar"> |
1018
|
|
|
<h3 class="catbg">', $txt['trackIP'], '</h3> |
1019
|
|
|
</div> |
1020
|
|
|
<div class="windowbg2 noup"> |
1021
|
|
|
<form action="', $context['base_url'], '" method="post" accept-charset="', $context['character_set'], '"> |
1022
|
|
|
<dl class="settings"> |
1023
|
|
|
<dt> |
1024
|
|
|
<label for="searchip"><strong>', $txt['enter_ip'], ':</strong></label> |
1025
|
|
|
</dt> |
1026
|
|
|
<dd> |
1027
|
|
|
<input type="text" name="searchip" value="', $context['ip'], '"> |
1028
|
|
|
</dd> |
1029
|
|
|
</dl> |
1030
|
|
|
<input type="submit" value="', $txt['trackIP'], '" class="button"> |
1031
|
|
|
</form> |
1032
|
|
|
</div> |
1033
|
|
|
<br>'; |
1034
|
|
|
|
1035
|
|
|
// The table inbetween the first and second table shows links to the whois server for every region. |
1036
|
|
|
if ($context['single_ip']) |
1037
|
|
|
{ |
1038
|
|
|
echo ' |
1039
|
|
|
<div class="cat_bar"> |
1040
|
|
|
<h3 class="catbg">', $txt['whois_title'], ' ', $context['ip'], '</h3> |
1041
|
|
|
</div> |
1042
|
|
|
<div class="windowbg2 noup">'; |
1043
|
|
|
|
1044
|
|
|
foreach ($context['whois_servers'] as $server) |
1045
|
|
|
echo ' |
1046
|
|
|
<a href="', $server['url'], '" target="_blank" rel="noopener"', '>', $server['name'], '</a><br>'; |
1047
|
|
|
echo ' |
1048
|
|
|
</div> |
1049
|
|
|
<br>'; |
1050
|
|
|
} |
1051
|
|
|
|
1052
|
|
|
// The second table lists all the members who have been logged as using this IP address. |
1053
|
|
|
echo ' |
1054
|
|
|
<div class="cat_bar"> |
1055
|
|
|
<h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
1056
|
|
|
</div>'; |
1057
|
|
|
|
1058
|
|
|
if (empty($context['ips'])) |
1059
|
|
|
echo ' |
1060
|
|
|
<p class="windowbg2 description"> |
1061
|
|
|
<em>', $txt['no_members_from_ip'], '</em> |
1062
|
|
|
</p>'; |
1063
|
|
|
|
1064
|
|
|
else |
1065
|
|
|
{ |
1066
|
|
|
echo ' |
1067
|
|
|
<table class="table_grid"> |
1068
|
|
|
<thead> |
1069
|
|
|
<tr class="title_bar"> |
1070
|
|
|
<th scope="col">', $txt['ip_address'], '</th> |
1071
|
|
|
<th scope="col">', $txt['display_name'], '</th> |
1072
|
|
|
</tr> |
1073
|
|
|
</thead> |
1074
|
|
|
<tbody>'; |
1075
|
|
|
|
1076
|
|
|
// Loop through each of the members and display them. |
1077
|
|
|
foreach ($context['ips'] as $ip => $memberlist) |
1078
|
|
|
echo ' |
1079
|
|
|
<tr class="windowbg"> |
1080
|
|
|
<td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
1081
|
|
|
<td>', implode(', ', $memberlist), '</td> |
1082
|
|
|
</tr>'; |
1083
|
|
|
|
1084
|
|
|
echo ' |
1085
|
|
|
</tbody> |
1086
|
|
|
</table>'; |
1087
|
|
|
} |
1088
|
|
|
|
1089
|
|
|
echo ' |
1090
|
|
|
<br>'; |
1091
|
|
|
|
1092
|
|
|
template_show_list('track_message_list'); |
1093
|
|
|
|
1094
|
|
|
echo '<br>'; |
1095
|
|
|
|
1096
|
|
|
template_show_list('track_user_list'); |
1097
|
|
|
|
1098
|
|
|
// 3rd party integrations may have added additional tracking. |
1099
|
|
|
if (!empty($context['additional_track_lists'])) |
1100
|
|
|
{ |
1101
|
|
|
foreach ($context['additional_track_lists'] as $list) |
1102
|
|
|
{ |
1103
|
|
|
echo '<br>'; |
1104
|
|
|
|
1105
|
|
|
template_show_list($list); |
1106
|
|
|
} |
1107
|
|
|
} |
1108
|
|
|
} |
1109
|
|
|
|
1110
|
|
|
/** |
1111
|
|
|
* This template shows an admin which permissions a user have and which group(s) give them each permission. |
1112
|
|
|
*/ |
1113
|
|
|
function template_showPermissions() |
1114
|
|
|
{ |
1115
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
1116
|
|
|
|
1117
|
|
|
echo ' |
1118
|
|
|
<div class="cat_bar"> |
1119
|
|
|
<h3 class="catbg profile_hd"> |
1120
|
|
|
', $txt['showPermissions'], ' |
1121
|
|
|
</h3> |
1122
|
|
|
</div>'; |
1123
|
|
|
|
1124
|
|
|
if ($context['member']['has_all_permissions']) |
1125
|
|
|
echo ' |
1126
|
|
|
<div class="information">', $txt['showPermissions_all'], '</div>'; |
1127
|
|
|
|
1128
|
|
|
else |
1129
|
|
|
{ |
1130
|
|
|
echo ' |
1131
|
|
|
<div class="information">',$txt['showPermissions_help'], '</div> |
1132
|
|
|
<div id="permissions" class="flow_hidden">'; |
1133
|
|
|
|
1134
|
|
|
if (!empty($context['no_access_boards'])) |
1135
|
|
|
{ |
1136
|
|
|
echo ' |
1137
|
|
|
<div class="cat_bar"> |
1138
|
|
|
<h3 class="catbg">', $txt['showPermissions_restricted_boards'], '</h3> |
1139
|
|
|
</div> |
1140
|
|
|
<div class="windowbg smalltext"> |
1141
|
|
|
', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
1142
|
|
|
|
1143
|
|
|
foreach ($context['no_access_boards'] as $no_access_board) |
1144
|
|
|
echo ' |
1145
|
|
|
<a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
1146
|
|
|
echo ' |
1147
|
|
|
</div>'; |
1148
|
|
|
} |
1149
|
|
|
|
1150
|
|
|
// General Permissions section. |
1151
|
|
|
echo ' |
1152
|
|
|
<div class="tborder"> |
1153
|
|
|
<div class="cat_bar"> |
1154
|
|
|
<h3 class="catbg">', $txt['showPermissions_general'], '</h3> |
1155
|
|
|
</div>'; |
1156
|
|
View Code Duplication |
if (!empty($context['member']['permissions']['general'])) |
1157
|
|
|
{ |
1158
|
|
|
echo ' |
1159
|
|
|
<table class="table_grid"> |
1160
|
|
|
<thead> |
1161
|
|
|
<tr class="title_bar"> |
1162
|
|
|
<th class="lefttext half_table">', $txt['showPermissions_permission'], '</th> |
1163
|
|
|
<th class="lefttext half_table">', $txt['showPermissions_status'], '</th> |
1164
|
|
|
</tr> |
1165
|
|
|
</thead> |
1166
|
|
|
<tbody>'; |
1167
|
|
|
|
1168
|
|
|
foreach ($context['member']['permissions']['general'] as $permission) |
1169
|
|
|
{ |
1170
|
|
|
echo ' |
1171
|
|
|
<tr class="windowbg"> |
1172
|
|
|
<td title="', $permission['id'], '"> |
1173
|
|
|
', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], ' |
1174
|
|
|
</td> |
1175
|
|
|
<td class="smalltext">'; |
1176
|
|
|
|
1177
|
|
|
if ($permission['is_denied']) |
1178
|
|
|
echo ' |
1179
|
|
|
<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1180
|
|
|
else |
1181
|
|
|
echo ' |
1182
|
|
|
', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1183
|
|
|
|
1184
|
|
|
echo ' |
1185
|
|
|
</td> |
1186
|
|
|
</tr>'; |
1187
|
|
|
} |
1188
|
|
|
echo ' |
1189
|
|
|
</tbody> |
1190
|
|
|
</table> |
1191
|
|
|
</div><!-- .tborder --> |
1192
|
|
|
<br>'; |
1193
|
|
|
} |
1194
|
|
|
else |
1195
|
|
|
echo ' |
1196
|
|
|
<p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
1197
|
|
|
|
1198
|
|
|
// Board permission section. |
1199
|
|
|
echo ' |
1200
|
|
|
<form action="' . $scripturl . '?action=profile;u=', $context['id_member'], ';area=permissions#board_permissions" method="post" accept-charset="', $context['character_set'], '"> |
1201
|
|
|
<div class="cat_bar"> |
1202
|
|
|
<h3 class="catbg"> |
1203
|
|
|
<a id="board_permissions"></a>', $txt['showPermissions_select'], ': |
1204
|
|
|
<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
1205
|
|
|
<option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], '</option>'; |
1206
|
|
|
|
1207
|
|
|
if (!empty($context['boards'])) |
1208
|
|
|
echo ' |
1209
|
|
|
<option value="" disabled>---------------------------</option>'; |
1210
|
|
|
|
1211
|
|
|
// Fill the box with any local permission boards. |
1212
|
|
|
foreach ($context['boards'] as $board) |
1213
|
|
|
echo ' |
1214
|
|
|
<option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
1215
|
|
|
|
1216
|
|
|
echo ' |
1217
|
|
|
</select> |
1218
|
|
|
</h3> |
1219
|
|
|
</div><!-- .cat_bar --> |
1220
|
|
|
</form>'; |
1221
|
|
|
|
1222
|
|
View Code Duplication |
if (!empty($context['member']['permissions']['board'])) |
1223
|
|
|
{ |
1224
|
|
|
echo ' |
1225
|
|
|
<table class="table_grid"> |
1226
|
|
|
<thead> |
1227
|
|
|
<tr class="title_bar"> |
1228
|
|
|
<th class="lefttext half_table">', $txt['showPermissions_permission'], '</th> |
1229
|
|
|
<th class="lefttext half_table">', $txt['showPermissions_status'], '</th> |
1230
|
|
|
</tr> |
1231
|
|
|
</thead> |
1232
|
|
|
<tbody>'; |
1233
|
|
|
|
1234
|
|
|
foreach ($context['member']['permissions']['board'] as $permission) |
1235
|
|
|
{ |
1236
|
|
|
echo ' |
1237
|
|
|
<tr class="windowbg"> |
1238
|
|
|
<td title="', $permission['id'], '"> |
1239
|
|
|
', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], ' |
1240
|
|
|
</td> |
1241
|
|
|
<td class="smalltext">'; |
1242
|
|
|
|
1243
|
|
|
if ($permission['is_denied']) |
1244
|
|
|
echo ' |
1245
|
|
|
<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
1246
|
|
|
|
1247
|
|
|
else |
1248
|
|
|
echo ' |
1249
|
|
|
', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
1250
|
|
|
|
1251
|
|
|
echo ' |
1252
|
|
|
</td> |
1253
|
|
|
</tr>'; |
1254
|
|
|
} |
1255
|
|
|
echo ' |
1256
|
|
|
</tbody> |
1257
|
|
|
</table>'; |
1258
|
|
|
} |
1259
|
|
|
else |
1260
|
|
|
echo ' |
1261
|
|
|
<p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
1262
|
|
|
echo ' |
1263
|
|
|
</div><!-- #permissions -->'; |
1264
|
|
|
} |
1265
|
|
|
} |
1266
|
|
|
|
1267
|
|
|
/** |
1268
|
|
|
* Template for user statistics, showing graphs and the like. |
1269
|
|
|
*/ |
1270
|
|
|
function template_statPanel() |
1271
|
|
|
{ |
1272
|
|
|
global $context, $txt; |
|
|
|
|
1273
|
|
|
|
1274
|
|
|
// First, show a few text statistics such as post/topic count. |
1275
|
|
|
echo ' |
1276
|
|
|
<div id="profileview" class="roundframe"> |
1277
|
|
|
<div id="generalstats"> |
1278
|
|
|
<dl class="stats"> |
1279
|
|
|
<dt>', $txt['statPanel_total_time_online'], ':</dt> |
1280
|
|
|
<dd>', $context['time_logged_in'], '</dd> |
1281
|
|
|
<dt>', $txt['statPanel_total_posts'], ':</dt> |
1282
|
|
|
<dd>', $context['num_posts'], ' ', $txt['statPanel_posts'], '</dd> |
1283
|
|
|
<dt>', $txt['statPanel_total_topics'], ':</dt> |
1284
|
|
|
<dd>', $context['num_topics'], ' ', $txt['statPanel_topics'], '</dd> |
1285
|
|
|
<dt>', $txt['statPanel_users_polls'], ':</dt> |
1286
|
|
|
<dd>', $context['num_polls'], ' ', $txt['statPanel_polls'], '</dd> |
1287
|
|
|
<dt>', $txt['statPanel_users_votes'], ':</dt> |
1288
|
|
|
<dd>', $context['num_votes'], ' ', $txt['statPanel_votes'], '</dd> |
1289
|
|
|
</dl> |
1290
|
|
|
</div>'; |
1291
|
|
|
|
1292
|
|
|
// This next section draws a graph showing what times of day they post the most. |
1293
|
|
|
echo ' |
1294
|
|
|
<div id="activitytime" class="flow_hidden"> |
1295
|
|
|
<div class="title_bar"> |
1296
|
|
|
<h3 class="titlebg"> |
1297
|
|
|
<span class="generic_icons history"></span> ', $txt['statPanel_activityTime'], ' |
1298
|
|
|
</h3> |
1299
|
|
|
</div>'; |
1300
|
|
|
|
1301
|
|
|
// If they haven't post at all, don't draw the graph. |
1302
|
|
|
if (empty($context['posts_by_time'])) |
1303
|
|
|
echo ' |
1304
|
|
|
<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1305
|
|
|
|
1306
|
|
|
// Otherwise do! |
1307
|
|
|
else |
1308
|
|
|
{ |
1309
|
|
|
echo ' |
1310
|
|
|
<ul class="activity_stats flow_hidden">'; |
1311
|
|
|
|
1312
|
|
|
// The labels. |
1313
|
|
|
foreach ($context['posts_by_time'] as $time_of_day) |
1314
|
|
|
echo ' |
1315
|
|
|
<li', $time_of_day['is_last'] ? ' class="last"' : '', '> |
1316
|
|
|
<div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '"> |
1317
|
|
|
<div style="height: ', (int) $time_of_day['relative_percent'], 'px;"> |
1318
|
|
|
<span>', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '</span> |
1319
|
|
|
</div> |
1320
|
|
|
</div> |
1321
|
|
|
<span class="stats_hour">', $time_of_day['hour_format'], '</span> |
1322
|
|
|
</li>'; |
1323
|
|
|
|
1324
|
|
|
echo ' |
1325
|
|
|
</ul>'; |
1326
|
|
|
} |
1327
|
|
|
|
1328
|
|
|
echo ' |
1329
|
|
|
</div><!-- #activitytime -->'; |
1330
|
|
|
|
1331
|
|
|
// Two columns with the most popular boards by posts and activity (activity = users posts / total posts). |
1332
|
|
|
echo ' |
1333
|
|
|
<div class="flow_hidden"> |
1334
|
|
|
<div class="half_content"> |
1335
|
|
|
<div class="title_bar"> |
1336
|
|
|
<h3 class="titlebg"> |
1337
|
|
|
<span class="generic_icons replies"></span> ', $txt['statPanel_topBoards'], ' |
1338
|
|
|
</h3> |
1339
|
|
|
</div>'; |
1340
|
|
|
|
1341
|
|
View Code Duplication |
if (empty($context['popular_boards'])) |
1342
|
|
|
echo ' |
1343
|
|
|
<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1344
|
|
|
|
1345
|
|
|
else |
1346
|
|
|
{ |
1347
|
|
|
echo ' |
1348
|
|
|
<dl class="stats">'; |
1349
|
|
|
|
1350
|
|
|
// Draw a bar for every board. |
1351
|
|
|
foreach ($context['popular_boards'] as $board) |
1352
|
|
|
{ |
1353
|
|
|
echo ' |
1354
|
|
|
<dt>', $board['link'], '</dt> |
1355
|
|
|
<dd> |
1356
|
|
|
<div class="profile_pie" style="background-position: -', ((int) ($board['posts_percent'] / 5) * 20), 'px 0;" title="', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '"> |
1357
|
|
|
', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), ' |
1358
|
|
|
</div> |
1359
|
|
|
', empty($context['hide_num_posts']) ? $board['posts'] : '', ' |
1360
|
|
|
</dd>'; |
1361
|
|
|
} |
1362
|
|
|
|
1363
|
|
|
echo ' |
1364
|
|
|
</dl>'; |
1365
|
|
|
} |
1366
|
|
|
echo ' |
1367
|
|
|
</div><!-- .half_content --> |
1368
|
|
|
<div class="half_content"> |
1369
|
|
|
<div class="title_bar"> |
1370
|
|
|
<h3 class="titlebg"> |
1371
|
|
|
<span class="generic_icons replies"></span> ', $txt['statPanel_topBoardsActivity'], ' |
1372
|
|
|
</h3> |
1373
|
|
|
</div>'; |
1374
|
|
|
|
1375
|
|
View Code Duplication |
if (empty($context['board_activity'])) |
1376
|
|
|
echo ' |
1377
|
|
|
<p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
1378
|
|
|
else |
1379
|
|
|
{ |
1380
|
|
|
echo ' |
1381
|
|
|
<dl class="stats">'; |
1382
|
|
|
|
1383
|
|
|
// Draw a bar for every board. |
1384
|
|
|
foreach ($context['board_activity'] as $activity) |
1385
|
|
|
{ |
1386
|
|
|
echo ' |
1387
|
|
|
<dt>', $activity['link'], '</dt> |
1388
|
|
|
<dd> |
1389
|
|
|
<div class="profile_pie" style="background-position: -', ((int) ($activity['percent'] / 5) * 20), 'px 0;" title="', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '"> |
1390
|
|
|
', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), ' |
1391
|
|
|
</div> |
1392
|
|
|
', $activity['percent'], '% |
1393
|
|
|
</dd>'; |
1394
|
|
|
} |
1395
|
|
|
|
1396
|
|
|
echo ' |
1397
|
|
|
</dl>'; |
1398
|
|
|
} |
1399
|
|
|
echo ' |
1400
|
|
|
</div><!-- .half_content --> |
1401
|
|
|
</div><!-- .flow_hidden -->'; |
1402
|
|
|
|
1403
|
|
|
echo ' |
1404
|
|
|
</div><!-- #profileview -->'; |
1405
|
|
|
} |
1406
|
|
|
|
1407
|
|
|
/** |
1408
|
|
|
* Template for editing profile options. |
1409
|
|
|
*/ |
1410
|
|
|
function template_edit_options() |
1411
|
|
|
{ |
1412
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
|
|
|
1413
|
|
|
|
1414
|
|
|
// The main header! |
1415
|
|
|
// because some browsers ignore autocomplete=off and fill username in display name and/ or email field, fake them out. |
1416
|
|
|
$url = !empty($context['profile_custom_submit_url']) ? $context['profile_custom_submit_url'] : $scripturl . '?action=profile;area=' . $context['menu_item_selected'] . ';u=' . $context['id_member']; |
1417
|
|
|
$url = $context['require_password'] && !empty($modSettings['force_ssl']) ? strtr($url, array('http://' => 'https://')) : $url; |
1418
|
|
|
|
1419
|
|
|
echo ' |
1420
|
|
|
<form action="', $url, '" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator" enctype="multipart/form-data"', ($context['menu_item_selected'] == 'account' ? ' autocomplete="off"' : ''), '> |
1421
|
|
|
<div style="position:absolute; left:-3000px;"> |
1422
|
|
|
<input type="text" id="autocompleteFakeName"> |
1423
|
|
|
<input type="password" id="autocompleteFakePassword"> |
1424
|
|
|
</div> |
1425
|
|
|
<div class="cat_bar"> |
1426
|
|
|
<h3 class="catbg profile_hd">'; |
1427
|
|
|
|
1428
|
|
|
// Don't say "Profile" if this isn't the profile... |
1429
|
|
|
if (!empty($context['profile_header_text'])) |
1430
|
|
|
echo ' |
1431
|
|
|
', $context['profile_header_text']; |
1432
|
|
|
else |
1433
|
|
|
echo ' |
1434
|
|
|
', $txt['profile']; |
1435
|
|
|
|
1436
|
|
|
echo ' |
1437
|
|
|
</h3> |
1438
|
|
|
</div>'; |
1439
|
|
|
|
1440
|
|
|
// Have we some description? |
1441
|
|
|
if ($context['page_desc']) |
1442
|
|
|
echo ' |
1443
|
|
|
<p class="information">', $context['page_desc'], '</p>'; |
1444
|
|
|
|
1445
|
|
|
echo ' |
1446
|
|
|
<div class="roundframe">'; |
1447
|
|
|
|
1448
|
|
|
// Any bits at the start? |
1449
|
|
|
if (!empty($context['profile_prehtml'])) |
1450
|
|
|
echo ' |
1451
|
|
|
<div>', $context['profile_prehtml'], '</div>'; |
1452
|
|
|
|
1453
|
|
|
if (!empty($context['profile_fields'])) |
1454
|
|
|
echo ' |
1455
|
|
|
<dl class="settings">'; |
1456
|
|
|
|
1457
|
|
|
// Start the big old loop 'of love. |
1458
|
|
|
$lastItem = 'hr'; |
1459
|
|
|
foreach ($context['profile_fields'] as $key => $field) |
1460
|
|
|
{ |
1461
|
|
|
// We add a little hack to be sure we never get more than one hr in a row! |
1462
|
|
|
if ($lastItem == 'hr' && $field['type'] == 'hr') |
1463
|
|
|
continue; |
1464
|
|
|
|
1465
|
|
|
$lastItem = $field['type']; |
1466
|
|
|
if ($field['type'] == 'hr') |
1467
|
|
|
echo ' |
1468
|
|
|
</dl> |
1469
|
|
|
<hr> |
1470
|
|
|
<dl class="settings">'; |
1471
|
|
|
|
1472
|
|
View Code Duplication |
elseif ($field['type'] == 'callback') |
1473
|
|
|
{ |
1474
|
|
|
if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
1475
|
|
|
{ |
1476
|
|
|
$callback_func = 'template_profile_' . $field['callback_func']; |
1477
|
|
|
$callback_func(); |
1478
|
|
|
} |
1479
|
|
|
} |
1480
|
|
|
else |
1481
|
|
|
{ |
1482
|
|
|
echo ' |
1483
|
|
|
<dt> |
1484
|
|
|
<strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
1485
|
|
|
|
1486
|
|
|
// Does it have any subtext to show? |
1487
|
|
|
if (!empty($field['subtext'])) |
1488
|
|
|
echo ' |
1489
|
|
|
<br> |
1490
|
|
|
<span class="smalltext">', $field['subtext'], '</span>'; |
1491
|
|
|
|
1492
|
|
|
echo ' |
1493
|
|
|
</dt> |
1494
|
|
|
<dd>'; |
1495
|
|
|
|
1496
|
|
|
// Want to put something infront of the box? |
1497
|
|
|
if (!empty($field['preinput'])) |
1498
|
|
|
echo ' |
1499
|
|
|
', $field['preinput']; |
1500
|
|
|
|
1501
|
|
|
// What type of data are we showing? |
1502
|
|
|
if ($field['type'] == 'label') |
1503
|
|
|
echo ' |
1504
|
|
|
', $field['value']; |
1505
|
|
|
|
1506
|
|
|
// Maybe it's a text box - very likely! |
1507
|
|
|
elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
1508
|
|
|
{ |
1509
|
|
|
if ($field['type'] == 'int' || $field['type'] == 'float') |
1510
|
|
|
$type = 'number'; |
1511
|
|
|
else |
1512
|
|
|
$type = $field['type']; |
1513
|
|
|
$step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
1514
|
|
|
|
1515
|
|
|
|
1516
|
|
|
echo ' |
1517
|
|
|
<input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' ', $step, '>'; |
1518
|
|
|
} |
1519
|
|
|
// You "checking" me out? ;) |
1520
|
|
View Code Duplication |
elseif ($field['type'] == 'check') |
1521
|
|
|
echo ' |
1522
|
|
|
<input type="hidden" name="', $key, '" value="0"> |
1523
|
|
|
<input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" ', $field['input_attr'], '>'; |
1524
|
|
|
|
1525
|
|
|
// Always fun - select boxes! |
1526
|
|
View Code Duplication |
elseif ($field['type'] == 'select') |
1527
|
|
|
{ |
1528
|
|
|
echo ' |
1529
|
|
|
<select name="', $key, '" id="', $key, '">'; |
1530
|
|
|
|
1531
|
|
|
if (isset($field['options'])) |
1532
|
|
|
{ |
1533
|
|
|
// Is this some code to generate the options? |
1534
|
|
|
if (!is_array($field['options'])) |
1535
|
|
|
$field['options'] = $field['options'](); |
1536
|
|
|
|
1537
|
|
|
// Assuming we now have some! |
1538
|
|
|
if (is_array($field['options'])) |
1539
|
|
|
foreach ($field['options'] as $value => $name) |
1540
|
|
|
echo ' |
1541
|
|
|
<option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
1542
|
|
|
} |
1543
|
|
|
|
1544
|
|
|
echo ' |
1545
|
|
|
</select>'; |
1546
|
|
|
} |
1547
|
|
|
|
1548
|
|
|
// Something to end with? |
1549
|
|
|
if (!empty($field['postinput'])) |
1550
|
|
|
echo ' |
1551
|
|
|
', $field['postinput']; |
1552
|
|
|
|
1553
|
|
|
echo ' |
1554
|
|
|
</dd>'; |
1555
|
|
|
} |
1556
|
|
|
} |
1557
|
|
|
|
1558
|
|
|
if (!empty($context['profile_fields'])) |
1559
|
|
|
echo ' |
1560
|
|
|
</dl>'; |
1561
|
|
|
|
1562
|
|
|
// Are there any custom profile fields - if so print them! |
1563
|
|
|
if (!empty($context['custom_fields'])) |
1564
|
|
|
{ |
1565
|
|
|
if ($lastItem != 'hr') |
1566
|
|
|
echo ' |
1567
|
|
|
<hr>'; |
1568
|
|
|
|
1569
|
|
|
echo ' |
1570
|
|
|
<dl class="settings">'; |
1571
|
|
|
|
1572
|
|
|
foreach ($context['custom_fields'] as $field) |
1573
|
|
|
echo ' |
1574
|
|
|
<dt> |
1575
|
|
|
<strong>', $field['name'], ': </strong><br> |
1576
|
|
|
<span class="smalltext">', $field['desc'], '</span> |
1577
|
|
|
</dt> |
1578
|
|
|
<dd> |
1579
|
|
|
', $field['input_html'], ' |
1580
|
|
|
</dd>'; |
1581
|
|
|
|
1582
|
|
|
echo ' |
1583
|
|
|
</dl>'; |
1584
|
|
|
|
1585
|
|
|
} |
1586
|
|
|
|
1587
|
|
|
// Any closing HTML? |
1588
|
|
|
if (!empty($context['profile_posthtml'])) |
1589
|
|
|
echo ' |
1590
|
|
|
<div>', $context['profile_posthtml'], '</div>'; |
1591
|
|
|
|
1592
|
|
|
// Only show the password box if it's actually needed. |
1593
|
|
View Code Duplication |
if ($context['require_password']) |
1594
|
|
|
echo ' |
1595
|
|
|
<dl class="settings"> |
1596
|
|
|
<dt> |
1597
|
|
|
<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
1598
|
|
|
<span class="smalltext">', $txt['required_security_reasons'], '</span> |
1599
|
|
|
</dt> |
1600
|
|
|
<dd> |
1601
|
|
|
<input type="password" name="oldpasswrd" id="oldpasswrd" size="20"> |
1602
|
|
|
</dd> |
1603
|
|
|
</dl>'; |
1604
|
|
|
|
1605
|
|
|
// The button shouldn't say "Change profile" unless we're changing the profile... |
1606
|
|
|
if (!empty($context['submit_button_text'])) |
1607
|
|
|
echo ' |
1608
|
|
|
<input type="submit" name="save" value="', $context['submit_button_text'], '" class="button floatright">'; |
1609
|
|
|
else |
1610
|
|
|
echo ' |
1611
|
|
|
<input type="submit" name="save" value="', $txt['change_profile'], '" class="button floatright">'; |
1612
|
|
|
|
1613
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
1614
|
|
|
echo ' |
1615
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
1616
|
|
|
|
1617
|
|
|
echo ' |
1618
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
1619
|
|
|
<input type="hidden" name="u" value="', $context['id_member'], '"> |
1620
|
|
|
<input type="hidden" name="sa" value="', $context['menu_item_selected'], '"> |
1621
|
|
|
</div><!-- .roundframe --> |
1622
|
|
|
</form>'; |
1623
|
|
|
|
1624
|
|
|
// Any final spellchecking stuff? |
1625
|
|
|
if (!empty($context['show_spellchecking'])) |
1626
|
|
|
echo ' |
1627
|
|
|
<form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
1628
|
|
|
} |
1629
|
|
|
|
1630
|
|
|
/** |
1631
|
|
|
* Personal Message settings. |
1632
|
|
|
*/ |
1633
|
|
|
function template_profile_pm_settings() |
1634
|
|
|
{ |
1635
|
|
|
global $context, $modSettings, $txt; |
|
|
|
|
1636
|
|
|
|
1637
|
|
|
echo ' |
1638
|
|
|
<dt> |
1639
|
|
|
<label for="pm_prefs">', $txt['pm_display_mode'], ':</label> |
1640
|
|
|
</dt> |
1641
|
|
|
<dd> |
1642
|
|
|
<select name="pm_prefs" id="pm_prefs"> |
1643
|
|
|
<option value="0"', $context['display_mode'] == 0 ? ' selected' : '', '>', $txt['pm_display_mode_all'], '</option> |
1644
|
|
|
<option value="1"', $context['display_mode'] == 1 ? ' selected' : '', '>', $txt['pm_display_mode_one'], '</option> |
1645
|
|
|
<option value="2"', $context['display_mode'] == 2 ? ' selected' : '', '>', $txt['pm_display_mode_linked'], '</option> |
1646
|
|
|
</select> |
1647
|
|
|
</dd> |
1648
|
|
|
<dt> |
1649
|
|
|
<label for="view_newest_pm_first">', $txt['recent_pms_at_top'], '</label> |
1650
|
|
|
</dt> |
1651
|
|
|
<dd> |
1652
|
|
|
<input type="hidden" name="default_options[view_newest_pm_first]" value="0"> |
1653
|
|
|
<input type="checkbox" name="default_options[view_newest_pm_first]" id="view_newest_pm_first" value="1"', !empty($context['member']['options']['view_newest_pm_first']) ? ' checked' : '', '> |
1654
|
|
|
</dd> |
1655
|
|
|
</dl> |
1656
|
|
|
<hr> |
1657
|
|
|
<dl class="settings"> |
1658
|
|
|
<dt> |
1659
|
|
|
<label for="pm_receive_from">', $txt['pm_receive_from'], '</label> |
1660
|
|
|
</dt> |
1661
|
|
|
<dd> |
1662
|
|
|
<select name="pm_receive_from" id="pm_receive_from"> |
1663
|
|
|
<option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
1664
|
|
|
|
1665
|
|
|
if (!empty($modSettings['enable_buddylist'])) |
1666
|
|
|
echo ' |
1667
|
|
|
<option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
1668
|
|
|
<option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
1669
|
|
|
|
1670
|
|
|
echo ' |
1671
|
|
|
<option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
1672
|
|
|
</select> |
1673
|
|
|
</dd> |
1674
|
|
|
<dt> |
1675
|
|
|
<label for="popup_messages">', $txt['popup_messages'], '</label> |
1676
|
|
|
</dt> |
1677
|
|
|
<dd> |
1678
|
|
|
<input type="hidden" name="default_options[popup_messages]" value="0"> |
1679
|
|
|
<input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked' : '', '> |
1680
|
|
|
</dd> |
1681
|
|
|
</dl> |
1682
|
|
|
<hr> |
1683
|
|
|
<dl class="settings"> |
1684
|
|
|
<dt> |
1685
|
|
|
<label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label> |
1686
|
|
|
</dt> |
1687
|
|
|
<dd> |
1688
|
|
|
<input type="hidden" name="default_options[pm_remove_inbox_label]" value="0"> |
1689
|
|
|
<input type="checkbox" name="default_options[pm_remove_inbox_label]" id="pm_remove_inbox_label" value="1"', !empty($context['member']['options']['pm_remove_inbox_label']) ? ' checked' : '', '> |
1690
|
|
|
</dd>'; |
1691
|
|
|
|
1692
|
|
|
} |
1693
|
|
|
|
1694
|
|
|
/** |
1695
|
|
|
* Template for showing theme settings. Note: template_options() actually adds the theme specific options. |
1696
|
|
|
*/ |
1697
|
|
|
function template_profile_theme_settings() |
1698
|
|
|
{ |
1699
|
|
|
global $context, $modSettings; |
|
|
|
|
1700
|
|
|
|
1701
|
|
|
$skeys = array_keys($context['theme_options']); |
1702
|
|
|
$first_option_key = array_shift($skeys); |
1703
|
|
|
$titled_section = false; |
1704
|
|
|
|
1705
|
|
|
foreach ($context['theme_options'] as $i => $setting) |
1706
|
|
|
{ |
1707
|
|
|
// Just spit out separators and move on |
1708
|
|
View Code Duplication |
if (empty($setting) || !is_array($setting)) |
1709
|
|
|
{ |
1710
|
|
|
// Insert a separator (unless this is the first item in the list) |
1711
|
|
|
if ($i !== $first_option_key) |
1712
|
|
|
echo ' |
1713
|
|
|
</dl> |
1714
|
|
|
<hr> |
1715
|
|
|
<dl class="settings">'; |
1716
|
|
|
|
1717
|
|
|
// Should we give a name to this section? |
1718
|
|
|
if (is_string($setting) && !empty($setting)) |
1719
|
|
|
{ |
1720
|
|
|
$titled_section = true; |
1721
|
|
|
echo ' |
1722
|
|
|
<dt><strong>' . $setting . '</strong></dt> |
1723
|
|
|
<dd></dd>'; |
1724
|
|
|
} |
1725
|
|
|
else |
1726
|
|
|
$titled_section = false; |
1727
|
|
|
|
1728
|
|
|
continue; |
1729
|
|
|
} |
1730
|
|
|
|
1731
|
|
|
// Is this disabled? |
1732
|
|
|
if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
1733
|
|
|
continue; |
1734
|
|
|
|
1735
|
|
|
elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
1736
|
|
|
continue; |
1737
|
|
|
|
1738
|
|
|
elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
1739
|
|
|
continue; |
1740
|
|
|
|
1741
|
|
|
elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
1742
|
|
|
continue; |
1743
|
|
|
|
1744
|
|
|
elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
1745
|
|
|
continue; |
1746
|
|
|
|
1747
|
|
View Code Duplication |
elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
1748
|
|
|
continue; |
1749
|
|
|
|
1750
|
|
View Code Duplication |
elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
1751
|
|
|
continue; |
1752
|
|
|
|
1753
|
|
|
// Some of these may not be set... Set to defaults here |
1754
|
|
|
$opts = array('topics_per_page', 'messages_per_page', 'display_quick_mod'); |
1755
|
|
|
if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) |
1756
|
|
|
$context['member']['options'][$setting['id']] = 0; |
1757
|
|
|
|
1758
|
|
|
if (!isset($setting['type']) || $setting['type'] == 'bool') |
1759
|
|
|
$setting['type'] = 'checkbox'; |
1760
|
|
|
|
1761
|
|
|
elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
1762
|
|
|
$setting['type'] = 'number'; |
1763
|
|
|
|
1764
|
|
|
elseif ($setting['type'] == 'string') |
1765
|
|
|
$setting['type'] = 'text'; |
1766
|
|
|
|
1767
|
|
|
if (isset($setting['options'])) |
1768
|
|
|
$setting['type'] = 'list'; |
1769
|
|
|
|
1770
|
|
|
echo ' |
1771
|
|
|
<dt> |
1772
|
|
|
<label for="', $setting['id'], '">', !$titled_section ? '<strong>' : '', $setting['label'], !$titled_section ? '</strong>' : '', '</label>'; |
1773
|
|
|
|
1774
|
|
|
if (isset($setting['description'])) |
1775
|
|
|
echo ' |
1776
|
|
|
<br> |
1777
|
|
|
<span class="smalltext">', $setting['description'], '</span>'; |
1778
|
|
|
echo ' |
1779
|
|
|
</dt> |
1780
|
|
|
<dd>'; |
1781
|
|
|
|
1782
|
|
|
// Display checkbox options |
1783
|
|
|
if ($setting['type'] == 'checkbox') |
1784
|
|
|
echo ' |
1785
|
|
|
<input type="hidden" name="default_options[' . $setting['id'] . ']" value="0"> |
1786
|
|
|
<input type="checkbox" name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', !empty($context['member']['options'][$setting['id']]) ? ' checked' : '', ' value="1">'; |
1787
|
|
|
|
1788
|
|
|
// How about selection lists, we all love them |
1789
|
|
View Code Duplication |
elseif ($setting['type'] == 'list') |
1790
|
|
|
{ |
1791
|
|
|
echo ' |
1792
|
|
|
<select name="default_options[', $setting['id'], ']" id="', $setting['id'], '"', '>'; |
1793
|
|
|
|
1794
|
|
|
foreach ($setting['options'] as $value => $label) |
1795
|
|
|
echo ' |
1796
|
|
|
<option value="', $value, '"', $value == $context['member']['options'][$setting['id']] ? ' selected' : '', '>', $label, '</option>'; |
1797
|
|
|
|
1798
|
|
|
echo ' |
1799
|
|
|
</select>'; |
1800
|
|
|
} |
1801
|
|
|
// A textbox it is then |
1802
|
|
|
else |
1803
|
|
|
{ |
1804
|
|
|
if (isset($setting['type']) && $setting['type'] == 'number') |
1805
|
|
|
{ |
1806
|
|
|
$min = isset($setting['min']) ? ' min="' . $setting['min'] . '"' : ' min="0"'; |
1807
|
|
|
$max = isset($setting['max']) ? ' max="' . $setting['max'] . '"' : ''; |
1808
|
|
|
$step = isset($setting['step']) ? ' step="' . $setting['step'] . '"' : ''; |
1809
|
|
|
|
1810
|
|
|
echo ' |
1811
|
|
|
<input type="number"', $min . $max . $step; |
1812
|
|
|
} |
1813
|
|
|
elseif (isset($setting['type']) && $setting['type'] == 'url') |
1814
|
|
|
echo' |
1815
|
|
|
<input type="url"'; |
1816
|
|
|
|
1817
|
|
|
else |
1818
|
|
|
echo ' |
1819
|
|
|
<input type="text"'; |
1820
|
|
|
|
1821
|
|
|
echo ' name="default_options[', $setting['id'], ']" id="', $setting['id'], '" value="', isset($context['member']['options'][$setting['id']]) ? $context['member']['options'][$setting['id']] : $setting['value'], '"', $setting['type'] == 'number' ? ' size="5"' : '', '>'; |
1822
|
|
|
} |
1823
|
|
|
|
1824
|
|
|
// end of this defintion |
1825
|
|
|
echo ' |
1826
|
|
|
</dd>'; |
1827
|
|
|
} |
1828
|
|
|
} |
1829
|
|
|
|
1830
|
|
|
/** |
1831
|
|
|
* The template for configuring alerts |
1832
|
|
|
*/ |
1833
|
|
|
function template_alert_configuration() |
1834
|
|
|
{ |
1835
|
|
|
global $context, $txt, $scripturl, $modSettings; |
|
|
|
|
1836
|
|
|
|
1837
|
|
|
echo ' |
1838
|
|
|
<div class="cat_bar"> |
1839
|
|
|
<h3 class="catbg"> |
1840
|
|
|
', $txt['alert_prefs'], ' |
1841
|
|
|
</h3> |
1842
|
|
|
</div> |
1843
|
|
|
<p class="information"> |
1844
|
|
|
', (empty($context['description']) ? $txt['alert_prefs_desc'] : $context['description']), ' |
1845
|
|
|
</p> |
1846
|
|
|
<form action="', $scripturl, '?', $context['action'], '" id="admin_form_wrapper" method="post" accept-charset="', $context['character_set'], '" id="notify_options" class="flow_hidden"> |
1847
|
|
|
<div class="cat_bar"> |
1848
|
|
|
<h3 class="catbg"> |
1849
|
|
|
', $txt['notification_general'], ' |
1850
|
|
|
</h3> |
1851
|
|
|
</div> |
1852
|
|
|
<div class="windowbg2 noup"> |
1853
|
|
|
<dl class="settings">'; |
1854
|
|
|
|
1855
|
|
|
// Allow notification on announcements to be disabled? |
1856
|
|
|
if (!empty($modSettings['allow_disableAnnounce'])) |
1857
|
|
|
echo ' |
1858
|
|
|
<dt> |
1859
|
|
|
<label for="notify_announcements">', $txt['notify_important_email'], '</label> |
1860
|
|
|
</dt> |
1861
|
|
|
<dd> |
1862
|
|
|
<input type="hidden" name="notify_announcements" value="0"> |
1863
|
|
|
<input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', '> |
1864
|
|
|
</dd>'; |
1865
|
|
|
|
1866
|
|
|
if (!empty($modSettings['enable_ajax_alerts'])) |
1867
|
|
|
echo ' |
1868
|
|
|
<dt> |
1869
|
|
|
<label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
1870
|
|
|
</dt> |
1871
|
|
|
<dd> |
1872
|
|
|
<input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '"> |
1873
|
|
|
</dd>'; |
1874
|
|
|
|
1875
|
|
|
echo ' |
1876
|
|
|
</dl> |
1877
|
|
|
</div><!-- .windowbg2 --> |
1878
|
|
|
<div class="cat_bar"> |
1879
|
|
|
<h3 class="catbg"> |
1880
|
|
|
', $txt['notify_what_how'], ' |
1881
|
|
|
</h3> |
1882
|
|
|
</div> |
1883
|
|
|
<table class="table_grid">'; |
1884
|
|
|
|
1885
|
|
|
foreach ($context['alert_types'] as $alert_group => $alerts) |
1886
|
|
|
{ |
1887
|
|
|
echo ' |
1888
|
|
|
<tr class="title_bar"> |
1889
|
|
|
<th>', $txt['alert_group_' . $alert_group], '</th> |
1890
|
|
|
<th>', $txt['receive_alert'], '</th> |
1891
|
|
|
<th>', $txt['receive_mail'], '</th> |
1892
|
|
|
</tr> |
1893
|
|
|
<tr class="windowbg">'; |
1894
|
|
|
|
1895
|
|
|
if (isset($context['alert_group_options'][$alert_group])) |
1896
|
|
|
{ |
1897
|
|
|
foreach ($context['alert_group_options'][$alert_group] as $opts) |
1898
|
|
|
{ |
1899
|
|
|
echo ' |
1900
|
|
|
<tr class="windowbg"> |
1901
|
|
|
<td colspan="3">'; |
1902
|
|
|
|
1903
|
|
|
$label = $txt['alert_opt_' . $opts[1]]; |
1904
|
|
|
$label_pos = isset($opts['label']) ? $opts['label'] : ''; |
1905
|
|
|
if ($label_pos == 'before') |
1906
|
|
|
echo ' |
1907
|
|
|
<label for="opt_', $opts[1], '">', $label, '</label>'; |
1908
|
|
|
|
1909
|
|
|
$this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
1910
|
|
|
switch ($opts[0]) |
1911
|
|
|
{ |
1912
|
|
|
case 'check': |
1913
|
|
|
echo ' |
1914
|
|
|
<input type="checkbox" name="opt_', $opts[1], '" id="opt_', $opts[1], '"', $this_value ? ' checked' : '', '>'; |
1915
|
|
|
break; |
1916
|
|
|
|
1917
|
|
|
case 'select': |
1918
|
|
|
echo ' |
1919
|
|
|
<select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
1920
|
|
|
|
1921
|
|
|
foreach ($opts['opts'] as $k => $v) |
1922
|
|
|
echo ' |
1923
|
|
|
<option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
1924
|
|
|
echo ' |
1925
|
|
|
</select>'; |
1926
|
|
|
break; |
1927
|
|
|
} |
1928
|
|
|
|
1929
|
|
|
if ($label_pos == 'after') |
1930
|
|
|
echo ' |
1931
|
|
|
<label for="opt_', $opts[1], '">', $label, '</label>'; |
1932
|
|
|
|
1933
|
|
|
echo ' |
1934
|
|
|
</td> |
1935
|
|
|
</tr>'; |
1936
|
|
|
} |
1937
|
|
|
} |
1938
|
|
|
|
1939
|
|
|
foreach ($alerts as $alert_id => $alert_details) |
1940
|
|
|
{ |
1941
|
|
|
echo ' |
1942
|
|
|
<tr class="windowbg"> |
1943
|
|
|
<td> |
1944
|
|
|
', $txt['alert_' . $alert_id], isset($alert_details['help']) ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $alert_details['help'] . '" onclick="return reqOverlayDiv(this.href);" class="help floatright"><span class="generic_icons help" title="' . $txt['help'] . '"></span></a>' : '', ' |
1945
|
|
|
</td>'; |
1946
|
|
|
|
1947
|
|
|
foreach ($context['alert_bits'] as $type => $bitmask) |
1948
|
|
|
{ |
1949
|
|
|
echo ' |
1950
|
|
|
<td class="centercol">'; |
1951
|
|
|
|
1952
|
|
|
$this_value = isset($context['alert_prefs'][$alert_id]) ? $context['alert_prefs'][$alert_id] : 0; |
1953
|
|
|
switch ($alert_details[$type]) |
1954
|
|
|
{ |
1955
|
|
|
case 'always': |
1956
|
|
|
echo ' |
1957
|
|
|
<input type="checkbox" checked disabled>'; |
1958
|
|
|
break; |
1959
|
|
|
case 'yes': |
1960
|
|
|
echo ' |
1961
|
|
|
<input type="checkbox" name="', $type, '_', $alert_id, '"', ($this_value & $bitmask) ? ' checked' : '', '>'; |
1962
|
|
|
break; |
1963
|
|
|
case 'never': |
1964
|
|
|
echo ' |
1965
|
|
|
<input type="checkbox" disabled>'; |
1966
|
|
|
break; |
1967
|
|
|
} |
1968
|
|
|
echo ' |
1969
|
|
|
</td>'; |
1970
|
|
|
} |
1971
|
|
|
|
1972
|
|
|
echo ' |
1973
|
|
|
</tr>'; |
1974
|
|
|
} |
1975
|
|
|
} |
1976
|
|
|
|
1977
|
|
|
echo ' |
1978
|
|
|
</table> |
1979
|
|
|
<br> |
1980
|
|
|
<div> |
1981
|
|
|
<input id="notify_submit" type="submit" name="notify_submit" value="', $txt['notify_save'], '" class="button"> |
1982
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">', !empty($context['token_check']) ? ' |
1983
|
|
|
<input type="hidden" name="' . $context[$context['token_check'] . '_token_var'] . '" value="' . $context[$context['token_check'] . '_token'] . '">' : '', ' |
1984
|
|
|
<input type="hidden" name="u" value="', $context['id_member'], '"> |
1985
|
|
|
<input type="hidden" name="sa" value="', $context['menu_item_selected'], '"> |
1986
|
|
|
</div> |
1987
|
|
|
</form> |
1988
|
|
|
<br>'; |
1989
|
|
|
} |
1990
|
|
|
|
1991
|
|
|
/** |
1992
|
|
|
* Template for showing which topics you're subscribed to |
1993
|
|
|
*/ |
1994
|
|
|
function template_alert_notifications_topics() |
1995
|
|
|
{ |
1996
|
|
|
global $txt; |
|
|
|
|
1997
|
|
|
|
1998
|
|
|
// The main containing header. |
1999
|
|
|
echo ' |
2000
|
|
|
<div class="cat_bar"> |
2001
|
|
|
<h3 class="catbg"> |
2002
|
|
|
', $txt['watched_topics'], ' |
2003
|
|
|
</h3> |
2004
|
|
|
</div> |
2005
|
|
|
<p class="information">', $txt['watched_topics_desc'], '</p> |
2006
|
|
|
<br>'; |
2007
|
|
|
|
2008
|
|
|
template_show_list('topic_notification_list'); |
2009
|
|
|
} |
2010
|
|
|
|
2011
|
|
|
/** |
2012
|
|
|
* Template for showing which boards you're subscribed to |
2013
|
|
|
*/ |
2014
|
|
|
function template_alert_notifications_boards() |
2015
|
|
|
{ |
2016
|
|
|
global $txt; |
|
|
|
|
2017
|
|
|
|
2018
|
|
|
echo ' |
2019
|
|
|
<div class="cat_bar"> |
2020
|
|
|
<h3 class="catbg"> |
2021
|
|
|
', $txt['watched_boards'], ' |
2022
|
|
|
</h3> |
2023
|
|
|
</div> |
2024
|
|
|
<p class="information">', $txt['watched_boards_desc'], '</p> |
2025
|
|
|
<br>'; |
2026
|
|
|
|
2027
|
|
|
template_show_list('board_notification_list'); |
2028
|
|
|
} |
2029
|
|
|
|
2030
|
|
|
/** |
2031
|
|
|
* Template for choosing group membership. |
2032
|
|
|
*/ |
2033
|
|
|
function template_groupMembership() |
2034
|
|
|
{ |
2035
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
2036
|
|
|
|
2037
|
|
|
// The main containing header. |
2038
|
|
|
echo ' |
2039
|
|
|
<form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator"> |
2040
|
|
|
<div class="cat_bar"> |
2041
|
|
|
<h3 class="catbg profile_hd"> |
2042
|
|
|
', $txt['profile'], ' |
2043
|
|
|
</h3> |
2044
|
|
|
</div> |
2045
|
|
|
<p class="information">', $txt['groupMembership_info'], '</p>'; |
2046
|
|
|
|
2047
|
|
|
// Do we have an update message? |
2048
|
|
|
if (!empty($context['update_message'])) |
2049
|
|
|
echo ' |
2050
|
|
|
<div class="infobox"> |
2051
|
|
|
', $context['update_message'], '. |
2052
|
|
|
</div>'; |
2053
|
|
|
|
2054
|
|
|
echo ' |
2055
|
|
|
<div id="groups">'; |
2056
|
|
|
|
2057
|
|
|
// Requesting membership to a group? |
2058
|
|
|
if (!empty($context['group_request'])) |
2059
|
|
|
{ |
2060
|
|
|
echo ' |
2061
|
|
|
<div class="groupmembership"> |
2062
|
|
|
<div class="cat_bar"> |
2063
|
|
|
<h3 class="catbg">', $txt['request_group_membership'], '</h3> |
2064
|
|
|
</div> |
2065
|
|
|
<div class="roundframe"> |
2066
|
|
|
', $txt['request_group_membership_desc'], ': |
2067
|
|
|
<textarea name="reason" rows="4"></textarea> |
2068
|
|
|
<div class="righttext"> |
2069
|
|
|
<input type="hidden" name="gid" value="', $context['group_request']['id'], '"> |
2070
|
|
|
<input type="submit" name="req" value="', $txt['submit_request'], '" class="button"> |
2071
|
|
|
</div> |
2072
|
|
|
</div> |
2073
|
|
|
</div><!-- .groupmembership -->'; |
2074
|
|
|
} |
2075
|
|
|
else |
2076
|
|
|
{ |
2077
|
|
|
echo ' |
2078
|
|
|
<div class="title_bar"> |
2079
|
|
|
<h3 class="titlebg">', $txt['current_membergroups'], '</h3> |
2080
|
|
|
</div>'; |
2081
|
|
|
|
2082
|
|
|
foreach ($context['groups']['member'] as $group) |
2083
|
|
|
{ |
2084
|
|
|
echo ' |
2085
|
|
|
<div class="windowbg" id="primdiv_', $group['id'], '">'; |
2086
|
|
|
|
2087
|
|
|
if ($context['can_edit_primary']) |
2088
|
|
|
echo ' |
2089
|
|
|
<input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', '>'; |
2090
|
|
|
|
2091
|
|
|
echo ' |
2092
|
|
|
<label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
2093
|
|
|
|
2094
|
|
|
// Can they leave their group? |
2095
|
|
|
if ($group['can_leave']) |
2096
|
|
|
echo ' |
2097
|
|
|
<a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
2098
|
|
|
|
2099
|
|
|
echo ' |
2100
|
|
|
</div><!-- .windowbg -->'; |
2101
|
|
|
} |
2102
|
|
|
|
2103
|
|
|
if ($context['can_edit_primary']) |
2104
|
|
|
echo ' |
2105
|
|
|
<div class="padding righttext"> |
2106
|
|
|
<input type="submit" value="', $txt['make_primary'], '" class="button"> |
2107
|
|
|
</div>'; |
2108
|
|
|
|
2109
|
|
|
// Any groups they can join? |
2110
|
|
|
if (!empty($context['groups']['available'])) |
2111
|
|
|
{ |
2112
|
|
|
echo ' |
2113
|
|
|
<div class="title_bar"> |
2114
|
|
|
<h3 class="titlebg">', $txt['available_groups'], '</h3> |
2115
|
|
|
</div>'; |
2116
|
|
|
|
2117
|
|
|
foreach ($context['groups']['available'] as $group) |
2118
|
|
|
{ |
2119
|
|
|
echo ' |
2120
|
|
|
<div class="windowbg"> |
2121
|
|
|
<strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
2122
|
|
|
|
2123
|
|
|
if ($group['type'] == 3) |
2124
|
|
|
echo ' |
2125
|
|
|
<a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
2126
|
|
|
|
2127
|
|
|
elseif ($group['type'] == 2 && $group['pending']) |
2128
|
|
|
echo ' |
2129
|
|
|
<span class="floatright">', $txt['approval_pending'], '</span>'; |
2130
|
|
|
|
2131
|
|
|
elseif ($group['type'] == 2) |
2132
|
|
|
echo ' |
2133
|
|
|
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
2134
|
|
|
|
2135
|
|
|
echo ' |
2136
|
|
|
</div><!-- .windowbg -->'; |
2137
|
|
|
} |
2138
|
|
|
} |
2139
|
|
|
|
2140
|
|
|
// Javascript for the selector stuff. |
2141
|
|
|
echo ' |
2142
|
|
|
<script> |
2143
|
|
|
var prevClass = ""; |
2144
|
|
|
var prevDiv = ""; |
2145
|
|
|
function highlightSelected(box) |
2146
|
|
|
{ |
2147
|
|
|
if (prevClass != "") |
2148
|
|
|
{ |
2149
|
|
|
prevDiv.className = prevClass; |
2150
|
|
|
} |
2151
|
|
|
prevDiv = document.getElementById(box); |
2152
|
|
|
prevClass = prevDiv.className; |
2153
|
|
|
|
2154
|
|
|
prevDiv.className = "windowbg"; |
2155
|
|
|
}'; |
2156
|
|
|
if (isset($context['groups']['member'][$context['primary_group']])) |
2157
|
|
|
echo ' |
2158
|
|
|
highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
2159
|
|
|
|
2160
|
|
|
echo ' |
2161
|
|
|
</script>'; |
2162
|
|
|
} |
2163
|
|
|
|
2164
|
|
|
echo ' |
2165
|
|
|
</div><!-- #groups -->'; |
2166
|
|
|
|
2167
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
2168
|
|
|
echo ' |
2169
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2170
|
|
|
|
2171
|
|
|
echo ' |
2172
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
2173
|
|
|
<input type="hidden" name="u" value="', $context['id_member'], '"> |
2174
|
|
|
</form>'; |
2175
|
|
|
} |
2176
|
|
|
|
2177
|
|
|
/** |
2178
|
|
|
* Template for managing ignored boards |
2179
|
|
|
*/ |
2180
|
|
|
function template_ignoreboards() |
2181
|
|
|
{ |
2182
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
2183
|
|
|
|
2184
|
|
|
// The main containing header. |
2185
|
|
|
echo ' |
2186
|
|
|
<form action="', $scripturl, '?action=profile;area=ignoreboards;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator"> |
2187
|
|
|
<div class="cat_bar"> |
2188
|
|
|
<h3 class="catbg profile_hd"> |
2189
|
|
|
', $txt['profile'], ' |
2190
|
|
|
</h3> |
2191
|
|
|
</div> |
2192
|
|
|
<p class="information">', $txt['ignoreboards_info'], '</p> |
2193
|
|
|
<div class="windowbg2"> |
2194
|
|
|
<div class="flow_hidden"> |
2195
|
|
|
<ul class="ignoreboards floatleft">'; |
2196
|
|
|
|
2197
|
|
|
$i = 0; |
2198
|
|
|
$limit = ceil($context['num_boards'] / 2); |
2199
|
|
|
foreach ($context['categories'] as $category) |
2200
|
|
|
{ |
2201
|
|
|
if ($i == $limit) |
2202
|
|
|
{ |
2203
|
|
|
echo ' |
2204
|
|
|
</ul> |
2205
|
|
|
<ul class="ignoreboards floatright">'; |
2206
|
|
|
|
2207
|
|
|
$i++; |
2208
|
|
|
} |
2209
|
|
|
|
2210
|
|
|
echo ' |
2211
|
|
|
<li class="category"> |
2212
|
|
|
<a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'creator\'); return false;">', $category['name'], '</a> |
2213
|
|
|
<ul>'; |
2214
|
|
|
|
2215
|
|
View Code Duplication |
foreach ($category['boards'] as $board) |
2216
|
|
|
{ |
2217
|
|
|
if ($i == $limit) |
2218
|
|
|
echo ' |
2219
|
|
|
</ul> |
2220
|
|
|
</li> |
2221
|
|
|
</ul> |
2222
|
|
|
<ul class="ignoreboards floatright"> |
2223
|
|
|
<li class="category"> |
2224
|
|
|
<ul>'; |
2225
|
|
|
|
2226
|
|
|
echo ' |
2227
|
|
|
<li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
2228
|
|
|
<label for="ignore_brd', $board['id'], '"><input type="checkbox" id="brd', $board['id'], '" name="ignore_brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked' : '', '> ', $board['name'], '</label> |
2229
|
|
|
</li>'; |
2230
|
|
|
|
2231
|
|
|
$i++; |
2232
|
|
|
} |
2233
|
|
|
|
2234
|
|
|
echo ' |
2235
|
|
|
</ul> |
2236
|
|
|
</li>'; |
2237
|
|
|
} |
2238
|
|
|
|
2239
|
|
|
echo ' |
2240
|
|
|
</ul>'; |
2241
|
|
|
|
2242
|
|
|
// Show the standard "Save Settings" profile button. |
2243
|
|
|
template_profile_save(); |
2244
|
|
|
|
2245
|
|
|
echo ' |
2246
|
|
|
</div><!-- .flow_hidden --> |
2247
|
|
|
</div><!-- .windowbg2 --> |
2248
|
|
|
</form> |
2249
|
|
|
<br>'; |
2250
|
|
|
} |
2251
|
|
|
|
2252
|
|
|
/** |
2253
|
|
|
* Simply loads some theme variables common to several warning templates. |
2254
|
|
|
*/ |
2255
|
|
|
function template_load_warning_variables() |
2256
|
|
|
{ |
2257
|
|
|
global $modSettings, $context; |
|
|
|
|
2258
|
|
|
|
2259
|
|
|
$context['warningBarWidth'] = 200; |
2260
|
|
|
// Setup the colors - this is a little messy for theming. |
2261
|
|
|
$context['colors'] = array( |
2262
|
|
|
0 => 'green', |
2263
|
|
|
$modSettings['warning_watch'] => 'darkgreen', |
2264
|
|
|
$modSettings['warning_moderate'] => 'orange', |
2265
|
|
|
$modSettings['warning_mute'] => 'red', |
2266
|
|
|
); |
2267
|
|
|
|
2268
|
|
|
// Work out the starting color. |
2269
|
|
|
$context['current_color'] = $context['colors'][0]; |
2270
|
|
|
foreach ($context['colors'] as $limit => $color) |
2271
|
|
|
if ($context['member']['warning'] >= $limit) |
2272
|
|
|
$context['current_color'] = $color; |
2273
|
|
|
} |
2274
|
|
|
|
2275
|
|
|
// Show all warnings of a user? |
2276
|
|
|
function template_viewWarning() |
2277
|
|
|
{ |
2278
|
|
|
global $context, $txt; |
|
|
|
|
2279
|
|
|
|
2280
|
|
|
template_load_warning_variables(); |
2281
|
|
|
|
2282
|
|
|
echo ' |
2283
|
|
|
<div class="cat_bar"> |
2284
|
|
|
<h3 class="catbg profile_hd"> |
2285
|
|
|
', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), ' |
2286
|
|
|
</h3> |
2287
|
|
|
</div> |
2288
|
|
|
<p class="information">', $txt['viewWarning_help'], '</p> |
2289
|
|
|
<div class="windowbg"> |
2290
|
|
|
<dl class="settings"> |
2291
|
|
|
<dt> |
2292
|
|
|
<strong>', $txt['profile_warning_name'], ':</strong> |
2293
|
|
|
</dt> |
2294
|
|
|
<dd> |
2295
|
|
|
', $context['member']['name'], ' |
2296
|
|
|
</dd> |
2297
|
|
|
<dt> |
2298
|
|
|
<strong>', $txt['profile_warning_level'], ':</strong> |
2299
|
|
|
</dt> |
2300
|
|
|
<dd> |
2301
|
|
|
<div> |
2302
|
|
|
<div> |
2303
|
|
|
<div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;"> |
2304
|
|
|
<div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div> |
2305
|
|
|
<div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';"> </div> |
2306
|
|
|
</div> |
2307
|
|
|
</div> |
2308
|
|
|
</div> |
2309
|
|
|
</dd>'; |
2310
|
|
|
|
2311
|
|
|
// There's some impact of this? |
2312
|
|
|
if (!empty($context['level_effects'][$context['current_level']])) |
2313
|
|
|
echo ' |
2314
|
|
|
<dt> |
2315
|
|
|
<strong>', $txt['profile_viewwarning_impact'], ':</strong> |
2316
|
|
|
</dt> |
2317
|
|
|
<dd> |
2318
|
|
|
', $context['level_effects'][$context['current_level']], ' |
2319
|
|
|
</dd>'; |
2320
|
|
|
|
2321
|
|
|
echo ' |
2322
|
|
|
</dl> |
2323
|
|
|
</div><!-- .windowbg -->'; |
2324
|
|
|
|
2325
|
|
|
template_show_list('view_warnings'); |
2326
|
|
|
} |
2327
|
|
|
|
2328
|
|
|
// Show a lovely interface for issuing warnings. |
2329
|
|
|
function template_issueWarning() |
2330
|
|
|
{ |
2331
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
2332
|
|
|
|
2333
|
|
|
template_load_warning_variables(); |
2334
|
|
|
|
2335
|
|
|
echo ' |
2336
|
|
|
<script> |
2337
|
|
|
// Disable notification boxes as required. |
2338
|
|
|
function modifyWarnNotify() |
2339
|
|
|
{ |
2340
|
|
|
disable = !document.getElementById(\'warn_notify\').checked; |
2341
|
|
|
document.getElementById(\'warn_sub\').disabled = disable; |
2342
|
|
|
document.getElementById(\'warn_body\').disabled = disable; |
2343
|
|
|
document.getElementById(\'warn_temp\').disabled = disable; |
2344
|
|
|
document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\'; |
2345
|
|
|
document.getElementById(\'preview_button\').style.display = disable ? \'none\' : \'\'; |
2346
|
|
|
} |
2347
|
|
|
|
2348
|
|
|
// Warn template. |
2349
|
|
|
function populateNotifyTemplate() |
2350
|
|
|
{ |
2351
|
|
|
index = document.getElementById(\'warn_temp\').value; |
2352
|
|
|
if (index == -1) |
2353
|
|
|
return false; |
2354
|
|
|
|
2355
|
|
|
// Otherwise see what we can do...'; |
2356
|
|
|
|
2357
|
|
|
foreach ($context['notification_templates'] as $k => $type) |
2358
|
|
|
echo ' |
2359
|
|
|
if (index == ', $k, ') |
2360
|
|
|
document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
2361
|
|
|
|
2362
|
|
|
echo ' |
2363
|
|
|
} |
2364
|
|
|
|
2365
|
|
|
function updateSlider(slideAmount) |
2366
|
|
|
{ |
2367
|
|
|
// Also set the right effect. |
2368
|
|
|
effectText = "";'; |
2369
|
|
|
|
2370
|
|
|
foreach ($context['level_effects'] as $limit => $text) |
2371
|
|
|
echo ' |
2372
|
|
|
if (slideAmount >= ', $limit, ') |
2373
|
|
|
effectText = "', $text, '";'; |
2374
|
|
|
|
2375
|
|
|
echo ' |
2376
|
|
|
setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
2377
|
|
|
} |
2378
|
|
|
</script>'; |
2379
|
|
|
|
2380
|
|
|
echo ' |
2381
|
|
|
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '"> |
2382
|
|
|
<div class="cat_bar"> |
2383
|
|
|
<h3 class="catbg profile_hd"> |
2384
|
|
|
', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], ' |
2385
|
|
|
</h3> |
2386
|
|
|
</div>'; |
2387
|
|
|
|
2388
|
|
|
if (!$context['user']['is_owner']) |
2389
|
|
|
echo ' |
2390
|
|
|
<p class="information">', $txt['profile_warning_desc'], '</p>'; |
2391
|
|
|
|
2392
|
|
|
echo ' |
2393
|
|
|
<div class="windowbg"> |
2394
|
|
|
<dl class="settings">'; |
2395
|
|
|
|
2396
|
|
|
if (!$context['user']['is_owner']) |
2397
|
|
|
echo ' |
2398
|
|
|
<dt> |
2399
|
|
|
<strong>', $txt['profile_warning_name'], ':</strong> |
2400
|
|
|
</dt> |
2401
|
|
|
<dd> |
2402
|
|
|
<strong>', $context['member']['name'], '</strong> |
2403
|
|
|
</dd>'; |
2404
|
|
|
|
2405
|
|
|
echo ' |
2406
|
|
|
<dt> |
2407
|
|
|
<strong>', $txt['profile_warning_level'], ':</strong>'; |
2408
|
|
|
|
2409
|
|
|
// Is there only so much they can apply? |
2410
|
|
|
if ($context['warning_limit']) |
2411
|
|
|
echo ' |
2412
|
|
|
<br> |
2413
|
|
|
<span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
2414
|
|
|
|
2415
|
|
|
echo ' |
2416
|
|
|
</dt> |
2417
|
|
|
<dd> |
2418
|
|
|
0% <input name="warning_level" id="warning_level" type="range" min="0" max="100" step="5" value="', $context['member']['warning'], '" onchange="updateSlider(this.value)"> 100% |
2419
|
|
|
<div class="clear_left"> |
2420
|
|
|
', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['member']['warning'], '% (', $context['level_effects'][$context['current_level']], ')</span> |
2421
|
|
|
</div> |
2422
|
|
|
</dd>'; |
2423
|
|
|
|
2424
|
|
|
if (!$context['user']['is_owner']) |
2425
|
|
|
{ |
2426
|
|
|
echo ' |
2427
|
|
|
<dt> |
2428
|
|
|
<strong>', $txt['profile_warning_reason'], ':</strong><br> |
2429
|
|
|
<span class="smalltext">', $txt['profile_warning_reason_desc'], '</span> |
2430
|
|
|
</dt> |
2431
|
|
|
<dd> |
2432
|
|
|
<input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50"> |
2433
|
|
|
</dd> |
2434
|
|
|
</dl> |
2435
|
|
|
<hr> |
2436
|
|
|
<div id="box_preview"', !empty($context['warning_data']['body_preview']) ? '' : ' style="display:none"', '> |
2437
|
|
|
<dl class="settings"> |
2438
|
|
|
<dt> |
2439
|
|
|
<strong>', $txt['preview'], '</strong> |
2440
|
|
|
</dt> |
2441
|
|
|
<dd id="body_preview"> |
2442
|
|
|
', !empty($context['warning_data']['body_preview']) ? $context['warning_data']['body_preview'] : '', ' |
2443
|
|
|
</dd> |
2444
|
|
|
</dl> |
2445
|
|
|
<hr> |
2446
|
|
|
</div> |
2447
|
|
|
<dl class="settings"> |
2448
|
|
|
<dt> |
2449
|
|
|
<strong><label for="warn_notify">', $txt['profile_warning_notify'], ':</label></strong> |
2450
|
|
|
</dt> |
2451
|
|
|
<dd> |
2452
|
|
|
<input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();"', $context['warning_data']['notify'] ? ' checked' : '', '> |
2453
|
|
|
</dd> |
2454
|
|
|
<dt> |
2455
|
|
|
<strong><label for="warn_sub">', $txt['profile_warning_notify_subject'], ':</label></strong> |
2456
|
|
|
</dt> |
2457
|
|
|
<dd> |
2458
|
|
|
<input type="text" name="warn_sub" id="warn_sub" value="', empty($context['warning_data']['notify_subject']) ? $txt['profile_warning_notify_template_subject'] : $context['warning_data']['notify_subject'], '" size="50"> |
2459
|
|
|
</dd> |
2460
|
|
|
<dt> |
2461
|
|
|
<strong><label for="warn_temp">', $txt['profile_warning_notify_body'], ':</label></strong> |
2462
|
|
|
</dt> |
2463
|
|
|
<dd> |
2464
|
|
|
<select name="warn_temp" id="warn_temp" disabled onchange="populateNotifyTemplate();"> |
2465
|
|
|
<option value="-1">', $txt['profile_warning_notify_template'], '</option> |
2466
|
|
|
<option value="-1" disabled>------------------------------</option>'; |
2467
|
|
|
|
2468
|
|
|
foreach ($context['notification_templates'] as $id_template => $template) |
2469
|
|
|
echo ' |
2470
|
|
|
<option value="', $id_template, '">', $template['title'], '</option>'; |
2471
|
|
|
|
2472
|
|
|
echo ' |
2473
|
|
|
</select> |
2474
|
|
|
<span class="smalltext" id="new_template_link" style="display: none;">[<a href="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=0" target="_blank" rel="noopener">', $txt['profile_warning_new_template'], '</a>]</span> |
2475
|
|
|
<br> |
2476
|
|
|
<textarea name="warn_body" id="warn_body" cols="40" rows="8">', $context['warning_data']['notify_body'], '</textarea> |
2477
|
|
|
</dd>'; |
2478
|
|
|
} |
2479
|
|
|
echo ' |
2480
|
|
|
</dl> |
2481
|
|
|
<div class="righttext">'; |
2482
|
|
|
|
2483
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
2484
|
|
|
echo ' |
2485
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2486
|
|
|
|
2487
|
|
|
echo ' |
2488
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
2489
|
|
|
<input type="button" name="preview" id="preview_button" value="', $txt['preview'], '" class="button"> |
2490
|
|
|
<input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button"> |
2491
|
|
|
</div><!-- .righttext --> |
2492
|
|
|
</div><!-- .windowbg --> |
2493
|
|
|
</form>'; |
2494
|
|
|
|
2495
|
|
|
// Previous warnings? |
2496
|
|
|
template_show_list('view_warnings'); |
2497
|
|
|
|
2498
|
|
|
echo ' |
2499
|
|
|
<script>'; |
2500
|
|
|
|
2501
|
|
|
if (!$context['user']['is_owner']) |
2502
|
|
|
echo ' |
2503
|
|
|
modifyWarnNotify(); |
2504
|
|
|
$(document).ready(function() { |
2505
|
|
|
$("#preview_button").click(function() { |
2506
|
|
|
return ajax_getTemplatePreview(); |
2507
|
|
|
}); |
2508
|
|
|
}); |
2509
|
|
|
|
2510
|
|
|
function ajax_getTemplatePreview () |
2511
|
|
|
{ |
2512
|
|
|
$.ajax({ |
2513
|
|
|
type: "POST", |
2514
|
|
|
url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml", |
2515
|
|
|
data: {item: "warning_preview", title: $("#warn_sub").val(), body: $("#warn_body").val(), issuing: true}, |
2516
|
|
|
context: document.body, |
2517
|
|
|
success: function(request){ |
2518
|
|
|
$("#box_preview").css({display:""}); |
2519
|
|
|
$("#body_preview").html($(request).find(\'body\').text()); |
2520
|
|
|
if ($(request).find("error").text() != \'\') |
2521
|
|
|
{ |
2522
|
|
|
$("#profile_error").css({display:""}); |
2523
|
|
|
var errors_html = \'<ul class="list_errors">\'; |
2524
|
|
|
var errors = $(request).find(\'error\').each(function() { |
2525
|
|
|
errors_html += \'<li>\' + $(this).text() + \'</li>\'; |
2526
|
|
|
}); |
2527
|
|
|
errors_html += \'</ul>\'; |
2528
|
|
|
|
2529
|
|
|
$("#profile_error").html(errors_html); |
2530
|
|
|
} |
2531
|
|
|
else |
2532
|
|
|
{ |
2533
|
|
|
$("#profile_error").css({display:"none"}); |
2534
|
|
|
$("#error_list").html(\'\'); |
2535
|
|
|
} |
2536
|
|
|
return false; |
2537
|
|
|
}, |
2538
|
|
|
}); |
2539
|
|
|
return false; |
2540
|
|
|
}'; |
2541
|
|
|
|
2542
|
|
|
echo ' |
2543
|
|
|
</script>'; |
2544
|
|
|
} |
2545
|
|
|
|
2546
|
|
|
/** |
2547
|
|
|
* Template to show for deleting a user's account - now with added delete post capability! |
2548
|
|
|
*/ |
2549
|
|
|
function template_deleteAccount() |
2550
|
|
|
{ |
2551
|
|
|
global $context, $scripturl, $txt; |
|
|
|
|
2552
|
|
|
|
2553
|
|
|
// The main containing header. |
2554
|
|
|
echo ' |
2555
|
|
|
<form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator"> |
2556
|
|
|
<div class="cat_bar"> |
2557
|
|
|
<h3 class="catbg profile_hd"> |
2558
|
|
|
', $txt['deleteAccount'], ' |
2559
|
|
|
</h3> |
2560
|
|
|
</div>'; |
2561
|
|
|
|
2562
|
|
|
// If deleting another account give them a lovely info box. |
2563
|
|
|
if (!$context['user']['is_owner']) |
2564
|
|
|
echo ' |
2565
|
|
|
<p class="information">', $txt['deleteAccount_desc'], '</p>'; |
2566
|
|
|
|
2567
|
|
|
echo ' |
2568
|
|
|
<div class="windowbg2">'; |
2569
|
|
|
|
2570
|
|
|
// If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
2571
|
|
|
if ($context['needs_approval']) |
2572
|
|
|
echo ' |
2573
|
|
|
<div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
2574
|
|
|
|
2575
|
|
|
// If the user is deleting their own account warn them first - and require a password! |
2576
|
|
|
if ($context['user']['is_owner']) |
2577
|
|
|
{ |
2578
|
|
|
echo ' |
2579
|
|
|
<div class="alert">', $txt['own_profile_confirm'], '</div> |
2580
|
|
|
<div> |
2581
|
|
|
<strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong> |
2582
|
|
|
<input type="password" name="oldpasswrd" size="20"> |
2583
|
|
|
<input type="submit" value="', $txt['yes'], '" class="button">'; |
2584
|
|
|
|
2585
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
2586
|
|
|
echo ' |
2587
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2588
|
|
|
|
2589
|
|
|
echo ' |
2590
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
2591
|
|
|
<input type="hidden" name="u" value="', $context['id_member'], '"> |
2592
|
|
|
<input type="hidden" name="sa" value="', $context['menu_item_selected'], '"> |
2593
|
|
|
</div>'; |
2594
|
|
|
} |
2595
|
|
|
// Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts! |
2596
|
|
|
else |
2597
|
|
|
{ |
2598
|
|
|
echo ' |
2599
|
|
|
<div class="alert">', $txt['deleteAccount_warning'], '</div>'; |
2600
|
|
|
|
2601
|
|
|
// Only actually give these options if they are kind of important. |
2602
|
|
|
if ($context['can_delete_posts']) |
2603
|
|
|
{ |
2604
|
|
|
echo ' |
2605
|
|
|
<div> |
2606
|
|
|
<label for="deleteVotes"> |
2607
|
|
|
<input type="checkbox" name="deleteVotes" id="deleteVotes" value="1"> ', $txt['deleteAccount_votes'], ': |
2608
|
|
|
</label><br> |
2609
|
|
|
<label for="deletePosts"> |
2610
|
|
|
<input type="checkbox" name="deletePosts" id="deletePosts" value="1"> ', $txt['deleteAccount_posts'], ': |
2611
|
|
|
</label> |
2612
|
|
|
<select name="remove_type"> |
2613
|
|
|
<option value="posts">', $txt['deleteAccount_all_posts'], '</option> |
2614
|
|
|
<option value="topics">', $txt['deleteAccount_topics'], '</option> |
2615
|
|
|
</select>'; |
2616
|
|
|
|
2617
|
|
|
if ($context['show_perma_delete']) |
2618
|
|
|
echo ' |
2619
|
|
|
<br> |
2620
|
|
|
<label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1">', $txt['deleteAccount_permanent'], ':</label>'; |
2621
|
|
|
|
2622
|
|
|
echo ' |
2623
|
|
|
</div>'; |
2624
|
|
|
} |
2625
|
|
|
|
2626
|
|
|
echo ' |
2627
|
|
|
<div> |
2628
|
|
|
<label for="deleteAccount"><input type="checkbox" name="deleteAccount" id="deleteAccount" value="1" onclick="if (this.checked) return confirm(\'', $txt['deleteAccount_confirm'], '\');"> ', $txt['deleteAccount_member'], '.</label> |
2629
|
|
|
</div> |
2630
|
|
|
<div> |
2631
|
|
|
<input type="submit" value="', $txt['delete'], '" class="button">'; |
2632
|
|
|
|
2633
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
2634
|
|
|
echo ' |
2635
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2636
|
|
|
|
2637
|
|
|
echo ' |
2638
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
2639
|
|
|
<input type="hidden" name="u" value="', $context['id_member'], '"> |
2640
|
|
|
<input type="hidden" name="sa" value="', $context['menu_item_selected'], '"> |
2641
|
|
|
</div>'; |
2642
|
|
|
} |
2643
|
|
|
echo ' |
2644
|
|
|
</div><!-- .windowbg2 --> |
2645
|
|
|
<br> |
2646
|
|
|
</form>'; |
2647
|
|
|
} |
2648
|
|
|
|
2649
|
|
|
/** |
2650
|
|
|
* Template for the password box/save button stuck at the bottom of every profile page. |
2651
|
|
|
*/ |
2652
|
|
|
function template_profile_save() |
2653
|
|
|
{ |
2654
|
|
|
global $context, $txt; |
|
|
|
|
2655
|
|
|
|
2656
|
|
|
echo ' |
2657
|
|
|
|
2658
|
|
|
<hr>'; |
2659
|
|
|
|
2660
|
|
|
// Only show the password box if it's actually needed. |
2661
|
|
View Code Duplication |
if ($context['require_password']) |
2662
|
|
|
echo ' |
2663
|
|
|
<dl class="settings"> |
2664
|
|
|
<dt> |
2665
|
|
|
<strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
2666
|
|
|
<span class="smalltext">', $txt['required_security_reasons'], '</span> |
2667
|
|
|
</dt> |
2668
|
|
|
<dd> |
2669
|
|
|
<input type="password" name="oldpasswrd" size="20"> |
2670
|
|
|
</dd> |
2671
|
|
|
</dl>'; |
2672
|
|
|
|
2673
|
|
|
echo ' |
2674
|
|
|
<div class="righttext">'; |
2675
|
|
|
|
2676
|
|
View Code Duplication |
if (!empty($context['token_check'])) |
2677
|
|
|
echo ' |
2678
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
2679
|
|
|
|
2680
|
|
|
echo ' |
2681
|
|
|
<input type="submit" value="', $txt['change_profile'], '" class="button"> |
2682
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
2683
|
|
|
<input type="hidden" name="u" value="', $context['id_member'], '"> |
2684
|
|
|
<input type="hidden" name="sa" value="', $context['menu_item_selected'], '"> |
2685
|
|
|
</div>'; |
2686
|
|
|
} |
2687
|
|
|
|
2688
|
|
|
/** |
2689
|
|
|
* Small template for showing an error message upon a save problem in the profile. |
2690
|
|
|
*/ |
2691
|
|
|
function template_error_message() |
|
|
|
|
2692
|
|
|
{ |
2693
|
|
|
global $context, $txt; |
|
|
|
|
2694
|
|
|
|
2695
|
|
|
echo ' |
2696
|
|
|
<div class="errorbox" ', empty($context['post_errors']) ? 'style="display:none" ' : '', 'id="profile_error">'; |
2697
|
|
|
|
2698
|
|
|
if (!empty($context['post_errors'])) |
2699
|
|
|
{ |
2700
|
|
|
echo ' |
2701
|
|
|
<span>', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], ':</span> |
2702
|
|
|
<ul id="list_errors">'; |
2703
|
|
|
|
2704
|
|
|
// Cycle through each error and display an error message. |
2705
|
|
|
foreach ($context['post_errors'] as $error) |
2706
|
|
|
echo ' |
2707
|
|
|
<li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
2708
|
|
|
|
2709
|
|
|
echo ' |
2710
|
|
|
</ul>'; |
2711
|
|
|
} |
2712
|
|
|
|
2713
|
|
|
echo ' |
2714
|
|
|
</div><!-- #profile_error -->'; |
2715
|
|
|
} |
2716
|
|
|
|
2717
|
|
|
/** |
2718
|
|
|
* Display a load of drop down selectors for allowing the user to change group. |
2719
|
|
|
*/ |
2720
|
|
|
function template_profile_group_manage() |
2721
|
|
|
{ |
2722
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
2723
|
|
|
|
2724
|
|
|
echo ' |
2725
|
|
|
<dt> |
2726
|
|
|
<strong>', $txt['primary_membergroup'], ': </strong><br> |
2727
|
|
|
<span class="smalltext"><a href="', $scripturl, '?action=helpadmin;help=moderator_why_missing" onclick="return reqOverlayDiv(this.href);"><span class="generic_icons help"></span> ', $txt['moderator_why_missing'], '</a></span> |
2728
|
|
|
</dt> |
2729
|
|
|
<dd> |
2730
|
|
|
<select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
2731
|
|
|
|
2732
|
|
|
// Fill the select box with all primary member groups that can be assigned to a member. |
2733
|
|
|
foreach ($context['member_groups'] as $member_group) |
2734
|
|
|
if (!empty($member_group['can_be_primary'])) |
2735
|
|
|
echo ' |
2736
|
|
|
<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
2737
|
|
|
', $member_group['name'], ' |
2738
|
|
|
</option>'; |
2739
|
|
|
|
2740
|
|
|
echo ' |
2741
|
|
|
</select> |
2742
|
|
|
</dd> |
2743
|
|
|
<dt> |
2744
|
|
|
<strong>', $txt['additional_membergroups'], ':</strong> |
2745
|
|
|
</dt> |
2746
|
|
|
<dd> |
2747
|
|
|
<span id="additional_groupsList"> |
2748
|
|
|
<input type="hidden" name="additional_groups[]" value="0">'; |
2749
|
|
|
|
2750
|
|
|
// For each membergroup show a checkbox so members can be assigned to more than one group. |
2751
|
|
|
foreach ($context['member_groups'] as $member_group) |
2752
|
|
|
if ($member_group['can_be_additional']) |
2753
|
|
|
echo ' |
2754
|
|
|
<label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', '> ', $member_group['name'], '</label><br>'; |
2755
|
|
|
|
2756
|
|
|
echo ' |
2757
|
|
|
</span> |
2758
|
|
|
<a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a> |
2759
|
|
|
<script> |
2760
|
|
|
document.getElementById("additional_groupsList").style.display = "none"; |
2761
|
|
|
document.getElementById("additional_groupsLink").style.display = ""; |
2762
|
|
|
</script> |
2763
|
|
|
</dd>'; |
2764
|
|
|
|
2765
|
|
|
} |
2766
|
|
|
|
2767
|
|
|
/** |
2768
|
|
|
* Callback function for entering a birthdate! |
2769
|
|
|
*/ |
2770
|
|
|
function template_profile_birthdate() |
2771
|
|
|
{ |
2772
|
|
|
global $txt, $context; |
|
|
|
|
2773
|
|
|
|
2774
|
|
|
// Just show the pretty box! |
2775
|
|
|
echo ' |
2776
|
|
|
<dt> |
2777
|
|
|
<strong>', $txt['dob'], ':</strong><br> |
2778
|
|
|
<span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span> |
2779
|
|
|
</dt> |
2780
|
|
|
<dd> |
2781
|
|
|
<input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '"> - |
2782
|
|
|
<input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '"> - |
2783
|
|
|
<input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '"> |
2784
|
|
|
</dd>'; |
2785
|
|
|
} |
2786
|
|
|
|
2787
|
|
|
/** |
2788
|
|
|
* Show the signature editing box? |
2789
|
|
|
*/ |
2790
|
|
|
function template_profile_signature_modify() |
2791
|
|
|
{ |
2792
|
|
|
global $txt, $context; |
|
|
|
|
2793
|
|
|
|
2794
|
|
|
echo ' |
2795
|
|
|
<dt id="current_signature" style="display:none"> |
2796
|
|
|
<strong>', $txt['current_signature'], ':</strong> |
2797
|
|
|
</dt> |
2798
|
|
|
<dd id="current_signature_display" style="display:none"> |
2799
|
|
|
<hr> |
2800
|
|
|
</dd> |
2801
|
|
|
|
2802
|
|
|
<dt id="preview_signature" style="display:none"> |
2803
|
|
|
<strong>', $txt['signature_preview'], ':</strong> |
2804
|
|
|
</dt> |
2805
|
|
|
<dd id="preview_signature_display" style="display:none"> |
2806
|
|
|
<hr> |
2807
|
|
|
</dd> |
2808
|
|
|
|
2809
|
|
|
<dt> |
2810
|
|
|
<strong>', $txt['signature'], ':</strong><br> |
2811
|
|
|
<span class="smalltext">', $txt['sig_info'], '</span><br> |
2812
|
|
|
<br>'; |
2813
|
|
|
|
2814
|
|
|
if ($context['show_spellchecking']) |
2815
|
|
|
echo ' |
2816
|
|
|
<input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button">'; |
2817
|
|
|
|
2818
|
|
|
echo ' |
2819
|
|
|
</dt> |
2820
|
|
|
<dd> |
2821
|
|
|
<textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br>'; |
2822
|
|
|
|
2823
|
|
|
// If there is a limit at all! |
2824
|
|
|
if (!empty($context['signature_limits']['max_length'])) |
2825
|
|
|
echo ' |
2826
|
|
|
<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
2827
|
|
|
|
2828
|
|
|
if (!empty($context['show_preview_button'])) |
2829
|
|
|
echo ' |
2830
|
|
|
<input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button floatright">'; |
2831
|
|
|
|
2832
|
|
|
if ($context['signature_warning']) |
2833
|
|
|
echo ' |
2834
|
|
|
<span class="smalltext">', $context['signature_warning'], '</span>'; |
2835
|
|
|
|
2836
|
|
|
// Some javascript used to count how many characters have been used so far in the signature. |
2837
|
|
|
echo ' |
2838
|
|
|
<script> |
2839
|
|
|
var maxLength = ', $context['signature_limits']['max_length'], '; |
2840
|
|
|
|
2841
|
|
|
$(document).ready(function() { |
2842
|
|
|
calcCharLeft(); |
2843
|
|
|
$("#preview_button").click(function() { |
2844
|
|
|
return ajax_getSignaturePreview(true); |
2845
|
|
|
}); |
2846
|
|
|
}); |
2847
|
|
|
</script> |
2848
|
|
|
</dd>'; |
2849
|
|
|
} |
2850
|
|
|
|
2851
|
|
|
/** |
2852
|
|
|
* Template for selecting an avatar |
2853
|
|
|
*/ |
2854
|
|
|
function template_profile_avatar_select() |
2855
|
|
|
{ |
2856
|
|
|
global $context, $txt, $modSettings; |
|
|
|
|
2857
|
|
|
|
2858
|
|
|
// Start with the upper menu |
2859
|
|
|
echo ' |
2860
|
|
|
<dt> |
2861
|
|
|
<strong id="personal_picture"><label for="avatar_upload_box">', $txt['personal_picture'], '</label></strong> |
2862
|
|
|
', empty($modSettings['gravatarOverride']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . '><label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['no_avatar'] . '</label><br>' : '', ' |
2863
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . '><label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['choose_avatar_gallery'] . '</label><br>' : '', ' |
2864
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . '><label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['my_own_pic'] . '</label><br>' : '', ' |
2865
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . '><label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['avatar_will_upload'] . '</label><br>' : '', ' |
2866
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_gravatar" value="gravatar"' . ($context['member']['avatar']['choice'] == 'gravatar' ? ' checked="checked"' : '') . '><label for="avatar_choice_gravatar"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['use_gravatar'] . '</label>' : '', ' |
2867
|
|
|
</dt> |
2868
|
|
|
<dd>'; |
2869
|
|
|
|
2870
|
|
|
// If users are allowed to choose avatars stored on the server show selection boxes to choice them from. |
2871
|
|
|
if (!empty($context['member']['avatar']['allow_server_stored'])) |
2872
|
|
|
{ |
2873
|
|
|
echo ' |
2874
|
|
|
<div id="avatar_server_stored"> |
2875
|
|
|
<div> |
2876
|
|
|
<select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
2877
|
|
|
|
2878
|
|
|
// This lists all the file categories. |
2879
|
|
|
foreach ($context['avatars'] as $avatar) |
2880
|
|
|
echo ' |
2881
|
|
|
<option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
2882
|
|
|
|
2883
|
|
|
echo ' |
2884
|
|
|
</select> |
2885
|
|
|
</div> |
2886
|
|
|
<div> |
2887
|
|
|
<select name="file" id="file" size="10" style="display: none;" onchange="showAvatar()" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');" disabled><option></option></select> |
2888
|
|
|
</div> |
2889
|
|
|
<div> |
2890
|
|
|
<img id="avatar" src="', !empty($context['member']['avatar']['allow_external']) && $context['member']['avatar']['choice'] == 'external' ? $context['member']['avatar']['external'] : $modSettings['avatar_url'] . '/blank.png', '" alt="Do Nothing"> |
2891
|
|
|
</div> |
2892
|
|
|
<script> |
2893
|
|
|
var files = ["' . implode('", "', $context['avatar_list']) . '"]; |
2894
|
|
|
var avatar = document.getElementById("avatar"); |
2895
|
|
|
var cat = document.getElementById("cat"); |
2896
|
|
|
var selavatar = "' . $context['avatar_selected'] . '"; |
2897
|
|
|
var avatardir = "' . $modSettings['avatar_url'] . '/"; |
2898
|
|
|
var size = avatar.alt.substr(3, 2) + " " + avatar.alt.substr(0, 2) + String.fromCharCode(117, 98, 116); |
2899
|
|
|
var file = document.getElementById("file"); |
2900
|
|
|
var maxHeight = ', !empty($modSettings['avatar_max_height_external']) ? $modSettings['avatar_max_height_external'] : 0, '; |
2901
|
|
|
var maxWidth = ', !empty($modSettings['avatar_max_width_external']) ? $modSettings['avatar_max_width_external'] : 0, '; |
2902
|
|
|
|
2903
|
|
|
if (avatar.src.indexOf("blank.png") > -1) |
2904
|
|
|
changeSel(selavatar); |
2905
|
|
|
else |
2906
|
|
|
previewExternalAvatar(avatar.src) |
2907
|
|
|
|
2908
|
|
|
</script> |
2909
|
|
|
</div><!-- #avatar_server_stored -->'; |
2910
|
|
|
} |
2911
|
|
|
|
2912
|
|
|
// If the user can link to an off server avatar, show them a box to input the address. |
2913
|
|
|
if (!empty($context['member']['avatar']['allow_external'])) |
2914
|
|
|
echo ' |
2915
|
|
|
<div id="avatar_external"> |
2916
|
|
|
<div class="smalltext">', $txt['avatar_by_url'], '</div>', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', ' |
2917
|
|
|
<input type="text" name="userpicpersonal" size="45" value="', ((stristr($context['member']['avatar']['external'], 'http://') || stristr($context['member']['avatar']['external'], 'https://')) ? $context['member']['avatar']['external'] : 'http://'), '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);"> |
2918
|
|
|
</div>'; |
2919
|
|
|
|
2920
|
|
|
// If the user is able to upload avatars to the server show them an upload box. |
2921
|
|
|
if (!empty($context['member']['avatar']['allow_upload'])) |
2922
|
|
|
echo ' |
2923
|
|
|
<div id="avatar_upload"> |
2924
|
|
|
<input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onchange="readfromUpload(this)" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" accept="image/gif, image/jpeg, image/jpg, image/png">', template_max_size('upload'), ' |
2925
|
|
|
', (!empty($context['member']['avatar']['id_attach']) ? '<br><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&') . 'time=' . time() . '" alt="" id="attached_image"><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '">' : ''), ' |
2926
|
|
|
</div>'; |
2927
|
|
|
|
2928
|
|
|
// if the user is able to use Gravatar avatars show then the image preview |
2929
|
|
|
if (!empty($context['member']['avatar']['allow_gravatar'])) |
2930
|
|
|
{ |
2931
|
|
|
echo ' |
2932
|
|
|
<div id="avatar_gravatar"> |
2933
|
|
|
<img src="' . $context['member']['avatar']['href'] . '" alt="">'; |
2934
|
|
|
|
2935
|
|
|
if (empty($modSettings['gravatarAllowExtraEmail'])) |
2936
|
|
|
echo ' |
2937
|
|
|
<div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
2938
|
|
|
else |
2939
|
|
|
{ |
2940
|
|
|
// Depending on other stuff, the stored value here might have some odd things in it from other areas. |
2941
|
|
|
if ($context['member']['avatar']['external'] == $context['member']['email']) |
2942
|
|
|
$textbox_value = ''; |
2943
|
|
|
else |
2944
|
|
|
$textbox_value = $context['member']['avatar']['external']; |
2945
|
|
|
|
2946
|
|
|
echo ' |
2947
|
|
|
<div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
2948
|
|
|
<input type="text" name="gravatarEmail" id="gravatarEmail" size="45" value="', $textbox_value, '">'; |
2949
|
|
|
} |
2950
|
|
|
echo ' |
2951
|
|
|
</div><!-- #avatar_gravatar -->'; |
2952
|
|
|
} |
2953
|
|
|
|
2954
|
|
|
echo ' |
2955
|
|
|
<script> |
2956
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "' . ($context['member']['avatar']['choice'] == 'server_stored' ? '' : 'none') . '";' : '', ' |
2957
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "' . ($context['member']['avatar']['choice'] == 'external' ? '' : 'none') . '";' : '', ' |
2958
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "' . ($context['member']['avatar']['choice'] == 'upload' ? '' : 'none') . '";' : '', ' |
2959
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? 'document.getElementById("avatar_gravatar").style.display = "' . ($context['member']['avatar']['choice'] == 'gravatar' ? '' : 'none') . '";' : '', ' |
2960
|
|
|
|
2961
|
|
|
function swap_avatar(type) |
2962
|
|
|
{ |
2963
|
|
|
switch(type.id) |
2964
|
|
|
{ |
2965
|
|
|
case "avatar_choice_server_stored": |
2966
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "";' : '', ' |
2967
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', ' |
2968
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', ' |
2969
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? 'document.getElementById("avatar_gravatar").style.display = "none";' : '', ' |
2970
|
|
|
break; |
2971
|
|
|
case "avatar_choice_external": |
2972
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', ' |
2973
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "";' : '', ' |
2974
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', ' |
2975
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? 'document.getElementById("avatar_gravatar").style.display = "none";' : '', ' |
2976
|
|
|
break; |
2977
|
|
|
case "avatar_choice_upload": |
2978
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', ' |
2979
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', ' |
2980
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "";' : '', ' |
2981
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? 'document.getElementById("avatar_gravatar").style.display = "none";' : '', ' |
2982
|
|
|
break; |
2983
|
|
|
case "avatar_choice_none": |
2984
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', ' |
2985
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', ' |
2986
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', ' |
2987
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? 'document.getElementById("avatar_gravatar").style.display = "none";' : '', ' |
2988
|
|
|
break; |
2989
|
|
|
case "avatar_choice_gravatar": |
2990
|
|
|
', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', ' |
2991
|
|
|
', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', ' |
2992
|
|
|
', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', ' |
2993
|
|
|
', !empty($context['member']['avatar']['allow_gravatar']) ? 'document.getElementById("avatar_gravatar").style.display = "";' : '', ' |
2994
|
|
|
', ($context['member']['avatar']['external'] == $context['member']['email'] || strstr($context['member']['avatar']['external'], 'http://')) ? |
2995
|
|
|
'document.getElementById("gravatarEmail").value = "";' : '', ' |
2996
|
|
|
break; |
2997
|
|
|
} |
2998
|
|
|
} |
2999
|
|
|
</script> |
3000
|
|
|
</dd>'; |
3001
|
|
|
} |
3002
|
|
|
|
3003
|
|
|
/** |
3004
|
|
|
* This is just a really little helper to avoid duplicating code unnecessarily |
3005
|
|
|
* |
3006
|
|
|
* @param string $type The type of avatar |
3007
|
|
|
*/ |
3008
|
|
|
function template_max_size($type) |
3009
|
|
|
{ |
3010
|
|
|
global $modSettings, $txt; |
|
|
|
|
3011
|
|
|
|
3012
|
|
|
$w = !empty($modSettings['avatar_max_width_' . $type]) ? comma_format($modSettings['avatar_max_width_' . $type]) : 0; |
|
|
|
|
3013
|
|
|
$h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
|
|
|
|
3014
|
|
|
|
3015
|
|
|
$suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
3016
|
|
|
if (empty($suffix)) |
3017
|
|
|
return; |
3018
|
|
|
|
3019
|
|
|
echo ' |
3020
|
|
|
<div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
3021
|
|
|
} |
3022
|
|
|
|
3023
|
|
|
/** |
3024
|
|
|
* Select the time format! |
3025
|
|
|
*/ |
3026
|
|
|
function template_profile_timeformat_modify() |
3027
|
|
|
{ |
3028
|
|
|
global $context, $txt, $scripturl; |
|
|
|
|
3029
|
|
|
|
3030
|
|
|
echo ' |
3031
|
|
|
<dt> |
3032
|
|
|
<strong><label for="easyformat">', $txt['time_format'], ':</label></strong><br> |
3033
|
|
|
<a href="', $scripturl, '?action=helpadmin;help=time_format" onclick="return reqOverlayDiv(this.href);" class="help"><span class="generic_icons help" title="', $txt['help'], '"></span></a> |
3034
|
|
|
<span class="smalltext"> |
3035
|
|
|
<label for="time_format">', $txt['date_format'], '</label> |
3036
|
|
|
</span> |
3037
|
|
|
</dt> |
3038
|
|
|
<dd> |
3039
|
|
|
<select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;">'; |
3040
|
|
|
|
3041
|
|
|
// Help the user by showing a list of common time formats. |
3042
|
|
|
foreach ($context['easy_timeformats'] as $time_format) |
3043
|
|
|
echo ' |
3044
|
|
|
<option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
3045
|
|
|
|
3046
|
|
|
echo ' |
3047
|
|
|
</select> |
3048
|
|
|
<input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30"> |
3049
|
|
|
</dd>'; |
3050
|
|
|
} |
3051
|
|
|
|
3052
|
|
|
/** |
3053
|
|
|
* Template for picking a theme |
3054
|
|
|
*/ |
3055
|
|
|
function template_profile_theme_pick() |
3056
|
|
|
{ |
3057
|
|
|
global $txt, $context, $scripturl; |
|
|
|
|
3058
|
|
|
|
3059
|
|
|
echo ' |
3060
|
|
|
<dt> |
3061
|
|
|
<strong>', $txt['current_theme'], ':</strong> |
3062
|
|
|
</dt> |
3063
|
|
|
<dd> |
3064
|
|
|
', $context['member']['theme']['name'], ' [<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['change'], '</a>] |
3065
|
|
|
</dd>'; |
3066
|
|
|
} |
3067
|
|
|
|
3068
|
|
|
/** |
3069
|
|
|
* Smiley set picker. |
3070
|
|
|
*/ |
3071
|
|
|
function template_profile_smiley_pick() |
3072
|
|
|
{ |
3073
|
|
|
global $txt, $context, $modSettings, $settings; |
|
|
|
|
3074
|
|
|
|
3075
|
|
|
echo ' |
3076
|
|
|
<dt> |
3077
|
|
|
<strong><label for="smiley_set">', $txt['smileys_current'], ':</label></strong> |
3078
|
|
|
</dt> |
3079
|
|
|
<dd> |
3080
|
|
|
<select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.png\';">'; |
3081
|
|
|
|
3082
|
|
|
foreach ($context['smiley_sets'] as $set) |
3083
|
|
|
echo ' |
3084
|
|
|
<option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
3085
|
|
|
|
3086
|
|
|
echo ' |
3087
|
|
|
</select> |
3088
|
|
|
<img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.png' : $settings['images_url'] . '/blank.png', '" alt=":)"> |
3089
|
|
|
</dd>'; |
3090
|
|
|
} |
3091
|
|
|
|
3092
|
|
|
/** |
3093
|
|
|
* Template for setting up and managing Two-Factor Authentication. |
3094
|
|
|
*/ |
3095
|
|
|
function template_tfasetup() |
3096
|
|
|
{ |
3097
|
|
|
global $txt, $context, $scripturl, $modSettings; |
|
|
|
|
3098
|
|
|
|
3099
|
|
|
echo ' |
3100
|
|
|
<div class="cat_bar"> |
3101
|
|
|
<h3 class="catbg">', $txt['tfa_title'], '</h3> |
3102
|
|
|
</div> |
3103
|
|
|
<div class="roundframe"> |
3104
|
|
|
<div> |
3105
|
|
|
', !empty($context['tfa_backup']) ? ' |
3106
|
|
|
<div class="smalltext error">' . $txt['tfa_backup_used_desc'] . '</div>' : |
3107
|
|
|
($modSettings['tfa_mode'] == 2 ? ' |
3108
|
|
|
<div class="smalltext"><strong>' . $txt['tfa_forced_desc'] . '</strong></div>' : ''), ' |
3109
|
|
|
<div class="smalltext">', $txt['tfa_desc'], '</div> |
3110
|
|
|
<div class="floatleft"> |
3111
|
|
|
<form action="', $scripturl, '?action=profile;area=tfasetup" method="post"> |
3112
|
|
|
<div class="title_top"> |
3113
|
|
|
<strong>', $txt['tfa_step1'], '</strong><br> |
3114
|
|
|
', !empty($context['tfa_pass_error']) ? '<div class="error smalltext">' . $txt['tfa_pass_invalid'] . '</div>' : '', ' |
3115
|
|
|
<input type="password" name="passwd" size="25"', !empty($context['tfa_pass_error']) ? ' class="error"' : '', !empty($context['tfa_pass_value']) ? ' value="' . $context['tfa_pass_value'] . '"' : '', '> |
3116
|
|
|
</div> |
3117
|
|
|
<div class="title_top"> |
3118
|
|
|
<strong>', $txt['tfa_step2'], '</strong> |
3119
|
|
|
<div class="smalltext">', $txt['tfa_step2_desc'], '</div> |
3120
|
|
|
<div class="tfacode">', $context['tfa_secret'], '</div> |
3121
|
|
|
</div> |
3122
|
|
|
<div class="title_top"> |
3123
|
|
|
<strong>', $txt['tfa_step3'], '</strong><br> |
3124
|
|
|
', !empty($context['tfa_error']) ? '<div class="error smalltext">' . $txt['tfa_code_invalid'] . '</div>' : '', ' |
3125
|
|
|
<input type="text" name="tfa_code" size="25"', !empty($context['tfa_error']) ? ' class="error"' : '', !empty($context['tfa_value']) ? ' value="' . $context['tfa_value'] . '"' : '', '> |
3126
|
|
|
<input type="submit" name="save" value="', $txt['tfa_enable'], '" class="button"> |
3127
|
|
|
</div> |
3128
|
|
|
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '"> |
3129
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
3130
|
|
|
</form> |
3131
|
|
|
</div> |
3132
|
|
|
<div class="floatright tfa_qrcode"> |
3133
|
|
|
<img src="', $context['tfa_qr_url'], '" alt=""> |
3134
|
|
|
</div>'; |
3135
|
|
|
|
3136
|
|
|
if (!empty($context['from_ajax'])) |
3137
|
|
|
echo ' |
3138
|
|
|
<br> |
3139
|
|
|
<a href="javascript:self.close();"></a>'; |
3140
|
|
|
|
3141
|
|
|
echo ' |
3142
|
|
|
</div> |
3143
|
|
|
</div><!-- .roundframe -->'; |
3144
|
|
|
} |
3145
|
|
|
|
3146
|
|
|
/** |
3147
|
|
|
* Template for setting up 2FA backup code |
3148
|
|
|
*/ |
3149
|
|
|
function template_tfasetup_backup() |
3150
|
|
|
{ |
3151
|
|
|
global $context, $txt; |
|
|
|
|
3152
|
|
|
|
3153
|
|
|
echo ' |
3154
|
|
|
<div class="cat_bar"> |
3155
|
|
|
<h3 class="catbg">', $txt['tfa_backup_title'], '</h3> |
3156
|
|
|
</div> |
3157
|
|
|
<div class="roundframe"> |
3158
|
|
|
<div> |
3159
|
|
|
<div class="smalltext">', $txt['tfa_backup_desc'], '</div> |
3160
|
|
|
<div class="bbc_code" style="resize: none; border: none;">', $context['tfa_backup'], '</div> |
3161
|
|
|
</div> |
3162
|
|
|
</div>'; |
3163
|
|
|
} |
3164
|
|
|
|
3165
|
|
|
/** |
3166
|
|
|
* Simple template for showing the 2FA area when editing a profile. |
3167
|
|
|
*/ |
3168
|
|
|
function template_profile_tfa() |
3169
|
|
|
{ |
3170
|
|
|
global $context, $txt, $scripturl, $modSettings; |
|
|
|
|
3171
|
|
|
|
3172
|
|
|
echo ' |
3173
|
|
|
<dt> |
3174
|
|
|
<strong>', $txt['tfa_profile_label'], ':</strong><br> |
3175
|
|
|
<div class="smalltext">', $txt['tfa_profile_desc'], '</div> |
3176
|
|
|
</dt> |
3177
|
|
|
<dd>'; |
3178
|
|
|
|
3179
|
|
|
if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
3180
|
|
|
echo ' |
3181
|
|
|
<a href="', !empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
3182
|
|
|
|
3183
|
|
|
elseif (!$context['tfa_enabled']) |
3184
|
|
|
echo ' |
3185
|
|
|
', $txt['tfa_profile_disabled']; |
3186
|
|
|
|
3187
|
|
|
else |
3188
|
|
|
echo ' |
3189
|
|
|
', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
3190
|
|
|
|
3191
|
|
|
echo ' |
3192
|
|
|
</dd>'; |
3193
|
|
|
} |
3194
|
|
|
|
3195
|
|
|
?> |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state