From 90b3efeeb9d939303ff80b180725e06e2e57af79 Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 13 Apr 2023 03:02:57 +0200 Subject: =?UTF-8?q?=C3=A9diteur=20page=20album?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 19 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 66b2f89..14371e5 100644 --- a/index.php +++ b/index.php @@ -40,7 +40,7 @@ if(isset($_SESSION['admin']) && $_SESSION['admin'] == 1 require('controller/Security.php'); // sécurité des chaines require('model/Article.php'); - if($_GET['page'] == 'discographie') + if($_GET['page'] === 'discographie' || $_GET['page'] === 'album') { require('model/Album.php'); } @@ -174,31 +174,28 @@ if(isset($_GET['page'])) $fonctionVisitor(); } - if($_GET['page'] == 'melaine') - {} + //if($_GET['page'] === 'melaine'){} } // page discographie (avec albums et articles) - elseif($_GET['page'] == 'discographie') + elseif($_GET['page'] === 'discographie') { - // rédaction + // nouvel album if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'edition') { - // modification - if(isset($_GET['file_code']) || !empty($_GET['file_code'])) - { - discoEdit($_GET['file_code'], 0); - } - // nouvel article - else + if(!isset($_GET['file_code']) || empty($_GET['file_code'])) { // par sécurité unset($_GET['file_code']); - discoEdit('', 0); + albumEdit('', 0); + } + else + { + discoVisitor(); } } // modification d'un positions.json (version sans JS) - else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'monter') + elseif($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] === 'monter') { if(isset($_GET['file_code']) && !empty($_GET['file_code'])) { @@ -211,11 +208,11 @@ if(isset($_GET['page'])) discoVisitor(); } } - else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'descendre') + elseif($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] === 'descendre') { if(isset($_GET['file_code']) && !empty($_GET['file_code'])) { - // 0 pour descendre + // -1 pour descendre inversionPositions($_GET['page'], $_GET['file_code'], 'Album', -1); discoVisitor(); } @@ -227,7 +224,14 @@ if(isset($_GET['page'])) // suppression else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'suppression') { - discoEdit($_GET['file_code'], 1); + if(isset($_GET['file_code']) && !empty($_GET['file_code'])) + { + albumEdit($_GET['file_code'], 1); + } + else + { + discoVisitor(); + } } else { @@ -235,10 +239,40 @@ if(isset($_GET['page'])) } } // page d'un album de la discographie - // page visiteur uniquement elseif($_GET['page'] == 'album') { - album($_GET['file_code']); + // page d'aucun album + if(!isset($_GET['file_code']) || $_GET['file_code'] == '') + { + header('Location: index.php?page=discographie'); + } + + if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'edition') + { + // modification + if(isset($_GET['file_code']) || !empty($_GET['file_code'])) + { + albumEdit($_GET['file_code'], 0); + } + // suppression + else if($_SESSION['admin'] == 1 && isset($_GET['action']) && $_GET['action'] == 'suppression') + { + albumEdit($_GET['file_code'], 1); + } + // on fait rien + else + { + // par sécurité + unset($_GET['file_code']); + + //albumEdit('', 0); + discoVisitor(); + } + } + else + { + albumVisitor($_GET['file_code']); + } } // page connexion elseif($_GET['page'] == 'connexion') -- cgit v1.2.3