diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
commit | 6b796258d413f00e498ce7f80f73a9f6c061f29c (patch) | |
tree | 49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /includes/components/header.inc | |
parent | 5860551daa0f60103ad24e93da29f401a653f144 (diff) | |
download | pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2 pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip |
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'includes/components/header.inc')
-rw-r--r-- | includes/components/header.inc | 475 |
1 files changed, 0 insertions, 475 deletions
diff --git a/includes/components/header.inc b/includes/components/header.inc deleted file mode 100644 index 7cf626e..0000000 --- a/includes/components/header.inc +++ /dev/null @@ -1,475 +0,0 @@ -<?php global $title; global $pages; global $readOnly; -$start = microtime(true); -$use2023UI = $useNewUI = true; -global $use2023UI; - -$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); - -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/score.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; - -?> -<!doctype html> -<html lang="en"> -<head> - <script> - document.cookie = "new2023UIDarkMode=" + (window.matchMedia("(prefers-color-scheme: dark)").matches ? "yes" : "no") + "; max-age=" + (60*60*24*365) + "; path=/; samesite; secure"; - </script> - <link href="/assets/logo/custom-2023.css" rel="preload" as="style"> - <link href="/assets/logo/light-2023.css" rel="preload" as="style"> - <link href="/assets/logo/custom-2023.css" rel="stylesheet"> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"> - <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script> - <title><?= $title && $title !== "-" ? $title . " ยท " : "" ?>Ponycule</title> - <link rel="shortcut icon" href="/assets/logo/newlogo-ng.png" type="image/png"> - <link href="/assets/logo/light-2023.css" rel="stylesheet"> -</head> -<body style="background-color: var(--palette-1);"> - <?php - $palettes = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/themes.json"), true); - - $selectedPalette = $palettes["default"]; - - global $memberID; global $systemID; if (isset($memberID) || isset($systemID)) { - if (isset($memberID)) { - $member = getMemberWithoutSystem($memberID); - $color = $member["color"]; - } else { - $systemDataForColor = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID/general.json"), true); - $color = $systemDataForColor["color"] ?? "000000"; - } - - if (isset($_GET["debug"])) { - ob_clean(); - echo("<pre>"); - - echo("Color difference debug\n======================\n\n"); - echo("Color: #" . $member["color"] . "\n\n"); - } - - $sr = hexdec(substr($color, 0, 2)); - $sg = hexdec(substr($color, 2, 2)); - $sb = hexdec(substr($color, 4, 2)); - - $differencesAll = []; - - foreach ($palettes["list"] as $id => $palette) { - $colors = [ - ...explode(",", $palette["dark"]), - ...explode(",", $palette["light"]) - ]; - - $importantColors = [ - $colors[5], - $colors[9], - $colors[15], - $colors[19] - ]; - $differences = []; - - if (isset($_GET["debug"])) echo("Palette " . $id . ": " . implode(", ", array_map(function ($i) { return "#$i"; }, $importantColors)) . "\n"); - - foreach ($importantColors as $color) { - $r = hexdec(substr($color, 0, 2)); - $g = hexdec(substr($color, 2, 2)); - $b = hexdec(substr($color, 4, 2)); - - $dr = abs($r - $sr); - $dg = abs($g - $sg); - $db = abs($b - $sb); - - $differences[] = $dr + $dg + $db; - } - - $total = array_reduce($differences, function ($a, $b) { return $a + $b; }) / count($differences); - - if (isset($_GET["debug"])) { - echo(" " . implode(", ", $differences) . "\n"); - echo(" " . $total . "\n\n"); - } - - $differencesAll[] = [ - "id" => $id, - "difference" => $total - ]; - } - - usort($differencesAll, function ($a, $b) { - return $a["difference"] - $b["difference"]; - }); - - if (isset($_GET["debug"])) { - echo("Smaller: " . $differencesAll[0]["id"] . ", " . $differencesAll[0]["difference"]); - } - - $selectedPalette = $differencesAll[0]["id"]; - - if (isset($_GET["debug"])) { - echo("</pre>"); - die(); - } - } - - global $userPalette; - $userPalette = $palettes["list"][$selectedPalette]; - - function rgb($color) { - return hexdec(substr($color, 0, 2)) . "," . hexdec(substr($color, 2, 2)) . "," . hexdec(substr($color, 4, 2)); - } - - function icon($name, $dark = null, $body = false) { - global $userPalette; - - if (isset($dark)) { - return "/assets/icons/new/" . $name . ".svg?color=" . explode(",", $userPalette[$dark ? "dark" : "light"])[$body ? 6 : 9]; - } else { - return "/assets/icons/new/" . $name . ".svg?color=" . explode(",", $userPalette[isset($_COOKIE["new2023UIDarkMode"]) && $_COOKIE["new2023UIDarkMode"] === "yes" ? "dark" : "light"])[$body ? 6 : 9]; - } - } - - foreach ([ "dark", "light" ] as $theme) { $palette = explode(",", $userPalette[$theme]); ?> - <style> - @media (prefers-color-scheme: <?= $theme ?>)<?= $theme === "light" ? ", (prefers-color-scheme: no-preference)" : "" ?> { - :root { - --bs-body-color: #<?= $palette[6] ?> !important; - --bs-body-color-rgb: <?= rgb($palette[6]) ?> !important; - --bs-body-bg: #<?= $palette[0] ?> !important; - --bs-body-bg-rgb: <?= rgb($palette[0]) ?> !important; - --bs-white: #<?= $palette[0] ?> !important; - --bs-white-rgb: <?= rgb($palette[0]) ?> !important; - - --bs-secondary-color: #<?= $palette[6] ?> !important; - --bs-secondary-color-rgb: <?= rgb($palette[6]) ?> !important; - --bs-secondary-bg: #<?= $palette[1] ?> !important; - --bs-secondary: #<?= $palette[6] ?> !important; - --bs-secondary-bg-rgb: <?= rgb($palette[1]) ?> !important; - - --bs-tertiary-color: #<?= $palette[6] ?> !important; - --bs-tertiary-color-rgb: <?= rgb($palette[6]) ?> !important; - --bs-tertiary-bg: #<?= $palette[2] ?> !important; - --bs-tertiary-bg-rgb: <?= rgb($palette[2]) ?> !important; - - --bs-light: #<?= $palette[2] ?> !important; - --bs-light-rgb: <?= rgb($palette[2]) ?> !important; - - --bs-link-color: #<?= $palette[9] ?> !important; - --bs-link-hover-color: #<?= $palette[9] ?>77 !important; - --bs-link-active-color: #<?= $palette[9] ?>77 !important; - - --palette-0: #<?= $palette[0] ?> !important; - --palette-1: #<?= $palette[1] ?> !important; - --palette-2: #<?= $palette[2] ?> !important; - --palette-3: #<?= $palette[3] ?> !important; - --palette-4: #<?= $palette[4] ?> !important; - --palette-5: #<?= $palette[5] ?> !important; - --palette-6: #<?= $palette[6] ?> !important; - --palette-7: #<?= $palette[7] ?> !important; - --palette-8: #<?= $palette[8] ?> !important; - --palette-9: #<?= $palette[9] ?> !important; - - --palette-0-rgb: <?= rgb($palette[0]) ?> !important; - --palette-1-rgb: <?= rgb($palette[1]) ?> !important; - --palette-2-rgb: <?= rgb($palette[2]) ?> !important; - --palette-3-rgb: <?= rgb($palette[3]) ?> !important; - --palette-4-rgb: <?= rgb($palette[4]) ?> !important; - --palette-5-rgb: <?= rgb($palette[5]) ?> !important; - --palette-6-rgb: <?= rgb($palette[6]) ?> !important; - --palette-7-rgb: <?= rgb($palette[7]) ?> !important; - --palette-8-rgb: <?= rgb($palette[8]) ?> !important; - --palette-9-rgb: <?= rgb($palette[9]) ?> !important; - } - - .dropdown-menu { - background-color: #<?= $palette[1] ?> !important; - --bs-dropdown-bg: #<?= $palette[1] ?> !important; - --bs-dropdown-link-color: #<?= $palette[6] ?> !important; - --bs-dropdown-link-disabled-color: #<?= $palette[6] ?>77 !important; - --bs-dropdown-link-hover-color: #<?= $palette[6] ?> !important; - --bs-dropdown-link-hover-bg: #<?= $palette[3] ?> !important; - --bs-dropdown-link-active-bg: #<?= $palette[6] ?> !important; - --bs-dropdown-link-active-color: #<?= $palette[6] ?> !important; - } - - .dropdown-item { - color: #<?= $palette[6] ?> !important; - } - - .dropdown-item:hover { - color: #<?= $palette[6] ?> !important; - background-color: #<?= $palette[3] ?> !important; - } - - .dropdown-item:active { - color: #<?= $palette[6] ?> !important; - background-color: #<?= $palette[6] ?> !important; - } - - .dropdown-item.disabled { - color: #<?= $palette[6] ?>77 !important; - } - - .coins { - color: #<?= $palette[6] ?> !important; - background-color: #<?= $palette[1] ?> !important; - } - - .list-group-item-primary { - color: var(--bs-body-bg); - background-color: #<?= $palette[6] ?>; - } - - .list-group-item-action.list-group-item-primary:hover, .list-group-item-action.list-group-item-primary:active, .list-group-item-action.list-group-item-primary:focus { - background-color: #<?= $palette[6] ?>dd; - color: var(--bs-body-bg); - } - - .profile-border-inner-active { - background-color: var(--bs-tertiary-bg) !important; - } - - .bg-secondary { - background-color: #<?= $palette[9] ?> !important; - color: #<?= $palette[0] ?> !important; - } - - .list-group-item-primary small { - color: #<?= $palette[0] ?>77 !important; - } - - .list-group, .list-group-item, .list-group-item-action { - --bs-list-group-color: var(--bs-body-color) !important; - --bs-list-group-action-color: var(--bs-body-color) !important; - --bs-list-group-action-hover-color: var(--bs-body-color) !important; - --bs-list-group-action-active-color: var(--bs-body-color) !important; - --bs-list-group-border-color: #<?= $palette[5] ?> !important; - --bs-list-group-bg: #<?= $palette[2] ?> !important; - --bs-list-group-action-hover-bg: #<?= $palette[1] ?> !important; - --bs-list-group-action-active-bg: #<?= $palette[1] ?> !important; - } - - .btn-outline-dark, .btn-outline-secondary { - --bs-btn-color: var(--bs-body-color); - --bs-btn-border-color: var(--bs-body-color); - --bs-btn-hover-color: var(--bs-body-bg); - --bs-btn-hover-bg: var(--bs-body-color); - --bs-btn-hover-border-color: var(--bs-body-color); - --bs-btn-focus-shadow-rgb: <?= rgb($palette[6]) ?>; - --bs-btn-active-color: var(--bs-body-bg); - --bs-btn-active-bg: var(--bs-body-color); - --bs-btn-active-border-color: var(--bs-body-color); - --bs-btn-active-shadow: inset 0 3px 5px rgba(<?= rgb($palette[6]) ?>, 0.125); - --bs-btn-disabled-color: #<?= $palette[6] ?>77; - --bs-btn-disabled-bg: transparent; - --bs-btn-disabled-border-color: #<?= $palette[6] ?>77; - --bs-gradient: none; - } - - .alert-primary { - --bs-alert-color: var(--bs-body-bg); - --bs-alert-bg: var(--bs-body-color); - --bs-alert-border-color: var(--bs-body-color); - } - - .alert-danger .btn-close, .alert-success .btn-close, .alert-warning .btn-close { - background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23<?= $palette[0] ?>'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat - } - - .alert-danger, .alert-success, .alert-warning, .list-group-item-warning { - --bs-alert-color: var(--bs-body-bg) !important; - --bs-alert-bg: #<?= $palette[9] ?> !important; - --bs-alert-border-color: #<?= $palette[9] ?> !important; - --bs-list-group-border-color: #<?= $palette[8] ?> !important; - } - - .list-group-item-warning, .list-group-item-success, .list-group-item-danger, .list-group-item-warning:hover, .list-group-item-success:hover, .list-group-item-danger:hover, .list-group-item-warning:active, .list-group-item-success:active, .list-group-item-danger:active { - color: var(--bs-body-color) !important; - background-color: #<?= $palette[8] ?> !important; - } - - .list-group-item-warning:hover, .list-group-item-success:hover, .list-group-item-danger:hover { - opacity: .75; - } - - .list-group-item-warning:active, .list-group-item-success:active, .list-group-item-danger:active { - opacity: .5; - } - - .list-group-item[open] { - opacity: 1 !important; - } - - .alert-secondary { - --bs-alert-color: var(--bs-secondary-color); - --bs-alert-bg: var(--bs-secondary-bg); - --bs-alert-border-color: var(--bs-secondary-bg); - } - - .badge.bg-success, .badge.bg-danger, .badge.bg-warning { - background-color: var(--bs-body-color) !important; - color: var(--bs-body-bg) !important; - } - - .badge.bg-secondary, .badge.bg-black { - background-color: var(--bs-body-bg) !important; - color: var(--bs-body-color) !important; - } - - .text-muted { - color: #<?= $palette[6] ?>77 !important; - } - - body.bg-light { - background-color: var(--bs-body-bg) !important; - } - - .btn-primary { - --bs-btn-color: #<?= $palette[8] ?>; - --bs-btn-bg: #<?= $palette[9] ?>; - --bs-btn-border-color: #<?= $palette[9] ?>; - --bs-btn-hover-color: #<?= $palette[8] ?>; - --bs-btn-hover-bg: #<?= $palette[9] ?>; - --bs-btn-hover-border-color: #<?= $palette[9] ?>; - --bs-btn-focus-shadow-rgb: <?= rgb($palette[9]) ?>; - --bs-btn-active-color: #<?= $palette[8] ?>; - --bs-btn-active-bg: #<?= $palette[9] ?>; - --bs-btn-active-border-color: #<?= $palette[9] ?>; - --bs-btn-active-shadow: inset 0 3px 5px rgba(<?= rgb($palette[9]) ?>, 0.25); - --bs-btn-disabled-color: #<?= $palette[8] ?>; - --bs-btn-disabled-bg: #<?= $palette[9] ?>77; - --bs-btn-disabled-border-color: #<?= $palette[9] ?>77; - } - - .btn-outline-primary { - --bs-btn-color: #<?= $palette[9] ?>; - --bs-btn-border-color: #<?= $palette[9] ?>; - --bs-btn-hover-color: var(--bs-body-bg); - --bs-btn-hover-bg: #<?= $palette[9] ?>; - --bs-btn-hover-border-color: #<?= $palette[9] ?>; - --bs-btn-focus-shadow-rgb: <?= rgb($palette[6]) ?>; - --bs-btn-active-color: var(--bs-body-bg); - --bs-btn-active-bg: #<?= $palette[9] ?>; - --bs-btn-active-border-color: #<?= $palette[9] ?>; - --bs-btn-active-shadow: inset 0 3px 5px rgba(<?= rgb($palette[6]) ?>, 0.125); - --bs-btn-disabled-color: #<?= $palette[6] ?>77; - --bs-btn-disabled-bg: transparent; - --bs-btn-disabled-border-color: #<?= $palette[6] ?>77; - --bs-gradient: none; - } - - .progress { - background-color: #<?= $palette[2] ?> !important; - } - - .progress-bar.bg-success { - background-color: #<?= $palette[9] ?> !important; - } - - .progress-bar.bg-danger { - background-color: #<?= $palette[7] ?> !important; - } - - .card { - background-color: #<?= $palette[2] ?> !important; - border-color: #<?= $palette[5] ?> !important; - } - - .form-control, .form-control:focus, .form-select, .form-select:focus, .form-check-input, .form-check-input:focus { - color: var(--bs-body-color); - background-color: #<?= $palette[2] ?> !important; - border-color: #<?= $palette[3] ?> !important; - } - - .form-check-input:checked, .form-check-input:checked:focus { - background-color: #<?= $palette[9] ?> !important; - border-color: #<?= $palette[9] ?> !important; - } - - .form-control:focus, .form-select:focus, .form-check-input:focus { - box-shadow: 0 0 0 0.25rem rgba(<?= rgb($palette[9]) ?>, .25); - transition: box-shadow 200ms; - } - - .form-control::placeholder, .form-select::placeholder { - color: #<?= $palette[6] ?>77; - } - - .modal { - --bs-modal-bg: #<?= $palette[1] ?> !important; - --bs-modal-header-border-color: #<?= $palette[3] ?> !important; - } - - .card { - --bs-card-bg: #<?= $palette[1] ?> !important; - } - - .btn-close { - background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23<?= $palette[6] ?>'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat; - opacity: 1 !important; - } - - .antialias, #new-homepage img, #hpd-other img, #hpd-raindrops img, .ck img, #system-info img, #member-card img { - image-rendering: auto !important; - } - - #member-relations img { - image-rendering: pixelated !important; - } - - .btn-close:hover { - opacity: .75 !important; - } - - .btn-close:active { - opacity: .5 !important; - } - - .ck-editor { - color: var(--bs-black); - } - - .alert-primary a, .alert-danger a, .alert-success a, .alert-warning a { - color: var(--bs-body-bg); - } - - #plus-box, #plus-box > div > div > div > span, #plus-box h2 { - color: var(--bs-body-color); - } - - #plus-box { - background: #<?= $palette[2] ?> !important; - } - - #plus-box > div { - background-image: none !important; - } - } - </style> - <?php } ?> - - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/2023ui.inc"; ?> -<?php $GLOBALS["ColdHazePerformance"]["header"] = (microtime(true) - $start) * 1000; $start = microtime(true); ?> -<main id="app" style="background-color: var(--palette-0);"> |