This repository has been archived by the owner on Jul 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Profile-Chars.template.php
1566 lines (1392 loc) · 54.9 KB
/
Profile-Chars.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
function character_popup_row($id_character, $char) {
global $context, $scripturl, $txt, $user_info, $cur_profile, $modSettings;
echo '
<li>
<div class="character">
<span class="avatar">
', !empty($char['avatar']) ? '<img src="' . $char['avatar'] . '" alt="" />' : '<img src="' . $modSettings['avatar_url'] . '/default.png" alt="" />', '
</span>
<a href="', $scripturl, $char['character_url'], '">', $char['character_name'], '</a>';
if (!empty($char['is_main']))
{
echo '
(<abbr title="', $txt['main_char_desc'], '">', $txt['main_char'], '</abbr>)';
}
if ($id_character != $user_info['id_character'])
echo '
<span class="switch">
<span data-href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=char_switch;char=', $id_character, ';', $context['session_var'], '=', $context['session_id'], '" class="button">', $txt['switch_chars'], '</a>
</span>';
if (empty($char['is_main']))
{
echo '
<span class="switch">
<a class="button" href="', $scripturl, $char['character_url'], ';sa=sheet">', $txt['char_sheet_link'], '</a>
</span>';
}
echo '
</div>
</li>';
}
function template_characters_popup()
{
global $context, $scripturl, $txt, $user_info, $cur_profile, $modSettings;
echo '
<div id="posting_as">', sprintf($txt['you_are_posting_as'], $user_info['character_name']), '
<div id="my_account" class="chars_container">
<ul>';
foreach ($cur_profile['characters'] as $id_character => $char)
{
if (!empty($char['is_main']))
character_popup_row($id_character, $char);
}
echo '
</ul>
</div>
<div id="my_characters">', $txt['my_characters'], '</div>
<div id="chars_container" class="chars_container">
<ul>';
foreach ($cur_profile['characters'] as $id_character => $char)
{
if ($char['retired'])
continue;
if (empty($char['is_main']))
character_popup_row($id_character, $char);
}
echo '
</ul>
</div>
<br />
<div class="clear centertext">
<a class="button" href="', $scripturl, '?action=profile;u=', $user_info['id'], ';area=char_create">', $txt['char_create'], '</a>
</div>
<script>
$(".chars_container .switch span.button").on("click", function() {
$.ajax({
url: $(this).data("href")
}).done(function( data ) {
console.log("done");
location.reload();
});
});
</script>';
}
function template_character_profile()
{
global $context, $txt, $user_profile, $scripturl, $user_info, $modSettings;
echo '
<div class="cat_bar">
<h3 class="catbg">
', !empty($context['character']['avatar']) ? '<img class="icon" style="max-width: 25px; max-height: 25px;" src="' . $context['character']['avatar'] . '" alt="">' : '', '
', $context['character']['character_name'], '
', $context['character']['retired'] ? ' - ' . $txt['char_retired'] : '', '
</h3>
</div>
<div class="errorbox" style="display:none" id="profile_error"></div>
<div id="profileview" class="roundframe flow_auto">
<div id="basicinfo">';
if (!empty($context['character']['avatar']))
echo '
<img class="avatar" src="', $context['character']['avatar'], '" alt=""><br /><br />';
else
echo '
<img class="avatar" src="', $modSettings['avatar_url'], '/default.png" alt=""><br /><br />';
if ($context['user']['is_owner'] && $user_info['id_character'] != $context['character']['id_character'])
{
echo '
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=char_switch_redir;char=', $context['character']['id_character'], ';', $context['session_var'], '=', $context['session_id'], '" class="button">', $txt['switch_to_char'], '</a><br /><br />';
}
if (!$context['character']['is_main'] && !empty($context['character']['char_sheet']))
{
echo '
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=sheet" class="button">', $txt['char_sheet'], '</a><br /><br />';
}
if ($context['character']['editable'])
{
echo '
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=edit" class="button">', $txt['edit_char'], '</a><br /><br />';
}
if ($context['character']['editable'] && $context['character']['retire_eligible'])
{
echo '
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=retire;', $context['session_var'], '=', $context['session_id'], '" class="button">', $context['character']['retired'] ? $txt['char_unretire_char'] : $txt['char_retire_char'], '</a><br /><br />';
}
if ($context['character']['editable'] && $context['character']['posts'] == 0 && !$context['character']['is_main'])
{
echo '
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=delete;', $context['session_var'], '=', $context['session_id'], '" class="button" onclick="return confirm(', JavaScriptEscape($txt['are_you_sure_delete_char']), ');">', $txt['delete_char'], '</a><br /><br />';
}
if (!$context['character']['is_main'] && allowedTo('admin_forum'))
{
echo '
<a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=move_acct;', $context['session_var'], '=', $context['session_id'], '" class="button">', $txt['move_char_action'], '</a><br /><br />';
}
$days_registered = (int) ((time() - $user_profile[$context['id_member']]['date_registered']) / (3600 * 24));
$posts_per_day = $days_registered > 1 ? comma_format($context['character']['posts'] / $days_registered, 2) : '';
echo '
</div>
<div id="detailedinfo">
<dl>
<dt>', $txt['char_name'], '</dt>
<dd>', $context['character']['character_name'], '</dd>
<dt>', $txt['profile_posts'], ':</dt>
<dd>', comma_format($context['character']['posts']), $days_registered > 1 ? ' (' . $posts_per_day . ' per day)' : '', '</dd>';
if (!empty($context['character']['char_title']))
{
echo '
<dt>', $txt['custom_title'], ':</dt>
<dd>', parse_bbc($context['character']['char_title'], false), '</dd>';
}
echo '
<dt>', $txt['age'], ':</dt>
<dd>', !empty($context['character']['age']) ? $context['character']['age'] : 'N/A', '</dd>
</dl>';
if (!empty($context['character']['signature'])) {
echo '
<div class="char_signature">', parse_bbc($context['character']['signature'], true, 'sig_char' . $context['character']['id_character']), '</div>
<dl></dl>';
}
echo '
<dl class="noborder">
<dt>', $txt['date_created'], '</dt>
<dd>', timeformat($context['character']['date_created']), '</dd>
<dt>', $txt['lastLoggedIn'], ': </dt>
<dd>', !empty($context['character']['last_active']) ? timeformat($context['character']['last_active']) : '<em>' . $txt['never'] . '</em>', '</dd>';
if ($context['character']['editable'])
echo '
<dt>', $txt['current_theme'], ':</dt>
<dd>', $context['character']['theme_name'], ' <a class="button" href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=theme">', $txt['change_theme'], '</a></dd>';
echo '
</dl>
</div>
</div>';
}
function template_edit_char()
{
global $context, $txt, $scripturl, $modSettings;
if ($context['char_updated'])
{
echo '
<div class="infobox">
', sprintf($txt[$context['user']['is_owner'] ? 'character_updated_you' : 'character_updated_else'], $context['character']['character_name']), '
</div>';
}
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['edit_char'], '</h3>
</div>';
echo '
<div id="profileview" class="roundframe flow_auto">
<div class="errorbox" id="profile_error"', empty($context['form_errors']) ? ' style="display:none"' : '', '>
<span>', $txt['char_editing_error'], '</span>
<ul id="list_errors">';
foreach ($context['form_errors'] as $err)
echo '
<li>', $err, '</li>';
echo '
</ul>
</div>
<div id="basicinfo">';
echo '
</div>
<div id="detailedinfo">
<form id="creator" action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=edit" method="post" accept-charset="', $context['character_set'], '">';
if ($context['character']['groups_editable'])
{
echo '
<dl>
<dt>
<strong>', $txt['primary_membergroup'], ': </strong><br>
</dt>
<dd>
<select name="id_group">';
// Fill the select box with all primary member groups that can be assigned to a member.
foreach ($context['member_groups'] as $member_group)
if (!empty($member_group['can_be_primary']))
echo '
<option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
', $member_group['name'], '
</option>';
echo '
</select>
</dd>
<dt>
<strong>', $txt['additional_membergroups'], ':</strong>
</dt>
<dd>
<span id="additional_groupsList">
<input type="hidden" name="additional_groups[]" value="0">';
// For each membergroup show a checkbox so members can be assigned to more than one group.
foreach ($context['member_groups'] as $member_group)
if ($member_group['can_be_additional'])
echo '
<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' : '', ' class="input_check"> ', $member_group['name'], '</label><br>';
echo '
</span>
<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>
<script>
document.getElementById("additional_groupsList").style.display = "none";
document.getElementById("additional_groupsLink").style.display = "";
</script>
</dd>
</dl>';
}
echo '
<dl>
<dt>', $txt['char_name'], '</dt>
<dd>
<input type="text" name="char_name" id="char_name" size="50" value="', $context['character']['character_name'], '" maxlength="50" class="input_text">
</dd>';
if ($context['character']['title_editable'])
{
echo '
<dt>', $txt['custom_title'], '</dt>
<dd>
<input type="text" name="char_title" id="char_title" size="50" value="', $context['character']['char_title_raw'], '" maxlength="255" class="input_text">
</dd>';
}
echo '
<dt>
', $txt['avatar_link'];
if (!empty($modSettings['avatar_max_width_external']))
{
echo '
<div class="smalltext">', sprintf(
$txt['max_avatar_size'],
$modSettings['avatar_max_width_external'],
$modSettings['avatar_max_height_external']
), '</div>';
}
echo '
</dt>
<dd>
<input type="text" name="avatar" id="avatar" size="50" value="', !empty($context['character']['avatar']) ? $context['character']['avatar'] : '', '" maxlength="255" class="input_type">
</dd>
<dt>', $txt['avatar_preview'], '</dt>
<dd id="avatar_preview"></dd>
<dt>', $txt['age'], ':</dt>
<dd>
<input type="text" name="age" id="age" size="50" value="', !empty($context['character']['age']) ? $context['character']['age'] : '', '" maxlength="50" class="input_text">
</dd>
</dl>
<div class="char_signature"></div>
<dl class="noborder" id="current_sig">
<dt>', $txt['current_signature'], ':</dt>
<dd></dd>
</dl>
<div class="signature" id="current_sig_parsed">
', !empty($context['character']['signature']) ? parse_bbc($context['character']['signature'], true, 'sig_char_' . $context['character']['id_character']) : '<em>' . $txt['no_signature_set'] . '</em>', '
</div>
<dl></dl>
<dl class="noborder" id="sig_preview">
<dt>', $txt['signature_preview'], ':</dt>
<dd></dd>
</dl>
<div class="signature" id="sig_preview_parsed"></div>
<dl class="noborder" id="sig_header">
<dt>', $txt['signature'], ':</dt>
<dd></dd>
</dl>
', template_control_richedit('char_signature', 'smileyBox_message', 'bbcBox_message');
echo '
<div>';
// If there is a limit at all!
if (!empty($context['signature_limits']['max_length']))
echo '
<span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span>';
echo '
<span class="floatright"><input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button_submit"></span>
</div>';
if ($context['signature_warning'])
echo '
<span class="smalltext">', $context['signature_warning'], '</span>';
// Some javascript used to count how many characters have been used so far in the signature.
echo '
<script>
var maxLength = ', $context['signature_limits']['max_length'], ';
last_signature = false;
function calcCharLeft()
{
var oldSignature = "", currentSignature = $("#char_signature").data("sceditor").getText().replace(/&#/g, \'&#\');
var currentChars = 0;
if (!document.getElementById("signatureLeft"))
return;
// Changed since we were last here?
if (last_signature === currentSignature)
return;
last_signature = currentSignature;
if (oldSignature != currentSignature)
{
oldSignature = currentSignature;
var currentChars = currentSignature.replace(/\r/, "").length;
if (is_opera)
currentChars = currentSignature.replace(/\r/g, "").length;
if (currentChars > maxLength)
document.getElementById("signatureLeft").className = "error";
else
document.getElementById("signatureLeft").className = "";
if (currentChars > maxLength)
chars_ajax_getSignaturePreview(false);
// Only hide it if the only errors were signature errors...
else if (currentChars <= maxLength)
{
// Are there any errors to begin with?
if ($(document).has("#list_errors"))
{
// Remove any signature errors
$("#list_errors").remove(".sig_error");
// Show this if other errors remain
if (!$("#list_errors").has("li"))
{
$("#profile_error").css({display:"none"});
$("#profile_error").html("");
}
}
}
}
setInnerHTML(document.getElementById("signatureLeft"), maxLength - currentChars);
}
$(document).ready(function() {
calcCharLeft();
$("#preview_button").click(function() {
return chars_ajax_getSignaturePreview(true);
});
});
window.setInterval(calcCharLeft, 1000);
</script>
<dl></dl>
<input type="hidden" name="u" value="', $context['id_member'], '" />
<input type="submit" name="edit_char" class="button_submit" value="', $txt['save_changes'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
<input type="hidden" name="', $context['edit-char' . $context['character']['id_character'] . '_token_var'], '" value="', $context['edit-char' . $context['character']['id_character'] . '_token'], '">
</form>
</div>
</div>';
}
function template_char_create()
{
global $context, $txt, $scripturl;
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['char_create'], '</h3>
</div>';
echo '
<div id="profileview" class="roundframe flow_auto">
<div class="errorbox" id="profile_error"', empty($context['form_errors']) ? ' style="display:none"' : '', '>
<span>', $txt['char_editing_error'], '</span>
<ul id="list_errors">';
foreach ($context['form_errors'] as $err)
echo '
<li>', $err, '</li>';
echo '
</ul>
</div>
<div id="basicinfo">';
echo '
</div>
<div id="detailedinfo">
<form id="creator" action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=char_create" method="post" accept-charset="', $context['character_set'], '">';
echo '
<dl>
<dt>', $txt['char_name'], '</dt>
<dd>
<input type="text" name="char_name" id="char_name" size="50" value="', $context['character']['character_name'], '" maxlength="50" class="input_text">
</dd>
<dt>', $txt['age'], ':</dt>
<dd>
<input type="text" name="age" id="age" size="50" value="', !empty($context['character']['age']) ? $context['character']['age'] : '', '" maxlength="50" class="input_text">
</dd>
</dl>
<dl class="char_sheet_text">
<dt>', $txt['char_sheet'], ':</dt>';
if (!empty($context['sheet_templates']))
{
echo '
<dd>
', $txt['char_templates_sel'], '
<select id="char_sheet_template">
<option>-- ', $txt['char_templates'], ' --</option>';
foreach ($context['sheet_templates'] as $id_template => $template)
{
echo '
<option value="', $id_template, '">', $template['name'], '</option>';
}
echo '
</select>
<a href="#" class="button" id="insert_char_template">', $txt['char_templates_add'], '</a>
</dd>';
}
echo '
</dl>
<div class="create_char_editor">';
template_control_richedit('message', null, 'bbcBox');
echo '
</div>
<br />
<div class="smalltext">', $txt['you_can_add_later'], '</div>
<input type="hidden" name="u" value="', $context['id_member'], '" />
<input type="submit" name="create_char" class="button_submit" value="', $txt['char_create'], '" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</form>
</div>
</div>';
insert_char_sheet_js();
}
function template_char_theme()
{
global $context, $txt, $scripturl;
echo '
<div class="cat_bar">
<h3 class="catbg">', $txt['char_theme'],'</h3>
</div>
<div id="profileview" class="roundframe flow_auto">
<form id="char_theme_wrapper" action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=characters;char=', $context['character']['id_character'], ';sa=theme" method="post">';
foreach ($context['themes'] as $id_theme => $theme)
{
echo '
<div class="char_theme_container">
<button name="theme[', $id_theme, ']" class="button"><img src="', $theme['thumbnail'], '" alt=""></button>
', $theme['name'], '
</div>';
}
echo '
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
</form>
</div>';
}
function template_char_posts()
{
global $context, $scripturl, $txt;
echo '
<div class="cat_bar">
<h3 class="catbg">
', empty($context['is_topics']) ? $txt['showMessages'] : $txt['showTopics'], ' - ', $context['character']['character_name'], '
</h3>
</div>', !empty($context['page_index']) ? '
<div class="pagesection">
<div class="pagelinks">' . $context['page_index'] . '</div>
</div>' : '';
// 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="counter">', $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>
<div class="list_posts">';
if (!$post['approved'])
echo '
<div class="approve_post">
<em>', $txt['post_awaiting_approval'], '</em>
</div>';
echo '
', $post['body'], '
</div>';
if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
echo '
<div class="floatright">
<ul class="quickbuttons">';
// If they *can* reply?
if ($post['can_reply'])
echo '
<li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>';
// If they *can* quote?
if ($post['can_quote'])
echo '
<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>';
// How about... even... remove it entirely?!
if ($post['can_delete'])
echo '
<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>';
if ($post['can_reply'] || $post['can_quote'] || $post['can_delete'])
echo '
</ul>
</div>';
echo '
</div>';
}
// No posts? Just end with a informative message.
if (empty($context['posts']))
echo '
<div class="windowbg2">
', $context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none'], '
</div>
</div>';
// Show more page numbers.
if (!empty($context['page_index']))
echo '
<div class="pagesection">
<div class="pagelinks">', $context['page_index'], '</div>
</div>';
}
function template_char_stats()
{
global $context, $txt;
// First, show a few text statistics such as post/topic count.
echo '
<div id="profileview" class="roundframe">
<div id="generalstats">
<dl class="stats">
<dt>', $txt['statPanel_total_posts'], ':</dt>
<dd>', $context['num_posts'], ' ', $txt['statPanel_posts'], '</dd>
<dt>', $txt['statPanel_total_topics'], ':</dt>
<dd>', $context['num_topics'], ' ', $txt['statPanel_topics'], '</dd>
</dl>
</div>';
// This next section draws a graph showing what times of day they post the most.
echo '
<div id="activitytime" class="flow_hidden">
<div class="title_bar">
<h3 class="titlebg">
<span class="generic_icons history"></span> ', $txt['statPanel_activityTime'], '
</h3>
</div>';
// If they haven't post at all, don't draw the graph.
if (empty($context['posts_by_time']))
echo '
<span class="centertext">', $txt['statPanel_noPosts'], '</span>';
// Otherwise do!
else
{
echo '
<ul class="activity_stats flow_hidden">';
// The labels.
foreach ($context['posts_by_time'] as $time_of_day)
{
echo '
<li', $time_of_day['is_last'] ? ' class="last"' : '', '>
<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']), '">
<div style="height: ', (int) $time_of_day['relative_percent'], 'px;">
<span>', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '</span>
</div>
</div>
<span class="stats_hour">', $time_of_day['hour_format'], '</span>
</li>';
}
echo '
</ul>';
}
echo '
<span class="clear">
</div>';
// Two columns with the most popular boards by posts and activity (activity = users posts / total posts).
echo '
<div class="flow_hidden">
<div class="half_content">
<div class="title_bar">
<h3 class="titlebg">
<span class="generic_icons replies"></span> ', $txt['statPanel_topBoards'], '
</h3>
</div>';
if (empty($context['popular_boards']))
echo '
<span class="centertext">', $txt['statPanel_noPosts'], '</span>';
else
{
echo '
<dl class="stats">';
// Draw a bar for every board.
foreach ($context['popular_boards'] as $board)
{
echo '
<dt>', $board['link'], '</dt>
<dd>
<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_char'], $board['posts_percent']), '">
', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_char'], $board['posts_percent']), '
</div>
', empty($context['hide_num_posts']) ? $board['posts'] : '', '
</dd>';
}
echo '
</dl>';
}
echo '
</div>';
echo '
<div class="half_content">
<div class="title_bar">
<h3 class="titlebg">
<span class="generic_icons replies"></span> ', $txt['statPanel_topBoardsActivity'], '
</h3>
</div>';
if (empty($context['board_activity']))
echo '
<span>', $txt['statPanel_noPosts'], '</span>';
else
{
echo '
<dl class="stats">';
// Draw a bar for every board.
foreach ($context['board_activity'] as $activity)
{
echo '
<dt>', $activity['link'], '</dt>
<dd>
<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']), '">
', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '
</div>
', $activity['percent'], '%
</dd>';
}
echo '
</dl>';
}
echo '
</div>
</div>';
echo '
</div>';
}
function template_char_summary()
{
global $context, $settings, $scripturl, $modSettings, $txt;
// Display the basic information about the user
echo '
<div id="profileview" class="roundframe flow_auto">
<div id="basicinfo">';
// Are there any custom profile fields for above the name?
if (!empty($context['print_custom_fields']['above_member']))
{
echo '
<div class="custom_fields_above_name">
<ul >';
foreach ($context['print_custom_fields']['above_member'] as $field)
if (!empty($field['output_html']))
echo '
<li>', $field['output_html'], '</li>';
echo '
</ul>
</div>
<br>';
}
echo '
<div class="username clear">
<h4>', $context['member']['name'], '</h4>
</div>
', $context['member']['avatar']['image'], '
<div class="badges">', $context['member']['badges'], '</div>
<div class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : ''), '</div>';
// Are there any custom profile fields for below the avatar?
if (!empty($context['print_custom_fields']['below_avatar']))
{
echo '
<div class="custom_fields_below_avatar">
<ul >';
foreach ($context['print_custom_fields']['below_avatar'] as $field)
if (!empty($field['output_html']))
echo '
<li>', $field['output_html'], '</li>';
echo '
</ul>
</div>
<br>';
}
echo '
<ul class="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="generic_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" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_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']))
{
echo '
<div class="custom_fields_bottom">
<ul class="nolist">';
foreach ($context['print_custom_fields']['bottom_poster'] as $field)
if (!empty($field['output_html']))
echo '
<li>', $field['output_html'], '</li>';
echo '
</ul>
</div>';
}
echo '
</div>';
echo '
<div id="detailedinfo">
<dl>';
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']))
{
echo '
<dl>';
foreach ($context['print_custom_fields']['standard'] as $field)
if (!empty($field['output_html']))
echo '
<dt>', $field['name'], ':</dt>
<dd>', $field['output_html'], '</dd>';
echo '
</dl>';
}
echo '
<dl class="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_type'] == 4 ? ' class="you_sure" data-confirm="'. $txt['profileConfirm'] .'"' : ''), '>', $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\').style.display = document.getElementById(\'ban_info\').style.display == \'none\' ? \'\' : \'none\';return false;">' . $txt['view_ban'] . '</a>]</dt>
<dt class="clear" id="ban_info" style="display: none;">
<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']))
{
echo '
<div class="custom_fields_above_signature">
<ul class="nolist">';
foreach ($context['print_custom_fields']['above_signature'] as $field)
if (!empty($field['output_html']))
echo '
<li>', $field['output_html'], '</li>';
echo '
</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'], '