-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmessage_send.php
More file actions
executable file
·189 lines (169 loc) · 5.76 KB
/
message_send.php
File metadata and controls
executable file
·189 lines (169 loc) · 5.76 KB
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
<?php
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// File: message_send.php
include ("config/config.php");
include ("languages/$langdir/lang_mailto2.inc");
include ("globals/clean_words.inc");
get_post_ifset("senderid, to, content, msgid, quote, subject, name");
$title = $l_sendm_title;
if ((!isset($senderid)) || ($senderid == ''))
{
$senderid = 0;
}
if ((!isset($msgid)) || ($msgid == ''))
{
$msgid = 0;
}
if ((!isset($quote)) || ($quote == ''))
{
$quote = 0;
}
if (checklogin())
{
$template_object->enable_gzip = 0;
include ("footer.php");
die();
}
if($playerinfo['template'] == '' or !isset($playerinfo['template'])){
$templatename = $default_template;
}else{
$templatename = $playerinfo['template'];
}
include ("header.php");
if($base_template[basename($_SERVER['PHP_SELF'])] == 1){
include ("globals/base_template_data.inc");
}
else
{
$template_object->assign("title", $title);
$template_object->assign("templatename", $templatename);
}
if($msgid != 0){
$res = $db->SelectLimit("SELECT subject, sender_id, message FROM {$db_prefix}messages WHERE ID=".$msgid." and recp_id=$playerinfo[player_id]", 1);
$msg = $res->fields;
$subject = $msg['subject'];
$sender_id = nl2br($msg['sender_id']);
$message = nl2br($msg['message']);
$res = $db->SelectLimit("SELECT character_name FROM {$db_prefix}players WHERE player_id=$sender_id", 1);
$sendername = $res->fields['character_name'];
}
if (empty($content))
{
$res = $db->Execute("SELECT character_name,player_id FROM {$db_prefix}players WHERE player_id <> $playerinfo[player_id] ORDER BY " .
"character_name ASC");
$count = 0;
while (!$res->EOF)
{
$row = $res->fields;
if ($row['player_id'] == $name)
{
$sendname[$count] = $row['character_name'];
$sendid[$count] = $row['player_id'];
$selected[$count] = "selected";
}
else
{
$sendname[$count] = $row['character_name'];
$sendid[$count] = $row['player_id'];
$selected[$count] = "";
}
$count++;
$res->MoveNext();
}
$res2 = $db->Execute("SELECT team_name,id FROM {$db_prefix}teams ORDER BY team_name ASC");
while (!$res2->EOF)
{
$row2 = $res2->fields;
$sendname[$count] = "$l_sendm_ally $row2[team_name]";
$sendid[$count] = -$row2['id'];
$selected[$count] = "";
$count++;
$res2->MoveNext();
}
if (isset($subject))
{
if (AAT_substr_count($subject,"RE: ")==0){
$subject = "RE: " . $subject;
}
}
if ($quote == 1)
{
$message = "Quote from: $sendername\n". str_repeat("-=", 45) . "\n" . $message. "\n". str_repeat("-=", 45) . "\n\n";
}else{
$message = "";
}
$template_object->assign("count", $count);
$template_object->assign("sendname", $sendname);
$template_object->assign("sendid", $sendid);
$template_object->assign("selected", $selected);
$template_object->assign("l_mt_to", $l_sendm_to);
$template_object->assign("playername", $playerinfo['character_name']);
$template_object->assign("l_mt_from", $l_sendm_from);
$template_object->assign("l_mt_subject", $l_sendm_subj);
$template_object->assign("l_mt_message", $l_sendm_mess);
$template_object->assign("l_mt_send", $l_sendm_send);
$template_object->assign("subject", $subject);
$template_object->assign("l_reset", $l_reset);
$template_object->assign("message", $message);
$template_object->assign("gotomain", $l_global_mmenu);
$template_object->display($templatename."mailto.tpl");
include ("footer.php");
}
else
{
$finalmessage = $l_sendm_sent;
if ($to >= 0)
{
$timestamp = date("Y-m-d H:i:s");
$res = $db->Execute("SELECT * FROM {$db_prefix}message_block WHERE blocked_player_id='$playerinfo[player_id]' and player_id='$to'");
if($res->RecordCount() == 0){
$content = htmlspecialchars(clean_words($content));
$subject = htmlspecialchars(clean_words($subject));
$debug_query = $db->Execute("INSERT INTO {$db_prefix}messages (sender_id, recp_id, sent, subject, message) VALUES " .
"('".$playerinfo['player_id']."', '" . $to . "', '".$timestamp."', " .
$db->qstr($subject) .", " . $db->qstr($content) . ")");
db_op_result($debug_query,__LINE__,__FILE__);
}
else
{
$finalmessage = $target_info['character_name'] . $l_sendm_blocked;
}
}
else
{
$finalmessage = "";
$timestamp = date("Y-m-d H:i:s");
$to = abs($to);
$res2 = $db->Execute("SELECT * FROM {$db_prefix}players where team='$to'");
// New lines to prevent SQL injection. Bad stuff.
$content = htmlspecialchars(clean_words($content));
$subject = htmlspecialchars(clean_words($subject));
while (!$res2->EOF)
{
$row2 = $res2->fields;
$res9 = $db->Execute("SELECT * FROM {$db_prefix}message_block WHERE blocked_player_id='$playerinfo[player_id]' and player_id='$row2[player_id]'");
if($res9->RecordCount() == 0){
$finalmessage .= $row2['character_name'] . " " . $l_sendm_sent . "<br>";
$debug_query = $db->Execute("INSERT INTO {$db_prefix}messages (sender_id, recp_id, sent, subject, message) VALUES " .
"('".$playerinfo['player_id']."', '".$row2['player_id']."', '".$timestamp."', " .
$db->qstr($subject) . ", " . $db->qstr($content) . ")");
db_op_result($debug_query,__LINE__,__FILE__);
}
else
{
$finalmessage .= $row2['character_name'] . "$l_sendm_blocked<br>";
}
$res2->MoveNext();
}
}
$template_object->assign("error_msg", $finalmessage);
$template_object->assign("gotomain", $l_global_mmenu);
$template_object->display($templatename."mailtosent.tpl");
include ("footer.php");
}
close_database();
?>