|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @name ElkArte Forum |
|
5
|
|
|
* @copyright ElkArte Forum contributors |
|
6
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause |
|
7
|
|
|
* |
|
8
|
|
|
* This file contains code covered by: |
|
9
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
|
10
|
|
|
* license: BSD, See included LICENSE.TXT for terms and conditions. |
|
11
|
|
|
* |
|
12
|
|
|
* @version 2.0 dev |
|
13
|
|
|
* |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Add settings that will be used in the template |
|
18
|
|
|
*/ |
|
19
|
|
|
function template_ProfileInfo_init() |
|
20
|
|
|
{ |
|
21
|
|
|
global $settings; |
|
22
|
|
|
|
|
23
|
|
|
// This piece is used to style attachments awaiting approval in the list |
|
24
|
|
|
$settings['attachments_awaiting_approval'] = '{attachment_link} (<em>{txt_awaiting}</em>)'; |
|
25
|
|
|
|
|
26
|
|
|
// This setting is used to load a certain number of attachments |
|
27
|
|
|
// in the user's profile summary, change it to a number if you need any |
|
28
|
|
|
$settings['attachments_on_summary'] = 10; |
|
29
|
|
|
|
|
30
|
|
|
theme()->getTemplates()->load('GenericMessages'); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* This template displays users details without any option to edit them. |
|
35
|
|
|
*/ |
|
36
|
|
|
function template_action_summary() |
|
37
|
|
|
{ |
|
38
|
|
|
global $context; |
|
39
|
|
|
|
|
40
|
|
|
// We do have some data to show I would hope |
|
41
|
|
|
if (!empty($context['summarytabs'])) |
|
42
|
|
|
{ |
|
43
|
|
|
// All the tab names |
|
44
|
|
|
$tabs = array_keys($context['summarytabs']); |
|
45
|
|
|
$tab_num = 0; |
|
46
|
|
|
|
|
47
|
|
|
// Start with the navigation ul, its converted to the tab navigation by jqueryUI |
|
48
|
|
|
echo ' |
|
49
|
|
|
<div class="profile_center"> |
|
50
|
|
|
<div id="tabs"> |
|
51
|
|
|
<ul>'; |
|
52
|
|
|
|
|
53
|
|
|
// A link for every tab |
|
54
|
|
|
foreach ($tabs as $tab) |
|
55
|
|
|
{ |
|
56
|
|
|
$tab_num++; |
|
57
|
|
|
echo ' |
|
58
|
|
|
<li> |
|
59
|
|
|
<a href="', (isset($context['summarytabs'][$tab]['href']) ? $context['summarytabs'][$tab]['href'] : '#tab_' . $tab_num), '">', $context['summarytabs'][$tab]['name'], '</a> |
|
60
|
|
|
</li>'; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
echo ' |
|
64
|
|
|
</ul>'; |
|
65
|
|
|
|
|
66
|
|
|
// For preload tabs (those without href), output the content divs and call the templates as defined by the tabs |
|
67
|
|
|
$tab_num = 0; |
|
68
|
|
|
foreach ($tabs as $tab) |
|
69
|
|
|
{ |
|
70
|
|
|
if (isset($context['summarytabs'][$tab]['href'])) |
|
71
|
|
|
continue; |
|
72
|
|
|
|
|
73
|
|
|
// Start a tab |
|
74
|
|
|
$tab_num++; |
|
75
|
|
|
echo ' |
|
76
|
|
|
<div id="tab_', $tab_num, '">'; |
|
77
|
|
|
|
|
78
|
|
|
// Each template in the tab gets placed in a container |
|
79
|
|
|
foreach ($context['summarytabs'][$tab]['templates'] as $templates) |
|
80
|
|
|
{ |
|
81
|
|
|
echo ' |
|
82
|
|
|
<div class="profile_content">'; |
|
83
|
|
|
|
|
84
|
|
|
// This container has multiple templates in it (like side x side) |
|
85
|
|
|
if (is_array($templates)) |
|
86
|
|
|
{ |
|
87
|
|
|
foreach ($templates as $template) |
|
88
|
|
|
{ |
|
89
|
|
|
$block = 'template_profile_block_' . $template; |
|
90
|
|
|
$block(); |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
// Or just a single template is fine |
|
94
|
|
|
else |
|
95
|
|
|
{ |
|
96
|
|
|
$block = 'template_profile_block_' . $templates; |
|
97
|
|
|
$block(); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
echo ' |
|
101
|
|
|
</div>'; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
// Close the tab |
|
105
|
|
|
echo ' |
|
106
|
|
|
</div>'; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
// Close the profile center |
|
110
|
|
|
echo ' |
|
111
|
|
|
</div> |
|
112
|
|
|
</div>'; |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Template for showing all the posts of the user, in chronological order. |
|
118
|
|
|
*/ |
|
119
|
|
|
function template_action_showPosts() |
|
120
|
|
|
{ |
|
121
|
|
|
global $context, $txt; |
|
122
|
|
|
|
|
123
|
|
|
template_pagesection(); |
|
124
|
|
|
|
|
125
|
|
|
echo ' |
|
126
|
|
|
<div id="recentposts" class="profile_center"> |
|
127
|
|
|
<h2 class="category_header"> |
|
128
|
|
|
', empty($context['is_topics']) ? $txt['showMessages'] : $txt['showTopics'], $context['user']['is_owner'] ? '' : ' - ' . $context['member']['name'], ' |
|
129
|
|
|
</h2>'; |
|
130
|
|
|
|
|
131
|
|
|
// No posts? Just end the table with a informative message. |
|
132
|
|
|
if (empty($context['posts'])) |
|
133
|
|
|
echo ' |
|
134
|
|
|
<div class="content"> |
|
135
|
|
|
', $context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none'], ' |
|
136
|
|
|
</div>'; |
|
137
|
|
|
else |
|
138
|
|
|
{ |
|
139
|
|
|
// For every post to be displayed, give it its own div, and show the important details of the post. |
|
140
|
|
View Code Duplication |
foreach ($context['posts'] as $post) |
|
141
|
|
|
{ |
|
142
|
|
|
$post['title'] = '<strong>' . $post['board']['link'] . ' / ' . $post['topic']['link'] . '</strong>'; |
|
143
|
|
|
$post['date'] = $post['html_time']; |
|
144
|
|
|
$post['class'] = 'content'; |
|
145
|
|
|
|
|
146
|
|
|
if (!$post['approved']) |
|
147
|
|
|
$post['body'] = ' |
|
148
|
|
|
<div class="approve_post"> |
|
149
|
|
|
<em>' . $txt['post_awaiting_approval'] . '</em> |
|
150
|
|
|
</div>' . ' |
|
151
|
|
|
' . $post['body']; |
|
152
|
|
|
|
|
153
|
|
|
template_simple_message($post); |
|
154
|
|
|
} |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
echo ' |
|
158
|
|
|
</div>'; |
|
159
|
|
|
|
|
160
|
|
|
// Show more page numbers. |
|
161
|
|
|
template_pagesection(); |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* Show the individual users permissions |
|
166
|
|
|
*/ |
|
167
|
|
|
function template_action_showPermissions() |
|
168
|
|
|
{ |
|
169
|
|
|
global $context, $scripturl, $txt; |
|
170
|
|
|
|
|
171
|
|
|
echo ' |
|
172
|
|
|
<h2 class="category_header hdicon cat_img_profile"> |
|
173
|
|
|
', $txt['showPermissions'], ' |
|
174
|
|
|
</h2>'; |
|
175
|
|
|
|
|
176
|
|
|
if ($context['member']['has_all_permissions']) |
|
177
|
|
|
{ |
|
178
|
|
|
echo ' |
|
179
|
|
|
<p class="description">', $txt['showPermissions_all'], '</p>'; |
|
180
|
|
|
} |
|
181
|
|
|
else |
|
182
|
|
|
{ |
|
183
|
|
|
echo ' |
|
184
|
|
|
<p class="description">', $txt['showPermissions_help'], '</p> |
|
185
|
|
|
<div id="permissions" class="flow_hidden">'; |
|
186
|
|
|
|
|
187
|
|
|
if (!empty($context['no_access_boards'])) |
|
188
|
|
|
{ |
|
189
|
|
|
echo ' |
|
190
|
|
|
<h2 class="category_header">', $txt['showPermissions_restricted_boards'], '</h2> |
|
191
|
|
|
<div class="content smalltext">', $txt['showPermissions_restricted_boards_desc'], ':<br />'; |
|
192
|
|
|
|
|
193
|
|
|
foreach ($context['no_access_boards'] as $no_access_board) |
|
194
|
|
|
echo ' |
|
195
|
|
|
', $no_access_board['name'], $no_access_board['is_last'] ? '' : ', '; |
|
196
|
|
|
|
|
197
|
|
|
echo ' |
|
198
|
|
|
</div>'; |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
// General Permissions section. |
|
202
|
|
|
echo ' |
|
203
|
|
|
<div> |
|
204
|
|
|
<h4 class="category_header">', $txt['showPermissions_general'], '</h4>'; |
|
205
|
|
|
|
|
206
|
|
View Code Duplication |
if (!empty($context['member']['permissions']['general'])) |
|
207
|
|
|
{ |
|
208
|
|
|
echo ' |
|
209
|
|
|
<table class="table_grid"> |
|
210
|
|
|
<thead> |
|
211
|
|
|
<tr class="table_head"> |
|
212
|
|
|
<th scope="col" class="lefttext" style="width: 50%;">', $txt['showPermissions_permission'], '</th> |
|
213
|
|
|
<th scope="col" class="lefttext" style="width: 50%;">', $txt['showPermissions_status'], '</th> |
|
214
|
|
|
</tr> |
|
215
|
|
|
</thead> |
|
216
|
|
|
<tbody>'; |
|
217
|
|
|
|
|
218
|
|
|
foreach ($context['member']['permissions']['general'] as $permission) |
|
219
|
|
|
{ |
|
220
|
|
|
echo ' |
|
221
|
|
|
<tr> |
|
222
|
|
|
<td title="', $permission['id'], '"> |
|
223
|
|
|
', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], ' |
|
224
|
|
|
</td> |
|
225
|
|
|
<td class="smalltext">'; |
|
226
|
|
|
|
|
227
|
|
|
if ($permission['is_denied']) |
|
228
|
|
|
echo ' |
|
229
|
|
|
<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
|
230
|
|
|
else |
|
231
|
|
|
echo ' |
|
232
|
|
|
', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
|
233
|
|
|
|
|
234
|
|
|
echo ' |
|
235
|
|
|
</td> |
|
236
|
|
|
</tr>'; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
echo ' |
|
240
|
|
|
</tbody> |
|
241
|
|
|
</table> |
|
242
|
|
|
</div><br />'; |
|
243
|
|
|
} |
|
244
|
|
|
else |
|
245
|
|
|
echo ' |
|
246
|
|
|
<p class="description">', $txt['showPermissions_none_general'], '</p>'; |
|
247
|
|
|
|
|
248
|
|
|
// Board permission section. |
|
249
|
|
|
echo ' |
|
250
|
|
|
<div> |
|
251
|
|
|
<form action="' . $scripturl . '?action=profile;u=', $context['id_member'], ';area=permissions#board_permissions" method="post" accept-charset="UTF-8"> |
|
252
|
|
|
<h4 class="category_header"> |
|
253
|
|
|
<a id="board_permissions"></a>', $txt['showPermissions_select'], ': |
|
254
|
|
|
<select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
|
255
|
|
|
<option value="0"', $context['board'] == 0 ? ' selected="selected"' : '', '>', $txt['showPermissions_global'], ' </option>'; |
|
256
|
|
|
|
|
257
|
|
|
if (!empty($context['boards'])) |
|
258
|
|
|
echo ' |
|
259
|
|
|
<option value="" disabled="disabled">', str_repeat('—', strlen($txt['showPermissions_global'])), '</option>'; |
|
260
|
|
|
|
|
261
|
|
|
// Fill the box with any local permission boards. |
|
262
|
|
View Code Duplication |
foreach ($context['boards'] as $board) |
|
263
|
|
|
echo ' |
|
264
|
|
|
<option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
|
265
|
|
|
|
|
266
|
|
|
echo ' |
|
267
|
|
|
</select> |
|
268
|
|
|
</h4> |
|
269
|
|
|
</form>'; |
|
270
|
|
|
|
|
271
|
|
View Code Duplication |
if (!empty($context['member']['permissions']['board'])) |
|
272
|
|
|
{ |
|
273
|
|
|
echo ' |
|
274
|
|
|
<table class="table_grid"> |
|
275
|
|
|
<thead> |
|
276
|
|
|
<tr class="table_head"> |
|
277
|
|
|
<th scope="col" class="lefttext" style="width: 50%;">', $txt['showPermissions_permission'], '</th> |
|
278
|
|
|
<th scope="col" class="lefttext" style="width: 50%;">', $txt['showPermissions_status'], '</th> |
|
279
|
|
|
</tr> |
|
280
|
|
|
</thead> |
|
281
|
|
|
<tbody>'; |
|
282
|
|
|
|
|
283
|
|
|
foreach ($context['member']['permissions']['board'] as $permission) |
|
284
|
|
|
{ |
|
285
|
|
|
echo ' |
|
286
|
|
|
<tr> |
|
287
|
|
|
<td title="', $permission['id'], '"> |
|
288
|
|
|
', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], ' |
|
289
|
|
|
</td> |
|
290
|
|
|
<td class="smalltext">'; |
|
291
|
|
|
|
|
292
|
|
|
if ($permission['is_denied']) |
|
293
|
|
|
echo ' |
|
294
|
|
|
<span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
|
295
|
|
|
else |
|
296
|
|
|
echo ' |
|
297
|
|
|
', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
|
298
|
|
|
|
|
299
|
|
|
echo ' |
|
300
|
|
|
</td> |
|
301
|
|
|
</tr>'; |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
echo ' |
|
305
|
|
|
</tbody> |
|
306
|
|
|
</table>'; |
|
307
|
|
|
} |
|
308
|
|
|
else |
|
309
|
|
|
echo ' |
|
310
|
|
|
<p class="description">', $txt['showPermissions_none_board'], '</p>'; |
|
311
|
|
|
|
|
312
|
|
|
echo ' |
|
313
|
|
|
</div> |
|
314
|
|
|
</div>'; |
|
315
|
|
|
} |
|
316
|
|
|
} |
|
317
|
|
|
|
|
318
|
|
|
/** |
|
319
|
|
|
* Template for user statistics, showing graphs and the like. |
|
320
|
|
|
*/ |
|
321
|
|
|
function template_action_statPanel() |
|
322
|
|
|
{ |
|
323
|
|
|
global $context, $txt; |
|
324
|
|
|
|
|
325
|
|
|
// First, show a few text statistics such as post/topic count. |
|
326
|
|
|
echo ' |
|
327
|
|
|
<div id="profileview"> |
|
328
|
|
|
<div id="generalstats"> |
|
329
|
|
|
<div class="content content_noframe"> |
|
330
|
|
|
<dl> |
|
331
|
|
|
<dt>', $txt['statPanel_total_time_online'], ':</dt> |
|
332
|
|
|
<dd>', $context['time_logged_in'], '</dd> |
|
333
|
|
|
<dt>', $txt['statPanel_total_posts'], ':</dt> |
|
334
|
|
|
<dd>', $context['num_posts'], ' ', $txt['statPanel_posts'], '</dd> |
|
335
|
|
|
<dt>', $txt['statPanel_total_topics'], ':</dt> |
|
336
|
|
|
<dd>', $context['num_topics'], ' ', $txt['statPanel_topics'], '</dd> |
|
337
|
|
|
<dt>', $txt['statPanel_users_polls'], ':</dt> |
|
338
|
|
|
<dd>', $context['num_polls'], ' ', $txt['statPanel_polls'], '</dd> |
|
339
|
|
|
<dt>', $txt['statPanel_users_votes'], ':</dt> |
|
340
|
|
|
<dd>', $context['num_votes'], ' ', $txt['statPanel_votes'], '</dd> |
|
341
|
|
|
</dl> |
|
342
|
|
|
</div> |
|
343
|
|
|
</div>'; |
|
344
|
|
|
|
|
345
|
|
|
// This next section draws a graph showing what times of day they post the most. |
|
346
|
|
|
echo ' |
|
347
|
|
|
<div class="separator"></div> |
|
348
|
|
|
<div id="activitytime" class="flow_hidden"> |
|
349
|
|
|
<h2 class="category_header hdicon cat_img_clock"> |
|
350
|
|
|
', $txt['statPanel_activityTime'], ' |
|
351
|
|
|
</h2> |
|
352
|
|
|
<div class="content content_noframe">'; |
|
353
|
|
|
|
|
354
|
|
|
// If they haven't post at all, don't draw the graph. |
|
355
|
|
|
if (empty($context['posts_by_time'])) |
|
356
|
|
|
echo ' |
|
357
|
|
|
<span class="centertext">', $txt['statPanel_noPosts'], '</span>'; |
|
358
|
|
|
// Otherwise do! |
|
359
|
|
|
else |
|
360
|
|
|
{ |
|
361
|
|
|
echo ' |
|
362
|
|
|
<ul class="activity_stats flow_hidden">'; |
|
363
|
|
|
|
|
364
|
|
|
// The labels. |
|
365
|
|
|
foreach ($context['posts_by_time'] as $time_of_day) |
|
366
|
|
|
{ |
|
367
|
|
|
echo ' |
|
368
|
|
|
<li> |
|
369
|
|
|
<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']), '"> |
|
370
|
|
|
<div style="height: ', (int) $time_of_day['relative_percent'], 'px;"> |
|
371
|
|
|
<span>', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '</span> |
|
372
|
|
|
</div> |
|
373
|
|
|
</div> |
|
374
|
|
|
<span class="stats_hour">', $time_of_day['hour_format'], '</span> |
|
375
|
|
|
</li>'; |
|
376
|
|
|
} |
|
377
|
|
|
|
|
378
|
|
|
echo ' |
|
379
|
|
|
</ul>'; |
|
380
|
|
|
} |
|
381
|
|
|
|
|
382
|
|
|
echo ' |
|
383
|
|
|
<span class="clear"></span> |
|
384
|
|
|
</div> |
|
385
|
|
|
</div>'; |
|
386
|
|
|
|
|
387
|
|
|
// Two columns with the most popular boards by posts and activity (activity = users posts / total posts). |
|
388
|
|
|
echo ' |
|
389
|
|
|
<div class="flow_hidden"> |
|
390
|
|
|
<div id="popularposts"> |
|
391
|
|
|
<h2 class="category_header hdicon cat_img_write"> |
|
392
|
|
|
', $txt['statPanel_topBoards'], ' |
|
393
|
|
|
</h2> |
|
394
|
|
|
<div class="content content_noframe">'; |
|
395
|
|
|
|
|
396
|
|
View Code Duplication |
if (empty($context['popular_boards'])) |
|
397
|
|
|
echo ' |
|
398
|
|
|
<span class="centertext">', $txt['statPanel_noPosts'], '</span>'; |
|
399
|
|
|
|
|
400
|
|
|
else |
|
401
|
|
|
{ |
|
402
|
|
|
echo ' |
|
403
|
|
|
<dl>'; |
|
404
|
|
|
|
|
405
|
|
|
// Draw a bar for every board. |
|
406
|
|
|
foreach ($context['popular_boards'] as $board) |
|
407
|
|
|
{ |
|
408
|
|
|
echo ' |
|
409
|
|
|
<dt>', $board['link'], '</dt> |
|
410
|
|
|
<dd> |
|
411
|
|
|
<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']), '"> |
|
412
|
|
|
', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), ' |
|
413
|
|
|
</div> |
|
414
|
|
|
<span>', empty($context['hide_num_posts']) ? $board['posts'] : '', '</span> |
|
415
|
|
|
</dd>'; |
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
echo ' |
|
419
|
|
|
</dl>'; |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
echo ' |
|
423
|
|
|
</div> |
|
424
|
|
|
</div> |
|
425
|
|
|
<div id="popularactivity"> |
|
426
|
|
|
<h2 class="category_header hdicon cat_img_piechart"> |
|
427
|
|
|
', $txt['statPanel_topBoardsActivity'], ' |
|
428
|
|
|
</h2> |
|
429
|
|
|
<div class="content content_noframe">'; |
|
430
|
|
|
|
|
431
|
|
View Code Duplication |
if (empty($context['board_activity'])) |
|
432
|
|
|
echo ' |
|
433
|
|
|
<span>', $txt['statPanel_noPosts'], '</span>'; |
|
434
|
|
|
else |
|
435
|
|
|
{ |
|
436
|
|
|
echo ' |
|
437
|
|
|
<dl>'; |
|
438
|
|
|
|
|
439
|
|
|
// Draw a bar for every board. |
|
440
|
|
|
foreach ($context['board_activity'] as $activity) |
|
441
|
|
|
{ |
|
442
|
|
|
echo ' |
|
443
|
|
|
<dt>', $activity['link'], '</dt> |
|
444
|
|
|
<dd> |
|
445
|
|
|
<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']), '"> |
|
446
|
|
|
', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), ' |
|
447
|
|
|
</div> |
|
448
|
|
|
<span>', $activity['percent'], '%</span> |
|
449
|
|
|
</dd>'; |
|
450
|
|
|
} |
|
451
|
|
|
|
|
452
|
|
|
echo ' |
|
453
|
|
|
</dl>'; |
|
454
|
|
|
} |
|
455
|
|
|
|
|
456
|
|
|
echo ' |
|
457
|
|
|
</div> |
|
458
|
|
|
</div> |
|
459
|
|
|
</div> |
|
460
|
|
|
</div>'; |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
/** |
|
464
|
|
|
* Show all warnings of a user |
|
465
|
|
|
*/ |
|
466
|
|
|
function template_viewWarning() |
|
467
|
|
|
{ |
|
468
|
|
|
global $context, $txt; |
|
469
|
|
|
|
|
470
|
|
|
template_load_warning_variables(); |
|
471
|
|
|
|
|
472
|
|
|
echo ' |
|
473
|
|
|
<h2 class="category_header hdicon cat_img_profile"> |
|
474
|
|
|
', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), ' |
|
475
|
|
|
</h2> |
|
476
|
|
|
<p class="description">', $txt['viewWarning_help'], '</p> |
|
477
|
|
|
<div class="content"> |
|
478
|
|
|
<dl class="settings"> |
|
479
|
|
|
<dt> |
|
480
|
|
|
<strong>', $txt['profile_warning_name'], ':</strong> |
|
481
|
|
|
</dt> |
|
482
|
|
|
<dd> |
|
483
|
|
|
', $context['member']['name'], ' |
|
484
|
|
|
</dd> |
|
485
|
|
|
<dt> |
|
486
|
|
|
<strong>', $txt['profile_warning_level'], ':</strong> |
|
487
|
|
|
</dt> |
|
488
|
|
|
<dd> |
|
489
|
|
|
<div class="progress_bar progress_bar_compact"> |
|
490
|
|
|
<div class="full_bar full_bar_compact">', $context['member']['warning'], '%</div> |
|
491
|
|
|
<div class="green_percent green_percent_compact" style="width: ', $context['member']['warning'], '%;"> </div> |
|
492
|
|
|
</div> |
|
493
|
|
|
</dd>'; |
|
494
|
|
|
|
|
495
|
|
|
// There's some impact of this? |
|
496
|
|
|
if (!empty($context['level_effects'][$context['current_level']])) |
|
497
|
|
|
echo ' |
|
498
|
|
|
<dt> |
|
499
|
|
|
<strong>', $txt['profile_viewwarning_impact'], ':</strong> |
|
500
|
|
|
</dt> |
|
501
|
|
|
<dd> |
|
502
|
|
|
', $context['level_effects'][$context['current_level']], ' |
|
503
|
|
|
</dd>'; |
|
504
|
|
|
|
|
505
|
|
|
echo ' |
|
506
|
|
|
</dl> |
|
507
|
|
|
</div>'; |
|
508
|
|
|
|
|
509
|
|
|
template_show_list('view_warnings'); |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
/** |
|
513
|
|
|
* Profile Summary Block |
|
514
|
|
|
* |
|
515
|
|
|
* Show avatar, title, group info, number of posts, karma, likes |
|
516
|
|
|
* Has links to show posts, drafts and attachments |
|
517
|
|
|
*/ |
|
518
|
|
|
function template_profile_block_summary() |
|
519
|
|
|
{ |
|
520
|
|
|
global $txt, $context, $modSettings, $scripturl; |
|
521
|
|
|
|
|
522
|
|
|
echo ' |
|
523
|
|
|
<div class="profileblock_left"> |
|
524
|
|
|
<h2 class="category_header hdicon cat_img_profile"> |
|
525
|
|
|
', ($context['user']['is_owner']) ? '<a href="' . $scripturl . '?action=profile;area=forumprofile;u=' . $context['member']['id'] . '">' . $txt['profile_user_summary'] . '</a>' : $txt['profile_user_summary'], ' |
|
526
|
|
|
</h2> |
|
527
|
|
|
<div id="basicinfo"> |
|
528
|
|
|
<div class="username"> |
|
529
|
|
|
<h4><span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span></h4> |
|
530
|
|
|
</div> |
|
531
|
|
|
', $context['member']['avatar']['image'], ' |
|
532
|
|
|
<span id="userstatus">', template_member_online($context['member']), '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>', '</span> |
|
533
|
|
|
</div> |
|
534
|
|
|
<div id="detailedinfo"> |
|
535
|
|
|
<dl>'; |
|
536
|
|
|
|
|
537
|
|
|
// The members display name |
|
538
|
|
|
echo ' |
|
539
|
|
|
<dt>', $txt['display_name'], ':</dt> |
|
540
|
|
|
<dd>', $context['member']['name'], '</dd>'; |
|
541
|
|
|
|
|
542
|
|
|
// The username if allowed |
|
543
|
|
|
if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
544
|
|
|
echo ' |
|
545
|
|
|
<dt>', $txt['username'], ':</dt> |
|
546
|
|
|
<dd>', $context['member']['username'], '</dd>'; |
|
547
|
|
|
|
|
548
|
|
|
// Some posts stats for fun |
|
549
|
|
|
if (!isset($context['disabled_fields']['posts'])) |
|
550
|
|
|
echo ' |
|
551
|
|
|
<dt>', $txt['profile_posts'], ':</dt> |
|
552
|
|
|
<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
|
553
|
|
|
|
|
554
|
|
|
// Title? |
|
555
|
|
|
if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
556
|
|
|
echo ' |
|
557
|
|
|
<dt>', $txt['custom_title'], ':</dt> |
|
558
|
|
|
<dd>', $context['member']['title'], '</dd>'; |
|
559
|
|
|
|
|
560
|
|
|
// If karma is enabled show the members karma. |
|
561
|
|
|
if ($modSettings['karmaMode'] == '1') |
|
562
|
|
|
echo ' |
|
563
|
|
|
<dt>', $modSettings['karmaLabel'], '</dt> |
|
564
|
|
|
<dd>', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</dd>'; |
|
565
|
|
|
elseif ($modSettings['karmaMode'] == '2') |
|
566
|
|
|
echo ' |
|
567
|
|
|
<dt>', $modSettings['karmaLabel'], '</dt> |
|
568
|
|
|
<dd>+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '</dd>'; |
|
569
|
|
|
|
|
570
|
|
|
// What do they like? |
|
571
|
|
|
if (!empty($modSettings['likes_enabled'])) |
|
572
|
|
|
echo ' |
|
573
|
|
|
<dt>', $txt['likes'], ': </dt> |
|
574
|
|
|
<dd>', $txt['likes_profile_given'], ': ', $context['member']['likes']['given'], ' / ', $txt['likes_profile_received'], ': ', $context['member']['likes']['received'], '</dd>'; |
|
575
|
|
|
|
|
576
|
|
|
// Some links to this users fine work |
|
577
|
|
|
echo ' |
|
578
|
|
|
<dt>', $txt['profile_activity'], ': </dt> |
|
579
|
|
|
<dd> |
|
580
|
|
|
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a> |
|
581
|
|
|
<br />'; |
|
582
|
|
|
|
|
583
|
|
|
if ($context['user']['is_owner'] && !empty($modSettings['drafts_enabled'])) |
|
584
|
|
|
echo ' |
|
585
|
|
|
<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '">', $txt['drafts_show'], '</a> |
|
586
|
|
|
<br />'; |
|
587
|
|
|
echo ' |
|
588
|
|
|
<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a> |
|
589
|
|
|
</dd>'; |
|
590
|
|
|
|
|
591
|
|
|
// close this block up |
|
592
|
|
|
echo ' |
|
593
|
|
|
</dl> |
|
594
|
|
|
</div> |
|
595
|
|
|
</div>'; |
|
596
|
|
|
} |
|
597
|
|
|
|
|
598
|
|
|
/** |
|
599
|
|
|
* Profile Info Block |
|
600
|
|
|
* |
|
601
|
|
|
* Show additional user details including: age, join date, |
|
602
|
|
|
* localization details (language and time) |
|
603
|
|
|
* If user has permissions can see IP address |
|
604
|
|
|
*/ |
|
605
|
|
|
function template_profile_block_user_info() |
|
606
|
|
|
{ |
|
607
|
|
|
global $settings, $txt, $context, $scripturl, $modSettings; |
|
608
|
|
|
|
|
609
|
|
|
echo ' |
|
610
|
|
|
<div class="profileblock_right"> |
|
611
|
|
|
<h2 class="category_header hdicon cat_img_stats_info"> |
|
612
|
|
|
', ($context['user']['is_owner']) ? '<a href="' . $scripturl . '?action=profile;area=forumprofile;u=' . $context['member']['id'] . '">' . $txt['profile_user_info'] . '</a>' : $txt['profile_user_info'], ' |
|
613
|
|
|
</h2> |
|
614
|
|
|
<div class="profileblock"> |
|
615
|
|
|
<dl>'; |
|
616
|
|
|
|
|
617
|
|
|
// And how old are we, oh my! |
|
618
|
|
|
echo ' |
|
619
|
|
|
<dt>', $txt['age'], ':</dt> |
|
620
|
|
|
<dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' <img src="' . $settings['images_url'] . '/cake.png" alt="" />' : ''), '</dd>'; |
|
621
|
|
|
|
|
622
|
|
|
// How long have they been a member, and when were they last on line? |
|
623
|
|
|
echo ' |
|
624
|
|
|
<dt>', $txt['date_registered'], ':</dt> |
|
625
|
|
|
<dd>', $context['member']['registered'], '</dd> |
|
626
|
|
|
|
|
627
|
|
|
<dt>', $txt['lastLoggedIn'], ':</dt> |
|
628
|
|
|
<dd>', $context['member']['last_login'], '</dd>'; |
|
629
|
|
|
|
|
630
|
|
|
// If the person looking is allowed, they can check the members IP address and hostname. |
|
631
|
|
|
if ($context['can_see_ip']) |
|
632
|
|
|
{ |
|
633
|
|
View Code Duplication |
if (!empty($context['member']['ip'])) |
|
634
|
|
|
echo ' |
|
635
|
|
|
<dt>', $txt['ip'], ':</dt> |
|
636
|
|
|
<dd><a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
|
637
|
|
|
|
|
638
|
|
|
if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
639
|
|
|
echo ' |
|
640
|
|
|
<dt>', $txt['hostname'], ':</dt> |
|
641
|
|
|
<dd>', $context['member']['hostname'], '</dd>'; |
|
642
|
|
|
} |
|
643
|
|
|
|
|
644
|
|
|
// Users language |
|
645
|
|
|
if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
646
|
|
|
echo ' |
|
647
|
|
|
<dt>', $txt['language'], ':</dt> |
|
648
|
|
|
<dd>', $context['member']['language'], '</dd>'; |
|
649
|
|
|
|
|
650
|
|
|
// And their time settings |
|
651
|
|
|
echo ' |
|
652
|
|
|
<dt>', $txt['local_time'], ':</dt> |
|
653
|
|
|
<dd>', $context['member']['local_time'], '</dd>'; |
|
654
|
|
|
|
|
655
|
|
|
// What are they up to? |
|
656
|
|
|
if (!isset($context['disabled_fields']['action']) && !empty($context['member']['action'])) |
|
657
|
|
|
echo ' |
|
658
|
|
|
<dt>', $txt['profile_action'], ':</dt> |
|
659
|
|
|
<dd>', $context['member']['action'], '</dd>'; |
|
660
|
|
|
|
|
661
|
|
|
// nuff about them, lets get back to me! |
|
662
|
|
|
echo ' |
|
663
|
|
|
</dl> |
|
664
|
|
|
</div> |
|
665
|
|
|
</div>'; |
|
666
|
|
|
} |
|
667
|
|
|
|
|
668
|
|
|
/** |
|
669
|
|
|
* Profile Contact Block |
|
670
|
|
|
* Show information on how to contact a member |
|
671
|
|
|
* Allows the adding or removal of buddies |
|
672
|
|
|
* Provides a PM link |
|
673
|
|
|
* Provides a Email link |
|
674
|
|
|
* Shows any profile website information |
|
675
|
|
|
* Shows custom profile fields of placement type '1', "with icons" |
|
676
|
|
|
*/ |
|
677
|
|
|
function template_profile_block_contact() |
|
678
|
|
|
{ |
|
679
|
|
|
global $txt, $context, $scripturl; |
|
680
|
|
|
|
|
681
|
|
|
$ci_empty = true; |
|
682
|
|
|
|
|
683
|
|
|
echo ' |
|
684
|
|
|
<div class="profileblock_left"> |
|
685
|
|
|
<h2 class="category_header hdicon cat_img_contacts"> |
|
686
|
|
|
', $txt['profile_contact'], ' |
|
687
|
|
|
</h2> |
|
688
|
|
|
<div class="profileblock"> |
|
689
|
|
|
<dl>'; |
|
690
|
|
|
|
|
691
|
|
|
// If viewing another profile, can they add this member as a buddy, or can they de-buddy them instead? |
|
692
|
|
|
if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
693
|
|
|
{ |
|
694
|
|
|
$ci_empty = false; |
|
695
|
|
|
echo ' |
|
696
|
|
|
<dt> |
|
697
|
|
|
<i class="icon i-user', $context['member']['is_buddy'] ? '-minus' : '-plus', '"></i> |
|
698
|
|
|
</dt> |
|
699
|
|
|
<dd> |
|
700
|
|
|
<a class="linkbutton" href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], ';sa=', ($context['member']['is_buddy'] ? 'remove' : 'add'), '">', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], '</a> |
|
701
|
|
|
</dd>'; |
|
702
|
|
|
} |
|
703
|
|
|
|
|
704
|
|
|
// PM's are nice to send, to others, not to your self |
|
705
|
|
|
if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
706
|
|
|
{ |
|
707
|
|
|
$ci_empty = false; |
|
708
|
|
|
echo ' |
|
709
|
|
|
<dt> |
|
710
|
|
|
<i class="icon i-comment', $context['member']['online']['is_online'] ? '' : '-blank', '"></i> |
|
711
|
|
|
</dt> |
|
712
|
|
|
<dd> |
|
713
|
|
|
<a class="linkbutton" href="', $scripturl, '?action=pm;sa=send;u=', $context['member']['id'], '">', $txt['send_member_pm'], '</a> |
|
714
|
|
|
</dd>'; |
|
715
|
|
|
} |
|
716
|
|
|
|
|
717
|
|
|
// Show the email contact info? |
|
718
|
|
|
if ($context['can_send_email']) |
|
719
|
|
|
{ |
|
720
|
|
|
$ci_empty = false; |
|
721
|
|
|
echo ' |
|
722
|
|
|
<dt> |
|
723
|
|
|
<i class="icon i-envelope-o', $context['member']['online']['is_online'] ? '' : '-blank', '"><s>', $txt['email'], '</s></i> |
|
724
|
|
|
</dt> |
|
725
|
|
|
<dd><em>', template_member_email($context['member'], true), '</em></dd>'; |
|
726
|
|
|
} |
|
727
|
|
|
|
|
728
|
|
|
// Don't show an icon if they haven't specified a website. |
|
729
|
|
|
if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
730
|
|
|
{ |
|
731
|
|
|
$ci_empty = false; |
|
732
|
|
|
echo ' |
|
733
|
|
|
<dt> |
|
734
|
|
|
<i class="icon i-website" title="', $txt['website'], '"></i> |
|
735
|
|
|
</dt> |
|
736
|
|
|
<dd> |
|
737
|
|
|
<a href="', $context['member']['website']['url'], '" target="_blank" class="new_win">', $context['member']['website']['title'] == '' ? $context['member']['website']['url'] : $context['member']['website']['title'], '</a> |
|
738
|
|
|
</dd>'; |
|
739
|
|
|
} |
|
740
|
|
|
|
|
741
|
|
|
echo ' |
|
742
|
|
|
</dl>'; |
|
743
|
|
|
|
|
744
|
|
|
// Are there any custom profile fields for the summary? |
|
745
|
|
|
if (!empty($context['custom_fields'])) |
|
746
|
|
|
{ |
|
747
|
|
|
$cf_show = false; |
|
748
|
|
|
foreach ($context['custom_fields'] as $field) |
|
749
|
|
|
{ |
|
750
|
|
|
if ($field['placement'] == 1 && !empty($field['value'])) |
|
751
|
|
|
{ |
|
752
|
|
|
$ci_empty = false; |
|
753
|
|
|
if (empty($cf_show)) |
|
754
|
|
|
{ |
|
755
|
|
|
echo ' |
|
756
|
|
|
<ul class="cf_icons">'; |
|
757
|
|
|
$cf_show = true; |
|
758
|
|
|
} |
|
759
|
|
|
|
|
760
|
|
|
// removed $field['name'], ': ', as it was annoying |
|
761
|
|
|
|
|
762
|
|
|
echo ' |
|
763
|
|
|
<li class="cf_icon">', $field['output_html'], '</li>'; |
|
764
|
|
|
} |
|
765
|
|
|
} |
|
766
|
|
|
|
|
767
|
|
|
if (!empty($cf_show)) |
|
768
|
|
|
echo ' |
|
769
|
|
|
</ul>'; |
|
770
|
|
|
} |
|
771
|
|
|
|
|
772
|
|
|
// No way to contact this member at all ... welcome home freak! |
|
773
|
|
|
if ($ci_empty === true) |
|
774
|
|
|
echo |
|
775
|
|
|
$txt['profile_contact_no']; |
|
776
|
|
|
|
|
777
|
|
|
echo ' |
|
778
|
|
|
</div> |
|
779
|
|
|
</div>'; |
|
780
|
|
|
} |
|
781
|
|
|
|
|
782
|
|
|
/** |
|
783
|
|
|
* Profile Signature / Other Block |
|
784
|
|
|
* |
|
785
|
|
|
* Shows the users signature |
|
786
|
|
|
* Shows custom profile fields that are placed with the signature line |
|
787
|
|
|
*/ |
|
788
|
|
|
function template_profile_block_other_info() |
|
789
|
|
|
{ |
|
790
|
|
|
global $txt, $context, $scripturl; |
|
791
|
|
|
|
|
792
|
|
|
echo ' |
|
793
|
|
|
<div class="profileblock_right"> |
|
794
|
|
|
<h2 class="category_header hdicon cat_img_write"> |
|
795
|
|
|
', ($context['user']['is_owner']) ? '<a href="' . $scripturl . '?action=profile;area=forumprofile;u=' . $context['member']['id'] . '">' . $txt['profile_more'] . '</a>' : $txt['profile_more'], ' |
|
796
|
|
|
</h2> |
|
797
|
|
|
<div class="profileblock profileblock_signature">'; |
|
798
|
|
|
|
|
799
|
|
|
// Are there any custom profile fields for the above signature area? |
|
800
|
|
|
if (!empty($context['custom_fields'])) |
|
801
|
|
|
{ |
|
802
|
|
|
$shown = false; |
|
803
|
|
|
foreach ($context['custom_fields'] as $field) |
|
804
|
|
|
{ |
|
805
|
|
|
if ($field['placement'] != 2 || empty($field['output_html'])) |
|
806
|
|
|
continue; |
|
807
|
|
|
|
|
808
|
|
|
if (empty($shown)) |
|
809
|
|
|
{ |
|
810
|
|
|
echo ' |
|
811
|
|
|
<dl>'; |
|
812
|
|
|
|
|
813
|
|
|
$shown = true; |
|
814
|
|
|
} |
|
815
|
|
|
|
|
816
|
|
|
echo ' |
|
817
|
|
|
<dt>', $field['name'], ':</dt> |
|
818
|
|
|
<dd>', $field['output_html'], '</dd>'; |
|
819
|
|
|
} |
|
820
|
|
|
} |
|
821
|
|
|
|
|
822
|
|
|
// Show the users signature. |
|
823
|
|
|
if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
824
|
|
|
{ |
|
825
|
|
|
if (empty($shown)) |
|
826
|
|
|
{ |
|
827
|
|
|
echo ' |
|
828
|
|
|
<dl>'; |
|
829
|
|
|
|
|
830
|
|
|
$shown = true; |
|
831
|
|
|
} |
|
832
|
|
|
|
|
833
|
|
|
echo ' |
|
834
|
|
|
<dt>', $txt['signature'], ':</dt> |
|
835
|
|
|
<dd>', $context['member']['signature'], '</dd>'; |
|
836
|
|
|
} |
|
837
|
|
|
|
|
838
|
|
|
if (empty($shown)) |
|
839
|
|
|
echo $txt['profile_signature_no']; |
|
840
|
|
|
else |
|
841
|
|
|
echo ' |
|
842
|
|
|
</dl>'; |
|
843
|
|
|
|
|
844
|
|
|
// Done with this block |
|
845
|
|
|
echo ' |
|
846
|
|
|
</div> |
|
847
|
|
|
</div>'; |
|
848
|
|
|
} |
|
849
|
|
|
|
|
850
|
|
|
/** |
|
851
|
|
|
* Profile Custom Block |
|
852
|
|
|
* |
|
853
|
|
|
* Show the custom profile fields for standard (value 0) placement |
|
854
|
|
|
*/ |
|
855
|
|
|
function template_profile_block_user_customprofileinfo() |
|
856
|
|
|
{ |
|
857
|
|
|
global $txt, $context, $scripturl; |
|
858
|
|
|
|
|
859
|
|
|
echo ' |
|
860
|
|
|
<div class="profileblock_left"> |
|
861
|
|
|
<h2 class="category_header hdicon cat_img_plus"> |
|
862
|
|
|
', ($context['user']['is_owner']) ? '<a href="' . $scripturl . '?action=profile;area=forumprofile;u=' . $context['member']['id'] . '">' . $txt['profile_info'] . '</a>' : $txt['profile_info'], ' |
|
863
|
|
|
</h2> |
|
864
|
|
|
<div class="profileblock">'; |
|
865
|
|
|
|
|
866
|
|
|
// Any custom fields for standard (non-icon, non-sig) placement? |
|
867
|
|
|
if (!empty($context['custom_fields'])) |
|
868
|
|
|
{ |
|
869
|
|
|
$shown = false; |
|
870
|
|
|
foreach ($context['custom_fields'] as $field) |
|
871
|
|
|
{ |
|
872
|
|
|
if (($field['placement'] == 0 || $field['placement'] == 3) && !empty($field['output_html'])) |
|
873
|
|
|
{ |
|
874
|
|
|
if (empty($shown)) |
|
875
|
|
|
{ |
|
876
|
|
|
echo ' |
|
877
|
|
|
<dl>'; |
|
878
|
|
|
$shown = true; |
|
879
|
|
|
} |
|
880
|
|
|
|
|
881
|
|
|
echo ' |
|
882
|
|
|
<dt>', $field['name'], ':</dt> |
|
883
|
|
|
<dd>', $field['output_html'], '</dd>'; |
|
884
|
|
|
} |
|
885
|
|
|
} |
|
886
|
|
|
|
|
887
|
|
|
if (!empty($shown)) |
|
888
|
|
|
echo ' |
|
889
|
|
|
</dl>'; |
|
890
|
|
|
} |
|
891
|
|
|
|
|
892
|
|
|
if (empty($shown)) |
|
893
|
|
|
echo $txt['profile_additonal_no']; |
|
894
|
|
|
|
|
895
|
|
|
echo ' |
|
896
|
|
|
</div> |
|
897
|
|
|
</div>'; |
|
898
|
|
|
} |
|
899
|
|
|
|
|
900
|
|
|
/** |
|
901
|
|
|
* Profile Moderation Block |
|
902
|
|
|
* |
|
903
|
|
|
* Show any warnings on this user and allows for editing |
|
904
|
|
|
* Can approve members waiting activation |
|
905
|
|
|
* Needs the correct permissions for either action in order to view |
|
906
|
|
|
*/ |
|
907
|
|
|
function template_profile_block_moderation() |
|
908
|
|
|
{ |
|
909
|
|
|
global $txt, $context, $scripturl; |
|
910
|
|
|
|
|
911
|
|
|
// Can they view warnings or approve members if so only show this if we needed |
|
912
|
|
|
if (($context['can_view_warning'] && $context['member']['warning']) || (!empty($context['activate_message']) || !empty($context['member']['bans']))) |
|
913
|
|
|
{ |
|
914
|
|
|
echo ' |
|
915
|
|
|
<div class="profileblock_right"> |
|
916
|
|
|
<h2 class="category_header hdicon cat_img_moderation"> |
|
917
|
|
|
', $txt['profile_moderation'], ' |
|
918
|
|
|
</h2> |
|
919
|
|
|
<div class="profileblock">'; |
|
920
|
|
|
|
|
921
|
|
|
// Can they view/issue a warning? |
|
922
|
|
|
if ($context['can_view_warning'] && $context['member']['warning']) |
|
923
|
|
|
{ |
|
924
|
|
|
echo ' |
|
925
|
|
|
<dl> |
|
926
|
|
|
<dt>', $txt['profile_warning_level'], ':</dt> |
|
927
|
|
|
<dd> |
|
928
|
|
|
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', $context['can_issue_warning'] ? 'issuewarning' : 'viewwarning', '">', $context['member']['warning'], '%</a>'; |
|
929
|
|
|
|
|
930
|
|
|
// Can we provide information on what this means? |
|
931
|
|
|
if (!empty($context['warning_status'])) |
|
932
|
|
|
echo ' |
|
933
|
|
|
<span class="smalltext">(', $context['warning_status'], ')</span>'; |
|
934
|
|
|
|
|
935
|
|
|
echo ' |
|
936
|
|
|
</dd> |
|
937
|
|
|
</dl>'; |
|
938
|
|
|
} |
|
939
|
|
|
|
|
940
|
|
|
// Is this member requiring activation and/or banned? |
|
941
|
|
|
if (!empty($context['activate_message']) || !empty($context['member']['bans'])) |
|
942
|
|
|
{ |
|
943
|
|
|
echo ' |
|
944
|
|
|
<dl>'; |
|
945
|
|
|
|
|
946
|
|
|
// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
|
947
|
|
|
if (!empty($context['activate_message'])) |
|
948
|
|
|
echo ' |
|
949
|
|
|
<dt class="clear"> |
|
950
|
|
|
<span class="alert">', $context['activate_message'], '</span> (<a href="' . $context['activate_url'] . '"', ($context['activate_type'] == 4 ? ' onclick="return confirm(\'' . $txt['profileConfirm'] . '\');"' : ''), '>', $context['activate_link_text'], '</a>) |
|
951
|
|
|
</dt>'; |
|
952
|
|
|
|
|
953
|
|
|
// If the current member is banned, show a message and possibly a link to the ban. |
|
954
|
|
|
if (!empty($context['member']['bans'])) |
|
955
|
|
|
{ |
|
956
|
|
|
echo ' |
|
957
|
|
|
<dt class="clear"> |
|
958
|
|
|
<span class="alert">', $txt['user_is_banned'], '</span> |
|
959
|
|
|
<a class="linkbutton" href="#" onclick="document.getElementById(\'ban_info\').style.display = window.getComputedStyle(getElementById(\'ban_info\')).getPropertyValue(\'display\') === \'none\' ? \'inline\' : \'none\';return false;">' . $txt['view_ban'] . '</a> |
|
960
|
|
|
</dt> |
|
961
|
|
|
<dd class="hide" id="ban_info"> |
|
962
|
|
|
<strong>', $txt['user_banned_by_following'], ':</strong>'; |
|
963
|
|
|
|
|
964
|
|
|
foreach ($context['member']['bans'] as $ban) |
|
965
|
|
|
echo ' |
|
966
|
|
|
<br /> |
|
967
|
|
|
<span class="smalltext">', $ban['explanation'], '</span>'; |
|
968
|
|
|
|
|
969
|
|
|
echo ' |
|
970
|
|
|
</dd>'; |
|
971
|
|
|
} |
|
972
|
|
|
|
|
973
|
|
|
echo ' |
|
974
|
|
|
</dl>'; |
|
975
|
|
|
} |
|
976
|
|
|
|
|
977
|
|
|
// Done with this block |
|
978
|
|
|
echo ' |
|
979
|
|
|
</div> |
|
980
|
|
|
</div>'; |
|
981
|
|
|
} |
|
982
|
|
|
} |
|
983
|
|
|
|
|
984
|
|
|
/** |
|
985
|
|
|
* Profile Buddies Block |
|
986
|
|
|
* |
|
987
|
|
|
* Shows a list of your buddies with pm/email links if available |
|
988
|
|
|
*/ |
|
989
|
|
|
function template_profile_block_buddies() |
|
990
|
|
|
{ |
|
991
|
|
|
global $context, $scripturl, $txt, $modSettings; |
|
992
|
|
|
|
|
993
|
|
|
// Set the div height to about 4 lines of buddies w/avatars |
|
994
|
|
|
if (isset($context['buddies'])) |
|
995
|
|
|
{ |
|
996
|
|
|
$div_height = 120 + (4 * max(empty($modSettings['avatar_max_height']) ? 0 : $modSettings['avatar_max_height'], empty($modSettings['avatar_max_height']) ? 0 : $modSettings['avatar_max_height'], 65)); |
|
997
|
|
|
} |
|
998
|
|
|
|
|
999
|
|
|
if (!empty($modSettings['enable_buddylist']) && $context['user']['is_owner']) |
|
1000
|
|
|
{ |
|
1001
|
|
|
echo ' |
|
1002
|
|
|
<h2 class="category_header hdicon cat_img_buddies"> |
|
1003
|
|
|
<a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['member']['id'], '">', $txt['buddies'], '</a> |
|
1004
|
|
|
</h2> |
|
1005
|
|
|
<div class="flow_auto" ', (isset($div_height) ? 'style="max-height: ' . $div_height . 'px;"' : ''), '> |
|
1006
|
|
|
<div class="attachments">'; |
|
1007
|
|
|
|
|
1008
|
|
|
// Now show them all |
|
1009
|
|
|
if (isset($context['buddies'])) |
|
1010
|
|
|
{ |
|
1011
|
|
|
foreach ($context['buddies'] as $buddy_id => $data) |
|
1012
|
|
|
{ |
|
1013
|
|
|
echo ' |
|
1014
|
|
|
<div class="attachment"> |
|
1015
|
|
|
<div class="generic_border centertext"> |
|
1016
|
|
|
', $data['avatar']['image'], '<br /> |
|
1017
|
|
|
<a href="', $scripturl, '?action=profile;u=', $data['id'], '">', $data['name'], '</a> |
|
1018
|
|
|
<br /> |
|
1019
|
|
|
', template_member_online($data), '<em><span class="smalltext"> ' . $txt[$data['online']['is_online'] ? 'online' : 'offline'] . '</span></em> |
|
1020
|
|
|
<div class="contact">'; |
|
1021
|
|
|
|
|
1022
|
|
|
// Only show the email address fully if it's not hidden - and we reveal the email. |
|
1023
|
|
|
echo template_member_email($data); |
|
1024
|
|
|
|
|
1025
|
|
|
// Can they send the buddy a PM? |
|
1026
|
|
|
if ($context['can_send_pm']) |
|
1027
|
|
|
{ |
|
1028
|
|
|
echo ' |
|
1029
|
|
|
<a href="', $scripturl, '?action=pm;sa=send;u=', $data['id'], '" class="icon i-comment', $data['online']['is_online'] ? '' : '-blank', '" title="', $txt['profile_sendpm_short'], ' to ', $data['name'], '"><s>', $txt['profile_sendpm_short'], ' to ', $data['name'], '</s></a>'; |
|
1030
|
|
|
} |
|
1031
|
|
|
|
|
1032
|
|
|
// Other contact info from custom profile fields? |
|
1033
|
|
|
if (isset($data['custom_fields'])) |
|
1034
|
|
|
{ |
|
1035
|
|
|
$im = array(); |
|
1036
|
|
|
|
|
1037
|
|
View Code Duplication |
foreach ($data['custom_fields'] as $key => $cpf) |
|
1038
|
|
|
{ |
|
1039
|
|
|
if ($cpf['placement'] == 1) |
|
1040
|
|
|
{ |
|
1041
|
|
|
$im[] = $cpf['value']; |
|
1042
|
|
|
} |
|
1043
|
|
|
} |
|
1044
|
|
|
|
|
1045
|
|
|
echo implode(' ', $im); |
|
1046
|
|
|
} |
|
1047
|
|
|
// Done with the contact information |
|
1048
|
|
|
echo ' |
|
1049
|
|
|
</div> |
|
1050
|
|
|
</div> |
|
1051
|
|
|
</div>'; |
|
1052
|
|
|
} |
|
1053
|
|
|
} |
|
1054
|
|
|
// Buddyless how sad :'( |
|
1055
|
|
|
else |
|
1056
|
|
|
{ |
|
1057
|
|
|
echo ' |
|
1058
|
|
|
<div class="infobox"> |
|
1059
|
|
|
', $txt['profile_buddies_no'], ' |
|
1060
|
|
|
</div>'; |
|
1061
|
|
|
} |
|
1062
|
|
|
|
|
1063
|
|
|
// All done |
|
1064
|
|
|
echo ' |
|
1065
|
|
|
</div> |
|
1066
|
|
|
</div>'; |
|
1067
|
|
|
} |
|
1068
|
|
|
} |
|
1069
|
|
|
|
|
1070
|
|
|
/** |
|
1071
|
|
|
* Consolidated profile block output. |
|
1072
|
|
|
*/ |
|
1073
|
|
|
function template_profile_blocks() |
|
1074
|
|
|
{ |
|
1075
|
|
|
global $context; |
|
1076
|
|
|
|
|
1077
|
|
|
if (empty($context['profile_blocks'])) |
|
1078
|
|
|
{ |
|
1079
|
|
|
return; |
|
1080
|
|
|
} |
|
1081
|
|
|
else |
|
1082
|
|
|
{ |
|
1083
|
|
|
foreach ($context['profile_blocks'] as $profile_block) |
|
1084
|
|
|
{ |
|
1085
|
|
|
$profile_block(); |
|
1086
|
|
|
} |
|
1087
|
|
|
} |
|
1088
|
|
|
} |
|
1089
|
|
|
|
|
1090
|
|
|
/** |
|
1091
|
|
|
* Profile Attachments Block |
|
1092
|
|
|
* |
|
1093
|
|
|
* Shows the most recent attachments (as thumbnails) for this user |
|
1094
|
|
|
*/ |
|
1095
|
|
|
function template_profile_block_attachments() |
|
1096
|
|
|
{ |
|
1097
|
|
|
global $txt, $context, $scripturl; |
|
1098
|
|
|
|
|
1099
|
|
|
// The attachment div |
|
1100
|
|
|
echo ' |
|
1101
|
|
|
<h2 class="category_header hdicon cat_img_attachments"> |
|
1102
|
|
|
<a href="', $scripturl, '?action=profile;area=showposts;sa=attach;u=', $context['member']['id'], '">', $txt['profile_attachments'], '</a> |
|
1103
|
|
|
</h2> |
|
1104
|
|
|
<div class="attachments">'; |
|
1105
|
|
|
|
|
1106
|
|
|
// Show the thumbnails |
|
1107
|
|
View Code Duplication |
if (!empty($context['thumbs'])) |
|
1108
|
|
|
{ |
|
1109
|
|
|
foreach ($context['thumbs'] as $picture) |
|
1110
|
|
|
{ |
|
1111
|
|
|
echo ' |
|
1112
|
|
|
<div class="attachment generic_border"> |
|
1113
|
|
|
<div class="profile_content attachment_thumb"> |
|
1114
|
|
|
<a id="link_', $picture['id'], '" href="', $picture['url'], '">', $picture['img'], '</a> |
|
1115
|
|
|
</div> |
|
1116
|
|
|
<div class="attachment_name"> |
|
1117
|
|
|
', $picture['subject'], ' |
|
1118
|
|
|
</div> |
|
1119
|
|
|
</div>'; |
|
1120
|
|
|
} |
|
1121
|
|
|
} |
|
1122
|
|
|
// No data for this member |
|
1123
|
|
|
else |
|
1124
|
|
|
echo ' |
|
1125
|
|
|
<div class="infobox"> |
|
1126
|
|
|
', $txt['profile_attachments_no'], ' |
|
1127
|
|
|
</div>'; |
|
1128
|
|
|
|
|
1129
|
|
|
// All done |
|
1130
|
|
|
echo ' |
|
1131
|
|
|
</div>'; |
|
1132
|
|
|
} |
|
1133
|
|
|
|
|
1134
|
|
|
/** |
|
1135
|
|
|
* Profile Posts Block |
|
1136
|
|
|
* |
|
1137
|
|
|
* Shows the most recent posts for this user |
|
1138
|
|
|
*/ |
|
1139
|
|
|
function template_profile_block_posts() |
|
1140
|
|
|
{ |
|
1141
|
|
|
global $txt, $context, $scripturl; |
|
1142
|
|
|
|
|
1143
|
|
|
// The posts block |
|
1144
|
|
|
echo ' |
|
1145
|
|
|
<h2 class="category_header hdicon cat_img_posts"> |
|
1146
|
|
|
<a href="', $scripturl, '?action=profile;area=showposts;sa=messages;u=', $context['member']['id'], '">', $txt['profile_recent_posts'], '</a> |
|
1147
|
|
|
</h2> |
|
1148
|
|
|
<div class="flow_auto"> |
|
1149
|
|
|
<table id="ps_recentposts">'; |
|
1150
|
|
|
|
|
1151
|
|
|
if (!empty($context['posts'])) |
|
1152
|
|
|
{ |
|
1153
|
|
|
echo ' |
|
1154
|
|
|
<tr> |
|
1155
|
|
|
<th class="recentpost">', $txt['message'], '</th> |
|
1156
|
|
|
<th class="recentposter">', $txt['board'], '</th> |
|
1157
|
|
|
<th class="recentboard">', $txt['subject'], '</th> |
|
1158
|
|
|
<th class="recenttime">', $txt['date'], '</th> |
|
1159
|
|
|
</tr>'; |
|
1160
|
|
|
|
|
1161
|
|
View Code Duplication |
foreach ($context['posts'] as $post) |
|
1162
|
|
|
echo ' |
|
1163
|
|
|
<tr> |
|
1164
|
|
|
<td class="recentpost">', $post['body'], '</td> |
|
1165
|
|
|
<td class="recentboard">', $post['board']['link'], '</td> |
|
1166
|
|
|
<td class="recentsubject">', $post['link'], '</td> |
|
1167
|
|
|
<td class="recenttime">', $post['time'], '</td> |
|
1168
|
|
|
</tr>'; |
|
1169
|
|
|
} |
|
1170
|
|
|
// No data for this member |
|
1171
|
|
|
else |
|
1172
|
|
|
echo ' |
|
1173
|
|
|
<tr> |
|
1174
|
|
|
<td class="norecent">', (isset($context['loadaverage']) ? $txt['profile_loadavg'] : $txt['profile_posts_no']), '</td> |
|
1175
|
|
|
</tr>'; |
|
1176
|
|
|
|
|
1177
|
|
|
// All done |
|
1178
|
|
|
echo ' |
|
1179
|
|
|
</table> |
|
1180
|
|
|
</div>'; |
|
1181
|
|
|
} |
|
1182
|
|
|
|
|
1183
|
|
|
/** |
|
1184
|
|
|
* Profile Topics Block |
|
1185
|
|
|
* |
|
1186
|
|
|
* Shows the most recent topics that this user has started |
|
1187
|
|
|
*/ |
|
1188
|
|
|
function template_profile_block_topics() |
|
1189
|
|
|
{ |
|
1190
|
|
|
global $txt, $context, $scripturl; |
|
1191
|
|
|
|
|
1192
|
|
|
// The topics block |
|
1193
|
|
|
echo ' |
|
1194
|
|
|
<h2 class="category_header hdicon cat_img_topics"> |
|
1195
|
|
|
<a href="', $scripturl, '?action=profile;area=showposts;sa=topics;u=', $context['member']['id'], '">', $txt['profile_topics'], '</a> |
|
1196
|
|
|
</h2> |
|
1197
|
|
|
<div class="flow_auto"> |
|
1198
|
|
|
<table id="ps_recenttopics">'; |
|
1199
|
|
|
|
|
1200
|
|
|
if (!empty($context['topics'])) |
|
1201
|
|
|
{ |
|
1202
|
|
|
echo ' |
|
1203
|
|
|
<tr> |
|
1204
|
|
|
<th class="recenttopic">', $txt['subject'], '</th> |
|
1205
|
|
|
<th class="recentboard">', $txt['board'], '</th> |
|
1206
|
|
|
<th class="recenttime">', $txt['date'], '</th> |
|
1207
|
|
|
</tr>'; |
|
1208
|
|
|
|
|
1209
|
|
View Code Duplication |
foreach ($context['topics'] as $post) |
|
1210
|
|
|
echo ' |
|
1211
|
|
|
<tr> |
|
1212
|
|
|
<td class="recenttopic">', $post['link'], '</td> |
|
1213
|
|
|
<td class="recentboard">', $post['board']['link'], '</td> |
|
1214
|
|
|
<td class="recenttime">', $post['time'], '</td> |
|
1215
|
|
|
</tr>'; |
|
1216
|
|
|
} |
|
1217
|
|
|
// No data for this member |
|
1218
|
|
|
else |
|
1219
|
|
|
echo ' |
|
1220
|
|
|
<tr> |
|
1221
|
|
|
<td class="norecent">', $txt['profile_topics_no'], '</td> |
|
1222
|
|
|
</tr>'; |
|
1223
|
|
|
|
|
1224
|
|
|
// All done |
|
1225
|
|
|
echo ' |
|
1226
|
|
|
</table> |
|
1227
|
|
|
</div>'; |
|
1228
|
|
|
} |
|
1229
|
|
|
|