From 1d62401c897a5ba82d0def92d97d09195a6d676f Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Thu, 1 Jul 2021 00:54:32 +0200 Subject: Fixed stuff + official logo --- _site/includes/dom/footer.php | 3 +- _site/includes/dom/header.php | 84 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 82 insertions(+), 5 deletions(-) (limited to '_site/includes/dom') diff --git a/_site/includes/dom/footer.php b/_site/includes/dom/footer.php index 1d0fb97..2b0a1f2 100644 --- a/_site/includes/dom/footer.php +++ b/_site/includes/dom/footer.php @@ -1,4 +1,5 @@ -

View RSS feed

+ +

View RSS feed (doesn't include unreleased articles)" : "" ?>


diff --git a/_site/includes/dom/header.php b/_site/includes/dom/header.php index db37bab..7f4bcf5 100644 --- a/_site/includes/dom/header.php +++ b/_site/includes/dom/header.php @@ -3,9 +3,44 @@ $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: Blogchain-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() { @@ -16,7 +51,7 @@ function customShutdown() { - Something went wrong - Blogchain + Something went wrong on Blogchain 🌙 \ No newline at end of file -- cgit