-
Notifications
You must be signed in to change notification settings - Fork 1
/
sendmessage.php
185 lines (171 loc) · 7.71 KB
/
sendmessage.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
<?php
require "include/bittorrent.php";
loggedinorreturn();
// Standard Administrative PM Replies
$pm_std_reply[1] = "Read the bloody [url=http://torrentbits.org/faq.php]FAQ[/url] and stop bothering me!";
$pm_std_reply[2] = "Die! Die! Die!";
// Standard Administrative PMs
$pm_template['1'] = array("Ratio warning","Hi,\n
You may have noticed, if you have visited the forum, that TB is disabling the accounts of all users with low share ratios.\n
I am sorry to say that your ratio is a little too low to be acceptable.\n
If you would like your account to remain open, you must ensure that your ratio increases dramatically in the next day or two, to get as close to 1.0 as possible.\n
I am sure that you will appreciate the importance of sharing your downloads.
You may PM any Moderator, if you believe that you are being treated unfairly.\n
Thank you for your cooperation.");
$pm_template['2'] = array("Avatar warning", "Hi,\n
You may not be aware that there are new guidelines on avatar sizes in the [url=http://torrentbits.org/rules.php]rules[/url], in particular \"Resize
your images to a width of 150 px and a size of [b]no more than 150 KB[/b].\"\n
I'm sorry to say your avatar doesn't conform to them. Please change it as soon as possible.\n
We understand this may be an inconvenience to some users but feel it is in the community's best interest.\n
Thanks for the cooperation.");
// Standard Administrative MMs
$mm_template['1'] = $pm_template['1'];
$mm_template['2'] = array("Downtime warning","We'll be down for a few hours");
$mm_template['3'] = array("Change warning","The tracker has been updated. Read
the forums for details.");
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{ //////// MM //
if (get_user_class() < UC_MODERATOR)
stderr("Error", "Permission denied");
$n_pms = $_POST['n_pms'];
$pmees = $_POST['pmees'];
$auto = $_POST['auto'];
if ($auto)
$body=$mm_template[$auto][1];
stdhead("Send message", false);
?>
<table class=main width=750 border=0 cellspacing=0 cellpadding=0>
<tr><td class=embedded><div align=center>
<h1>Mass Message to <?=$n_pms?> user<?=($n_pms>1?"s":"")?>!</h1>
<form method=post action=takemessage.php>
<? if ($_SERVER["HTTP_REFERER"]) { ?>
<input type=hidden name=returnto value=<?=$_SERVER["HTTP_REFERER"]?>>
<? } ?>
<table border=1 cellspacing=0 cellpadding=5>
<TR>
<TD colspan="2"><B>Subject: </B>
<INPUT name="subject" type="text" size="76"></TD>
</TR>
<tr><td colspan="2"><div align="center">
<textarea name=msg cols=80 rows=15><?=htmlspecialchars($body)?></textarea>
</div></td></tr>
<tr><td colspan="2"><div align="center"><b>Comment: </b>
<input name="comment" type="text" size="70">
</div></td></tr>
<tr><td><div align="center"><b>From: </b>
<?=$CURUSER['username']?>
<input name="sender" type="radio" value="self" checked>
System
<input name="sender" type="radio" value="system">
</div></td>
<td><div align="center"><b>Take snapshot:</b> <input name="snap" type="checkbox" value="1">
</div></td></tr>
<tr><td colspan="2" align=center><input type=submit value="Send it!" class=btn>
</td></tr></table>
<input type=hidden name=pmees value="<?=$pmees?>">
<input type=hidden name=n_pms value=<?=$n_pms?>>
</form><br><br>
<form method=post action=<?=$_SERVER['PHP_SELF']?>>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td>
<b>Templates:</b>
<select name="auto">
<?
for ($i = 1; $i <= count($mm_template); $i++) {
echo "<option value=$i ".($auto == $i?"selected":"").
">".$mm_template[$i][0]."</option>\n";}
?>
</select>
<input type=submit value="Use" class=btn>
</td></tr></table>
<input type=hidden name=pmees value="<?=$pmees?>">
<input type=hidden name=n_pms value=<?=$n_pms?>>
</form></div></td></tr></table>
<?
} else { //////// PM //
$receiver = $_GET["receiver"];
if (!is_valid_id($receiver))
die;
$replyto = $_GET["replyto"];
if ($replyto && !is_valid_id($replyto))
die;
$auto = $_GET["auto"];
$std = $_GET["std"];
if (($auto || $std ) && get_user_class() < UC_MODERATOR)
die("Permission denied.");
$res = mysql_query("SELECT * FROM users WHERE id=$receiver") or die(mysql_error());
$user = mysql_fetch_assoc($res);
if (!$user)
die("No user with that ID.");
if ($auto)
$body = $pm_std_reply[$auto];
if ($std)
$body = $pm_template[$std][1];
if ($replyto)
{
$res = mysql_query("SELECT * FROM messages WHERE id=$replyto") or sqlerr();
$msga = mysql_fetch_assoc($res);
if ($msga["receiver"] != $CURUSER["id"])
die;
$res = mysql_query("SELECT username FROM users WHERE id=" . $msga["sender"]) or sqlerr();
$usra = mysql_fetch_assoc($res);
$body .= "\n\n\n-------- $usra[username] wrote: --------\n$msga[msg]\n";
}
stdhead("Send message", false);
?>
<table class=main width=750 border=0 cellspacing=0 cellpadding=0><tr><td class=embedded>
<div align=center>
<h1>Message to <a href=userdetails.php?id=<?=$receiver?>><?=$user["username"]?></a></h1>
<form method=post action=takemessage.php>
<TR>
<TD colspan="2" align=center><B>Subject: </B>
<INPUT name="subject" type="text" size="72" value="<?=$subject?>"></TD>
</TR>
<? if ($_GET["returnto"] || $_SERVER["HTTP_REFERER"]) { ?>
<input type=hidden name=returnto value=<?=$_GET["returnto"] ? $_GET["returnto"] : $_SERVER["HTTP_REFERER"]?>>
<? } ?>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td<?=$replyto?" colspan=2":""?>><textarea name=msg cols=80 rows=15><?=htmlspecialchars($body)?></textarea></td></tr>
<tr>
<? if ($replyto) { ?>
<td align=center><input type=checkbox name='delete' value='yes' <?=$CURUSER['deletepms'] == 'yes'?"checked":""?>>Delete message you are replying to
<input type=hidden name=origmsg value=<?=$replyto?>></td>
<? } ?>
<td align=center><input type=checkbox name='save' value='yes' <?=$CURUSER['savepms'] == 'yes'?"checked":""?>>Save message to Sentbox</td></tr>
<tr><td<?=$replyto?" colspan=2":""?> align=center><input type=submit value="Send it!" class=btn></td></tr>
</table>
<input type=hidden name=receiver value=<?=$receiver?>>
</form>
<!--
<?
if (get_user_class() >= UC_MODERATOR)
{
?>
<br><br>
<form method=get action=<?=$_SERVER['PHP_SELF']?>>
<table border=1 cellspacing=0 cellpadding=5>
<tr><td>
<b>PM Templates:</b>
<select name="std"><?
for ($i = 1; $i <= count($pm_template); $i++)
{
echo "<option value=$i ".($std == $i?"selected":"").
">".$pm_template[$i][0]."</option>\n";
}?>
</select>
<? if ($_SERVER["HTTP_REFERER"]) { ?>
<input type=hidden name=returnto value=<?=$_GET["returnto"]?$_GET["returnto"]:$_SERVER["HTTP_REFERER"]?>>
<? } ?>
<input type=hidden name=receiver value=<?=$receiver?>>
<input type=hidden name=replyto value=<?=$replyto?>>
<input type=submit value="Use" class=btn>
</td></tr></table></form>
<?
}
?>
-->
<br/></div></td></tr>
<?
}
stdfoot();
?>