diff options
Diffstat (limited to 'includes/fragments/member.inc')
-rw-r--r-- | includes/fragments/member.inc | 102 |
1 files changed, 84 insertions, 18 deletions
diff --git a/includes/fragments/member.inc b/includes/fragments/member.inc index 1d9530c..f1169c8 100644 --- a/includes/fragments/member.inc +++ b/includes/fragments/member.inc @@ -1,4 +1,6 @@ -<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; global $lang; global $pages; global $app; +<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; global $lang; global $pages; global $app; global $isLoggedIn; global $isLowerLoggedIn; + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; if ($memberData["name"] === "fusion") { $title = ($memberCommonName === "fusion" ? $lang["member"]["merge"] : $memberCommonName); @@ -6,6 +8,14 @@ if ($memberData["name"] === "fusion") { $title = $memberCommonName . " ยท " . $systemCommonName; } +if ($memberData["name"] !== "unknown" && $memberData["name"] !== "fusion") { + $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); + + if ($metadata["private"] && !$isLoggedIn && !$isLowerLoggedIn) { + peh_error("Page not found: " . strip_tags($member), 404); + } +} + require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; $travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json"), true); @@ -141,26 +151,82 @@ if ($memberData["name"] === "fusion") { </li> <li><b>Date added:</b> <?= date('l j F Y', strtotime($memberData["created"])) ?> (<?= timeAgo($memberData["created"]) ?>, <code><?= $memberData["created"] ?></code>)</li> <li><b>Pronouns:</b> <?= $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="border:1px solid rgba(255, 255, 255, .5);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"])): ?> <code><?= str_repeat("0", 48 - strlen(decbin($metadata["bitset"]))) . decbin($metadata["bitset"]) ?></code> (0x<?= str_repeat("0", 12 - strlen(dechex($metadata["bitset"]))) . dechex($metadata["bitset"]) ?>, <?= $metadata["bitset"] ?>)</li><?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" : ($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/util/score.inc"; ?> <li> - <b>Score breakdown:</b> <code>-</code> - <ul><li>-</ul></li> + <b>Metadata:</b> + <ul> + <?php foreach (parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json"), true)) as $name => $value): ?> + <li> + <b><?= $name ?></b>: <?php + + if (is_bool($value)) { + echo($value ? "true" : "false"); + } else if (is_numeric($value)) { + echo((string)$value); + } else if (is_string($value)) { + echo("\"$value\""); + } else if (is_null($value)) { + echo("null"); + } else if (is_array($value) && array_keys($value) !== array_keys(array_keys($value))) { // Is associative ?> + <ul> + <?php foreach ($value as $name2 => $value2): ?> + <li> + <b><?= $name2 ?></b>: <?php + + if (is_bool($value2)) { + echo($value2 ? "true" : "false"); + } else if (is_numeric($value2)) { + echo((string)$value2); + } else if (is_string($value2)) { + echo("\"$value2\""); + } else if (is_null($value2)) { + echo("null"); + } else if (is_array($value2)) { + echo("Array"); + } else { + var_dump($value2); + } + + ?> + </li> + <?php endforeach; ?> + </ul><?php + } else if (is_array($value) && array_keys($value) === array_keys(array_keys($value))) { // Is indexes ?> + <ul> + <?php foreach ($value as $value2): ?> + <li> + <?php + + if (is_bool($value2)) { + echo($value2 ? "true" : "false"); + } else if (is_numeric($value2)) { + echo((string)$value2); + } else if (is_string($value2)) { + echo("\"$value2\""); + } else if (is_null($value2)) { + echo("null"); + } else if (is_array($value2)) { + echo("Array"); + } else { + var_dump($value2); + } + + ?> + </li> + <?php endforeach; ?> + </ul><?php + } else if (is_array($value) && count($value) === 0) { + echo("[]"); + } else { + var_dump($value); + } + + ?> + </li> + <?php endforeach; ?> + </ul> + </li> </ul> </div> </details> |