
- /html/about.php - /html/admin.php - /html/compte.php - /html/editpage.php - /html/index.php - /html/login.php - /html/news.php - /html/register.php - /html/upload.php - /html/users.php - /config/global.ini - /include/functions.php - /include/variables.php
120 lines
5.2 KiB
PHP
120 lines
5.2 KiB
PHP
<?php
|
|
require "../include/variables.php";
|
|
require "../include/functions.php";
|
|
|
|
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">
|
|
<style>
|
|
@media (prefers-color-scheme: dark) {
|
|
.body {
|
|
<?=$theme_dark?>
|
|
}
|
|
}
|
|
@media (prefers-color-scheme: light) {
|
|
.body {
|
|
<?=$theme_light?>
|
|
}
|
|
}
|
|
</style>
|
|
<link rel="icon" href="src/img/favicon.ico">
|
|
<title><?=$title?></title>
|
|
</head>
|
|
<body class="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 == "") {
|
|
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
|
$search = isset($_GET['search']) ? "%" . htmlspecialchars($_GET['search']) . "%" : "%%";
|
|
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE (titre LIKE :search OR ID LIKE :search OR auteur LIKE :search) AND classification <= :accreditation ORDER BY date DESC");
|
|
$req->bindParam(":search", $search);
|
|
$req->bindParam(":accreditation", $_SESSION['accreditation']);
|
|
$req->execute();
|
|
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
echo "<h1>Dernières news du Club</h1>";
|
|
echo "<form action='' method='get'><input type='text' placeholder='Article' name='search'><input type='submit' value='Rechercher'></form>";
|
|
|
|
if ($resultat) {
|
|
foreach($resultat as $row) {
|
|
$date = strtotime($row['date']);
|
|
echo "<hr><div class='article-preview'>";
|
|
echo "<a href='?article=" . $row['ID'] . "' class='article-link'>";
|
|
echo "<div class='article-titre'>" . $row['titre'] . "</div></a>";
|
|
echo "<div class='article-date'>" . date('d/m/Y', $date) . "</div></div>";
|
|
}
|
|
} else {
|
|
echo "Aucun article trouvé";
|
|
}
|
|
} else if (!isset($_GET['search']) && $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-info'>";
|
|
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
|
$req = $bdd->prepare("SELECT ID, titre, date, auteur, classification FROM articles WHERE ID = :article AND classification <= :accreditation");
|
|
$req->bindParam(":article", $article);
|
|
$req->bindParam(":accreditation", $_SESSION['accreditation']);
|
|
$req->execute();
|
|
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);;
|
|
|
|
if ($resultat) {
|
|
$date = strtotime($resultat[0]['date']);
|
|
echo "<div class='article-titre'>" . $resultat[0]['titre'] . "</div>";
|
|
echo "<div class='article-date'>" . date('d/m/Y', $date) . "</div>";
|
|
echo "<div class='article-auteur'>" . $resultat[0]['auteur'] . "</div>";
|
|
echo "<div class='article-classification'>" . $classifications[$resultat[0]['classification']] . "</div></div>";
|
|
echo "<div class='article-content'>";
|
|
echo $parsedown->text($markdownContent);
|
|
echo "</div></div>";
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<footer>
|
|
<div class="content">
|
|
<div>
|
|
<div><?=$copyright?></div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|