diff options
Diffstat (limited to 'includes/functions.inc')
-rw-r--r-- | includes/functions.inc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/includes/functions.inc b/includes/functions.inc index 386d2b2..c3ec313 100644 --- a/includes/functions.inc +++ b/includes/functions.inc @@ -21,6 +21,23 @@ if (!function_exists("getAsset")) { } $id = $id1 . $id2; + + if (str_ends_with(getMemberWithoutSystem($memberID)["name"], "-travelling")) { + $id1 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/general.json"), true)["uuid"]); + + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($systemID === "gdapd" ? "ynmuc" : "gdapd") . "/members.json"), true); + $list = array_map(function ($i) { + return $i["name"]; + }, $members); + + if (in_array(substr(getMemberWithoutSystem($memberID)["name"], 0, -11), $list)) { + $id2 = preg_replace("/^([\da-f]{8})-([\da-f]{4})-([\da-f]{4})-([\da-f]{4})-([\da-f]{12})$/", "$1$2$3$4$5", getMemberFromName(substr(getMemberWithoutSystem($memberID)["name"], 0, -11))["uuid"]); + } else { + return "/error/nomember/?s=$systemID&m=$memberID&t=$type"; + } + + $id = $id1 . $id2; + } } else { $id = $id1; } @@ -457,7 +474,7 @@ if (!function_exists("getMemberFromName")) { $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 ($item["name"] === $name) return getMemberWithoutSystem($item["id"]); } } } |