diff options
Diffstat (limited to 'src/controller')
| -rw-r--r-- | src/controller/ContactFormController.php | 16 | ||||
| -rw-r--r-- | src/controller/UserController.php | 2 | ||||
| -rw-r--r-- | src/controller/ViewController.php | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/controller/ContactFormController.php b/src/controller/ContactFormController.php index 181e93c..01faa72 100644 --- a/src/controller/ContactFormController.php +++ b/src/controller/ContactFormController.php | |||
| @@ -80,4 +80,20 @@ class ContactFormController | |||
| 80 | } | 80 | } |
| 81 | die; | 81 | die; |
| 82 | } | 82 | } |
| 83 | static public function deleteEmail(EntityManager $entityManager, array $json): void | ||
| 84 | { | ||
| 85 | $email = $entityManager->find('App\Entity\Email', $json['id']); | ||
| 86 | $entityManager->remove($email); | ||
| 87 | $entityManager->flush(); | ||
| 88 | echo json_encode(['success' => true]); | ||
| 89 | die; | ||
| 90 | } | ||
| 91 | static public function toggleSensitiveEmail(EntityManager $entityManager, array $json): void | ||
| 92 | { | ||
| 93 | $email = $entityManager->find('App\Entity\Email', $json['id']); | ||
| 94 | $email->makeSensitive($json['checked']); | ||
| 95 | $entityManager->flush(); | ||
| 96 | echo json_encode(['success' => true, 'checked' => $json['checked'], 'deletion_date' => $email->getDeletionDate()->format('d/m/Y')]); | ||
| 97 | die; | ||
| 98 | } | ||
| 83 | } \ No newline at end of file | 99 | } \ No newline at end of file |
diff --git a/src/controller/UserController.php b/src/controller/UserController.php index a35b09e..f3c99e7 100644 --- a/src/controller/UserController.php +++ b/src/controller/UserController.php | |||
| @@ -90,6 +90,8 @@ class UserController | |||
| 90 | $_SESSION['user'] = $_POST['login']; | 90 | $_SESSION['user'] = $_POST['login']; |
| 91 | $_SESSION['admin'] = true; | 91 | $_SESSION['admin'] = true; |
| 92 | 92 | ||
| 93 | EmailService::cleanEmails($entityManager); | ||
| 94 | |||
| 93 | $url = new URL(isset($_GET['from']) ? ['page' => $_GET['from']] : []); | 95 | $url = new URL(isset($_GET['from']) ? ['page' => $_GET['from']] : []); |
| 94 | isset($_GET['id']) ? $url->addParams(['id' => $_GET['id']]) : ''; | 96 | isset($_GET['id']) ? $url->addParams(['id' => $_GET['id']]) : ''; |
| 95 | } | 97 | } |
diff --git a/src/controller/ViewController.php b/src/controller/ViewController.php index 9139dd4..8c95526 100644 --- a/src/controller/ViewController.php +++ b/src/controller/ViewController.php | |||
| @@ -55,7 +55,7 @@ class ViewController extends AbstractBuilder // ViewController est aussi le prem | |||
| 55 | self::$root_node = $model->getNode(); | 55 | self::$root_node = $model->getNode(); |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | /* 3/ 2ème contrôle utilisant les données récupérées */ | 58 | /* 3/ 2ème contrôle des paramètres avec les données récupérées */ |
| 59 | 59 | ||
| 60 | // article non trouvé en BDD | 60 | // article non trouvé en BDD |
| 61 | if(CURRENT_PAGE === 'article' && !$_SESSION['admin'] && self::$root_node->getNodeByName('main')->getAdoptedChild() === null){ | 61 | if(CURRENT_PAGE === 'article' && !$_SESSION['admin'] && self::$root_node->getNodeByName('main')->getAdoptedChild() === null){ |
