');
}
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 !(isset($travelling[$i['id']]) && $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 isset($travelling[$i['id']]) && $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 = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"];
$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];
return "{$difference} {$period} {$tense}";
}
}
if (!function_exists("timeIn")) {
function timeIn($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 = $time - $now;
if ($difference <= 10 && $difference >= 0) {
return $tense = "now";
} elseif ($difference > 0) {
$tense = "in";
} else {
$tense = "ago";
}
for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
$difference /= $lengths[$j];
}
$difference = round($difference);
$period = $periods[$j] . ($difference >1 ? "s" :'');
return "{$tense} {$difference} {$period}";
}
}
if (!function_exists("duration")) {
function duration($seconds) {
if ($seconds >= 60) {
if (floor($seconds / 60) >= 60) {
if (floor($seconds / 3600) >= 24) {
$days = floor($seconds / 86400);
return $days . " day" . ($days > 1 ? "s" : "");
} else {
$hours = floor($seconds / 3600);
return $hours . " hour" . ($hours > 1 ? "s" : "");
}
} else {
$minutes = floor($seconds / 60);
return $minutes . " minute" . ($minutes > 1 ? "s" : "");
}
} else {
return $seconds . " seconds";
}
}
}
if (!function_exists("relativeDate")) {
function relativeDate($date, $showTime = true) {
if (!is_numeric($date)) $date = strtotime($date);
if (!$showTime) {
if (date('Y-m-d', $date) === date('Y-m-d')) {
return "today";
} elseif (date('Y-m-d', $date) === date('Y-m-d', time() + 86400)) {
return "tomorrow";
} elseif ($date < time() + 518400) {
return date('l', $date);
} else {
return date('D j M', $date);
}
} else {
if (date('Y-m-d', $date) === date('Y-m-d')) {
return "today,
" . date('H:i', $date) . "";
} elseif (date('Y-m-d', $date) === date('Y-m-d', time() + 86400)) {
return "tomorrow,
" . date('H:i', $date) . "";
} elseif ($date < time() + 518400) {
return date('l', $date) . ",
" . date('H:i', $date) . "";
} else {
return date('D j M', $date) . ",
" . date('H:i', $date) . "";
}
}
}
}
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;
}
}
}