Masquage du code de vérification des formulaires et mise à jour des modules

This commit is contained in:
Fred Tempez 2023-06-19 19:58:17 +02:00
parent e14f1d65aa
commit c2d3d5cef2
14 changed files with 66 additions and 54 deletions

View File

@ -16,7 +16,7 @@
class blog extends common class blog extends common
{ {
const VERSION = '6.6'; const VERSION = '6.8';
const REALNAME = 'Blog'; const REALNAME = 'Blog';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -320,7 +320,7 @@ class blog extends common
$comments = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']); $comments = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']);
self::$commentsDelete = template::button('blogCommentDeleteAll', [ self::$commentsDelete = template::button('blogCommentDeleteAll', [
'class' => 'blogCommentDeleteAll buttonRed', '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' 'value' => 'Tout effacer'
]); ]);
// Ids des commentaires par ordre de création // 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) { if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']) === true) {
$buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [ $buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [
'class' => $comment['approval'] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved buttonRed', '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', 'value' => $comment['approval'] === true ? 'A' : 'R',
'help' => $comment['approval'] === true ? 'Approuvé' : 'Rejeté', 'help' => $comment['approval'] === true ? 'Approuvé' : 'Rejeté',
]); ]);
@ -354,7 +354,7 @@ class blog extends common
$buttonApproval, $buttonApproval,
template::button('blogCommentDelete' . $commentIds[$i], [ template::button('blogCommentDelete' . $commentIds[$i], [
'class' => 'blogCommentDelete buttonRed', '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') 'value' => template::ico('trash')
]) ])
]; ];
@ -379,7 +379,7 @@ class blog extends common
]); ]);
} }
// Jeton incorrect // Jeton incorrect
elseif ($this->getUrl(4) !== $_SESSION['csrf']) { elseif ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -404,7 +404,7 @@ class blog extends common
public function commentDeleteAll() public function commentDeleteAll()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -436,7 +436,7 @@ class blog extends common
]); ]);
} }
// Jeton incorrect // Jeton incorrect
elseif ($this->getUrl(4) !== $_SESSION['csrf']) { elseif ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -536,12 +536,12 @@ class blog extends common
'help' => ($toApprove || $approved) > 0 ? 'Éditer / Approuver les commentaires' : '' 'help' => ($toApprove || $approved) > 0 ? 'Éditer / Approuver les commentaires' : ''
]), ]),
template::button('blogConfigEdit' . $articleIds[$i], [ 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') 'value' => template::ico('pencil')
]), ]),
template::button('blogConfigDelete' . $articleIds[$i], [ template::button('blogConfigDelete' . $articleIds[$i], [
'class' => 'blogConfigDelete buttonRed', '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') 'value' => template::ico('trash')
]) ])
]; ];
@ -565,7 +565,7 @@ class blog extends common
'feeds' => $this->getInput('blogOptionShowFeeds', helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('blogOptionShowFeeds', helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('blogOptionFeedslabel', helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('blogOptionFeedslabel', helper::FILTER_STRING_SHORT),
'layout' => $this->getInput('blogOptionArticlesLayout', helper::FILTER_BOOLEAN), '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), 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
'dateFormat' => $this->getInput('blogOptionDateFormat'), 'dateFormat' => $this->getInput('blogOptionDateFormat'),
'timeFormat' => $this->getInput('blogOptionTimeFormat'), 'timeFormat' => $this->getInput('blogOptionTimeFormat'),
@ -592,14 +592,15 @@ class blog extends common
*/ */
public function delete() 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 // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'access' => false 'access' => false
]); ]);
} }
// Jeton incorrect // Jeton incorrect
elseif ($this->getUrl(3) !== $_SESSION['csrf']) { elseif ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -624,7 +625,7 @@ class blog extends common
public function edit() public function edit()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -863,15 +864,18 @@ class blog extends common
if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) { if ($articlePublishedOn <= time() and $articleIdsStates[$articleId]) {
$articleIds[] = $articleId; $articleIds[] = $articleId;
// Nombre de commentaires approuvés par article // Nombre de commentaires approuvés par article
self::$comments[$articleId] = 0 ;
if (is_array($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment']))) { 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'])); foreach ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment']) as $commentId => $commentValue) {
} else { if ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment', $commentId, 'approval'])) {
self::$comments[$articleId] = '0'; self::$comments[$articleId] = self::$comments[$articleId] + 1;
}
}
} }
} }
} }
// Pagination // 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 // Liste des pages
self::$pages = $pagination['pages']; self::$pages = $pagination['pages'];
// Articles en fonction de la pagination // Articles en fonction de la pagination

View File

@ -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 # version 6.6
- Position de l'icône RSS - Position de l'icône RSS
- Présentation en tableau amélioration du visuel - Présentation en tableau amélioration du visuel

