diff options
Diffstat (limited to 'includes/components/header.inc')
-rw-r--r-- | includes/components/header.inc | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/includes/components/header.inc b/includes/components/header.inc new file mode 100644 index 0000000..7c4cfc8 --- /dev/null +++ b/includes/components/header.inc @@ -0,0 +1,220 @@ +<?php global $title; global $pages; + +$useNewUI = !isset($_GET['old']); +$readOnly = false; +file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test", "hello"); + +if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test")) { + unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/data/.test"); +} else { + $readOnly = true; +} + +$isNormallyLoggedIn = false; + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; +if ($readOnly && $isLoggedIn || $readOnly && $isUserLoggedIn) { + $isLoggedIn = false; + $isUserLoggedIn = false; + $isNormallyLoggedIn = true; +} + +$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); + +if (!function_exists("error")) { + function error($errno, $errstr, $file, $line) { + echo(' + <!-- -->"> + <div class="alert alert-danger" style="text-align: left;"> + <b>Error ' . $errno . ':</b> ' . $errstr . ' [' . $file . ':' . $line . '] + </div>'); + } +} + +if (isset($_GET['errors'])) { + ini_set('display_errors', '1'); + ini_set('display_startup_errors', '1'); + error_reporting(E_ALL); + set_error_handler("error", E_ALL); +} + +global $_MemberName; +global $_MemberPage; +global $_SystemName; +global $_SystemPage; +global $toplevel; + +$pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); +$page = $pages[$toplevel] ?? [ + "rail" => false +]; + +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/pronouns.inc"; +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; + +?> +<!doctype html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link href="/assets/logo/custom.css" rel="stylesheet"> + <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 !== "-" ? $title . " ยท " : "" ?>Cold Haze</title> + <link rel="shortcut icon" href="/assets/logo/newlogo<?= $isLoggedIn || $isLowerLoggedIn ? "3" : "" ?>.png" type="image/png"> +</head> +<body<?php if ($page["rail"] && $isLoggedIn && !$useNewUI): ?> id="admin-page"<?php endif; ?>> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/navigation.inc"; global $navigation; ?> + + <?php if (!$useNewUI): ?> + <div style="margin-top: 60px;" id="top-of-page"></div> + <?php endif; ?> + + <?php if ($useNewUI): ?> + <aside id="navigation-pane"> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/pane.inc"; ?> + </aside> + + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/mobilenav.inc"; ?> + + <style> + body { + margin-left: 300px; + } + + .modal.show { + left: 300px; + width: calc(100% - 300px); + } + + nav { + display: none !important; + } + + #navigation-pane { + z-index: 9999; + background: black; + position: fixed; + top: 0; + left: 0; + bottom: 0; + width: 300px; + border-right: 1px solid rgba(255, 255, 255, .25); + overflow: auto; + } + + #title-bar { + position: fixed; + top: 0; + left: 300px; + right: 0; + height: 34px; + background: rgba(0, 0, 0, .75); + z-index: 9999; + padding: 5px; + text-align: center; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-bottom: 1px solid rgba(255, 255, 255, .25); + } + + #mobile-navigation { + display: none; + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 48px; + background: rgba(0, 0, 0, .75); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-top: 1px solid rgba(255, 255, 255, .25); + z-index: 999999; + } + + @media (max-width: 1360px) { + .modal.show { + left: 250px !important; + width: calc(100% - 250px) !important; + } + + #title-bar { + left: 250px !important; + } + + #navigation-pane { + width: 250px !important; + } + + body { + margin-left: 250px !important; + } + + #system-banner-container, #member-banner-container { + width: 100% !important; + } + } + + @media (max-width: 1300px) { + .modal.show { + left: 200px !important; + width: calc(100% - 200px) !important; + } + + #title-bar { + left: 200px !important; + } + + #navigation-pane { + width: 200px !important; + } + + body { + margin-left: 200px !important; + } + } + + @media (max-width: 1195px) { + .modal.show { + left: 0 !important; + width: 100% !important; + } + + #title-bar { + left: 0 !important; + } + + #navigation-pane { + display: none !important; + } + + body { + margin-left: 0 !important; + } + + #mobile-navigation { + display: block !important; + } + } + + @media (max-width: 700px) { + #title-bar-parts-mobile { + display: inline !important; + } + + #title-bar-parts-desktop { + display: none; + } + + #title-bar { + text-align: left; + } + } + </style> + <?php endif; ?> |