diff --git a/core/core.php b/core/core.php index 33e8a6ce..9990d47e 100644 --- a/core/core.php +++ b/core/core.php @@ -24,7 +24,8 @@ class common { const GROUP_VISITOR = 0; const GROUP_MEMBER = 1; const GROUP_EDITOR = 2; - const GROUP_ADMIN = 3; + const GROUP_MODERATOR = 3; + const GROUP_ADMIN = 4; const SIGNATURE_ID = 1; const SIGNATURE_PSEUDO = 2; const SIGNATURE_FIRSTLASTNAME = 3; @@ -127,24 +128,28 @@ class common { self::GROUP_BANNED => 'Banni', self::GROUP_VISITOR => 'Visiteur', self::GROUP_MEMBER => 'Membre', - self::GROUP_EDITOR => 'Éditeur', + self::GROUP_EDITOR => 'Rédacteur', + self::GROUP_MODERATOR => 'Modérateur', self::GROUP_ADMIN => 'Administrateur' ]; public static $groupEdits = [ self::GROUP_BANNED => 'Banni', self::GROUP_MEMBER => 'Membre', - self::GROUP_EDITOR => 'Éditeur', + self::GROUP_EDITOR => 'Rédacteur', + self::GROUP_MODERATOR => 'Modérateur', self::GROUP_ADMIN => 'Administrateur' ]; public static $groupNews = [ self::GROUP_MEMBER => 'Membre', - self::GROUP_EDITOR => 'Éditeur', + self::GROUP_EDITOR => 'Rédacteur', + self::GROUP_MODERATOR => 'Modérateur', self::GROUP_ADMIN => 'Administrateur' ]; public static $groupPublics = [ self::GROUP_VISITOR => 'Visiteur', self::GROUP_MEMBER => 'Membre', - self::GROUP_EDITOR => 'Éditeur', + self::GROUP_EDITOR => 'Rédacteur', + self::GROUP_MODERATOR => 'Modérateur', self::GROUP_ADMIN => 'Administrateur' ]; public static $timezone; @@ -1464,6 +1469,13 @@ class common { } } } + // Actualiser les droits + $users = $this->getdata(['user']); + foreach ($users as $key => $value) { + if ($this->getData(['user',$key,'group']) > 2 ) { + $this->setData(['user',$key,'group', $this->getData(['user',$key,'group']) + 1 ]); + } + } $this->setData(['core', 'dataVersion', 10400]); } } @@ -2684,6 +2696,7 @@ class layout extends common { if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) { // Items de gauche $leftItems = ''; + //if($this->getUser('group') >= self::GROUP_MODERATOR) { if($this->getUser('group') >= self::GROUP_EDITOR) { $leftItems .= '
  • '; - $leftItems .= '
  • ' . template::ico('plus') . '
  • '; + if($this->getUser('group') >= self::GROUP_MODERATOR) { + $leftItems .= '
  • ' . template::ico('plus') . '
  • '; + } if( // Sur un module de page qui autorise le bouton de modification de la page $this->core->output['showBarEditButton'] @@ -2739,15 +2754,20 @@ class layout extends common { OR $this->getUrl(0) === '' ) { $leftItems .= '
  • ' . template::ico('pencil') . '
  • '; - if ($this->getData(['page', $this->getUrl(0),'moduleId'])) { + if ($this->getData(['page', $this->getUrl(0),'moduleId']) + AND $this->getUser('group') >= self::GROUP_MODERATOR + ) { $leftItems .= '
  • ' . template::ico('gear') . '
  • '; } - $leftItems .= '
  • ' . template::ico('clone') . '
  • '; - $leftItems .= '
  • ' . template::ico('trash') . '
  • '; + if($this->getUser('group') >= self::GROUP_MODERATOR) { + $leftItems .= '
  • ' . template::ico('clone') . '
  • '; + $leftItems .= '
  • ' . template::ico('trash') . '
  • '; + } } } // Items de droite $rightItems = ''; + // if($this->getUser('group') >= self::GROUP_MODERATOR) { if($this->getUser('group') >= self::GROUP_EDITOR) { $rightItems .= '
  • ' . template::ico('folder') . '
  • '; } @@ -2807,6 +2827,7 @@ class layout extends common { $vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';'; if( $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + //AND $this->getUser('group') >= self::GROUP_MODERATOR AND $this->getUser('group') >= self::GROUP_EDITOR ) { $vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR.'core.json')) . ';'; diff --git a/core/module/page/page.php b/core/module/page/page.php index bb9cdc72..1fef534e 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -17,10 +17,10 @@ class page extends common { public static $actions = [ - 'add' => self::GROUP_EDITOR, - 'delete' => self::GROUP_EDITOR, + 'add' => self::GROUP_MODERATOR, + 'delete' => self::GROUP_MODERATOR, 'edit' => self::GROUP_EDITOR, - 'duplicate' => self::GROUP_EDITOR + 'duplicate' => self::GROUP_MODERATOR ]; public static $pagesNoParentId = [ '' => 'Aucune' diff --git a/core/module/user/user.php b/core/module/user/user.php index 1373c40b..3b76a820 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -124,7 +124,7 @@ class user extends common { // L'utilisateur n'existe pas $this->getData(['user', $this->getUrl(2)]) === null // Groupe insuffisant - AND ($this->getUrl('group') < self::GROUP_EDITOR) + AND ($this->getUrl('group') < self::GROUP_MODERATOR) ) { // Valeurs en sortie $this->addOutput([ @@ -183,7 +183,7 @@ class user extends common { AND $this->getUrl('group') <= self::GROUP_VISITOR ) // Impossible d'éditer un autre utilisateur - OR ($this->getUrl('group') < self::GROUP_EDITOR) + OR ($this->getUrl('group') < self::GROUP_MODERATOR) ) ) { // Valeurs en sortie diff --git a/core/module/user/view/add/add.php b/core/module/user/view/add/add.php index 831a52bf..3b4e092c 100644 --- a/core/module/user/view/add/add.php +++ b/core/module/user/view/add/add.php @@ -51,15 +51,21 @@
  • Accès aux pages privées membres
  • + diff --git a/core/module/user/view/edit/edit.php b/core/module/user/view/edit/edit.php index 28dfe0e5..c1ec2818 100644 --- a/core/module/user/view/edit/edit.php +++ b/core/module/user/view/edit/edit.php @@ -69,15 +69,21 @@
  • Accès aux pages privées membres
  • + diff --git a/module/blog/blog.php b/module/blog/blog.php index 084a22ad..0b270d9c 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -21,14 +21,14 @@ class blog extends common { const EDIT_ADMIN = '03'; // Groupe des admin public static $actions = [ - 'add' => self::GROUP_EDITOR, - 'comment' => self::GROUP_EDITOR, - 'commentApprove' => self::GROUP_EDITOR, - 'commentDelete' => self::GROUP_EDITOR, - 'commentDeleteAll' => self::GROUP_EDITOR, - 'config' => self::GROUP_EDITOR, - 'delete' => self::GROUP_EDITOR, - 'edit' => self::GROUP_EDITOR, + 'add' => self::GROUP_MODERATOR, + 'comment' => self::GROUP_MODERATOR, + 'commentApprove' => self::GROUP_MODERATOR, + 'commentDelete' => self::GROUP_MODERATOR, + 'commentDeleteAll' => self::GROUP_MODERATOR, + 'config' => self::GROUP_MODERATOR, + 'delete' => self::GROUP_MODERATOR, + 'edit' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR ]; @@ -41,7 +41,7 @@ class blog extends common { public static $editCommentSignature = ''; public static $comments = []; - + public static $nbCommentsApproved = 0; public static $commentsDelete; @@ -471,9 +471,9 @@ class blog extends common { ksort(self::$users); foreach(self::$users as $userId => &$userFirstname) { // Les membres ne sont pas éditeurs, les exclure de la liste - if ( $this->getData(['user', $userId, 'group']) < self::GROUP_EDITOR) { + if ( $this->getData(['user', $userId, 'group']) < self::GROUP_MODERATOR) { unset(self::$users[$userId]); - } + } $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . self::$groupEdits[$this->getData(['user', $userId, 'group'])] . ')'; } unset($userFirstname); diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index b8217051..f25cc37b 100644 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -8,7 +8,7 @@ getUser('group') >= self::GROUP_ADMIN + $this->getUser('group') >= self::GROUP_MODERATOR AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') ): ?>
    diff --git a/module/form/form.php b/module/form/form.php index ff9a1635..6c11b2df 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -17,13 +17,13 @@ class form extends common { public static $actions = [ - 'config' => self::GROUP_EDITOR, - 'data' => self::GROUP_EDITOR, - 'delete' => self::GROUP_EDITOR, - 'deleteall' => self::GROUP_EDITOR, + 'config' => self::GROUP_MODERATOR, + 'data' => self::GROUP_MODERATOR, + 'delete' => self::GROUP_MODERATOR, + 'deleteall' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR, - 'export2csv' => self::GROUP_EDITOR, - 'output2csv' => self::GROUP_EDITOR + 'export2csv' => self::GROUP_MODERATOR, + 'output2csv' => self::GROUP_MODERATOR ]; public static $data = []; diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index c89655ef..77d0f2c3 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -36,13 +36,13 @@ class gallery extends common { public static $thumbs = []; public static $actions = [ - 'config' => self::GROUP_EDITOR, - 'delete' => self::GROUP_EDITOR, - 'dirs' => self::GROUP_EDITOR, - 'sortGalleries' => self::GROUP_EDITOR, - 'sortPictures' => self::GROUP_EDITOR, - 'edit' => self::GROUP_EDITOR, - 'theme' => self::GROUP_EDITOR, + 'config' => self::GROUP_MODERATOR, + 'delete' => self::GROUP_MODERATOR, + 'dirs' => self::GROUP_MODERATOR, + 'sortGalleries' => self::GROUP_MODERATOR, + 'sortPictures' => self::GROUP_MODERATOR, + 'edit' => self::GROUP_MODERATOR, + 'theme' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR ]; diff --git a/module/news/news.php b/module/news/news.php index adc1a2d3..4499028c 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -15,10 +15,10 @@ class news extends common { public static $actions = [ - 'add' => self::GROUP_EDITOR, - 'config' => self::GROUP_EDITOR, - 'delete' => self::GROUP_EDITOR, - 'edit' => self::GROUP_EDITOR, + 'add' => self::GROUP_MODERATOR, + 'config' => self::GROUP_MODERATOR, + 'delete' => self::GROUP_MODERATOR, + 'edit' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR ]; diff --git a/module/redirection/redirection.php b/module/redirection/redirection.php index f6aa0852..5c92521c 100644 --- a/module/redirection/redirection.php +++ b/module/redirection/redirection.php @@ -15,7 +15,7 @@ class redirection extends common { public static $actions = [ - 'config' => self::GROUP_EDITOR, + 'config' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR ]; @@ -49,7 +49,7 @@ class redirection extends common { // Message si l'utilisateur peut éditer la page if( $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND $this->getUser('group') >= self::GROUP_EDITOR + AND $this->getUser('group') >= self::GROUP_MODERATOR AND $this->getUrl(1) !== 'force' ) { // Valeurs en sortie diff --git a/module/search/search.php b/module/search/search.php index 556036f0..b2a41f07 100644 --- a/module/search/search.php +++ b/module/search/search.php @@ -20,7 +20,7 @@ class search extends common { public static $actions = [ 'index' => self::GROUP_VISITOR, - 'config' => self::GROUP_EDITOR + 'config' => self::GROUP_MODERATOR ]; // Variables pour l'affichage des résultats