From 141291c29306391f91e7ceee57ff4d6e9907ab1d Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 21 Mar 2025 00:47:16 +0100 Subject: dossier public --- index.php | 128 -------------------------------------------------------------- 1 file changed, 128 deletions(-) delete mode 100644 index.php (limited to 'index.php') diff --git a/index.php b/index.php deleted file mode 100644 index 3e89113..0000000 --- a/index.php +++ /dev/null @@ -1,128 +0,0 @@ -setLanguage('fr'); // attention, exécute une autre fonction qui peut échouer -$ckeditor->setStorageMode('files'); -$ckeditor->setPage($page); - - -// routage - -// upload images AJAX -if(isset($_GET['action']) && $_GET['action'] === 'upload_image_editor') -{ - $ckeditor->checkAjaxRequest(); -} - -// submit normal -if(isset($_GET['action']) && $_GET['action'] === 'submit_editor' && isset($_POST["contenu"])) // HTML envoyé par l'éditeur -{ - $ckeditor->setFrom($from); - $html_from_editor = $ckeditor->checkSubmitPOST(); - - if($id_article == '') // nouvel article - { - $id_article = time(); - } - - if($ckeditor->getStorageMode() === 'database') - { - // => modèle - } - elseif($ckeditor->getStorageMode() === 'files') - { - file_put_contents(CKEditor::DATA_PATH . '/html/' . $id_article . '.html', $html_from_editor); - } - - header('Location: index.php?page=' . $ckeditor->getFrom()); - die; -} - -// modèle - récupération des articles -$id_array = []; // noms des id en BBD ou des fichiers -$articles_content = []; // contenu HTML - -if(isset($_GET['action']) && $_GET['action'] === 'open_editor' && $id_article == '') -{ - $articles_content = $ckeditor->openEditor() . "\n"; -} -else -{ - $articles_content = $ckeditor->displayNewArticleButton() . "\n"; -} - -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 - { - $id_array[] = rtrim($file_name, '.html'); - } - } - - // suppression et rechargement - if(isset($_GET['action']) && $_GET['action'] === 'delete_article') - { - if(in_array($id_article, $id_array)) - { - unlink(CKEditor::DATA_PATH . '/html/' . $id_article . '.html'); - //$ckeditor->deleteSideEffects(); - } - header('Location: index.php?page=' . $from); - die; - } - - // affichage - foreach($id_array 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 - - // vue - afficher des articles et éventuellement l'éditeur dans un des articles - 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) . "\n"; - } - else - { - $articles_content .= $ckeditor->displayArticle($id, $texte) . "\n"; - } - } - else - { - $articles_content .= $ckeditor->displayArticle($id, $texte) . "\n"; - } - } -} -// vue -?> - - - - - - - getCSSOutsideEditorTag() ?> - getCSSEditorTag() ?> - - -
- -
- - -- cgit v1.2.3