summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/index.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/public/index.php b/public/index.php
index c81728a..7bbb545 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,4 +1,6 @@
1<?php 1<?php
2declare(strict_types=1);
3
2function imagickCleanAndWriteImage(string $image_data, string $local_path): bool // "string" parce que file_get_contents... 4function imagickCleanAndWriteImage(string $image_data, string $local_path): bool // "string" parce que file_get_contents...
3{ 5{
4 $format = strtolower(pathinfo($local_path)['extension']); 6 $format = strtolower(pathinfo($local_path)['extension']);
@@ -59,7 +61,7 @@ function curlDownloadImage(string $url, int $maxRetries = 3, int $timeout = 10):
59 $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); 61 $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
60 //$curlError = curl_error($ch); 62 //$curlError = curl_error($ch);
61 63
62 curl_close($ch); 64 //curl_close($ch); // inutile depuis php 8.0
63 65
64 if($imageData !== false && $httpCode >= 200 && $httpCode < 300){ 66 if($imageData !== false && $httpCode >= 200 && $httpCode < 300){
65 return $imageData; 67 return $imageData;
@@ -157,7 +159,7 @@ elseif(isset($_GET['action']) && in_array($_GET['action'], ['upload_image', 'upl
157 die; 159 die;
158 } 160 }
159 if(!is_uploaded_file($_FILES['file']['tmp_name'])) { 161 if(!is_uploaded_file($_FILES['file']['tmp_name'])) {
160 http_response_code(500); 162 http_response_code(400);
161 echo json_encode(['message' => "Le fichier n'a pas été téléchargé correctement."]); 163 echo json_encode(['message' => "Le fichier n'a pas été téléchargé correctement."]);
162 die; 164 die;
163 } 165 }
@@ -280,7 +282,7 @@ elseif(isset($_GET['action']) && $_GET['action'] == 'upload_file'){
280 282
281 tinymce.init({ 283 tinymce.init({
282 selector: `#${article_id}`, 284 selector: `#${article_id}`,
283 language: 'fr_FR', // télécharger des paquets de langue ici: https://www.tiny.cloud/get-tiny/language-packages/ 285 language: 'fr_FR',
284 language_url: '../vendor/mklkj/tinymce-i18n/langs/fr_FR.js', // paquet mklkj/tinymce-i18n avec composer 286 language_url: '../vendor/mklkj/tinymce-i18n/langs/fr_FR.js', // paquet mklkj/tinymce-i18n avec composer
285 license_key: 'gpl', 287 license_key: 'gpl',
286 branding: false, 288 branding: false,
@@ -310,7 +312,7 @@ elseif(isset($_GET['action']) && $_GET['action'] == 'upload_file'){
310 }); 312 });
311 let skipPastePreProcess = false; 313 let skipPastePreProcess = false;
312 editor.on('Paste', function (e){ // déclenchement AVANT PastePreProcess et quelque que soit le contenu collé 314 editor.on('Paste', function (e){ // déclenchement AVANT PastePreProcess et quelque que soit le contenu collé
313 if (!e.clipboardData) { // e.clipboardData: DataTransfer 315 if(!e.clipboardData){ // e.clipboardData: DataTransfer
314 return; 316 return;
315 } 317 }
316 const items = e.clipboardData.items; // base64 318 const items = e.clipboardData.items; // base64