diff --git a/bans.php b/bans.php index a638d4a..4ec8d3a 100644 --- a/bans.php +++ b/bans.php @@ -21,12 +21,17 @@ if (is_null($banlist)) { $cache->set('banlist', $banlist, 600); } +$total = ""; + +if(isset($banlist[0][0])) { + $total = " (" . $banlist[0][0] . " łącznie)"; +} ?>
-

Lista banów

+

Lista banów

@@ -47,7 +52,7 @@ if (is_null($banlist)) { - +
@@ -69,18 +74,24 @@ function getBanlist() { $bany = $tsAdmin->banList(); $output = ""; + $total = 0; foreach ($bany as $ban) { if(!isset($ban['lastnickname'])) continue; + $total++; + $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($reason)) + $reason = "(brak powodu)"; + if($duration == 0) $expires = "Ban permanentny"; else @@ -89,12 +100,12 @@ function getBanlist() { $output .= "$lastnickname$reason$invokername$created$expires"; } - return $output; + return array($total, $output); } catch(TeamSpeak3_Exception $e) { if($e->getCode() == 1281) { return false; } else { - return '

Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '

'; + return array(null, '

Wystąpił błąd ' . $e->getCode() . ': ' . $e->getMessage() . '

'); } }