From 66ee0f5f5416aed9f7a7264f18ae6bdf4c8ed50f Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 19 Jul 2022 13:43:33 +0200 Subject: miniatures articles 1 --- controller/ajax.php | 7 ++++++- controller/ckeditor.php | 20 +++++++++++--------- controller/installation.php | 9 +++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'controller') diff --git a/controller/ajax.php b/controller/ajax.php index 489e814..13f5c08 100644 --- a/controller/ajax.php +++ b/controller/ajax.php @@ -19,10 +19,15 @@ if(isset($_GET['action']) && isset($_GET['page']) && $_GET['action'] == 'upload_ $Image = new Image(true); $Image->upload(); echo($Image->reponseAjax); // attendu par l'éditeur + + $Image->makeThumbnail(630); // => taille de la
+ // on pourra l'agrandir en cliquant dessus + // code exécuté alors que l'utilisateur récupère la main } - exit; // stop !! + exit(); // stop !! } + // page restauration quand le fichier zip est lourd // -> input file onchange if(isset($_GET['action']) && $_GET['action'] == 'restauration' diff --git a/controller/ckeditor.php b/controller/ckeditor.php index 43fd2e2..3e14494 100644 --- a/controller/ckeditor.php +++ b/controller/ckeditor.php @@ -34,12 +34,10 @@ function preparationCKeditor($html) // réception du HTML créé par l'éditeur function submitCKeditor() { - $page = $_GET['page']; - // déjà fait mais on ne sait jamais if(!isset($_SESSION['admin']) || $_SESSION['admin'] != 1) { - header('Location: index.php?page=' . $page . '&erreur=connexion'); + header('Location: index.php?page=' . $_GET['page'] . '&erreur=connexion'); exit(); } @@ -56,32 +54,36 @@ function submitCKeditor() //$contenu = mediaSubmit($contenu); // ne pas continuer si la variable est vide (javascript mal supporté ou utilisation de IE, bug?, erreur de l'utilisateur), risque perte de contenu !! - if($page != 'discographie' && $contenu == '') + if($_GET['page'] != 'discographie' && $contenu == '') { - header('Location: index.php?page=' . $page . '&erreur=contenu_vide'); + header('Location: index.php?page=' . $_GET['page'] . '&erreur=contenu_vide'); exit(); } } // pages avec des articles simples (melaine...) - if($page != 'discographie') + if($_GET['page'] != 'discographie') { - $Article = new Article($page); + $Article = new Article($_GET['page']); if(!isset($_SESSION['target']) || $_SESSION['target'] == '') { $Article->create($contenu); + + // create html-mini } else { $Article->fileCode = $_SESSION['target']; // erreur ici? $Article->update($contenu); + + // update html-mini } } // page discographie - else if($page == 'discographie') + else if($_GET['page'] == 'discographie') { - $Album = new Album($page); + $Album = new Album($_GET['page']); // on retrouve les données si nécessaire if(isset($_SESSION['target']) && $_SESSION['target'] != '') diff --git a/controller/installation.php b/controller/installation.php index b2a687c..3745189 100644 --- a/controller/installation.php +++ b/controller/installation.php @@ -77,6 +77,15 @@ function installation() { createIndexPHP('data/' . $page . '/html/index.php', $droitsFichiers); } + if(!file_exists('data/' . $page . '/html-mini-images')) + { + mkdir('data/' . $page . '/html-mini-images'); + chmod('data/' . $page . '/html-mini-images', $droitsDossiers); + } + if(!file_exists('data/' . $page . '/html-mini-images/index.php')) + { + createIndexPHP('data/' . $page . '/html-mini-images/index.php', $droitsFichiers); + } if(!file_exists('data/' . $page . '/images')) { mkdir('data/' . $page . '/images'); -- cgit v1.2.3