|
1 |
| -<?php |
2 |
| -/************************************************************************* |
3 |
| -This file is part of SourceBans++ |
4 |
| -
|
5 |
| -Copyright � 2014-2016 SourceBans++ Dev Team <https://github.com/sbpp> |
6 |
| -
|
7 |
| -SourceBans++ is licensed under a |
8 |
| -Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. |
9 |
| -
|
10 |
| -You should have received a copy of the license along with this |
11 |
| -work. If not, see <http://creativecommons.org/licenses/by-nc-sa/3.0/>. |
12 |
| -
|
13 |
| -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
14 |
| -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
15 |
| -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
16 |
| -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
17 |
| -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
18 |
| -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
19 |
| -THE SOFTWARE. |
20 |
| -
|
21 |
| -This program is based off work covered by the following copyright(s): |
22 |
| -SourceBans 1.4.11 |
23 |
| -Copyright � 2007-2014 SourceBans Team - Part of GameConnect |
24 |
| -Licensed under CC BY-NC-SA 3.0 |
25 |
| -Page: <http://www.sourcebans.net/> - <http://www.gameconnect.net/> |
26 |
| -*************************************************************************/ |
27 |
| - |
28 |
| -global $userbank, $theme; |
29 |
| -if ($GLOBALS['config']['config.enableprotest'] != "1") { |
30 |
| - CreateRedBox("Error", "This page is disabled. You should not be here."); |
31 |
| - PageDie(); |
32 |
| -} |
33 |
| -if (!defined("IN_SB")) { |
34 |
| - echo "You should not be here. Only follow links!"; |
35 |
| - die(); |
36 |
| -} |
37 |
| -if (!isset($_POST['subprotest']) || $_POST['subprotest'] != 1) { |
38 |
| - $Type = 0; |
39 |
| - $SteamID = ""; |
40 |
| - $IP = ""; |
41 |
| - $PlayerName = ""; |
42 |
| - $UnbanReason = ""; |
43 |
| - $Email = ""; |
44 |
| -} else { |
45 |
| - $Type = (int) $_POST['Type']; |
46 |
| - $SteamID = htmlspecialchars($_POST['SteamID']); |
47 |
| - $IP = htmlspecialchars($_POST['IP']); |
48 |
| - $PlayerName = htmlspecialchars($_POST['PlayerName']); |
49 |
| - $UnbanReason = htmlspecialchars($_POST['BanReason']); |
50 |
| - $Email = htmlspecialchars($_POST['EmailAddr']); |
51 |
| - $validsubmit = true; |
52 |
| - $errors = ""; |
53 |
| - $BanId = -1; |
54 |
| - |
55 |
| - if (get_magic_quotes_gpc()) { |
56 |
| - $UnbanReason = stripslashes($UnbanReason); |
57 |
| - } |
58 |
| - |
59 |
| - if ($Type == 0 && !validate_steam($SteamID)) { |
60 |
| - $errors .= '* Please type a valid STEAM ID.<br>'; |
61 |
| - $validsubmit = false; |
62 |
| - } elseif ($Type == 0) { |
63 |
| - $pre = $GLOBALS['db']->Prepare("SELECT bid FROM " . DB_PREFIX . "_bans WHERE authid=? AND RemovedBy IS NULL AND type=0;"); |
64 |
| - $res = $GLOBALS['db']->Execute($pre, array( |
65 |
| - $SteamID |
66 |
| - )); |
67 |
| - if ($res->RecordCount() == 0) { |
68 |
| - $errors .= '* That Steam ID is not banned!<br>'; |
69 |
| - $validsubmit = false; |
70 |
| - } else { |
71 |
| - $BanId = (int) $res->fields[0]; |
72 |
| - $res = $GLOBALS['db']->Execute("SELECT pid FROM " . DB_PREFIX . "_protests WHERE bid=$BanId"); |
73 |
| - if ($res->RecordCount() > 0) { |
74 |
| - $errors .= '* A protest is already pending for this Steam ID.<br>'; |
75 |
| - $validsubmit = false; |
76 |
| - } |
77 |
| - } |
78 |
| - } |
79 |
| - if ($Type == 1 && !validate_ip($IP)) { |
80 |
| - $errors .= '* Please type a valid IP.<br>'; |
81 |
| - $validsubmit = false; |
82 |
| - } elseif ($Type == 1) { |
83 |
| - $pre = $GLOBALS['db']->Prepare("SELECT bid FROM " . DB_PREFIX . "_bans WHERE ip=? AND RemovedBy IS NULL AND type=1;"); |
84 |
| - $res = $GLOBALS['db']->Execute($pre, array( |
85 |
| - $IP |
86 |
| - )); |
87 |
| - if ($res->RecordCount() == 0) { |
88 |
| - $errors .= '* That IP is not banned!<br>'; |
89 |
| - $validsubmit = false; |
90 |
| - } else { |
91 |
| - $BanId = (int) $res->fields[0]; |
92 |
| - $res = $GLOBALS['db']->Execute("SELECT pid FROM " . DB_PREFIX . "_protests WHERE bid=$BanId"); |
93 |
| - if ($res->RecordCount() > 0) { |
94 |
| - $errors .= '* A protest is already pending for this IP.<br>'; |
95 |
| - $validsubmit = false; |
96 |
| - } |
97 |
| - } |
98 |
| - } |
99 |
| - if (strlen($PlayerName) == 0) { |
100 |
| - $errors .= '* You must include a player name<br>'; |
101 |
| - $validsubmit = false; |
102 |
| - } |
103 |
| - if (strlen($UnbanReason) == 0) { |
104 |
| - $errors .= '* You must include comments<br>'; |
105 |
| - $validsubmit = false; |
106 |
| - } |
107 |
| - if (!check_email($Email)) { |
108 |
| - $errors .= '* You must include a valid email address<br>'; |
109 |
| - $validsubmit = false; |
110 |
| - } |
111 |
| - |
112 |
| - if (!$validsubmit) { |
113 |
| - CreateRedBox("Error", $errors); |
114 |
| - } |
115 |
| - |
116 |
| - if ($validsubmit && $BanId != -1) { |
117 |
| - $UnbanReason = trim($UnbanReason); |
118 |
| - $pre = $GLOBALS['db']->Prepare("INSERT INTO " . DB_PREFIX . "_protests(bid,datesubmitted,reason,email,archiv,pip) VALUES (?,UNIX_TIMESTAMP(),?,?,0,?)"); |
119 |
| - $res = $GLOBALS['db']->Execute($pre, array( |
120 |
| - $BanId, |
121 |
| - $UnbanReason, |
122 |
| - $Email, |
123 |
| - $_SERVER['REMOTE_ADDR'] |
124 |
| - )); |
125 |
| - $protid = $GLOBALS['db']->Insert_ID(); |
126 |
| - $protadmin = $GLOBALS['db']->GetRow("SELECT ad.user FROM " . DB_PREFIX . "_protests p, " . DB_PREFIX . "_admins ad, " . DB_PREFIX . "_bans b WHERE p.pid = '" . $protid . "' AND b.bid = p.bid AND ad.aid = b.aid"); |
127 |
| - |
128 |
| - $Type = 0; |
129 |
| - $SteamID = ""; |
130 |
| - $IP = ""; |
131 |
| - $PlayerName = ""; |
132 |
| - $UnbanReason = ""; |
133 |
| - $Email = ""; |
134 |
| - |
135 |
| - // Send an email when protest was posted |
136 |
| - $headers = 'From: ' . $GLOBALS['sb-email'] . "\n" . 'X-Mailer: PHP/' . phpversion(); |
137 |
| - |
138 |
| - $emailinfo = $GLOBALS['db']->Execute("SELECT aid, user, email FROM `" . DB_PREFIX . "_admins` WHERE aid = (SELECT aid FROM `" . DB_PREFIX . "_bans` WHERE bid = '" . (int) $BanId . "');"); |
139 |
| - $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], ".php") + 4); |
140 |
| - if (isset($GLOBALS['config']['protest.emailonlyinvolved']) && $GLOBALS['config']['protest.emailonlyinvolved'] == 1 && !empty($emailinfo->fields['email'])) { |
141 |
| - $admins = array( |
142 |
| - array( |
143 |
| - 'aid' => $emailinfo->fields['aid'], |
144 |
| - 'user' => $emailinfo->fields['user'], |
145 |
| - 'email' => $emailinfo->fields['email'] |
146 |
| - ) |
147 |
| - ); |
148 |
| - } else { |
149 |
| - $admins = $userbank->GetAllAdmins(); |
150 |
| - } |
151 |
| - foreach ($admins as $admin) { |
152 |
| - $message = ""; |
153 |
| - $message .= "Hello " . $admin['user'] . ",\n\n"; |
154 |
| - $message .= "A new ban protest has been posted on your SourceBans page.\n\n"; |
155 |
| - $message .= "Player: " . $_POST['PlayerName'] . " (" . $_POST['SteamID'] . ")\nBanned by: " . $protadmin['user'] . "\nMessage: " . $_POST['BanReason'] . "\n\n"; |
156 |
| - $message .= "Click the link below to view the current ban protests.\n\nhttp://" . $_SERVER['HTTP_HOST'] . $requri . "?p=admin&c=bans#^1"; |
157 |
| - if ($userbank->HasAccess(ADMIN_OWNER | ADMIN_BAN_PROTESTS, $admin['aid']) && $userbank->HasAccess(ADMIN_NOTIFY_PROTEST, $admin['aid'])) { |
158 |
| - mail($admin['email'], "[SourceBans] Ban Protest Added", $message, $headers); |
159 |
| - } |
160 |
| - } |
161 |
| - |
162 |
| - CreateGreenBox("Successful", "Your protest has been sent."); |
163 |
| - } |
164 |
| -} |
165 |
| - |
166 |
| -$theme->assign('steam_id', $SteamID); |
167 |
| -$theme->assign('ip', $IP); |
168 |
| -$theme->assign('player_name', $PlayerName); |
169 |
| -$theme->assign('reason', $UnbanReason); |
170 |
| -$theme->assign('player_email', $Email); |
171 |
| - |
172 |
| -$theme->display('page_protestban.tpl'); |
173 |
| -?> |
174 |
| -<script type="text/javascript"> |
175 |
| -function changeType(szListValue) |
176 |
| -{ |
177 |
| - $('steam.row').style.display = (szListValue == "0" ? "" : "none"); |
178 |
| - $('ip.row').style.display = (szListValue == "1" ? "" : "none"); |
179 |
| -} |
180 |
| -$('Type').options[<?=$Type;?>].selected = true; |
181 |
| -changeType(<?=$Type?>); |
182 |
| -</script> |
| 1 | +<?php |
| 2 | +/************************************************************************* |
| 3 | +This file is part of SourceBans++ |
| 4 | +
|
| 5 | +Copyright � 2014-2016 SourceBans++ Dev Team <https://github.com/sbpp> |
| 6 | +
|
| 7 | +SourceBans++ is licensed under a |
| 8 | +Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. |
| 9 | +
|
| 10 | +You should have received a copy of the license along with this |
| 11 | +work. If not, see <http://creativecommons.org/licenses/by-nc-sa/3.0/>. |
| 12 | +
|
| 13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | +THE SOFTWARE. |
| 20 | +
|
| 21 | +This program is based off work covered by the following copyright(s): |
| 22 | +SourceBans 1.4.11 |
| 23 | +Copyright � 2007-2014 SourceBans Team - Part of GameConnect |
| 24 | +Licensed under CC BY-NC-SA 3.0 |
| 25 | +Page: <http://www.sourcebans.net/> - <http://www.gameconnect.net/> |
| 26 | +*************************************************************************/ |
| 27 | + |
| 28 | +global $userbank, $theme; |
| 29 | +if ($GLOBALS['config']['config.enableprotest'] != "1") { |
| 30 | + CreateRedBox("Error", "This page is disabled. You should not be here."); |
| 31 | + PageDie(); |
| 32 | +} |
| 33 | +if (!defined("IN_SB")) { |
| 34 | + echo "You should not be here. Only follow links!"; |
| 35 | + die(); |
| 36 | +} |
| 37 | +if (!isset($_POST['subprotest']) || $_POST['subprotest'] != 1) { |
| 38 | + $Type = 0; |
| 39 | + $SteamID = ""; |
| 40 | + $IP = ""; |
| 41 | + $PlayerName = ""; |
| 42 | + $UnbanReason = ""; |
| 43 | + $Email = ""; |
| 44 | +} else { |
| 45 | + $Type = (int) $_POST['Type']; |
| 46 | + $SteamID = htmlspecialchars($_POST['SteamID']); |
| 47 | + $IP = htmlspecialchars($_POST['IP']); |
| 48 | + $PlayerName = htmlspecialchars($_POST['PlayerName']); |
| 49 | + $UnbanReason = htmlspecialchars($_POST['BanReason']); |
| 50 | + $Email = htmlspecialchars($_POST['EmailAddr']); |
| 51 | + $validsubmit = true; |
| 52 | + $errors = ""; |
| 53 | + $BanId = -1; |
| 54 | + |
| 55 | + if (get_magic_quotes_gpc()) { |
| 56 | + $UnbanReason = stripslashes($UnbanReason); |
| 57 | + } |
| 58 | + |
| 59 | + if ($Type == 0 && !validate_steam($SteamID)) { |
| 60 | + $errors .= '* Please type a valid STEAM ID.<br>'; |
| 61 | + $validsubmit = false; |
| 62 | + } elseif ($Type == 0) { |
| 63 | + $pre = $GLOBALS['db']->Prepare("SELECT bid FROM " . DB_PREFIX . "_bans WHERE authid=? AND RemovedBy IS NULL AND type=0;"); |
| 64 | + $res = $GLOBALS['db']->Execute($pre, array( |
| 65 | + $SteamID |
| 66 | + )); |
| 67 | + if ($res->RecordCount() == 0) { |
| 68 | + $errors .= '* That Steam ID is not banned!<br>'; |
| 69 | + $validsubmit = false; |
| 70 | + } else { |
| 71 | + $BanId = (int) $res->fields[0]; |
| 72 | + $res = $GLOBALS['db']->Execute("SELECT pid FROM " . DB_PREFIX . "_protests WHERE bid=$BanId"); |
| 73 | + if ($res->RecordCount() > 0) { |
| 74 | + $errors .= '* A protest is already pending for this Steam ID.<br>'; |
| 75 | + $validsubmit = false; |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + if ($Type == 1 && !validate_ip($IP)) { |
| 80 | + $errors .= '* Please type a valid IP.<br>'; |
| 81 | + $validsubmit = false; |
| 82 | + } elseif ($Type == 1) { |
| 83 | + $pre = $GLOBALS['db']->Prepare("SELECT bid FROM " . DB_PREFIX . "_bans WHERE ip=? AND RemovedBy IS NULL AND type=1;"); |
| 84 | + $res = $GLOBALS['db']->Execute($pre, array( |
| 85 | + $IP |
| 86 | + )); |
| 87 | + if ($res->RecordCount() == 0) { |
| 88 | + $errors .= '* That IP is not banned!<br>'; |
| 89 | + $validsubmit = false; |
| 90 | + } else { |
| 91 | + $BanId = (int) $res->fields[0]; |
| 92 | + $res = $GLOBALS['db']->Execute("SELECT pid FROM " . DB_PREFIX . "_protests WHERE bid=$BanId"); |
| 93 | + if ($res->RecordCount() > 0) { |
| 94 | + $errors .= '* A protest is already pending for this IP.<br>'; |
| 95 | + $validsubmit = false; |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | + if (strlen($PlayerName) == 0) { |
| 100 | + $errors .= '* You must include a player name<br>'; |
| 101 | + $validsubmit = false; |
| 102 | + } |
| 103 | + if (strlen($UnbanReason) == 0) { |
| 104 | + $errors .= '* You must include comments<br>'; |
| 105 | + $validsubmit = false; |
| 106 | + } |
| 107 | + if (!check_email($Email)) { |
| 108 | + $errors .= '* You must include a valid email address<br>'; |
| 109 | + $validsubmit = false; |
| 110 | + } |
| 111 | + |
| 112 | + if (!$validsubmit) { |
| 113 | + CreateRedBox("Error", $errors); |
| 114 | + } |
| 115 | + |
| 116 | + if ($validsubmit && $BanId != -1) { |
| 117 | + $UnbanReason = trim($UnbanReason); |
| 118 | + $pre = $GLOBALS['db']->Prepare("INSERT INTO " . DB_PREFIX . "_protests(bid,datesubmitted,reason,email,archiv,pip) VALUES (?,UNIX_TIMESTAMP(),?,?,0,?)"); |
| 119 | + $res = $GLOBALS['db']->Execute($pre, array( |
| 120 | + $BanId, |
| 121 | + $UnbanReason, |
| 122 | + $Email, |
| 123 | + $_SERVER['REMOTE_ADDR'] |
| 124 | + )); |
| 125 | + $protid = $GLOBALS['db']->Insert_ID(); |
| 126 | + $protadmin = $GLOBALS['db']->GetRow("SELECT ad.user FROM " . DB_PREFIX . "_protests p, " . DB_PREFIX . "_admins ad, " . DB_PREFIX . "_bans b WHERE p.pid = '" . $protid . "' AND b.bid = p.bid AND ad.aid = b.aid"); |
| 127 | + |
| 128 | + $Type = 0; |
| 129 | + $SteamID = ""; |
| 130 | + $IP = ""; |
| 131 | + $PlayerName = ""; |
| 132 | + $UnbanReason = ""; |
| 133 | + $Email = ""; |
| 134 | + |
| 135 | + // Send an email when protest was posted |
| 136 | + $headers = 'From: ' . $GLOBALS['sb-email'] . "\n" . 'X-Mailer: PHP/' . phpversion(); |
| 137 | + |
| 138 | + $emailinfo = $GLOBALS['db']->Execute("SELECT aid, user, email FROM `" . DB_PREFIX . "_admins` WHERE aid = (SELECT aid FROM `" . DB_PREFIX . "_bans` WHERE bid = '" . (int) $BanId . "');"); |
| 139 | + $requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], ".php") + 4); |
| 140 | + if (isset($GLOBALS['config']['protest.emailonlyinvolved']) && $GLOBALS['config']['protest.emailonlyinvolved'] == 1 && !empty($emailinfo->fields['email'])) { |
| 141 | + $admins = array( |
| 142 | + array( |
| 143 | + 'aid' => $emailinfo->fields['aid'], |
| 144 | + 'user' => $emailinfo->fields['user'], |
| 145 | + 'email' => $emailinfo->fields['email'] |
| 146 | + ) |
| 147 | + ); |
| 148 | + } else { |
| 149 | + $admins = $userbank->GetAllAdmins(); |
| 150 | + } |
| 151 | + foreach ($admins as $admin) { |
| 152 | + $message = ""; |
| 153 | + $message .= "Hello " . $admin['user'] . ",\n\n"; |
| 154 | + $message .= "A new ban protest has been posted on your SourceBans page.\n\n"; |
| 155 | + $message .= "Player: " . $_POST['PlayerName'] . " (" . $_POST['SteamID'] . ")\nBanned by: " . $protadmin['user'] . "\nMessage: " . $_POST['BanReason'] . "\n\n"; |
| 156 | + $message .= "Click the link below to view the current ban protests.\n\nhttp://" . $_SERVER['HTTP_HOST'] . $requri . "?p=admin&c=bans#%5E1"; |
| 157 | + if ($userbank->HasAccess(ADMIN_OWNER | ADMIN_BAN_PROTESTS, $admin['aid']) && $userbank->HasAccess(ADMIN_NOTIFY_PROTEST, $admin['aid'])) { |
| 158 | + mail($admin['email'], "[SourceBans] Ban Protest Added", $message, $headers); |
| 159 | + } |
| 160 | + } |
| 161 | + |
| 162 | + CreateGreenBox("Successful", "Your protest has been sent."); |
| 163 | + } |
| 164 | +} |
| 165 | + |
| 166 | +$theme->assign('steam_id', $SteamID); |
| 167 | +$theme->assign('ip', $IP); |
| 168 | +$theme->assign('player_name', $PlayerName); |
| 169 | +$theme->assign('reason', $UnbanReason); |
| 170 | +$theme->assign('player_email', $Email); |
| 171 | + |
| 172 | +$theme->display('page_protestban.tpl'); |
| 173 | +?> |
| 174 | +<script type="text/javascript"> |
| 175 | +function changeType(szListValue) |
| 176 | +{ |
| 177 | + $('steam.row').style.display = (szListValue == "0" ? "" : "none"); |
| 178 | + $('ip.row').style.display = (szListValue == "1" ? "" : "none"); |
| 179 | +} |
| 180 | +$('Type').options[<?=$Type;?>].selected = true; |
| 181 | +changeType(<?=$Type?>); |
| 182 | +</script> |
0 commit comments