Compare commits

...

95 Commits

Author SHA1 Message Date
fredtempez e6454d8f33 Merge branch '10400' into editeur 4 months ago
fredtempez 8a5505dc3f Merge branch '10400' into editeur 4 months ago
fredtempez 852f0fc52b Merge branch '10400' into editeur 4 months ago
fredtempez 14e06b1313 Merge branch '10400' into editeur 4 months ago
fredtempez 7ba8c0f8e6 Merge branch '10400' into editeur 4 months ago
fredtempez aacd7814ad Merge branch '10400' into editeur 4 months ago
fredtempez 9f0d85a797 Merge branch '10400' into editeur 4 months ago
fredtempez 8e8302e203 Merge branch '10400' into editeur 4 months ago
fredtempez 673576adb2 Merge branch '10400' into editeur 4 months ago
fredtempez c546241e58 Merge branch '10400' into editeur 4 months ago
fredtempez ca71c0b1dc Merge branch '10400' into editeur 4 months ago
fredtempez 9f03befd29 Merge branch '10400' into editeur 5 months ago
fredtempez 14d7011c25 Merge branch '10400' into editeur 5 months ago
fredtempez a326c6e81c Merge branch '10400' into editeur 5 months ago
fredtempez 2157f5391b Merge branch '10400' into editeur 5 months ago
fredtempez f67e3f871b Merge branch '10400' into editeur 5 months ago
fredtempez 396fe6ce26 Merge branch '10400' into editeur 5 months ago
Fred Tempez 0ffcc74765 Merge branch '10400' into editeur 6 months ago
Fred Tempez 7d88215f62 init editeur 6 months ago
Fred Tempez 348634accc Merge branch '10400' into editeur 6 months ago
Fred Tempez d031bf8896 Merge branch '10307' into 10400 6 months ago
Fred Tempez bb5d884aee TinyMCE Format select 6 months ago
Fred Tempez 944067a134 commenaire à l'installation 6 months ago
Fred Tempez 0f12d2e3f0 merge fix WIP 6 months ago
Fred Tempez b5d3a8b9bd Merge branch '10400' into editeur 6 months ago
Fred Tempez e4ff62f984 merge master 10306 6 months ago
Fred Tempez e7ae2d7e93 Merge branch 'master' 10306 into 10400 6 months ago
Fred Tempez bcaa1d0afc Modif sylvain rfm 6 months ago
Fred Tempez c20d5e99d2 Revert "permissions RFM" 6 months ago
Fred Tempez d7ca5f13fc permissions RFM 6 months ago
Fred Tempez c5d4eb1a54 Modif du 9/11 par Sylvain 6 months ago
Fred Tempez 8f14755c53 Merge branch '10400' into editeur 6 months ago
Fred Tempez 443be197b6 Merge branch '10400' into editeur 6 months ago
Fred Tempez a577e7c684 Merge branch '10400' into editeur 6 months ago
Fred Tempez e449bb2842 Merge branch '10400' into editeur 6 months ago
Fred Tempez 5bbcc6f6fa Merge branch '10400' into editeur 6 months ago
Fred Tempez d8a91f8880 Merge branch '10400' into editeur 6 months ago
Fred Tempez f332d8e3d2 Merge branch '10400' into editeur 6 months ago
Fred Tempez bcaf62d736 Merge branch '10400' into editeur 6 months ago
Fred Tempez 156c03c6a2 Merge branch '10400' into editeur 6 months ago
Fred Tempez bfa37b2c99 Merge branch '10400' into editeur 6 months ago
Fred Tempez bf1ca89e9a Merge branch '10400' into editeur 6 months ago
Fred Tempez bc809b96ce Merge branch '10400' into editeur 6 months ago
Fred Tempez 447e7ed90c Merge branch '10400' into editeur 6 months ago
Fred Tempez 67631c19a5 ajout et installation d'un user : données de signature 6 months ago
Fred Tempez 3e61ba9dab table pour les petits et très petits écrans 6 months ago
Fred Tempez 473383c426 Merge branch '10400' into editeur 6 months ago
fredtempez 46100898aa Merge branch '10400' into editeur 7 months ago
fredtempez 8ce9fb033b Merge branch '10400' into editeur 7 months ago
fredtempez 4c82720d4b Merge branch '10400' into editeur 7 months ago
fredtempez 50e508f486 Merge branch '10400' into editeur 7 months ago
fredtempez 4cdb1fe7c3 Merge branch '10304' into editeur 7 months ago
fredtempez 0f3eac9713 Merge branch '10400' into editeur 7 months ago
fredtempez 70a5e967bd Merge branch '10400' into editeur 7 months ago
Fred Tempez 79b8fd01c8 droits sur le module 7 months ago
Fred Tempez 7c8175a24d affiche le droit courant modif par admin 7 months ago
Fred Tempez 7a9c1fd142 erreu module 7 months ago
Fred Tempez 11e28f51fc Merge branch 'master' into editeur 7 months ago
Fred Tempez b4b79fc308 Merge branch 'master' into editeur 7 months ago
Fred Tempez 5e96a306e0 Merge branch '10400' into editeur 7 months ago
Fred Tempez b43535c186 Merge branch 'master' into editeur 7 months ago
Fred Tempez 303fb85615 Merge branch 'master' into editeur 7 months ago
Prof Langues 3bd8f8cf3f Merge branch '10400' into editeur 7 months ago
Prof Langues 91093014f3 Merge branch '10303' into editeur 7 months ago
Fred Tempez fe60147bd2 Merge branch '10400' into editeur 7 months ago
Fred Tempez 24bae1270f Merge branch '10400' into editeur 7 months ago
Fred Tempez 559d0d5c95 Merge branch '10400' into editeur 7 months ago
Fred Tempez 68f15aeed2 Merge branch '10400' into editeur 7 months ago
Fred Tempez ff98f2d478 Merge branch '10400' into editeur 7 months ago
Fred Tempez 07639ecafd Merge branch '10400' into editeur 7 months ago
Fred Tempez 9326267cc4 Merge branch 'editeur' of https://github.com/fredtempez/ZwiiCMS into editeur 7 months ago
Fred Tempez dbf7df04bb Merge branch '10400' into editeur 7 months ago
Prof Langues da77d79fb6 Merge branch '10400' into editeur 7 months ago
Fred Tempez 0ae5d80c28 Merge branch '10400' into editeur 7 months ago
Fred Tempez af49404044 Merge branch '10400' into editeur 7 months ago
Fred Tempez 7048cc37f4 Merge branch '10400' into editeur 7 months ago
Fred Tempez 80ee16aa82 Revert "Permissions de l'article" 7 months ago
Prof Langues e24461fa2d Permissions de l'article 7 months ago
Fred Tempez b146f42355 Merge branch '10400' into editeur 7 months ago
Fred Tempez 50f8d5afe3 Revert "Modif Sylvain" 7 months ago
Fred Tempez 87d2e22577 Modif Sylvain 7 months ago
Fred Tempez ef71b79225 protection changement module 7 months ago
Fred Tempez 96041f1842 Revert "Revert "permission changement de module + réécriture test dans les fonctions page"" 7 months ago
Fred Tempez 3a5b0afe74 Revert "permission changement de module + réécriture test dans les fonctions page" 7 months ago
Fred Tempez 468bb2cd25 permission changement de module + réécriture test dans les fonctions page 7 months ago
Fred Tempez f9569b1085 permissions sur modules externes 7 months ago
Fred Tempez 32e727eb71 Merge branch '10303' into editeur 7 months ago
Fred Tempez bd82e0337e bloquage niveau page 7 months ago
Fred Tempez 088cd6fc69 Merge branch '10303' into editeur 7 months ago
Fred Tempez f4d75f0142 Revert "bug routeur" 7 months ago
Fred Tempez f1da9bead6 Merge branch '10303' into editeur 7 months ago
Fred Tempez 2ca430f7b4 Merge branch '10303' into editeur 7 months ago
Fred Tempez 1a981b490d Merge branch '10303' into editeur 7 months ago
Fred Tempez 81e5f27227 Merge branch '10400' into editeur 7 months ago
Fred Tempez f1f5d5414f Init 7 months ago
  1. 6
      CHANGES.md
  2. 52
      core/core.php
  3. 274
      core/module/page/page.php
  4. 41
      core/module/page/view/edit/edit.php
  5. 5
      core/module/user/view/add/add.php
  6. 53
      core/module/user/view/edit/edit.php
  7. 24
      core/vendor/filemanager/config/config.php
  8. 54
      module/blog/blog.php
  9. 5
      module/blog/view/edit/edit.php
  10. 62
      module/gallery/gallery.php
  11. 54
      module/news/news.php

6
CHANGES.md

@ -70,6 +70,12 @@ Corrections :
- Petites corrections
- Bouton format dans TinyMCE
## version 10.3.07
- Corrections :
- installation, auteurs des articles gérés à l'installation.
- Modification :
- TinyMCE : icône du sélecteur de formats.
## version 10.3.06
- Correction :
- Édition de page avec module, le changement de mise en page désactive le bouton d'option du module.

52
core/core.php

@ -24,8 +24,9 @@ class common {
const GROUP_BANNED = -1;
const GROUP_VISITOR = 0;
const GROUP_MEMBER = 1;
const GROUP_MODERATOR = 2;
const GROUP_ADMIN = 3;
const GROUP_EDITOR = 2;
const GROUP_MODERATOR = 3;
const GROUP_ADMIN = 4;
const SIGNATURE_ID = 1;
const SIGNATURE_PSEUDO = 2;
const SIGNATURE_FIRSTLASTNAME = 3;
@ -122,24 +123,28 @@ class common {
self::GROUP_BANNED => 'Banni',
self::GROUP_VISITOR => 'Visiteur',
self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'É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_MODERATOR => 'Éditeur',
self::GROUP_EDITOR => 'Rédacteur',
self::GROUP_MODERATOR => 'Modérateur',
self::GROUP_ADMIN => 'Administrateur'
];
public static $groupNews = [
self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'É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_MODERATOR => 'Éditeur',
self::GROUP_EDITOR => 'Rédacteur',
self::GROUP_MODERATOR => 'Modérateur',
self::GROUP_ADMIN => 'Administrateur'
];
// Langues proposées
@ -1527,6 +1532,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 ]);
}
}
// Création du fichier locale.json
$this->setData(['locale','homePageId',$this->getData(['config','homePageId'])]);
$this->setData(['locale','page404',$this->getData(['config','page404'])]);
@ -1887,8 +1899,6 @@ class core extends common {
}
// Check l'accès à la page
$access = null;
$accessInfo['userName'] = '';
$accessInfo['pageId'] = '';
if($this->getData(['page', $this->getUrl(0)]) !== null) {
if(
$this->getData(['page', $this->getUrl(0), 'group']) === self::GROUP_VISITOR
@ -1919,7 +1929,6 @@ class core extends common {
$access = false;
}
}
/**
* Contrôle si la page demandée est en édition ou accès à la gestion du site
* conditions de blocage :
@ -1928,6 +1937,8 @@ class core extends common {
* - Une partie de l'URL fait partie de la liste de filtrage (édition d'un module etc..)
* - L'édition est ouverte depuis un temps dépassé, on considère que la page est restée ouverte et qu'elle ne sera pas validée
*/
$accessInfo['userName'] = '';
$accessInfo['pageId'] = '';
foreach($this->getData(['user']) as $userId => $userIds){
$t = explode('/',$this->getData(['user', $userId, 'accessUrl']));
if ( $this->getUser('id') &&
@ -2817,7 +2828,8 @@ 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_MODERATOR) {
if($this->getUser('group') >= self::GROUP_EDITOR) {
$leftItems .= '<li><select id="barSelectPage">';
$leftItems .= '<option value="">Choisissez une page</option>';
$leftItems .= '<optgroup label="Pages orphelines">';
@ -2862,7 +2874,9 @@ class layout extends common {
}
$leftItems .= '</optgroup>';
$leftItems .= '</select></li>';
$leftItems .= '<li><a href="' . helper::baseUrl() . 'page/add" data-tippy-content="Créer une page ou<br>une barre latérale">' . template::ico('plus') . '</a></li>';
if($this->getUser('group') >= self::GROUP_MODERATOR) {
$leftItems .= '<li><a href="' . helper::baseUrl() . 'page/add" data-tippy-content="Créer une page ou<br>une barre latérale">' . template::ico('plus') . '</a></li>';
}
if(
// Sur un module de page qui autorise le bouton de modification de la page
$this->core->output['showBarEditButton']
@ -2872,16 +2886,21 @@ class layout extends common {
OR $this->getUrl(0) === ''
) {
$leftItems .= '<li><a href="' . helper::baseUrl() . 'page/edit/' . $this->getUrl(0) . '" data-tippy-content="Modifier la page">' . template::ico('pencil') . '</a></li>';
if ($this->getData(['page', $this->getUrl(0),'moduleId'])) {
if ($this->getData(['page', $this->getUrl(0),'moduleId'])
AND $this->getUser('group') >= self::GROUP_MODERATOR
) {
$leftItems .= '<li><a href="' . helper::baseUrl() . $this->getUrl(0) . '/config' . '" data-tippy-content="Configurer le module">' . template::ico('gear') . '</a></li>';
}
$leftItems .= '<li><a id="pageDuplicate" href="' . helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0) . '&csrf=' . $_SESSION['csrf'] . '" data-tippy-content="Dupliquer la page">' . template::ico('clone') . '</a></li>';
$leftItems .= '<li><a id="pageDelete" href="' . helper::baseUrl() . 'page/delete/' . $this->getUrl(0) . '&csrf=' . $_SESSION['csrf'] . '" data-tippy-content="Effacer la page">' . template::ico('trash') . '</a></li>';
if($this->getUser('group') >= self::GROUP_MODERATOR) {
$leftItems .= '<li><a id="pageDuplicate" href="' . helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0) . '&csrf=' . $_SESSION['csrf'] . '" data-tippy-content="Dupliquer la page">' . template::ico('clone') . '</a></li>';
$leftItems .= '<li><a id="pageDelete" href="' . helper::baseUrl() . 'page/delete/' . $this->getUrl(0) . '&csrf=' . $_SESSION['csrf'] . '" data-tippy-content="Effacer la page">' . template::ico('trash') . '</a></li>';
}
}
}
// Items de droite
$rightItems = '';
if($this->getUser('group') >= self::GROUP_MODERATOR) {
// if($this->getUser('group') >= self::GROUP_MODERATOR) {
if($this->getUser('group') >= self::GROUP_EDITOR) {
$rightItems .= '<li><a href="' . helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') .'" data-tippy-content="Gérer les fichiers" data-lity>' . template::ico('folder') . '</a></li>';
}
if($this->getUser('group') >= self::GROUP_ADMIN) {
@ -2944,7 +2963,8 @@ 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_MODERATOR
AND $this->getUser('group') >= self::GROUP_EDITOR
) {
$vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR.'core.json')) . ';';
}

274
core/module/page/page.php

@ -19,8 +19,9 @@ class page extends common {
public static $actions = [
'add' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR,
'duplicate' => self::GROUP_MODERATOR
'edit' => self::GROUP_EDITOR,
'duplicate' => self::GROUP_MODERATOR,
'module' => self::GROUP_MODERATOR
];
public static $pagesNoParentId = [
'' => 'Aucune'
@ -70,6 +71,14 @@ class page extends common {
* Duplication
*/
public function duplicate() {
// Contrôle d'accès
if ( self::$actions[__FUNCTION__] >= $this->getUser('group')) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
return;
}
// Adresse sans le token
$url = explode('&',$this->getUrl(2));
// La page n'existe pas
@ -126,6 +135,14 @@ class page extends common {
* Création
*/
public function add() {
// Contrôle d'accès
if ( self::$actions[__FUNCTION__] >= $this->getUser('group')) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
return;
}
$pageTitle = 'Nouvelle page';
$pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
$this->setData([
@ -134,7 +151,7 @@ class page extends common {
[
'typeMenu' => 'text',
'iconUrl' => '',
'disable' => false,
'disable' => false,
'content' => 'Contenu de votre nouvelle page.',
'hideTitle' => false,
'breadCrumb' => false,
@ -170,6 +187,14 @@ class page extends common {
* Suppression
*/
public function delete() {
// Contrôle d'accès
if ( self::$actions[__FUNCTION__] >= $this->getUser('group')) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
return;
}
// $url prend l'adresse sans le token
$url = explode('&',$this->getUrl(2));
// La page n'existe pas
@ -286,11 +311,13 @@ class page extends common {
*/
public function edit() {
// La page n'existe pas
if($this->getData(['page', $this->getUrl(2)]) === null) {
if( $this->getData(['page', $this->getUrl(2)]) === null
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
return;
}
// La page existe
else {
@ -348,142 +375,135 @@ class page extends common {
if ($this->getUrl(2) === $this->getData(['locale', 'page302']) ) {
$this->setData(['locale','page302', $pageId]);
}
// Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
$lastPosition = 1;
$hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
$position = $this->getInput('pageEditPosition', helper::FILTER_INT);
foreach($hierarchy as $hierarchyPageId) {
// Ignore la page en cours de modification
if($hierarchyPageId === $this->getUrl(2)) {
continue;
}
// Incrémente de +1 pour laisser la place à la position de la page en cours de modification
if($lastPosition === $position) {
$lastPosition++;
}
// Change la position
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
// Incrémente pour la prochaine position
// Incrémente de +1 pour laisser la place à la position de la page en cours de modification
if($lastPosition === $position) {
$lastPosition++;
}
if ($this->getinput('pageEditBlock') !== 'bar') {
$barLeft = $this->getinput('pageEditBarLeft');
$barRight = $this->getinput('pageEditBarRight');
$hideTitle = $this->getInput('pageEditHideTitle', helper::FILTER_BOOLEAN);
// Change la position
$this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
// Incrémente pour la prochaine position
$lastPosition++;
}
if ($this->getinput('pageEditBlock') !== 'bar') {
$barLeft = $this->getinput('pageEditBarLeft');
$barRight = $this->getinput('pageEditBarRight');
$hideTitle = $this->getInput('pageEditHideTitle', helper::FILTER_BOOLEAN);
} else {
// Une barre ne peut pas avoir de barres
$barLeft = "";
$barRight = "";
// Une barre est masquée
$position = 0;
$hideTitle = true;
}
// Modifie la page ou en crée une nouvelle si l'id a changé
$this->setData([
'page',
$pageId,
[
'typeMenu' => $this->getinput('pageTypeMenu'),
'iconUrl' => $this->getinput('pageIconUrl'),
'disable'=> $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN),
'content' => (empty($this->getInput('pageEditContent', null)) ? '<p>&nbsp;</p>' : $this->getInput('pageEditContent', null)),
'hideTitle' => $hideTitle,
'breadCrumb' => $this->getInput('pageEditbreadCrumb', helper::FILTER_BOOLEAN),
'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG),
'metaTitle' => $this->getInput('pageEditMetaTitle'),
'moduleId' => $this->getInput('pageEditModuleId'),
'modulePosition' => $this->getInput('configModulePosition'),
'parentPageId' => $this->getInput('pageEditParentPageId'),
'position' => $position,
'group' => $this->getinput('pageEditBlock') !== 'bar' ? $this->getInput('pageEditGroup', helper::FILTER_INT) : 0,
'targetBlank' => $this->getInput('pageEditTargetBlank', helper::FILTER_BOOLEAN),
'title' => $this->getInput('pageEditTitle', helper::FILTER_STRING_SHORT),
'block' => $this->getinput('pageEditBlock'),
'barLeft' => $barLeft,
'barRight' => $barRight,
'displayMenu' => $this->getinput('pageEditDisplayMenu'),
'hideMenuSide' => $this->getinput('pageEditHideMenuSide', helper::FILTER_BOOLEAN),
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
]
]);
// Barre renommée : changement le nom de la barre dans les pages mères
if ($this->getinput('pageEditBlock') === 'bar') {
foreach ($this->getHierarchy() as $eachPageId=>$parentId) {
if ($this->getData(['page',$eachPageId,'barRight']) === $this->getUrl(2)) {
$this->setData(['page',$eachPageId,'barRight',$pageId]);
}
if ($this->getData(['page',$eachPageId,'barLeft']) === $this->getUrl(2)) {
$this->setData(['page',$eachPageId,'barLeft',$pageId]);
} else {
// Une barre ne peut pas avoir de barres
$barLeft = "";
$barRight = "";
// Une barre est masquée
$position = 0;
$hideTitle = true;
}
// Modifie la page ou en crée une nouvelle si l'id a changé
$this->setData([
'page',
$pageId,
[
'typeMenu' => $this->getinput('pageTypeMenu'),
'iconUrl' => $this->getinput('pageIconUrl'),
'disable'=> $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN),
'content' => (empty($this->getInput('pageEditContent', null)) ? '<p>&nbsp;</p>' : $this->getInput('pageEditContent', null)),
'hideTitle' => $hideTitle,
'breadCrumb' => $this->getInput('pageEditbreadCrumb', helper::FILTER_BOOLEAN),
'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG),
'metaTitle' => $this->getInput('pageEditMetaTitle'),
'moduleId' => ( self::$actions['module'] >= $this->getUser('group')
AND $this->getInput('pageEditModuleId') !== $this->getData(['page',$this->getUrl(2),'moduleId']) )
? $this->getInput('pageEditModuleIdOld')
: $this->getInput('pageEditModuleId'),
'modulePosition' => $this->getInput('configModulePosition'),
'parentPageId' => $this->getInput('pageEditParentPageId'),
'position' => $position,
'group' => $this->getinput('pageEditBlock') !== 'bar' ? $this->getInput('pageEditGroup', helper::FILTER_INT) : 0,
'targetBlank' => $this->getInput('pageEditTargetBlank', helper::FILTER_BOOLEAN),
'title' => $this->getInput('pageEditTitle', helper::FILTER_STRING_SHORT),
'block' => $this->getinput('pageEditBlock'),
'barLeft' => $barLeft,
'barRight' => $barRight,
'displayMenu' => $this->getinput('pageEditDisplayMenu'),
'hideMenuSide' => $this->getinput('pageEditHideMenuSide', helper::FILTER_BOOLEAN),
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
]
]);
// Barre renommée : changement le nom de la barre dans les pages mères
if ($this->getinput('pageEditBlock') === 'bar') {
foreach ($this->getHierarchy() as $eachPageId=>$parentId) {
if ($this->getData(['page',$eachPageId,'barRight']) === $this->getUrl(2)) {
$this->setData(['page',$eachPageId,'barRight',$pageId]);
}
if ($this->getData(['page',$eachPageId,'barLeft']) === $this->getUrl(2)) {
$this->setData(['page',$eachPageId,'barLeft',$pageId]);
}
foreach ($parentId as $childId) {
if ($this->getData(['page',$childId,'barRight']) === $this->getUrl(2)) {
$this->setData(['page',$childId,'barRight',$pageId]);
}
foreach ($parentId as $childId) {
if ($this->getData(['page',$childId,'barRight']) === $this->getUrl(2)) {
$this->setData(['page',$childId,'barRight',$pageId]);
}
if ($this->getData(['page',$childId,'barLeft']) === $this->getUrl(2)) {
$this->setData(['page',$childId,'barLeft',$pageId]);
}
if ($this->getData(['page',$childId,'barLeft']) === $this->getUrl(2)) {
$this->setData(['page',$childId,'barLeft',$pageId]);
}
}
}
// Met à jour le site map
$this->createSitemap('all');
// Redirection vers la configuration
if($this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $pageId . '/config',
'state' => true
]);
}
// Redirection vers la page
else {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $pageId,
'notification' => 'Modifications enregistrées',
'state' => true
]);
}
}
// Liste des modules
$moduleIds = [];
$iterator = new DirectoryIterator('module/');
foreach($iterator as $fileInfos) {
if(is_file($fileInfos->getPathname() . '/' . $fileInfos->getFilename() . '.php')) {
if (array_key_exists($fileInfos->getBasename(),self::$moduleNames)) {
$moduleIds[$fileInfos->getBasename()] = self::$moduleNames[$fileInfos->getBasename()];
} else {
$moduleIds[$fileInfos->getBasename()] = ucfirst($fileInfos->getBasename());
}
}
// Met à jour le site map
$this->createSitemap('all');
// Redirection vers la configuration
if($this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $pageId . '/config',
'state' => true
]);
}
self::$moduleIds = $moduleIds;
asort(self::$moduleIds);
self::$moduleIds = array_merge( ['' => 'Aucun'] , self::$moduleIds);
// Pages sans parent
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
if($parentPageId !== $this->getUrl(2)) {
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
// Redirection vers la page
else {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $pageId,
'notification' => 'Modifications enregistrées',
'state' => true
]);
}
}
// Liste des modules
$moduleIds = [];
$iterator = new DirectoryIterator('module/');
foreach($iterator as $fileInfos) {
if(is_file($fileInfos->getPathname() . '/' . $fileInfos->getFilename() . '.php')) {
if (array_key_exists($fileInfos->getBasename(),self::$moduleNames)) {
$moduleIds[$fileInfos->getBasename()] = self::$moduleNames[$fileInfos->getBasename()];
} else {
$moduleIds[$fileInfos->getBasename()] = ucfirst($fileInfos->getBasename());
}
}
// Pages barre latérales
foreach($this->getHierarchy(null,false,true) as $parentPageId => $childrenPageIds) {
if($parentPageId !== $this->getUrl(2) &&
$this->getData(['page', $parentPageId, 'block']) === 'bar') {
self::$pagesBarId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
}
}
self::$moduleIds = $moduleIds;
asort(self::$moduleIds);
self::$moduleIds = array_merge( ['' => 'Aucun'] , self::$moduleIds);
// Pages sans parent
foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
if($parentPageId !== $this->getUrl(2)) {
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
}
// Valeurs en sortie
$this->addOutput([
'title' => $this->getData(['page', $this->getUrl(2), 'title']),
'vendor' => [
'tinymce'
],
'view' => 'edit'
]);
}
// Pages barre latérales
foreach($this->getHierarchy(null,false,true) as $parentPageId => $childrenPageIds) {
if($parentPageId !== $this->getUrl(2) &&
$this->getData(['page', $parentPageId, 'block']) === 'bar') {
self::$pagesBarId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
}
}
// Valeurs en sortie
$this->addOutput([
'title' => $this->getData(['page', $this->getUrl(2), 'title']),
'vendor' => [
'tinymce'
],
'view' => 'edit'
]);
}
}

41
core/module/page/view/edit/edit.php

@ -14,19 +14,23 @@ echo template::formOpen('pageEditForm');
]); ?>
</div>
<div class="col2 offset4">
<?php echo template::button('pageEditDuplicate', [
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Dupliquer',
'ico' => 'clone'
]); ?>
<?php if ( $module::$actions['duplicate'] < $this->getUser('group')): ?>
<?php echo template::button('pageEditDuplicate', [
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Dupliquer',
'ico' => 'clone'
]); ?>
<?php endif;?>
</div>
<div class="col2">
<?php echo template::button('pageEditDelete', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Supprimer',
'ico' => 'cancel'
]); ?>
<?php if ( $module::$actions['delete'] < $this->getUser('group')): ?>
<?php echo template::button('pageEditDelete', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Supprimer',
'ico' => 'cancel'
]); ?>
<?php endif;?>
</div>
<div class="col2">
<?php echo template::submit('pageEditSubmit'); ?>
@ -47,11 +51,13 @@ echo template::formOpen('pageEditForm');
<div class="row">
<div class="col9">
<?php echo template::hidden('pageEditModuleRedirect'); ?>
<?php echo template::select('pageEditModuleId', $module::$moduleIds, [
<?php echo template::select('pageEditModuleId', $module::$moduleIds, [
'help' => 'En cas de changement de module, les données du module précédent seront supprimées.',
'label' => 'Module',
'selected' => $this->getData(['page', $this->getUrl(2), 'moduleId'])
'selected' => $this->getData(['page', $this->getUrl(2), 'moduleId']),
'disabled' => $module::$actions['module'] >= $this->getUser('group')
]); ?>
<!-- Confirmation de suppression en cas d'annulation -->
<?php echo template::hidden('pageEditModuleIdOld',['value' => $this->getData(['page', $this->getUrl(2), 'moduleId'])]); ?>
<?php echo template::hidden('pageEditModuleIdOldText',[
'value' => array_key_exists($this->getData(['page', $this->getUrl(2), 'moduleId']),$module::$moduleNames)? $module::$moduleNames[$this->getData(['page', $this->getUrl(2), 'moduleId'])] : ucfirst($this->getData(['page', $this->getUrl(2), 'moduleId']))
@ -265,18 +271,21 @@ echo template::formOpen('pageEditForm');
<div class='col6'>
<?php echo template::select('pageEditGroup', self::$groupPublics, [
'label' => 'Groupe requis pour accéder à la page :',
'selected' => $this->getData(['page', $this->getUrl(2), 'group'])
'selected' => $this->getData(['page', $this->getUrl(2), 'group']),
'disabled' => $this->getUser('group') < self::GROUP_MODERATOR ? true : false
]); ?>
</div>
<div class='col12'>
<?php echo template::text('pageEditMetaTitle', [
'label' => 'Méta-titre',
'value' => $this->getData(['page', $this->getUrl(2), 'metaTitle'])
'value' => $this->getData(['page', $this->getUrl(2), 'metaTitle']),
'disabled' => $this->getUser('group') < self::GROUP_MODERATOR ? true : false
]); ?>
<?php echo template::textarea('pageEditMetaDescription', [
'label' => 'Méta-description',
//'maxlength' => '500',
'value' => $this->getData(['page', $this->getUrl(2), 'metaDescription'])
'value' => $this->getData(['page', $this->getUrl(2), 'metaDescription']),
'disabled' => $this->getUser('group') < self::GROUP_MODERATOR ? true : false
]); ?>
</div>
</div>

5
core/module/user/view/add/add.php

@ -50,16 +50,21 @@
<ul id="userAddGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userAddGroupDescription displayNone">
<li>Accès aux pages privées membres</li>
</ul>
<ul id="userAddGroupDescription<?php echo self::GROUP_EDITOR; ?>" class="userAddGroupDescription displayNone">
<li>Édition de pages</li>
</ul>
<ul id="userAddGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userAddGroupDescription displayNone">
<li>Accès aux pages privées membres et éditeurs</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
<li>Gestion de tous les modules</li>
</ul>
<ul id="userAddGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="userAddGroupDescription displayNone">
<li>Accès à toutes les pages privées</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
<li>Ajout / Édition / Suppression d'utilisateurs</li>
<li>Gestion de tous les modules</li>
<li>Configuration du site</li>
<li>Personnalisation du thème</li>
</ul>

53
core/module/user/view/edit/edit.php

@ -57,31 +57,34 @@
'label' => 'Adresse mail',
'value' => $this->getData(['user', $this->getUrl(2), 'mail'])
]); ?>
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
<?php echo template::select('userEditGroup', self::$groupEdits, [
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
'label' => 'Groupe',
'selected' => $this->getData(['user', $this->getUrl(2), 'group'])
]); ?>
<div id="userEditLabelAuth">Autorisations :</div>
<ul id="userEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userEditGroupDescription displayNone">
<li>Accès aux pages privées membres</li>
</ul>
<ul id="userEditGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userEditGroupDescription displayNone">
<li>Accès aux pages privées membres et éditeurs</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
</ul>
<ul id="userEditGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="userEditGroupDescription displayNone">
<li>Accès à toutes les pages privées</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
<li>Ajout / Édition / Suppression d'utilisateurs</li>
<li>Configuration du site</li>
<li>Personnalisation du thème</li>
</ul>
<?php endif; ?>
<?php echo template::select('userEditGroup', self::$groupEdits, [
'disabled' => $this->getUrl(2) === $this->getUser('id') OR $this->getUser('group') < self::GROUP_ADMIN ,
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre groupe.' : ''),
'label' => 'Groupe',
'selected' => $this->getData(['user', $this->getUrl(2), 'group'])
]); ?>
<div id="userEditLabelAuth">Autorisations :</div>
<ul id="userEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userEditGroupDescription displayNone">
<li>Accès aux pages privées membres</li>
</ul>
<ul id="userEditGroupDescription<?php echo self::GROUP_EDITOR; ?>" class="userEditGroupDescription displayNone">
<li>Édition de pages</li>
</ul>
<ul id="userEditGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userEditGroupDescription displayNone">
<li>Accès aux pages privées membres et éditeurs</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
<li>Gestion de tous les modules</li>
</ul>
<ul id="userEditGroupDescription<?php echo self::GROUP_ADMIN; ?>" class="userEditGroupDescription displayNone">
<li>Accès à toutes les pages privées</li>
<li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li>
<li>Ajout / Édition / Suppression d'utilisateurs</li>
<li>Gestion de tous les modules</li>
<li>Configuration du site</li>
<li>Personnalisation du thème</li>
</ul>
</div>
</div>
<div class="col6">

24
core/vendor/filemanager/config/config.php

@ -13,6 +13,14 @@ ob_start('mb_output_handler');
date_default_timezone_set('Europe/Paris');
setlocale(LC_CTYPE, 'fr_FR'); //correct transliteration
// Validation des actions (delete, rename) par lecture du groupe de l'utilisateur via cookie et user.json
$val = false;
if( is_file('../../../site/data/user.json')){
$json = file_get_contents('../../../site/data/user.json');
$user = json_decode($json, true);
$val = $user['user'][$_COOKIE["ZWII_USER_ID"]]['group'] >= 3 ? true : false;
}
/*
|--------------------------------------------------------------------------
| Optional security
@ -336,18 +344,18 @@ $config = array(
//*************************
//Permissions configuration
//******************
'delete_files' => true,
'delete_files' => $val,
'create_folders' => true,
'delete_folders' => true,
'delete_folders' => $val,
'upload_files' => true,
'rename_files' => true,
'rename_folders' => true,
'rename_files' => $val,
'rename_folders' => $val,
'duplicate_files' => true,
'extract_files' => true,
'copy_cut_files' => true, // for copy/cut files
'copy_cut_dirs' => true, // for copy/cut directories
'chmod_files' => true, // change file permissions
'chmod_dirs' => true, // change folder permissions
'copy_cut_files' => $val, // for copy/cut files
'copy_cut_dirs' => $val, // for copy/cut directories
'chmod_files' => $val, // change file permissions
'chmod_dirs' => $val, // change folder permissions
'preview_text_files' => true, // eg.: txt, log etc.
'edit_text_files' => true, // eg.: txt, log etc.
'create_text_files' => true, // only create files with exts. defined in $config['editable_text_file_exts']

54
module/blog/blog.php

@ -19,14 +19,14 @@ class blog extends common {
const EDIT_ALL = 'all';
public static $actions = [
'add' => self::GROUP_MODERATOR,
'add' => self::GROUP_EDITOR,
'comment' => self::GROUP_MODERATOR,
'commentApprove' => self::GROUP_MODERATOR,
'commentDelete' => self::GROUP_MODERATOR,
'commentDeleteAll' => self::GROUP_MODERATOR,
'config' => self::GROUP_MODERATOR,
'config' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR,
'edit' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR
];
@ -463,29 +463,37 @@ class blog extends common {
* Suppression
*/
public function delete() {
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
// Contrôle d'accès
if ( self::$actions[__FUNCTION__] >= $this->getUser('group')) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
}
// Jeton incorrect
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Article supprimé',
'state' => true
]);
} else {
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']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Article supprimé',
'state' => true
]);
}
}
}
@ -563,7 +571,7 @@ 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_MODERATOR) {
if ( $this->getData(['user', $userId, 'group']) < self::GROUP_EDITOR) {
unset(self::$users[$userId]);
}
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . self::$groupEdits[$this->getData(['user', $userId, 'group'])] . ')';

5
module/blog/view/edit/edit.php

@ -95,8 +95,9 @@
<div class="col4">
<?php echo template::select('blogEditConsent', $module::$articleConsent , [
'label' => 'Edition / Suppression',
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']),
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'article sans restriction'
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']),
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'article sans restriction',
'disabled' => $this->getUser('group') < self::GROUP_MODERATOR ? true : false
]); ?>
</div>
</div>

62
module/gallery/gallery.php

@ -36,13 +36,13 @@ class gallery extends common {
public static $thumbs = [];
public static $actions = [
'config' => self::GROUP_MODERATOR,
'config' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR,
'dirs' => self::GROUP_MODERATOR,
'sortGalleries' => self::GROUP_MODERATOR,
'sortPictures' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR,
'theme' => self::GROUP_MODERATOR,
'dirs' => self::GROUP_EDITOR,
'sortGalleries' => self::GROUP_EDITOR,
'sortPictures' => self::GROUP_EDITOR,
'edit' => self::GROUP_EDITOR,
'theme' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR
];
@ -287,31 +287,39 @@ class gallery extends common {
* Suppression
*/
public function delete() {
// $url prend l'adresse sans le token
// La galerie n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Contrôle d'accès
if ( self::$actions[__FUNCTION__] >= $this->getUser('group')) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
}
// Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Suppression non autorisée'
]);
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Galerie supprimée',
'state' => true
]);
} else {
// $url prend l'adresse sans le token
// La galerie n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
}
// Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Suppression non autorisée'
]);
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Galerie supprimée',
'state' => true
]);
}
}
}

54
module/news/news.php

@ -15,10 +15,10 @@
class news extends common {
public static $actions = [
'add' => self::GROUP_MODERATOR,
'config' => self::GROUP_MODERATOR,
'add' => self::GROUP_EDITOR,
'config' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR,
'edit' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR
];
@ -187,30 +187,38 @@ class news extends common {
* Suppression
*/
public function delete() {
// La news n'existe pas
if($this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]) === null) {
// Contrôle d'accès
if ( self::$actions[__FUNCTION__] >= $this->getUser('group')) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
}
// Jeton incorrect
elseif ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0),'posts', $this->getUrl(2)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'News supprimée',
'state' => true
]);
} else {
// La news n'existe pas
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']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'News supprimée',
'state' => true
]);
}
}
}

Loading…
Cancel
Save