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

View File

@ -12,7 +12,7 @@
<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. -->
<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>

View File

@ -90,7 +90,7 @@ function showError($title, $text) { ?>
<?php echo $text; ?>
</div>
<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>