From 99e990c131b5fa122984a869bea95f3e9074bc7b Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 29 May 2025 11:39:54 +0200 Subject: =?UTF-8?q?d=C3=A9but=20bloc=20calendrier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/Captcha.php | 2 +- src/controller/password.php | 4 ++-- src/view/CalendarBuilder.php | 42 +++++++++++++++++++++++++++++++++++++++++ src/view/password.php | 2 +- src/view/templates/calendar.php | 4 ++++ 5 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 src/view/CalendarBuilder.php create mode 100644 src/view/templates/calendar.php diff --git a/src/controller/Captcha.php b/src/controller/Captcha.php index 3253b95..da61a53 100644 --- a/src/controller/Captcha.php +++ b/src/controller/Captcha.php @@ -44,7 +44,7 @@ class Captcha } static public function controlInput(string $input = '0'): int { - // un POST est une chaîne qu'on doit convertir en nombre si: + // un POST est une chaîne qu'on doit convertir en nombre dans deux conditions: // test de format: $input est un nombre // test d'intégrité: supprimer les décimales avec (int) ne change pas la valeur du nombre return is_numeric($input) && $input == (int)$input ? (int)$input : 0; diff --git a/src/controller/password.php b/src/controller/password.php index 2a38508..2189326 100644 --- a/src/controller/password.php +++ b/src/controller/password.php @@ -154,7 +154,7 @@ function connect(LoginBuilder $builder, EntityManager $entityManager) elseif(!isset($_POST['login']) || empty($_POST['login']) || !isset($_POST['password']) || empty($_POST['password'])) { - $error = 'bad_password'; + $error = 'bad_login_or_password'; } else // c'est OK { @@ -179,7 +179,7 @@ function connect(LoginBuilder $builder, EntityManager $entityManager) } else { - $error = 'bad_password'; + $error = 'bad_login_or_password'; } } diff --git a/src/view/CalendarBuilder.php b/src/view/CalendarBuilder.php new file mode 100644 index 0000000..4229866 --- /dev/null +++ b/src/view/CalendarBuilder.php @@ -0,0 +1,42 @@ +getName() . '.php'; + + if(file_exists($viewFile)) + { + if(!empty($node->getNodeData()->getData())) + { + extract($node->getNodeData()->getData()); + } + + + if($_SESSION['admin']) + { + + + // squelette d'un nouvel article () + /*ob_start(); + require self::VIEWS_PATH . 'article.php'; + $new_article = ob_get_clean();*/ + } + + // articles existants + /*$this->useChildrenBuilder($node); + $content = $this->html;*/ + + ob_start(); + require $viewFile; + $this->html = ob_get_clean(); // pas de concaténation ici, on écrase + } + } +} \ No newline at end of file diff --git a/src/view/password.php b/src/view/password.php index b8a090e..ed99040 100644 --- a/src/view/password.php +++ b/src/view/password.php @@ -109,7 +109,7 @@ $header = ob_get_clean(); $error_messages = [ 'error_non_valid_captcha' => '

Erreur au test anti-robot, veuillez saisir un nombre entier.

', 'bad_solution_captcha' => '

Erreur au test anti-robot, veuillez réessayer.

', - 'bad_login_or_password' => '

Saisir un Identifiant (e-mail) et un mot de passe.

', + 'bad_login_or_password' => '

Mauvais identifiant ou mot de passe, veuillez réessayer.

', 'bad_password' => '

Mauvais mot de passe, veuillez réessayer.

', 'forbidden_characters' => '

Caractères interdits: espaces, tabulations, sauts CR/LF.

' ]; diff --git a/src/view/templates/calendar.php b/src/view/templates/calendar.php new file mode 100644 index 0000000..d85ade7 --- /dev/null +++ b/src/view/templates/calendar.php @@ -0,0 +1,4 @@ + +
+

+
\ No newline at end of file -- cgit v1.2.3