diff options
| author | polo <ordipolo@gmx.fr> | 2025-05-29 11:39:54 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2025-05-29 11:39:54 +0200 |
| commit | 99e990c131b5fa122984a869bea95f3e9074bc7b (patch) | |
| tree | 2c941c08d309a5ace06d45532b9fe6cd99ab3672 | |
| parent | 03668b9bb9f224f6db985bc9980dc75fab2fa4d5 (diff) | |
| download | cms-99e990c131b5fa122984a869bea95f3e9074bc7b.tar.gz cms-99e990c131b5fa122984a869bea95f3e9074bc7b.tar.bz2 cms-99e990c131b5fa122984a869bea95f3e9074bc7b.zip | |
début bloc calendrier
| -rw-r--r-- | src/controller/Captcha.php | 2 | ||||
| -rw-r--r-- | src/controller/password.php | 4 | ||||
| -rw-r--r-- | src/view/CalendarBuilder.php | 42 | ||||
| -rw-r--r-- | src/view/password.php | 2 | ||||
| -rw-r--r-- | src/view/templates/calendar.php | 4 |
5 files changed, 50 insertions, 4 deletions
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 | |||
| 44 | } | 44 | } |
| 45 | static public function controlInput(string $input = '0'): int | 45 | static public function controlInput(string $input = '0'): int |
| 46 | { | 46 | { |
| 47 | // un POST est une chaîne qu'on doit convertir en nombre si: | 47 | // un POST est une chaîne qu'on doit convertir en nombre dans deux conditions: |
| 48 | // test de format: $input est un nombre | 48 | // test de format: $input est un nombre |
| 49 | // test d'intégrité: supprimer les décimales avec (int) ne change pas la valeur du nombre | 49 | // test d'intégrité: supprimer les décimales avec (int) ne change pas la valeur du nombre |
| 50 | return is_numeric($input) && $input == (int)$input ? (int)$input : 0; | 50 | 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) | |||
| 154 | elseif(!isset($_POST['login']) || empty($_POST['login']) | 154 | elseif(!isset($_POST['login']) || empty($_POST['login']) |
| 155 | || !isset($_POST['password']) || empty($_POST['password'])) | 155 | || !isset($_POST['password']) || empty($_POST['password'])) |
| 156 | { | 156 | { |
| 157 | $error = 'bad_password'; | 157 | $error = 'bad_login_or_password'; |
| 158 | } | 158 | } |
| 159 | else // c'est OK | 159 | else // c'est OK |
| 160 | { | 160 | { |
| @@ -179,7 +179,7 @@ function connect(LoginBuilder $builder, EntityManager $entityManager) | |||
| 179 | } | 179 | } |
| 180 | else | 180 | else |
| 181 | { | 181 | { |
| 182 | $error = 'bad_password'; | 182 | $error = 'bad_login_or_password'; |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
| 185 | 185 | ||
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 @@ | |||
| 1 | <?php | ||
| 2 | // src/view/CalendarBuilder.php | ||
| 3 | |||
| 4 | declare(strict_types=1); | ||
| 5 | |||
| 6 | use App\Entity\Node; | ||
| 7 | |||
| 8 | class CalendarBuilder extends AbstractBuilder | ||
| 9 | { | ||
| 10 | public function __construct(Node $node) | ||
| 11 | { | ||
| 12 | parent::__construct($node); | ||
| 13 | $viewFile = self::VIEWS_PATH . $node->getName() . '.php'; | ||
| 14 | |||
| 15 | if(file_exists($viewFile)) | ||
| 16 | { | ||
| 17 | if(!empty($node->getNodeData()->getData())) | ||
| 18 | { | ||
| 19 | extract($node->getNodeData()->getData()); | ||
| 20 | } | ||
| 21 | |||
| 22 | |||
| 23 | if($_SESSION['admin']) | ||
| 24 | { | ||
| 25 | |||
| 26 | |||
| 27 | // squelette d'un nouvel article () | ||
| 28 | /*ob_start(); | ||
| 29 | require self::VIEWS_PATH . 'article.php'; | ||
| 30 | $new_article = ob_get_clean();*/ | ||
| 31 | } | ||
| 32 | |||
| 33 | // articles existants | ||
| 34 | /*$this->useChildrenBuilder($node); | ||
| 35 | $content = $this->html;*/ | ||
| 36 | |||
| 37 | ob_start(); | ||
| 38 | require $viewFile; | ||
| 39 | $this->html = ob_get_clean(); // pas de concaténation ici, on écrase | ||
| 40 | } | ||
| 41 | } | ||
| 42 | } \ 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(); | |||
| 109 | $error_messages = [ | 109 | $error_messages = [ |
| 110 | 'error_non_valid_captcha' => '<p class="avertissement" >Erreur au test anti-robot, veuillez saisir un nombre entier.</p>', | 110 | 'error_non_valid_captcha' => '<p class="avertissement" >Erreur au test anti-robot, veuillez saisir un nombre entier.</p>', |
| 111 | 'bad_solution_captcha' => '<p class="avertissement" >Erreur au test anti-robot, veuillez réessayer.</p>', | 111 | 'bad_solution_captcha' => '<p class="avertissement" >Erreur au test anti-robot, veuillez réessayer.</p>', |
| 112 | 'bad_login_or_password' => '<p class="avertissement" >Saisir un Identifiant (e-mail) et un mot de passe.</p>', | 112 | 'bad_login_or_password' => '<p class="avertissement" >Mauvais identifiant ou mot de passe, veuillez réessayer.</p>', |
| 113 | 'bad_password' => '<p class="avertissement" >Mauvais mot de passe, veuillez réessayer.</p>', | 113 | 'bad_password' => '<p class="avertissement" >Mauvais mot de passe, veuillez réessayer.</p>', |
| 114 | 'forbidden_characters' => '<p class="avertissement" >Caractères interdits: espaces, tabulations, sauts CR/LF.</p>' | 114 | 'forbidden_characters' => '<p class="avertissement" >Caractères interdits: espaces, tabulations, sauts CR/LF.</p>' |
| 115 | ]; | 115 | ]; |
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 @@ | |||
| 1 | <?php declare(strict_types=1); ?> | ||
| 2 | <section class="calendar" id="<?= $this->id_node ?>"> | ||
| 3 | <h3><?= $title ?></h3> | ||
| 4 | </section> \ No newline at end of file | ||
