aboutsummaryrefslogtreecommitdiff
path: root/blog/_article.php
diff options
context:
space:
mode:
Diffstat (limited to 'blog/_article.php')
-rw-r--r--blog/_article.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/blog/_article.php b/blog/_article.php
new file mode 100644
index 0000000..1d25467
--- /dev/null
+++ b/blog/_article.php
@@ -0,0 +1,38 @@
+<?php
+
+if (!isset($_GET['i'])) {
+ header("Location: /blog");
+ die();
+}
+if (strpos($_GET['i'], "/") !== false && strpos($_GET['i'], ".") !== false && strpos($_GET['i'], "\\") !== false) {
+ header("Location: /blog");
+ die();
+}
+if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json")) {
+ header("Location: /blog");
+ die();
+}
+
+$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json"), true);
+$article = $_GET['i'];
+$_TITLE = $data["title"];
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php";
+
+?>
+<div style="margin-top: 56px;z-index: 5;background: #fff;padding-top: 20px;min-height: calc(100vh - 57px);" id="main-box">
+ <div class="container">
+ <h2><?= $data["title"] ?></h2>
+ <h6 class="text-muted"><?= l("Published", "PubliƩ") ?> <?= DateTime::createFromFormat('Y-m-d', explode("@", $article)[0])->format("F jS, Y"); ?></h6>
+
+ <hr>
+ <div>
+ <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.html") ?>
+ </div>
+
+ <hr>
+ <p><a href="/blog"><?= l("All blog articles", "Tous les articles de blog") ?></a></p>
+ </div>
+
+ <br>
+</div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>