Improved banlist
This commit is contained in:
parent
a4d70af18a
commit
8b865c277e
19
bans.php
19
bans.php
|
@ -21,12 +21,17 @@ if (is_null($banlist)) {
|
||||||
$cache->set('banlist', $banlist, 600);
|
$cache->set('banlist', $banlist, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$total = "";
|
||||||
|
|
||||||
|
if(isset($banlist[0][0])) {
|
||||||
|
$total = " (" . $banlist[0][0] . " łącznie)";
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów</h3>
|
<h3 class="panel-title"><i class="fa fa-ban" aria-hidden="true"></i> Lista banów<?php echo $total; ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
||||||
|
@ -47,7 +52,7 @@ if (is_null($banlist)) {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php echo $banlist[0]; ?>
|
<?php echo $banlist[0][1]; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,18 +74,24 @@ function getBanlist() {
|
||||||
$bany = $tsAdmin->banList();
|
$bany = $tsAdmin->banList();
|
||||||
|
|
||||||
$output = "";
|
$output = "";
|
||||||
|
$total = 0;
|
||||||
|
|
||||||
foreach ($bany as $ban) {
|
foreach ($bany as $ban) {
|
||||||
|
|
||||||
if(!isset($ban['lastnickname']))
|
if(!isset($ban['lastnickname']))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
$total++;
|
||||||
|
|
||||||
$lastnickname = $ban['lastnickname']->toString();
|
$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']);
|
||||||
$duration = $ban['duration'];
|
$duration = $ban['duration'];
|
||||||
|
|
||||||
|
if(empty($reason))
|
||||||
|
$reason = "<b>(brak powodu)</b>";
|
||||||
|
|
||||||
if($duration == 0)
|
if($duration == 0)
|
||||||
$expires = "Ban permanentny";
|
$expires = "Ban permanentny";
|
||||||
else
|
else
|
||||||
|
@ -89,12 +100,12 @@ function getBanlist() {
|
||||||
$output .= "<tr><td>$lastnickname</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>";
|
$output .= "<tr><td>$lastnickname</td><td>$reason</td><td>$invokername</td><td>$created</td><td>$expires</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return array($total, $output);
|
||||||
} catch(TeamSpeak3_Exception $e) {
|
} catch(TeamSpeak3_Exception $e) {
|
||||||
if($e->getCode() == 1281) {
|
if($e->getCode() == 1281) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>';
|
return array(null, '<div class="alert alert-danger"><p class="text-center">Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '</p></div>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue