');
}
if (!$hideTitle) echo('
' . $name . '
');
if ($hideTitle) {
echo('
');
} else {
echo('
');
}
showMembersFromList(scoreOrder([...array_map(function ($i) use ($id) {
$i["travelling"] = false;
$i["system"] = $id;
return $i;
}, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id-members.json"), true), function ($i) use ($travelling) {
return !$travelling[$i['id']]['travelling'];
})), ...array_map(function ($i) use ($id) {
$i["travelling"] = true;
$i["system"] = ($id === "gdapd" ? "ynmuc" : "gdapd");
return $i;
}, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($id === "gdapd" ? "ynmuc" : "gdapd") . "-members.json"), true), function ($i) use ($travelling) {
return $travelling[$i['id']]['travelling'];
}))], $id));
echo('
');
}
}
if (!function_exists("cloudburst")) {
function cloudburst(bool $hideTitle): void {
showSystem("ynmuc", "Cloudburst System", "#5f08a9a6", $hideTitle);
}
}
if (!function_exists("raindrops")) {
function raindrops(bool $hideTitle): void {
showSystem("gdapd", "Raindrops System", "#a95f08a6", $hideTitle);
}
}
if (!function_exists("getMember")) {
function getMember(string $id) {
global $systemID;
$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true);
$member = null;
foreach ($members as $m) {
if ($m["id"] === $id) $member = $m;
}
return $member;
}
}
if (!function_exists("timeAgo")) {
function timeAgo($time): string {
if (!is_numeric($time)) {
$time = strtotime($time);
}
$periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"];
$lengths = array("60", "60", "24", "7", "4.35", "12", "100");
$now = time();
$difference = $now - $time;
if ($difference <= 10 && $difference >= 0) {
return $tense = "now";
} elseif ($difference > 0) {
$tense = "ago";
} else {
$tense = "later";
}
for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
$difference /= $lengths[$j];
}
$difference = round($difference);
$period = $periods[$j] . ($difference >1 ? "s" :'');
return "{$difference} {$period} {$tense}";
}
}
if (!function_exists("getMemberSystem")) {
function getMemberSystem(string $id) {
$list = scoreOrderGlobal();
foreach ($list as $item) {
if ($item["id"] === $id) return $item["_system"];
}
}
}
if (!function_exists("getMemberFromName")) {
function getMemberFromName(string $name) {
$list = [...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), ...json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)];
foreach ($list as $item) {
if ($item["name"] === $name) return $item;
}
}
}
if (!function_exists("resolveMember")) {
function resolveMember(mixed $name) {
if (is_string($name)) {
if (str_ends_with($name, "-travelling")) {
return substr($name, 0, strlen($name) - 11);
} else {
return $name;
}
} else {
return $name;
}
}
}