From 4b21b40292de8ee08220ab901651a13ec5e35199 Mon Sep 17 00:00:00 2001 From: polo Date: Wed, 22 Jan 2025 23:45:52 +0100 Subject: gestion des $page, $from et $id --- index.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index e02d3d1..f388081 100644 --- a/index.php +++ b/index.php @@ -1,22 +1,31 @@ setStorageMode('files'); +$ckeditor->setPage($page); // routage // upload images AJAX -if(isset($_GET['action']) && $_GET['action'] === 'upload_image') +if(isset($_GET['action']) && $_GET['action'] === 'upload_image_editor') { $ckeditor->checkAjaxReqest(); } // submit normal -if(isset($_GET['action']) && $_GET['action'] === 'submit') // HTML envoyé par l'éditeur +if(isset($_GET['action']) && $_GET['action'] === 'submit_editor') // HTML envoyé par l'éditeur { + $ckeditor->setFrom($from); + $ckeditor->setIdArticle($id_article); $ckeditor->checkSubmitPOST(); } @@ -25,25 +34,26 @@ foreach($articles as $article) {}*/ // ouvrir l'éditeur -if(isset($_GET['action']) && $_GET['action'] === 'editor') +if(isset($_GET['action']) && $_GET['action'] === 'open_editor') { + $ckeditor->setIdArticle($id_article); $editeurHTML = $ckeditor->openEditor(); } else // affichage article { - if($ckeditor->storage === 'database') + $ckeditor->setIdArticle('1646148841'); + if($ckeditor->getStorageMode() === 'database') { // ton code } - elseif($ckeditor->storage === 'files') + elseif($ckeditor->getStorageMode() === 'files') { - $texte = file_get_contents($ckeditor->data_path . '/html/' . $ckeditor->nom_article . '.html'); + $texte = file_get_contents($ckeditor->getDataPath() . '/html/' . $ckeditor->getIdArticle() . '.html'); //$texte = trim(addcslashes($texte, "'")); // échappe seulement les simples quotes $texte = trim($texte); } - $editeurHTML = '
' . $texte . '
-

ouvrir l\'éditeur

'; +

ouvrir l\'éditeur

'; } require 'src/view/templates/page.php'; -- cgit v1.2.3