From 8b865c277e0934f06daa5f1302fb37a6c9aa206c Mon Sep 17 00:00:00 2001 From: Wruczek Date: Wed, 29 Jun 2016 04:08:39 +0200 Subject: [PATCH] Improved banlist --- bans.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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() . '

'); } }