10.2 Nettoyage d'espaces

This commit is contained in:
Fred Tempez 2020-06-03 09:07:00 +02:00
parent f6474295d4
commit 508cd838df
5 changed files with 72 additions and 72 deletions

View File

@ -12,7 +12,7 @@
- Modifications : - 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, 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. - 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 ## version 10.1.03
- Mise à jour : - Mise à jour :

View File

@ -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 : * conditions de blocage :
* - Les deux utilisateurs qui accèdent à la même page sont différents * - Les deux utilisateurs qui accèdent à la même page sont différents
* - les URLS sont identiques * - les URLS sont identiques

View File

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

View File

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

View File

@ -93,7 +93,7 @@ class news extends common {
$this->getData(['module', $this->getUrl(0), $newsIds[$i], 'title']), $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('%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'])], self::$states[$this->getData(['module', $this->getUrl(0), $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]. '/' . $_SESSION['csrf'],
@ -116,7 +116,7 @@ class news extends common {
/** /**
* Suppression * Suppression
*/ */
public function delete() { public function delete() {
// La news n'existe pas // La news n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) { if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie // Valeurs en sortie
@ -131,7 +131,7 @@ class news extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée' 'notification' => 'Action non autorisée'
]); ]);
} }
// Suppression // Suppression
else { else {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]); $this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
@ -155,7 +155,7 @@ class news extends common {
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée' 'notification' => 'Action non autorisée'
]); ]);
} }
// La news n'existe pas // La news n'existe pas
if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) { if($this->getData(['module', $this->getUrl(0), $this->getUrl(2)]) === null) {
// Valeurs en sortie // Valeurs en sortie