summaryrefslogtreecommitdiff
path: root/includes/member.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
committerMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
commita2df9a69dcc14cb70118cda2ded499055e7ee358 (patch)
tree6dd283e4e9452d38bce81ddaaae49b5335755842 /includes/member.php
parent84dd0735820b16b60f600284d35183d76547a71f (diff)
downloadpluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip
m. update
Diffstat (limited to 'includes/member.php')
-rw-r--r--includes/member.php38
1 files changed, 33 insertions, 5 deletions
diff --git a/includes/member.php b/includes/member.php
index ad7995f..a2573d1 100644
--- a/includes/member.php
+++ b/includes/member.php
@@ -1,5 +1,7 @@
<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = $memberCommonName . " ยท " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true);
+
function timeAgo($time): string {
if (!is_numeric($time)) {
$time = strtotime($time);
@@ -26,28 +28,49 @@ function timeAgo($time): string {
$difference = round($difference);
$period = $periods[$j] . ($difference >1 ? "s" :'');
- return "{$difference} {$period} {$tense} ";
+ return "{$difference} {$period} {$tense}";
}
-$metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true);
+$metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true));
?>
<br>
<div class="container">
- <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.php"; ?>
+ <script>
+ window.currentMemberData = JSON.parse(atob(`<?= base64_encode(json_encode(getMemberBannerData($memberID, $systemID))) ?>`));
+ </script>
+ <div id="member-banner"></div>
+ <script src="/app/banner.js"></script><script>refreshBanner()</script>
<br>
<?php global $isLoggedIn; if ($isLoggedIn): ?>
+ <?php if (!isset($metadata["bitset"])): ?>
+ <div class="alert alert-warning">
+ <b>This member's metadata needs an update.</b> It still uses the old JSON metadata system instead of the new 24bit integer-based system. Contact a developer to request an update. (only administrators can see this; file: <code><?= $_SERVER['DOCUMENT_ROOT'] ?>/includes/data/<?= $systemID ?>-<?= $memberID ?>-metadata.json</code>)
+ </div>
+ <?php endif; ?>
<div class="alert alert-dark">
<details>
<summary>Private administrator information</summary>
<ul style="margin-bottom:0;">
<li><b>ID:</b> <code><?= $memberID ?></code> (<code><?= $systemID . "/" . $memberID ?></code>, <?= $memberData["name"] ?>)</li>
+ <li><b>Pronouns:</b> <?= implode(", ", getPronounsFromMark($memberData['pronouns'])) ?></li>
+ <li><b>Pronouns usage:</b> <ul><?php
+
+ foreach (getMemberPronouns($memberData['pronouns']) as $type => $usage) {
+ if (is_string($usage) && $type !== "color") {
+ echo("<li><b>" . $type . ":</b> " . $usage . "</li>");
+ }
+ }
+
+ ?></ul></li>
+ <li><b>Color:</b> <span style="background-color:#<?= $memberData["color"] ?? "ffffff" ?>;display:inline-block;width:16px;height:16px;border-radius:5px;vertical-align: middle;filter: invert(1) hue-rotate(180deg);"></span> <span style="vertical-align: middle;"><code>#<?= $memberData["color"] ?? "ffffff" ?></code></span>
+ <li><b>Bitset:</b><?php if (isset($metadata["bitset"])): ?> <span style="background-color:#<?= dechex($metadata["bitset"]) ?>;display:inline-block;width:16px;height:16px;border-radius:5px;vertical-align: middle;filter: invert(1) hue-rotate(180deg);"></span> <span style="vertical-align: middle;"><code><?= str_repeat("0", 24 - strlen(decbin($metadata["bitset"]))) . decbin($metadata["bitset"]) ?></code> (0x<?= str_repeat("0", 6 - strlen(dechex($metadata["bitset"]))) . dechex($metadata["bitset"]) ?>, <?= $metadata["bitset"] ?>)</li></span><?php else: ?> <span class="text-warning" style="filter:invert(1) hue-rotate(180deg);">Not using bitset; please update.</span><?php endif; ?>
<li><b>Reduced name:</b> <?= getMiniName($memberData["display_name"] ?? $member["name"]) ?></li>
<li><b>Shared memory access:</b> <code><?= $metadata["shared_memory"] ?></code> (<?= $metadata["shared_memory"] === 2 ? "Full direct access" : ($metadata["shared_memory"] === 0 ? "No direct access" : "Partial direct access") ?>)</li>
<li><b>Protector:</b> <code><?= $metadata["protector"] ? "1" : "0" ?></code> (<?= $metadata["protector"] ? "Yes" : "No" ?>)</li>
- <li><b>Little:</b> <code><?= $metadata["little"] ?></code> (<?= $metadata["little"] === 2 ? "Is a little" : ($metadata["little"] === 1 ? "Is an age regressor" : "No") ?>)</li>
+ <li><b>Little:</b> <code><?= $metadata["little"] ?></code> (<?= $metadata["little"] === 2 ? "Is a little" : ($metadata["little"] === 1 ? "Is an age regressor" : ($metadata["little"] === 3 ? "Not a little, but younger" : "No")) ?>)</li>
<li><b>Relations count:</b> <code><?= count($metadata["marefriends"]) + count($metadata["sisters"]) ?></code></li>
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.php"; $score = calculateScore($metadata, $memberData["display_name"] ?? $memberData["name"]); ?>
<li>
@@ -72,10 +95,15 @@ $metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes
</details>
</div>
<?php endif; ?>
+ <?php if ($travelling[$memberID]['travelling']): ?>
+ <div class="alert alert-primary">
+ This pony is visiting the <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?> since <?= timeAgo($travelling[$memberID]["history"][count($travelling[$memberID]["history"]) - 1]["start"]) ?>, therefore currently not in the <?= $systemCommonName ?>.
+ </div>
+ <?php endif; ?>
<div id="page-content">
<?php global $isLoggedIn; if ($isLoggedIn): ?>
- <small style="opacity:.5;display:block;">(<a href="/edit/<?= $system ?>/<?= $memberData['name'] ?>">edit</a>)</small>
+ <small style="opacity:.5;display:block;">(<a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">edit</a>)</small>
<?php endif; ?>
<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html") ? file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html") : "<i>This page is empty.</i>" ?>
</div>