
- /html/about.php - /html/admin.php - /html/compte.php - /html/editpage.php - /html/login.php - /html/logout.php - /html/news.php - /html/register.php - /html/src/banner/index.php - /html/src/img/empty.jpg - /html/src/img/favicon.ico - /html/src/miniature/index.php - /html/src/pp/index.php - /html/upload.php - /html/user.php - /html/users.php - /content/journal/0.md - /content/journal/198183.md - /content/about.md - /content/admin.md - /content/index.md - /html-old/editpage.php - /html-old/src/banner/index.php - /html-old/src/css/index.php - /html-old/src/css/style.css - /html-old/src/fonts/index.php - /html-old/src/fonts/bahnschrift.ttf - /html-old/src/img/empty.jpg - /html-old/src/img/favicon.ico - /html-old/src/img/index.php - /html-old/src/img/athena-mono.png - /html-old/src/miniature/index.php - /html-old/src/pp/index.php - /html-old/src/index.php - /html-old/about.php - /html-old/robots.txt - /html-old/admin.php - /html-old/compte.php - /html-old/login.php - /html-old/logout.php - /html-old/index.php - /html-old/news.php - /html-old/register.php - /html-old/upload.php - /html-old/users.php - /html-old/user.php - /html/about/index.php - /html/account/index.php - /html/admin/index.php - /html/assets/banners/index.php - /html/assets/miniatures/index.php - /html/assets/pp/index.php - /html/assets/index.php - /html/editor/index.php - /html/login/index.php - /html/login/logout.php - /html/login/register.php - /html/news/index.php - /html/settings/index.php - /html/settings/deleteaccount.php - /html/src/css/style.css - /html/src/img/athena-mono.png - /html/index.php - /html/robots.txt - /content/articles/0.md - /content/articles/198183.md - /content/pages/about.md - /content/pages/admin.md - /content/pages/index.md - /include/variables.php - /include/functions.php - /config/global.ini
143 lines
6.7 KiB
PHP
143 lines
6.7 KiB
PHP
<?php
|
|
require("../../include/variables.php");
|
|
require("../../include/functions.php");
|
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
|
|
<head>
|
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
|
<style>
|
|
.article .article-title {
|
|
font-family: cfont, Arial, sans-serif;
|
|
font-size: 3em;
|
|
margin-top: 1em;
|
|
}
|
|
|
|
.article .article-illustration {
|
|
padding: 2em 0;
|
|
}
|
|
|
|
.article .article-illustration img {
|
|
max-width: 60%;
|
|
max-height: 30em;
|
|
}
|
|
|
|
.article .article-content img {
|
|
max-width: 100%;
|
|
max-height: 30em;
|
|
}
|
|
|
|
.article .article-content h1 {
|
|
font-family: Arial, sans-serif;
|
|
font-weight: bold;
|
|
font-size: 2em;
|
|
}
|
|
|
|
.user-widget {
|
|
margin-top: 2em;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="body">
|
|
|
|
<header>
|
|
<div class="panel-content">
|
|
<?php fillHeader($rootPageURL, $headerTitle, $headerSubtitle);?>
|
|
</div>
|
|
</header>
|
|
|
|
<nav>
|
|
<div class="panel-content">
|
|
<?php fillNav($rootPageURL);?>
|
|
</div>
|
|
</nav>
|
|
|
|
<main>
|
|
<div class="content">
|
|
<?php
|
|
if (isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT) && file_exists($rootFilePath . 'content/articles/' . $_GET['article'] . '.md')) {
|
|
$articleMarkdownContent = file_get_contents($rootFilePath . 'content/articles/' . $_GET['article'] . '.md');
|
|
|
|
require_once '../../include/parsedown.php';
|
|
$parsedown = new Parsedown();
|
|
|
|
$sqlRequest = "SELECT articles.ID, articles.title, articles.date, articles.miniature, articles.resume, articles.author, users.username, users.display_name, users.level, users.profile_picture FROM articles JOIN users ON articles.author = users.ID WHERE articles.ID = :articleID AND articles.classification <= :userAccreditation";
|
|
$request = $pdo->prepare($sqlRequest);
|
|
$request->bindParam(":articleID", $_GET['article']);
|
|
$request->bindParam(":userAccreditation", $_SESSION['userAccreditation']);
|
|
$request->execute();
|
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
if($result) {
|
|
$pubDateTime = strtotime($result[0]['date']);
|
|
$pubDate = date('d/m/Y', $pubDateTime);
|
|
$articleID = $result[0]['ID'];
|
|
$articleTitle = $result[0]['title'];
|
|
$articleResume = $result[0]['resume'];
|
|
$miniatureURL = $result[0]['miniature'];
|
|
$authorUsername = $result[0]['username'];
|
|
$authorDisplayName = $result[0]['display_name'];
|
|
$authorLevel = $result[0]['level'];
|
|
$authorPPURL = $result[0]['profile_picture'] == NULL ? "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png" : $result[0]['profile_picture'];
|
|
$authorID = $result[0]['author'];
|
|
|
|
echo ('<div class="article">');
|
|
echo ('<div class="article-info">');
|
|
echo ('<div class="article-title">' . $articleTitle . '</div>');
|
|
echo ('<div class="article-date">' . $pubDate . '</div>');
|
|
if ($_SESSION['userID'] == $authorID) {
|
|
echo ('<a href="/editor?article=' . $articleID . '" class="button">Editer</a>');
|
|
}
|
|
|
|
userWidget($authorPPURL, $authorDisplayName, $authorUsername, $authorLevel, $certificationColors, $rootPageURL);
|
|
|
|
echo ('<div class="article-illustration">');
|
|
echo ('<img src="' . $miniatureURL . '"/>');
|
|
echo ('</div>');
|
|
|
|
echo ('<div class="article-content">');
|
|
echo ($parsedown->text($articleMarkdownContent));
|
|
echo ('</div>');
|
|
|
|
echo ('</div>');
|
|
echo ('</div>');
|
|
}
|
|
|
|
} else {
|
|
$search = isset($_GET['search']) ? "%" . htmlspecialchars($_GET['search']) . "%" : "%%";
|
|
$sqlRequest = "SELECT articles.ID, articles.title, articles.date, articles.miniature, articles.resume, users.username, users.display_name FROM articles JOIN users ON articles.author = users.ID WHERE (articles.title LIKE :search OR articles.ID LIKE :search OR users.username LIKE :search) AND articles.classification <= :userAccreditation";
|
|
$request = $pdo->prepare($sqlRequest);
|
|
$request->bindParam(":search", $search);
|
|
$request->bindParam(":userAccreditation", $_SESSION['userAccreditation']);
|
|
$request->execute();
|
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
echo ('<h1>News</h1>');
|
|
|
|
echo ('<form action="#" method="get">');
|
|
$shapePath = '<path d="M10.25 3.75c-3.59 0-6.5 2.91-6.5 6.5s2.91 6.5 6.5 6.5c1.795 0 3.419-.726 4.596-1.904 1.178-1.177 1.904-2.801 1.904-4.596 0-3.59-2.91-6.5-6.5-6.5zm-8.5 6.5c0-4.694 3.806-8.5 8.5-8.5s8.5 3.806 8.5 8.5c0 1.986-.682 3.815-1.824 5.262l4.781 4.781-1.414 1.414-4.781-4.781c-1.447 1.142-3.276 1.824-5.262 1.824-4.694 0-8.5-3.806-8.5-8.5z"></path>';
|
|
textInput("text", $shapePath, "search", "Chercher", "");
|
|
echo ('</form>');
|
|
|
|
if ($result) {
|
|
echo('<div class="articles-list">');
|
|
listArticles($result, $rootPageURL);
|
|
echo('</div>');
|
|
} else {
|
|
echo ('Aucun article trouvé');
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</main>
|
|
<footer>
|
|
<div class="panel-content">
|
|
<?php fillFooter($footerText);?>
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|