-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Profile.template.php
3520 lines (3029 loc) · 117 KB
/
Profile.template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines https://www.simplemachines.org
* @copyright 2023 Simple Machines and individual contributors
* @license https://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.1.4
*/
/**
* Minor stuff shown above the main profile - mostly used for error messages and showing that the profile update was successful.
*/
function template_profile_above()
{
global $context;
// Prevent Chrome from auto completing fields when viewing/editing other members profiles
if (isBrowser('is_chrome') && !$context['user']['is_owner'])
echo '
<script>
disableAutoComplete();
</script>';
// If an error occurred while trying to save previously, give the user a clue!
echo '
', template_error_message();
// If the profile was update successfully, let the user know this.
if (!empty($context['profile_updated']))
echo '
<div class="infobox">
', $context['profile_updated'], '
</div>';
}
/**
* Template for any HTML needed below the profile (closing off divs/tables, etc.)
*/
function template_profile_below()
{
}
/**
* Template for showing off the spiffy popup of the menu
*/
function template_profile_popup()
{
global $context, $scripturl, $txt;
// Load the custom template
loadTemplate('themecustoms/templates/theme');
// Unlike almost every other template, this is designed to be included into the HTML directly via $().load()
echo '
<div class="profile_user_avatar floatleft">
<a href="', $scripturl, '?action=profile;u=', $context['user']['id'], '">', $context['member']['avatar']['image'], '</a>
</div>
<div class="profile_user_info floatleft">
<span class="profile_username"><a href="', $scripturl, '?action=profile;u=', $context['user']['id'], '">', $context['user']['name'], '</a></span>
<span class="profile_group">', $context['member']['group'], '</span>
</div>';
// Load the languages, if any
themecustoms_languageselector();
echo '
<div class="profile_user_links unread_buttons">
<ol>
<li>
<a href="', $scripturl, '?action=unreadreplies" title="', $txt['show_unread_replies'], '">
', themecustoms_icon('fas fa-comment-dots'), '
<span>', $txt['unread_replies'], '</span>
</a>
</li>
<li>
<a href="', $scripturl, '?action=unread" title="', $txt['unread_since_visit'], '">
', themecustoms_icon('fas fa-book-open'), '
<span>', $txt['view_unread_category'], '</span>
</a>
</li>
</ol>
</div>
<div class="profile_user_links">
<ol>';
$menu_context = &$context[$context['profile_menu_name']];
foreach ($context['profile_items'] as $item)
{
$area = &$menu_context['sections'][$item['menu']]['areas'][$item['area']];
$item_url = (isset($item['url']) ? $item['url'] : (isset($area['url']) ? $area['url'] : $menu_context['base_url'] . ';area=' . $item['area'])) . $menu_context['extra_parameters'];
echo '
<li>
<a href="', $item_url, '">
<span class="main_icons ', $area['plain_class'], '"></span>
<span>', !empty($item['title']) ? $item['title'] : $area['label'], '</span>
</a>
</li>';
}
echo '
</ol>
</div><!-- .profile_user_links -->';
}
/**
* The "popup" showing the user's alerts
*/
function template_alerts_popup()
{
global $context, $txt, $scripturl;
// Unlike almost every other template, this is designed to be included into the HTML directly via $().load()
echo '
<div class="alert_bar">
<div class="alerts_opts block">
<a href="' . $scripturl . '?action=profile;area=notification;sa=markread;', $context['session_var'], '=', $context['session_id'], '" onclick="return markAlertsRead(this)">', $txt['mark_alerts_read'], '</a>
<a href="', $scripturl, '?action=profile;area=notification;sa=alerts" class="floatright">', $txt['alert_settings'], '</a>
</div>
<div class="alerts_box centertext">
<a href="', $scripturl, '?action=profile;area=showalerts" class="button">', $txt['all_alerts'], '</a>
</div>
</div>
<div class="alerts_unread">';
if (empty($context['unread_alerts']))
template_alerts_all_read();
else
{
foreach ($context['unread_alerts'] as $id_alert => $details)
{
echo '
<', !$details['show_links'] ? 'a href="' . $scripturl . '?action=profile;area=showalerts;alert=' . $id_alert . '" onclick="this.classList.add(\'alert_read\')"' : 'div', ' class="unread_notify">
<div class="unread_notify_image">
', empty($details['sender']['avatar']['image']) ? '' : $details['sender']['avatar']['image'] . '
', $details['icon'], '
</div>
<div class="details">
<span class="alert_text">', $details['text'], '</span> - <span class="alert_time">', $details['time'], '</span>
</div>
</', !$details['show_links'] ? 'a' : 'div', '>';
}
}
echo '
</div><!-- .alerts_unread -->
<script>
function markAlertsRead(obj) {
ajax_indicator(true);
$.get(
obj.href,
function(data) {
ajax_indicator(false);
$("#alerts_menu_top span.amt").remove();
$("#alerts_menu div.alerts_unread").html(data);
if (typeof localStorage != "undefined")
localStorage.setItem("alertsCounter", 0);
}
);
return false;
}
</script>';
}
/**
* A simple template to say "You don't have any unread alerts".
*/
function template_alerts_all_read()
{
global $txt;
echo '<div class="no_unread">', $txt['alerts_no_unread'], '</div>';
}
/**
* This template displays a user's details without any option to edit them.
*/
function template_summary()
{
global $context, $settings, $scripturl, $modSettings, $txt;
// Display the basic information about the user
echo '
<div id="profileview" class="roundframe flow_auto noup">
<div id="basicinfo">';
// Are there any custom profile fields for above the name?
if (!empty($context['print_custom_fields']['above_member']))
{
$fields = '';
foreach ($context['print_custom_fields']['above_member'] as $field)
if (!empty($field['output_html']))
$fields .= '
<li>' . $field['output_html'] . '</li>';
if (!empty($fields))
echo '
<div class="custom_fields_above_name">
<ul>', $fields, '
</ul>
</div>';
}
echo '
<div class="username clear">
<h4>';
if (!empty($context['print_custom_fields']['before_member']))
foreach ($context['print_custom_fields']['before_member'] as $field)
if (!empty($field['output_html']))
echo '
<span>', $field['output_html'], '</span>';
echo '
', $context['member']['name'];
if (!empty($context['print_custom_fields']['after_member']))
foreach ($context['print_custom_fields']['after_member'] as $field)
if (!empty($field['output_html']))
echo '
<span>', $field['output_html'], '</span>';
echo '
<span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span>
</h4>
</div>
', $context['member']['avatar']['image'];
// Are there any custom profile fields for below the avatar?
if (!empty($context['print_custom_fields']['below_avatar']))
{
$fields = '';
foreach ($context['print_custom_fields']['below_avatar'] as $field)
if (!empty($field['output_html']))
$fields .= '
<li>' . $field['output_html'] . '</li>';
if (!empty($fields))
echo '
<div class="custom_fields_below_avatar">
<ul>', $fields, '
</ul>
</div>';
}
echo '
<ul class="icon_fields clear">';
// Email is only visible if it's your profile or you have the moderate_forum permission
if ($context['member']['show_email'])
echo '
<li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="main_icons mail" title="' . $txt['email'] . '"></span></a></li>';
// Don't show an icon if they haven't specified a website.
if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
echo '
<li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" rel="noopener">', ($settings['use_image_buttons'] ? '<span class="main_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>';
// Are there any custom profile fields as icons?
if (!empty($context['print_custom_fields']['icons']))
{
foreach ($context['print_custom_fields']['icons'] as $field)
if (!empty($field['output_html']))
echo '
<li class="custom_field">', $field['output_html'], '</li>';
}
echo '
</ul>
<span id="userstatus">
', $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>' : '';
// Can they add this member as a buddy?
if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
echo '
<br>
<a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], '</a>';
echo '
</span>';
if (!$context['user']['is_owner'] && $context['can_send_pm'])
echo '
<a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>';
echo '
<a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>';
if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled']))
echo '
<a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>';
echo '
<a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>';
// Are there any custom profile fields for bottom?
if (!empty($context['print_custom_fields']['bottom_poster']))
{
$fields = '';
foreach ($context['print_custom_fields']['bottom_poster'] as $field)
if (!empty($field['output_html']))
$fields .= '
<li>' . $field['output_html'] . '</li>';
if (!empty($fields))
echo '
<div class="custom_fields_bottom">
<ul class="nolist">', $fields, '
</ul>
</div>';
}
echo '
</div><!-- #basicinfo -->
<div id="detailedinfo">
<dl class="settings">';
if ($context['user']['is_owner'] || $context['user']['is_admin'])
echo '
<dt>', $txt['username'], ': </dt>
<dd>', $context['member']['username'], '</dd>';
if (!isset($context['disabled_fields']['posts']))
echo '
<dt>', $txt['profile_posts'], ': </dt>
<dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
if ($context['member']['show_email'])
echo '
<dt>', $txt['email'], ': </dt>
<dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>';
if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
echo '
<dt>', $txt['custom_title'], ': </dt>
<dd>', $context['member']['title'], '</dd>';
if (!empty($context['member']['blurb']))
echo '
<dt>', $txt['personal_text'], ': </dt>
<dd>', $context['member']['blurb'], '</dd>';
echo '
<dt>', $txt['age'], ':</dt>
<dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' <img src="' . $settings['images_url'] . '/cake.png" alt="">' : ''), '</dd>';
echo '
</dl>';
// Any custom fields for standard placement?
if (!empty($context['print_custom_fields']['standard']))
{
$fields = array();
foreach ($context['print_custom_fields']['standard'] as $field)
if (!empty($field['output_html']))
$fields[] = $field;
if (count($fields) > 0)
{
echo '
<dl class="settings">';
foreach ($fields as $field)
echo '
<dt>', $field['name'], ':</dt>
<dd>', $field['output_html'], '</dd>';
echo '
</dl>';
}
}
echo '
<dl class="settings noborder">';
// Can they view/issue a warning?
if ($context['can_view_warning'] && $context['member']['warning'])
{
echo '
<dt>', $txt['profile_warning_level'], ': </dt>
<dd>
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>';
// Can we provide information on what this means?
if (!empty($context['warning_status']))
echo '
<span class="smalltext">(', $context['warning_status'], ')</span>';
echo '
</dd>';
}
// Is this member requiring activation and/or banned?
if (!empty($context['activate_message']) || !empty($context['member']['bans']))
{
// If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
if (!empty($context['activate_message']))
echo '
<dt class="clear">
<span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '">', $context['activate_link_text'], '</a>)
</dt>';
// If the current member is banned, show a message and possibly a link to the ban.
if (!empty($context['member']['bans']))
{
echo '
<dt class="clear">
<span class="alert">', $txt['user_is_banned'], '</span> [<a href="#" onclick="document.getElementById(\'ban_info\').classList.toggle(\'hidden\');return false;">' . $txt['view_ban'] . '</a>]
</dt>
<dt class="clear hidden" id="ban_info">
<strong>', $txt['user_banned_by_following'], ':</strong>';
foreach ($context['member']['bans'] as $ban)
echo '
<br>
<span class="smalltext">', $ban['explanation'], '</span>';
echo '
</dt>';
}
}
echo '
<dt>', $txt['date_registered'], ': </dt>
<dd>', $context['member']['registered'], '</dd>';
// If the person looking is allowed, they can check the members IP address and hostname.
if ($context['can_see_ip'])
{
if (!empty($context['member']['ip']))
echo '
<dt>', $txt['ip'], ': </dt>
<dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
echo '
<dt>', $txt['hostname'], ': </dt>
<dd>', $context['member']['hostname'], '</dd>';
}
echo '
<dt>', $txt['local_time'], ':</dt>
<dd>', $context['member']['local_time'], '</dd>';
if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
echo '
<dt>', $txt['language'], ':</dt>
<dd>', $context['member']['language'], '</dd>';
if ($context['member']['show_last_login'])
echo '
<dt>', $txt['lastLoggedIn'], ': </dt>
<dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>';
echo '
</dl>';
// Are there any custom profile fields for above the signature?
if (!empty($context['print_custom_fields']['above_signature']))
{
$fields = '';
foreach ($context['print_custom_fields']['above_signature'] as $field)
if (!empty($field['output_html']))
$fields .= '
<li>' . $field['output_html'] . '</li>';
if (!empty($fields))
echo '
<div class="custom_fields_above_signature">
<ul class="nolist">', $fields, '
</ul>
</div>';
}
// Show the users signature.
if ($context['signature_enabled'] && !empty($context['member']['signature']))
echo '
<div class="signature">
<h5>', $txt['signature'], ':</h5>
', $context['member']['signature'], '
</div>';
// Are there any custom profile fields for below the signature?
if (!empty($context['print_custom_fields']['below_signature']))
{
$fields = '';
foreach ($context['print_custom_fields']['below_signature'] as $field)
if (!empty($field['output_html']))
$fields .= '
<li>' . $field['output_html'] . '</li>';
if (!empty($fields))
echo '
<div class="custom_fields_below_signature">
<ul class="nolist">', $fields, '
</ul>
</div>';
}
echo '
</div><!-- #detailedinfo -->
</div><!-- #profileview -->';
}
/**
* Template for showing all the posts of the user, in chronological order.
*/
function template_showPosts()
{
global $context, $scripturl, $txt;
echo '
<div class="cat_bar', !isset($context['attachments']) ? ' cat_bar_round' : '', '">
<h3 class="catbg">
', (!isset($context['attachments']) && empty($context['is_topics']) ? $txt['showMessages'] : (!empty($context['is_topics']) ? $txt['showTopics'] : $txt['showAttachments'])), ' - ', $context['member']['name'], '
</h3>
</div>', !empty($context['page_index']) ? '
<div class="pagesection">
<div class="pagelinks">' . $context['page_index'] . '</div>
</div>' : '';
// Are we displaying posts or attachments?
if (!isset($context['attachments']))
{
// For every post to be displayed, give it its own div, and show the important details of the post.
foreach ($context['posts'] as $post)
{
echo '
<div class="', $post['css_class'], '">
<div class="page_number floatright"> #', $post['counter'], '</div>
<div class="topic_details">
<h5>
<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>
</h5>
<span class="smalltext">', $post['time'], '</span>
</div>';
if (!$post['approved'])
echo '
<div class="noticebox">
', $txt['post_awaiting_approval'], '
</div>';
echo '
<div class="post">
<div class="inner">
', $post['body'], '
</div>
</div><!-- .post -->';
// Post options
template_quickbuttons($post['quickbuttons'], 'profile_showposts');
echo '
</div><!-- .', $post['css_class'], ' -->';
}
}
else
template_show_list('attachments');
// No posts? Just end with a informative message.
if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
echo '
<div class="windowbg">
', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
</div>';
// Show more page numbers.
if (!empty($context['page_index']))
echo '
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
</div>';
}
/**
* Template for showing all alerts
*/
function template_showAlerts()
{
global $context, $txt, $scripturl;
// Do we have an update message?
if (!empty($context['update_message']))
echo '
<div class="infobox">
', $context['update_message'], '
</div>';
echo '
<div class="cat_bar">
<h3 class="catbg">
', $txt['alerts'], ' - ', $context['member']['name'], '
</h3>
</div>';
if (empty($context['alerts']))
echo '
<div class="information">
', $txt['alerts_none'], '
</div>';
else
{
// Start the form if checkboxes are in use
if ($context['showCheckboxes'])
echo '
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=showalerts;save" method="post" accept-charset="', $context['character_set'], '" id="mark_all">';
echo '
<table id="alerts" class="table_grid">';
foreach ($context['alerts'] as $id => $alert)
{
echo '
<tr class="windowbg">
<td class="alert_image">
<div>
', empty($alert['sender']['avatar']['image']) ? '' : $alert['sender']['avatar']['image'] . '
', $alert['icon'], '
</div>
</td>
<td class="alert_text">
<div>', $alert['text'], '</div>
<time class="alert_inline_time" datetime="', $alert['alert_time'], '">', $alert['time'], '</time>
</td>
<td class="alert_time">
<time datetime="', $alert['alert_time'], '">', $alert['time'], '</time>
</td>
<td class="alert_buttons">';
// Alert options
template_quickbuttons($alert['quickbuttons'], 'profile_alerts');
echo '
</td>
</tr>';
}
echo '
</table>
<div class="pagesection">
<div class="pagelinks">', $context['pagination'], '</div>
<div class="floatright">';
if ($context['showCheckboxes'])
echo '
', $txt['check_all'], ': <input type="checkbox" name="select_all" id="select_all">
<select name="mark_as">
<option value="read">', $txt['quick_mod_markread'], '</option>
<option value="unread">', $txt['quick_mod_markunread'], '</option>
<option value="remove">', $txt['quick_mod_remove'], '</option>
</select>
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
<input type="hidden" name="start" value="', $context['start'], '">
<input type="submit" name="req" value="', $txt['quick_mod_go'], '" class="button you_sure">';
echo '
<a href="', $context['alert_purge_link'], '" class="button you_sure">', $txt['alert_purge'], '</a>
</div>
</div>';
if ($context['showCheckboxes'])
echo '
</form>';
}
}
/**
* Template for showing all of a user's drafts
*/
function template_showDrafts()
{
global $context, $scripturl, $txt;
echo '
<div class="cat_bar cat_bar_round">
<h3 class="catbg">
', $txt['drafts'], ' - ', $context['member']['name'], '
</h3>
</div>', !empty($context['page_index']) ? '
<div class="pagesection">
<div class="pagelinks">' . $context['page_index'] . '</div>
</div>' : '';
// No drafts? Just show an informative message.
if (empty($context['drafts']))
echo '
<div class="windowbg centertext">
', $txt['draft_none'], '
</div>';
else
{
// For every draft to be displayed, give it its own div, and show the important details of the draft.
foreach ($context['drafts'] as $draft)
{
echo '
<div class="windowbg">
<div class="page_number floatright"> #', $draft['counter'], '</div>
<div class="topic_details">
<h5>
<strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> ';
if (!empty($draft['sticky']))
echo '
<span class="main_icons sticky" title="', $txt['sticky_topic'], '"></span>';
if (!empty($draft['locked']))
echo '
<span class="main_icons lock" title="', $txt['locked_topic'], '"></span>';
echo '
</h5>
<span class="smalltext"><strong>', $txt['draft_saved_on'], ':</strong> ', $draft['time'], '</span>
</div><!-- .topic_details -->
<div class="list_posts">
', $draft['body'], '
</div>
<div class="floatright">';
// Draft buttons
template_quickbuttons($draft['quickbuttons'], 'profile_drafts');
echo '
</div><!-- .floatright -->
</div><!-- .windowbg -->';
}
}
// Show page numbers.
echo '
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
</div>';
}
/**
* Template for showing and managing the buddy list.
*/
function template_editBuddies()
{
global $context, $scripturl, $txt;
if (!empty($context['saved_successful']))
echo '
<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
elseif (!empty($context['saved_failed']))
echo '
<div class="errorbox">', $context['saved_failed'], '</div>';
echo '
<div id="edit_buddies">
<div class="cat_bar">
<h3 class="catbg">
<span class="main_icons people icon"></span> ', $txt['editBuddies'], '
</h3>
</div>
<table class="table_grid">
<thead>
<tr class="title_bar">
<th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th>
<th scope="col" class="buddy_status">', $txt['status'], '</th>';
if ($context['can_moderate_forum'])
echo '
<th scope="col" class="buddy_email">', $txt['email'], '</th>';
if (!empty($context['custom_pf']))
foreach ($context['custom_pf'] as $column)
echo '
<th scope="col" class="buddy_custom_fields">', $column['label'], '</th>';
echo '
<th scope="col" class="buddy_remove">', $txt['remove'], '</th>
</tr>
</thead>
<tbody>';
// If they don't have any buddies don't list them!
if (empty($context['buddies']))
echo '
<tr class="windowbg">
<td colspan="', $context['can_moderate_forum'] ? '10' : '9', '">
<strong>', $txt['no_buddies'], '</strong>
</td>
</tr>';
// Now loop through each buddy showing info on each.
else
{
foreach ($context['buddies'] as $buddy)
{
echo '
<tr class="windowbg">
<td class="buddy_link">', $buddy['link'], '</td>
<td class="centertext buddy_status">
<a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a>
</td>';
if ($buddy['show_email'])
echo '
<td class="buddy_email centertext">
<a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="main_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a>
</td>';
// Show the custom profile fields for this user.
if (!empty($context['custom_pf']))
foreach ($context['custom_pf'] as $key => $column)
echo '
<td class="centertext buddy_custom_fields">', $buddy['options'][$key], '</td>';
echo '
<td class="centertext buddy_remove">
<a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="main_icons delete" title="', $txt['buddy_remove'], '"></span></a>
</td>
</tr>';
}
}
echo '
</tbody>
</table>
</div><!-- #edit_buddies -->';
// Add a new buddy?
echo '
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=buddies" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['buddy_add'], '</h3>
</div>
<div class="information">
<dl class="settings">
<dt>
<label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
</dt>
<dd>
<input type="text" name="new_buddy" id="new_buddy" size="30">
<input type="submit" value="', $txt['buddy_add_button'], '" class="button floatnone">
</dd>
</dl>
</div>';
if (!empty($context['token_check']))
echo '
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</form>
<script>
var oAddBuddySuggest = new smc_AutoSuggest({
sSelf: \'oAddBuddySuggest\',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sSuggestId: \'new_buddy\',
sControlId: \'new_buddy\',
sSearchType: \'member\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
bItemList: false
});
</script>';
}
/**
* Template for showing the ignore list of the current user.
*/
function template_editIgnoreList()
{
global $context, $scripturl, $txt;
if (!empty($context['saved_successful']))
echo '
<div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>';
elseif (!empty($context['saved_failed']))
echo '
<div class="errorbox">', $context['saved_failed'], '</div>';
echo '
<div id="edit_buddies">
<div class="cat_bar">
<h3 class="catbg profile_hd">
', $txt['editIgnoreList'], '
</h3>
</div>
<table class="table_grid">
<thead>
<tr class="title_bar">
<th scope="col" class="quarter_table buddy_link">', $txt['name'], '</th>
<th scope="col" class="buddy_status">', $txt['status'], '</th>';
if ($context['can_moderate_forum'])
echo '
<th scope="col" class="buddy_email">', $txt['email'], '</th>';
echo '
<th scope="col" class="buddy_remove">', $txt['ignore_remove'], '</th>
</tr>
</thead>
<tbody>';
// If they don't have anyone on their ignore list, don't list it!
if (empty($context['ignore_list']))
echo '
<tr class="windowbg">
<td colspan="', $context['can_moderate_forum'] ? '4' : '3', '">
<strong>', $txt['no_ignore'], '</strong>
</td>
</tr>';
// Now loop through each buddy showing info on each.
foreach ($context['ignore_list'] as $member)
{
echo '
<tr class="windowbg">
<td class="buddy_link">', $member['link'], '</td>
<td class="centertext buddy_status">
<a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a>
</td>';
if ($context['can_moderate_forum'])
echo '
<td class="centertext buddy_email">
<a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="main_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a>
</td>';
echo '
<td class="centertext buddy_remove">
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="main_icons delete" title="', $txt['ignore_remove'], '"></span></a>
</td>
</tr>';
}
echo '
</tbody>
</table>
</div><!-- #edit_buddies -->';
// Add to the ignore list?
echo '
<form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore" method="post" accept-charset="', $context['character_set'], '">
<div class="cat_bar">
<h3 class="catbg">', $txt['ignore_add'], '</h3>
</div>
<div class="information">
<dl class="settings">
<dt>
<label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
</dt>
<dd>
<input type="text" name="new_ignore" id="new_ignore" size="30">
<input type="submit" value="', $txt['ignore_add_button'], '" class="button">
</dd>
</dl>
</div>';
if (!empty($context['token_check']))
echo '
<input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</form>
<script>
var oAddIgnoreSuggest = new smc_AutoSuggest({
sSelf: \'oAddIgnoreSuggest\',
sSessionId: \'', $context['session_id'], '\',
sSessionVar: \'', $context['session_var'], '\',
sSuggestId: \'new_ignore\',
sControlId: \'new_ignore\',
sSearchType: \'member\',
sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
bItemList: false
});
</script>';
}
/**
* This template shows an admin information on a users IP addresses used and errors attributed to them.
*/
function template_trackActivity()
{
global $context, $scripturl, $txt;
// The first table shows IP information about the user.
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['view_ips_by'], ' ', $context['member']['name'], '</h3>
</div>';
// The last IP the user used.
echo '
<div id="tracking" class="windowbg">
<dl class="settings noborder">
<dt>