$scoreHost, "fictive" => $scoreFictive, "little" => $scoreLittle, "median" => $scoreMedian, "not_talking" => $scoreNotTalking, "name" => $scoreName, "protector" => $scoreProtector, "shared_memory" => $scoreSharedMemory, "relations" => $scoreRelations, "species" => $scoreSpecies, "total" => $score ]; } function scoreOrder($members, $system) { $ordered = []; foreach ($members as $member) { if ($member["name"] !== "unknown") { $systemID = $member["system"] ?? $system; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$member[id]-metadata.json"), true)); $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-$member[id]-metadata.json"), true)), $member["display_name"] ?? $member["name"]); $ordered[] = $member; } } uasort($ordered, function($a, $b) { return $b["_score"]["total"] - $a["_score"]["total"]; }); return $ordered; } function scoreOrderGlobal() { $ordered = []; foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true) as $member) { if ($member["name"] !== "unknown") { $member["_system"] = "gdapd"; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)); $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true)), $member["display_name"] ?? $member["name"]); $ordered[] = $member; } } foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true) as $member) { if ($member["name"] !== "unknown") { $member["_system"] = "ynmuc"; $member["_metadata"] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)); $member["_score"] = calculateScore(parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true)), $member["display_name"] ?? $member["name"]); $ordered[] = $member; } } uasort($ordered, function($a, $b) { return $b["_score"]["total"] - $a["_score"]["total"]; }); return $ordered; }