From 089d94ff3a34ef022015bf28db0427497acc67ea Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 28 Jan 2023 20:31:04 +0100 Subject: Updated 7 files and renamed 2 files (automated) --- includes/banner.inc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'includes/banner.inc') 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 ?? [] ] -- cgit