diff options
author | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-07-20 01:15:15 +0200 |
---|---|---|
committer | Minteck <46352972+Minteck@users.noreply.github.com> | 2021-07-20 01:15:15 +0200 |
commit | af9e5ef458b93ef2003905e1ccc5665e7266c242 (patch) | |
tree | 989ac25a8b75578788cd7157308f37b9b83cf8f5 /blog | |
download | main-af9e5ef458b93ef2003905e1ccc5665e7266c242.tar.gz main-af9e5ef458b93ef2003905e1ccc5665e7266c242.tar.bz2 main-af9e5ef458b93ef2003905e1ccc5665e7266c242.zip |
Commit
Diffstat (limited to 'blog')
-rw-r--r-- | blog/.htaccess | 3 | ||||
-rw-r--r-- | blog/_article.php | 38 | ||||
-rw-r--r-- | blog/index.php | 14 |
3 files changed, 55 insertions, 0 deletions
diff --git a/blog/.htaccess b/blog/.htaccess new file mode 100644 index 0000000..ec30801 --- /dev/null +++ b/blog/.htaccess @@ -0,0 +1,3 @@ +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 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"; ?> diff --git a/blog/index.php b/blog/index.php new file mode 100644 index 0000000..7c3040b --- /dev/null +++ b/blog/index.php @@ -0,0 +1,14 @@ +<?php $_TITLE = "Blog"; 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("All blog articles", "Tous les articles du blog") ?></h2> + <div class="alert alert-secondary"> + <strong>Note :</strong> If you want a more generally tech-centric blog that doesn't necessarily talk about me, you should check out <a target="_blank" href="https://unchainedtech.minteck.ro.lt">UnchainedTech</a>, that is also accessible <a href="http://blgchnxuwuxqwclt247g6d4sxun4w3cqohkwgtjmckb6nbzu2pfssvyd.onion/">here</a> if you are using the Tor network. + </div> + + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/blog/list.php"; ?> + </div> + + <br> +</div> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/footer.php"; ?> |