v 1.3.4 - Improvements for banlist

This commit is contained in:
Wruczek 2016-11-18 21:18:36 +01:00
parent cc9b755087
commit 44eb73c379
3 changed files with 23 additions and 12 deletions

View File

@ -64,16 +64,24 @@ function getBanlist() {
try { try {
$tsAdmin = TeamSpeak3::factory(getTeamspeakURI() . "#no_query_clients"); $tsAdmin = TeamSpeak3::factory(getTeamspeakURI() . "#no_query_clients");
$bany = $tsAdmin->banList(); $bans = $tsAdmin->banList();
$output = ""; $output = "";
foreach ($bany as $ban) { foreach ($bans as $ban) {
$user = null;
if (!empty($ban['ip']))
$user = censorIP($ban['ip']->toString());
if (!empty($ban['lastnickname']))
$user = $ban['lastnickname']->toString();
if (empty($user))
$user = "<i>Unknown</i>";
if (!isset($ban['lastnickname']))
continue;
$lastnickname = $ban['lastnickname']->toString();
$reason = $ban['reason']; $reason = $ban['reason'];
$invokername = $ban['invokername']->toString(); $invokername = $ban['invokername']->toString();
$created = date('d-m-Y H:i:s', $ban['created']); $created = date('d-m-Y H:i:s', $ban['created']);
@ -87,7 +95,7 @@ function getBanlist() {
else else
$expires = date('d-m-Y H:i:s', $ban['created'] + $duration); $expires = date('d-m-Y H:i:s', $ban['created'] + $duration);
$output .= "<tr><td>$lastnickname</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>"; $output .= "<tr><td>$user</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>";
} }
return $output; return $output;
@ -101,6 +109,9 @@ function getBanlist() {
} }
function censorIP($ip) {
return preg_replace("/(\d+\.\d+\.)\d+\.\d+/", "$1*.*", $ip);
}
require_once __DIR__ . "/include/footer.php"; require_once __DIR__ . "/include/footer.php";
?> ?>

View File

@ -12,7 +12,7 @@
<ul class="list-inline"> <ul class="list-inline">
<li> <!-- Please respect the amount of work we've put for free into this project and leave the authors in the footer. Thank you. --> <li> <!-- Please respect the amount of work we've put for free into this project and leave the authors in the footer. Thank you. -->
<p> <p>
<a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.3.3 &mdash; &copy; <a href="http://wruczek.top">Wruczek</a> 2016 <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.3.4 &mdash; &copy; <a href="http://wruczek.top">Wruczek</a> 2016
</p> </p>
<p> <p>

View File

@ -90,7 +90,7 @@ function showError($title, $text) { ?>
<?php echo $text; ?> <?php echo $text; ?>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
&copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.3.3 | MIT License &copy; <a href="http://wruczek.top">Wruczek</a> 2016 | <a href="https://github.com/Wruczek/ts-website">ts-website</a> v 1.3.4 | MIT License
</div> </div>
</div> </div>