setStorageMode('files'); $ckeditor->setPage($page); // routage // upload images AJAX if(isset($_GET['action']) && $_GET['action'] === 'upload_image_editor') { $ckeditor->checkAjaxReqest(); } // submit normal if(isset($_GET['action']) && $_GET['action'] === 'submit_editor') // HTML envoyé par l'éditeur { $ckeditor->setFrom($from); $ckeditor->checkSubmitPOST(); } // modèle - récupération des articles $articles_id = []; // noms des id en BBD ou des fichiers $articles_content = []; // contenu HTML if($ckeditor->getStorageMode() === 'database') { // => modèle } elseif($ckeditor->getStorageMode() === 'files') { foreach(scandir(CKEditor::DATA_PATH . '/html/') as $file_name) { if(str_ends_with($file_name, '.html')) // filtre . et .. et d'éventuels autres fichiers { $articles_id[] = rtrim($file_name, '.html'); } } foreach($articles_id as $id) { $texte = trim(file_get_contents(CKEditor::DATA_PATH . '/html/' . $id . '.html')); //$texte = addslashes($texte); // échappe ', ", \ et NULL, je sais pas si c'est bien // ouvrir l'éditeur sur un des articles ou aucun if(isset($_GET['action']) && $_GET['action'] === 'open_editor') { if($id === $id_article) { $texte = addcslashes($texte, "'"); // échapper les simples quotes pour javascript $articles_content[] = $ckeditor->openEditor($id, $texte); } else { $articles_content[] = $ckeditor->displayArticle($id, $texte); } } else // affichage article { $articles_content[] = $ckeditor->displayArticle($id, $texte); } } } require 'src/view/templates/page.php';