blob: e02d3d17e273f5fe8678052cf11aa0ab789bf019 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?php
// index.php
require 'src/integration/ckeditor5/CKEditor.php';
$ckeditor = new CKEditor();
// routage
// upload images AJAX
if(isset($_GET['action']) && $_GET['action'] === 'upload_image')
{
$ckeditor->checkAjaxReqest();
}
// submit normal
if(isset($_GET['action']) && $_GET['action'] === 'submit') // HTML envoyé par l'éditeur
{
$ckeditor->checkSubmitPOST();
}
/*$articles = [];
foreach($articles as $article)
{}*/
// ouvrir l'éditeur
if(isset($_GET['action']) && $_GET['action'] === 'editor')
{
$editeurHTML = $ckeditor->openEditor();
}
else // affichage article
{
if($ckeditor->storage === 'database')
{
// ton code
}
elseif($ckeditor->storage === 'files')
{
$texte = file_get_contents($ckeditor->data_path . '/html/' . $ckeditor->nom_article . '.html');
//$texte = trim(addcslashes($texte, "'")); // échappe seulement les simples quotes
$texte = trim($texte);
}
$editeurHTML = '<div class="conteneur_article" >' . $texte . '</div>
<p><a href="' . $ckeditor->open_editor_link . '">ouvrir l\'éditeur</a></p>';
}
require 'src/view/templates/page.php';
|