Update 72 files
- /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
@ -1,41 +1,39 @@
|
|||||||
[main]
|
[root]
|
||||||
root = "https://e59.fr"
|
pageURL = "https://e59.fr/"
|
||||||
wwwroot = "/var/www/e59"
|
filePath = "/var/www/e59/"
|
||||||
title = "Club Réseaux"
|
|
||||||
header-title = "E59"
|
|
||||||
header-subtitle = "Club Réseaux"
|
|
||||||
copyright = "© Jan BELLON - E59"
|
|
||||||
|
|
||||||
[sql]
|
[sql]
|
||||||
dbname = ""
|
databaseName = "E59"
|
||||||
dbuser = ""
|
databaseUser = ""
|
||||||
dbpass = ""
|
databasePass = ""
|
||||||
dbhost = "127.0.0.1"
|
databaseHost = "127.0.0.1"
|
||||||
|
|
||||||
[nav]
|
[main]
|
||||||
News = "news.php"
|
pageTitle = "E59"
|
||||||
A propos = "about.php"
|
headerTitle = "E59"
|
||||||
|
headerSubtitle = "Club Réseaux"
|
||||||
|
footerText = "© Jan BELLON - E59 v1.2"
|
||||||
|
|
||||||
[classifications]
|
[confidentialLevels]
|
||||||
0 = "E59i-P (Public)"
|
0 = "E59i-P (Public)"
|
||||||
1 = "E59i-M (Membres)"
|
1 = "E59i-M (Membres)"
|
||||||
2 = "E59i-R (Responsables)"
|
2 = "E59i-R (Responsables)"
|
||||||
3 = "E59i-D (Direction)"
|
3 = "E59i-D (Direction)"
|
||||||
|
|
||||||
[roles]
|
[userLevels]
|
||||||
0 = "Invité"
|
0 = "Invité"
|
||||||
1 = "Membre"
|
1 = "Membre"
|
||||||
2 = "Responsable"
|
2 = "Responsable"
|
||||||
3 = "Directeur"
|
3 = "Directeur"
|
||||||
|
|
||||||
[themes_dark]
|
[certificationColors]
|
||||||
0 = '--text: hsl(0, 0%, 80%);--background: hsl(0, 0%, 15%);--banner-background: hsl(0, 0%, 10%);--buttons: hsl(0, 0%, 5%)'
|
|
||||||
1 = '--text: hsl(208, 100%, 96%); --background: hsl(215, 21%, 11%); --banner-background: hsl(216, 28%, 7%); --buttons: hsl(216, 28%, 7%)'
|
|
||||||
|
|
||||||
[themes_light]
|
|
||||||
0 = '--text: hsl(0, 0%, 20%);--background: hsl(0, 0%, 100%);--banner-background: hsl(0, 0%, 100%);--buttons: hsl(0, 0%, 100%)'
|
|
||||||
1 = '--text: hsl(208, 100%, 0%); --background: hsl(215, 21%, 100%); --banner-background: hsl(216, 28%, 95%); --buttons: hsl(216, 28%, 95%)'
|
|
||||||
|
|
||||||
[certifcolors]
|
|
||||||
2 = "#1d9bf0"
|
2 = "#1d9bf0"
|
||||||
3 = "#e3ba1f"
|
3 = "#e3ba1f"
|
||||||
|
|
||||||
|
[darkThemes]
|
||||||
|
0 = '--text: hsl(0, 0%, 80%);--background: hsl(0, 0%, 15%);--panel-background: hsl(0, 0%, 10%);--buttons: hsl(0, 0%, 5%)'
|
||||||
|
1 = '--text: hsl(208, 100%, 96%); --background: hsl(215, 21%, 11%); --panel-background: hsl(216, 28%, 7%); --buttons: hsl(216, 28%, 7%)'
|
||||||
|
|
||||||
|
[lightThemes]
|
||||||
|
0 = '--text: hsl(0, 0%, 20%);--background: hsl(0, 0%, 100%);--panel-background: hsl(0, 0%, 100%);--buttons: hsl(0, 0%, 100%)'
|
||||||
|
1 = '--text: hsl(208, 100%, 0%); --background: hsl(215, 21%, 100%); --panel-background: hsl(216, 28%, 95%); --buttons: hsl(216, 28%, 95%)'
|
||||||
|
98
html-old/index.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
require "../include/variables.php";
|
||||||
|
require "../include/functions.php";
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!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="<?=$root?>" 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
|
||||||
|
$markdownContent = file_get_contents('../content/index.md');
|
||||||
|
|
||||||
|
require_once '../include/parsedown.php';
|
||||||
|
$parsedown = new Parsedown();
|
||||||
|
echo $parsedown->text($markdownContent);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class="articles"><?php
|
||||||
|
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
||||||
|
$search = isset($_GET['search']) ? "%" . htmlspecialchars($_GET['search']) . "%" : "%%";
|
||||||
|
$req = $bdd->prepare("SELECT articles.ID, articles.titre, articles.date, articles.image, articles.resume, users.username, users.display_name FROM articles JOIN users ON articles.auteur = users.ID WHERE articles.classification <= :accreditation ORDER BY date DESC LIMIT 3");
|
||||||
|
$req->bindParam(":accreditation", $_SESSION['accreditation']);
|
||||||
|
$req->execute();
|
||||||
|
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
foreach($resultat as $row) {
|
||||||
|
$date = strtotime($row['date']);
|
||||||
|
echo '<div class="article-preview">';
|
||||||
|
echo '<div class="article-illustration">';
|
||||||
|
echo '<a href="news.php?article=' . $row['ID'] . '" class="article-link"><img src="' . $row['image'] . '" class="article-miniature"></a>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '<div class="article-details">';
|
||||||
|
echo '<div class="article-data">n° ' . $row['ID'] . ' | ' . date('d/m/Y', $date) . ' | '. '<a href="user.php?user=' . $row['username'] . '">' . $row['display_name'] . '</a></div>';
|
||||||
|
echo '<a href="news.php?article=' . $row['ID'] . '" class="article-link">';
|
||||||
|
echo '<div class="article-titre">' . $row['titre'] . '</div>';
|
||||||
|
echo '</a>';
|
||||||
|
echo '<div class="article-resume">' . $row['resume'] . '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div> ';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="content">
|
||||||
|
<div>
|
||||||
|
<div><?=$copyright?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
5
html-old/robots.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
User-agent: Googlebot
|
||||||
|
Disallow: /src/
|
||||||
|
|
||||||
|
User-agent: *
|
||||||
|
Allow: /
|
312
html-old/src/css/style.css
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: crfont; /* Nom de la police */
|
||||||
|
src: url('/src/fonts/bahnschrift.ttf') format('truetype'); /* Chemin vers votre fichier TTF */
|
||||||
|
/* Autres attributs de la police (facultatif) */
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: crfont, sans-serif;
|
||||||
|
color: var(--text);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
font-family: Helvetica, Arial, sans-serif;
|
||||||
|
background: var(--background);
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
min-height: 100em;
|
||||||
|
}
|
||||||
|
|
||||||
|
header, footer, nav {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
background: var(--banner-background);
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
header, footer {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, textarea {
|
||||||
|
background-color: var(--buttons);
|
||||||
|
color: var(--text);
|
||||||
|
padding: 0.4em 1em;
|
||||||
|
margin: 15px 0;
|
||||||
|
font-size: 1.2em;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='submit'], button {
|
||||||
|
color: var(--text);
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='submit']:hover, button:hover {
|
||||||
|
box-shadow: 0 0 15px var(--banner-background);
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
border-radius: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navitem {
|
||||||
|
padding: 0.5em;
|
||||||
|
background-color: var(--buttons);
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
color: rgb(199 181 147);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
width: 80%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pancontent {
|
||||||
|
width: 90%;
|
||||||
|
display: flex;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.athena-container {
|
||||||
|
padding: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.athena {
|
||||||
|
height: 7em;
|
||||||
|
border-radius: 3.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.athena:hover {
|
||||||
|
box-shadow: 0 0 15px rgba(255, 255, 255, 0.322);
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-title {
|
||||||
|
text-align: right;
|
||||||
|
margin-top: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-title .title {
|
||||||
|
font-size: 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview {
|
||||||
|
padding: 2em 0.5em;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-illustration {
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-details {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-link {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-miniature {
|
||||||
|
max-width: 15em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-data {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-titre {
|
||||||
|
font: 1.5em crfont, Arial;
|
||||||
|
padding: 0.5em 0 0.5em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-resume-input {
|
||||||
|
min-height: 5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-info .article-auteur {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-info .article-classification {
|
||||||
|
padding: 1em 0;
|
||||||
|
font-size: 1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-info .article-titre {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article .article-illustration {
|
||||||
|
padding: 2em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article .article-miniature {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-content img {
|
||||||
|
max-height: 10em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-content {
|
||||||
|
width: 80%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-header {
|
||||||
|
background-color: var(--banner-background);
|
||||||
|
padding-bottom: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-banner {
|
||||||
|
width: 100%;
|
||||||
|
height: 12em;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-pp-image {
|
||||||
|
width: 10em;
|
||||||
|
height: 10em;
|
||||||
|
border-radius: 10em;
|
||||||
|
transform: translate(0, -60%);
|
||||||
|
border: 5px solid var(--banner-background);
|
||||||
|
background-color: var(--banner-background);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-pp {
|
||||||
|
height: 6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .display-name {
|
||||||
|
font-weight: bold;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-role {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .certification {
|
||||||
|
transform: translate(0, +22%);
|
||||||
|
width: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .bio {
|
||||||
|
padding: 1em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .user-articles {
|
||||||
|
margin-top: 5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-main-profile .bio-input {
|
||||||
|
max-height: 3em;
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-auteur {
|
||||||
|
background-color: var(--banner-background);
|
||||||
|
display: flex;
|
||||||
|
padding: 0.5em 1em 0.5em 0.5em;
|
||||||
|
border-radius: 10em;
|
||||||
|
width: 15em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-auteur .auteur-display-name {
|
||||||
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-auteur .auteur-display-name .certification {
|
||||||
|
transform: translate(0, -15%);
|
||||||
|
width: 1.5em;
|
||||||
|
margin-left: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-auteur .auteur-names {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-auteur .auteur-pp {
|
||||||
|
height: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-auteur .auteur-pp-image {
|
||||||
|
width: 4em;
|
||||||
|
height: 4em;
|
||||||
|
border-radius: 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: var(--banner-background);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 2em;
|
||||||
|
margin: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row input {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
background-color: var(--buttons);
|
||||||
|
color: var(--text);
|
||||||
|
border-radius: 10px;
|
||||||
|
color: var(--text);
|
||||||
|
padding: 0.4em 1em;
|
||||||
|
margin: 15px;
|
||||||
|
font-size: 1.2em;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media(max-width: 750px) {
|
||||||
|
body {
|
||||||
|
font-size: 0.8em
|
||||||
|
}
|
||||||
|
.article-preview {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.article-preview .article-illustration {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2em 0;
|
||||||
|
}
|
||||||
|
.article-preview .article-miniature {
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-details {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-preview .article-data {
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
.article-preview .article-titre {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
.article-preview .article-resume {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
.article .article-miniature {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
BIN
html-old/src/fonts/bahnschrift.ttf
Normal file
BIN
html-old/src/img/athena-mono.png
Normal file
After Width: | Height: | Size: 408 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
1
html-old/src/img/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
1
html-old/src/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
1
html-old/src/miniature/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
1
html-old/src/pp/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
46
html/about/index.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?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></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">
|
||||||
|
|
||||||
|
<div class="markdown-text">
|
||||||
|
<?php
|
||||||
|
$pageContent = markdownContent('../../content/pages/about.md', $rootFilePath);
|
||||||
|
echo($pageContent);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
254
html/account/index.php
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
<?php
|
||||||
|
require("../../include/variables.php");
|
||||||
|
require("../../include/functions.php");
|
||||||
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
||||||
|
|
||||||
|
if (isset($_FILES['newPP']) && $_FILES['newPP']['error'] == 0) {
|
||||||
|
$tempImagePath = $_FILES['newPP']['tmp_name'];
|
||||||
|
$ImagePath = 'assets/pp/' . $_SESSION['userID'] . '.png';
|
||||||
|
$rootImagePath = $rootFilePath . 'html/' . $ImagePath;
|
||||||
|
$imageURL = $rootPageURL . $ImagePath;
|
||||||
|
|
||||||
|
list($width, $height) = getimagesize($tempImagePath);
|
||||||
|
|
||||||
|
$imageInfo = getimagesize($tempImagePath);
|
||||||
|
|
||||||
|
if ($imageInfo[2] === IMAGETYPE_PNG || $imageInfo[2] === IMAGETYPE_JPEG) {
|
||||||
|
$imageWidth = 128;
|
||||||
|
$imageHeight = 128;
|
||||||
|
$imageResized = imagecreatetruecolor($imageWidth, $imageHeight);
|
||||||
|
$imageOriginal = imagecreatefromstring(file_get_contents($tempImagePath));
|
||||||
|
|
||||||
|
imagecopyresampled($imageResized, $imageOriginal, 0, 0, 0, 0, $imageWidth, $imageHeight, $width, $height);
|
||||||
|
imagealphablending($imageResized, false);
|
||||||
|
imagesavealpha($imageResized, $rootPath);
|
||||||
|
|
||||||
|
imagepng($imageResized, $rootImagePath);
|
||||||
|
|
||||||
|
imagedestroy($imageOriginal);
|
||||||
|
imagedestroy($imageResized);
|
||||||
|
|
||||||
|
$sqlRequest = "UPDATE users SET profile_picture = :userPP WHERE ID = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":userPP", $imageURL);
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Photo de profil mise à jour";
|
||||||
|
} else {
|
||||||
|
$status = "Erreur SQL";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Le fichier doit être au format PNG ou JPG";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_FILES['newBanner']) && $_FILES['newBanner']['error'] == 0) {
|
||||||
|
$tempImagePath = $_FILES['newBanner']['tmp_name'];
|
||||||
|
$ImagePath = 'assets/banners/' . $_SESSION['userID'] . '.png';
|
||||||
|
$rootImagePath = $rootFilePath . 'html/' . $ImagePath;
|
||||||
|
$imageURL = $rootPageURL . $ImagePath;
|
||||||
|
|
||||||
|
list($width, $height) = getimagesize($tempImagePath);
|
||||||
|
|
||||||
|
$imageInfo = getimagesize($tempImagePath);
|
||||||
|
|
||||||
|
if ($imageInfo[2] === IMAGETYPE_PNG || $imageInfo[2] === IMAGETYPE_JPEG) {
|
||||||
|
$imageWidth = 800;
|
||||||
|
$imageHeight = ($height / $width) * $imageWidth;
|
||||||
|
$imageResized = imagecreatetruecolor($imageWidth, $imageHeight);
|
||||||
|
$imageOriginal = imagecreatefromstring(file_get_contents($tempImagePath));
|
||||||
|
|
||||||
|
imagecopyresampled($imageResized, $imageOriginal, 0, 0, 0, 0, $imageWidth, $imageHeight, $width, $height);
|
||||||
|
imagealphablending($imageResized, false);
|
||||||
|
imagesavealpha($imageResized, $rootPath);
|
||||||
|
|
||||||
|
imagepng($imageResized, $rootImagePath);
|
||||||
|
|
||||||
|
imagedestroy($imageOriginal);
|
||||||
|
imagedestroy($imageResized);
|
||||||
|
|
||||||
|
$sqlRequest = "UPDATE users SET banner = :userBanner WHERE ID = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":userBanner", $imageURL);
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Banière mise à jour";
|
||||||
|
} else {
|
||||||
|
$status = "Erreur SQL";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Le fichier doit être au format PNG ou JPG";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['userDisplayName']) && isset($_POST['userBio'])) {
|
||||||
|
if(preg_match('!\S!u', $_POST['userDisplayName']) && preg_match('!\S!u', $_POST['userBio'])) {
|
||||||
|
$sqlRequest = "UPDATE users SET display_name = :userDisplayName, bio = :userBio WHERE ID = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":userDisplayName", htmlspecialchars($_POST['userDisplayName']));
|
||||||
|
$request->bindParam(":userBio", htmlspecialchars($_POST['userBio']));
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Informations mises à jour";
|
||||||
|
$_SESSION['userDisplayName'] = htmlspecialchars($_POST['userDisplayName']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$request = $pdo->prepare("SELECT ID, username, display_name, profile_picture, banner, bio FROM users WHERE ID = :userID");
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if($result) {
|
||||||
|
$userID = $result[0]['ID'];
|
||||||
|
$userName = $result[0]['username'];
|
||||||
|
$userDisplayName = $result[0]['display_name'];
|
||||||
|
$userPPURL = $result[0]['profile_picture'] == NULL ? "https://abs.twimg.com/sticky/default_profile_images/default_profile_400x400.png" : $result[0]['profile_picture'];
|
||||||
|
$userBanner = $result[0]['banner'] = NULL ? "" : $result[0]['banner'];
|
||||||
|
$userBio = $result[0]['bio'];
|
||||||
|
} else {
|
||||||
|
header("Location: /login?p=account");
|
||||||
|
die("Erreur, utilisateur introuvable");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
||||||
|
<style>
|
||||||
|
.content {
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-banner {
|
||||||
|
<?php
|
||||||
|
if (empty($userBanner)) {
|
||||||
|
echo "background-color: black";
|
||||||
|
} else {
|
||||||
|
echo "background-image: url('" . $userBanner . "');";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-profile .bio-input {
|
||||||
|
max-height: 3em;
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-header .text-input, .user-header textarea {
|
||||||
|
background-color: var(--background);
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info .text-input label {
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-input .file-input {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-input button {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info form {
|
||||||
|
margin: 1em 0;
|
||||||
|
}
|
||||||
|
</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">
|
||||||
|
<div class="user-profile">
|
||||||
|
<div class="user-banner"></div>
|
||||||
|
<div class="user-header">
|
||||||
|
<div class="user-header-content">
|
||||||
|
<div class="user-pp"><img src="<?=$userPPURL?>"></div>
|
||||||
|
<a href="/users?u=<?=$userName?>" class="button">Voir le profil publique</a>
|
||||||
|
<div class="status"><?=$status?></div>
|
||||||
|
<div class="user-info">
|
||||||
|
<form action="#" method="post">
|
||||||
|
<div class="names">
|
||||||
|
<div class="display-name">
|
||||||
|
<?php textInput("text", "", "userDisplayName", "Nom d'affichage", $userDisplayName) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div><textarea class="bio-input" name="userBio" placeholder="Bio..." maxlength="100"><?=$userBio?></textarea></div>
|
||||||
|
<div><button type="submit">Mettre à jour</button></div>
|
||||||
|
</form>
|
||||||
|
<div>
|
||||||
|
<form action="#" method="post" enctype="multipart/form-data">
|
||||||
|
<div class="image-input">
|
||||||
|
<?php fileInput("newPP")?>
|
||||||
|
<input type="submit" value="Changer la PP" class="button">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<form action="#" method="post" enctype="multipart/form-data">
|
||||||
|
<div class="image-input">
|
||||||
|
<?php fileInput("newBanner")?>
|
||||||
|
<input type="submit" value="Changer la banière" class="button">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="user-articles">
|
||||||
|
<div class="user-content">
|
||||||
|
<div><a href="/upload" class="button">Rédiger un article</a></div>
|
||||||
|
<?php
|
||||||
|
$search = isset($_GET['search']) ? "%" . htmlspecialchars($_GET['search']) . "%" : "%%";
|
||||||
|
$request = $pdo->prepare("SELECT ID, title, date, miniature, resume FROM articles WHERE (title LIKE :search OR ID LIKE :search) AND author = :userID ORDER BY date DESC");
|
||||||
|
$request->bindParam(":search", $search);
|
||||||
|
$request->bindParam(":userID", $userID);
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
echo ('<h1>Vos articles</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 ('Vous n\'avez publié aucun article...');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
40
html/admin/index.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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>
|
||||||
|
/* CUSTOM STYLE */
|
||||||
|
</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"></div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
1
html/assets/banners/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
1
html/assets/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
1
html/assets/miniatures/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
1
html/assets/pp/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php http_response_code(403);?>
|
200
html/editor/index.php
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
<?php
|
||||||
|
require("../../include/variables.php");
|
||||||
|
require("../../include/functions.php");
|
||||||
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
||||||
|
|
||||||
|
if ($_SESSION['level'] < 1) {
|
||||||
|
header("Location: login.php");
|
||||||
|
http_response_code(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getting article informations
|
||||||
|
|
||||||
|
if (isset($_GET['article'])) {
|
||||||
|
$sqlRequest = "SELECT ID, title, resume, miniature, classification FROM articles WHERE ID = :articleID AND author = :authorID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":articleID", $_GET['article']);
|
||||||
|
$request->bindParam(":authorID", $_SESSION['userID']);
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
if ($result) {
|
||||||
|
$articleID = $result[0]['ID'];
|
||||||
|
$articleTitle = $result[0]['title'];
|
||||||
|
$articleResume = $result[0]['resume'];
|
||||||
|
$articleClassification = $result[0]['classification'];
|
||||||
|
$miniatureURL = $result[0]['miniature'];
|
||||||
|
$articleContent = file_get_contents($rootFilePath . 'content/articles/' . $articleID . '.md');
|
||||||
|
} else {
|
||||||
|
$status = "Article introuvable";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Veuillez choisir un article";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Article deletion
|
||||||
|
|
||||||
|
if (isset($_POST['delete-article']) && $_POST['delete-article'] == "delete") {
|
||||||
|
$sqlRequest = "DELETE FROM articles WHERE ID = :articleID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":articleID", $articleID);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Article supprimé";
|
||||||
|
$articleTitle = "";
|
||||||
|
$articleResume = "";
|
||||||
|
$articleContent = "";
|
||||||
|
$miniatureURL = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Updating the article after upload
|
||||||
|
|
||||||
|
if (isset($_POST['article-content']) && isset($_POST['classification']) && isset($articleID)) {
|
||||||
|
|
||||||
|
file_put_contents($rootFilePath . "content/articles/" . $articleID . ".md", nl2br($_POST['article-content']));
|
||||||
|
|
||||||
|
$sqlRequest = "UPDATE articles SET title = :title, resume = :resume, classification = :classification WHERE ID = :articleID AND author = :authorID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":title", htmlspecialchars($_POST['article-title']));
|
||||||
|
$request->bindParam(":resume", htmlspecialchars($_POST['article-resume']));
|
||||||
|
$request->bindParam(":classification", $_POST['classification'], PDO::PARAM_INT);
|
||||||
|
$request->bindParam(":articleID", $_GET['article'], PDO::PARAM_INT);
|
||||||
|
$request->bindParam(":authorID", $_SESSION['userID'], PDO::PARAM_INT);
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
if($request->execute()) {
|
||||||
|
header("Location: /editor?article=" . $articleID);
|
||||||
|
} else {
|
||||||
|
$status = "Une erreur s'est produite";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Updating the miniature
|
||||||
|
|
||||||
|
if (isset($_FILES['miniature']) && $_FILES['miniature']['error'] == 0 && isset($articleID)) {
|
||||||
|
$tempImagePath = $_FILES['miniature']['tmp_name'];
|
||||||
|
$ImagePath = 'assets/miniatures/' . $articleID . '.png';
|
||||||
|
$rootImagePath = $rootFilePath . 'html/' . $ImagePath;
|
||||||
|
$imageURL = $rootPageURL . $ImagePath;
|
||||||
|
|
||||||
|
list($width, $height) = getimagesize($tempImagePath);
|
||||||
|
|
||||||
|
$imageInfo = getimagesize($tempImagePath);
|
||||||
|
|
||||||
|
if ($imageInfo[2] === IMAGETYPE_PNG || $imageInfo[2] === IMAGETYPE_JPEG) {
|
||||||
|
$imageWidth = 500;
|
||||||
|
$imageHeight = ($height / $width) * $imageWidth;
|
||||||
|
$imageResized = imagecreatetruecolor($imageWidth, $imageHeight);
|
||||||
|
$imageOriginal = imagecreatefromstring(file_get_contents($tempImagePath));
|
||||||
|
|
||||||
|
imagecopyresampled($imageResized, $imageOriginal, 0, 0, 0, 0, $imageWidth, $imageHeight, $width, $height);
|
||||||
|
imagealphablending($imageResized, false);
|
||||||
|
imagesavealpha($imageResized, $rootPath);
|
||||||
|
|
||||||
|
imagepng($imageResized, $rootImagePath);
|
||||||
|
|
||||||
|
imagedestroy($imageOriginal);
|
||||||
|
imagedestroy($imageResized);
|
||||||
|
|
||||||
|
$sqlRequest = "UPDATE articles SET miniature = :miniature WHERE ID = :articleID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":miniature", $imageURL);
|
||||||
|
$request->bindParam(":articleID", $articleID);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Miniature changée";
|
||||||
|
$miniatureURL = $imageURL;
|
||||||
|
} else {
|
||||||
|
$status = "Erreur SQL";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Le fichier doit être au format PNG ou JPG";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
||||||
|
<style>
|
||||||
|
.text-input label {
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
min-width: 80%;
|
||||||
|
}
|
||||||
|
.article-content-input {
|
||||||
|
min-height: 40em;
|
||||||
|
}
|
||||||
|
.miniature-change-zone {
|
||||||
|
margin-top: 5em;
|
||||||
|
}
|
||||||
|
.image-input {
|
||||||
|
display: flex;
|
||||||
|
gap: 1em;
|
||||||
|
}
|
||||||
|
.miniature-preview img {
|
||||||
|
width: 20em;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
#delete-button {
|
||||||
|
margin-top: 5em;
|
||||||
|
}
|
||||||
|
</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">
|
||||||
|
<div class="status"><?=$status?></div>
|
||||||
|
<form action="?article=<?=$articleID?>" method="post">
|
||||||
|
<div>
|
||||||
|
<div><h1>Editer un article</h1></div>
|
||||||
|
<?php textInput("text", "", "article-title", "Titre de l'article", $articleTitle)?>
|
||||||
|
<div><textarea name="article-resume" placeholder="Résumé de l'article (200 cacactères) ..." class="article-resume-input" maxlength="200"><?=$articleResume?></textarea></div>
|
||||||
|
<div><textarea name="article-content" placeholder="Contenu de l'article (MarkDown) ..." class="article-content-input"><?=str_replace("<br />", "", $articleContent)?></textarea></div>
|
||||||
|
<?php
|
||||||
|
selectInput("classification", "Classification", $confidentialLevels, $articleClassification);
|
||||||
|
?>
|
||||||
|
<div><button type="submit">Publier</button></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="miniature-change-zone">
|
||||||
|
<div class="miniature-preview"><img src="<?=$miniatureURL?>"></div>
|
||||||
|
<form action="?article=<?=$articleID?>" method="post" enctype="multipart/form-data">
|
||||||
|
<div class="image-input">
|
||||||
|
<?php fileInput("miniature")?>
|
||||||
|
<input type="submit" value="Changer la miniature" class="button">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<form action="?article=<?=$articleID?>" method="post" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="delete-article" value="delete">
|
||||||
|
<button type="submit" id="delete-button">Supprimer l'article</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,98 +0,0 @@
|
|||||||
<?php
|
|
||||||
require "../include/variables.php";
|
|
||||||
require "../include/functions.php";
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!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="<?=$root?>" 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
|
|
||||||
$markdownContent = file_get_contents('../content/index.md');
|
|
||||||
|
|
||||||
require_once '../include/parsedown.php';
|
|
||||||
$parsedown = new Parsedown();
|
|
||||||
echo $parsedown->text($markdownContent);
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<div class="articles"><?php
|
|
||||||
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
|
||||||
$search = isset($_GET['search']) ? "%" . htmlspecialchars($_GET['search']) . "%" : "%%";
|
|
||||||
$req = $bdd->prepare("SELECT articles.ID, articles.titre, articles.date, articles.image, articles.resume, users.username, users.display_name FROM articles JOIN users ON articles.auteur = users.ID WHERE articles.classification <= :accreditation ORDER BY date DESC LIMIT 3");
|
|
||||||
$req->bindParam(":accreditation", $_SESSION['accreditation']);
|
|
||||||
$req->execute();
|
|
||||||
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
|
|
||||||
foreach($resultat as $row) {
|
|
||||||
$date = strtotime($row['date']);
|
|
||||||
echo '<div class="article-preview">';
|
|
||||||
echo '<div class="article-illustration">';
|
|
||||||
echo '<a href="news.php?article=' . $row['ID'] . '" class="article-link"><img src="' . $row['image'] . '" class="article-miniature"></a>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '<div class="article-details">';
|
|
||||||
echo '<div class="article-data">n° ' . $row['ID'] . ' | ' . date('d/m/Y', $date) . ' | '. '<a href="user.php?user=' . $row['username'] . '">' . $row['display_name'] . '</a></div>';
|
|
||||||
echo '<a href="news.php?article=' . $row['ID'] . '" class="article-link">';
|
|
||||||
echo '<div class="article-titre">' . $row['titre'] . '</div>';
|
|
||||||
echo '</a>';
|
|
||||||
echo '<div class="article-resume">' . $row['resume'] . '</div>';
|
|
||||||
echo '</div>';
|
|
||||||
echo '</div> ';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<footer>
|
|
||||||
<div class="content">
|
|
||||||
<div>
|
|
||||||
<div><?=$copyright?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
94
html/login/index.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
require("../../include/variables.php");
|
||||||
|
require("../../include/functions.php");
|
||||||
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
||||||
|
|
||||||
|
if (isset($_SESSION['userID'])) {
|
||||||
|
header("Location: /");
|
||||||
|
die("Vous êtes déjà connecté.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['username']) && isset($_POST['password'])) {
|
||||||
|
|
||||||
|
if (empty($_POST['username']) == false && empty($_POST['password']) == false) {
|
||||||
|
|
||||||
|
if(preg_match('!\S!u', $_POST['username']) && preg_match('!\S!u', $_POST['password'])) {
|
||||||
|
|
||||||
|
$sqlRequest = "SELECT ID, username, display_name, level, accreditation FROM users WHERE (username = :username OR email = :username) AND password = :password";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":username", htmlspecialchars($_POST['username']));
|
||||||
|
$request->bindParam(":password", md5($_POST['password']));
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
|
||||||
|
$_SESSION['userID'] = $result[0]['ID'];
|
||||||
|
$_SESSION['userName'] = $result[0]['username'];
|
||||||
|
$_SESSION['userDisplayName'] = $result[0]['display_name'];
|
||||||
|
$_SESSION['userLevel'] = $result[0]['level'];
|
||||||
|
$_SESSION['userAccreditation'] = $result[0]['accreditation'];
|
||||||
|
$redirectPage = isset($_GET['p']) ? $_GET['p'] : "";
|
||||||
|
header('Location: /' . $redirectPage);
|
||||||
|
exit("Login success");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$status = 'Identifiants incorrects';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = 'Caractères illégaux';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = 'Les champs ne doivent pas être vides';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
||||||
|
<style>
|
||||||
|
</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">
|
||||||
|
<form action="#" method="post">
|
||||||
|
<div class="form">
|
||||||
|
<div class="form-title">Se Connecter</div>
|
||||||
|
<div class="status"><?=$status?></div>
|
||||||
|
<?php
|
||||||
|
textInput("text", "", "username", "Login / Email", "");
|
||||||
|
textInput("password", "", "password", "Mot de Passe", "");
|
||||||
|
?>
|
||||||
|
<button type="submit">Se connecter</button>
|
||||||
|
<div>ou</div>
|
||||||
|
<a href="register.php" class="button">Créer un compte</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
6
html/login/logout.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
session_destroy();
|
||||||
|
header("Location: /login");
|
||||||
|
exit();
|
||||||
|
?>
|
108
html/login/register.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
require("../../include/variables.php");
|
||||||
|
require("../../include/functions.php");
|
||||||
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
||||||
|
|
||||||
|
if (isset($_SESSION['userID'])) {
|
||||||
|
header("Location: index.php");
|
||||||
|
die("Vous êtes déjà connecté");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['username']) && isset($_POST['password1']) && isset($_POST['password2'])) {
|
||||||
|
if(empty($_POST['username']) == false && empty($_POST['password1']) === false && empty($_POST['password2']) === false) {
|
||||||
|
if(preg_match('!\S!u', $_POST['username']) && preg_match('!\S!u', $_POST['password1']) && preg_match('!\S!u', $_POST['password2'])) {
|
||||||
|
if($_POST['password1'] == $_POST['password2']) {
|
||||||
|
|
||||||
|
if (empty($_POST['email']) === false && preg_match('!\S!u', $_POST['username']) == false) {
|
||||||
|
$status = "Caractères illégaux";
|
||||||
|
} else {
|
||||||
|
$userEmail = isset($_POST['email']) ? strtolower($_POST['email']) : NULL;
|
||||||
|
$userDisplayName = htmlspecialchars($_POST['username']);
|
||||||
|
$userName = str_replace(" ", "_", strtolower(htmlspecialchars($_POST['username'])));
|
||||||
|
|
||||||
|
$sqlRequest = "SELECT ID FROM users WHERE username = :username";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":username", htmlspecialchars($_POST['username']));
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if($result) {
|
||||||
|
$status = "Le nom d'utilisateur existe déjà";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$request = $pdo->prepare("INSERT INTO users (username, password, email, display_name, level, accreditation) VALUES (:username, :password, :email, :display_name, 1, 1)");
|
||||||
|
$request->bindParam(':username', $userName);
|
||||||
|
$request->bindParam(':password', md5($_POST['password1']));
|
||||||
|
$request->bindParam(':email', $userEmail);
|
||||||
|
$request->bindParam(':display_name', $userDisplayName);
|
||||||
|
|
||||||
|
if ($request->execute()) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
$status = "Erreur SQL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Les mots de passe ne correspondent pas";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Caractères illégaux";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Les champs ne doivent pas être vides";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
||||||
|
<style>
|
||||||
|
/* CUSTOM STYLE */
|
||||||
|
</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">
|
||||||
|
<form action="#" method="post">
|
||||||
|
<div class="form">
|
||||||
|
<div class="form-title">Créer un compte</div>
|
||||||
|
<div class="status"><?=$status?></div>
|
||||||
|
<?php
|
||||||
|
textInput("text", "", "username", "Login", "");
|
||||||
|
textInput("email", "", "email", "Email (facultatif)", "");
|
||||||
|
textInput("password", "", "password1", "Mot de Passe", "");
|
||||||
|
textInput("password", "", "password2", "Confirmation du Mot de passe", "");
|
||||||
|
?>
|
||||||
|
<button type="submit">Créer un compte</button>
|
||||||
|
<div>ou</div>
|
||||||
|
<a href="index.php" class="button">Se connecter</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
143
html/news/index.php
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<?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>
|
@ -1,5 +0,0 @@
|
|||||||
User-agent: Googlebot
|
|
||||||
Disallow: /src/
|
|
||||||
|
|
||||||
User-agent: *
|
|
||||||
Allow: /
|
|
90
html/settings/deleteaccount.php
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
require("../../include/variables.php");
|
||||||
|
require("../../include/functions.php");
|
||||||
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
||||||
|
|
||||||
|
if (!isset($_SESSION['userID'])) {
|
||||||
|
header("Location: /login");
|
||||||
|
http_response_code(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['delete-account']) && $_POST['delete-account'] == "delete-account") {
|
||||||
|
$sqlRequest = "DELETE FROM users WHERE ID = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
if($request->execute()) {
|
||||||
|
$sqlRequest = "UPDATE articles SET author = 0 WHERE author = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Votre compte a été supprimé, votre session reste active jusqu'à déconnexion";
|
||||||
|
} else {
|
||||||
|
$status = "Erreur lors du passage de propriétés";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Erreur lors de la suppression utilisateur";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
||||||
|
<style>
|
||||||
|
.button, button {
|
||||||
|
margin: 0 1em;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
.choice {
|
||||||
|
display: flex;
|
||||||
|
align-items: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
#yes {
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#no {
|
||||||
|
color: #00ff00;
|
||||||
|
}
|
||||||
|
</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">
|
||||||
|
<form action="#" method="post">
|
||||||
|
<div class="form">
|
||||||
|
<div class="form-title">Etes vous sur de vouloir supprimer votre compte</div>
|
||||||
|
<div class="status"><?=$status?></div>
|
||||||
|
<div class="choice">
|
||||||
|
<a href="/settings" class="button" id="no">Non</a>
|
||||||
|
<form action="#"><input type="hidden" name="delete-account" value="delete-account"><button type="submit" id="yes">Oui</button></form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
99
html/settings/index.php
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
require("../../include/variables.php");
|
||||||
|
require("../../include/functions.php");
|
||||||
|
$pdo = sqlConnect($sqlDatabaseHost, $sqlDatabaseName, $sqlDatabaseUser, $sqlDatabasePass);
|
||||||
|
|
||||||
|
if (!isset($_SESSION['userID'])) {
|
||||||
|
header("Location: /login");
|
||||||
|
http_response_code(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['username']) && isset($_POST['email'])) {
|
||||||
|
if(empty($_POST['username']) == false) {
|
||||||
|
if(preg_match('!\S!u', $_POST['username']) && preg_match('!\S!u', $_POST['email'])) {
|
||||||
|
$sqlRequest = "SELECT ID FROM users WHERE username = :username";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":username", htmlspecialchars($_POST['username']));
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
if($result && $result[0]['ID'] != $_SESSION['userID']) {
|
||||||
|
$status = "Le nom d'utilisateur n'est pas disponible";
|
||||||
|
} else {
|
||||||
|
$sqlRequest = "UPDATE users SET username = :username, email = :email WHERE ID = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":username", htmlspecialchars($_POST['username']));
|
||||||
|
$request->bindParam(":email", htmlspecialchars($_POST['email']));
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
if($request->execute()) {
|
||||||
|
$status = "Informations mises à jour";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$status = "Le nom d'utilisateur ne peut pas être vide";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<?php fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme);?>
|
||||||
|
<style>
|
||||||
|
.choice {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.choice a {
|
||||||
|
margin: 2em 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
</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">
|
||||||
|
<form action="#" method="post">
|
||||||
|
<div class="form">
|
||||||
|
<div class="form-title">Options</div>
|
||||||
|
<div class="status"><?=$status?></div>
|
||||||
|
<?php
|
||||||
|
$sqlRequest = "SELECT username, email FROM users WHERE ID = :userID";
|
||||||
|
$request = $pdo->prepare($sqlRequest);
|
||||||
|
$request->bindParam(":userID", $_SESSION['userID']);
|
||||||
|
$request->execute();
|
||||||
|
$result = $request->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
textInput("text", "", "username", "username", $result[0]['username']);
|
||||||
|
textInput("email", "", "email", "user@e59.fr", $result[0]['email']);
|
||||||
|
?>
|
||||||
|
<div class="choice">
|
||||||
|
<button type="submit">Mettre à jour</button>
|
||||||
|
<a href="deleteaccount.php">Supprimer le compte</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<div class="panel-content">
|
||||||
|
<?php fillFooter($footerText);?>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,312 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: crfont; /* Nom de la police */
|
|
||||||
src: url('/src/fonts/bahnschrift.ttf') format('truetype'); /* Chemin vers votre fichier TTF */
|
|
||||||
/* Autres attributs de la police (facultatif) */
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: crfont, sans-serif;
|
|
||||||
color: var(--text);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
font-family: Helvetica, Arial, sans-serif;
|
|
||||||
background: var(--background);
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
min-height: 100em;
|
|
||||||
}
|
|
||||||
|
|
||||||
header, footer, nav {
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
background: var(--banner-background);
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
header, footer {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
input, textarea {
|
|
||||||
background-color: var(--buttons);
|
|
||||||
color: var(--text);
|
|
||||||
padding: 0.4em 1em;
|
|
||||||
margin: 15px 0;
|
|
||||||
font-size: 1.2em;
|
|
||||||
border: 0;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type='submit'], button {
|
|
||||||
color: var(--text);
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type='submit']:hover, button:hover {
|
|
||||||
box-shadow: 0 0 15px var(--banner-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
border-radius: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navitem {
|
|
||||||
padding: 0.5em;
|
|
||||||
background-color: var(--buttons);
|
|
||||||
margin-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: var(--text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status {
|
|
||||||
color: rgb(199 181 147);
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
width: 80%;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pancontent {
|
|
||||||
width: 90%;
|
|
||||||
display: flex;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.athena-container {
|
|
||||||
padding: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.athena {
|
|
||||||
height: 7em;
|
|
||||||
border-radius: 3.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.athena:hover {
|
|
||||||
box-shadow: 0 0 15px rgba(255, 255, 255, 0.322);
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-title {
|
|
||||||
text-align: right;
|
|
||||||
margin-top: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-title .title {
|
|
||||||
font-size: 3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview {
|
|
||||||
padding: 2em 0.5em;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-illustration {
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-details {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-link {
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-miniature {
|
|
||||||
max-width: 15em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-data {
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-titre {
|
|
||||||
font: 1.5em crfont, Arial;
|
|
||||||
padding: 0.5em 0 0.5em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-resume-input {
|
|
||||||
min-height: 5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-info .article-auteur {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-info .article-classification {
|
|
||||||
padding: 1em 0;
|
|
||||||
font-size: 1.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-info .article-titre {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article .article-illustration {
|
|
||||||
padding: 2em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article .article-miniature {
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 40%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-content img {
|
|
||||||
max-height: 10em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-content {
|
|
||||||
width: 80%;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-header {
|
|
||||||
background-color: var(--banner-background);
|
|
||||||
padding-bottom: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-banner {
|
|
||||||
width: 100%;
|
|
||||||
height: 12em;
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-pp-image {
|
|
||||||
width: 10em;
|
|
||||||
height: 10em;
|
|
||||||
border-radius: 10em;
|
|
||||||
transform: translate(0, -60%);
|
|
||||||
border: 5px solid var(--banner-background);
|
|
||||||
background-color: var(--banner-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-pp {
|
|
||||||
height: 6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .display-name {
|
|
||||||
font-weight: bold;
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-role {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .certification {
|
|
||||||
transform: translate(0, +22%);
|
|
||||||
width: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .bio {
|
|
||||||
padding: 1em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .user-articles {
|
|
||||||
margin-top: 5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-main-profile .bio-input {
|
|
||||||
max-height: 3em;
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-auteur {
|
|
||||||
background-color: var(--banner-background);
|
|
||||||
display: flex;
|
|
||||||
padding: 0.5em 1em 0.5em 0.5em;
|
|
||||||
border-radius: 10em;
|
|
||||||
width: 15em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-auteur .auteur-display-name {
|
|
||||||
font-weight: bold;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-auteur .auteur-display-name .certification {
|
|
||||||
transform: translate(0, -15%);
|
|
||||||
width: 1.5em;
|
|
||||||
margin-left: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-auteur .auteur-names {
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-auteur .auteur-pp {
|
|
||||||
height: 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-auteur .auteur-pp-image {
|
|
||||||
width: 4em;
|
|
||||||
height: 4em;
|
|
||||||
border-radius: 4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row {
|
|
||||||
display: inline-block;
|
|
||||||
background-color: var(--banner-background);
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 2em;
|
|
||||||
margin: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row input {
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
background-color: var(--buttons);
|
|
||||||
color: var(--text);
|
|
||||||
border-radius: 10px;
|
|
||||||
color: var(--text);
|
|
||||||
padding: 0.4em 1em;
|
|
||||||
margin: 15px;
|
|
||||||
font-size: 1.2em;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media(max-width: 750px) {
|
|
||||||
body {
|
|
||||||
font-size: 0.8em
|
|
||||||
}
|
|
||||||
.article-preview {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.article-preview .article-illustration {
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2em 0;
|
|
||||||
}
|
|
||||||
.article-preview .article-miniature {
|
|
||||||
max-width: 100%;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-details {
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-preview .article-data {
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
.article-preview .article-titre {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
.article-preview .article-resume {
|
|
||||||
font-size: 1.2em;
|
|
||||||
}
|
|
||||||
.article .article-miniature {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
Before Width: | Height: | Size: 408 KiB After Width: | Height: | Size: 404 KiB |
@ -1,56 +1,217 @@
|
|||||||
<?php
|
<?php // Functions
|
||||||
session_start();
|
|
||||||
|
|
||||||
if(!isset($_SESSION['accreditation'])) {
|
session_start();
|
||||||
$_SESSION['accreditation'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!isset($_SESSION['role'])) {
|
if (!isset($_SESSION['userID'])) {
|
||||||
$_SESSION['role'] = 0;
|
$_SESSION['userAccreditation'] = 0;
|
||||||
}
|
$_SESSION['userLevel'] = 0;
|
||||||
|
|
||||||
if(!isset($_COOKIE['theme'])) {
|
|
||||||
setcookie('theme', 0, time()+10*60*60);
|
|
||||||
$theme_dark = $themes_dark[0];
|
|
||||||
$theme_light = $themes_light[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($_GET['theme'])) {
|
|
||||||
setcookie('theme', (int)$_GET['theme'] % 2);
|
|
||||||
$theme_dark = $themes_dark[$_GET['theme']];
|
|
||||||
$theme_light = $themes_light[$_GET['theme']];
|
|
||||||
} else if(isset($_COOKIE['theme'])){
|
|
||||||
$theme_dark = $themes_dark[$_COOKIE['theme']];
|
|
||||||
$theme_light = $themes_light[$_COOKIE['theme']];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function nav($nav) {
|
|
||||||
foreach($nav as $name => $url) {
|
|
||||||
echo "<a href='$url'><div class='navitem'>$name</div></a>";
|
|
||||||
}
|
}
|
||||||
if($_SESSION['role'] >= 3) {
|
|
||||||
echo "<a href='admin.php'><div class='navitem'>Admin</div></a>";
|
|
||||||
}
|
|
||||||
if (isset($_SESSION['userid'])) {
|
|
||||||
echo "<a href='compte.php'><div class='navitem'>Profil</div></a><a href='logout.php'><div class='navitem'>Déconnexion</div></a>";
|
|
||||||
} else {
|
|
||||||
echo "<a href='login.php'><div class='navitem'>Connexion</div></a>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function connect($dbhost, $dbname, $dbuser, $dbpass) {
|
if (!isset($_COOKIE['theme'])) {
|
||||||
try
|
setcookie('theme', 0, time()+10*60*60);
|
||||||
{
|
$darkTheme = $darkThemes[0];
|
||||||
$bdd = new PDO('mysql:host=' . $dbhost . ';dbname=' . $dbname . ';charset=UTF8mb4',$dbuser,$dbpass);
|
$lightTheme = $lightThemes[0];
|
||||||
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
}
|
||||||
|
|
||||||
|
if (isset($_GET['theme'])) {
|
||||||
|
$newTheme = (int)$_GET['theme'] % 2;
|
||||||
|
setcookie('theme', $newTheme); // % 2 => Number of different themes
|
||||||
|
$darkTheme = $darkThemes[$newTheme];
|
||||||
|
$lightTHeme = $lightThemes[$newTheme];
|
||||||
|
|
||||||
|
} else if (isset($_COOKIE['theme'])) {
|
||||||
|
$theme = (int)$_COOKIE['theme'] % 2;
|
||||||
|
$darkTheme = $darkThemes[$theme];
|
||||||
|
$lightTheme = $lightThemes[$theme];
|
||||||
|
}
|
||||||
|
|
||||||
|
$status = "";
|
||||||
|
|
||||||
|
function markdownContent($filePath, $rootFilePath) {
|
||||||
|
$markdownContent = file_get_contents($filePath);
|
||||||
|
require_once $rootFilePath . 'include/parsedown.php';
|
||||||
|
$parsedown = new Parsedown();
|
||||||
|
return $parsedown->text($markdownContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillHead($rootPageURL, $pageTitle, $darkTheme, $lightTheme) {
|
||||||
|
|
||||||
|
echo ('<meta charset="UTF-8">');
|
||||||
|
echo ('<meta name="viewport" content="width=device-width, initial-scale=1.0">');
|
||||||
|
echo ('<link rel="stylesheet" href="' . $rootPageURL . 'src/css/style.css">');
|
||||||
|
echo ('<link rel="icon" href="' . $rootPageURL . 'src/img/favicon.ico">');
|
||||||
|
|
||||||
|
echo ('<style>');
|
||||||
|
|
||||||
|
echo ('@media (prefers-color-scheme: dark) {');
|
||||||
|
echo ('.body {');
|
||||||
|
echo ($darkTheme);
|
||||||
|
echo ('}');
|
||||||
|
echo ('}');
|
||||||
|
|
||||||
|
echo ('@media (prefers-color-scheme: light) {');
|
||||||
|
echo ('.body {');
|
||||||
|
echo ($lightTheme);
|
||||||
|
echo ('}');
|
||||||
|
echo ('}');
|
||||||
|
|
||||||
|
echo ('</style>');
|
||||||
|
|
||||||
|
echo ('<title>' . $pageTitle . '</title>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillHeader($rootPageURL, $headerTitle, $headerSubtitle) {
|
||||||
|
|
||||||
|
echo ('<div class="logo-container">');
|
||||||
|
|
||||||
|
echo ('<a href="' . $rootPageURL . '">');
|
||||||
|
echo ('<img src="' . $rootPageURL . 'src/img/athena-mono.png" class="logo-img">');
|
||||||
|
echo ('</a>');
|
||||||
|
|
||||||
|
echo ('</div>');
|
||||||
|
|
||||||
|
echo ('<div class="content">');
|
||||||
|
|
||||||
|
echo ('<div class="header-title-container">');
|
||||||
|
echo ('<div class="header-title">' . $headerTitle . '</div>');
|
||||||
|
echo ('<div class="header-subtitle">' . $headerSubtitle . '</div>');
|
||||||
|
echo ('</div>');
|
||||||
|
|
||||||
|
echo ('</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillNav($rootPageURL) {
|
||||||
|
|
||||||
|
echo ('<a href="' . $rootPageURL . 'news"><div class="nav-link">News</div></a>');
|
||||||
|
echo ('<a href="' . $rootPageURL . 'about"><div class="nav-link">A propos</div></a>');
|
||||||
|
|
||||||
|
/*if ($_SESSION['userLevel'] >= 3) {
|
||||||
|
echo ('<a href="' . $rootPageURL . 'admin"><div class="nav-link">Admin</div></a>');
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(isset($_SESSION['userID'])) {
|
||||||
|
echo ('<a href="' . $rootPageURL . 'account"><div class="nav-link">Profil</div></a>');
|
||||||
|
echo ('<a href="' . $rootPageURL . 'settings"><div class="nav-link">Options</div></a>');
|
||||||
|
echo ('<a href="' . $rootPageURL . 'login/logout.php"><div class="nav-link">Déconnexion</div></a>');
|
||||||
|
} else {
|
||||||
|
echo ('<a href="' . $rootPageURL . 'login"><div class="nav-link">Se connecter</div></a>');
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
}
|
||||||
{
|
|
||||||
die('Erreur : '.$e->getMessage());
|
function fillFooter($footerText) {
|
||||||
|
echo($footerText);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sqlConnect($dbHost, $dbName, $dbUser, $dbPass) {
|
||||||
|
try {
|
||||||
|
$pdo = new PDO('mysql:host=' . $dbHost . ';dbname=' . $dbName . ';charset=UTF8mb4', $dbUser, $dbPass);
|
||||||
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
} catch(Exception $e) {
|
||||||
|
require('error.php');
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
return $bdd;
|
|
||||||
}
|
return $pdo;
|
||||||
|
}
|
||||||
|
|
||||||
|
function userWidget($userPPURL, $userDisplayName, $userName, $userLevel, $certificationColors, $rootPageURL) {
|
||||||
|
|
||||||
|
echo ('<a href="' . $rootPageURL . 'users?u=' . $userName . '">');
|
||||||
|
echo ('<div class="user-widget">');
|
||||||
|
|
||||||
|
echo ('<div class="user-pp">');
|
||||||
|
echo ('<img src="' . $userPPURL . '">');
|
||||||
|
echo ('</div>');
|
||||||
|
|
||||||
|
echo ('<div class="user-info">');
|
||||||
|
|
||||||
|
echo ('<div class="user-display-name">');
|
||||||
|
echo ($userDisplayName);
|
||||||
|
if ($userLevel > 1) {
|
||||||
|
echo ('<svg class="certification" fill="' . $certificationColors[$userLevel] . '" viewBox="0 0 22 22" aria-label="' . $userLevels[$userLevel] . '" role="img">');
|
||||||
|
echo ('<g><path d="M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"></path></g>');
|
||||||
|
echo ('</svg>');
|
||||||
|
}
|
||||||
|
echo ('</div>');
|
||||||
|
|
||||||
|
echo ('<div class="user-name">@' . $userName . '</div>');
|
||||||
|
|
||||||
|
echo ('</div>');
|
||||||
|
|
||||||
|
echo ('</div>');
|
||||||
|
echo ('</a>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function listArticles($result, $rootPageURL) {
|
||||||
|
|
||||||
|
foreach($result as $article) {
|
||||||
|
$pubDateTime = strtotime($article['date']);
|
||||||
|
$pubDate = date('d/m/Y', $pubDateTime);
|
||||||
|
$articleID = $article['ID'];
|
||||||
|
$articleTitle = $article['title'];
|
||||||
|
$articleResume = $article['resume'];
|
||||||
|
$miniatureURL = empty($article['miniature']) ? $rootPageURL . "src/img/empty.jpg" : $article['miniature'];
|
||||||
|
if(isset($article['username']) && isset($article['display_name'])) {
|
||||||
|
$authorLink = ' | <a href="user.php?user=' . $article['username'] . '">' . $article['display_name'] . '</a>';
|
||||||
|
} else {
|
||||||
|
$authorLink = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo('<div class="article-preview">');
|
||||||
|
|
||||||
|
echo('<a href="'. $rootPageURL .'news?article=' . $articleID . '" class="article-link">');
|
||||||
|
echo('<div class="article-illustration">');
|
||||||
|
|
||||||
|
echo('<img src="' . $miniatureURL . '" class="article-miniature">');
|
||||||
|
|
||||||
|
echo('</div>');
|
||||||
|
echo('</a>');
|
||||||
|
|
||||||
|
echo('<div class="article-info">');
|
||||||
|
echo('<div class="article-data">n° ' . $articleID . ' | ' . $pubDate . '</div>');
|
||||||
|
|
||||||
|
echo('<a href="'. $rootPageURL .'news?article=' . $articleID . '" class="article-link">');
|
||||||
|
echo('<div class="article-title">' . $articleTitle . '</div>');
|
||||||
|
echo('</a>');
|
||||||
|
|
||||||
|
echo('<div class="article-resume">' . $articleResume . '</div>');
|
||||||
|
|
||||||
|
echo('</div>');
|
||||||
|
echo('</div> ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function textInput($type, $shapePath, $name, $placeholder, $value) {
|
||||||
|
|
||||||
|
echo ('<div class="text-input">');
|
||||||
|
echo ('<label for="' . $name . '">');
|
||||||
|
echo ('<svg viewBox="0 0 24 24" aria-hidden="true" class="input-icon">');
|
||||||
|
echo ('<g>' . $shapePath . '</g>');
|
||||||
|
echo ('</svg>');
|
||||||
|
echo ('</label>');
|
||||||
|
echo ('<input type="' . $type . '" placeholder="' . $placeholder . '" name="' . $name . '" value="' . $value . '">');
|
||||||
|
echo ('</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fileInput($name) {
|
||||||
|
echo ('<div class="file-input">');
|
||||||
|
echo ('<input type="file" name="' . $name . '">');
|
||||||
|
echo ('</div>');
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectInput($name, $label, $options, $defaultValue) {
|
||||||
|
echo('<div class="select-input">');
|
||||||
|
echo('<label for="' . $name . '">' . $label . '</label>');
|
||||||
|
echo('<select name="' . $name .'" required>');
|
||||||
|
|
||||||
|
foreach($options as $value => $name) {
|
||||||
|
$selectStatus = $value == $defaultValue ? "selected" : "";
|
||||||
|
echo ('<option value="' . $value .'" ' . $selectStatus . '>' . $name . '</option>');
|
||||||
|
}
|
||||||
|
|
||||||
|
echo('</select>');
|
||||||
|
echo('</div>');
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -1,24 +1,24 @@
|
|||||||
<?php
|
<?php // Variables
|
||||||
$config = parse_ini_file('../config/global.ini', true);
|
|
||||||
|
|
||||||
$dbuser = $config['sql']['dbuser'];
|
$globalConfig = parse_ini_file('/var/www/dev/config/global.ini', true);
|
||||||
$dbpass = $config['sql']['dbpass'];
|
|
||||||
$dbname = $config['sql']['dbname'];
|
|
||||||
$dbhost = $config['sql']['dbhost'];
|
|
||||||
|
|
||||||
$root = $config['main']['root'];
|
$rootPageURL = $globalConfig['root']['pageURL'];
|
||||||
$wwwroot = $config['main']['wwwroot'];
|
$rootFilePath = $globalConfig['root']['filePath'];
|
||||||
|
|
||||||
$title = $config['main']['title'];
|
$sqlDatabaseName = $globalConfig['sql']['databaseName'];
|
||||||
$header_title = $config['main']['header-title'];
|
$sqlDatabaseUser = $globalConfig['sql']['databaseUser'];
|
||||||
$header_subtitle = $config['main']['header-subtitle'];
|
$sqlDatabasePass = $globalConfig['sql']['databasePass'];
|
||||||
$copyright = $config['main']['copyright'];
|
$sqlDatabaseHost = $globalConfig['sql']['databaseHost'];
|
||||||
$nav = $config['nav'];
|
|
||||||
$navadmin = $nav;
|
$pageTitle = $globalConfig['main']['pageTitle'];
|
||||||
$status = "";
|
$headerTitle = $globalConfig['main']['headerTitle'];
|
||||||
$classifications = $config['classifications'];
|
$headerSubtitle = $globalConfig['main']['headerSubtitle'];
|
||||||
$roles = $config['roles'];
|
$footerText = $globalConfig['main']['footerText'];
|
||||||
$themes_dark = $config['themes_dark'];
|
|
||||||
$themes_light = $config['themes_light'];
|
$confidentialLevels = $globalConfig['confidentialLevels'];
|
||||||
$certif_colors = $config['certifcolors']
|
$userLevels = $globalConfig['userLevels'];
|
||||||
|
$certificationColors = $globalConfig['certificationColors'];
|
||||||
|
|
||||||
|
$darkThemes = $globalConfig['darkThemes'];
|
||||||
|
$lightThemes = $globalConfig['lightThemes'];
|
||||||
?>
|
?>
|