diff options
Diffstat (limited to 'includes/components/navigation.inc')
-rw-r--r-- | includes/components/navigation.inc | 448 |
1 files changed, 0 insertions, 448 deletions
diff --git a/includes/components/navigation.inc b/includes/components/navigation.inc deleted file mode 100644 index 1d24dea..0000000 --- a/includes/components/navigation.inc +++ /dev/null @@ -1,448 +0,0 @@ -<?php - -global $use2023UI; -$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); - -global $navigation; -global $toplevel; -global $lang; global $pages; global $app; global $isLowerLoggedIn; global $isLoggedIn; - -if (!$use2023UI) { - - $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/navigation.json"), true); - - if (!isset($cache["raindrops"])) $cache["raindrops"] = []; - if (!isset($cache["cloudburst"])) $cache["cloudburst"] = []; - if (!isset($cache["other"])) $cache["other"] = []; - - foreach ([ - [ - "name" => "raindrops", - "id" => "gdapd" - ], - [ - "name" => "cloudburst", - "id" => "ynmuc" - ], - [ - "name" => "other", - "id" => $app["other"]["id"] - ] - ] as $cacheSystem) { - if (!isset($cache[$cacheSystem["name"]]["public"])) { - $isLoggedInOldState = $isLoggedIn; - $isLowerLoggedInOldState = $isLowerLoggedIn; - - $isLoggedIn = false; - $isLowerLoggedIn = false; - - $cache[$cacheSystem["name"]]["public"] = array_map(function ($member) { - return [ - "name" => $member['display_name'] ?? $member['name'], - "icon" => getAsset($member["system"], $member["id"], "heads"), - "invert" => false, - "link" => "/$member[name]", - "stepped" => null, - "private" => false - ]; - }, array_filter(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$cacheSystem[id]/members.json"), true), "$cacheSystem[id]"), "$cacheSystem[id]"), function ($member) { - return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; - })); - - $isLoggedIn = $isLoggedInOldState; - $isLowerLoggedIn = $isLowerLoggedInOldState; - } - - if (!isset($cache[$cacheSystem["name"]]["private"])) { - $isLoggedInOldState = $isLoggedIn; - $isLowerLoggedInOldState = $isLowerLoggedIn; - - $isLoggedIn = true; - $isLowerLoggedIn = false; - - $cache[$cacheSystem["name"]]["private"] = array_map(function ($member) { - return [ - "name" => $member['display_name'] ?? $member['name'], - "icon" => getAsset($member["system"], $member["id"], "heads"), - "invert" => false, - "link" => "/$member[name]", - "stepped" => null, - "private" => false - ]; - }, array_filter(scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$cacheSystem[id]/members.json"), true), "$cacheSystem[id]"), "$cacheSystem[id]"), function ($member) { - return $member['name'] !== "unknown" && $member['name'] !== "fusion" && $member['name'] !== "new"; - })); - - $isLoggedIn = $isLoggedInOldState; - $isLowerLoggedIn = $isLowerLoggedInOldState; - } - } - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/navigation.json", json_encode($cache)); - - $navigation_admin = [ - "admin" => !$isLowerLoggedIn, - "name" => "Private utilities", - "icon" => "/assets/icons/admin.svg", - "invert" => true, - "items" => [ - "alerts" => [ - "name" => null, - "minimal" => true, - "items" => [ - [ - "name" => $pages["emergency"]["name"][$lang["_name"]], - "icon" => "/assets/icons/emergency.svg", - "invert" => false, - "link" => "/-/emergency", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["wakeup"]["name"][$lang["_name"]], - "icon" => "/assets/icons/wakeup.svg", - "invert" => false, - "link" => "/-/wakeup", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["pleasure"]["name"][$lang["_name"]], - "icon" => "/assets/icons/pleasure.svg", - "invert" => false, - "link" => "/-/pleasure", - "stepped" => null, - "private" => false - ] - ] - ], - "apps" => [ - "name" => $lang["navigation"]["apps"], - "minimal" => false, - "items" => [ - time() >= 1686787200 ? null : [ - "name" => "Front planner<span class='badge bg-warning text-black rounded-pill' style='position:relative;top:-1px; margin-left: 5px;'>EOL</span>", - "icon" => "/assets/icons/fronting.svg", - "invert" => true, - "link" => "/-/fronting", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["evening"]["name"][$lang["_name"]] . (time() >= 1686787200 ? "" : "<span class='badge bg-info text-black rounded-pill' style='position:relative;top:-1px; margin-left: 5px;'>Beta</span>"), - "icon" => "/assets/icons/evening.svg", - "invert" => true, - "link" => "/-/evening", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["profiles"]["name"][$lang["_name"]], - "icon" => "/assets/icons/profiles.svg", - "invert" => true, - "link" => "/-/profiles", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["money"]["name"][$lang["_name"]], - "icon" => "/assets/icons/money.svg", - "invert" => true, - "link" => "/-/money", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["contacts"]["name"][$lang["_name"]], - "icon" => "/assets/icons/contacts.svg", - "invert" => true, - "link" => "/-/contacts", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["schedules"]["name"][$lang["_name"]], - "icon" => "/assets/icons/schedules.svg", - "invert" => true, - "link" => "/-/schedules", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["docs"]["name"][$lang["_name"]], - "icon" => "/assets/icons/docs.svg", - "invert" => true, - "link" => "/-/docs", - "stepped" => null, - "private" => true - ], - time() >= 1688169600 ? null : [ - "name" => "Devices<span class='badge bg-warning text-black rounded-pill' style='position:relative;top:-1px; margin-left: 5px;'>EOL</span>", - "icon" => "/assets/icons/computers.svg", - "invert" => true, - "link" => "/-/computers", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["travelling"]["name"][$lang["_name"]], - "icon" => "/assets/icons/travelling.svg", - "invert" => true, - "link" => "/-/travelling", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["stats"]["name"][$lang["_name"]], - "icon" => "/assets/icons/stats.svg", - "invert" => true, - "link" => "/-/stats", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["pair"]["name"][$lang["_name"]], - "icon" => "/assets/icons/pair.svg", - "invert" => true, - "link" => "/-/pair", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["sessions"]["name"][$lang["_name"]], - "icon" => "/assets/icons/sessions.svg", - "invert" => true, - "link" => "/-/sessions", - "stepped" => null, - "private" => true - ], - [ - "name" => $pages["logout"]["name"][$lang["_name"]], - "icon" => "/assets/icons/logout.svg", - "invert" => true, - "link" => "/-/logout", - "stepped" => null, - "private" => false - ] - ] - ], - "sort" => [ - "name" => "Sorted members lists", - "minimal" => false, - "items" => [ - [ - "name" => $pages["splitting"]["name"][$lang["_name"]], - "icon" => "/assets/icons/splitting.svg", - "invert" => true, - "link" => "/-/splitting", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["byfront"]["name"][$lang["_name"]], - "icon" => "/assets/icons/byfront.svg", - "invert" => true, - "link" => "/-/byfront", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["alphabet"]["name"][$lang["_name"]], - "icon" => "/assets/icons/alphabet.svg", - "invert" => true, - "link" => "/-/alphabet", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["s:species"]["name"][$lang["_name"]], - "icon" => "/assets/icons/species.svg", - "invert" => true, - "link" => "/-/byspecies", - "stepped" => null, - "private" => false - ], - ] - ] - ] - ]; - $navigation_global = [ - "admin" => false, - "name" => $lang["navigation"]["general"], - "icon" => "/assets/icons/global.svg", - "invert" => true, - "items" => [ - "main" => [ - "name" => null, - "minimal" => false, - "items" => [ - [ - "name" => $pages["home"]["name"][$lang["_name"]], - "icon" => "/assets/icons/home.svg", - "invert" => true, - "link" => "/", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["relations"]["name"][$lang["_name"]], - "icon" => "/assets/icons/relations.svg", - "invert" => true, - "link" => "/-/relations", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["terminology"]["name"][$lang["_name"]], - "icon" => "/assets/icons/terminology.svg", - "invert" => true, - "link" => "/-/terminology", - "stepped" => null, - "private" => false - ] - ] - ] - ] - ]; - $navigation_cloudburst = [ - "admin" => false, - "name" => "Cloudburst System", - "icon" => getAsset("ynmuc"), - "invert" => false, - "items" => [ - "header" => [ - "name" => null, - "minimal" => false, - "items" => [ - [ - "name" => $lang["navigation"]["about"], - "icon" => "/assets/icons/about.svg", - "invert" => true, - "link" => "/cloudburst", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["s:history"]["name"][$lang["_name"]], - "icon" => "/assets/icons/history.svg", - "invert" => true, - "link" => "/cloudburst/-/history", - "stepped" => null, - "private" => false - ] - ] - ], - "members" => [ - "name" => $lang["navigation"]["members"], - "minimal" => false, - "items" => $cache["cloudburst"][$isLoggedIn || $isLowerLoggedIn ? "private" : "public"] - ] - ] - ]; - $navigation_other = [ - "admin" => !$isLowerLoggedIn, - "name" => $app["other"]["name"], - "icon" => getAsset($app["other"]["id"]), - "invert" => false, - "items" => [ - "header" => [ - "name" => null, - "minimal" => false, - "items" => [ - [ - "name" => $lang["navigation"]["about"], - "icon" => "/assets/icons/about.svg", - "invert" => true, - "link" => "/" . $app["other"]["slug"], - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["s:history"]["name"][$lang["_name"]], - "icon" => "/assets/icons/history.svg", - "invert" => true, - "link" => "/" . $app["other"]["slug"] . "/-/history", - "stepped" => null, - "private" => false - ] - ] - ], - "members" => [ - "name" => $lang["navigation"]["members"], - "minimal" => false, - "items" => $cache["other"][$isLoggedIn || $isLowerLoggedIn ? "private" : "public"] - ] - ] - ]; - $navigation_raindrops = [ - "admin" => false, - "name" => "Raindrops System", - "icon" => getAsset("gdapd"), - "invert" => false, - "items" => [ - "header" => [ - "name" => null, - "minimal" => false, - "items" => [ - [ - "name" => $lang["navigation"]["about"], - "icon" => "/assets/icons/about.svg", - "invert" => true, - "link" => "/raindrops", - "stepped" => null, - "private" => false - ], - [ - "name" => $pages["s:history"]["name"][$lang["_name"]], - "icon" => "/assets/icons/history.svg", - "invert" => true, - "link" => "/raindrops/-/history", - "stepped" => null, - "private" => false - ] - ] - ], - "members" => [ - "name" => $lang["navigation"]["members"], - "minimal" => false, - "items" => $cache["raindrops"][$isLoggedIn || $isLowerLoggedIn ? "private" : "public"] - ] - ] - ]; - - global $parts; - - if (isset($parts) && isset($parts[0]) && $parts[0] === $app["other"]["slug"]) { - $navigation = [ - "other" => $navigation_other, - "cloudburst" => $navigation_cloudburst, - "raindrops" => $navigation_raindrops, - "admin" => $navigation_admin, - "global" => $navigation_global - ]; - } elseif (isset($parts) && isset($parts[0]) && $parts[0] === "cloudburst") { - $navigation = [ - "cloudburst" => $navigation_cloudburst, - "raindrops" => $navigation_raindrops, - "other" => $navigation_other, - "admin" => $navigation_admin, - "global" => $navigation_global - ]; - } elseif (isset($parts) && isset($parts[0]) && $parts[0] === "raindrops") { - $navigation = [ - "raindrops" => $navigation_raindrops, - "cloudburst" => $navigation_cloudburst, - "other" => $navigation_other, - "admin" => $navigation_admin, - "global" => $navigation_global - ]; - } else { - $navigation = [ - "admin" => $navigation_admin, - "global" => $navigation_global, - "cloudburst" => $navigation_cloudburst, - "raindrops" => $navigation_raindrops, - "other" => $navigation_other, - ]; - } -}
\ No newline at end of file |