View File

@ -1 +1 @@
{"name":"blog","realName":"Blog","version":"6.5","update":"0.0","delete":true,"dataDirectory":""} {"name":"blog","realName":"Blog","version":"6.8","update":"0.0","delete":true,"dataDirectory":""}

View File

@ -39,7 +39,7 @@
) )
) )
) : ?> ) : ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf']; ?>"> <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">
<?php echo template::ico('pencil'); ?> Éditer <?php echo template::ico('pencil'); ?> Éditer
</a> </a>
<?php endif; ?> <?php endif; ?>

View File

@ -9,7 +9,7 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if ($module::$articles): ?> <?php if ($module::$articles): ?>
<article> <article id="article">
<?php foreach ($module::$articles as $articleId => $article): ?> <?php foreach ($module::$articles as $articleId => $article): ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'layout']) === true): ?> <?php if ($this->getData(['module', $this->getUrl(0), 'config', 'layout']) === true): ?>
<div class="readMoreModernContainer"> <div class="readMoreModernContainer">
@ -73,7 +73,7 @@
) )
): ?> ): ?>
<a <a
href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleId . '/' . $_SESSION['csrf']; ?>"> href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleId; ?>">
<?php echo template::ico('pencil'); ?> Éditer <?php echo template::ico('pencil'); ?> Éditer
</a> </a>
<?php endif; ?> <?php endif; ?>
@ -133,11 +133,11 @@
</h2> </h2>
<div class="blogComment"> <div class="blogComment">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>#comment"> <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>#comment">
<?php if ($article['comment']): ?> <?php if ($module::$comments[$articleId]): ?>
<?php echo count($article['comment']); ?> <?php echo $module::$comments[$articleId]; ?>
<?php echo template::ico('comment', ['margin' => 'left']); ?>
<?php endif; ?> <?php endif; ?>
</a> </a>
<?php echo template::ico('comment', ['margin' => 'left']); ?>
</div> </div>
<div class="blogDate"> <div class="blogDate">
<!-- bloc signature et date --> <!-- bloc signature et date -->

View File

@ -1,3 +1,5 @@
# Version 3.10
- Masque le code de vérification
# Version 3.9 # Version 3.9
- Redirection des pages orphelines - Redirection des pages orphelines
# Version 3.8 # Version 3.8

View File

@ -17,7 +17,7 @@
class form extends common class form extends common
{ {
const VERSION = '3.9'; const VERSION = '3.10';
const REALNAME = 'Formulaire'; const REALNAME = 'Formulaire';
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) 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, 'deleteall' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
'export2csv' => self::GROUP_MODERATOR, 'export2csv' => self::GROUP_MODERATOR,
'output2csv' => self::GROUP_MODERATOR,
'init' => self::GROUP_MODERATOR,
'update' => self::GROUP_MODERATOR,
]; ];
public static $data = []; public static $data = [];
@ -249,7 +246,7 @@ class form extends common
$content, $content,
template::button('formDataDelete' . $dataIds[$i], [ template::button('formDataDelete' . $dataIds[$i], [
'class' => 'formDataDelete buttonRed', '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') 'value' => template::ico('trash')
]) ])
]; ];
@ -270,7 +267,7 @@ class form extends common
public function export2csv() public function export2csv()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(2) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',
@ -311,7 +308,7 @@ class form extends common
public function deleteall() public function deleteall()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(2) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',
@ -347,7 +344,7 @@ class form extends common
public function delete() public function delete()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',

View File

@ -9,14 +9,14 @@
<div class="col1 offset9"> <div class="col1 offset9">
<?php echo template::button('formDataDeleteAll', [ <?php echo template::button('formDataDeleteAll', [
'class' => 'formDataDeleteAll buttonRed', 'class' => 'formDataDeleteAll buttonRed',
'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall',
'value' => template::ico('trash'), 'value' => template::ico('trash'),
'help' => 'Effacer toutes les données' 'help' => 'Effacer toutes les données'
]); ?> ]); ?>
</div> </div>
<div class="col1"> <div class="col1">
<?php echo template::button('formDataBack', [ <?php echo template::button('formDataBack', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'], 'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv',
'value' => template::ico('download'), 'value' => template::ico('download'),
'help' => 'Exporter toutes les données' 'help' => 'Exporter toutes les données'
]); ?> ]); ?>

View File

@ -1,3 +1,5 @@
# Version 3.9
- Bloque l'effacement de la galerie selon le profil
# Version 3.8 # Version 3.8
- Version compare null, dataversion not initialize - Version compare null, dataversion not initialize
- Bug de positionnement des boutons de retour - Bug de positionnement des boutons de retour

View File

