diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-08 12:04:30 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-08 12:04:30 +0200 |
commit | 95112b1eb06a4be531ded59563d53a63a8d614e8 (patch) | |
tree | fd3dc676227309c87a39feab9ca458985e327907 /blog/_article.php | |
parent | 87303b0d3540037fb94efdde24dbaacb2880d6cb (diff) | |
download | main-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.gz main-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.bz2 main-95112b1eb06a4be531ded59563d53a63a8d614e8.zip |
Opening!
Diffstat (limited to 'blog/_article.php')
-rw-r--r-- | blog/_article.php | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/blog/_article.php b/blog/_article.php index 819d7b1..1a43d14 100644 --- a/blog/_article.php +++ b/blog/_article.php @@ -1,38 +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 = l($data["title"], $data["title.fr"] ?? $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><?= l($data["title"], $data["title.fr"] ?? $data["title"]) ?></h2> - <h6 class="text-muted"><?= l("Published", "PubliƩ") ?> <?= strftime(l("%a %b %e, %Y", "%a %e %b %Y"), (int)DateTime::createFromFormat('Y-m-d', explode("@", $article)[0])->format("U")); ?></h6> - - <hr> - <div> - <?= l(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.html"), file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.fr.html") ? file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.fr.html") : 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"; ?> +<?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") || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.md")) {
+ 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><?= l($data["title"], $data["title.fr"] ?? $data["title"]) ?></h2>
+ <h6 class="text-muted"><?= l("Published", "PubliƩ") ?> <?= strftime(l("%a %b %e, %Y", "%a %e %b %Y"), (int)DateTime::createFromFormat('Y-m-d', explode("@", $article)[0])->format("U")); ?></h6>
+
+ <hr>
+ <div>
+ <?= /** @var mixed $Parsedown */ $Parsedown->text(l(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.md"), file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.fr.md") ? file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.fr.md") : file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $_GET['i'] . ".json.md"))) ?>
+ </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"; ?>
|