e59-website/html/journal.php
Jan BELLON b06e5345b3 Update 8 files
- /include/variables.php
- /include/functions.php
- /html/index.php
- /html/admin.php
- /html/upload.php
- /html/login.php
- /html/journal.php
- /config/global.ini
2024-03-07 01:09:05 +00:00

79 lines
2.7 KiB
PHP

<?php
require "../include/variables.php";
require "../include/functions.php";
if (isset($_GET['article']) == false || filter_var($_GET['article'], FILTER_VALIDATE_INT) == false) {
$article = "0";
} else {
$article = $_GET['article'];
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./src/css/style.css">
<link rel="icon" href="src/img/favicon.ico">
<title><?=$title?></title>
</head>
<body>
<header>
<div class="pancontent">
<div class="athena-container">
<a href="/">
<img src="./src/img/athena-mono.png" class="athena">
</a>
</div>
<div class="content">
<div>
<div class="main-title">
<div class="title"><?=$header_title?></div>
<div class="subtitle"><?=$header_subtitle?></div>
</div>
</div>
</div>
</div>
</header>
<nav>
<div class="pancontent">
<?php nav($nav);?>
</div>
</nav>
<main>
<div class="content">
<div>
<div>
<?php
if (file_exists('../content/journal/' . $article . '.md')) {
$markdownContent = file_get_contents('../content/journal/' . $article . '.md');
require_once '../include/parsedown.php';
$parsedown = new Parsedown();
echo $parsedown->text($markdownContent);
} else {
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("SELECT (ID, titre, date, auteur) FROM articles ORDER BY date DESC");
$bdd->execute();
$resultat = $req->fetch(PDO::FETCH_ASSOC);
if ($resultat) {
foreach($resultat as $row) {
echo "<div class='article'><div><a href='#?article=" . $row['ID'] . "'>" . $row['Titre'] . "</a></div><div>" . $row['auteur'] . "</div><div>" . $row['date'] . "</div></div>";
}
}
}
?>
</div>
</div>
</div>
</main>
<footer>
<div class="content">
<div>
<div><?=$copyright?></div>
</div>
</div>
</footer>
</body>
</html>