2016-06-28 21:18:59 +00:00
|
|
|
<?php
|
|
|
|
$bansPage = true;
|
|
|
|
require_once __DIR__ . "/include/header.php";
|
|
|
|
require_once __DIR__ . "/include/tsutils.php";
|
|
|
|
require_once __DIR__ . "/lib/phpfastcache/autoload.php";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use phpFastCache\Util;
|
|
|
|
use phpFastCache\CacheManager;
|
|
|
|
|
|
|
|
Util\Languages::setEncoding("UTF-8");
|
|
|
|
$cache = CacheManager::Files();
|
|
|
|
|
|
|
|
$banlist = $cache->get('banlist');
|
|
|
|
|
|
|
|
// $cache->clean();
|
|
|
|
|
|
|
|
if (is_null($banlist)) {
|
|
|
|
$banlist = array(getBanlist(), date('d-m-Y H:i:s'));
|
2016-06-29 00:15:14 +00:00
|
|
|
$cache->set('banlist', $banlist, 600);
|
2016-06-28 21:18:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
2016-06-29 02:34:20 +00:00
|
|
|
<h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów</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">
|
|
|
|
<p class="text-center">BRAK ZBANOWANYCH UŻYTKOWNIKÓW</p>
|
|
|
|
</div>
|
|
|
|
<?php } else { ?>
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table id="banlist" class="table table-striped table-bordered" cellspacing="0" width="100%">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Nick</th>
|
|
|
|
<th>Powód</th>
|
|
|
|
<th>Zbanowany przez</th>
|
|
|
|
<th>Data zbanowania</th>
|
|
|
|
<th>Wygasa</th>
|
|
|
|
</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">
|
|
|
|
Stan na <?php echo $banlist[1]; ?><!-- <span style="float: right">Podgląd odświerza się co 60 sekund</span> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
function getBanlist() {
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
try {
|
|
|
|
$tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients");
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
$bany = $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-06-28 21:18:59 +00:00
|
|
|
foreach ($bany as $ban) {
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
if(!isset($ban['lastnickname']))
|
|
|
|
continue;
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
$lastnickname = $ban['lastnickname']->toString();
|
2016-06-29 00:15:14 +00:00
|
|
|
$reason = $ban['reason'];
|
2016-06-28 21:18:59 +00:00
|
|
|
$invokername = $ban['invokername']->toString();
|
|
|
|
$created = date('d-m-Y H:i:s', $ban['created']);
|
|
|
|
$duration = $ban['duration'];
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-29 02:08:39 +00:00
|
|
|
if(empty($reason))
|
|
|
|
$reason = "<b>(brak powodu)</b>";
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
if($duration == 0)
|
|
|
|
$expires = "Ban permanentny";
|
|
|
|
else
|
|
|
|
$expires = date('d-m-Y H:i:s', $ban['created'] + $duration);
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-28 21:18:59 +00:00
|
|
|
$output .= "<tr><td>$lastnickname</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>";
|
|
|
|
}
|
2016-07-01 20:34:55 +00:00
|
|
|
|
2016-06-29 02:34:20 +00:00
|
|
|
return $output;
|
2016-06-28 21:18:59 +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-06-29 02:34:20 +00:00
|
|
|
return '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
require_once __DIR__ . "/include/footer.php";
|
|
|
|
?>
|