From 5860551daa0f60103ad24e93da29f401a653f144 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 29 Mar 2024 22:05:35 +0100 Subject: Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated) --- includes/util/functions.inc | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'includes/util/functions.inc') diff --git a/includes/util/functions.inc b/includes/util/functions.inc index 87954ea..b01476f 100644 --- a/includes/util/functions.inc +++ b/includes/util/functions.inc @@ -23,6 +23,16 @@ if (!function_exists("getMemberPronouns")) { } } +if (!function_exists("file_get_contents_or_defaults")) { + function file_get_contents_or_defaults($file, $default) { + if (file_exists($file)) { + return file_get_contents($file); + } else { + return $default; + } + } +} + if (!function_exists("parseMetadata")) { function parseMetadata ($metadata) { $metadata["little"] = 0; @@ -106,6 +116,24 @@ if (!function_exists("peh_error")) { if (!function_exists("getAsset")) { function getAsset($systemID, $memberID = null, $type = "avatars"): string { + if ($systemID === "gdapd") { + if (isset($memberID)) { + if ($type === "avatars" || $type === "heads") { + return getSystemMember($systemID, $memberID)["avatar_url"]; + } else { + return getSystemMember($systemID, $memberID)["banner"]; + } + } else { + $system = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $systemID . "/general.json"), true); + + if ($type === "avatars" || $type === "heads") { + return $system["avatar_url"]; + } else { + return $system["banner"]; + } + } + } + $app = $GLOBALS["ColdHazeApp"] ?? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); $systemFile = (isset($app["other"]) && $systemID === $app["other"]["id"]) ? "other" : $systemID; @@ -660,4 +688,4 @@ if (!function_exists("calculateFullAmount")) { return number_format($total, 2, '.', ','); } } -} \ No newline at end of file +} -- cgit