-
Notifications
You must be signed in to change notification settings - Fork 0
/
messagecompose.php
160 lines (141 loc) · 4.17 KB
/
messagecompose.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
<?php
require_once("system-db.php");
start_db();
if (isset($_POST['mailcommand'])) {
foreach($_POST['ticked'] as $chkval) {
sendInternalUserMessage($chkval, $_POST['subject'], $_POST['composemessage']);
}
header("location: messages.php");
}
require_once("system-header.php");
require_once("tinymce.php");
include("mailtabstrip.php");
?>
<SCRIPT>
function send() {
$("#mailcommand").val("X");
$("#frmpost").submit();
}
</SCRIPT>
<div class="viewmessage">
<form method="POST" id="frmpost" name="frmpost">
<input type="hidden" name="mailcommand" id="mailcommand" />
<table class="composetable" cellspacing=4>
<tr>
<td valign=top>
Send To
</td>
<td valign=top>
<div class="userselector">
<table>
<?php
$qry = "SELECT member_id, imageid, firstname, lastname " .
"FROM {$_SESSION['DB_PREFIX']}members " .
"ORDER BY firstname, lastname";
$result = mysql_query($qry);
if (! $result) logError("Error: " . mysql_error());
//Check whether the query was successful or not
if ($result) {
while (($member = mysql_fetch_assoc($result))) {
?>
<tr>
<td width='16px'>
<input type="checkbox" id="ticked" name="ticked[]" class="ticked" value="<?php echo $member['member_id']; ?>" />
</td>
<td width='30px'>
<?php
if ($member['imageid'] != null && $member['imageid'] != 0) {
?>
<img height=32 src="system-imageviewer.php?id=<?php echo $member['imageid']; ?>" />
<?php
}
?>
</td>
<td>
<?php echo $member['firstname'] . " " . $member['lastname']; ?>
</td>
</tr>
<?php
}
}
?>
</table>
</div>
</td>
</tr>
<tr>
<td valign=top>
Subject
</td>
<td valign=top>
<input type="text" name="subject" id="subject" cols=80 style='width:400px' />
</td>
</tr>
<tr>
<td valign=top>
Message
</td>
<td valign=top>
<textarea id="composemessage" name="composemessage" class="tinyMCE"></textarea>
</td>
</tr>
<tr>
<td valign=top>
</td>
<td valign=top>
<a class='link1 rgap5' href="javascript: send()"><em><b>Send</b></em></a>
<a class='link1' href='messages.php'><em><b>Cancel</b></em></a>
</td>
</tr>
</table>
<script>
$(document).ready(
function() {
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
$qry = "SELECT subject, message, from_member_id " .
"FROM {$_SESSION['DB_PREFIX']}messages " .
"WHERE id = $id";
$result = mysql_query($qry);
if (! $result) logError("Error: " . mysql_error());
//Check whether the query was successful or not
if ($result) {
while (($member = mysql_fetch_assoc($result))) {
?>
$("#composemessage").val("<br><hr /><?php echo mysql_escape_string($member['message']); ?>");
$("#composemessage").focus();
$("#subject").val("Re: <?php echo mysql_escape_string($member['subject']); ?>");
$(".ticked[value=<?php echo $member['from_member_id']; ?>]").attr("checked", true);
<?php
}
}
}
if (isset($_GET['forwardid'])) {
$id = $_GET['forwardid'];
$qry = "SELECT subject, message, from_member_id " .
"FROM {$_SESSION['DB_PREFIX']}messages " .
"WHERE id = $id";
$result = mysql_query($qry);
if (! $result) logError("Error: " . mysql_error());
//Check whether the query was successful or not
if ($result) {
while (($member = mysql_fetch_assoc($result))) {
?>
$("#composemessage").val("<?php echo mysql_escape_string($member['message']); ?>");
$("#composemessage").focus();
$("#subject").val("<?php echo mysql_escape_string($member['subject']); ?>");
<?php
}
}
}
?>
}
);
</script>
</form>
</div>
<?php
require_once("system-footer.php");
?>