Browse Source

10.2 Nettoyage d'espaces

pull/9/head
Fred Tempez 1 year ago
parent
commit
508cd838df
  1. 2
      CHANGES.md
  2. 2
      core/core.php
  3. 32
      module/blog/blog.php
  4. 100
      module/gallery/gallery.php
  5. 8
      module/news/news.php

2
CHANGES.md

@ -12,7 +12,7 @@
- Modifications :
- Thème, les sélecteurs de couleur affiche la valeur RGBa d'une couleur différente de celle de la sélection.
- Thème de l'administration, amélioration du rendu.
- Image tag : adaptatations suit à la modification de l'API Google.
- Image tag : adaptations suite à la modification de l'API Google.
## version 10.1.03
- Mise à jour :

2
core/core.php

@ -1647,7 +1647,7 @@ class core extends common {
}
/**
* Controle si la page demandée est en édition ou accès à la gestion du site
* Contrôle si la page demandée est en édition ou accès à la gestion du site
* conditions de blocage :
* - Les deux utilisateurs qui accèdent à la même page sont différents
* - les URLS sont identiques

32
module/blog/blog.php

@ -44,7 +44,7 @@ class blog extends common {
];
public static $picturePositions = [
'left' => 'À gauche',
'left' => 'À gauche',
'right' => 'À droite ',
];
@ -67,11 +67,11 @@ class blog extends common {
$this->setData(['module', $this->getUrl(0), $articleId, [
'closeComment' => $this->getInput('blogAddCloseComment', helper::FILTER_BOOLEAN),
'mailNotification' => $this->getInput('blogEditMailNotification', helper::FILTER_BOOLEAN),
'groupNotification' => $this->getInput('blogEditGroupNotification', helper::FILTER_INT),
'groupNotification' => $this->getInput('blogEditGroupNotification', helper::FILTER_INT),
'comment' => [],
'content' => $this->getInput('blogAddContent', null),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
'publishedOn' => $this->getInput('blogAddPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
@ -124,7 +124,7 @@ class blog extends common {
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau
$comment = $comments[$commentIds[$i]];
self::$comments[] = [
self::$comments[] = [
utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
$comment['content'],
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
@ -160,7 +160,7 @@ class blog extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3)]);
@ -182,7 +182,7 @@ class blog extends common {
// Pagination
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
// Liste des pages
self::$pages = $pagination['pages'];
self::$pages = $pagination['pages'];
// Articles en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau
@ -191,7 +191,7 @@ class blog extends common {
// date('d/m/Y H:i', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])),
utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn'])))
.' à '.
utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))),
utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))),
self::$states[$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'state'])],
template::button('blogConfigEdit' . $articleIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
@ -228,7 +228,7 @@ class blog extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
@ -252,7 +252,7 @@ class blog extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
}
// L'article n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie
@ -263,7 +263,7 @@ class blog extends common {
// L'article existe
else {
// Soumission du formulaire
if($this->isPost()) {
if($this->isPost()) {
$articleId = $this->getInput('blogEditTitle', helper::FILTER_ID, true);
// Incrémente le nouvel id de l'article
if($articleId !== $this->getUrl(2)) {
@ -352,17 +352,17 @@ class blog extends common {
'createdOn' => time(),
'userId' => $this->getInput('blogArticleUserId'),
]]);
// Envoi d'une notification aux administrateurs
// Init tableau
$to = [];
// Liste des destinataires
// Liste des destinataires
foreach($this->getData(['user']) as $userId => $user) {
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'groupNotification']) ) {
$to[] = $user['mail'];
}
}
// Envoi du mail $sent code d'erreur ou de réusssite
// Envoi du mail $sent code d'erreur ou de réussite
if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'mailNotification']) === true) {
$sent = $this->sendMail(
$to,
@ -377,7 +377,7 @@ class blog extends common {
//'notification' => 'Commentaire ajouté',
//'state' => true
'notification' => ($sent === true ? 'Commentaire ajouté et une notification envoyée' : 'Commentaire ajouté, erreur de notification : <br/>' . $sent),
'state' => ($sent === true ? true : null)
'state' => ($sent === true ? true : null)
]);
} else {
@ -385,10 +385,10 @@ class blog extends common {
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
'notification' => 'Commentaire ajouté',
'state' => true
'state' => true
]);
}
}
// Ids des commentaires par ordre de publication
$commentIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment']), 'createdOn', 'SORT_DESC'));

100
module/gallery/gallery.php

@ -19,7 +19,7 @@ class gallery extends common {
const SORT_ASC = 'SORT_ASC';
const SORT_DSC = 'SORT_DSC';
const SORT_HAND = 'SORT_HAND';
const GALLERY_VERSION = '2.25';
const GALLERY_VERSION = '2.25';
public static $directories = [];
@ -33,7 +33,7 @@ class gallery extends common {
public static $picturesId = [];
public static $thumbs = [];
public static $thumbs = [];
public static $actions = [
'config' => self::GROUP_MODERATOR,
@ -43,7 +43,7 @@ class gallery extends common {
'sortPictures' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR,
'theme' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR
'index' => self::GROUP_VISITOR
];
public static $sort = [
@ -94,7 +94,7 @@ class gallery extends common {
public static $galleryThemeOpacity = [
'1' => 'Aucun ',
'.9' => 'Très Discrète',
'.8' => 'Discrète',
'.8' => 'Discrète',
'.7' => 'Moyenne',
'.6' => 'Forte',
'.5' => 'Très forte'
@ -149,7 +149,7 @@ class gallery extends common {
'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend']),
'positions' => $this->getData(['module',$this->getUrl(0),$data[$i],'positions'])
]]);
}
}
}
}
@ -187,13 +187,13 @@ class gallery extends common {
//Affichage de la galerie triée
$g = $this->getData(['module', $this->getUrl(0)]);
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
asort($p,SORT_NUMERIC);
asort($p,SORT_NUMERIC);
$galleries = [];
foreach ($p as $positionId => $item) {
$galleries [$positionId] = $g[$positionId];
$galleries [$positionId] = $g[$positionId];
}
// Traitement de l'affichage
if($galleries) {
if($galleries) {
foreach($galleries as $galleryId => $gallery) {
// Erreur dossier vide
if(is_dir($gallery['config']['directory'])) {
@ -206,8 +206,8 @@ class gallery extends common {
$gallery['config']['directory'] = '<span class="galleryConfigError">' . $gallery['config']['directory'] . ' (dossier introuvable)</span>';
}
// Met en forme le tableau
self::$galleries[] = [
template::ico('sort'),
self::$galleries[] = [
template::ico('sort'),
$gallery['config']['name'],
$gallery['config']['directory'],
template::button('galleryConfigEdit' . $galleryId , [
@ -227,19 +227,19 @@ class gallery extends common {
// Soumission du formulaire d'ajout d'une galerie
if($this->isPost()) {
if (!$this->getInput('galleryConfigFilterResponse')) {
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)]));
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)]));
// définir une vignette par défaut
$directory = $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true);
$iterator = new DirectoryIterator($directory);
$iterator = new DirectoryIterator($directory);
foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
// Créer la miniature si manquante
if (!file_exists( str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
$this->makeThumb($fileInfos->getPathname(),
str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
self::THUMBS_WIDTH);
}
// Miniatures
// Miniatures
$homePicture = strtolower($fileInfos->getFilename());
break;
}
@ -278,7 +278,7 @@ class gallery extends common {
* Suppression
*/
public function delete() {
// $url prend l'adresse sans le token
// $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
@ -293,7 +293,7 @@ class gallery extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Suppression non autorisée'
]);
}
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
@ -328,7 +328,7 @@ class gallery extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
}
// La galerie n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie
@ -344,16 +344,16 @@ class gallery extends common {
$galleryId = $this->getInput('galleryEditName', helper::FILTER_ID, true);
if($galleryId !== $this->getUrl(2)) {
// Incrémente le nouvel id de la galerie
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0)]));
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0)]));
// Transférer la position des images
$oldPositions = $this->getData(['module',$this->getUrl(0), $this->getUrl(2),'positions']);
$oldPositions = $this->getData(['module',$this->getUrl(0), $this->getUrl(2),'positions']);
// Supprime l'ancienne galerie
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
}
// légendes
$legends = [];
foreach((array) $this->getInput('legend', null) as $file => $legend) {
// Image de couverure par défaut si non définie
// Image de couverture par défaut si non définie
$homePicture = $file;
$file = str_replace('.','',$file);
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
@ -364,7 +364,7 @@ class gallery extends common {
$d = array_keys($this->getInput('homePicture', null));
$homePicture = $d[0];
}
// Sauvegarder
// Sauvegarder
$this->setData(['module', $this->getUrl(0), $galleryId, [
'config' => [
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
@ -379,7 +379,7 @@ class gallery extends common {
'legend' => $legends,
'positions' => empty($oldPositions) ? $this->getdata(['module', $this->getUrl(0), $galleryId, 'positions']) : $oldPositions
]]);
// Valeurs en sortie
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'] ,
'notification' => 'Modifications enregistrées',
@ -390,7 +390,7 @@ class gallery extends common {
$directory = $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'directory']);
if(is_dir($directory)) {
$iterator = new DirectoryIterator($directory);
foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
// Créer la miniature RFM si manquante
@ -399,13 +399,13 @@ class gallery extends common {
str_replace('source','thumb',$fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()),
122);
}
self::$pictures[str_replace('.','',$fileInfos->getFilename())] = [
self::$pictures[str_replace('.','',$fileInfos->getFilename())] = [
template::ico('sort'),
$fileInfos->getFilename(),
template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [
template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
'class' => 'homePicture'
]),
]),
template::text('legend[' . $fileInfos->getFilename() . ']', [
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
]),
@ -414,7 +414,7 @@ class gallery extends common {
self::$picturesId [] = str_replace('.','',$fileInfos->getFilename());
}
}
// Tri des images
// Tri des images
switch ($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort'])) {
case self::SORT_HAND:
$positions = $this->getdata(['module',$this->getUrl(0), $this->getUrl(2),'positions']);
@ -424,7 +424,7 @@ class gallery extends common {
$tempPictures[$key] = self::$pictures[$key];
$tempPicturesId [] = $key;
}
}
}
// Images ayant été ajoutées dans le dossier mais non triées
foreach (self::$pictures as $key => $value) {
if (!array_key_exists($key,$tempPictures)) {
@ -439,12 +439,12 @@ class gallery extends common {
case self::SORT_ASC:
ksort(self::$pictures,SORT_NATURAL);
sort(self::$picturesId,SORT_NATURAL);
break;
break;
case self::SORT_DSC:
krsort(self::$pictures,SORT_NATURAL);
rsort(self::$picturesId,SORT_NATURAL);
break;
}
break;
}
}
// Valeurs en sortie
$this->addOutput([
@ -473,21 +473,21 @@ class gallery extends common {
// La galerie existe
else {
// Images de la galerie
$directory = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'directory']);
$directory = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'directory']);
if(is_dir($directory)) {
$iterator = new DirectoryIterator($directory);
foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'legend', str_replace('.','',$fileInfos->getFilename())]);
$picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'positions', str_replace('.','',$fileInfos->getFilename())]);
// Créer la miniature si manquante
if (!file_exists( str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) {
$this->makeThumb($fileInfos->getPathname(),
str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()),
self::THUMBS_WIDTH);
}
}
// Définir la Miniature
self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists( str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists( str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))
? str_replace('source','thumb',$directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
: str_replace('source','thumb',$directory) . '/' . strtolower($fileInfos->getFilename());
}
@ -499,18 +499,18 @@ class gallery extends common {
if ($picturesSort) {
foreach ($picturesSort as $name => $position) {
$temp[$name] = self::$pictures[$name];
}
}
self::$pictures = $temp;
break;
}
case self::SORT_DSC:
krsort(self::$pictures,SORT_NATURAL);
break;
break;
case self::SORT_ASC:
default:
ksort(self::$pictures,SORT_NATURAL);
break;
}
}
}
// Affichage du template
if(self::$pictures) {
@ -536,10 +536,10 @@ class gallery extends common {
// Tri des galeries suivant l'ordre défini
$g = $this->getData(['module', $this->getUrl(0)]);
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
asort($p,SORT_NUMERIC);
asort($p,SORT_NUMERIC);
$galleries = [];
foreach ($p as $positionId => $item) {
$galleries [$positionId] = $g[$positionId];
$galleries [$positionId] = $g[$positionId];
}
// Construire le tableau
foreach((array) $galleries as $galleryId => $gallery) {
@ -547,7 +547,7 @@ class gallery extends common {
$iterator = new DirectoryIterator($gallery['config']['directory']);
foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
self::$galleries[$galleryId] = $gallery;
// L'image de couverture est-elle supprimée ?
if (file_exists( $gallery['config']['directory'] . '/' . $gallery['config']['homePicture'])) {
@ -556,12 +556,12 @@ class gallery extends common {
$this->makeThumb($gallery['config']['directory'] . '/' . str_replace(self::THUMBS_SEPARATOR ,'',$gallery['config']['homePicture']),
str_replace('source','thumb',$gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']),
self::THUMBS_WIDTH);
}
}
// Définir l'image de couverture
self::$firstPictures[$galleryId] = file_exists( str_replace('source','thumb',$gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']))
? str_replace('source','thumb',$gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture'])
: str_replace('source','thumb',$gallery['config']['directory']) . '/' . strtolower($gallery['config']['homePicture']);
} else {
} else {
// homePicture contient une image invalide, supprimée ou déplacée
// Définir l'image de couverture, première image disponible
$this->makeThumb($fileInfos->getPath() . '/' . $fileInfos->getFilename(),
@ -571,7 +571,7 @@ class gallery extends common {
? str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())
: str_replace('source','thumb',$fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename());
}
}
}
continue(1);
}
}
@ -600,7 +600,7 @@ class gallery extends common {
// Initialisation des données de thème de la galerie dasn theme.json
// Création des valeur par défaut absentes
if ( $this->getData(['theme', $this->getUrl(0)]) === null ) {
require_once('module/gallery/ressource/defaultdata.php');
require_once('module/gallery/ressource/defaultdata.php');
$this->setData(['theme', $this->getUrl(0), theme::$defaultData]);
}
// Soumission du formulaire
@ -626,8 +626,8 @@ class gallery extends common {
// Création des fichiers CSS
$content = file_get_contents('module/gallery/ressource/vartheme.css');
$themeCss = file_get_contents('module/gallery/ressource/theme.css');
// Injection des variables
$content = str_replace('#thumbAlign#',$this->getinput('galleryThemeThumbAlign'),$content );
// Injection des variables
$content = str_replace('#thumbAlign#',$this->getinput('galleryThemeThumbAlign'),$content );
$content = str_replace('#thumbWidth#',$this->getinput('galleryThemeThumbWidth'),$content );
$content = str_replace('#thumbHeight#',$this->getinput('galleryThemeThumbHeight'),$content );
$content = str_replace('#thumbMargin#',$this->getinput('galleryThemeThumbMargin'),$content );
@ -636,14 +636,14 @@ class gallery extends common {
$content = str_replace('#thumbOpacity#',$this->getinput('galleryThemeThumbOpacity'),$content );
$content = str_replace('#thumbShadows#',$this->getinput('galleryThemeThumbShadows'),$content );
$content = str_replace('#thumbShadowsColor#',$this->getinput('galleryThemeThumbShadowsColor'),$content );
$content = str_replace('#thumbRadius#',$this->getinput('galleryThemeThumbRadius'),$content );
$content = str_replace('#legendAlign#',$this->getinput('galleryThemeLegendAlign'),$content );
$content = str_replace('#thumbRadius#',$this->getinput('galleryThemeThumbRadius'),$content );
$content = str_replace('#legendAlign#',$this->getinput('galleryThemeLegendAlign'),$content );
$content = str_replace('#legendHeight#',$this->getinput('galleryThemeLegendHeight'),$content );
$content = str_replace('#legendTextColor#',$this->getinput('galleryThemeLegendTextColor'),$content );
$content = str_replace('#legendBgColor#',$this->getinput('galleryThemeLegendBgColor'),$content );
$success = file_put_contents('module/gallery/view/index/index.css',$content . $themeCss);
$success = $success && file_put_contents('module/gallery/view/gallery/gallery.css',$content . $themeCss);
// Valeurs en sortie
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl() . '/theme',
'notification' => $success ? 'Modifications enregistrées' : 'Modifications non enregistées !',

8
module/news/news.php

@ -93,7 +93,7 @@ class news extends common {
$this->getData(['module', $this->getUrl(0), $newsIds[$i], 'title']),
utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn'])))
.' à '.
utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn']))),
utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $newsIds[$i], 'publishedOn']))),
self::$states[$this->getData(['module', $this->getUrl(0), $newsIds[$i], 'state'])],
template::button('newsConfigEdit' . $newsIds[$i], [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
@ -116,7 +116,7 @@ class news extends common {
/**
* Suppression
*/
public function delete() {
public function delete() {
// La news n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie
@ -131,7 +131,7 @@ class news extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
}
// Suppression
else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
@ -155,7 +155,7 @@ class news extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
}
// La news n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie

Loading…
Cancel
Save