Update 2 files
- /html/journal-interne.php - /html/journal.php
This commit is contained in:
parent
ccf390afab
commit
96ca096381
@ -1,89 +0,0 @@
|
|||||||
<?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>
|
|
@ -55,7 +55,8 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
|
|||||||
echo "</div></div>";
|
echo "</div></div>";
|
||||||
} else {
|
} else {
|
||||||
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
||||||
$req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles ORDER BY date DESC");
|
$req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles WHERE role <= :role ORDER BY date DESC");
|
||||||
|
$req->bindParam(":role", $_SESSION['role'])
|
||||||
$req->execute();
|
$req->execute();
|
||||||
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user