summaryrefslogtreecommitdiff
path: root/includes/travelling.inc
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-03-12 19:16:53 +0100
committerRaindropsSys <contact@minteck.org>2023-03-12 19:16:53 +0100
commiteb89b15c0f044673c1206a418a21d0baba1a675e (patch)
tree39ac31a576d8b8392cbd9baf8d67621bf2cefa86 /includes/travelling.inc
parent5385f0ed8fbb4325203a222a75e6700ffb519349 (diff)
downloadpluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.tar.gz
pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.tar.bz2
pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.zip
Updated 104 files, added 3 files, deleted 4 files and renamed 36 files (automated)
Diffstat (limited to 'includes/travelling.inc')
-rw-r--r--includes/travelling.inc62
1 files changed, 0 insertions, 62 deletions
diff --git a/includes/travelling.inc b/includes/travelling.inc
deleted file mode 100644
index 0d1696a..0000000
--- a/includes/travelling.inc
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
-$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true);
-
-$json_cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true);
-$json_raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true);
-$json_other = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true);
-
-if (!isset($json_cloudburst)) $json_cloudburst = [];
-if (!isset($json_raindrops)) $json_raindrops = [];
-if (!isset($json_other)) $json_other = [];
-
-$members = [...array_map(function ($i) {
- $i["_system"] = "ynmuc";
- return $i;
-}, $json_cloudburst), ...array_map(function ($i) {
- $i["_system"] = "gdapd";
- return $i;
-}, $json_raindrops), ...array_map(function ($i) use ($app) {
- $i["_system"] = $app["other"]["id"];
- return $i;
-}, $json_other)];
-
-foreach ($members as $member) {
- if (!isset($travelling[$member["id"]])) {
- $travelling[$member["id"]] = [
- "travelling" => false,
- "history" => []
- ];
-
- @file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT)));
- }
-
- if (!isset($travelling[$member["id"]]["equestria"])) {
- $travelling[$member["id"]]["equestria"] = false;
- }
-}
-
-function withTravelers(array $members, string $system): array {
- global $travelling;
- global $app;
-
- if ($system === $app["other"]["id"]) {
- return $members;
- } else {
- return [
- ...array_map(function ($i) use ($system) {
- $i['system'] = $system;
- return $i;
- }, array_filter($members, function ($i) use ($travelling) {
- return !(isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']));
- })),
- ...array_filter(array_map(function ($i) use ($system) {
- $i['system'] = $system === "gdapd" ? "ynmuc" : "gdapd";
- return $i;
- }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($system === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true)), function ($i) use ($travelling) {
- return isset($travelling[$i['id']]) && $travelling[$i['id']]['travelling'] && (!isset($travelling[$i['id']]['equestria']) || !$travelling[$i['id']]['equestria']);
- })
- ];
- }
-} \ No newline at end of file