summaryrefslogtreecommitdiff
path: root/includes/system
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 00:04:25 +0200
committerMinteck <contact@minteck.org>2022-08-10 00:04:25 +0200
commit0417260bf158c5d7b62888dae2e202b0de115a05 (patch)
tree7f54ee56da118813f2d1b3a324d322d0c74fa51b /includes/system
downloadpluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.gz
pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.bz2
pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.zip
Initial commit
Diffstat (limited to 'includes/system')
-rw-r--r--includes/system/compare.php189
-rw-r--r--includes/system/history.php380
-rw-r--r--includes/system/species.php53
-rw-r--r--includes/system/subsystem.php124
-rw-r--r--includes/system/tree.php114
5 files changed, 860 insertions, 0 deletions
diff --git a/includes/system/compare.php b/includes/system/compare.php
new file mode 100644
index 0000000..96eb5d9
--- /dev/null
+++ b/includes/system/compare.php
@@ -0,0 +1,189 @@
+<?php global $system; global $systemCommonName; global $systemID; $title = "Compare members · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+
+$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
+
+function getMember(string $id) {
+ global $systemID;
+ global $members;
+
+ $member = null;
+
+ foreach ($members as $m) {
+ if ($m["id"] === $id) $member = $m;
+ }
+
+ return $member;
+}
+
+?>
+
+ <br>
+ <div class="container">
+ <h2>Compare members of the <?= $systemCommonName ?></h2>
+ <div class="comparison">
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Member</span>
+ <span class="comparison-header-l1">Member</span>
+ <span class="comparison-header-l2">Member</span>
+ <span class="comparison-header-l3">Member</span>
+ <span class="comparison-header-l4">Member</span>
+ <span class="comparison-header-l5">Mmbr.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Species</span>
+ <span class="comparison-header-l1">Species</span>
+ <span class="comparison-header-l2">Species</span>
+ <span class="comparison-header-l3">Species</span>
+ <span class="comparison-header-l4">Spec.</span>
+ <span class="comparison-header-l5">Spec.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Relations</span>
+ <span class="comparison-header-l1">Relations</span>
+ <span class="comparison-header-l2">Relations</span>
+ <span class="comparison-header-l3">Relations</span>
+ <span class="comparison-header-l4">Relt.</span>
+ <span class="comparison-header-l5">Relt.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Host</span>
+ <span class="comparison-header-l1">Host</span>
+ <span class="comparison-header-l2">Host</span>
+ <span class="comparison-header-l3">Host</span>
+ <span class="comparison-header-l4">Hst.</span>
+ <span class="comparison-header-l5">Hst.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Fictive</span>
+ <span class="comparison-header-l1">Fictive</span>
+ <span class="comparison-header-l2">Fictive</span>
+ <span class="comparison-header-l3">Fictive</span>
+ <span class="comparison-header-l4">Fic.</span>
+ <span class="comparison-header-l5">Fic.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Little</span>
+ <span class="comparison-header-l1">Little</span>
+ <span class="comparison-header-l2">Little</span>
+ <span class="comparison-header-l3">Little</span>
+ <span class="comparison-header-l4">Ltl.</span>
+ <span class="comparison-header-l5">Ltl.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Not talking</span>
+ <span class="comparison-header-l1">No talk</span>
+ <span class="comparison-header-l2">No talk</span>
+ <span class="comparison-header-l3">NT.</span>
+ <span class="comparison-header-l4">NT.</span>
+ <span class="comparison-header-l5">NT.</span>
+ </span>
+ <span class="comparison-header comparison-item">
+ <span class="comparison-header-l0">Protector</span>
+ <span class="comparison-header-l1">Protector</span>
+ <span class="comparison-header-l2">Protect.</span>
+ <span class="comparison-header-l3">Protect.</span>
+ <span class="comparison-header-l4">Prt.</span>
+ <span class="comparison-header-l5">Prt.</span>
+ </span>
+
+ <?php foreach (scoreOrder($members, $systemID) as $member):
+
+ $metadata = $member["_metadata"];
+
+ if ($member["name"] === "scootaloo") {
+ if ((int)date('j') % 2 === 0) {
+ $metadata["marefriends"] = array_reverse($metadata["marefriends"]);
+ }
+ }
+
+ ?>
+ <a title="<?= $member["display_name"] ?? $member["name"] ?>" data-bs-toggle="tooltip" class="member-link comparison-item comparison-item-clickable" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><span class="comparison-name-full"><?= $member["display_name"] ?? $member["name"] ?></span><span class="comparison-name-small"><?= getMiniName($member["display_name"] ?? $member["name"]) ?></span></span>
+ <span class="comparison-colors" style="background-color: #<?= $member["color"] ?? "ffffff" ?>; height: 16px; width: 16px;display: inline-block;vertical-align: middle;border-radius:2px;"></span>
+ </a>
+ <span class="comparison-item">
+ <?php foreach ($metadata["species"] ?? [] as $species): ?>
+ <img data-bs-toggle="tooltip" title="<?php switch ($species) {
+ case "earth":
+ echo "Earth pony";
+ break;
+
+ case "alicorn":
+ echo "Alicorn";
+ break;
+
+ case "pegasus":
+ echo "Pegasus";
+ break;
+
+ case "batpony":
+ echo "Bat pony";
+ break;
+
+ case "unicorn":
+ echo "Unicorn";
+ break;
+
+ default:
+ echo $species;
+ break;
+ } ?>" style="width:24px;vertical-align: middle;position:relative;top:-5px;" src="/assets/species/<?= $species ?>.png" alt="<?= $species ?>">
+ <?php endforeach; ?>
+ </span>
+ <span class="comparison-item">
+ <?= count($metadata["marefriends"]) + count($metadata["sisters"]) === 0 ? "-" : "" ?>
+ <span class="comparison-relations-count">
+ <?= count($metadata["marefriends"]) + count($metadata["sisters"]) > 0 ? count($metadata["marefriends"]) + count($metadata["sisters"]) : "" ?>
+ </span>
+ <span class="comparison-relations-full">
+ <?php $index = 0; foreach ($metadata["marefriends"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem-members.json"), true), function ($item) {
+ global $mfMemberID;
+ return $item["id"] === $mfMemberID;
+ }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Marefriend" data-bs-toggle="tooltip" data-bs-html="true" class="member-link" href="/<?= $mfSystem === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $mfMember["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "" ?>.png" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["sisters"] as $marefriend): $mfSystem = explode("/", $marefriend)[0]; $mfMemberID = explode("/", $marefriend)[1]; $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem-members.json"), true), function ($item) {
+ global $mfMemberID;
+ return $item["id"] === $mfMemberID;
+ }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Sister" data-bs-toggle="tooltip" data-bs-html="true" class="member-link" href="/<?= $mfSystem === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $mfMember["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "" ?>.png" style="width:24px;"></a><?php $index++; endforeach; ?>
+ </span>
+ </span>
+ <span class="comparison-item">
+ <?php if ($metadata["host"]): ?>
+ <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;">
+ <?php else: ?>
+ <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;">
+ <?php endif; ?>
+ </span>
+ <span class="comparison-item">
+ <?php if ($metadata["fictive"]): ?>
+ <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;">
+ <?php else: ?>
+ <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;">
+ <?php endif; ?>
+ </span>
+ <span class="comparison-item">
+ <?php if ($metadata["little"] >= 2): ?>
+ <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;">
+ <?php elseif ($metadata["little"] === 1): ?>
+ <img data-bs-toggle="tooltip" title="Age regressor" src="/assets/icons/partial.svg" alt="Partial" style="width:24px;">
+ <?php else: ?>
+ <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;">
+ <?php endif; ?>
+ </span>
+ <span class="comparison-item">
+ <?php if ($metadata["not_talking"]): ?>
+ <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;">
+ <?php else: ?>
+ <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;">
+ <?php endif; ?>
+ </span>
+ <span class="comparison-item">
+ <?php if ($metadata["protector"]): ?>
+ <img data-bs-toggle="tooltip" title="Yes" src="/assets/icons/complete.svg" alt="Yes" style="width:24px;">
+ <?php else: ?>
+ <img data-bs-toggle="tooltip" title="No" src="/assets/icons/none.svg" alt="No" style="width:24px;">
+ <?php endif; ?>
+ </span>
+ <?php endforeach; ?>
+ </div>
+ </div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> \ No newline at end of file
diff --git a/includes/system/history.php b/includes/system/history.php
new file mode 100644
index 0000000..ad4e30e
--- /dev/null
+++ b/includes/system/history.php
@@ -0,0 +1,380 @@
+<?php global $system; global $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+
+function getMember(string $id) {
+ global $systemID;
+
+ $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
+ $member = null;
+
+ foreach ($members as $m) {
+ if ($m["id"] === $id) $member = $m;
+ }
+
+ return $member;
+}
+
+?>
+
+ <br>
+ <div class="container" id="page-content">
+ <?php
+
+ $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-switches.json"), true);
+ uksort($switches, function ($a, $b) {
+ return strtotime($b["timestamp"]) - strtotime($a["timestamp"]);
+ });
+
+ function getSwitchesForDay(int $day) {
+ global $switches;
+
+ $filtered = array_values(array_filter($switches, function ($i) use ($day) {
+ $diff = strtotime(date("Y-m-d")) - strtotime(explode("T", $i["timestamp"])[0]);
+ return $diff <= (86400 * $day) && $diff > (86400 * ($day - 1));
+ }));
+
+ uksort($filtered, function ($a, $b) {
+ return strtotime($b["timestamp"]) - strtotime($a["timestamp"]);
+ });
+
+ return $filtered;
+ }
+
+ function getSwitchBefore(string $id) {
+ global $switches;
+
+ $currentPassed = false;
+ $before = null;
+
+ foreach ($switches as $switch) {
+ if ($currentPassed) {
+ $before = $switch;
+ break;
+ } else {
+ if ($switch["id"] === $id) {
+ $currentPassed = true;
+ }
+ }
+ }
+
+ return $before;
+ }
+
+ function isNotToday(int $timestamp, int $offset) {
+ if (date('Y-m-d', $timestamp) !== date('Y-m-d', time() - (86400 * $offset))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ $switches1 = getSwitchesForDay(0);
+ $switches2 = getSwitchesForDay(1);
+ $switches3 = getSwitchesForDay(2);
+ $switches4 = getSwitchesForDay(3);
+ $switches5 = getSwitchesForDay(4);
+ $switches6 = getSwitchesForDay(5);
+ $switches7 = getSwitchesForDay(6);
+ $switches8 = getSwitchesForDay(7);
+ $switches9 = getSwitchesForDay(8);
+ $switches10 = getSwitchesForDay(9);
+
+ ?>
+ <h2>Front history in the <?= $systemCommonName ?></h2>
+ <h4>Today</h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches1);
+
+ $fronters[] = [
+ "member" => $switches2[0] ? $switches2[0]["members"][0] : ($switches3[0] ? $switches3[0]["members"][0] : ($switches4[0] ? $switches4[0]["members"][0] : ($switches5[0] ? $switches5[0]["members"][0] : ($switches6[0] ? $switches6[0]["members"][0] : ($switches7[0] ? $switches7[0]["members"][0] : ($switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0]))))))),
+ "date" => strtotime($switches2[0] ? $switches2[0]["timestamp"] : ($switches3[0] ? $switches3[0]["timestamp"] : ($switches4[0] ? $switches4[0]["timestamp"] : ($switches5[0] ? $switches5[0]["timestamp"] : ($switches6[0] ? $switches6[0]["timestamp"] : ($switches7[0] ? $switches7[0]["timestamp"] : ($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))))))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 0) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;">Yesterday</h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches2);
+
+ $fronters[] = [
+ "member" => $switches3[0] ? $switches3[0]["members"][0] : ($switches4[0] ? $switches4[0]["members"][0] : ($switches5[0] ? $switches5[0]["members"][0] : ($switches6[0] ? $switches6[0]["members"][0] : ($switches7[0] ? $switches7[0]["members"][0] : ($switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0])))))),
+ "date" => strtotime($switches3[0] ? $switches3[0]["timestamp"] : ($switches4[0] ? $switches4[0]["timestamp"] : ($switches5[0] ? $switches5[0]["timestamp"] : ($switches6[0] ? $switches6[0]["timestamp"] : ($switches7[0] ? $switches7[0]["timestamp"] : ($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 1) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 2)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches3);
+
+ $fronters[] = [
+ "member" => $switches4[0] ? $switches4[0]["members"][0] : ($switches5[0] ? $switches5[0]["members"][0] : ($switches6[0] ? $switches6[0]["members"][0] : ($switches7[0] ? $switches7[0]["members"][0] : ($switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0]))))),
+ "date" => strtotime($switches4[0] ? $switches4[0]["timestamp"] : ($switches5[0] ? $switches5[0]["timestamp"] : ($switches6[0] ? $switches6[0]["timestamp"] : ($switches7[0] ? $switches7[0]["timestamp"] : ($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 2) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 3)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches4);
+
+ $fronters[] = [
+ "member" => $switches5[0] ? $switches5[0]["members"][0] : ($switches6[0] ? $switches6[0]["members"][0] : ($switches7[0] ? $switches7[0]["members"][0] : ($switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0])))),
+ "date" => strtotime($switches5[0] ? $switches5[0]["timestamp"] : ($switches6[0] ? $switches6[0]["timestamp"] : ($switches7[0] ? $switches7[0]["timestamp"] : ($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 3) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 4)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches5);
+
+ $fronters[] = [
+ "member" => $switches6[0] ? $switches6[0]["members"][0] : ($switches7[0] ? $switches7[0]["members"][0] : ($switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0]))),
+ "date" => strtotime($switches6[0] ? $switches6[0]["timestamp"] : ($switches7[0] ? $switches7[0]["timestamp"] : ($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 4) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 5)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches6);
+
+ $fronters[] = [
+ "member" => $switches7[0] ? $switches7[0]["members"][0] : ($switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0])),
+ "date" => strtotime($switches7[0] ? $switches7[0]["timestamp"] : ($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 5) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 6)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches7);
+
+ $fronters[] = [
+ "member" => $switches8[0] ? $switches8[0]["members"][0] : ($switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0]),
+ "date" => strtotime($switches8[0] ? $switches8[0]["timestamp"] : ($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 6) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 7)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches8);
+
+ $fronters[] = [
+ "member" => $switches9[0] ? $switches9[0]["members"][0] : $switches10[0]["members"][0],
+ "date" => strtotime($switches9[0] ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 7) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 8)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches9);
+
+ $fronters[] = [
+ "member" => $switches10[0] ? $switches10[0]["members"][0] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][0],
+ "date" => strtotime($switches10[0] ? $switches10[0]["timestamp"] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["timestamp"])
+ ];
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 8) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ <h4 style="margin-top:15px;"><?= date('D j M', time() - (86400 * 9)) ?></h4>
+ <?php
+
+ $fronters = array_map(function ($i) {
+ return [
+ "member" => $i["members"][0],
+ "date" => strtotime($i["timestamp"])
+ ];
+ }, $switches10);
+
+ $fronters = array_unique($fronters, SORT_REGULAR);
+
+ foreach ($fronters as $fronter): $member = getMember($fronter["member"]);
+ ?>
+ <div class="fronter">
+ <span class="fronter-date" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;">
+ <?= isNotToday($fronter["date"], 9) ? "00:00" : date('H:i', $fronter["date"]) ?>
+ </span>
+ <span class="fronter-profile" style="vertical-align: middle;">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
+ </a>
+ </span>
+ </div>
+ <?php endforeach; ?>
+ </div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> \ No newline at end of file
diff --git a/includes/system/species.php b/includes/system/species.php
new file mode 100644
index 0000000..a2251d0
--- /dev/null
+++ b/includes/system/species.php
@@ -0,0 +1,53 @@
+<?php global $system; global $systemCommonName; global $systemID; $title = "Members by species · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+
+$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
+$members = scoreOrder($members, $systemID);
+
+function species(array $members, string $id, string $name) { global $systemID; ?>
+ <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1fr 4fr;">
+ <div class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;">
+ <img src="/assets/species/<?= $id ?>.png" style="width:24px;"><span class="species-name"> <?= $name ?></span> (<?= count($members) ?>)
+ </div>
+
+ <div class="relation-item" style="margin-left:10px;padding:0 20px;">
+ <?php if (count($members) > 0): ?>
+ <?php $index = 0; foreach ($members as $member): ?>
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a><?php if ($index + 2 <= count($members)) echo('<span class="list-separator-desktop">, &nbsp;</span><span class="list-separator-mobile"><br></span>'); $index++; endforeach; ?>
+ <?php else: ?>-<?php endif; ?>
+ </div>
+ </div>
+<?php }
+
+?>
+
+ <br>
+ <div class="container" id="page-content">
+ <h2><?= $systemCommonName ?> members by species</h2>
+ <?php
+
+ $earth = [];
+ $pegasus = [];
+ $unicorn = [];
+ $alicorn = [];
+ $batpony = [];
+
+ foreach ($members as $member) {
+ foreach ($member["_metadata"]["species"] as $species) {
+ if ($species === "earth") $earth[] = $member;
+ if ($species === "pegasus") $pegasus[] = $member;
+ if ($species === "unicorn") $unicorn[] = $member;
+ if ($species === "alicorn") $alicorn[] = $member;
+ if ($species === "batpony") $batpony[] = $member;
+ }
+ }
+
+ ?>
+
+ <?php species($earth, "earth", "Earth ponies"); ?>
+ <?php species($pegasus, "pegasus", "Pegasi"); ?>
+ <?php species($unicorn, "unicorn", "Unicorns"); ?>
+ <?php species($alicorn, "alicorn", "Alicorns"); ?>
+ <?php species($batpony, "batpony", "Bat ponies"); ?>
+ </div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> \ No newline at end of file
diff --git a/includes/system/subsystem.php b/includes/system/subsystem.php
new file mode 100644
index 0000000..5d28cba
--- /dev/null
+++ b/includes/system/subsystem.php
@@ -0,0 +1,124 @@
+<?php global $system; global $systemCommonName; global $parts; global $systemID;
+
+$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
+
+$subsystemID = $parts[3];
+
+$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystems.json"), true) ?? [];
+
+function getMember(string $id) {
+ global $systemID;
+ global $members;
+
+ $member = null;
+
+ foreach ($members as $m) {
+ if ($m["id"] === $id) $member = $m;
+ }
+
+ return $member;
+}
+
+function memberHasSubsystem(array $member) {
+ global $subsystems;
+ $has = false;
+
+ foreach ($subsystems as $subsystem) {
+ if ($subsystem["source_type"] === "member" && $subsystem["source"] === $member["id"]) {
+ $has = true;
+ }
+ }
+
+ return $has;
+}
+
+function memberPartOfSubsystem(array $member) {
+ global $subsystems;
+ $is = false;
+
+ foreach ($subsystems as $subsystem) {
+ if (in_array($member["id"], $subsystem["members"])) {
+ $is = true;
+ }
+ }
+
+ return $is;
+}
+
+function getMemberSubsystem(array $member) {
+ global $subsystems;
+ $subsystem = null;
+
+ foreach ($subsystems as $ss) {
+ if ($ss["source_type"] === "member" && $ss["source"] === $member["id"]) {
+ $subsystem = $ss;
+ }
+ }
+
+ return $subsystem;
+}
+
+function getSubsystemByID(string $id) {
+ global $subsystems;
+ $subsystem = null;
+
+ foreach ($subsystems as $ss) {
+ if ($ss["source"] === $id) {
+ $subsystem = $ss;
+ }
+ }
+
+ return $subsystem;
+}
+
+function timeAgo($time): string {
+ if (!is_numeric($time)) {
+ $time = strtotime($time);
+ }
+
+ $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"];
+ $lengths = array("60", "60", "24", "7", "4.35", "12", "100");
+
+ $now = time();
+
+ $difference = $now - $time;
+ if ($difference <= 10 && $difference >= 0) {
+ return $tense = "now";
+ } elseif ($difference > 0) {
+ $tense = "ago";
+ } else {
+ $tense = "later";
+ }
+
+ for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
+ $difference /= $lengths[$j];
+ }
+
+ $difference = round($difference);
+
+ $period = $periods[$j] . ($difference >1 ? "s" :'');
+ return "{$difference} {$period} {$tense} ";
+}
+
+if (getSubsystemByID($subsystemID) === null) header("Location: /?error=Invalid subsystem ID") and die();
+$subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystemID.json"), true);
+
+$title = $subsystemData["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+
+?>
+
+ <br>
+ <div class="container">
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/subsysbanner.php"; ?>
+ <br>
+
+ <div id="page-content">
+ <?php global $isLoggedIn; if ($isLoggedIn): ?>
+ <small style="opacity:.5;display:block;">(<a href="/edit/<?= $system ?>/<?= $subsystemID ?>">edit</a>)</small>
+ <?php endif; ?>
+ <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystemID.html") ?>
+ </div>
+ <?php showSubsystem(getSubsystemByID($subsystemID), $systemID); ?>
+ </div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> \ No newline at end of file
diff --git a/includes/system/tree.php b/includes/system/tree.php
new file mode 100644
index 0000000..04cbf83
--- /dev/null
+++ b/includes/system/tree.php
@@ -0,0 +1,114 @@
+<?php global $system; global $systemCommonName; global $systemID; $title = "System tree · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+
+$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
+$members = scoreOrder($members, $systemID);
+
+$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystems.json"), true) ?? [];
+
+function getMember(string $id) {
+ global $systemID;
+ global $members;
+
+ $member = null;
+
+ foreach ($members as $m) {
+ if ($m["id"] === $id) $member = $m;
+ }
+
+ return $member;
+}
+
+function memberHasSubsystem(array $member) {
+ global $subsystems;
+ $has = false;
+
+ foreach ($subsystems as $subsystem) {
+ if ($subsystem["source_type"] === "member" && $subsystem["source"] === $member["id"]) {
+ $has = true;
+ }
+ }
+
+ return $has;
+}
+
+function memberPartOfSubsystem(array $member) {
+ global $subsystems;
+ $is = false;
+
+ foreach ($subsystems as $subsystem) {
+ if (in_array($member["id"], $subsystem["members"])) {
+ $is = true;
+ }
+ }
+
+ return $is;
+}
+
+function getMemberSubsystem(array $member) {
+ global $subsystems;
+ $subsystem = null;
+
+ foreach ($subsystems as $ss) {
+ if ($ss["source_type"] === "member" && $ss["source"] === $member["id"]) {
+ $subsystem = $ss;
+ }
+ }
+
+ return $subsystem;
+}
+
+?>
+
+ <br>
+ <div class="container" id="page-content">
+ <h2>System tree for the <?= $systemCommonName ?></h2>
+ <a class="tree-root member-link" href="/<?= $system ?>">
+ <img src="/assets/uploads/<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/" . $system . ".png") ? $system : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><?= $systemCommonName ?></span></a>
+ <?php $first = true; ?>
+ <?php foreach ($subsystems as $subsystem): if ($subsystem["source_type"] === "trait"): ?>
+ <div class="tree-l0">
+ <div class="tree-l0-separator<?= $first ? " tree-first-separator" : "" ?>">&nbsp;</div>
+ <div class="tree-inner">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/-/subsystem/<?= $subsystem["source"] ?>">
+ <img src="/assets/uploads/ss-<?= $subsystem["source"] ?>.png" style="width:24px;border-radius:5px;"> <span style="vertical-align: middle;"><?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystem[source].json") ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-subsystem-$subsystem[source].json"), true)["name"] : $subsystem["source"] ?></span>
+ </a>
+ </div>
+ <?php $ssfirst = true; foreach ($subsystem["members"] as $ssm): $ssmember = getMember($ssm); ?>
+ <div class="tree-l1">
+ <div class="tree-l0-separator">&nbsp;</div>
+ <div class="tree-l1-separator<?= $ssfirst ? " tree-first-separator" : "" ?>">&nbsp;</div>
+ <div class="tree-inner">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $ssmember["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $ssmember['name'] . ".png") ? "-" . $ssmember['name'] : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span>
+ </a>
+ </div>
+ </div>
+ <?php $ssfirst = false; endforeach; ?>
+ </div>
+ <?php $first = false; endif; endforeach; ?>
+ <?php foreach ($members as $member): if (!memberPartOfSubsystem($member)): ?>
+ <div class="tree-l0">
+ <div class="tree-l0-separator<?= $first ? " tree-first-separator" : "" ?>">&nbsp;</div>
+ <div class="tree-inner">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $member["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><?= $member["display_name"] ?? $member["name"] ?></span>
+ </a>
+ </div>
+ <?php if (memberHasSubsystem($member)): ?>
+ <?php $ssfirst = true; foreach (getMemberSubsystem($member)["members"] as $ssm): $ssmember = getMember($ssm); ?>
+ <div class="tree-l1">
+ <div class="tree-l0-separator">&nbsp;</div>
+ <div class="tree-l1-separator<?= $ssfirst ? " tree-first-separator" : "" ?>">&nbsp;</div>
+ <div class="tree-inner">
+ <a class="member-link" href="/<?= $systemID === "gdapd" ? "raindrops" : "cloudburst" ?>/<?= $ssmember["name"] ?>">
+ <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $ssmember['name'] . ".png") ? "-" . $ssmember['name'] : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span>
+ </a>
+ </div>
+ </div>
+ <?php $ssfirst = false;endforeach; ?>
+ <?php endif; ?>
+ </div>
+ <?php $first = false; endif; endforeach; ?>
+ </div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?> \ No newline at end of file