diff options
Diffstat (limited to 'app.php')
-rw-r--r-- | app.php | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -2,7 +2,7 @@ ob_start(); -//if (true) { +//if (false) { if (!str_starts_with($_SERVER['REQUEST_URI'], "/api")) { require_once $_SERVER['DOCUMENT_ROOT'] . "/error.php"; set_error_handler("ch_error"); @@ -88,16 +88,22 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) { } else { $namesCloudburst = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true)), "unknown-cb"]; + }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true), function ($i) { + return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json"); + })), "unknown-cb"]; $namesRaindrops = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true)), "unknown-rd"]; + }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), function ($i) { + return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json"); + })), "unknown-rd"]; $namesOther = []; if ($isLoggedIn || $isLowerLoggedIn) { $namesOther = [...array_map(function ($i) { return $i['name']; - }, json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true)), $app["other"]["unknown"]]; + }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true), function ($i) { + return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json"); + })), $app["other"]["unknown"]]; } if ((in_array($toplevel, $namesCloudburst) || in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther)) && $toplevel !== "unknown") { |