diff options
author | Minteck <contact@minteck.org> | 2023-02-23 19:34:56 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-23 19:34:56 +0100 |
commit | 3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 (patch) | |
tree | 75be5fba4368472fb11c8015aee026b2b9a71888 /api/desktop-app.php | |
parent | 8cc1f13c17fa2fb5a4410542d39e650e02945634 (diff) | |
download | pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.gz pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.tar.bz2 pluralconnect-3d1cd02f27518f1a04374c7c8320cd5d82ede6e9.zip |
Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated)
Diffstat (limited to 'api/desktop-app.php')
-rw-r--r-- | api/desktop-app.php | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/api/desktop-app.php b/api/desktop-app.php deleted file mode 100644 index 2d0f0bf..0000000 --- a/api/desktop-app.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc"; - -if (!isset($_GET["id"])) die(); - -if (isset($_GET["config"])) { - $data = []; - - $keys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/permitted.json"), true); - $proceed = false; - - if (in_array($_GET["id"], array_keys($keys))) { - $proceed = true; - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $keys[$_GET["id"]]["system"] . "/fronters.json"), true)["members"]; - - if (count($fronters) > 0) { - $fronter = $fronters[0]; - $info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $fronter["id"] . ".json"), true); - $info = parseMetadata($info); - - if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) { - $proceed = false; - } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) { - if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01"; - - $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1); - - if ($age < 16) { - $proceed = false; - } - } - } - } - - if ($proceed) { - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json", "{}"); - $usage = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json"), true); - $usage[$_GET['id']] = date('c'); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json", json_encode($usage)); - - $data = $keys[$_GET["id"]]["config"] ?? []; - } -} else { - $data = [ - "success" => true, - "valid" => false, - "underage" => false, - "normal" => false - ]; - - $keys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/permitted.json"), true); - - if (in_array($_GET["id"], array_keys($keys))) { - $data["valid"] = true; - - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $keys[$_GET["id"]]["system"] . "/fronters.json"), true)["members"]; - - if (count($fronters) > 0) { - $fronter = $fronters[0]; - $info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $fronter["id"] . ".json"), true); - $info = parseMetadata($info); - - $data["normal"] = $info["sexually_active"]; - - if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) { - $data["underage"] = true; - } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) { - if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01"; - - $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1); - - if ($age < 16) { - $data["underage"] = true; - } - } - } - } -} - -die(json_encode($data));
\ No newline at end of file |