Merge branch '10400' into editeur

This commit is contained in:
Fred Tempez 2020-10-15 21:19:30 +02:00
commit dbf7df04bb
3 changed files with 25 additions and 24 deletions

View File

@ -177,9 +177,9 @@ class blog extends common {
$buttonApproval = ''; $buttonApproval = '';
// Compatibilité avec les commentaires des versions précédentes, les valider // Compatibilité avec les commentaires des versions précédentes, les valider
$comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ; $comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ;
if ( $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'commentApprove']) === true) { if ( $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'commentApproved']) === true) {
$buttonApproval = template::button('blogcommentApprove' . $commentIds[$i], [ $buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [
'class' => $comment['approval'] === true ? 'blogCommentReject' : 'blogCommentApprove buttonRed' , 'class' => $comment['approval'] === true ? 'blogCommentReject' : '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] . '/' . $_SESSION['csrf'] ,
'value' => $comment['approval'] === true ? 'A' : 'R' 'value' => $comment['approval'] === true ? 'A' : 'R'
]); ]);
@ -307,15 +307,14 @@ class blog extends common {
foreach ($articleIds as $key => $value) { foreach ($articleIds as $key => $value) {
if ( if (
( // Propriétaire ( // Propriétaire
(
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER $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->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id')
AND $this->getUser('group') >= self::GROUP_MODERATOR OR $this->getUser('group') === self::GROUP_ADMIN )
) )
OR ( OR (
// Groupe // 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']) AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $value,'editConsent'])
) )
OR ( OR (
@ -465,7 +464,7 @@ class blog extends common {
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN), 'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
'userId' => $newuserid, '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'), 'commentMaxlength' => $this->getInput('blogEditCommentMaxlength'),
'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN), 'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN),
'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN), 'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN),
@ -557,7 +556,7 @@ class blog extends common {
} }
// Envoi du mail $sent code d'erreur ou de réussite // 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é'; $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( $sent = $this->sendMail(
$to, $to,
'Nouveau commentaire', 'Nouveau commentaire',

View File

@ -14,10 +14,10 @@
( // Propriétaire ( // Propriétaire
( (
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER $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->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id')
AND $this->getUser('group') >= self::GROUP_MODERATOR OR $this->getUser('group') === self::GROUP_ADMIN )
) )
) OR ( OR (
// Groupe // Groupe
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== $module::EDIT_OWNER $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']) AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent'])
@ -25,6 +25,8 @@
OR ( OR (
// Tout le monde // Tout le monde
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
AND $this->getUser('group') >= $module::$action['config']
)
) )
): ?> ): ?>
<?php echo template::button('blogEdit', [ <?php echo template::button('blogEdit', [

View File

@ -114,7 +114,7 @@
]); ?> ]); ?>
</div> </div>
<div class="col4 commentOptionsWrapper "> <div class="col4 commentOptionsWrapper ">
<?php echo template::checkbox('blogEditCommentApprove', true, 'Approbation par un modérateur', [ <?php echo template::checkbox('blogEditCommentApproved', true, 'Approbation par un modérateur', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApproved']), 'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApproved']),
'' ''
]); ?> ]); ?>