summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php51
1 files changed, 23 insertions, 28 deletions
diff --git a/index.php b/index.php
index 96b3259..e02d3d1 100644
--- a/index.php
+++ b/index.php
@@ -1,54 +1,49 @@
1<?php 1<?php
2// index.php 2// index.php
3 3
4require 'src/integration/ckeditor5/config.php'; 4
5require $ckeditor_integration . 'init.php'; 5require 'src/integration/ckeditor5/CKEditor.php';
6makeTranslationSymLink(); 6$ckeditor = new CKEditor();
7 7
8 8
9// routage 9// routage
10 10
11// upload images AJAX 11// upload images AJAX
12require $ckeditor_integration . 'image_upload.php'; 12if(isset($_GET['action']) && $_GET['action'] === 'upload_image')
13{
14 $ckeditor->checkAjaxReqest();
15}
13 16
14// submit normal 17// submit normal
15if(isset($_GET['action']) && $_GET['action'] === 'submit') // HTML envoyé par l'éditeur 18if(isset($_GET['action']) && $_GET['action'] === 'submit') // HTML envoyé par l'éditeur
16{ 19{
17 require $ckeditor_integration . 'clean_html.php'; 20 $ckeditor->checkSubmitPOST();
18 $html_from_editor = getAndCleanEditorOutput(); // manipule $_POST['contenu'];
19
20 // enregistrement des données
21 //var_dump($html_from_editor);
22 echo "ce programme n'enregistre rien, faîtes-le dans votre application et supprimer cette ligne dans index.php"; die;
23
24 header('Location: ' . $previous_page);
25 die;
26} 21}
27 22
23/*$articles = [];
24foreach($articles as $article)
25{}*/
26
28// ouvrir l'éditeur 27// ouvrir l'éditeur
29elseif(isset($_GET['page']) && $_GET['page'] === 'editor') 28if(isset($_GET['action']) && $_GET['action'] === 'editor')
30{ 29{
31 require $ckeditor_integration . 'create.php'; 30 $editeurHTML = $ckeditor->openEditor();
32} 31}
33else // $previous_page, affichage sans l'article 32else // affichage article
34{ 33{
35 // contrôleur 34 if($ckeditor->storage === 'database')
36 35 {
37 // modèle 36 // ton code
38 if($storage === 'database') 37 }
39 {} 38 elseif($ckeditor->storage === 'files')
40 elseif($storage === 'files')
41 { 39 {
42 $texte = file_get_contents('data/' . $page . '/html/' . $nom_article . '.html'); 40 $texte = file_get_contents($ckeditor->data_path . '/html/' . $ckeditor->nom_article . '.html');
43 //$texte = trim(addcslashes($texte, "'")); // échappe seulement les simples quotes 41 //$texte = trim(addcslashes($texte, "'")); // échappe seulement les simples quotes
44 $texte = trim($texte); 42 $texte = trim($texte);
45 } 43 }
46 44
47 // vue 45 $editeurHTML = '<div class="conteneur_article" >' . $texte . '</div>
48 $css_editeur = ''; 46 <p><a href="' . $ckeditor->open_editor_link . '">ouvrir l\'éditeur</a></p>';
49 $contenu = '<div class="conteneur_article" >' . $texte . '</div>
50 <p><a href="' . $open_editor_link . '">ouvrir l\'éditeur</a></p>';
51} 47}
52 48
53// vue
54require 'src/view/templates/page.php'; 49require 'src/view/templates/page.php';