From 0417260bf158c5d7b62888dae2e202b0de115a05 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 10 Aug 2022 00:04:25 +0200 Subject: Initial commit --- includes/system/compare.php | 189 +++++++++++++++++++++ includes/system/history.php | 380 ++++++++++++++++++++++++++++++++++++++++++ includes/system/species.php | 53 ++++++ includes/system/subsystem.php | 124 ++++++++++++++ includes/system/tree.php | 114 +++++++++++++ 5 files changed, 860 insertions(+) create mode 100644 includes/system/compare.php create mode 100644 includes/system/history.php create mode 100644 includes/system/species.php create mode 100644 includes/system/subsystem.php create mode 100644 includes/system/tree.php (limited to 'includes/system') 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 @@ + + +
+
+

Compare members of the

+
+ + Member + Member + Member + Member + Member + Mmbr. + + + Species + Species + Species + Species + Spec. + Spec. + + + Relations + Relations + Relations + Relations + Relt. + Relt. + + + Host + Host + Host + Host + Hst. + Hst. + + + Fictive + Fictive + Fictive + Fictive + Fic. + Fic. + + + Little + Little + Little + Little + Ltl. + Ltl. + + + Not talking + No talk + No talk + NT. + NT. + NT. + + + Protector + Protector + Protect. + Protect. + Prt. + Prt. + + + + " data-bs-toggle="tooltip" class="member-link comparison-item comparison-item-clickable" href="//"> + .png" style="width:24px;"> + ; height: 16px; width: 16px;display: inline-block;vertical-align: middle;border-radius:2px;"> + + + + " style="width:24px;vertical-align: middle;position:relative;top:-5px;" src="/assets/species/.png" alt=""> + + + + + + 0 ? count($metadata["marefriends"]) + count($metadata["sisters"]) : "" ?> + + +
Marefriend" data-bs-toggle="tooltip" data-bs-html="true" class="member-link" href="//">.png" style="width:24px;">

Sister" data-bs-toggle="tooltip" data-bs-html="true" class="member-link" href="//">.png" style="width:24px;">
+
+
+ + + Yes + + No + + + + + Yes + + No + + + + = 2): ?> + Yes + + Partial + + No + + + + + Yes + + No + + + + + Yes + + No + + + +
+
+ + \ 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 @@ + + +
+
+ (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); + + ?> +

Front history in the

+

Today

+ $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"]); + ?> + + +

Yesterday

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $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"]); + ?> + + +

+ $i["members"][0], + "date" => strtotime($i["timestamp"]) + ]; + }, $switches10); + + $fronters = array_unique($fronters, SORT_REGULAR); + + foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + ?> + + +
+ + \ 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 @@ + +
+
+ () +
+ +
+ 0): ?> + + /">.png" style="width:24px;"> ,  
'); $index++; endforeach; ?> + - +
+
+ + +
+
+

members by species

+ + + + + + + +
+ + \ 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 @@ += 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'; + +?> + +
+
+ +
+ +
+ + (edit) + + +
+ +
+ + \ 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 @@ + + +
+
+

System tree for the

+ + .png" style="width:24px;"> + + + + + + + +
+ + \ No newline at end of file -- cgit