@ -18,7 +18,7 @@ class gallery extends common
{ {
const VERSION = '3.8'; const VERSION = '3.9';
const REALNAME = 'Galerie'; const REALNAME = 'Galerie';
const DATADIRECTORY = self::DATA_DIR . 'gallery/'; const DATADIRECTORY = self::DATA_DIR . 'gallery/';
@ -385,13 +385,13 @@ class gallery extends common
$gallery['config']['name'], $gallery['config']['name'],
$gallery['config']['directory'], $gallery['config']['directory'],
template::button('galleryConfigEdit' . $galleryId, [ 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'), 'value' => template::ico('pencil'),
'help' => 'Configuration de la galerie ' 'help' => 'Configuration de la galerie '
]), ]),
template::button('galleryConfigDelete' . $galleryId, [ template::button('galleryConfigDelete' . $galleryId, [
'class' => 'galleryConfigDelete buttonRed', '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'), 'value' => template::ico('trash'),
'help' => 'Supprimer cette galerie' 'help' => 'Supprimer cette galerie'
]) ])
@ -507,7 +507,7 @@ class gallery extends common
]); ]);
} }
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -544,7 +544,7 @@ class gallery extends common
public function edit() public function edit()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -589,7 +589,7 @@ class gallery extends common
]); ]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $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'), 'notification' => helper::translate('Modifications enregistrées'),
'state' => true 'state' => true
]); ]);
@ -854,7 +854,7 @@ class gallery extends common
public function theme() public function theme()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(2) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -935,7 +935,7 @@ class gallery extends common
*/ */
if ($this->getUrl(2) === 'galleries') { if ($this->getUrl(2) === 'galleries') {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -976,7 +976,7 @@ class gallery extends common
*/ */
} elseif ($this->getUrl(2) === 'gallery') { } elseif ($this->getUrl(2) === 'gallery') {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(4) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit',
@ -1027,7 +1027,7 @@ class gallery extends common
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $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'), 'notification' => helper::translate('Modifications enregistrées'),
'state' => true 'state' => true
]); ]);

View File

@ -1,3 +1,5 @@
# Version 4.5
- Bloque l'effacement de l'article selon le profil
# Version 4.4 # Version 4.4
- Intl date Formats - Intl date Formats
- Bug un conflit avec le style de la page - Bug un conflit avec le style de la page

View File

@ -16,7 +16,7 @@
class news extends common class news extends common
{ {
const VERSION = '4.3'; const VERSION = '4.4';
const REALNAME = 'News'; const REALNAME = 'News';
const DATADIRECTORY = self::DATA_DIR . 'news/'; const DATADIRECTORY = self::DATA_DIR . 'news/';
@ -239,12 +239,12 @@ class news extends common
$dateOff, $dateOff,
helper::translate(self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'state'])]), helper::translate(self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'state'])]),
template::button('newsConfigEdit' . $newsIds[$i], [ 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') 'value' => template::ico('pencil')
]), ]),
template::button('newsConfigDelete' . $newsIds[$i], [ template::button('newsConfigDelete' . $newsIds[$i], [
'class' => 'newsConfigDelete buttonRed', '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') 'value' => template::ico('trash')
]) ])
]; ];
@ -338,12 +338,12 @@ class news extends common
$dateOff, $dateOff,
helper::translate(helper::translate(self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'state'])])), helper::translate(helper::translate(self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'state'])])),
template::button('newsConfigEdit' . $newsIds[$i], [ 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') 'value' => template::ico('pencil')
]), ]),
template::button('newsConfigDelete' . $newsIds[$i], [ template::button('newsConfigDelete' . $newsIds[$i], [
'class' => 'newsConfigDelete buttonRed', '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') 'value' => template::ico('cancel')
]) ])
]; ];
@ -372,7 +372,7 @@ class news extends common
]); ]);
} }
// Jeton incorrect // Jeton incorrect
elseif ($this->getUrl(3) !== $_SESSION['csrf']) { elseif ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -397,7 +397,7 @@ class news extends common
public function edit() public function edit()
{ {
// Jeton incorrect // Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) { if ($this->checkCSRF()) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',

View File

@ -18,7 +18,7 @@
( $this->getUser('group') === self::GROUP_ADMIN ) ( $this->getUser('group') === self::GROUP_ADMIN )
) )
): ?> ): ?>
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>"> <a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1);?>">
<?php echo template::ico('pencil');?> Éditer <?php echo template::ico('pencil');?> Éditer
</a> </a>
<?php endif; ?> <?php endif; ?>

View File

@ -34,7 +34,7 @@
) )
): ?> ): ?>
<a <a
href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId . '/' . $_SESSION['csrf']; ?>"> href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">
<?php echo template::ico('pencil'); ?> Éditer <?php echo template::ico('pencil'); ?> Éditer
</a> </a>
<?php endif; ?> <?php endif; ?>