From ccc5041dad54630bd94bddcd93d46dc4852f28e4 Mon Sep 17 00:00:00 2001 From: Prof Langues Date: Thu, 15 Oct 2020 16:12:20 +0200 Subject: [PATCH 1/2] erreur de variables --- module/blog/blog.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index 1bf3c1d1..c484e3b1 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -177,8 +177,8 @@ class blog extends common { $buttonApproval = ''; // Compatibilité avec les commentaires des versions précédentes, les valider $comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ; - if ( $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'commentApprove']) === true) { - $buttonApproval = template::button('blogcommentApprove' . $commentIds[$i], [ + if ( $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'commentApproved']) === true) { + $buttonApproval = template::button('blogcommentApproved' . $commentIds[$i], [ 'class' => $comment['approval'] === true ? 'blogCommentReject' : 'blogCommentApprove buttonRed' , 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] , 'value' => $comment['approval'] === true ? 'A' : 'R' @@ -549,7 +549,7 @@ class blog extends common { } // Envoi du mail $sent code d'erreur ou de réussite $notification = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé'; - if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'mailNotification']) === true) { + if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentNotification']) === true) { $sent = $this->sendMail( $to, 'Nouveau commentaire', From 4be16c87e88ada0f1485fd33f3257eab1aa5a0e3 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 15 Oct 2020 21:13:48 +0200 Subject: [PATCH 2/2] Modif Sylvain --- module/blog/blog.php | 21 ++++++++++----------- module/blog/view/article/article.php | 22 ++++++++++++---------- module/blog/view/edit/edit.php | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index c484e3b1..f32e28f2 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -178,8 +178,8 @@ class blog extends common { // Compatibilité avec les commentaires des versions précédentes, les valider $comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ; if ( $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'commentApproved']) === true) { - $buttonApproval = template::button('blogcommentApproved' . $commentIds[$i], [ - 'class' => $comment['approval'] === true ? 'blogCommentReject' : 'blogCommentApprove buttonRed' , + $buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [ + 'class' => $comment['approval'] === true ? 'blogCommentReject' : 'blogCommentApproved buttonRed' , 'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] , 'value' => $comment['approval'] === true ? 'A' : 'R' ]); @@ -307,21 +307,20 @@ class blog extends common { foreach ($articleIds as $key => $value) { if ( ( // Propriétaire - ( - $this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER - AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id') - AND $this->getUser('group') >= self::GROUP_MODERATOR - ) + $this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) + ) OR ( // Groupe - $this->getData(['module', $this->getUrl(0), $value,'editConsent'])) !== self::EDIT_OWNER + $this->getData(['module', $this->getUrl(0), $value,'editConsent']) !== self::EDIT_OWNER AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $value,'editConsent']) - ) + ) OR ( // Tout le monde $this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_ALL - ) + ) ) { $filterData[] = $value; } @@ -457,7 +456,7 @@ class blog extends common { 'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN), 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), 'userId' => $newuserid, - 'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : self::EDIT_OWNER, + 'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('blogEditConsent'), 'commentMaxlength' => $this->getInput('blogEditCommentMaxlength'), 'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN), 'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN), diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index f6f1e4f3..41c30a49 100644 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -13,18 +13,20 @@ AND ( // Propriétaire ( - $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER - AND $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id') - AND $this->getUser('group') >= self::GROUP_MODERATOR - ) - ) OR ( - // Groupe - $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== $module::EDIT_OWNER - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent']) + $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id') + OR $this->getUser('group') === self::GROUP_ADMIN ) ) OR ( - // Tout le monde - $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL + // Groupe + $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== $module::EDIT_OWNER + AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent']) + ) + OR ( + // Tout le monde + $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL + AND $this->getUser('group') >= $module::$action['config'] + ) ) ): ?>
- $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApproved']), '' ]); ?>