aboutsummaryrefslogtreecommitdiff
path: root/_site/includes/dom/header.php
diff options
context:
space:
mode:
Diffstat (limited to '_site/includes/dom/header.php')
-rw-r--r--_site/includes/dom/header.php517
1 files changed, 9 insertions, 508 deletions
diff --git a/_site/includes/dom/header.php b/_site/includes/dom/header.php
index 978e766..15beaa1 100644
--- a/_site/includes/dom/header.php
+++ b/_site/includes/dom/header.php
@@ -1,508 +1,9 @@
-<?php
-
-$listGetTimeout = 0;
-ob_start();
-
-$admin = true;
-if (!isset($_COOKIE["ADMIN_TOKEN"])) {
- $admin = false;
- if (isset($__ADMIN)) header("Location: /admin/offline") and die();
-} else {
- if (!(strpos("/", $_COOKIE['ADMIN_TOKEN']) === false && strpos(".", $_COOKIE['ADMIN_TOKEN']) === false && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']))) {
- $admin = false;
- if (isset($__ADMIN)) header("Location: /admin/offline") and die();
- } else {
- $_USER = trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/tokens/" . $_COOKIE['ADMIN_TOKEN']));
- }
-}
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
-$Parsedown = new Parsedown();
-
-function gh_api($api) {
- $crl = curl_init("https://api.github.com/" . $api);
- curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($crl, CURLINFO_HEADER_OUT, true);
- curl_setopt($crl, CURLOPT_POST, false);
-
- curl_setopt($crl, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- "Accept: application/json",
- "Authorization: token " . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/credentials.json"), true)["token"],
- "User-Agent: UnchainedTech-Admin/0.0.0 (nekostarfan@gmail.com)"
- ));
-
- $result = curl_exec($crl);
-
- if ($result === false) {
- throw new ErrorException("GitHub API unexpectedly interrupted", 214, E_ERROR);
- }
-
- return $result;
-}
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
-
-function customShutdown() {
- if (!is_null(error_get_last())) {
- ob_clean();
- $d = error_get_last();
- echo "
-<!DOCTYPE html>
-<html>
-<head>
- <title>Something went wrong on UnchainedTech 🌙</title>
- <style>
-
- @font-face {
- src: url(\"/font/regular.ttf\");
- font-family: \"JetBrains Mono\";
- font-style: normal;
- }
-
- @font-face {
- src: url(\"/font/italic.ttf\");
- font-family: \"JetBrains Mono\";
- font-style: italic;
- }
-
- *, pre {
- font-family: \"JetBrains Mono\", sans-serif;
- transition: none !important;
- }
-
- nav, * {
- color: #00ff00 !important;
- }
-
- html, body, nav.navbar, .card {
- background-color: black !important;
- }
-
- a:hover {
- color: black !important;
- background: #00ff00;
- }
-
- pre {
- background: #00ff00;
- border-radius: 5px;
- padding: 10px;
- color: black !important;
- text-align: left;
- }
-
- @media (min-width: 700px) {
- pre {
- margin-left: 25%;
- margin-right: 25%;
- }
- }
-
- </style>
-</head>
-<body>
- <div style='margin-top:50px;text-align: center;'>
- <h1>Something went wrong <small>(like, for real!)</small></h1>
- <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='mailto:nekostarfan@gmail.com'>report this bug</a>.</p>
- <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p>
- <pre>
-#99{$d["type"]}: ";
-
-$pparts = explode(": ", $d["message"]);
-array_shift($pparts);
-
-$parts = explode(" in ", implode(": ", $pparts));
-echo($parts[0]);
-
-$stp = explode("\nStack trace:", $parts[1]);
-echo("\n at " . $stp[0]);
-
-$stlines = explode("\n", $stp[1]);
-array_shift($stlines);
-
-foreach ($stlines as $stline) {
- $stpparts = explode(" ", $stline);
- array_shift($stpparts);
- $stline = implode(" ", $stpparts);
-
- if ($stline !== " thrown" && $stline !== "{main}") {
- $pp2 = explode("(", $stline);
- $pp2n = explode(")", $pp2[1]);
-
- echo("\n at " . $pp2[0] . ":" . $pp2n[0]);
- } else if ($stline === "{main}") {
- echo("\n at UnchainedTech.\$Core (PHP " . PHP_VERSION . ")");
- }
-}
-
-echo "
-</pre>
- </div>
-</body>
-</html>
- ";
- die();
- }
-}
-
-function customError($errno, $errstr, $errfile = "&lt;unknown file&gt;", $errline = "&lt;unknown line&gt;") {
- ob_clean();
- echo "
-<!DOCTYPE html>
-<html>
-<head>
- <title>Something went wrong on UnchainedTech 🌙</title>
- <style>
-
- @font-face {
- src: url(\"/font/regular.ttf\");
- font-family: \"JetBrains Mono\";
- font-style: normal;
- }
-
- @font-face {
- src: url(\"/font/italic.ttf\");
- font-family: \"JetBrains Mono\";
- font-style: italic;
- }
-
- *, pre {
- font-family: \"JetBrains Mono\", sans-serif;
- transition: none !important;
- }
-
- nav, * {
- color: #00ff00 !important;
- }
-
- html, body, nav.navbar, .card {
- background-color: black !important;
- }
-
- a:hover {
- color: black !important;
- background: #00ff00;
- }
-
- pre {
- background: #00ff00;
- border-radius: 5px;
- padding: 10px;
- color: black !important;
- text-align: left;
- }
-
- @media (min-width: 700px) {
- pre {
- margin-left: 25%;
- margin-right: 25%;
- }
- }
-
- </style>
-</head>
-<body>
- <div style='margin-top:50px;text-align: center;'>
- <h1>Something went wrong <small>(like, for real!)</small></h1>
- <p>An error occured and UnchainedTech cannot load right now. Even us can make mistakes sometimes, and because you are really nice you will <a href='mailto:nekostarfan@gmail.com'>report this bug</a>.</p>
- <p>For you, really tech-savvy people, here is that alien language thing you're probably looking for:</p>
- <pre>
-#{$errno}: {$errstr}
- at {$errfile}:{$errline}
- at UnchainedTech.\$Core (PHP " . PHP_VERSION . ")
-</pre>
- </div>
-</body>
-</html>
- ";
- die();
-}
-set_error_handler("customError", E_ALL);
-register_shutdown_function("customShutdown");
-
-?>
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <meta name="description" content="<?= $_DESCRIPTION ?? "A page from UnchainedTech, a blog made by technology enthusiasts that talks about all sorts of stuff." ?>">
- <title><?= isset($_TITLE) ? $_TITLE . " on UnchainedTech 🌙" : "UnchainedTech" ?></title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="icon" href="/logo.svg">
- <link rel="stylesheet" href="/css/bootstrap.min.css">
- <style>
-
- @font-face {
- src: url("/font/regular.ttf");
- font-family: "JetBrains Mono";
- font-style: normal;
- }
-
- @font-face {
- src: url("/font/italic.ttf");
- font-family: "JetBrains Mono";
- font-style: italic;
- }
-
- *, code {
- font-family: "JetBrains Mono", sans-serif;
- transition: none !important;
- }
-
- nav, * {
- color: #00ff00 !important;
- }
-
- html, body, nav.navbar, .card {
- background-color: black !important;
- }
-
- nav.navbar {
- border-bottom: 3px solid #00ff00 !important;
- }
-
- .card {
- border-color: #00ff00 !important;
- }
-
- .btn-primary {
- background-color: black !important;
- border-color: #00ff00 !important;
- border-style: dashed;
- }
-
- .list-group-item {
- background: black;
- border: 1px solid #00ff00;
- }
-
- .list-group:not(.no-link) .list-group-item:hover {
- background: #00ff00;
- color: black !important;
- }
-
- .btn-primary:hover {
- background: #00ff00 !important;
- color: black !important;
- }
-
- hr {
- border-color: #00ff00;
- border-width: 3px;
- }
-
- td {
- border: 1px solid #00ff00;
- }
-
- th {
- border: 1px solid #00ff00;
- border-bottom-width: 2px;
- }
-
- code {
- background: #00ff00;
- color: black !important;
- }
-
- pre {
- background: #00ff00;
- border-radius: 5px;
- padding: 10px;
- }
-
- img {
- max-width: 100%;
- max-height: 50vh;
- }
-
- .nav-link:hover, .nav-link:focus {
- outline: 1px dotted #00ff00;
- }
-
- .nav-link:active {
- outline: 1px solid #00ff00;
- }
-
- .btn:focus {
- box-shadow: none;
- }
-
- #article-cover {
- width: 100%;
- height: 50vh;
- background-size: cover;
- background-position: center;
- }
-
- .badge-secondary {
- background: black;
- border: 1px solid #ffff00;
- color: #ffff00 !important;
- font-weight: normal;
- }
-
- .nav-admin {
- color: #ffff00 !important;
- outline-color: #ffff00 !important;
- }
-
- a.list-group-item.list-group-item-action.list-group-item-admin {
- border-color: #ffff00;
- color: #ffff00 !important;
- }
-
- a.list-group-item.list-group-item-action.list-group-item-admin:hover {
- background-color: #ffff00 !important;
- }
-
- .card-admin {
- filter: hue-rotate(-45deg);
- }
-
- .admin-text {
- color: #ffff00 !important;
- }
-
- .list-admin-warning, .list-admin-warning * {
- color: #ff0000 !important;
- }
-
- #apps_outer {
- background: transparent;
- border: none;
- }
-
- #apps_outer::after {
- display: none;
- }
-
- #apps_path {
- fill: #00ff00;
- }
-
- #apps_outer:hover #apps_path {
- opacity: .75;
- }
-
- #apps_outer:active #apps_path, #apps_outer:focus #apps_path {
- opacity: .5;
- }
-
- .app-icon {
- width: 24px;
- height: 24px;
- vertical-align: middle;
- margin-right: 5px;
- filter: invert(1);
- }
-
- .app-title {
- vertical-align: middle;
- }
-
- .nav-item.dropdown {
- float: right;
- display: block;
- position: fixed;
- right: 10px;
- }
-
- .nav-item.dropdown, .nav-item.dropdown * {
- outline: none !important;
- }
-
- #apps, #apps * {
- color: #212529 !important;
- font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
- }
-
- #apps {
- filter: invert(1);
- }
-
- ::-webkit-scrollbar {
- width: 10px;
- margin-left: 1px;
- }
-
- ::-webkit-scrollbar-track {
- background: transparent;
- margin-left: 1px;
- }
-
- ::-webkit-scrollbar-thumb {
- background-color: #00dd00;
- margin-left: 1px;
- }
-
- ::-webkit-scrollbar-thumb:hover {
- background-color: #00bb00;
- }
-
- ::-webkit-scrollbar-thumb:active {
- background-color: #009900;
- }
-
- .navbar-toggler {
- border-color: #00ff00 !important;
- border-radius: 0;
- }
-
- .navbar-collapse.collapse.show {
- height: calc(100vh - 63px);
- }
-
- .navbar-toggler-icon {
- background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'><path stroke='rgba%280, 255, 0, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>") !important;
- }
-
- </style>
- <script src="/js/jquery.js"></script>
- <script src="/js/bootstrap.bundle.min.js"></script>
-</head>
-<body>
- <nav class="navbar navbar-expand-md bg-dark navbar-dark fixed-top">
- <a class="navbar-brand" href="/"><img id="siteicon" src="/logo-alt.svg" width="32px"> <span style="vertical-align: middle;"># unchainedtech_ <?= $admin ? '<span class="badge badge-secondary">admin</span>' : '' ?></span></a>
-
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
- <span class="navbar-toggler-icon"></span>
- </button>
-
- <div id="collapsibleNavbar" class="collapse navbar-collapse">
- <ul class="navbar-nav">
- <li class="nav-item">
- <a class="nav-link" href="/home">Home</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/articles">All Articles</a>
- </li>
- <li class="nav-item">
- <a class="nav-link" href="/about">About</a>
- </li>
- <?php if ($admin): ?>
- <li class="nav-item">
- <a class="nav-link nav-admin" href="/admin">Administration</a>
- </li>
- <?php endif; ?>
-
- <li class="nav-item dropdown">
- <a class="nav-link dropdown-toggle" href="#" id="apps_outer" data-toggle="dropdown">
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" class="glyph_f10"><path d="M1 19h4v-4H1zm7 0h4v-4H8zm7 0h4v-4h-4zM1 12h4V8H1zm7 0h4V8H8zm7 0h4V8h-4zM1 5h4V1H1zm7 0h4V1H8zm7-4v4h4V1z" id="apps_path"></path></svg>
- </a>
- <div class="dropdown-menu" id="apps" style="position:fixed;top:48px;left:initial;right:10px;">
- <a href="https://github.com/Minteck" class="dropdown-item"><img alt="" src="/apps/github.png" class="app-icon"> <span class="app-title">GitHub</span></a>
- <a href="https://kartik.hopto.org/online" class="dropdown-item"><img alt="" src="/apps/kartik.png" class="app-icon"> <span class="app-title">Kartik Online</span></a>
- <a href="https://minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/minteck.svg" class="app-icon"> Minteck's Space</span></a>
- <a href="https://unchainedtech.minteck.ro.lt" class="dropdown-item"><span class="app-title"><img alt="" src="/apps/unchainedtech.png" class="app-icon"> UnchainedTech</span></a>
- <a href="https://jetbrains.minteck.ro.lt/hub" class="dropdown-item"><img alt="" src="/apps/hub.svg" class="app-icon"> <span class="app-title">Minteck's Hub</span></a>
- <a href="https://jetbrains.minteck.ro.lt/youtrack" class="dropdown-item"><img alt="" src="/apps/youtrack.svg" class="app-icon"> <span class="app-title">YouTrack</span></a>
- </div>
- </li>
- </ul>
- </div>
-
- </nav>
-<div id="separator" style="margin-top:72px;"></div> \ No newline at end of file
+<?php
+
+$GLOBALS["experimentalUIisStable"] = false;
+
+if ((isset($_COOKIE['_UnchainedTech_ExperimentalUI']) && $_COOKIE['_UnchainedTech_ExperimentalUI'] === "true") || $GLOBALS["experimentalUIisStable"]) {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/v2/header.php";
+} else {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/v1/header.php";
+} \ No newline at end of file