diff options
Diffstat (limited to 'src/controller/ajax_admin.php')
-rw-r--r-- | src/controller/ajax_admin.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/controller/ajax_admin.php b/src/controller/ajax_admin.php index 944e84b..2318ac1 100644 --- a/src/controller/ajax_admin.php +++ b/src/controller/ajax_admin.php | |||
@@ -197,7 +197,6 @@ if($_SERVER['CONTENT_TYPE'] === 'application/json') | |||
197 | $data = file_get_contents('php://input'); | 197 | $data = file_get_contents('php://input'); |
198 | $json = json_decode($data, true); | 198 | $json = json_decode($data, true); |
199 | 199 | ||
200 | // requêtes de tinymce ou touchant aux articles | ||
201 | if(isset($_GET['action'])) | 200 | if(isset($_GET['action'])) |
202 | { | 201 | { |
203 | if($_GET['action'] === 'editor_submit' && isset($json['id']) && isset($json['content'])) | 202 | if($_GET['action'] === 'editor_submit' && isset($json['id']) && isset($json['content'])) |
@@ -356,13 +355,17 @@ if($_SERVER['CONTENT_TYPE'] === 'application/json') | |||
356 | die; | 355 | die; |
357 | } | 356 | } |
358 | 357 | ||
359 | // config formulaire | 358 | |
360 | /*elseif($_GET['action'] === 'recipient_email'){ | 359 | /* -- bloc Formulaire -- */ |
360 | elseif($_GET['action'] === 'recipient_email'){ | ||
361 | $email = htmlspecialchars(trim($json['email'])); | 361 | $email = htmlspecialchars(trim($json['email'])); |
362 | 362 | ||
363 | if(filter_var($email, FILTER_VALIDATE_EMAIL) && isset($json['hidden']) && empty($json['hidden'])){ | 363 | if((filter_var($email, FILTER_VALIDATE_EMAIL) // nouvel e-mail |
364 | || ($json['email'] === '' && !empty(Config::$email_dest))) // e-mail par défaut | ||
365 | && isset($json['hidden']) && empty($json['hidden'])) | ||
366 | { | ||
364 | $form_data = $entityManager->find('App\Entity\NodeData', $json['id']); | 367 | $form_data = $entityManager->find('App\Entity\NodeData', $json['id']); |
365 | $form_data->updateData('email', $json['email']); | 368 | $form_data->updateData('email', $email); |
366 | $entityManager->persist($form_data); | 369 | $entityManager->persist($form_data); |
367 | $entityManager->flush(); | 370 | $entityManager->flush(); |
368 | 371 | ||
@@ -372,10 +375,13 @@ if($_SERVER['CONTENT_TYPE'] === 'application/json') | |||
372 | echo json_encode(['success' => false]); | 375 | echo json_encode(['success' => false]); |
373 | } | 376 | } |
374 | die; | 377 | die; |
375 | }*/ | 378 | } |
376 | // e-mail de test | ||
377 | elseif($_GET['action'] === 'test_email'){ | 379 | elseif($_GET['action'] === 'test_email'){ |
378 | if(sendEmail(false, 'nom du visiteur', 'adresse@du_visiteur.fr', "TEST d'un envoi d'e-mail depuis le site web")){ | 380 | // destinataire = e-mail par défaut dans config.ini OU choisi par l'utilisateur |
381 | $form_data = $entityManager->find('App\Entity\NodeData', $json['id']); | ||
382 | $recipient = $form_data->getData()['email'] ?? Config::$email_dest; | ||
383 | |||
384 | if(sendEmail($recipient, false, 'nom du visiteur', 'adresse@du_visiteur.fr', "TEST d'un envoi d'e-mail depuis le site web")){ | ||
379 | echo json_encode(['success' => true]); | 385 | echo json_encode(['success' => true]); |
380 | } | 386 | } |
381 | else{ | 387 | else{ |