diff options
author | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-06-29 20:00:07 +0200 |
---|---|---|
committer | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-06-29 20:00:07 +0200 |
commit | d2733aa17b7932dfb78e97639e7d568ac41b9ee1 (patch) | |
tree | 1e77dbe51e192c42f993e79e53532d3558d36bcb /_site/rewrites/article.php | |
parent | 9f3bd84cb82a7f57a49701018a7fb43eb77c65aa (diff) | |
download | unchainedtech-d2733aa17b7932dfb78e97639e7d568ac41b9ee1.tar.gz unchainedtech-d2733aa17b7932dfb78e97639e7d568ac41b9ee1.tar.bz2 unchainedtech-d2733aa17b7932dfb78e97639e7d568ac41b9ee1.zip |
Let's finally commit stuff!
Diffstat (limited to '_site/rewrites/article.php')
-rw-r--r-- | _site/rewrites/article.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/_site/rewrites/article.php b/_site/rewrites/article.php new file mode 100644 index 0000000..eb98798 --- /dev/null +++ b/_site/rewrites/article.php @@ -0,0 +1,48 @@ +<?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(); +$item = $list[$_GET['i']]; + +$_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> + + <article> + <?= $item["content"]["full"] ?> + </article> +</div> + +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?>
\ No newline at end of file |