diff options
Diffstat (limited to 'Application/TransactionsList')
-rw-r--r-- | Application/TransactionsList/index.php | 8 |
1 files changed, 6 insertions, 2 deletions
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"], |