From 953ddd82e48dd206cef5ac94456549aed13b3ad5 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 17 Nov 2023 23:25:29 +0100 Subject: Updated 30 files and deleted 2976 files (automated) --- includes/util/banner.inc | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'includes/util/banner.inc') diff --git a/includes/util/banner.inc b/includes/util/banner.inc index aca1edb..944a701 100644 --- a/includes/util/banner.inc +++ b/includes/util/banner.inc @@ -1,5 +1,26 @@ 0 || $metadata["birth"]["age"] === -1) { + if ($metadata["birth"]["age"] === -1) { + return "Eternal"; + } elseif ($metadata["birth"]["age"] <= 0) { + return "-"; + } elseif (is_numeric($metadata["birth"]["age"])) { + return $metadata["birth"]["age"] . "* years old"; + } + } else { + if ($metadata["birth"]["year"] <= 1900) { + return "-"; + } else { + $age = (int)date('Y') - $metadata["birth"]["year"] + (strtotime(date('Y') . "-" . $metadata["birth"]["date"]) <= time() ? 0 : -1); + return $age . " years old"; + } + } + + return "-"; +} + require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/pronouns.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; @@ -167,10 +188,10 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $app = $GLOBALS["ColdHazeApp"]; $systemData = []; - $systemData['page'] = "/" . ($system === "gdapd" ? "raindrops" : ($system === $app["other"]["id"] ? $app["other"]["slug"] : "cloudburst")); + $systemData['page'] = "/" . ($system === "gdapd" ? "raindrops" : ($system === $app["other"]["id"] ? $app["other"]["slug"] : ($system === "hrbom" ? "moonglow" : "cloudburst"))); $systemData['icon'] = getAsset($system); - $systemData['name'] = $system === "gdapd" ? "Raindrops" : ($system === $app["other"]["id"] ? $app["other"]["short"] : "Cloudburst"); - $systemData['full_name'] = $system === "gdapd" ? "Raindrops System" : ($system === $app["other"]["id"] ? $app["other"]["name"] : "Cloudburst System"); + $systemData['name'] = $system === "gdapd" ? "Raindrops" : ($system === $app["other"]["id"] ? $app["other"]["short"] : ($system === "hrbom" ? "Moonglow" : "Cloudburst")); + $systemData['full_name'] = $system === "gdapd" ? "Raindrops System" : ($system === $app["other"]["id"] ? $app["other"]["name"] : ($system === "hrbom" ? "Moonglow" : "Cloudburst System")); $systemData['temporary'] = false; if ($travelling[$member['id']]["travelling"] && !$travelling[$member['id']]["equestria"]) { @@ -400,7 +421,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { 'median' => $metadata["median"], 'little' => $metadata["little"] >= 2, 'name' => $member["display_name"] ?? $member["name"], - 'gender' => isset($metadata["gender"]) && trim($metadata["gender"]) !== "" ? $Parsedown->text($metadata["gender"]) : "Agender", + 'gender' => isset($metadata["show_gender"]) && $metadata["show_gender"] ? (isset($metadata["gender"]) && trim($metadata["gender"]) !== "" ? $Parsedown->text($metadata["gender"]) : "Agender") : null, 'badges' => $badges, 'prefixes' => $prefixes, 'pronouns' => isset($member["pronouns"]) && trim($member["pronouns"]) !== "" ? $member["pronouns"] : "they/them", @@ -408,6 +429,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { 'last_fronted' => $lastFronted, 'species' => $speciesList, 'system' => $systemData, + 'age' => getAge($metadata), 'relations' => [ 'marefriends' => $marefriends ?? [], 'sexfriends' => $sexfriends ?? null, -- cgit