diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
commit | 6b796258d413f00e498ce7f80f73a9f6c061f29c (patch) | |
tree | 49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /includes/util/score.inc | |
parent | 5860551daa0f60103ad24e93da29f401a653f144 (diff) | |
download | pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2 pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip |
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'includes/util/score.inc')
-rw-r--r-- | includes/util/score.inc | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/includes/util/score.inc b/includes/util/score.inc deleted file mode 100644 index c7d47de..0000000 --- a/includes/util/score.inc +++ /dev/null @@ -1,147 +0,0 @@ -<?php - -function scoreOrder($members, $system, $useDominant = false) { - global $defaultMember; - global $isLowerLoggedIn; - global $isLoggedIn; - - $ordered = []; - foreach ($members as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling")) { - if (isset($member["color"])) { - if ($useDominant) { - $rgb = [ - hexdec(substr($member["dominant_color"] ?? $member["color"], 0, 2)), - hexdec(substr($member["dominant_color"] ?? $member["color"], 2, 2)), - hexdec(substr($member["dominant_color"] ?? $member["color"], 4, 2)) - ]; - } else { - $rgb = [ - hexdec(substr($member["color"], 0, 2)), - hexdec(substr($member["color"], 2, 2)), - hexdec(substr($member["color"], 4, 2)) - ]; - } - - $hsl = rgbToHsl( - $rgb[0], - $rgb[1], - $rgb[2] - ); - } else { - $hsl = rgbToHsl(255, 255, 255); - } - - $systemID = $member["system"] ?? $system; - - $member["_system"] = $member["system"] = $systemID; - $member["_metadata"] = parseMetadata(json_decode(file_get_contents_or_defaults($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json", $defaultMember), true)); - $member["_score"] = $hsl[0]; - - if (!isset($member["_metadata"]["private"]) || !$member["_metadata"]["private"] || $isLoggedIn || $isLowerLoggedIn) { - $ordered[] = $member; - } - } - } - - uasort($ordered, function($a, $b) { - return $a["_score"] - $b["_score"]; - }); - - return $ordered; -} - -function scoreOrderGlobal() { - global $defaultMember; - global $isLowerLoggedIn; - global $isLoggedIn; - - $ordered = []; - - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling")) { - if (isset($member["color"])) { - $rgb = [ - hexdec(substr($member["color"], 0, 2)), - hexdec(substr($member["color"], 2, 2)), - hexdec(substr($member["color"], 4, 2)) - ]; - $hsl = rgbToHsl( - $rgb[0], - $rgb[1], - $rgb[2] - ); - } else { - $hsl = rgbToHsl(255, 255, 255); - } - $member["_score"] = $hsl[0]; - $member["_system"] = "hrbom"; - $member["system"] = "hrbom"; - $member["_metadata"] = parseMetadata(json_decode(file_get_contents_or_defaults($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json", $defaultMember), true)); - - if (!isset($member["_metadata"]["private"]) || !$member["_metadata"]["private"] || $isLoggedIn || $isLowerLoggedIn) { - $ordered[] = $member; - } - } - } - - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling")) { - if (isset($member["color"])) { - $rgb = [ - hexdec(substr($member["color"], 0, 2)), - hexdec(substr($member["color"], 2, 2)), - hexdec(substr($member["color"], 4, 2)) - ]; - $hsl = rgbToHsl( - $rgb[0], - $rgb[1], - $rgb[2] - ); - } else { - $hsl = rgbToHsl(255, 255, 255); - } - $member["_score"] = $hsl[0]; - $member["_system"] = "gdapd"; - $member["system"] = "gdapd"; - $member["_metadata"] = parseMetadata(json_decode(file_get_contents_or_defaults($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json", $defaultMember), true)); - - if (!isset($member["_metadata"]["private"]) || !$member["_metadata"]["private"] || $isLoggedIn || $isLowerLoggedIn) { - $ordered[] = $member; - } - } - } - - if ($isLowerLoggedIn || $isLoggedIn) { - $app = $GLOBALS["ColdHazeApp"] ?? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true) as $member) { - if ($member["name"] !== "unknown" && $member["name"] !== "fusion" && $member["name"] !== "new" && !str_starts_with($member["name"], "smol") && !str_ends_with($member["name"], "-travelling")) { - if (isset($member["color"])) { - $rgb = [ - hexdec(substr($member["color"], 0, 2)), - hexdec(substr($member["color"], 2, 2)), - hexdec(substr($member["color"], 4, 2)) - ]; - $hsl = rgbToHsl( - $rgb[0], - $rgb[1], - $rgb[2] - ); - } else { - $hsl = rgbToHsl(255, 255, 255); - } - $member["_score"] = $hsl[0]; - $member["_system"] = $app["other"]["id"]; - $member["system"] = $app["other"]["id"]; - $member["_metadata"] = parseMetadata(json_decode(file_get_contents_or_defaults($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$member[id].json", $defaultMember), true)); - $ordered[] = $member; - } - } - } - - uasort($ordered, function($a, $b) { - return $a["_score"] - $b["_score"]; - }); - - return array_values($ordered); -} |