diff options
Diffstat (limited to 'includes/banner.inc')
-rw-r--r-- | includes/banner.inc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/includes/banner.inc b/includes/banner.inc index cbae0b2..341b4e7 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -59,6 +59,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "regression" => null, "median" => null, "marefriends" => [], + "sexfriends" => [], "sisters" => [], "caretakers" => [] ]); @@ -235,6 +236,29 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + $sexfriends = null; + + if ($isLoggedIn) { + $sexfriends = []; + foreach ($metadata["sexfriends"] as $marefriend) { + $mfSystem = explode("/", $marefriend)[0]; + $mfMemberID = explode("/", $marefriend)[1]; + $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfMemberID) { + return $item["id"] === $mfMemberID; + }); + sort($mfMember); + $mfMember = $mfMember[0]; + + $sexfriends[] = [ + "id" => $marefriend, + "link" => "/" . ($mfMember["name"]), + "icon" => getAsset($mfSystem, $mfMemberID, "heads"), + "name" => getMiniName($mfMember["display_name"] ?? $mfMember["name"]), + "full_name" => $mfMember["display_name"] ?? $mfMember["name"] + ]; + } + } + $sisters = []; foreach ($metadata["sisters"] as $marefriend) { $mfSystem = explode("/", $marefriend)[0]; @@ -488,6 +512,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { 'system' => $systemData, 'relations' => [ 'marefriends' => $marefriends ?? [], + 'sexfriends' => $sexfriends ?? null, 'sisters' => $sisters ?? [], 'caretakers' => $caretakers ?? [] ] |