diff options
author | Minteck <contact@minteck.org> | 2022-08-21 17:31:56 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-21 17:31:56 +0200 |
commit | a2df9a69dcc14cb70118cda2ded499055e7ee358 (patch) | |
tree | 6dd283e4e9452d38bce81ddaaae49b5335755842 /includes/header.php | |
parent | 84dd0735820b16b60f600284d35183d76547a71f (diff) | |
download | pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2 pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip |
m. update
Diffstat (limited to 'includes/header.php')
-rw-r--r-- | includes/header.php | 189 |
1 files changed, 152 insertions, 37 deletions
diff --git a/includes/header.php b/includes/header.php index af12bcb..59c64b7 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,7 +1,23 @@ <?php global $title; +function error($errno, $errstr, $file, $line) { ?> + <!-- -->"> + <div class="alert alert-danger" style="text-align: left;"> + <b>Error <?= $errno ?>:</b> <?= $errstr ?> [<?= $file ?>:<?= $line ?>] + </div> +<?php } + +if (isset($_GET['errors'])) { + set_error_handler("error"); +} + +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/travelling.php"; global $travelling; require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/score.php"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/pronouns.php"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/bitset.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rainbow.php"; function getMiniName(string $name) { $parts = explode(" ", $name); @@ -46,10 +62,10 @@ function getBrightness(string $hexCode) { function showMembersFromList(array $list, string $id) { foreach ($list as $member) { if ($member['name'] !== "unknown") { echo('<!-- ' . ($member['display_name'] ?? $member['name']) . ' --> -<a href="/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;"><div> -<img alt="" src="/assets/uploads/pt' . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "") . '.png" style="height:48px;display:block;margin-left:auto;margin-right:auto;"> +<a href="/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border:1px solid ' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';outline-color:' . (isset($member['color']) ? "#" . $member['color'] . "55" : "transparent") . ';border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;"><div> +<img alt="" src="' . $member['avatar_url'] . '" style="border-radius:999px;background-color:rgba(0, 0, 0, .25);height:48px;display:block;margin-left:auto;margin-right:auto;"> <div style="text-decoration:none;color:white;margin-top:5px;">' . ($member['display_name'] ?? $member['name']) . '</div> -<div style="text-decoration:none !important;color:black !important;"><code style="text-decoration:none !important;color:white !important;">' . $member['proxy_tags'][0]['prefix'] . '</code></div> +<div style="text-decoration:none !important;color:black !important;"><code style="text-decoration:none !important;color:white !important;">' . ($member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '</code></div> </div></div></a>'); }} } @@ -71,6 +87,8 @@ function showSubsystem(array $data, string $parentSystem) { } function showSystem(string $id, string $name, string $color, bool $hideTitle) { + global $travelling; + if ($hideTitle) { echo('<!-- ' . $name . ' --> <div id="hpd-' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">'); @@ -78,10 +96,9 @@ function showSystem(string $id, string $name, string $color, bool $hideTitle) { echo('<!-- ' . $name . ' --> <div id="hpd-' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px 10px 10px 20px;display:grid;grid-template-columns: 128px 1fr;margin-bottom:10px;">'); } - if (!$hideTitle) echo('<!-- System Name --> <a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: ' . $color . ';width: 148px;text-decoration:none;color:white;filter:none !important;" href="/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" class="hpd-system"> -' . $name . ' +<div style="text-align:center;"><img src="/assets/uploads/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '.png" style="width:64px;"><br>' . $name . '</div> </a>'); if ($hideTitle) { @@ -90,7 +107,19 @@ function showSystem(string $id, string $name, string $color, bool $hideTitle) { echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);padding-left:10px;grid-gap:10px;">'); } - showMembersFromList(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id-members.json"), true), $id), $id); + 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), $id); echo('</div> @@ -114,7 +143,7 @@ function raindrops(bool $hideTitle): void { <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> <title><?= $title ? $title . " ยท " : "" ?>Cuties and Plurality</title> - <link rel="shortcut icon" href="/assets/uploads/logo.jpg" type="image/jpg"> + <link rel="shortcut icon" href="/assets/logo/logo.png" type="image/png"> <style> nav.navbar { background-color: black !important; @@ -134,6 +163,26 @@ function raindrops(bool $hideTitle): void { background-color: rgba(255, 255, 255, .2) !important; } + .hpd-system { + transition: opacity 200ms; + } + + .hpd-item-card { + outline-style: solid; + outline-width: 0; + transition: background-color 200ms, outline-width 200ms; + } + + .hpd-item-card:hover { + outline-style: solid; + outline-width: 4px; + } + + .hpd-item-card:active { + outline-style: solid; + outline-width: 6px; + } + .hpd-system:hover { opacity: .9 !important; } @@ -302,10 +351,11 @@ function raindrops(bool $hideTitle): void { color: white !important; text-decoration: none !important; cursor: pointer; + transition: background 200ms; } .system-action:hover { - background:rgba(255, 255, 255, .1); + background: rgba(255, 255, 255, .1); } .table-dark { @@ -598,12 +648,27 @@ function raindrops(bool $hideTitle): void { .tree-inner { display: inline-block; } + + .navbar-collapse.collapse.show, .navbar-collapse.collapsing { + background: black; + margin: 7px -12px; + padding: 0 12px; + border-bottom: 1px solid rgba(255, 255, 255, .25); + } + + .rainbow-item:hover { + opacity: .75; + } + + .rainbow-item:active { + opacity: .5; + } </style> </head> <body> - <nav class="navbar navbar-expand-md bg-dark navbar-dark"> + <nav class="navbar navbar-expand-<?= $isLoggedIn ? 'lg' : 'md' ?> bg-dark navbar-dark" style="height:60px;"> <div class="container-fluid"> - <a class="navbar-brand" href="/"><img src="/assets/uploads/logo.jpg" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> <span style="vertical-align: middle;">Cuties and Plurality</span><a> + <a class="navbar-brand" href="/"><img src="/assets/logo/logo.png" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> <span style="vertical-align: middle;">Cuties and Plurality</span><a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#collapsibleNavbar"> <span class="navbar-toggler-icon"></span> </button> @@ -611,66 +676,99 @@ function raindrops(bool $hideTitle): void { <ul class="navbar-nav"> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> - <img src="<?= $isLoggedIn ? "/assets/icons/loggedin.svg" : "/assets/icons/global.svg" ?>" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <img src="/assets/icons/global.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Global</span> </a> <ul class="dropdown-menu"> - <?php if ($isLoggedIn): ?> - <li><a class="dropdown-item" href="/emergency"> - <img src="/assets/icons/emergency.svg" alt="" style="width:24px;vertical-align: middle;"> - <span class="text-danger" style="vertical-align: middle;">Emergency Alert</span> - </a></li> - <li><hr class="dropdown-divider"></li> - <?php endif; ?> <li><a class="dropdown-item" href="/"> <img src="/assets/icons/home.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Home</span> </a></li> - <li><a class="dropdown-item" href="/disclaimers"> + <li><a class="dropdown-item" href="/-/disclaimers"> <img src="/assets/icons/disclaimers.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Disclaimers</span> </a></li> - <li><a class="dropdown-item" href="/relations"> + <li><a class="dropdown-item" href="/-/relations"> <img src="/assets/icons/relations.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Relations</span> </a></li> - <li><a class="dropdown-item" href="/terminology"> + <li><a class="dropdown-item" href="/-/terminology"> <img src="/assets/icons/terminology.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Terminology</span> </a></li> <li><hr class="dropdown-divider"></li> <li><h5 class="dropdown-header">Tools</h5></li> - <li><a class="dropdown-item" href="/parser"> + <li><a class="dropdown-item" href="/-/parser"> <img src="/assets/icons/parser.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Message Parser</span> </a></li> - <li><a class="dropdown-item" href="/prefix"> + <li><a class="dropdown-item" href="/-/prefix"> <img src="/assets/icons/prefix.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Prefix Generator</span> </a></li> + <?php if (!$isLoggedIn): ?> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header">Administrator</h5></li> + <li><a class="dropdown-item" href="/-/login"> + <img src="/assets/icons/login.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Login</span> + </a></li> + <?php else: ?> <li><hr class="dropdown-divider"></li> <li><h5 class="dropdown-header">Administrator</h5></li> - <?php if ($isLoggedIn): ?> - <li><a class="dropdown-item" href="/fronting"> + <li><a class="dropdown-item disabled" href="#" style="opacity:.5;"> + <img src="/assets/icons/right.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">See menu</span> + </a></li> + <?php endif; ?> + </ul> + </li> + <?php if ($isLoggedIn): ?> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> + <img src="/assets/icons/admin.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Administrator</span> + </a> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="/-/emergency"> + <img src="/assets/icons/emergency.svg" alt="" style="width:24px;vertical-align: middle;"> + <span class="text-danger" style="vertical-align: middle;">Emergency Alert</span> + </a></li> + <li><hr class="dropdown-divider"></li> + + <li><h5 class="dropdown-header">Applications</h5></li> + <li><a class="dropdown-item" href="/-/fronting"> <img src="/assets/icons/fronting.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Front Planner</span> </a></li> - <li><a class="dropdown-item" href="/score"> + <li><a class="dropdown-item" href="/-/together"> + <img src="/assets/icons/together.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Watch Together</span> + </a></li> + <li><a class="dropdown-item" href="/-/travelling"> + <img src="/assets/icons/travel.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">System Travelling</span> + </a></li> + <li><hr class="dropdown-divider"></li> + + <li><h5 class="dropdown-header">Utilities</h5></li> + <li><a class="dropdown-item" href="/-/bitset"> + <img src="/assets/icons/bitset.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Bitset Calculator</span> + </a></li> + <li><a class="dropdown-item" href="/-/score"> <img src="/assets/icons/score.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Score System Testing</span> </a></li> - <li><a class="dropdown-item" href="/logout"> + <li><hr class="dropdown-divider"></li> + + <li><a class="dropdown-item" href="/-/logout"> <img src="/assets/icons/logout.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">Logout</span> </a></li> - <?php else: ?> - <li><a class="dropdown-item" href="/login"> - <img src="/assets/icons/login.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - <span style="vertical-align: middle;">Login</span> - </a></li> - <?php endif; ?> </ul> </li> + <?php endif; ?> <?php if (!isset($emergencyHeader) || !$emergencyHeader): ?> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="/cloudburst" role="button" data-bs-toggle="dropdown"> @@ -682,9 +780,26 @@ function raindrops(bool $hideTitle): void { <img src="/assets/icons/about.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;">About us</span> </a></li> + <?php + + $subsystems = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-subsystems.json"), true); + $subsystemsNotMember = array_values(array_filter($subsystems, function ($i) { + return $i["source_type"] !== "member"; + })); + + if (count($subsystemsNotMember) > 0): ?> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header">Subsystems (<?= count($subsystemsNotMember) ?>)</h5></li> + <?php foreach ($subsystemsNotMember as $subsystem): $ssData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-subsystem-" . $subsystem['source'] . ".json"), true); ?> + <li><a class="dropdown-item" href="/cloudburst/-/subsystem/<?= $subsystem['source'] ?>"> + <img src="/assets/uploads/ss-<?= $subsystem['source'] ?>.png" alt="" style="border-radius:5px;width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;"><?= $ssData['name'] ?? $subsystem['source'] ?></span> + </a></li> + <?php endforeach; ?> + <?php endif; ?> <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Members (<?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)) - 1 ?>)</h5></li> - <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true), "ynmuc") as $member): if ($member['name'] !== "unknown"): ?> + <li><h5 class="dropdown-header">Members (<?= count(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true), "ynmuc")) - 1 ?>)</h5></li> + <?php foreach (scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true), "ynmuc"), "ynmuc") as $member): if ($member['name'] !== "unknown"): ?> <li><a class="dropdown-item" href="/cloudburst/<?= $member['name'] ?>"> <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;"><?= $member['display_name'] ?? $member['name'] ?></span> @@ -703,8 +818,8 @@ function raindrops(bool $hideTitle): void { <span style="vertical-align: middle;">About us</span> </a></li> <li><hr class="dropdown-divider"></li> - <li><h5 class="dropdown-header">Members (<?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)) - 1 ?>)</h5></li> - <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): if ($member['name'] !== "unknown"): ?> + <li><h5 class="dropdown-header">Members (<?= count(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd")) - 1 ?>)</h5></li> + <?php foreach (scoreOrder(withTravelers(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd"), "gdapd") as $member): if ($member['name'] !== "unknown"): ?> <li><a class="dropdown-item" href="/raindrops/<?= $member['name'] ?>"> <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" alt="" style="width:24px;vertical-align: middle;"> <span style="vertical-align: middle;"><?= $member['display_name'] ?? $member['name'] ?></span> |