summaryrefslogtreecommitdiff
path: root/includes/banner.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/banner.php')
-rw-r--r--includes/banner.php73
1 files changed, 11 insertions, 62 deletions
diff --git a/includes/banner.php b/includes/banner.php
index 2582b63..213863a 100644
--- a/includes/banner.php
+++ b/includes/banner.php
@@ -2,69 +2,9 @@
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/pronouns.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php";
$travelling = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling.json"), true);
-if (!function_exists("getMiniName")) {
- function getMiniName(string $name) {
- $parts = explode(" ", $name);
-
- if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly") {
- if (str_contains($parts[0], "/")) {
- return explode("/", $parts[0])[0];
- } else {
- return $parts[0];
- }
- } else {
- return $name;
- }
- }
-}
-
-if (!function_exists("getSystemMember")) {
- function getSystemMember(string $system, string $id) {
- $systemID = $system;
-
- $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
- $member = null;
-
- foreach ($members as $m) {
- if ($m["id"] === $id) $member = $m;
- }
-
- return $member;
- }
-}
-
-if (!function_exists("timeAgo")) {
- 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}";
- }
-}
function _header_getMember(string $id, $system) {
$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-members.json"), true);
@@ -106,6 +46,7 @@ function _header_getSubsystemFromMember(array $member) {
function getMemberBannerData(string $id, string $system, bool $french = false) {
global $subsystems;
global $travelling;
+ global $isLoggedIn;
$subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system-subsystems.json"), true) ?? [];
@@ -381,6 +322,14 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
];
}
+ if (($metadata["sexually_active"] ?? false) && !$french && $isLoggedIn) {
+ $badges[] = [
+ "id" => "sexually_active",
+ "color" => "d6a833",
+ "html" => '<span data-bs-toggle="tooltip" data-bs-html="true" title="<b>Sexually active</b><br>' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' doing sexual acts and would pleasure ' . getMemberPronouns($member['pronouns'])["possessive_det"] . ' marefriend·s IRL if ' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' had the chance." class="badge rounded-pill" style="background-color:#d68f33;">Sexually active</span>'
+ ];
+ }
+
if ($metadata["protector"] ?? false) {
$badges[] = [
"id" => "protector",
@@ -423,7 +372,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) {
];
}
- if (($metadata["little"] ?? 0) === 1) {
+ if (($metadata["age_regressor"] ?? false)) {
if ($metadata["regression"] !== null && $metadata["regression"] !== false) {
$regression = _header_getMember($metadata["regression"], $system);
$badges[] = [