summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-06 18:51:14 +0200
committerMinteck <contact@minteck.org>2022-06-06 18:51:14 +0200
commit6a0e17d3726241cb5f899c28db7815444b9b8e42 (patch)
tree35b1f42bc6b850035ef715f9f18709bc05f1b8a2
parente18b9890f9c40950b331e829072f63b38ef72d11 (diff)
downloadbits-server-6a0e17d3726241cb5f899c28db7815444b9b8e42.tar.gz
bits-server-6a0e17d3726241cb5f899c28db7815444b9b8e42.tar.bz2
bits-server-6a0e17d3726241cb5f899c28db7815444b9b8e42.zip
Goal stuff
-rw-r--r--Application/GetGoal/index.php8
-rw-r--r--Private/SessionManager.php1
2 files changed, 9 insertions, 0 deletions
diff --git a/Application/GetGoal/index.php b/Application/GetGoal/index.php
new file mode 100644
index 0000000..8ad95d0
--- /dev/null
+++ b/Application/GetGoal/index.php
@@ -0,0 +1,8 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/Private/SessionManager.php";
+header("Content-Type: application/json");
+
+$goal = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/Private/Data/Goal.json"), true);
+
+die(json_encode($goal)); \ No newline at end of file
diff --git a/Private/SessionManager.php b/Private/SessionManager.php
index bb6c721..05b443f 100644
--- a/Private/SessionManager.php
+++ b/Private/SessionManager.php
@@ -2,6 +2,7 @@
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/Data")) mkdir($_SERVER['DOCUMENT_ROOT'] . "/Data");
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/Data/Transactions.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/Data/Transactions.json", "[]");
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/Data/Goal.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/Data/Goal.json", '{"name": "No goal","amount": {"eur": 0,"gbp": 0}}');
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/Data/Users.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/Data/Users.json", "{}");
global $SessionManagerAllowDisallowed;