aboutsummaryrefslogtreecommitdiff
path: root/blog/_article.php
blob: 1d25467e49791afc08d981a04724b168a9b20efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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"; ?>