forked from flazyforum/Flazy-Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpm.php
939 lines (800 loc) · 51.5 KB
/
pm.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
<?php
/**
* Позволяет участникам просматривать\редактировать\отправлять личные сообщения.
*
* @copyright Copyright (C) 2008 PunBB, partially based on code copyright (C) 2008 FluxBB.org
* @modified Copyright (C) 2014-2018 Flazy
* @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
* @package Flazy
*/
if (!defined('FORUM_ROOT'))
define('FORUM_ROOT', './');
require FORUM_ROOT . 'include/common.php';
($hook = get_hook('pm_fl_start')) ? eval($hook) : null;
if ($forum_user['is_guest'])
message($lang_common['No permission']);
$section = isset($_GET['section']) ? $_GET['section'] : 'inbox';
$errors = array();
// Load the profile.php language file
require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/profile.php';
require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/pm.php';
if ($section == 'delete') {
if (isset($_GET['id'])) {
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1)
message($lang_common['Bad request']);
confirm_current_url(forum_link($forum_url['pm_delete'], $id));
$query = array(
'SELECT' => 'm.receiver_id',
'FROM' => 'pm AS m',
'WHERE' => 'm.id=' . $id
);
($hook = get_hook('pm_fl_pm_get_message_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
if (!$forum_db->num_rows($result))
message($lang_common['Bad request']);
$cur_delete = $forum_db->fetch_assoc($result);
$section = ($cur_delete['receiver_id'] == $forum_user['id'] ? 'inbox' : 'outbox');
$ids[0] = $id;
}
else if (isset($_POST['id'])) {
confirm_current_url(forum_link($forum_url['pm_delete_section']));
$ids = $_POST['id'];
$section = $_POST['section'];
foreach ($ids as $key => $id)
$ids[$key] = intval($id);
}
if (!defined('FORUM_FUNCTIONS_DELETE_POST'))
require FORUM_ROOT . 'include/functions/delete_pm.php';
delete_pm($ids, $section);
redirect(forum_link($forum_url['pm'], $section), $lang_pm['Message deleted']);
}
if (isset($_POST['form_sent'])) {
$receiver = isset($_POST['req_receiver']) ? forum_trim($_POST['req_receiver']) : null;
$subject = forum_trim($_POST['subject']);
$message = forum_linebreaks(forum_trim($_POST['req_message']));
$receiver_id = 'NULL';
if ($receiver) {
$query = array(
'SELECT' => 'u.id, u.email, u.pm_get_mail',
'FROM' => 'users AS u',
'WHERE' => 'u.username=\'' . $forum_db->escape($receiver) . '\''
);
($hook = get_hook('pm_fl_pm_get_receiver_id_qr')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
if ($forum_db->num_rows($result))
list($receiver_id, $receiver_email, $receiver_mail) = $forum_db->fetch_row($result);
else
$errors[] = sprintf($lang_pm['Non-existent username'], forum_htmlencode($receiver));
if ($forum_user['id'] == $receiver_id)
$errors[] = $lang_pm['Message to yourself'];
if ($receiver_id == '1')
$errors[] = $lang_pm['Message to guest'];
}
if (isset($_POST['draft'])) {
if ($message == '' && $subject == '' && $receiver == '')
$errors[] = $lang_pm['Empty all fields'];
$status = 'draft';
}
else {
if ($forum_user['pm_outbox'] >= $forum_config['o_pm_outbox_size'])
$errors[] = sprintf($lang_pm['Limit outbox'], $forum_config['o_pm_outbox_size']);
if ($receiver == '')
$errors[] = $lang_pm['Empty receiver'];
if (utf8_strlen($message) > FORUM_MAX_POSTSIZE)
$errors[] = sprintf($lang_pm['Too long message'], forum_number_format(utf8_strlen($message)), forum_number_format(FORUM_MAX_POSTSIZE));
else if (!$forum_config['p_message_all_caps'] && check_is_all_caps($message) && !$forum_user['is_admmod'])
$errors[] = $lang_pm['All caps message'];
// Validate BBCode syntax
if ($forum_config['p_message_bbcode'] || $forum_config['o_make_links']) {
if (!defined('FORUM_PARSER_LOADED'))
require FORUM_ROOT . 'include/parser.php';
$message = preparse_bbcode($message, $errors);
}
if ($message == '')
$errors[] = $lang_pm['Empty body'];
$status = 'sent';
}
$now = time();
($hook = get_hook('pp_fl_end_validation')) ? eval($hook) : null;
if (empty($errors)) {
if (isset($_POST['edit'])) {
$id = intval($_POST['edit']);
$query = array(
'UPDATE' => 'pm',
'SET' => 'receiver_id=' . $receiver_id . ', subject=\'' . $forum_db->escape($subject) . '\', message=\'' . $forum_db->escape($message) . '\', edited=' . $now,
'WHERE' => 'id=' . $id . ' AND (status=\'draft\' OR status=\'sent\')'
);
($hook = get_hook('pm_fl_edit_update_status_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
redirect(forum_link($forum_url['pm_view'], $id), $lang_pm['Message send']);
} else if (isset($_POST['submit']) || isset($_POST['draft'])) {
$post_info = array(
'sender_id' => $forum_user['id'],
'sender_name' => $forum_user['username'],
'receiver_id' => $receiver_id,
'status' => $status,
'posted' => $now,
'subject' => $subject,
'message' => $message,
);
$redirect_message = $lang_pm['Message saved'];
if (isset($_POST['submit'])) {
$post_info['receiver'] = $receiver;
$post_info['email'] = $receiver_email;
$post_info['mail'] = $receiver_mail;
$redirect_message = $lang_pm['Message sent'];
}
($hook = get_hook('pm_pre_add_pm')) ? eval($hook) : null;
if (!defined('FORUM_FUNCTIONS_ADD_PM'))
require FORUM_ROOT . 'include/functions/add_pm.php';
add_pm($post_info, $new_pid);
redirect(forum_link($forum_url['pm_view'], $new_pid), $redirect_message);
}
}
}
// Setup navigation menu
$forum_page['main_menu'] = array();
$forum_page['main_menu']['about'] = '<li class="first-item"><a href="' . forum_link($forum_url['profile'], array($forum_user['id'], 'about')) . '#brd-crumbs-top"><span>' . $lang_profile['Section about'] . '</span></a></li>';
$forum_page['main_menu']['identity'] = '<li><a href="' . forum_link($forum_url['profile'], array($forum_user['id'], 'identity')) . '#brd-crumbs-top"><span>' . $lang_profile['Section identity'] . '</span></a></li>';
$forum_page['main_menu']['settings'] = '<li><a href="' . forum_link($forum_url['profile'], array($forum_user['id'], 'settings')) . '#brd-crumbs-top"><span>' . $lang_profile['Section settings'] . '</span></a></li>';
if ($forum_config['o_signatures'])
$forum_page['main_menu']['signature'] = '<li><a href="' . forum_link($forum_url['profile'], array($forum_user['id'], 'signature')) . '#brd-crumbs-top"><span>' . $lang_profile['Section signature'] . '</span></a></li>';
if ($forum_config['o_avatars'])
$forum_page['main_menu']['avatar'] = '<li><a href="' . forum_link($forum_url['profile'], array($forum_user['id'], 'avatar')) . '#brd-crumbs-top"><span>' . $lang_profile['Section avatar'] . '</span></a></li>';
$forum_page['main_menu']['pm'] = '<li class="active"><a href="' . forum_link($forum_url['pm'], 'inbox') . '#brd-crumbs-top"><span>' . $lang_profile['Private messages'] . '</span></a></li>';
if ($forum_user['g_id'] == FORUM_ADMIN || ($forum_user['g_moderator'] == '1' && $forum_user['g_mod_ban_users'] && !$forum_page['own_profile']))
$forum_page['main_menu']['admin'] = '<li><a href="' . forum_link($forum_url['profile'], array($forum_user['id'], 'admin')) . '#brd-crumbs-top"><span>' . $lang_profile['Section admin'] . '</span></a></li>';
$forum_links['pm'] = array(
'<li' . ($section == 'inbox' ? ' class="active first-item"' : ' class="normal"') . '><a href="' . forum_link($forum_url['pm'], 'inbox') . '#brd-crumbs-top">' . $lang_pm['Inbox'] . '</a></li>',
'<li' . ($section == 'outbox' ? ' class="active first-item"' : ' class="normal"') . '><a href="' . forum_link($forum_url['pm'], 'outbox') . '#brd-crumbs-top">' . $lang_pm['Outbox'] . '</a></li>',
'<li' . ($section == 'write' ? ' class="active first-item"' : ' class="normal"') . '><a href="' . forum_link($forum_url['pm'], 'write') . '#brd-crumbs-top">' . $lang_pm['Compose message'] . '</a></li>'
);
($hook = get_hook('pm_change_details_modify_main_menu')) ? eval($hook) : null;
if ($section == 'inbox' || $section == 'outbox') {
confirm_current_url(forum_link($forum_url['pm'], $section));
// Setup breadcrumbs
$forum_page['crumbs'] = array(
array($forum_config['o_board_title'], forum_link($forum_url['index'])),
array(sprintf($lang_profile['Users profile'], $forum_user['username']), forum_link($forum_url['profile'], array($forum_user['id'], 'about'))),
array($lang_profile['Private messages'], forum_link($forum_url['pm'], $section))
);
if ($forum_config['o_pm_' . $section . '_size']) {
if (!($forum_user['pm_' . $section] < 1 * $forum_config['o_pm_' . $section . '_size']))
$forum_page['full_box'] = sprintf($lang_pm['Limit ' . $section], $forum_config['o_pm_' . $section . '_size']);
else if (!($forum_user['pm_' . $section] < 0.75 * $forum_config['o_pm_' . $section . '_size']))
$forum_page['full_box'] = sprintf($lang_pm['Limit almost ' . $section], $forum_config['o_pm_' . $section . '_size']);
}
if ($section == 'inbox') {
$forum_page['heading'] = $lang_pm['Inbox'] . ($forum_config['o_pm_inbox_size'] ? sprintf($lang_pm['Status box'], substr(($forum_user['pm_inbox'] / ($forum_config['o_pm_inbox_size'] * 0.01)), 0, 5), $forum_user['pm_inbox'], $forum_config['o_pm_inbox_size']) : '');
$forum_page['user_role'] = $lang_pm['Sender'];
} else {
$forum_page['heading'] = $lang_pm['Outbox'] . ($forum_config['o_pm_outbox_size'] ? sprintf($lang_pm['Status box'], substr(($forum_user['pm_outbox'] / ($forum_config['o_pm_outbox_size'] * 0.01)), 0, 5), $forum_user['pm_outbox'], $forum_config['o_pm_outbox_size']) : '');
$forum_page['user_role'] = $lang_pm['Receiver'];
}
($hook = get_hook('pm_fl_section_box_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE', 'pm-message');
require FORUM_ROOT . 'header.php';
// START SUBST - <forum_main>
ob_start();
?>
<div class="admin-submenu gen-content">
<ul>
<?php echo implode("\n\t\t\t\t", $forum_links['pm']) . "\n" ?>
</ul>
</div>
<div class="main-subhead">
<h2 class="hn"><span><?php echo $forum_page['heading'] ?></span></h2>
</div>
<?php
if (!empty($forum_page['full_box'])) {
?>
<div class="main-content main-frm">
<div class="ct-box error-box">
<p class="important"><?php echo $forum_page['full_box'] . "\n" ?></p>
</div>
</div>
<?php
}
if (!$forum_user['pm_' . $section]) {
?>
<div class="main-content main-frm">
<div class="ct-box">
<h2 class="hn"><span><?php echo $lang_pm['Intro'] ?></span></h2>
</div>
<div class="ct-box">
<h2 class="hn"><strong><?php echo $lang_pm['Not PM'] ?></strong></h2>
</div>
</div>
<?php
} else {
$forum_page['num_pages'] = ceil($forum_user['pm_' . $section] / $forum_user['disp_topics']);
$forum_page['page'] = (!isset($_GET['p']) || !is_numeric($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $forum_page['num_pages']) ? 1 : $_GET['p'];
$forum_page['start_from'] = $forum_user['disp_topics'] * ($forum_page['page'] - 1);
$forum_page['finish_at'] = min(($forum_page['start_from'] + $forum_user['disp_topics']), ($forum_user['pm_' . $section]));
$query = array(
'SELECT' => 'm.id, m.status, m.subject, m.message, m.edited, u.id AS user_id, u.username',
'FROM' => 'pm AS m',
'ORDER BY' => 'm.edited DESC',
'LIMIT' => $forum_page['start_from'] . ', ' . $forum_user['disp_topics']
);
if ($section == 'inbox') {
$query['JOINS'][] = array(
'LEFT JOIN' => 'users AS u',
'ON' => '(u.id=m.sender_id)'
);
$query['WHERE'] = 'm.receiver_id=' . $forum_user['id'] . ' AND m.deleted_by_receiver=0 AND (m.status=\'read\' OR m.status=\'delivered\')';
} else {
$query['JOINS'][] = array(
'LEFT JOIN' => 'users AS u',
'ON' => '(u.id=m.receiver_id)'
);
$query['WHERE'] = 'm.sender_id=' . $forum_user['id'] . ' AND m.deleted_by_sender=0';
}
($hook = get_hook('pf_fl_pm_list_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$forum_page['set_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
$forum_page['form_action'] = forum_link($forum_url['pm_delete_section']);
$forum_page['mod_options'] = array(
'mod_delete' => '<span class="submit"><input type="submit" name="delete" value="' . $lang_pm['Delete message'] . '" onclick="return confirm_delete();"/></span>'
);
$forum_page['hidden_fields'] = array(
'send_action' => '<input type="hidden" name="send_action" value="" />',
'csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />',
'section' => '<input type="hidden" name="section" value="' . $section . '" />'
);
$forum_page['items_info'] = $lang_profile['Private messages'];
$forum_page['main_foot_options']['select_all'] = '<span ' . (empty($forum_page['main_foot_options']) ? ' class="first-item"' : '') . '><a href="#" onclick="return Forum.toggleCheckboxes(document.getElementById(\'pm-actions-form\'))">' . $lang_pm['Select all'] . '</a></span>';
$forum_page['table_header'] = array();
$forum_page['table_header']['icons'] = '<th class="tc' . count($forum_page['table_header']) . '" scope="col"><img src="' . $base_url . '/img/style/p_sent.png" height="16" width="16" alt="Status" title="Status"/></th>';
$forum_page['table_header']['role'] = '<th class="tc' . count($forum_page['table_header']) . '" scope="col">' . $forum_page['user_role'] . '</th>';
$forum_page['table_header']['subject'] = '<th class="tc' . count($forum_page['table_header']) . '" scope="col">' . $lang_pm['Subject'] . '</th>';
$forum_page['table_header']['edited'] = '<th class="tc' . count($forum_page['table_header']) . '" scope="col">' . $lang_pm['Edited'] . '</th>';
$forum_page['table_header']['select'] = '<th class="info-select" scope="col"></th>';
($hook = get_hook('pm_fl_box_results_pre_header_output')) ? eval($hook) : null;
?>
<form id="pm-actions-form" class="frm-form" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>">
<div class="main-content main-frm">
<div class="hidden">
<?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields']), "\n" ?>
</div>
<div class="ct-box">
<h2 class="hn"><span><?php echo $lang_pm['Intro'] ?></span></h2>
</div>
<fieldset class="frm-set set<?php echo ++$forum_page['set_count'] ?>">
<legend class="group-legend"><strong><?php echo $forum_page['heading'] ?></strong></legend>
<div class="ct-group">
<table cellspacing="0" class="pm-list">
<thead>
<tr>
<?php echo implode("\n\t\t\t\t\t\t\t", $forum_page['table_header']) . "\n" ?>
</tr>
</thead>
<tbody>
<?php
while ($cur_pm = $forum_db->fetch_assoc($result)) {
$message_link = forum_link($forum_url['pm_view'], $cur_pm['id']);
($hook = get_hook('pm_fl_box_pre_message_link')) ? eval($hook) : null;
$forum_page['table_row'] = array();
$forum_page['table_row']['icons'] = '<td class="tc' . count($forum_page['table_row']) . '"><img src="' . $base_url . '/img/style/' . ($cur_pm['status'] == 'delivered' ? 'p_' . $section . '_' : 'p_') . '' . $cur_pm['status'] . '.png" height="16" width="16" alt="' . $lang_pm['Status ' . $cur_pm['status']] . '" title="' . $lang_pm['Status ' . $cur_pm['status']] . '" /></td>';
$forum_page['table_row']['username'] = '<td class="tc' . count($forum_page['table_row']) . '">' . ($cur_pm['username'] ? '<a href="' . forum_link($forum_url['user'], $cur_pm['user_id']) . '">' . forum_htmlencode($cur_pm['username']) . '</a>' : $lang_pm['Empty']) . '</td>';
$forum_page['table_row']['subject'] = '<td class="tc' . count($forum_page['table_row']) . '"><span><a href="' . $message_link . '">' . forum_trim($cur_pm['subject'] ? forum_htmlencode($cur_pm['subject']) : $lang_pm['Empty']) . '</a>' . ($forum_user['pm_long_subject'] ? ' <a class="message" href="' . $message_link . '">' . forum_htmlencode(preg_replace('#(?:\s*(?:\[quote(?:=("|"|\'|)(?:.*?)\\1)?\](?:.*)\[\/quote\])*)((?:\S*\s*){20})(?:.*)$#su', '$2', $cur_pm['message'])) . '</a>' : '') . '</span></td>';
$forum_page['table_row']['edited'] = '<td class="tc' . count($forum_page['table_row']) . '">' . format_time($cur_pm['edited']) . '</td>';
$forum_page['table_row']['select'] = '<td class="info-select"><input type="checkbox" name="id[]" value="' . $cur_pm['id'] . '" /></td>';
++$forum_page['item_count'];
($hook = get_hook('pm_fl_box_results_row_pre_data_output')) ? eval($hook) : null;
?>
<tr class="<?php echo ($forum_page['item_count'] % 2 != 0) ? 'odd' : 'even' ?><?php echo ($forum_page['item_count'] == 1) ? ' row1' : '' ?><?php echo ($cur_pm['status'] == 'delivered') ? ' pm-new' : '' ?>">
<?php echo implode("\n\t\t\t\t\t\t\t", $forum_page['table_row']) . "\n" ?>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</fieldset>
</div>
<div class="main-options mod-options gen-content">
<p class="options"><?php echo implode(' ', $forum_page['mod_options']) ?></p>
</div>
</form>
<script type="text/javascript">
function confirm_delete()
{
var a = document.all && !window.opera ? document.all : document.getElementsByTagName("*");
var count = 0;
for (var i = a.length; i--; )
{
if (a[i].tagName.toLowerCase() == 'input' && a[i].getAttribute("type") == "checkbox" && a[i].getAttribute("name") == "id[]" && a[i].checked)
count++;
}
if (!count)
{
alert("<?php echo $lang_pm['Not selected'] ?>");
return false;
}
return confirm("<?php echo $lang_pm['Selected messages'] ?> " + count + "\n<?php echo $lang_pm['Delete confirmation'] ?>");
}
</script>
<div class="main-foot">
<?php
if (!empty($forum_page['main_foot_options']))
echo "\t\t" . '<p class="options">' . implode(' ', $forum_page['main_foot_options']) . '</p>' . "\n";
?>
<h2 class="hn"><span><?php echo $forum_page['items_info'] ?></span></h2>
</div>
<div id="brd-pagepost-end" class="main-pagepost gen-content">
<p class="paging"><span class="pages"><?php echo $lang_common['Pages'] . '</span> ' . paginate($forum_page['num_pages'], $forum_page['page'], $forum_url['pm' . ($section ? '' : '_outbox')], $lang_common['Paging separator'], $forum_user['id']) ?></p>
<p class="posting"><a class="newpost" href="<? echo forum_link($forum_url['pm'], 'write') ?>"><span><?php echo $lang_pm['New message'] ?></span></a></p>
</div>
<?php
}
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<forum_main>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <forum_main>
require FORUM_ROOT . 'footer.php';
}
else if ($section == 'write' || $section == 'edit') {
$forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
if ($section == 'edit') {
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1)
message($lang_common['Bad request']);
confirm_current_url(forum_link($forum_url['pm_edit'], $id));
$query = array(
'SELECT' => 'u.username, m.subject, m.message, m.status',
'FROM' => 'pm AS m',
'JOINS' => array(
array(
'LEFT JOIN' => 'users AS u',
'ON' => 'u.id=m.receiver_id'
)
),
'WHERE' => 'm.id=' . $id . ' AND (status=\'draft\' OR status=\'sent\')'
);
($hook = get_hook('pm_fl_pm_get_message_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
if (!$forum_db->num_rows($result))
message($lang_common['Bad request']);
list($receiver, $subject, $message, $status) = $forum_db->fetch_row($result);
$forum_page['form_action'] = forum_link($forum_url['pm_edit'], $id);
}
else {
if ($forum_config['o_pm_outbox_size'] && !($forum_user['pm_outbox'] < 1 * $forum_config['o_pm_outbox_size']))
message(sprintf($lang_pm['Limit outbox'], $forum_config['o_pm_outbox_size']));
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
if ($id < 2)
message($lang_common['Bad request']);
$query = array(
'SELECT' => 'u.username',
'FROM' => 'users AS u',
'WHERE' => 'u.id=' . $id
);
($hook = get_hook('pm_fl_pm_get_receiver_id_qr')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
list($receiver) = $forum_db->fetch_row($result);
// Check for use of incorrect URLs
confirm_current_url(forum_link($forum_url['pm_post'], $id));
$forum_page['form_action'] = forum_link($forum_url['pm'], 'write');
}
else {
// Check for use of incorrect URLs
confirm_current_url(forum_link($forum_url['pm'], $section));
$forum_page['form_action'] = forum_link($forum_url['pm'], $section);
}
}
$forum_page['hidden_fields'] = array(
'form_sent' => '<input type="hidden" name="form_sent" value="1" />',
'csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />',
);
if ($section == 'edit') {
$forum_page['hidden_fields']['edit'] = '<input type="hidden" name="edit" value="' . $id . '" />';
if ($status != 'draft')
$forum_page['hidden_fields']['edit'] = '<input type="hidden" name="req_receiver" value="' . forum_htmlencode($receiver) . '" />';
}
// Setup help
$forum_page['text_options'] = array();
if ($forum_config['p_message_bbcode'])
$forum_page['text_options']['bbcode'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'bbcode') . '" title="' . sprintf($lang_common['Help page'], $lang_common['BBCode']) . '">' . $lang_common['BBCode'] . '</a></span>';
if ($forum_config['p_message_img_tag'])
$forum_page['text_options']['img'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'img') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Images']) . '">' . $lang_common['Images'] . '</a></span>';
if ($forum_config['o_smilies'])
$forum_page['text_options']['smilies'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'smilies') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Smilies']) . '">' . $lang_common['Smilies'] . '</a></span>';
// Setup breadcrumbs
$forum_page['crumbs'] = array(
array($forum_config['o_board_title'], forum_link($forum_url['index'])),
array(sprintf($lang_profile['Users profile'], $forum_user['username']), forum_link($forum_url['profile'], array($forum_user['id'], 'about'))),
array($lang_profile['Private messages'], forum_link($forum_url['pm'], $section))
);
($hook = get_hook('pm_fl_section_write_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE', 'pm-write');
require FORUM_ROOT . 'header.php';
// START SUBST - <forum_main>
ob_start();
?>
<div class="admin-submenu gen-content">
<ul>
<?php echo implode("\n\t\t\t\t", $forum_links['pm']) . "\n" ?>
</ul>
</div>
<?php
// If preview selected and there are no errors
if (isset($_POST['preview']) && empty($errors)) {
if (!defined('FORUM_PARSER_LOADED'))
require FORUM_ROOT . 'include/parser.php';
$forum_page['preview_message'] = parse_message(forum_trim($message), false);
// Generate the post heading
$forum_page['post_ident'] = array();
$forum_page['post_ident']['byline'] = '<span class="post-byline"><strong>' . forum_htmlencode($forum_user['username']) . '</strong>' . '</span>';
$forum_page['post_ident']['link'] = '<span class="post-link">' . format_time(time()) . '</span>';
($hook = get_hook('pm_preview_pre_display')) ? eval($hook) : null;
?>
<div class="main-subhead">
<h2 class="hn"><span><?php echo $lang_pm['Preview message'] ?></span></h2>
</div>
<div id="post-preview" class="main-content main-frm">
<div class="post singlepost">
<div class="posthead">
<h3 class="hn"><?php echo implode(' ', $forum_page['post_ident']) ?></h3>
<?php ($hook = get_hook('pm_preview_new_post_head_option')) ? eval($hook) : null; ?>
</div>
<div class="postbody">
<div class="post-entry">
<div class="entry-content">
<?php echo $forum_page['preview_message'] . "\n" ?>
</div>
<?php ($hook = get_hook('pm_preview_new_post_entry_data')) ? eval($hook) : null; ?>
</div>
</div>
</div>
</div>
<?php
}
?>
<div class="main-subhead">
<h2 class="hn"><span><?php echo $lang_pm['New message'] ?></span></h2>
</div>
<div class="main-content main-frm">
<?php
if (!empty($forum_page['text_options']))
echo "\t\t" . '<p class="ct-options options">' . sprintf($lang_common['You may use'], implode(' ', $forum_page['text_options'])) . '</p>' . "\n";
if (!empty($errors)) {
$forum_page['errors'] = array();
foreach ($errors as $cur_error)
$forum_page['errors'][] = '<li class="warn"><span>' . $cur_error . '</span></li>';
?>
<div class="ct-box error-box">
<h2 class="warn"><?php echo $lang_pm['Messsage errors'] ?></h2>
<ul class="error-list">
<?php echo implode("\n\t\t\t\t", $forum_page['errors']) . "\n" ?>
</ul>
</div>
<?php
}
?>
<form class="frm-form" name="post" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>">
<div class="hidden">
<?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields']) . "\n" ?>
</div>
<fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
<legend class="group-legend"><strong><?php echo $lang_pm['Send message'] ?></strong></legend>
<?php
if ($section != 'edit' || $status == 'draft') {
($hook = get_hook('pm_fl_pre_receiver')) ? eval($hook) : null;
?>
<div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="sf-box text required longtext">
<label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pm['To'] ?> <em><?php echo $lang_common['Required'] ?></em></span> <small><?php echo $lang_pm['Receivers username'] ?></small></label><br />
<span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="req_receiver" value="<?php if (isset($_POST['req_receiver']) || isset($receiver)) echo forum_htmlencode($receiver); ?>" size="80" maxlength="255" /></span>
</div>
</div>
<?php
}
($hook = get_hook('pm_fl_pre_subject')) ? eval($hook) : null;
?>
<div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="sf-box text required longtext">
<label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pm['Subject'] ?></span></label><br />
<span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="subject" value="<?php if (isset($_POST['subject']) || isset($subject)) echo forum_htmlencode($subject); ?>" size="80" maxlength="255" /></span>
</div>
</div>
<?php ($hook = get_hook('pm_fl_pre_pm_req_message')) ? eval($hook) : null; ?>
<div class="txt-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="txt-box textarea required">
<label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pm['Message'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label>
<?php require FORUM_ROOT . 'bb.php'; ?>
<div class="txt-input"><span class="fld-input"><textarea id="text" name="req_message" rows="10" cols="65"><?php if (isset($_POST['req_message']) || isset($message)) echo forum_htmlencode($message); ?></textarea></span></div>
</div>
</div>
</fieldset>
<div class="frm-buttons">
<span class="submit"><input type="submit" name="submit" value="<?php echo $lang_pm['Send button'] ?>" /></span>
<span class="submit"><input type="submit" name="preview" value="<?php echo $lang_pm['Preview'] ?>" /></span>
<span class="submit"><input type="submit" name="draft" value="<?php echo $lang_pm['Save draft'] ?>" /></span>
</div>
</form>
</div>
<?php
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<forum_main>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <forum_main>
require FORUM_ROOT . 'footer.php';
}
else if ($section == 'message') {
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($id < 1)
message($lang_common['Bad request']);
confirm_current_url(forum_link($forum_url['pm_view'], $id));
require FORUM_ROOT . 'lang/' . $forum_user['language'] . '/topic.php';
($hook = get_hook('pm_fl_pre_message_qr_get')) ? eval($hook) : null;
$query = array(
'SELECT' => 'm.id, m.sender_id, m.receiver_id, m.status, u0.username, u0.email, u0.title, u0.avatar, u0.registered, u0.location, u0.num_posts, u0.timezone, u0.admin_note, u0.url, u0.email_setting, g.g_id, g.g_user_title, o.user_id AS is_online, u1.username AS receiver, readed, edited, subject, message',
'FROM' => 'pm AS m',
'JOINS' => array(
array(
'LEFT JOIN' => 'users AS u0',
'ON' => 'u0.id=m.sender_id'
),
array(
'LEFT JOIN' => 'users AS u1',
'ON' => 'u1.id=m.receiver_id'
),
array(
'INNER JOIN' => 'groups AS g',
'ON' => 'g.g_id=u0.group_id'
),
array(
'LEFT JOIN' => 'online AS o',
'ON' => '(o.user_id=u0.id AND o.user_id!=1 AND o.idle=0)'
),
),
'WHERE' => 'm.id=' . $id . ' AND (m.receiver_id=' . $forum_user['id'] . ' OR m.sender_id=' . $forum_user['id'] . ')'
);
($hook = get_hook('pm_fl_get_message_qr_get')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
if (!$forum_db->num_rows($result))
message($lang_common['Bad request']);
$cur_message = $forum_db->fetch_assoc($result);
$type = ($cur_message['receiver_id'] == $forum_user['id'] ? 'inbox' : 'outbox');
if ($type == 'inbox') {
$forum_page['heading'] = $lang_pm['Incoming message'];
$forum_page['user_text'] = $lang_pm['Sender'];
$forum_page['user_content'] = $cur_message['username'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_message['sender_id']) . '">' . forum_htmlencode($cur_message['username']) . '</a>' : $lang_pm['Empty'];
// Update the status of an read message
if ($cur_message['status'] == 'delivered') {
$query = array(
'UPDATE' => 'pm',
'SET' => 'status=\'read\', readed=' . time(),
'WHERE' => 'id=' . $id,
);
($hook = get_hook('pm_fl_qr_update_status')) ? eval($hook) : null;
$result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
$query = array(
'UPDATE' => 'users',
'SET' => 'pm_new=pm_new-1',
'WHERE' => 'id=' . $cur_message['receiver_id'],
);
($hook = get_hook('pm_fl_qr_minus_pm_new')) ? eval($hook) : null;
$forum_db->query_build($query) or error(__FILE__, __LINE__);
}
} else {
$forum_page['heading'] = $lang_pm['Outgoing message'];
$forum_page['user_text'] = $lang_pm['Receiver'];
$forum_page['user_content'] = $cur_message['receiver'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_message['receiver_id']) . '">' . forum_htmlencode($cur_message['receiver']) . '</a>' : $lang_pm['Empty'];
}
if (!defined('FORUM_PARSER_LOADED'))
require FORUM_ROOT . 'include/parser.php';
$forum_page['post_ident']['byline'] = '<span class="post-byline">' . ($cur_message['username'] != '' ? '<a href="' . forum_link($forum_url['user'], $cur_message['sender_id']) . '">' . forum_htmlencode($cur_message['username']) . '</a>' : $lang_pm['Empty']) . '</span>';
$forum_page['post_ident']['link'] = '<span class="post-link">' . format_time($cur_message['edited']) . $lang_common['Title separator'] . flazy_format_time($cur_message['edited']) . '</span>';
$forum_page['author_ident']['usertitle'] = '<li class="usertitle"><span>' . get_title($cur_message) . '</span></li>';
if ($forum_config['o_avatars'] && $forum_user['show_avatars']) {
if (!defined('FORUM_FUNCTIONS_GENERATE_AVATAR'))
require FORUM_ROOT . 'include/functions/generate_avatar_markup.php';
$forum_page['avatar_markup'] = generate_avatar_markup($cur_message['sender_id'], $cur_message['avatar'], $cur_message['email']);
if (!empty($forum_page['avatar_markup']))
$forum_page['author_ident']['avatar'] = '<li class="useravatar">' . $forum_page['avatar_markup'] . '</li>';
}
if ($cur_message['is_online'] == $cur_message['sender_id'])
$forum_page['author_ident']['status'] = '<li class="userstatus"><span>' . $lang_topic['Online'] . '</span></li>';
else
$forum_page['author_ident']['status'] = '<li class="userstatus"><span>' . $lang_topic['Offline'] . '</span></li>';
if ($forum_config['o_show_user_info']) {
if ($cur_message['location'] != '') {
if ($forum_config['o_censoring'])
$cur_message['location'] = censor_words($cur_message['location']);
$forum_page['author_info']['from'] = '<li><span>' . $lang_topic['From'] . ' <strong> ' . forum_htmlencode($cur_message['location']) . '</strong></span></li>';
}
$forum_page['author_info']['registered'] = '<li><span>' . $lang_topic['Registered'] . ' <strong> ' . format_time($cur_message['registered'], 1) . '</strong></span></li>';
// Разница во времени
$time_dif = $forum_user['timezone'] - $cur_message['timezone'];
if ($time_dif != 0 && $forum_user['id'] > 1)
$forum_page['author_info']['timezone'] = '<li><span><strong>' . $lang_topic['Timezone'] . ' </strong>' . $time_dif . ' ' . $lang_topic['From yours'] . '</span></li>';
}
if ($forum_config['o_show_post_count'] || $forum_user['is_admmod'])
$forum_page['author_info']['posts'] = '<li><span>' . $lang_topic['Posts info'] . ' <strong><a href="' . forum_link($forum_url['search_user_posts'], $cur_message['sender_id']) . '">' . forum_number_format($cur_message['num_posts']) . '</a></strong></span></li>';
if ($forum_user['is_admmod']) {
if ($cur_message['admin_note'] != '')
$forum_page['author_info']['note'] = '<li><span>' . $lang_topic['Note'] . ' <strong> ' . forum_htmlencode($cur_message['admin_note']) . '</strong></span></li>';
}
$forum_page['message']['message'] = parse_message($cur_message['message'], false);
if ($cur_message['url'] != '')
$forum_page['post_contacts']['url'] = '<span class="user-url' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a class="external" href="' . forum_link('click.php') . '?' . forum_htmlencode(($forum_config['o_censoring']) ? censor_words($cur_message['url']) : $cur_message['url']) . '" onclick="window.open(this.href); return false" rel="nofollow">' . sprintf($lang_topic['Visit website'], '<span>' . sprintf($lang_topic['User possessive'], forum_htmlencode($cur_message['username'])) . '</span>') . '</a></span>';
if ((($cur_message['email_setting'] == '0' && !$forum_user['is_guest']) || $forum_user['is_admmod']) && $forum_user['g_send_email'])
$forum_page['post_contacts']['email'] = '<span class="user-email' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a href="mailto:' . forum_htmlencode($cur_message['email']) . '">' . $lang_profile['E-mail'] . '<span> ' . forum_htmlencode($cur_message['username']) . '</span></a></span>';
else if ($cur_message['email_setting'] == '1' && !$forum_user['is_guest'] && $forum_user['g_send_email'])
$forum_page['post_contacts']['email'] = '<span class="user-email' . (empty($forum_page['post_contacts']) ? ' first-item' : '') . '"><a href="' . forum_link($forum_url['email'], $cur_message['sender_id']) . '">' . $lang_topic['E-mail'] . '<span> ' . forum_htmlencode($cur_message['username']) . '</span></a></span>';
if (!empty($forum_page['post_contacts']))
$forum_page['post_options']['contacts'] = '<p class="post-contacts">' . implode(' ', $forum_page['post_contacts']) . '</p>';
if ($forum_config['o_report_enabled'])
$forum_page['post_actions']['report'] = '<span class="report-post' . (empty($forum_page['post_actions']) ? ' first-item' : '') . '"><a href="' . forum_link($forum_url['report'], array($cur_message['id'], 'pm')) . '">' . $lang_topic['Report'] . '</a></span>';
$forum_page['post_actions']['delete'] = '<span class="delete-topic' . (empty($forum_page['post_actions']) ? ' first-item' : '') . '"><a href="' . forum_link($forum_url['pm_delete'], $cur_message['id']) . '" onclick="return confirm(\'' . $lang_pm['Delete confirmation 1'] . '\');" >' . $lang_pm['Delete message'] . '</a></span>';
if ($type == 'outbox' && ($cur_message['status'] == 'draft' || $cur_message['status'] == 'sent'))
$forum_page['post_actions']['edit'] = '<span class="edit-topic' . (empty($forum_page['post_actions']) ? ' first-item' : '') . '"><a href="' . forum_link($forum_url['pm_edit'], $cur_message['id']) . '">' . $lang_pm['Edit message'] . '</a></span>';
if (!empty($forum_page['post_actions']))
$forum_page['post_options']['actions'] = '<p class="post-actions">' . implode(' ', $forum_page['post_actions']) . '</p>';
// Setup breadcrumbs
$forum_page['crumbs'] = array(
array($forum_config['o_board_title'], forum_link($forum_url['index'])),
array(sprintf($lang_profile['Users profile'], $forum_user['username']), forum_link($forum_url['profile'], array($forum_user['id'], 'about'))),
array($lang_profile['Private messages'], forum_link($forum_url['pm'], $section))
);
($hook = get_hook('pm_fl_section_mesage_pre_header_load')) ? eval($hook) : null;
define('FORUM_PAGE', 'pm-message');
require FORUM_ROOT . 'header.php';
// START SUBST - <forum_main>
ob_start();
$forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
?>
<div class="admin-submenu gen-content">
<ul>
<?php echo implode("\n\t\t\t\t", $forum_links['pm']) . "\n" ?>
</ul>
</div>
<div class="main-subhead">
<h3 class="hn"><span><?php echo $forum_page['heading'] ?></span></h3>
</div>
<div class="main-content main-frm">
<?php
if ($type == 'outbox' && $cur_message['status'] == 'sent') {
?>
<div class="ct-box user-box">
<h2 class="hn"><span><?php echo $lang_pm['Sent note'] ?></span></h2>
</div>
<?php
}
?>
<fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
<div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="ct-box data-box">
<h4 class="ct-legend hn"><span><?php echo $forum_page['user_text'] ?></span></h4>
<h4 class="hn"><?php echo $forum_page['user_content'] ?></h4>
</div>
</div>
<div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="ct-box data-box">
<?php
if ($type == 'inbox') {
($hook = get_hook('pm_fl_pre_legend_edited')) ? eval($hook) : null;
?>
<h4 class="ct-legend hn"><span><?php echo $lang_pm['Sent'] ?></span></h4>
<h4 class="hn"><?php echo $cur_message['edited'] ? format_time($cur_message['edited']) . "\n" : $lang_profile['Not sent'] ?></h4>
<?php
} else {
($hook = get_hook('pm_fl_pre_legend_status')) ? eval($hook) : null;
?>
<h4 class="ct-legend hn"><span><?php echo $lang_pm['Status'] ?></span></h4>
<h4 class="hn"><?php echo $lang_pm['Status ' . $cur_message['status']], $cur_message['status'] == 'read' ? ' ' . format_time($cur_message['readed']) : '' ?></h4>
<?php
}
?>
</div>
</div>
<?php ($hook = get_hook('pm_fl_pre_legend_subject')) ? eval($hook) : null; ?>
<div class="ct-set data-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="ct-box data-box">
<h4 class="ct-legend hn"><span><?php echo $lang_pm['Subject'] ?></span></h4>
<h4 class="hn"><?php echo $cur_message['subject'] ? forum_htmlencode($cur_message['subject']) . "\n" : $lang_pm['Empty'] ?></h4>
</div>
</div>
</fieldset>
<div class="post">
<div class="posthead">
<h3 class="hn post-ident"><?php echo implode(' ', $forum_page['post_ident']) ?></h3>
</div>
<div class="postbody online">
<div class="post-author">
<ul class="author-ident">
<?php echo implode("\n\t\t\t\t\t\t", $forum_page['author_ident']) . "\n" ?>
</ul>
<ul class="author-info">
<?php echo implode("\n\t\t\t\t\t\t", $forum_page['author_info']) . "\n" ?>
</ul>
</div>
<div class="post-entry">
<div class="entry-content">
<?php echo implode("\n\t\t\t\t\t\t", $forum_page['message']) . "\n" ?>
</div>
<?php ($hook = get_hook('pm_fl_row_message_entry_data')) ? eval($hook) : null; ?>
</div>
</div>
<div class="postfoot">
<div class="post-options">
<?php echo implode("\n\t\t\t\t\t", $forum_page['post_options']) . "\n" ?>
</div>
</div>
</div>
</div>
<?php
if (isset($cur_message['id']) && $type == 'inbox') {
$forum_page['group_count'] = $forum_page['item_count'] = $forum_page['fld_count'] = 0;
$forum_page['form_action'] = forum_link($forum_url['pm'], 'write');
$forum_page['hidden_fields'] = array(
'form_sent' => '<input type="hidden" name="form_sent" value="1" />',
'csrf_token' => '<input type="hidden" name="csrf_token" value="' . generate_form_token($forum_page['form_action']) . '" />',
'send_action' => '<input type="hidden" name="req_receiver" value="' . forum_htmlencode($cur_message['username']) . '" />'
);
// Setup help
$forum_page['text_options'] = array();
if ($forum_config['p_message_bbcode'])
$forum_page['text_options']['bbcode'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'bbcode') . '" title="' . sprintf($lang_common['Help page'], $lang_common['BBCode']) . '">' . $lang_common['BBCode'] . '</a></span>';
if ($forum_config['p_message_img_tag'])
$forum_page['text_options']['img'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'img') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Images']) . '">' . $lang_common['Images'] . '</a></span>';
if ($forum_config['o_smilies'])
$forum_page['text_options']['smilies'] = '<span' . (empty($forum_page['text_options']) ? ' class="first-item"' : '') . '><a class="exthelp" href="' . forum_link($forum_url['help'], 'smilies') . '" title="' . sprintf($lang_common['Help page'], $lang_common['Smilies']) . '">' . $lang_common['Smilies'] . '</a></span>';
($hook = get_hook('pm_fl_message_review_row_pre_display')) ? eval($hook) : null;
?>
<div class="main-subhead">
<h3 class="hn"><span><?php echo $lang_pm['Reply'] ?></span></h3>
</div>
<div class="main-content main-frm">
<?php
if (!empty($forum_page['text_options']))
echo "\t\t" . '<p class="ct-options options">' . sprintf($lang_common['You may use'], implode(' ', $forum_page['text_options'])) . '</p>' . "\n";
if (substr($cur_message['subject'], 0, 4) == 'Ответ: ')
$cur_message['subject'] = 'Oтвет[2]: ' . utf8_substr($cur_message['subject'], 4);
$subject_reply = preg_replace('#^Ответ\[(\d{1,10})\]: #u', '\'Ответ[\'.(\\1 + 1).\']: \'', $cur_message['subject']);
$cur_message['subject'] = $cur_message['subject'] == $subject_reply ? 'Ответ: ' . $cur_message['subject'] : $subject_reply;
?>
<form class="frm-form" name="post" method="post" accept-charset="utf-8" action="<?php echo $forum_page['form_action'] ?>">
<div class="hidden">
<?php echo implode("\n\t\t\t\t", $forum_page['hidden_fields']) . "\n" ?>
</div>
<fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
<legend class="group-legend"><strong><?php echo $lang_pm['Send message'] ?></strong></legend>
<?php ($hook = get_hook('pm_fl_message_pre_subject')) ? eval($hook) : null; ?>
<div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="sf-box text required longtext">
<label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pm['Subject'] ?></span></label><br />
<span class="fld-input"><input id="fld<?php echo $forum_page['fld_count'] ?>" type="text" name="subject" value="<?php echo forum_htmlencode($cur_message['subject']) ?>" size="80" maxlength="255" /></span>
</div>
</div>
<?php ($hook = get_hook('pm_fl_message_pre_req_message')) ? eval($hook) : null; ?>
<div class="txt-set set<?php echo ++$forum_page['item_count'] ?>">
<div class="txt-box textarea required">
<label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_pm['Message'] ?> <em><?php echo $lang_common['Required'] ?></em></span></label>
<?php require FORUM_ROOT . 'bb.php'; ?>
<div class="txt-input"><span class="fld-input"><textarea id="text" name="req_message" rows="10" cols="65"></textarea></span></div>
</div>
</div>
</fieldset>
<div class="frm-buttons">
<span class="submit"><input type="submit" name="submit" value="<?php echo $lang_pm['Send button'] ?>" /></span>
<span class="submit"><input type="submit" name="preview" value="<?php echo $lang_pm['Preview'] ?>" /></span>
<span class="submit"><input type="submit" name="draft" value="<?php echo $lang_pm['Save draft'] ?>" /></span>
</div>
</form>
</div>
<?php
}
$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<forum_main>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <forum_main>
require FORUM_ROOT . 'footer.php';
}
($hook = get_hook('pm_change_details_new_section')) ? eval($hook) : null;
message($lang_common['Bad request']);