From 9f21e838c715fb87556b9c9760e392de6a22aee9 Mon Sep 17 00:00:00 2001 From: Wruczek Date: Thu, 19 Jan 2017 19:43:28 +0100 Subject: [PATCH] Improvements to banlist sorting Thanks to Vitaly for reporting the issue! --- bans.php | 8 +++++--- js/bans.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bans.php b/bans.php index 9b071c7..f7054e0 100644 --- a/bans.php +++ b/bans.php @@ -84,8 +84,10 @@ function getBanlist() { $reason = $ban['reason']; $invokername = $ban['invokername']->toString(); - $created = date('d-m-Y H:i:s', $ban['created']); $duration = $ban['duration']; + $createdepoch = $ban['created']; + $expiresepoch = $ban['created'] + $duration; + $created = date('d-m-Y H:i:s', $createdepoch); if (empty($reason)) $reason = "" . translate($lang["banlist"]["table"]["emptyreason"]) . ""; @@ -93,9 +95,9 @@ function getBanlist() { if ($duration == 0) $expires = translate($lang["banlist"]["table"]["permaban"]); else - $expires = date('d-m-Y H:i:s', $ban['created'] + $duration); + $expires = date('d-m-Y H:i:s', $expiresepoch); - $output .= "$user$reason$invokername$created$expires"; + $output .= "$user$reason$invokername$created$expires"; } return $output; diff --git a/js/bans.js b/js/bans.js index 82bc767..ac695ba 100644 --- a/js/bans.js +++ b/js/bans.js @@ -1,6 +1,6 @@ $(document).ready(function () { $('#banlist').dataTable({ - "order": [], + "order": [[3, "desc"]], "language": { "url": datatablesUrl }