diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-24 14:03:36 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-24 14:03:36 +0200 |
commit | 633c92eae865e957121e08de634aeee11a8b3992 (patch) | |
tree | 09d881bee1dae0b6eee49db1dfaf0f500240606c /pages/relations.inc | |
parent | c4657e4509733699c0f26a3c900bab47e915d5a0 (diff) | |
download | pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.gz pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.tar.bz2 pluralconnect-633c92eae865e957121e08de634aeee11a8b3992.zip |
Updated 18 files, added 1692 files and deleted includes/system/compare.inc (automated)
Diffstat (limited to 'pages/relations.inc')
-rw-r--r-- | pages/relations.inc | 184 |
1 files changed, 108 insertions, 76 deletions
diff --git a/pages/relations.inc b/pages/relations.inc index f872a2f..1c5a878 100644 --- a/pages/relations.inc +++ b/pages/relations.inc @@ -3,86 +3,87 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn; global $app; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; -?> +if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/relations.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/relations.json", "{}"); -<br> -<div class="container"> +$cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/relations.json"), true); + +function page() { global $isLoggedIn; global $isLowerLoggedIn; global $pages; global $lang; global $app; ?> <div id="page-content"> <h2><?= $pages["relations"]["name"][$lang["_name"]] ?></h2> <?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): ?> - <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr 2.25fr;"> - <a 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;" href="/<?= $member["name"] ?>"> - <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> - </a> - - <table class="relation-item relation-item-marefriends" style="margin-left:10px;padding:0 20px;"> - <tbody><tr> - <td style="width: 50%;text-align:right;"> - <b style="padding-right:5px;"><?= $lang["relations"]["marefriends"] ?></b><span class="list-separator-mobile"><br></span> - </td> - <td style="width: 50%;text-align:left;"> - <?php if (count($member["_metadata"]["marefriends"]) === 0): ?> - <span class="text-muted"><?= $lang["relations"]["no"] ?></span> - <?php else: ?> - <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> - <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endif; endforeach; ?> - <?php endif; ?> - </td> - </tr></tbody> - </table> - - <table class="relation-item relation-item-sisters" style="padding:0 20px;"> - <tbody><tr> - <td style="width: 50%;text-align:right;"> - <b style="padding-right:5px;"><?= $lang["relations"]["sisters"] ?></b><span class="list-separator-mobile"><br></span> - </td> - <td style="width: 50%;text-align:left;"> - <?php if (count($member["_metadata"]["sisters"]) === 0): ?> - <span class="text-muted"><?= $lang["relations"]["no"] ?></span> - <?php else: ?> - <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> - <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endif; endforeach; ?> - <?php endif; ?> - </td> - </tr></tbody> - </table> - - <table class="relation-item relation-item-caretakers" style="padding:0 20px;"> - <tbody><tr> - <td style="width: 50%;text-align:right;"> - <b style="padding-right:5px;"><?= $lang["relations"]["caretakers"] ?></b><span class="list-separator-mobile"><br></span> - </td> - <td style="width: 50%;text-align:left;"> - <?php if (count($member["_metadata"]["caretakers"]) === 0): ?> - <span class="text-muted"><?= $lang["relations"]["no"] ?></span> - <?php else: ?> - <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> - <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endif; endforeach; ?> - <?php endif; ?> - </td> - </tr></tbody> - </table> - - <table class="relation-item relation-item-friends" style="padding:0 20px;"> - <tbody><tr> - <td style="width: 50%;text-align:right;"> - <b style="padding-right:5px;">Friends:</b><span class="list-separator-mobile"><br></span> - </td> - <td style="width: 50%;text-align:left;"> - <?php if (!isset($member["_metadata"]["friends"]) || count($member["_metadata"]["friends"]) === 0): ?> - <span class="text-muted"><?= $lang["relations"]["no"] ?></span> - <?php else: ?> - <?php foreach ($member["_metadata"]["friends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> - <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> - <?php endif; endforeach; ?> - <?php endif; ?> - </td> - </tr></tbody> - </table> - </div> + <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr 2.25fr;"> + <a 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;" href="/<?= $member["name"] ?>"> + <img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> + </a> + + <table class="relation-item relation-item-marefriends" style="margin-left:10px;padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;"><?= $lang["relations"]["marefriends"] ?></b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (count($member["_metadata"]["marefriends"]) === 0): ?> + <span class="text-muted"><?= $lang["relations"]["no"] ?></span> + <?php else: ?> + <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> + <?php endif; endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> + + <table class="relation-item relation-item-sisters" style="padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;"><?= $lang["relations"]["sisters"] ?></b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (count($member["_metadata"]["sisters"]) === 0): ?> + <span class="text-muted"><?= $lang["relations"]["no"] ?></span> + <?php else: ?> + <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> + <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> + <?php endif; endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> + + <table class="relation-item relation-item-caretakers" style="padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;"><?= $lang["relations"]["caretakers"] ?></b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (count($member["_metadata"]["caretakers"]) === 0): ?> + <span class="text-muted"><?= $lang["relations"]["no"] ?></span> + <?php else: ?> + <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> + <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> + <?php endif; endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> + + <table class="relation-item relation-item-friends" style="padding:0 20px;"> + <tbody><tr> + <td style="width: 50%;text-align:right;"> + <b style="padding-right:5px;">Friends:</b><span class="list-separator-mobile"><br></span> + </td> + <td style="width: 50%;text-align:left;"> + <?php if (!isset($member["_metadata"]["friends"]) || count($member["_metadata"]["friends"]) === 0): ?> + <span class="text-muted"><?= $lang["relations"]["no"] ?></span> + <?php else: ?> + <?php foreach ($member["_metadata"]["friends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?> + <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a> + <?php endif; endforeach; ?> + <?php endif; ?> + </td> + </tr></tbody> + </table> + </div> <?php endforeach; ?> </div> @@ -115,6 +116,37 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; text-align: center; } </style> +<?php } + +?> + +<br> +<div class="container"> + <?php if (!isset($cache["private"]) || !isset($cache["public"])) { + ob_start(); + $isLoggedInOldState = $isLoggedIn; + $isLowerLoggedInOldState = $isLowerLoggedIn; + $isLoggedIn = true; + $isLowerLoggedIn = true; + page(); + $isLoggedIn = $isLoggedInOldState; + $isLowerLoggedIn = $isLowerLoggedInOldState; + $cache["private"] = ob_get_contents(); + ob_end_clean(); + + ob_start(); + $isLoggedInOldState = $isLoggedIn; + $isLowerLoggedInOldState = $isLowerLoggedIn; + $isLoggedIn = false; + $isLowerLoggedIn = false; + page(); + $isLoggedIn = $isLoggedInOldState; + $isLowerLoggedIn = $isLowerLoggedInOldState; + $cache["public"] = ob_get_contents(); + ob_end_clean(); + } + + echo($isLoggedIn ? $cache["private"] : $cache["public"]); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/relations.json", json_encode($cache)); ?> </div> <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?> |