2016-06-28 21:18:59 +00:00
|
|
|
<?php
|
|
|
|
$bansPage = true;
|
|
|
|
require_once __DIR__ . "/include/header.php";
|
|
|
|
require_once __DIR__ . "/include/tsutils.php";
|
2017-01-29 21:56:17 +00:00
|
|
|
require_once __DIR__ . "/include/cacheutils.class.php";
|
2016-06-28 21:18:59 +00:00
|
|
|
|
2017-01-29 21:56:17 +00:00
|
|
|
$cacheutils = new CacheUtils('banlist');
|
2016-06-28 21:18:59 +00:00
|
|
|
|
2017-01-29 21:56:17 +00:00
|
|
|
if($cacheutils->isExpired()) {
|
|
|
|
$cacheutils->setValue([getBanlist(), date('d-m-Y H:i:s')], 300);
|
2016-06-28 21:18:59 +00:00
|
|
|
}
|
2017-01-29 21:56:17 +00:00
|
|
|
|
|
|
|
$banlist = $cacheutils->getValue();
|
2016-06-28 21:18:59 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
2016-07-25 14:14:04 +00:00
|
|
|
<h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> <?php tl($lang["banlist"]["title"]); ?></h3>
|
2016-06-28 21:18:59 +00:00
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
|
2016-06-29 02:34:20 +00:00
|
|
|
<?php if(empty($banlist[0])) { ?>
|
2016-06-28 21:18:59 +00:00
|
|
|
<div class="alert alert-success">
|
2016-07-25 14:14:04 +00:00
|
|
|
<p class="text-center"><?php tl($lang["banlist"]["emptylist"]); ?></p>
|
2016-06-28 21:18:59 +00:00
|
|
|
</div>
|
|
|
|
<?php } else { ?>
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table id="banlist" class="table table-striped table-bordered" cellspacing="0" width="100%">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2016-07-25 14:14:04 +00:00
|
|
|
<th><?php tl($lang["banlist"]["table"]["nickname"]); ?></th>
|
|
|
|
<th><?php tl($lang["banlist"]["table"]["reason"]); ?></th>
|
|
|
|
<th><?php tl($lang["banlist"]["table"]["bannedby"]); ?></th>
|
|
|
|
<th><?php tl($lang["banlist"]["table"]["bandate"]); ?></th>
|
|
|
|
<th><?php tl($lang["banlist"]["table"]["expires"]); ?></th>
|
2016-06-28 21:18:59 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2016-06-29 02:34:20 +00:00
|
|
|
<?php echo $banlist[0]; ?>
|
2016-06-28 21:18:59 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="panel-footer">
|
2016-10-12 19:57:49 +00:00
|
|
|
<?php tl($lang["banlist"]["lastupdate"], [$banlist[1]]); ?><!-- <span style="float: right">Podgląd odświeża się co 60 sekund</span> -->
|
2016-06-28 21:18:59 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
function getBanlist() {
|
2016-07-25 14:14:04 +00:00
|
|
|
global $lang;
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
try {
|
2017-02-01 15:31:32 +00:00
|
|
|
$tsAdmin = getTeamspeakConnection("#no_query_clients");
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-11-18 20:18:36 +00:00
|
|
|
$bans = $tsAdmin->banList();
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
$output = "";
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-11-18 20:18:36 +00:00
|
|
|
foreach ($bans as $ban) {
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-11-18 20:18:36 +00:00
|
|
|
$user = null;
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-11-18 20:18:36 +00:00
|
|
|
if (!empty($ban['ip']))
|
|
|
|
$user = censorIP($ban['ip']->toString());
|
|
|
|
|
|
|
|
if (!empty($ban['lastnickname']))
|
|
|
|
$user = $ban['lastnickname']->toString();
|
|
|
|
|
|
|
|
if (empty($user))
|
|
|
|
$user = "<i>Unknown</i>";
|
|
|
|
|
|
|
|
|
|
|
|
$reason = $ban['reason'];
|
|
|
|
$invokername = $ban['invokername']->toString();
|
|
|
|
$duration = $ban['duration'];
|
2017-01-19 18:43:28 +00:00
|
|
|
$createdepoch = $ban['created'];
|
|
|
|
$expiresepoch = $ban['created'] + $duration;
|
|
|
|
$created = date('d-m-Y H:i:s', $createdepoch);
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-10-31 02:18:46 +00:00
|
|
|
if (empty($reason))
|
2016-07-25 14:14:04 +00:00
|
|
|
$reason = "<b>" . translate($lang["banlist"]["table"]["emptyreason"]) . "</b>";
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-10-31 02:18:46 +00:00
|
|
|
if ($duration == 0)
|
2016-07-25 14:14:04 +00:00
|
|
|
$expires = translate($lang["banlist"]["table"]["permaban"]);
|
2016-06-28 21:18:59 +00:00
|
|
|
else
|
2017-01-19 18:43:28 +00:00
|
|
|
$expires = date('d-m-Y H:i:s', $expiresepoch);
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2017-01-19 18:43:28 +00:00
|
|
|
$output .= "<tr><td>$user</td><td>$reason</td><td>$invokername</td><td data-order=\"$createdepoch\">$created</td><td data-order=\"$expiresepoch\">$expires</td></tr>";
|
2016-06-28 21:18:59 +00:00
|
|
|
}
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-29 02:34:20 +00:00
|
|
|
return $output;
|
2016-10-31 02:18:46 +00:00
|
|
|
} catch (TeamSpeak3_Exception $e) {
|
|
|
|
if ($e->getCode() == 1281) {
|
2016-06-29 02:34:20 +00:00
|
|
|
return '';
|
2016-06-28 21:18:59 +00:00
|
|
|
} else {
|
2016-07-25 14:14:04 +00:00
|
|
|
return '<div class="alert alert-danger"><p class="text-center">' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '</p></div>';
|
2016-06-28 21:18:59 +00:00
|
|
|
}
|
|
|
|
}
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
}
|
|
|
|
|
2016-11-18 20:18:36 +00:00
|
|
|
function censorIP($ip) {
|
2016-11-18 20:23:56 +00:00
|
|
|
return preg_replace("/(\d+\.\d+\.)\d+\.\d+/", "$1***.***", $ip);
|
2016-11-18 20:18:36 +00:00
|
|
|
}
|
2016-06-28 21:18:59 +00:00
|
|
|
|
|
|
|
require_once __DIR__ . "/include/footer.php";
|
|
|
|
?>
|