From 695b1272d828f605ee5620d7ede3e148a2d30c98 Mon Sep 17 00:00:00 2001 From: Jan BELLON Date: Mon, 11 Mar 2024 18:01:59 +0000 Subject: [PATCH] Update 3 files - /html/src/css/style.css - /html/news.php - /html/editpage.php --- html/editpage.php | 35 +++++++++++++++++++++++------------ html/news.php | 20 +++++++++++++------- html/src/css/style.css | 32 ++++++++++++++++++-------------- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/html/editpage.php b/html/editpage.php index 48b3620c..d1e12cc2 100644 --- a/html/editpage.php +++ b/html/editpage.php @@ -51,11 +51,13 @@ if(isset($fichier)) { if(isset($_POST['page-content'])) { file_put_contents($fichier, nl2br($_POST['page-content'])); } - if(isset($_POST['classification'])&& isset($_GET['article'])) { + if(isset($_POST['classification']) && isset($_POST['image']) && isset($_POST['resume']) && isset($_GET['article'])) { $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); - $req = $bdd->prepare("UPDATE articles SET classification = :classification WHERE ID = :article"); + $req = $bdd->prepare("UPDATE articles SET classification = :classification, titre = :titre, resume = :resume WHERE ID = :article"); $req->bindParam(':classification', $_POST['classification']); + $req->bindParam(':titre', $_POST['titre']); + $req->bindParam(':resume', $_POST['resume']); $req->bindParam(':article', $_GET['article']); if($req->execute()) { $status = "Informations mises à jour"; @@ -129,13 +131,13 @@ if(isset($fichier)) { echo "
"; if(isset($_GET['article'])) { $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); - $req = $bdd->prepare("SELECT classification, titre FROM articles WHERE ID = :article"); + $req = $bdd->prepare("SELECT classification, titre, image FROM articles WHERE ID = :article"); $req->bindParam(":article", $_GET['article']); $req->execute(); $resultat = $req->fetchAll(PDO::FETCH_ASSOC); if($resultat) { - echo '
'; foreach($classifications as $id => $nom) { if((int)$resultat[0]['classification'] == $id) { echo ''; @@ -144,8 +146,11 @@ if(isset($fichier)) { } } - echo "
"; + echo '
'; $filename = $resultat[0]['titre']; + + echo '
'; + echo '
'; } } echo "

" . $filename . "

"; @@ -172,7 +177,7 @@ if(isset($fichier)) { $search = "%" . htmlspecialchars($_GET['search']) . "%"; $condition = "AND (titre LIKE '" . $search . "' OR ID LIKE '" . $search . "' OR auteur LIKE '" . $search . "') "; } - $req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles WHERE classification <= :accreditation " . $condition . "ORDER BY date DESC LIMIT 10"); + $req = $bdd->prepare("SELECT ID, titre, date, auteur, image, resume FROM articles WHERE classification <= :accreditation " . $condition . "ORDER BY date DESC LIMIT 10"); $req->bindParam(":accreditation", $_SESSION['accreditation']); $req->execute(); $resultat = $req->fetchAll(PDO::FETCH_ASSOC); @@ -180,12 +185,18 @@ if(isset($fichier)) { if ($resultat) { foreach($resultat as $row) { $date = strtotime($row['date']); - echo "

"; - echo ""; - echo "
" . $row['titre'] . "
"; - echo ""; - echo "
" . $row['auteur'] . "
"; - echo "
" . $row['ID'] . "
"; + echo '
'; + echo '
'; + echo '' + echo '
'; + echo '
'; + echo '
n° ' . $row['ID'] . ' | ' . date('d/m/Y', $date) . ' | '. $row['auteur'] . '
'; + echo ''; + echo '
' . $row['titre'] . '
'; + echo '
'; + echo '
' . $row['resume'] . '
'; + echo '
'; + echo '
' } } diff --git a/html/news.php b/html/news.php index f3a9b1e7..ed16902e 100644 --- a/html/news.php +++ b/html/news.php @@ -61,7 +61,7 @@ if (isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT) $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); $search = isset($_GET['search']) ? "%" . htmlspecialchars($_GET['search']) . "%" : "%%"; - $req = $bdd->prepare("SELECT ID, titre, date, auteur FROM articles WHERE (titre LIKE :search OR ID LIKE :search OR auteur LIKE :search) AND classification <= :accreditation ORDER BY date DESC"); + $req = $bdd->prepare("SELECT ID, titre, date, auteur, image, resume 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(); @@ -73,12 +73,18 @@ if (isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT) if ($resultat) { foreach($resultat as $row) { $date = strtotime($row['date']); - echo "

"; - echo ""; - echo "
" . $row['titre'] . "
"; - echo ""; - echo "
" . $row['auteur'] . "
"; - echo "
" . $row['ID'] . "
"; + echo '
'; + echo '
'; + echo '' + echo '
'; + echo '
'; + echo '
n° ' . $row['ID'] . ' | ' . date('d/m/Y', $date) . ' | '. $row['auteur'] . '
'; + echo ''; + echo '
' . $row['titre'] . '
'; + echo '
'; + echo '
' . $row['resume'] . '
'; + echo '
'; + echo '
' } } else { echo "Aucun article trouvé"; diff --git a/html/src/css/style.css b/html/src/css/style.css index 726f3995..aaac2d36 100644 --- a/html/src/css/style.css +++ b/html/src/css/style.css @@ -98,9 +98,26 @@ a { padding: 0.5em; } +.article-preview .article-illustration { + display: inline-block; + padding-right: 1em; +} + +.article-preview .article-details { + display: inline-block; + vertical-align: top; +} + .article-preview .article-link { color: var(--text); - display: inline-block; +} + +.article-preview .article-miniature { + max-width: 15em; +} + +.article-preview .article-data { + font-size: 0.8em; } .article-preview .article-titre { @@ -108,19 +125,6 @@ a { padding: 0 0 0.3em 0; } -.article-preview .article-date { - display: inline-block; - padding: 0 1em; -} - -.article-preview .article-auteur { - float: right; -} - -.article-info { - -} - .article-info .article-auteur { float: right; }