summaryrefslogtreecommitdiff
path: root/includes/util/banner.inc
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
commit953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch)
tree8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/util/banner.inc
parent62a9199846b0c07c03218703b33e8385764f42d9 (diff)
downloadpluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/util/banner.inc')
-rw-r--r--includes/util/banner.inc30
1 files changed, 26 insertions, 4 deletions
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 @@
<?php
+function getAge($metadata) {
+ if (!isset($metadata["birth"]["year"]) || $metadata["birth"]["age"] > 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"] : "<i>they/them</i>",
@@ -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,