aboutsummaryrefslogtreecommitdiff
path: root/_site/rewrites
diff options
context:
space:
mode:
Diffstat (limited to '_site/rewrites')
-rw-r--r--_site/rewrites/admin-article.php138
-rw-r--r--_site/rewrites/article.php136
-rw-r--r--_site/rewrites/assets.php48
3 files changed, 174 insertions, 148 deletions
diff --git a/_site/rewrites/admin-article.php b/_site/rewrites/admin-article.php
index a8a7813..6de5f80 100644
--- a/_site/rewrites/admin-article.php
+++ b/_site/rewrites/admin-article.php
@@ -1,71 +1,69 @@
-<?php
-
-if (!isset($_GET['i'])) {
- header("Location: /articles");
- die();
-}
-
-if (strpos($_GET['i'], "/") !== false && strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
- header("Location: /articles");
- die();
-}
-
-if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $_GET['i'] . ".md") || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $_GET['i'] . ".md")) {
- header("Location: /articles");
- die();
-}
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
-$Parsedown = new Parsedown();
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
-$list = getArticlesList(false);
-$item = $list[$_GET['i']];
-
-$_TITLE = $item["title"];
-$__ADMIN = true;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php";
-
-?>
-
-<div class="container" style="margin-top:30px;">
- <div class="card" style="margin-bottom:20px;">
- <div class="card-body">
- <h1><?= $_TITLE ?></h1>
- <p><b>Unreleased article</b>, by <?= implode(" and ", $item["author"]) ?></p>
- </div>
- </div>
-</div>
-
-<?php if (!is_null($item["cover"])): ?>
-<header id="article-cover" style="background-image:url('<?= $item["cover"] ?>')"></header>
-<?php endif; ?>
-
-<div class="container" style="margin-top:15px;">
- <article>
- <?= $item["content"]["full"] ?>
- </article>
-</div>
-
-<div class="container">
- <div class="card">
- <div class="card-body" style="padding: .5rem;text-align: center">
- <small>
- <b>This article hasn't been released yet</b><br>
- This article is a work in progress. Unauthorized publishing or disclosure of this article without the consent of all the contributors will possibly lead to a ban.
- </small>
- </div>
- </div>
-</div>
-
-<style>
- body {
- filter: hue-rotate(-45deg);
- }
-
- .badge-secondary, .nav-admin, img:not(#siteicon), #article-cover, .admin-text {
- filter: hue-rotate(45deg);
- }
-</style>
-
+<?php
+
+if (!isset($_GET['i'])) {
+ header("Location: /articles");
+ die();
+}
+
+if (strpos($_GET['i'], "/") !== false && strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
+ header("Location: /articles");
+ die();
+}
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $_GET['i'] . ".md") || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/_drafts/" . $_GET['i'] . ".md")) {
+ header("Location: /articles");
+ die();
+}
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
+$Parsedown = new Parsedown();
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
+$list = getArticlesList(false);
+$item = $list[$_GET['i']];
+
+$_TITLE = $item["title"];
+$__ADMIN = true;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php";
+
+?>
+
+<div class="container" style="margin-top:30px;">
+ <div class="card" style="margin-bottom:20px;">
+ <div class="card-body">
+ <h1><?= $_TITLE ?></h1>
+ <p><b>Unreleased article</b>, by <?= implode(" and ", $item["author"]) ?></p>
+ </div>
+ </div>
+</div>
+
+<?php if (!is_null($item["cover"])): ?>
+<header id="article-cover" style="background-image:url('<?= $item["cover"] ?>')"></header>
+<?php endif; ?>
+
+<div class="container" style="margin-top:15px;">
+ <article>
+ <?= $item["content"]["full"] ?>
+ </article>
+</div>
+
+<div class="container">
+ <div class="card">
+ <div class="card-body" style="padding: .5rem;text-align: center">
+ <small>
+ <b>This article hasn't been released yet</b><br>
+ This article is a work in progress. Unauthorized publishing or disclosure of this article without the consent of all the contributors will possibly lead to a ban.
+ </small>
+ </div>
+ </div>
+</div>
+
+<?php if ((isset($_COOKIE['_UnchainedTech_ExperimentalUI']) && $_COOKIE['_UnchainedTech_ExperimentalUI'] === "true") || $GLOBALS["experimentalUIisStable"]): ?>
+ <main id="comments" class="container">
+ <hr>
+ <h2>Comments</h2>
+ <p style="text-align: center;"><i>Comments are disabled on unreleased articles.</i></p>
+ </main>
+<?php endif; ?>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/rewrites/article.php b/_site/rewrites/article.php
index aa858c9..2c53370 100644
--- a/_site/rewrites/article.php
+++ b/_site/rewrites/article.php
@@ -1,55 +1,83 @@
-<?php
-
-if (!isset($_GET['i'])) {
- header("Location: /articles");
- die();
-}
-
-if (strpos($_GET['i'], "/") !== false && strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
- header("Location: /articles");
- die();
-}
-
-if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $_GET['i'] . ".md") || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $_GET['i'] . ".md")) {
- header("Location: /articles");
- die();
-}
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
-$Parsedown = new Parsedown();
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
-$list = getArticlesList(false);
-$item = $list[$_GET['i']];
-
-$_DESCRIPTION = str_replace("\n", " ", str_replace("\"", "“", $item["content"]["little"]));
-$_TITLE = $item["title"];
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php";
-
-?>
-
-<div class="container" style="margin-top:30px;">
- <div class="card" style="margin-bottom:20px;">
- <div class="card-body">
- <h1><?= $_TITLE ?></h1>
- <p>Published on <?php
-
- $dt = DateTime::createFromFormat('Ymd', $item["date"]);
- echo($dt->format("M jS, Y"));
-
- ?>, by <?= implode(" and ", $item["author"]) ?></p>
- </div>
- </div>
-</div>
-
-<?php if (!is_null($item["cover"])): ?>
-<header id="article-cover" style="background-image:url('<?= $item["cover"] ?>')"></header>
-<?php endif; ?>
-
-<div class="container" style="margin-top:15px;">
- <article>
- <?= $item["content"]["full"] ?>
- </article>
-</div>
-
+<?php
+
+if (!isset($_GET['i'])) {
+ header("Location: /articles");
+ die();
+}
+
+if (strpos($_GET['i'], "/") !== false && strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
+ header("Location: /articles");
+ die();
+}
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $_GET['i'] . ".md") || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/" . $_GET['i'] . ".md")) {
+ header("Location: /articles");
+ die();
+}
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
+$Parsedown = new Parsedown();
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
+$list = getArticlesList(false);
+$item = $list[$_GET['i']];
+
+$_DESCRIPTION = str_replace("\n", " ", str_replace("\"", "“", $item["content"]["little"]));
+$_TITLE = $item["title"];
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php";
+
+?>
+
+<div class="container" style="margin-top:30px;">
+ <div class="card" style="margin-bottom:20px;">
+ <div class="card-body">
+ <h1><?= $_TITLE ?></h1>
+ <p>Published on <?php
+
+ $dt = DateTime::createFromFormat('Ymd', $item["date"]);
+ echo($dt->format("M jS, Y"));
+
+ ?>, by <?= implode(" and ", $item["author"]) ?></p>
+ </div>
+ </div>
+</div>
+
+<?php if (!is_null($item["cover"])): ?>
+<header id="article-cover" style="background-image:url('<?= $item["cover"] ?>')"></header>
+<?php endif; ?>
+
+<div class="container" style="margin-top:15px;">
+ <article>
+ <?= $item["content"]["full"] ?>
+ </article>
+</div>
+
+<?php if ((isset($_COOKIE['_UnchainedTech_ExperimentalUI']) && $_COOKIE['_UnchainedTech_ExperimentalUI'] === "true") || $GLOBALS["experimentalUIisStable"]): ?>
+<main id="comments" class="container">
+ <hr>
+ <h2>Comments</h2>
+ <div id="comment-section"></div>
+ <script>
+ initComments({
+ node: document.getElementById("comment-section"),
+ defaultHomeserverUrl: "https://matrix.cactus.chat:8448",
+ serverName: "cactus.chat",
+ siteName: "unchainedtech",
+ commentSectionId: "<?= $item["id"] ?>"
+ })
+
+ document.querySelector(".cactus-button.cactus-login-button").innerText += " with Matrix";
+ </script>
+ <style>
+ .cactus-login-form {
+ background: black !important;
+ }
+
+ .cactus-editor-buttons {
+ filter: invert(1);
+ }
+ </style>
+</main>
+<?php endif; ?>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/rewrites/assets.php b/_site/rewrites/assets.php
index bd2baac..8ee7a38 100644
--- a/_site/rewrites/assets.php
+++ b/_site/rewrites/assets.php
@@ -1,25 +1,25 @@
-<?php
-
-if (!isset($_GET['i'])) {
- die();
-}
-
-if (strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
- die();
-}
-
-if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i']) || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i'])) {
- die();
-}
-
-$file = $_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i'];
-
-header('Content-Type: ' . mime_content_type($file));
-header('Content-Transfer-Encoding: binary');
-header('Expires: 0');
-header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-header('Pragma: public');
-ob_clean();
-flush();
-readfile($file);
+<?php
+
+if (!isset($_GET['i'])) {
+ die();
+}
+
+if (strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
+ die();
+}
+
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i']) || !is_file($_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i'])) {
+ die();
+}
+
+$file = $_SERVER['DOCUMENT_ROOT'] . "/../_posts/assets/" . $_GET['i'];
+
+header('Content-Type: ' . mime_content_type($file));
+header('Content-Transfer-Encoding: binary');
+header('Expires: 0');
+header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+header('Pragma: public');
+ob_clean();
+flush();
+readfile($file);
exit; \ No newline at end of file