diff options
Diffstat (limited to 'includes/member.php')
-rw-r--r-- | includes/member.php | 140 |
1 files changed, 88 insertions, 52 deletions
diff --git a/includes/member.php b/includes/member.php index f8050b0..d0120d5 100644 --- a/includes/member.php +++ b/includes/member.php @@ -10,35 +10,6 @@ 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); - } - - $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; - $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); - - $now = time(); - - $difference = $now - $time; - if ($difference <= 10 && $difference >= 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 ($memberData["name"] !== "unknown" && $memberData["name"] !== "fusion") { $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "-" . $memberID . "-metadata.json"), true)); } @@ -78,44 +49,83 @@ if ($memberData["name"] === "fusion") { <div id="member-banner"></div> <div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?> border-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] : "transparent" ?>"> <div> - <b>Food:</b> + <b>Food:</b><span class="member-small-separator"><br></span> <?= match ($metadata["food"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"])) . " species indicates that " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($memberData["pronouns"])["third"] ? "doesn't" : "don't") . " need to eat food, therefore " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . " can eat all foods.'>Doesn't need</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat fish or meat.'>Can't eat animals</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat meat, but can eat fish.'>Can't eat meat</span>", - 3 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can eat all foods, meat and fish included.'>No restrictions</span>", + 0 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"])) . " species indicates that " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($memberData["pronouns"])["third"] ? "doesn't" : "don't") . " need to eat food, therefore " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"]) . " can eat all foods.'>Not needed</span>", + 1 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat fish or meat.'>Not animals</span>", + 2 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can't eat meat, but can eat fish.'>Not meat</span>", + 3 => "<span data-bs-toggle='tooltip' title='" . ucfirst(str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["subjective"])) . " can eat all foods, meat and fish included.'>All</span>", } ?> </div> <div> - <b>Memory access:</b> + <b>Shared memory:</b><span class="member-small-separator"><br></span> <?= match ($metadata["shared_memory"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly share" : " don't directly share") . " memory with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but is able to (slowly) query it if that is needed.'>No direct access</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly shares" : " don't directly share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but may be able to share certain memories and/or share memories at will.'>Partial direct access</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates.'>Full direct access</span>", + 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly share" : " don't directly share") . " memory with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but is able to (slowly) query it if that is needed.'>None</span>", + 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't directly shares" : " don't directly share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates, but may be able to share certain memories and/or share memories at will.'>Partial</span>", + 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " shares" : " share") . " all memories with " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " headmates.'>Full</span>", } ?> </div> <div> - <b>Magic:</b> + <b>Magic:</b><span class="member-small-separator"><br></span> <?= match ($metadata["magic"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " is unable to use magic at all.'>Can't use magic</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can use magic in rare cases, such as when somepony else is pouring magic into " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " or when a physical event occurs.'>Can use magic in some cases</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " horn.'>Can use a horn</span>", - 3 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " wings.'>Can use wings</span>", - 4 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using both " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " horn and wings.'>Can use a horn and wings</span>", - 5 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using another part of " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body that is neither a horn or wings.'>Can cast spells</span>", + 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " is unable to use magic at all.'>None</span>", + 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can use magic in rare cases, such as when somepony else is pouring magic into " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " or when a physical event occurs.'>In some cases</span>", + 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " horn.'>Horn</span>", + 3 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " wings.'>Wings</span>", + 4 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using both " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " horn and wings.'>Horn and wings</span>", + 5 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " can cast spells using another part of " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body that is neither a horn or wings.'>Yes</span>", } ?> </div> <?php if ($isLoggedIn): ?> <div> - <b>Sensitivity:</b> + <b>Sensitivity:</b><span class="member-small-separator"><br></span> <?= match ($metadata["sensitivity"]) { - 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " does" : " do") . " not have sensitive spots on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body.'>Not sensitive</span>", - 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " may have (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body.'>May be sensitive</span>", - 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " has" : " have") . " (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body, and playing with it/them will make " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " feel affectionate: extremely safe and cared for.'>Affectionately sensitive</span>", - 3 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " has" : " have") . " (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body, and playing with it/them will make " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " feel sexually pleasured.'>Sexually sensitive</span>", + 0 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " does" : " do") . " not have sensitive spots on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body.'>None</span>", + 1 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " may have (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body.'>Maybe</span>", + 2 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " has" : " have") . " (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body, and playing with it/them will make " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " feel affectionate: extremely safe and cared for.'>Affectionate</span>", + 3 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " has" : " have") . " (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body, and playing with it/them will make " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " feel sexually pleasured.'>Sexual</span>", 4 => "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . (getMemberPronouns($memberData["pronouns"])["third"] ? " has" : " have") . " (a) sensitive spot·s on " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " body, and playing with it/them will make " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " feel affectionate or sexually pleasured.'>Affectionate and sexual</span>", } ?> </div> + <div> + <b>Age:</b><span class="member-small-separator"><br></span> + <?php if (!isset($metadata["birth"]["year"])): ?> + <?php if ($metadata["birth"]["age"] <= 0): ?> + - + <?php else: ?> + <?= "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . str_replace("'", "'", getMemberPronouns($memberData["pronouns"])["third"] ? " doesn't" : " don't") . " age like the body does, making " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " stay " . $metadata["birth"]["age"] . " years old for " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["possessive_det"]) . " entire life.'>" . $metadata["birth"]["age"] . "* years old</span>" ?> + <?php endif; ?> + <?php else: ?> + <?php if ($metadata["birth"]["year"] <= 2000): ?> + - + <?php else: ?> + <?php + + $birthdate = $metadata["birth"]["year"] . date('-m-d'); + if (isset($metadata["birth"]["date"]) && trim($metadata["birth"]["date"]) !== "" && $metadata["birth"]["date"] !== "01-01") { + $birthdate = $metadata["birth"]["year"] . "-" . $metadata["birth"]["date"]; + } + + $age = floor((time() - strtotime($birthdate)) / 31557600); + $birthday = "as time passes"; + + if (isset($metadata["birth"]["date"]) && trim($metadata["birth"]["date"]) !== "" && $metadata["birth"]["date"] !== "01-01") { + $birthday = "every " . date('F jS', strtotime(date('Y') . "-" . $metadata["birth"]["date"])); + } + + ?> + <?= "<span data-bs-toggle='tooltip' title='" . str_replace("'", "'", ucfirst(getMemberPronouns($memberData['pronouns'])["subjective"])) . " age" . str_replace("'", "'", getMemberPronouns($memberData["pronouns"])["third"] ? "s" : "") . " like the body does, making " . str_replace("'", "'", getMemberPronouns($memberData['pronouns'])["object"]) . " stay " . $age . " years old for now, having this age change $birthday.'>" . $age . " years old</span>" ?> + <?php endif; ?> + <?php endif; ?> + </div> + <div> + <b>Birthday:</b><span class="member-small-separator"><br></span> + <?php if (isset($metadata["birth"]["date"]) && trim($metadata["birth"]["date"]) !== "" && $metadata["birth"]["date"] !== "01-01"): ?> + <?= date('F jS', strtotime(date('Y') . "-" . $metadata["birth"]["date"])) ?> + <?php else: ?> + - + <?php endif; ?> + </div> <?php endif; ?> </div> </div> @@ -141,6 +151,7 @@ if ($memberData["name"] === "fusion") { <ul> <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-metadata.json" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-metadata.json") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-metadata.json") . " bytes" : "not found" ?>)</li> <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html") . " bytes" : "not found" ?>)</li> + <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html") . " bytes" : "not found" ?>)</li> </ul> </li> <li><b>Date added:</b> <?= date('l j F Y', strtotime($memberData["created"])) ?> (<?= timeAgo($memberData["created"]) ?>, <code><?= $memberData["created"] ?></code>)</li> @@ -189,6 +200,12 @@ if ($memberData["name"] === "fusion") { ?></ul></li> </ul> + + <br> + <div style="filter:invert(0);" class="alert alert-warning"> + <b>AI-generated page:</b> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/ai.php"; ?> + </div> </details> </div> <?php endif; ?> @@ -197,6 +214,14 @@ if ($memberData["name"] === "fusion") { <?= getMiniName($memberData["display_name"] ?? $memberData["name"]) ?> is visiting the <?= $systemID === "ynmuc" ? "Raindrops System" : "Cloudburst System" ?> since <?= timeAgo($travelling[$memberID]["history"][count($travelling[$memberID]["history"]) - 1]["start"]) ?>, therefore <?= getMemberPronouns($memberData["pronouns"])["subjective"] ?> <?= getMemberPronouns($memberData["pronouns"])["third"] ? "is" : "are" ?> currently not in the <?= $systemCommonName ?>. </div> <?php endif; ?> + <?php if ($memberData["name"] === "new"): ?> + <div class="alert alert-secondary"> + <p>Hello there!</p> + <p>I'm currently a new headmate slowly figuring myself out.</p> + <p>Give me some time to figure myself out and see this page change as I find new stuff about my identity. Don't be too worried if I accidentally get pushed to front, it's something that can happen sometimes.</p> + <span>Thanks!</span> + </div> + <?php endif; ?> <div id="page-content"> <?php if ($memberData["name"] === "unknown"): ?> @@ -222,9 +247,20 @@ if ($memberData["name"] === "fusion") { </div> <?php else: ?> <?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;">(edit: <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small> + <?php endif; ?> + + <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html") && $isLoggedIn): ?> + <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-private.html") ?> + <hr> + <?php endif; ?> + + <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html")): ?> + <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$memberID-content.html") ?> + <?php else: ?> + <p class="text-muted">This page is automatically generated and may not be 100% accurate.</p> + <?php require $_SERVER['DOCUMENT_ROOT'] . "/includes/ai.php"; ?> <?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>" ?> <?php endif; ?> </div> </div> |