From 841186fe04cef4ad14babae178488ec6861ba9eb Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 19 Jun 2023 19:58:37 +0200 Subject: [PATCH] =?UTF-8?q?Masquage=20du=20code=20de=20v=C3=A9rification?= =?UTF-8?q?=20des=20formulaires=20et=20mise=20=C3=A0=20jour=20des=20module?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/blog/blog.php | 38 +++++++++++++++------------- module/blog/changes.md | 7 ++++- module/blog/enum.json | 2 +- module/blog/view/article/article.php | 2 +- module/blog/view/index/index.php | 10 ++++---- module/form/changes.md | 2 ++ module/form/form.php | 13 ++++------ module/form/view/data/data.php | 4 +-- module/gallery/changes.md | 2 ++ module/gallery/gallery.php | 20 +++++++-------- module/news/changes.md | 4 +-- module/news/news.php | 14 +++++----- module/news/view/article/article.php | 2 +- module/news/view/index/index.php | 2 +- 14 files changed, 66 insertions(+), 56 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index c7f90116..c607e871 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -16,7 +16,7 @@ class blog extends common { - const VERSION = '6.6'; + const VERSION = '6.8'; const REALNAME = 'Blog'; const DELETE = true; const UPDATE = '0.0'; @@ -320,7 +320,7 @@ class blog extends common $comments = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']); self::$commentsDelete = template::button('blogCommentDeleteAll', [ 'class' => 'blogCommentDeleteAll buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2) . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2), 'value' => 'Tout effacer' ]); // Ids des commentaires par ordre de création @@ -340,7 +340,7 @@ class blog extends common if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']) === true) { $buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [ 'class' => $comment['approval'] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i], 'value' => $comment['approval'] === true ? 'A' : 'R', 'help' => $comment['approval'] === true ? 'Approuvé' : 'Rejeté', ]); @@ -354,7 +354,7 @@ class blog extends common $buttonApproval, template::button('blogCommentDelete' . $commentIds[$i], [ 'class' => 'blogCommentDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDelete/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDelete/' . $this->getUrl(2) . '/' . $commentIds[$i], 'value' => template::ico('trash') ]) ]; @@ -379,7 +379,7 @@ class blog extends common ]); } // Jeton incorrect - elseif ($this->getUrl(4) !== $_SESSION['csrf']) { + elseif ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -404,7 +404,7 @@ class blog extends common public function commentDeleteAll() { // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -436,7 +436,7 @@ class blog extends common ]); } // Jeton incorrect - elseif ($this->getUrl(4) !== $_SESSION['csrf']) { + elseif ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -536,12 +536,12 @@ class blog extends common 'help' => ($toApprove || $approved) > 0 ? 'Éditer / Approuver les commentaires' : '' ]), template::button('blogConfigEdit' . $articleIds[$i], [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i], 'value' => template::ico('pencil') ]), template::button('blogConfigDelete' . $articleIds[$i], [ 'class' => 'blogConfigDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i], 'value' => template::ico('trash') ]) ]; @@ -565,7 +565,7 @@ class blog extends common 'feeds' => $this->getInput('blogOptionShowFeeds', helper::FILTER_BOOLEAN), 'feedsLabel' => $this->getInput('blogOptionFeedslabel', helper::FILTER_STRING_SHORT), 'layout' => $this->getInput('blogOptionArticlesLayout', helper::FILTER_BOOLEAN), - 'articlesLenght' => $this->getInput('blogOptionArticlesLayout', helper::FILTER_BOOLEAN) === false ? $this->getInput('blogOptionArticlesLenght', helper::FILTER_INT): 0, + 'articlesLenght' => $this->getInput('blogOptionArticlesLayout', helper::FILTER_BOOLEAN) === false ? $this->getInput('blogOptionArticlesLenght', helper::FILTER_INT) : 0, 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true), 'dateFormat' => $this->getInput('blogOptionDateFormat'), 'timeFormat' => $this->getInput('blogOptionTimeFormat'), @@ -592,14 +592,15 @@ class blog extends common */ public function delete() { - if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) { + if ( + $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) { // Valeurs en sortie $this->addOutput([ 'access' => false ]); } // Jeton incorrect - elseif ($this->getUrl(3) !== $_SESSION['csrf']) { + elseif ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -624,7 +625,7 @@ class blog extends common public function edit() { // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -863,15 +864,18 @@ class blog extends common if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) { $articleIds[] = $articleId; // Nombre de commentaires approuvés par article + self::$comments[$articleId] = 0 ; if (is_array($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment']))) { - self::$comments[$articleId] = count($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment'])); - } else { - self::$comments[$articleId] = '0'; + foreach ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment']) as $commentId => $commentValue) { + if ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment', $commentId, 'approval'])) { + self::$comments[$articleId] = self::$comments[$articleId] + 1; + } + } } } } // Pagination - $pagination = helper::pagination($articleIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])); + $pagination = helper::pagination($articleIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']), '#article'); // Liste des pages self::$pages = $pagination['pages']; // Articles en fonction de la pagination diff --git a/module/blog/changes.md b/module/blog/changes.md index 000bb906..673b310d 100755 --- a/module/blog/changes.md +++ b/module/blog/changes.md @@ -1,4 +1,9 @@ - +# version 6.9 +- Masque le code de vérification +# version 6.8 +- Erreur de décompte des commentaires approuvés ou non dans l'index +# version 6.7 +- Ancre article qui affiche le début de l'article au clic sur la barre de pages, fonction utile lorsque le module est sous la page # version 6.6 - Position de l'icône RSS - Présentation en tableau amélioration du visuel diff --git a/module/blog/enum.json b/module/blog/enum.json index 8138ec10..7720ddcb 100644 --- a/module/blog/enum.json +++ b/module/blog/enum.json @@ -1 +1 @@ -{"name":"blog","realName":"Blog","version":"6.5","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file +{"name":"blog","realName":"Blog","version":"6.8","update":"0.0","delete":true,"dataDirectory":""} \ No newline at end of file diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 63cb2cf7..fb3f83be 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -39,7 +39,7 @@ ) ) ) : ?> - + Éditer diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 3c5f8177..88ca931a 100755 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -9,7 +9,7 @@ -
+
$article): ?> getData(['module', $this->getUrl(0), 'config', 'layout']) === true): ?>
@@ -73,7 +73,7 @@ ) ): ?> + href="getUrl(0) . '/edit/' . $articleId; ?>"> Éditer @@ -133,11 +133,11 @@
diff --git a/module/form/changes.md b/module/form/changes.md index cabf62e4..53bf07bb 100644 --- a/module/form/changes.md +++ b/module/form/changes.md @@ -1,3 +1,5 @@ +# Version 3.10 +- Masque le code de vérification # Version 3.9 - Redirection des pages orphelines # Version 3.8 diff --git a/module/form/form.php b/module/form/form.php index 22c62aa3..acdb3bb7 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -17,7 +17,7 @@ class form extends common { - const VERSION = '3.9'; + const VERSION = '3.10'; const REALNAME = 'Formulaire'; const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) @@ -29,9 +29,6 @@ class form extends common 'deleteall' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR, 'export2csv' => self::GROUP_MODERATOR, - 'output2csv' => self::GROUP_MODERATOR, - 'init' => self::GROUP_MODERATOR, - 'update' => self::GROUP_MODERATOR, ]; public static $data = []; @@ -249,7 +246,7 @@ class form extends common $content, template::button('formDataDelete' . $dataIds[$i], [ 'class' => 'formDataDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $dataIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $dataIds[$i], 'value' => template::ico('trash') ]) ]; @@ -270,7 +267,7 @@ class form extends common public function export2csv() { // Jeton incorrect - if ($this->getUrl(2) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', @@ -311,7 +308,7 @@ class form extends common public function deleteall() { // Jeton incorrect - if ($this->getUrl(2) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', @@ -347,7 +344,7 @@ class form extends common public function delete() { // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', diff --git a/module/form/view/data/data.php b/module/form/view/data/data.php index a9118a25..e8f600dd 100644 --- a/module/form/view/data/data.php +++ b/module/form/view/data/data.php @@ -9,14 +9,14 @@
'formDataDeleteAll buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall', 'value' => template::ico('trash'), 'help' => 'Effacer toutes les données' ]); ?>
helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv', 'value' => template::ico('download'), 'help' => 'Exporter toutes les données' ]); ?> diff --git a/module/gallery/changes.md b/module/gallery/changes.md index a2860585..9f6e4d86 100644 --- a/module/gallery/changes.md +++ b/module/gallery/changes.md @@ -1,3 +1,5 @@ +# Version 3.9 +- Masque le code de vérification # Version 3.8 - Version compare null, dataversion not initialize - Bug de positionnement des boutons de retour diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 66c5cd57..21ce91dc 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -18,7 +18,7 @@ class gallery extends common { - const VERSION = '3.8'; + const VERSION = '3.9'; const REALNAME = 'Galerie'; const DATADIRECTORY = self::DATA_DIR . 'gallery/'; @@ -385,13 +385,13 @@ class gallery extends common $gallery['config']['name'], $gallery['config']['directory'], template::button('galleryConfigEdit' . $galleryId, [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId, 'value' => template::ico('pencil'), 'help' => 'Configuration de la galerie ' ]), template::button('galleryConfigDelete' . $galleryId, [ 'class' => 'galleryConfigDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId, 'value' => template::ico('trash'), 'help' => 'Supprimer cette galerie' ]) @@ -507,7 +507,7 @@ class gallery extends common ]); } // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -544,7 +544,7 @@ class gallery extends common public function edit() { // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -589,7 +589,7 @@ class gallery extends common ]); // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(2) . '/' . $_SESSION['csrf'], + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(2), 'notification' => helper::translate('Modifications enregistrées'), 'state' => true ]); @@ -854,7 +854,7 @@ class gallery extends common public function theme() { // Jeton incorrect - if ($this->getUrl(2) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -935,7 +935,7 @@ class gallery extends common */ if ($this->getUrl(2) === 'galleries') { // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -976,7 +976,7 @@ class gallery extends common */ } elseif ($this->getUrl(2) === 'gallery') { // Jeton incorrect - if ($this->getUrl(4) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit', @@ -1027,7 +1027,7 @@ class gallery extends common } // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'], + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId, 'notification' => helper::translate('Modifications enregistrées'), 'state' => true ]); diff --git a/module/news/changes.md b/module/news/changes.md index 0d38a1e7..b598ae6c 100644 --- a/module/news/changes.md +++ b/module/news/changes.md @@ -1,3 +1,5 @@ +# Version 4.5 +- Masque le code de vérification # Version 4.4 - Intl date Formats - Bug un conflit avec le style de la page @@ -15,5 +17,3 @@ - Ecran layout réservé à la configuration et au thème - Bug avec l'initialisation, fichier css déclaré mais absent - Appel de la feuille style si présente - -A faire partie CSS à amléiorer au niveau des options diff --git a/module/news/news.php b/module/news/news.php index 45c30ed4..e6a0d2e5 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -16,7 +16,7 @@ class news extends common { - const VERSION = '4.3'; + const VERSION = '4.4'; const REALNAME = 'News'; const DATADIRECTORY = self::DATA_DIR . 'news/'; @@ -239,12 +239,12 @@ class news extends common $dateOff, helper::translate(self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'state'])]), template::button('newsConfigEdit' . $newsIds[$i], [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i], 'value' => template::ico('pencil') ]), template::button('newsConfigDelete' . $newsIds[$i], [ 'class' => 'newsConfigDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i], 'value' => template::ico('trash') ]) ]; @@ -338,12 +338,12 @@ class news extends common $dateOff, helper::translate(helper::translate(self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'state'])])), template::button('newsConfigEdit' . $newsIds[$i], [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i], 'value' => template::ico('pencil') ]), template::button('newsConfigDelete' . $newsIds[$i], [ 'class' => 'newsConfigDelete buttonRed', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i], 'value' => template::ico('cancel') ]) ]; @@ -372,7 +372,7 @@ class news extends common ]); } // Jeton incorrect - elseif ($this->getUrl(3) !== $_SESSION['csrf']) { + elseif ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', @@ -397,7 +397,7 @@ class news extends common public function edit() { // Jeton incorrect - if ($this->getUrl(3) !== $_SESSION['csrf']) { + if ($this->checkCSRF()) { // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', diff --git a/module/news/view/article/article.php b/module/news/view/article/article.php index e541a897..67c4ee21 100644 --- a/module/news/view/article/article.php +++ b/module/news/view/article/article.php @@ -18,7 +18,7 @@ ( $this->getUser('group') === self::GROUP_ADMIN ) ) ): ?> - + Éditer diff --git a/module/news/view/index/index.php b/module/news/view/index/index.php index 14da4d51..ee5cf9e0 100644 --- a/module/news/view/index/index.php +++ b/module/news/view/index/index.php @@ -34,7 +34,7 @@ ) ): ?> + href="getUrl(0) . '/edit/' . $newsId; ?>"> Éditer