
- /html/upload-file.php - /html/editpage.php - /html/admin.php - /html/journal-interne.php - /html/login.php - /html/compte.php - /html/upload.php - /config/global.ini - /include/variables.php - /include/functions.php
89 lines
3.1 KiB
PHP
89 lines
3.1 KiB
PHP
<?php
|
|
require "../include/variables.php";
|
|
require "../include/functions.php";
|
|
|
|
if(isset($_SESSION['role']) == false || $_SESSION['role'] < 1) {
|
|
header("Location: login.php");
|
|
http_response_code(404);
|
|
die();
|
|
}
|
|
|
|
if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
|
|
$article = $_GET['article'];
|
|
} else {
|
|
$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="/" class="athena-link">
|
|
<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 ($article != "" && file_exists('/var/www/e59/content/journal/' . $article . '.md')) {
|
|
$markdownContent = file_get_contents('/var/www/e59/content/journal/' . $article . '.md');
|
|
|
|
require_once '../include/parsedown.php';
|
|
$parsedown = new Parsedown();
|
|
echo "<div class='article'><div class='article-content'>";
|
|
echo $parsedown->text($markdownContent);
|
|
echo "</div></div>";
|
|
} else {
|
|
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
|
$req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles ORDER BY date DESC");
|
|
$req->execute();
|
|
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$date = new Datetime($row['date']);
|
|
|
|
if ($resultat) {
|
|
foreach($resultat as $row) {
|
|
echo "<a href='?article=" . $row['ID'] . "' class='article-link'><div class='article'><div class='article-content'><div><h1>" . $row['titre'] . "</h1></div><div><h2>" . $row['auteur'] . "</h2></div><div>" . $date->format('d/m/Y') . "</div></div></div></a>";
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<footer>
|
|
<div class="content">
|
|
<div>
|
|
<div><?=$copyright?></div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|