diff options
Diffstat (limited to 'blog')
-rw-r--r-- | blog/.htaccess | 4 | ||||
-rw-r--r-- | blog/_article.php | 76 | ||||
-rw-r--r-- | blog/index.php | 34 |
3 files changed, 57 insertions, 57 deletions
diff --git a/blog/.htaccess b/blog/.htaccess index ec30801..b67accb 100644 --- a/blog/.htaccess +++ b/blog/.htaccess @@ -1,3 +1,3 @@ -RewriteEngine on -RewriteBase /blog +RewriteEngine on
+RewriteBase /blog
RewriteRule ^/?article-([a-zA-Z0-9_@\-]+)$ /blog/_article.php?i=$1 [L]
\ No newline at end of file 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"; ?>
diff --git a/blog/index.php b/blog/index.php index 203e1ba..b915fbe 100644 --- a/blog/index.php +++ b/blog/index.php @@ -1,17 +1,17 @@ -<?php $_TITLE = "Blog"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; ?> - -<div style="z-index: 5;background: #fff;min-height: calc(100vh - 57px);" id="main-box"> - <div id="project-hero" style="background-image:url('/static/hero/blog.jpg');"></div> - - <div class="container"> - <h2><?= l("All blog articles", "Tous les articles du blog") ?></h2> - <div class="alert alert-secondary"> - <strong>Note<?= l("", " "); ?>:</strong> <?= l("If you want a more generally tech-centric blog that doesn't necessarily talk about me, you should check out", "Si vous voulez un blog plus centré sur la technologie qui ne parle pas nécessairement de moi, vous devriez regarder") ?> <a target="_blank" href="https://unchainedtech.minteck.ro.lt">UnchainedTech</a><?= l(", ", " (en anglais), ") ?><?= l("that is also available", "qui est aussi disponible") ?> <a href="http://blgchnxuwuxqwclt247g6d4sxun4w3cqohkwgtjmckb6nbzu2pfssvyd.onion/"><?= l("here", "ici"); ?></a> <?= l("if you are using the Tor network.", "si vous utilisez le réseau Tor.") ?> - </div> - - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/blog/list.php"; ?> - </div> - - <br> -</div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?> +<?php $_TITLE = "Blog"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/header.php"; ?>
+
+<div style="z-index: 5;background: #fff;min-height: calc(100vh - 57px);" id="main-box">
+ <div id="project-hero" style="background-image:url('/static/hero/blog.jpg');"></div>
+
+ <div class="container">
+ <h2><?= l("All blog articles", "Tous les articles du blog") ?></h2>
+ <div class="alert alert-secondary">
+ <strong>Note<?= l("", " "); ?>:</strong> <?= l("If you want a more generally tech-centric blog that doesn't necessarily talk about me, you should check out", "Si vous voulez un blog plus centré sur la technologie qui ne parle pas nécessairement de moi, vous devriez regarder") ?> <a target="_blank" href="https://unchainedtech.minteck.ro.lt">UnchainedTech</a><?= l(", ", " (en anglais), ") ?><?= l("that is also available", "qui est aussi disponible") ?> <a href="http://blgchnxuwuxqwclt247g6d4sxun4w3cqohkwgtjmckb6nbzu2pfssvyd.onion/"><?= l("here", "ici"); ?></a> <?= l("if you are using the Tor network.", "si vous utilisez le réseau Tor.") ?>
+ </div>
+
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/blog/list.php"; ?>
+ </div>
+
+ <br>
+</div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?>
|