diff options
Diffstat (limited to 'includes/system')
-rw-r--r-- | includes/system/compare.inc (renamed from includes/system/compare.php) | 16 | ||||
-rw-r--r-- | includes/system/history.inc (renamed from includes/system/history.php) | 222 | ||||
-rw-r--r-- | includes/system/species.inc (renamed from includes/system/species.php) | 12 | ||||
-rw-r--r-- | includes/system/subsystem.inc (renamed from includes/system/subsystem.php) | 14 | ||||
-rw-r--r-- | includes/system/tree.inc (renamed from includes/system/tree.php) | 16 |
5 files changed, 174 insertions, 106 deletions
diff --git a/includes/system/compare.php b/includes/system/compare.inc index 9714488..de777aa 100644 --- a/includes/system/compare.php +++ b/includes/system/compare.inc @@ -1,6 +1,6 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Compare members · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $travelling; +<?php global $system; global $systemCommonName; global $systemID; $title = "Compare members · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; -$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); +$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); function getMember(string $id) { global $systemID; @@ -90,7 +90,7 @@ function getMember(string $id) { ?> <a title="<?= $member["display_name"] ?? $member["name"] ?>" data-bs-toggle="tooltip" class="member-link comparison-item comparison-item-clickable" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($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> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" 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"> @@ -132,16 +132,16 @@ function getMember(string $id) { <?= 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) { + <?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 tooltip-nohelp" href="/<?= $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) { + }); 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 tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" 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 tooltip-nohelp" href="/<?= $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["caretakers"] 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) { + }); 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 tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?><?php $index = 0; foreach ($metadata["caretakers"] 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>Caretaker" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $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; ?> + }); sort($mfMember); $mfMember = $mfMember[0]; ?><a title="<b><?= $mfMember["display_name"] ?? $mfMember["name"] ?></b><br>Caretaker" data-bs-toggle="tooltip" data-bs-html="true" class="member-link tooltip-nohelp" href="/<?= $mfMember["name"] ?>"><img src="<?= getAsset($mfSystem, $mfMember["id"], "heads") ?>" style="width:24px;"></a><?php $index++; endforeach; ?> </span> </span> <span class="comparison-item"> @@ -186,4 +186,4 @@ function getMember(string $id) { </div> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/history.php b/includes/system/history.inc index a13a3e1..ee687d7 100644 --- a/includes/system/history.php +++ b/includes/system/history.inc @@ -1,9 +1,9 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +<?php global $system; global $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; function getMember(string $id) { global $systemID; - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/members.json"), true); $member = null; foreach ($members as $m) { @@ -19,9 +19,7 @@ function getMember(string $id) { <div class="container" id="page-content"> <?php - $switches = array_values(array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-switches.json"), true), function ($i) { - return isset($i["members"][0]); - })); + $switches = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/switches.json"), true); uksort($switches, function ($a, $b) { if (isset($b["timestamp"]) && isset($a["timestamp"])) { return strtotime($b["timestamp"]) - strtotime($a["timestamp"]); @@ -102,7 +100,7 @@ function getMember(string $id) { $fronters = array_map(function ($i) { return [ - "member" => $i["members"][0], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -114,9 +112,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches2[0]) ? $switches2[0]["timestamp"] : (isset($switches3[0]) ? $switches3[0]["timestamp"] : (isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))))) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -124,21 +120,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 0) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> <h4 style="margin-top:15px;">Yesterday</h4> <?php $fronters = array_map(function ($i) { return [ - "member" => $i["members"][0], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -150,9 +155,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches3[0]) ? $switches3[0]["timestamp"] : (isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))))) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -160,21 +163,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 1) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -186,9 +198,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches4[0]) ? $switches4[0]["timestamp"] : (isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))))) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -196,21 +206,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 2) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -222,9 +241,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches5[0]) ? $switches5[0]["timestamp"] : (isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))))) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -232,21 +249,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 3) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -258,9 +284,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches6[0]) ? $switches6[0]["timestamp"] : (isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])))) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -268,21 +292,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 4) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -294,9 +327,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches7[0]) ? $switches7[0]["timestamp"] : (isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]))) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -304,21 +335,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 5) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -330,9 +370,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches8[0]) ? $switches8[0]["timestamp"] : (isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"])) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -340,21 +378,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 6) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -366,9 +413,7 @@ function getMember(string $id) { "date" => strtotime(isset($switches9[0]) ? $switches9[0]["timestamp"] : $switches10[0]["timestamp"]) ]; - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -376,21 +421,30 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; @@ -399,12 +453,10 @@ function getMember(string $id) { $fronters[] = [ "member" => isset($switches10[0]) ? $switches10[0]["members"][0] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][0], "member2" => isset($switches10[0]) && isset($switches10[0]["members"]) && isset($switches10[0]["members"][1]) ? $switches10[0]["members"][1] : (isset(getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1]) ? getSwitchBefore($switches9[count($switches9) - 1]["id"])["members"][1] : null), - "date" => strtotime($switches10[0] ? $switches10[0]["timestamp"] : getSwitchBefore($switches9[count($switches9) - 1]["id"])["timestamp"]) + "date" => strtotime(isset($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"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 8) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -412,29 +464,36 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; 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], + "member" => $i["members"][0] ?? null, "member2" => $i["members"][1] ?? null, "date" => strtotime($i["timestamp"]) ]; }, $switches10); - $fronters = array_unique($fronters, SORT_REGULAR); - - foreach ($fronters as $fronter): $member = getMember($fronter["member"]); + foreach ($fronters as $fronter): if (isset($fronter["member"])): $member = getMember($fronter["member"]); ?> <div class="fronter"> <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 9) ? strtotime(date('Y-m-d', $fronter["date"])) : $fronter["date"] ?>" style="opacity:.5;font-family: monospace;font-size:14px;vertical-align: middle;"> @@ -442,19 +501,28 @@ function getMember(string $id) { </span> <span class="fronter-profile" style="vertical-align: middle;"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> </a> <?php if (isset($fronter["member2"])): $member2 = getMember($fronter["member2"]); ?> (with <a class="member-link" href="/<?= $member2["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member2['name']) . ".png") ? "-" . $member2['name'] : "" ?>.png" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a>) <?php endif; ?> </span> </div> - <?php endforeach; ?> + <?php else: ?> + <div class="fronter"> + <span class="fronter-date" data-date-time="<?= isNotToday($fronter["date"], 7) ? strtotime(date('Y-m-d', $fronter["date"])) : $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;"> + <span class="text-muted">Fallback pony</span> + </span> + </div> + <?php endif; endforeach; ?> </div> <script> Array.from(document.getElementsByClassName("fronter-date")).forEach((i) => { i.innerText = new Date(parseInt(i.getAttribute("data-date-time").trim()) * 1000).toTimeString().split(" ")[0].substring(0, 5) + " " }); document.getElementById("timezone").style.display = ""; </script> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/species.php b/includes/system/species.inc index a35e811..bd37d7b 100644 --- a/includes/system/species.php +++ b/includes/system/species.inc @@ -1,6 +1,6 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "Members by species · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; global $travelling; +<?php global $system; global $systemCommonName; global $systemID; $title = "Members by species · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; global $travelling; -$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); +$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; ?> @@ -11,9 +11,9 @@ function species(array $members, string $id, string $name) { global $systemID; ? global $travelling; return !$travelling[$i['id']]['travelling']; }), - ...array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "-members.json"), true), function ($i) use ($id, $systemID) { + ...array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true), function ($i) use ($id, $systemID) { global $travelling; - return $travelling[$i['id']]['travelling'] && in_array($id, parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "-" . $i['id'] . "-metadata.json"), true))["species"]); + return $travelling[$i['id']]['travelling'] && in_array($id, parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i['id'] . ".json"), true))["species"]); }) ]; @@ -26,7 +26,7 @@ function species(array $members, string $id, string $name) { global $systemID; ? <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="/<?= $member["name"] ?>"><img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($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">, </span><span class="list-separator-mobile"><br></span>'); $index++; endforeach; ?> + <a class="member-link" href="/<?= $member["name"] ?>"><img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= getMiniName($member["display_name"] ?? $member["name"]) ?></a><?php if ($index + 2 <= count($members)) echo('<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>'); $index++; endforeach; ?> <?php else: ?>-<?php endif; ?> </div> </div> @@ -67,4 +67,4 @@ function species(array $members, string $id, string $name) { global $systemID; ? <?php species($crystal, "crystal", "Crystal ponies"); ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/subsystem.php b/includes/system/subsystem.inc index 372ad08..b7d73f1 100644 --- a/includes/system/subsystem.php +++ b/includes/system/subsystem.inc @@ -2,11 +2,11 @@ if (str_ends_with($_GET['_'], "/subsystem")) header("Location: /?error=Invalid subsystem ID") and die(); -$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); +$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) ?? []; +$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? []; function getMember(string $id) { global $systemID; @@ -74,27 +74,27 @@ function getSubsystemByID(string $id) { } 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); +$subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystemID.json"), true); global $subsystem; $subsystem = getSubsystemByID($subsystemID); -$title = $subsystemData["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +$title = $subsystemData["name"] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; ?> <br> <div class="container"> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/subsysbanner.php"; ?> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/subsysbanner.inc"; ?> <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") ?> + <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystemID.html") ?> </div> <?php showSubsystem(getSubsystemByID($subsystemID), $systemID); ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/system/tree.php b/includes/system/tree.inc index 21d146b..c3cc5c4 100644 --- a/includes/system/tree.php +++ b/includes/system/tree.inc @@ -1,9 +1,9 @@ -<?php global $system; global $systemCommonName; global $systemID; $title = "System tree · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; +<?php global $system; global $systemCommonName; global $systemID; $title = "System tree · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; -$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); +$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) ?? []; +$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID.json"), true) ?? []; function getMember(string $id) { global $systemID; @@ -70,7 +70,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l0-separator<?= $first ? " tree-first-separator" : "" ?>"> </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> + <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/subsystems/$systemID-$subsystem[source].json") ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/subsystems/$systemID-$subsystem[source].json"), true)["name"] : $subsystem["source"] ?></span> </a> </div> <?php $ssfirst = true; foreach ($subsystem["members"] as $ssm): $ssmember = getMember($ssm); ?> @@ -79,7 +79,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l1-separator<?= $ssfirst ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $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> + <img src="<?= getAsset($systemID, $ssmember["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span> </a> </div> </div> @@ -91,7 +91,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l0-separator<?= $first ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $member["name"] ?>"> - <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . resolveMember($member['name']) . ".png") ? "-" . $member['name'] : "" ?>.png" style="width:24px;"> <span style="vertical-align: middle;"><?= $member["display_name"] ?? $member["name"] ?></span> + <img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><?= $member["display_name"] ?? $member["name"] ?></span> </a> </div> <?php if (memberHasSubsystem($member)): ?> @@ -101,7 +101,7 @@ function getMemberSubsystem(array $member) { <div class="tree-l1-separator<?= $ssfirst ? " tree-first-separator" : "" ?>"> </div> <div class="tree-inner"> <a class="member-link" href="/<?= $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> + <img src="<?= getAsset($systemID, $ssmember["id"], "heads") ?>" style="width:24px;"> <span style="vertical-align: middle;"><?= $ssmember["display_name"] ?? $ssmember["name"] ?></span> </a> </div> </div> @@ -111,4 +111,4 @@ function getMemberSubsystem(array $member) { <?php $first = false; endif; endforeach; ?> </div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'; ?>
\ No newline at end of file +<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file |