/
page.home.php
184 lines (157 loc) · 7.86 KB
/
page.home.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
<?php
/*************************************************************************
This file is part of SourceBans++
SourceBans++ (c) 2014-2019 by SourceBans++ Dev Team
The SourceBans++ Web panel is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org/licenses/by-nc-sa/3.0/>.
This program is based off work covered by the following copyright(s):
SourceBans 1.4.11
Copyright © 2007-2014 SourceBans Team - Part of GameConnect
Licensed under CC-BY-NC-SA 3.0
Page: <http://www.sourcebans.net/> - <http://www.gameconnect.net/>
*************************************************************************/
global $theme;
if (!defined("IN_SB")) {
echo "You should not be here. Only follow links!";
die();
}
define('IN_HOME', true);
$res = $GLOBALS['db']->Execute("SELECT count(name) FROM " . DB_PREFIX . "_banlog");
$totalstopped = (int) $res->fields[0];
$res = $GLOBALS['db']->Execute("SELECT bl.name, time, bl.sid, bl.bid, b.type, b.authid, b.ip
FROM " . DB_PREFIX . "_banlog AS bl
LEFT JOIN " . DB_PREFIX . "_bans AS b ON b.bid = bl.bid
ORDER BY time DESC LIMIT 10");
$GLOBALS['server_qry'] = "";
$stopped = array();
$blcount = 0;
while (!$res->EOF) {
$info = array();
$info['date'] = Config::time($res->fields[1]);
$info['name'] = stripslashes(filter_var($res->fields[0], FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
$info['short_name'] = trunc($info['name'], 40);
$info['auth'] = $res->fields['authid'];
$info['ip'] = $res->fields['ip'];
$info['server'] = "block_" . $res->fields['sid'] . "_$blcount";
if ($res->fields['type'] == 1) {
if ($userbank->is_admin())
$info['search_link'] = "index.php?p=banlist&advSearch=$info[ip]&advType=ip&Submit";
else
$info['search_link'] = "index.php?p=banlist&advSearch=$info[name]&advType=name";
} else {
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['auth'] . "&advType=steamid&Submit";
}
$info['link_url'] = "window.location = '" . $info['search_link'] . "';";
$info['name'] = htmlspecialchars(addslashes($info['name']), ENT_QUOTES, 'UTF-8');
$info['popup'] = "ShowBox('Blocked player: " . $info['name'] . "', '" . $info['name'] . " tried to enter<br />' + document.getElementById('" . $info['server'] . "').title + '<br />at " . $info['date'] . "<br /><div align=middle><a href=" . $info['search_link'] . ">Click here for ban details.</a></div>', 'red', '', true);";
$GLOBALS['server_qry'] .= "xajax_ServerHostProperty(" . $res->fields['sid'] . ", 'block_" . $res->fields['sid'] . "_$blcount', 'title', 100);";
array_push($stopped, $info);
$res->MoveNext();
++$blcount;
}
$res = $GLOBALS['db']->Execute("SELECT count(bid) FROM " . DB_PREFIX . "_bans");
$BanCount = (int) $res->fields[0];
$res = $GLOBALS['db']->Execute("SELECT bid, ba.ip, ba.authid, ba.name, created, ends, length, reason, ba.aid, ba.sid, ad.user, CONCAT(se.ip,':',se.port), se.sid, mo.icon, ba.RemoveType, ba.type
FROM " . DB_PREFIX . "_bans AS ba
LEFT JOIN " . DB_PREFIX . "_admins AS ad ON ba.aid = ad.aid
LEFT JOIN " . DB_PREFIX . "_servers AS se ON se.sid = ba.sid
LEFT JOIN " . DB_PREFIX . "_mods AS mo ON mo.mid = se.modid
ORDER BY created DESC LIMIT 10");
$bans = array();
while (!$res->EOF) {
$info = array();
if ($res->fields['length'] == 0) {
$info['perm'] = true;
$info['unbanned'] = false;
} else {
$info['temp'] = true;
$info['unbanned'] = false;
}
$info['name'] = stripslashes($res->fields[3]);
$info['created'] = Config::time($res->fields['created']);
$ltemp = explode(",", $res->fields[6] == 0 ? 'Permanent' : SecondsToString(intval($res->fields[6])));
$info['length'] = $ltemp[0];
$info['icon'] = empty($res->fields[13]) ? 'web.png' : $res->fields[13];
$info['authid'] = $res->fields[2];
$info['ip'] = $res->fields[1];
if ($res->fields[15] == 1) {
if ($userbank->is_admin())
$info['search_link'] = "index.php?p=banlist&advSearch=$info[ip]&advType=ip&Submit";
else
$info['search_link'] = "index.php?p=banlist&advSearch=$info[name]&advType=name";
} else {
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['authid'] . "&advType=steamid&Submit";
}
$info['link_url'] = "window.location = '" . $info['search_link'] . "';";
$info['short_name'] = trunc($info['name'], 25);
if ($res->fields[14] == 'D' || $res->fields[14] == 'U' || $res->fields[14] == 'E' || ($res->fields[6] && $res->fields[5] < time())) {
$info['unbanned'] = true;
if ($res->fields[14] == 'D') {
$info['ub_reason'] = 'D';
} elseif ($res->fields[14] == 'U') {
$info['ub_reason'] = 'U';
} else {
$info['ub_reason'] = 'E';
}
} else {
$info['unbanned'] = false;
}
array_push($bans, $info);
$res->MoveNext();
}
$res = $GLOBALS['db']->Execute("SELECT count(bid) FROM " . DB_PREFIX . "_comms");
$CommCount = (int) $res->fields[0];
$res = $GLOBALS['db']->Execute("SELECT bid, ba.authid, ba.type, ba.name, created, ends, length, reason, ba.aid, ba.sid, ad.user, CONCAT(se.ip,':',se.port), se.sid, mo.icon, ba.RemoveType, ba.type
FROM " . DB_PREFIX . "_comms AS ba
LEFT JOIN " . DB_PREFIX . "_admins AS ad ON ba.aid = ad.aid
LEFT JOIN " . DB_PREFIX . "_servers AS se ON se.sid = ba.sid
LEFT JOIN " . DB_PREFIX . "_mods AS mo ON mo.mid = se.modid
ORDER BY created DESC LIMIT 10");
$comms = array();
while (!$res->EOF) {
$info = array();
if ($res->fields['length'] == 0) {
$info['perm'] = true;
$info['unbanned'] = false;
} else {
$info['temp'] = true;
$info['unbanned'] = false;
}
$info['name'] = stripslashes($res->fields[3]);
$info['created'] = Config::time($res->fields['created']);
$ltemp = explode(",", $res->fields[6] == 0 ? 'Permanent' : SecondsToString(intval($res->fields[6])));
$info['length'] = $ltemp[0];
$info['icon'] = empty($res->fields[13]) ? 'web.png' : $res->fields[13];
$info['authid'] = $res->fields['authid'];
$info['search_link'] = "index.php?p=commslist&advSearch=" . $info['authid'] . "&advType=steamid&Submit";
$info['link_url'] = "window.location = '" . $info['search_link'] . "';";
$info['short_name'] = trunc($info['name'], 25);
$info['type'] = $res->fields['type'] == 2 ? "fas fa-comment-slash fa-lg" : "fas fa-microphone-slash fa-lg";
if ($res->fields[14] == 'D' || $res->fields[14] == 'U' || $res->fields[14] == 'E' || ($res->fields[6] && $res->fields[5] < time())) {
$info['unbanned'] = true;
if ($res->fields[14] == 'D') {
$info['ub_reason'] = 'D';
} elseif ($res->fields[14] == 'U') {
$info['ub_reason'] = 'U';
} else {
$info['ub_reason'] = 'E';
}
} else {
$info['unbanned'] = false;
}
array_push($comms, $info);
$res->MoveNext();
}
require(TEMPLATES_PATH . "/page.servers.php"); //Set theme vars from servers page
$theme->assign('dashboard_lognopopup', Config::getBool('dash.lognopopup'));
$theme->assign('dashboard_title', Config::get('dash.intro.title'));
$theme->assign('dashboard_text', Config::get('dash.intro.text'));
$theme->assign('players_blocked', $stopped);
$theme->assign('total_blocked', $totalstopped);
$theme->assign('players_banned', $bans);
$theme->assign('total_bans', $BanCount);
$theme->assign('total_comms', $CommCount);
$theme->assign('players_commed', $comms);
$theme->display('page_dashboard.tpl');