From d67f6a0547700aded74e2429c4f13d6a9dbf29ce Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 17 Jun 2022 15:23:02 +0200 Subject: Fix major bug --- Application/TransactionsList/index.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Application/TransactionsList') diff --git a/Application/TransactionsList/index.php b/Application/TransactionsList/index.php index 185e94b..4bb56e0 100644 --- a/Application/TransactionsList/index.php +++ b/Application/TransactionsList/index.php @@ -33,10 +33,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/Private/SessionManager.php"; header("Content-Type: application/json"); $users = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Users.json"), true); -$list = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Transactions.json"), true); +$list = array_reverse(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Transactions"), function ($i) { + return !str_starts_with($i, ".") && str_ends_with($i, ".json"); +})); $plist = []; -foreach ($list as $item) { +foreach ($list as $id) { + $item = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Transactions/" . $id), true); + $item["author"] = [ "id" => $item["author"], "name" => $users[$item["author"]] ?? $item["author"], -- cgit