magician comment blog form
This commit is contained in:
parent
e4a630add9
commit
1c33e288ea
|
@ -1,5 +1,14 @@
|
|||
# Changelog
|
||||
|
||||
## Version 5.0.03 de Deltacms
|
||||
- Modifications :
|
||||
- module Blog : nouvelle structure pour l'enregistrement des données de pages utilisant ce module, pour alléger le fichier module.json commun à l'ensembles des modules,
|
||||
-
|
||||
- Correction :
|
||||
- Filemanager : correction d'instructions dépréciées.
|
||||
- Sur le site :
|
||||
-
|
||||
|
||||
## Version 5.0.02 de Deltacms
|
||||
- Modifications :
|
||||
- animation et réduction du panneau cookies,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
# DeltaCMS 5.0.02
|
||||
# DeltaCMS 5.0.03
|
||||
|
||||
DeltaCMS est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.
|
||||
L'administration du site est trilingue espagnol (castillan), anglais ou français, le site peut être rédigé dans une langue quelconque.
|
||||
|
@ -87,7 +87,7 @@ En cas de difficulté avec la nouvelle version, il suffira de téléverser la sa
|
|||
[R] content Dossier des contenus de page
|
||||
[F] accueil.html Exemple contenu de la page d'accueil
|
||||
[R] data_module Données volumineuses des pages avec module
|
||||
[F] ma_page.json Exemple de page avec données volumineuses, un fichier par page
|
||||
[F] blog.json Exemple de page avec données volumineuses, un fichier par page
|
||||
[R] *modules* Un dossier par module, exemple [R]search [R]agenda, pour les données du module
|
||||
[F] admin.css Thème des pages d'administration
|
||||
[F] admin.json Données de thème des pages d'administration
|
||||
|
|
|
@ -52,7 +52,7 @@ class common {
|
|||
|
||||
// Numéro de version
|
||||
const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/';
|
||||
const DELTA_VERSION = '5.0.02';
|
||||
const DELTA_VERSION = '5.0.03';
|
||||
const DELTA_UPDATE_CHANNEL = "v5";
|
||||
|
||||
public static $actions = [];
|
||||
|
|
|
@ -231,8 +231,8 @@ switch ($lang) {
|
|||
break;
|
||||
}
|
||||
// Si la langue n'est pas supportée par Tinymce la langue d'administration est utilisée
|
||||
if( ! file_exists( 'core/vendor/tinymce/langs/'.$lang_page.'.js' )){
|
||||
$lang_page = $lang_admin;
|
||||
if( ! file_exists( 'core/vendor/tinymce/langs/'.$lang_page.'.js' )){
|
||||
$lang_page = $text['core']['showComment'][7];
|
||||
}
|
||||
echo '<script> var lang_admin = "'.$lang_page.'"; </script>';
|
||||
// Vendor tinymce ?>
|
||||
|
|
|
@ -212,4 +212,7 @@ if ($this->getData(['core', 'dataVersion']) < 5002) {
|
|||
}
|
||||
$this->setData(['core', 'dataVersion', 5002]);
|
||||
}
|
||||
if ($this->getData(['core', 'dataVersion']) < 5003) {
|
||||
$this->setData(['core', 'dataVersion', 5003]);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -37,6 +37,7 @@ $text['core']['showComment'][3] = 'Comment on the page ';
|
|||
$text['core']['showComment'][4] = 'Form submitted';
|
||||
$text['core']['showComment'][5] = 'Failed to submit form';
|
||||
$text['core']['showComment'][6] = 'No comments yet';
|
||||
$text['core']['showComment'][7] ='en_GB';
|
||||
// core.js.php
|
||||
$text['core_js'][0] = "Updating ?";
|
||||
// Select File
|
||||
|
|
|
@ -37,6 +37,7 @@ $text['core']['showComment'][3] = 'Comentar en la página ';
|
|||
$text['core']['showComment'][4] = 'Formulario enviado';
|
||||
$text['core']['showComment'][5] = 'Error al enviar el formulario';
|
||||
$text['core']['showComment'][6] = 'Aún no hay comentarios';
|
||||
$text['core']['showComment'][7] ='es';
|
||||
// core.js.php
|
||||
$text['core_js'][0] = "¿Realizar actualización?";
|
||||
// Seleccione Archivo
|
||||
|
|
|
@ -37,6 +37,7 @@ $text['core']['showComment'][3] = 'Commentaire sur la page ';
|
|||
$text['core']['showComment'][4] = 'Formulaire soumis';
|
||||
$text['core']['showComment'][5] = 'Echec d\'envoi du formulaire';
|
||||
$text['core']['showComment'][6] = 'Pas encore de commentaire';
|
||||
$text['core']['showComment'][7] ='fr_FR';
|
||||
// core.js.php
|
||||
$text['core_js'][0] = "Effectuer la mise à jour ?";
|
||||
// Select File
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="row" style="display: flex; flex-wrap: wrap;">
|
||||
<div class="col3">
|
||||
<div class="block" style="height: 100%;">
|
||||
<h1 style="text-align: center;">Bienvenue sur votre<br />nouveau site<br />DeltaCMS !</h1>
|
||||
<h1 style="text-align: center;">Degemer mat war<br />ho lec'hienn nevez<br />DeltaCMS !</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
<div class="col3">
|
||||
<div class="block" style="height: 100%;">
|
||||
<h2 style="text-align: left;">Un email contenant le récapitulatif de votre installation vient de vous être envoyé.</h2>
|
||||
<h2 style="text-align: left;">Ur postel o konteniñ ar gemenadenn diavaez evit ho staliañ zo bet kaset deoc'h..</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -76,7 +76,7 @@ class init extends common {
|
|||
]
|
||||
],
|
||||
'core' => [
|
||||
'dataVersion' => 5002,
|
||||
'dataVersion' => 5003,
|
||||
'lastBackup' => 0,
|
||||
'lastClearTmp' => 0,
|
||||
'lastAutoUpdate' => 0,
|
||||
|
|
|
@ -483,8 +483,8 @@ class imageLib {
|
|||
|
||||
// *** Get cropping co-ordinates
|
||||
$cropArray = $this->getCropPlacing($optimalWidth, $optimalHeight, $newWidth, $newHeight, $cropPos);
|
||||
$cropStartX = $cropArray['x'];
|
||||
$cropStartY = $cropArray['y'];
|
||||
$cropStartX = (int) $cropArray['x'];
|
||||
$cropStartY = (int) $cropArray['y'];
|
||||
|
||||
// *** Crop this bad boy
|
||||
$crop = imagecreatetruecolor($newWidth, $newHeight);
|
||||
|
|
|
@ -4,25 +4,28 @@
|
|||
* This file is part of DeltaCMS.
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
||||
* @copyright Copyright (C) 2021, Sylvain Lelièvre
|
||||
* @author Sylvain Lelièvre
|
||||
* @copyright 2021 © Sylvain Lelièvre
|
||||
* @author Lionel Croquefer
|
||||
* @copyright 2022 © Lionel Croquefer
|
||||
* @license GNU General Public License, version 3
|
||||
* @link https://deltacms.fr/
|
||||
* @contact https://deltacms.fr/contact
|
||||
*
|
||||
* Delta was created from version 11.2.00.24 of ZwiiCMS
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @copyright 2008-2018 © Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||
* @copyright 2018-2021 © Frédéric Tempez
|
||||
*/
|
||||
|
||||
class blog extends common {
|
||||
|
||||
const VERSION = '6.8';
|
||||
const VERSION = '7.0';
|
||||
const REALNAME = 'Blog';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
const DATADIRECTORY = '';
|
||||
|
||||
const EDIT_OWNER = 'owner';
|
||||
const EDIT_GROUP = 'group';
|
||||
|
@ -123,9 +126,11 @@ class blog extends common {
|
|||
$this->setData(['module', $this->getUrl(0), 'texts', 'ReadMore', 'Lire la suite']);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','6.3']);
|
||||
}
|
||||
// Version 6.8
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '6.8', '<') ) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','6.8']);
|
||||
// Version 7.0
|
||||
if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '7.0', '<') ) {
|
||||
$this->setData(['data_module', $this->getUrl(0), 'posts', $this->getData(['module', $this->getUrl(0), 'posts']) ]);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'posts']);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','7.0']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,30 +157,30 @@ class blog extends common {
|
|||
$feeds->setDate(date('r',time()));
|
||||
$feeds->addGenerator();
|
||||
// Corps des articles
|
||||
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
|
||||
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC');
|
||||
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['data_module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC');
|
||||
$articleIdsStates = helper::arrayCollumn($this->getData(['data_module', $this->getUrl(0),'posts']), 'state', 'SORT_DESC');
|
||||
foreach( $articleIdsPublishedOns as $articleId => $articlePublishedOn ) {
|
||||
if( $articlePublishedOn <= time() AND $articleIdsStates[$articleId] ) {
|
||||
// Miniature
|
||||
$parts = explode('/',$this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||
$parts = explode('/',$this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'picture']));
|
||||
// Créer les articles du flux
|
||||
$newsArticle = $feeds->createNewItem();
|
||||
// Signature de l'article
|
||||
$author = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));
|
||||
$author = $this->signature($this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'userId']));
|
||||
$newsArticle->addElementArray([
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']),
|
||||
'title' => $this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'title']),
|
||||
'link' => helper::baseUrl() .$this->getUrl(0) . '/' . $articleId,
|
||||
'description' => '<img src="' . helper::baseUrl() . self::FILE_DIR . $thumb
|
||||
. '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" title="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" alt="' . $this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" title="' . $this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" />' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'content']),
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'content']),
|
||||
]);
|
||||
$newsArticle->setAuthor($author,'no@mail.com');
|
||||
$newsArticle->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $articleId);
|
||||
$newsArticle->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])));
|
||||
if ( file_exists($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])) ) {
|
||||
$newsArticle->setDate(date('r', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])));
|
||||
if ( file_exists($this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'picture'])) ) {
|
||||
$imageData = getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb);
|
||||
$newsArticle->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb,
|
||||
$imageData[0] * $imageData[1],
|
||||
|
@ -275,14 +280,14 @@ class blog extends common {
|
|||
}
|
||||
// Incrémente l'id de l'article
|
||||
$articleId = helper::increment($this->getInput('blogAddTitle', helper::FILTER_ID), $this->getData(['page']));
|
||||
$articleId = helper::increment($articleId, (array) $this->getData(['module', $this->getUrl(0)]));
|
||||
$articleId = helper::increment($articleId, (array) $this->getData(['data_module', $this->getUrl(0), 'posts']));
|
||||
$articleId = helper::increment($articleId, array_keys(self::$actions));
|
||||
// Crée l'article
|
||||
$this->setData(['module',
|
||||
$this->setData(['data_module',
|
||||
$this->getUrl(0),
|
||||
'posts',
|
||||
$articleId, [
|
||||
'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
|
||||
'comment' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
|
||||
'content' => $this->getInput('blogAddContent', null),
|
||||
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT),
|
||||
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
|
||||
|
@ -343,7 +348,7 @@ class blog extends common {
|
|||
$param = 'blog';
|
||||
include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php');
|
||||
|
||||
$comments = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2),'comment']);
|
||||
$comments = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2),'comment']);
|
||||
self::$commentsDelete = template::button('blogCommentDeleteAll', [
|
||||
'class' => 'blogCommentDeleteAll buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2).'/' . $_SESSION['csrf'] ,
|
||||
|
@ -368,7 +373,7 @@ class blog extends common {
|
|||
$buttonApproval = '';
|
||||
// Compatibilité avec les commentaires des versions précédentes, les valider
|
||||
$comment['approval'] = array_key_exists('approval', $comment) === false ? true : $comment['approval'] ;
|
||||
if ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2),'commentApproved']) === true) {
|
||||
if ( $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2),'commentApproved']) === true) {
|
||||
$buttonApproval = template::button('blogCommentApproved' . $commentIds[$i], [
|
||||
'class' => $comment['approval'] === true ? 'blogCommentRejected buttonGreen' : 'blogCommentApproved buttonRed' ,
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentApprove/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] ,
|
||||
|
@ -393,7 +398,7 @@ class blog extends common {
|
|||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $text['blog']['comment'][1]. $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
|
||||
'title' => $text['blog']['comment'][1]. $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
|
||||
'view' => 'comment'
|
||||
]);
|
||||
}
|
||||
|
@ -417,7 +422,7 @@ class blog extends common {
|
|||
include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php');
|
||||
|
||||
// Le commentaire n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
|
||||
if($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
|
@ -433,7 +438,7 @@ class blog extends common {
|
|||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]);
|
||||
$this->deleteData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2),
|
||||
|
@ -471,7 +476,7 @@ class blog extends common {
|
|||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment',[] ]);
|
||||
$this->setData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment',[] ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
||||
|
@ -500,7 +505,7 @@ class blog extends common {
|
|||
include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php');
|
||||
|
||||
// Le commentaire n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
|
||||
if($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
|
@ -516,12 +521,12 @@ class blog extends common {
|
|||
}
|
||||
// Inversion du statut
|
||||
else {
|
||||
$approved = !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) ;
|
||||
$this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), [
|
||||
'author' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']),
|
||||
'content' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']),
|
||||
'createdOn' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']),
|
||||
'userId' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']),
|
||||
$approved = !$this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) ;
|
||||
$this->setData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), [
|
||||
'author' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']),
|
||||
'content' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']),
|
||||
'createdOn' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']),
|
||||
'userId' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']),
|
||||
'approval' => $approved
|
||||
]]);
|
||||
|
||||
|
@ -573,25 +578,25 @@ class blog extends common {
|
|||
setlocale(LC_TIME, 'fr_FR');
|
||||
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en') setlocale(LC_TIME, 'en_GB');
|
||||
// Ids des articles par ordre de publication
|
||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['data_module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
// Gestion des droits d'accès
|
||||
$filterData=[];
|
||||
foreach ($articleIds as $key => $value) {
|
||||
if (
|
||||
( // Propriétaire
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
|
||||
AND ( $this->getData(['data_module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
|
||||
OR (
|
||||
// Groupe
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
|
||||
AND $this->getUser('group') >= $this->getData(['data_module',$this->getUrl(0), 'posts', $value,'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
|
||||
)
|
||||
) {
|
||||
$filterData[] = $value;
|
||||
|
@ -605,28 +610,28 @@ class blog extends common {
|
|||
// Articles en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Nombre de commentaires à approuver et approuvés
|
||||
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
|
||||
$approvals = helper::arrayCollumn($this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
|
||||
if ( is_array($approvals) ) {
|
||||
$a = array_values($approvals);
|
||||
$toApprove = count(array_keys($a,false));
|
||||
$approved = count(array_keys($a,true));
|
||||
} else {
|
||||
$toApprove = 0;
|
||||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||
$approved = count($this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||
}
|
||||
// Met en forme le tableau
|
||||
$date = mb_detect_encoding(date('d\/m\/Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? date('d\/m\/Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(date('d\/m\/Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(date('H\:i', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? date('H\:i', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(date('H\:i', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$date = mb_detect_encoding(date('d\/m\/Y', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? date('d\/m\/Y', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(date('d\/m\/Y', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(date('H\:i', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? date('H\:i', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(date('H\:i', $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
self::$articles[] = [
|
||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||
'</a>',
|
||||
$date .$text['blog']['config'][2]. $heure,
|
||||
$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
|
||||
$states[$this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
|
||||
// Bouton pour afficher les commentaires de l'article
|
||||
template::button('blogConfigComment' . $articleIds[$i], [
|
||||
'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' ,
|
||||
|
@ -671,7 +676,7 @@ class blog extends common {
|
|||
$param = 'blog';
|
||||
include('./module/blog/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_blog.php');
|
||||
|
||||
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
|
||||
if($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
|
@ -687,7 +692,7 @@ class blog extends common {
|
|||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
|
||||
$this->deleteData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
|
@ -724,7 +729,7 @@ class blog extends common {
|
|||
]);
|
||||
}
|
||||
// L'article n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
|
||||
if($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
|
@ -744,14 +749,14 @@ class blog extends common {
|
|||
// Incrémente le nouvel id de l'article
|
||||
if($articleId !== $this->getUrl(2)) {
|
||||
$articleId = helper::increment($articleId, $this->getData(['page']));
|
||||
$articleId = helper::increment($articleId, $this->getData(['module', $this->getUrl(0),'posts']));
|
||||
$articleId = helper::increment($articleId, $this->getData(['data_module', $this->getUrl(0),'posts']));
|
||||
$articleId = helper::increment($articleId, array_keys(self::$actions));
|
||||
}
|
||||
$this->setData(['module',
|
||||
$this->setData(['data_module',
|
||||
$this->getUrl(0),
|
||||
'posts',
|
||||
$articleId, [
|
||||
'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
|
||||
'comment' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
|
||||
'content' => $this->getInput('blogEditContent', null),
|
||||
'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT),
|
||||
'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN),
|
||||
|
@ -771,7 +776,7 @@ class blog extends common {
|
|||
]);
|
||||
// Supprime l'ancien article
|
||||
if($articleId !== $this->getUrl(2)) {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
|
||||
$this->deleteData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2)]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
|
@ -793,7 +798,7 @@ class blog extends common {
|
|||
unset($userFirstname);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
|
||||
'title' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title']),
|
||||
'vendor' => [
|
||||
'flatpickr',
|
||||
'tinymce'
|
||||
|
@ -848,7 +853,7 @@ class blog extends common {
|
|||
AND intval($this->getUrl(1)) === 0
|
||||
) {
|
||||
// L'article n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1)]) === null) {
|
||||
if($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
|
@ -860,7 +865,7 @@ class blog extends common {
|
|||
if($this->isPost()) {
|
||||
|
||||
// Sauve le contenu dans un brouillon
|
||||
// $this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, 'draft', 'content', $this->getInput('blogArticleContent', false) ]);
|
||||
// $this->setData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, 'draft', 'content', $this->getInput('blogArticleContent', false) ]);
|
||||
$_SESSION['commentAuthor'] = $this->getInput('blogArticleAuthor', false);
|
||||
$_SESSION['commentContent'] = $this->getInput('blogArticleContent', false);
|
||||
$detectBot ='';
|
||||
|
@ -893,38 +898,38 @@ class blog extends common {
|
|||
}
|
||||
if( $detectBot !== 'bot' ){
|
||||
// Crée le commentaire
|
||||
$key = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
|
||||
$key = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
|
||||
if( $key === null ) $key=array();
|
||||
$commentId = helper::increment(uniqid(), $key);
|
||||
$content = $this->getInput('blogArticleContent', false);
|
||||
$this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [
|
||||
$this->setData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [
|
||||
'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE),
|
||||
'content' => $content,
|
||||
'createdOn' => time(),
|
||||
'userId' => $this->getInput('blogArticleUserId'),
|
||||
'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
|
||||
'approval' => !$this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
|
||||
]]);
|
||||
// Envoi d'une notification aux administrateurs
|
||||
// Init tableau
|
||||
$to = [];
|
||||
// Liste des destinataires
|
||||
foreach($this->getData(['user']) as $userId => $user) {
|
||||
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification']) ) {
|
||||
if ($user['group'] >= $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification']) ) {
|
||||
$to[] = $user['mail'];
|
||||
$firstname[] = $user['firstname'];
|
||||
$lastname[] = $user['lastname'];
|
||||
}
|
||||
}
|
||||
// Envoi du mail $sent code d'erreur ou de réussite
|
||||
$notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? $this->getData(['module', $this->getUrl(0), 'texts', 'Waiting']): $this->getData(['module', $this->getUrl(0), 'texts', 'CommentOK']);
|
||||
if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) {
|
||||
$notification = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? $this->getData(['module', $this->getUrl(0), 'texts', 'Waiting']): $this->getData(['module', $this->getUrl(0), 'texts', 'CommentOK']);
|
||||
if ($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) {
|
||||
$error = 0;
|
||||
foreach($to as $key => $adress){
|
||||
$sent = $this->sendMail(
|
||||
$adress,
|
||||
$text['blog']['index'][4],
|
||||
$text['blog']['index'][5] . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' .
|
||||
$text['blog']['index'][6].'<a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a>'.$text['blog']['index'][7].'<br><br>',
|
||||
$text['blog']['index'][6].'<a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a>'.$text['blog']['index'][7].'<br><br>',
|
||||
''
|
||||
);
|
||||
if( $sent === false) $error++;
|
||||
|
@ -955,7 +960,7 @@ class blog extends common {
|
|||
}
|
||||
}
|
||||
// Ids des commentaires approuvés par ordre de publication
|
||||
$commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
|
||||
$commentsApproved = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
|
||||
if ($commentsApproved) {
|
||||
foreach( $commentsApproved as $key => $value){
|
||||
if($value['approval']===false) unset($commentsApproved[$key]);
|
||||
|
@ -969,7 +974,7 @@ class blog extends common {
|
|||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Signature de l'article
|
||||
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||
self::$articleSignature = $this->signature($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||
// Signature du commentaire édité
|
||||
if($this->getUser('password') === $this->getInput('DELTA_USER_PASSWORD')) {
|
||||
self::$editCommentSignature = $this->signature($this->getUser('id'));
|
||||
|
@ -977,21 +982,21 @@ class blog extends common {
|
|||
// Commentaires en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Signatures des commentaires
|
||||
$e = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'userId']);
|
||||
$e = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'userId']);
|
||||
if ($e) {
|
||||
self::$commentsSignature[$commentIds[$i]] = $this->signature($e);
|
||||
} else {
|
||||
self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'author']);
|
||||
self::$commentsSignature[$commentIds[$i]] = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'author']);
|
||||
}
|
||||
// Données du commentaire si approuvé
|
||||
if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) {
|
||||
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i]]);
|
||||
if ($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) {
|
||||
self::$comments[$commentIds[$i]] = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i]]);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie (activation de tinymce déporté dans article.php)
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
|
||||
'title' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']),
|
||||
'vendor' => ['tinymce'],
|
||||
'view' => 'article'
|
||||
]);
|
||||
|
@ -1001,8 +1006,8 @@ class blog extends common {
|
|||
// Liste des articles
|
||||
else {
|
||||
// Ids des articles par ordre de publication
|
||||
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC');
|
||||
$articleIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
|
||||
$articleIdsPublishedOns = helper::arrayCollumn($this->getData(['data_module', $this->getUrl(0),'posts']), 'publishedOn', 'SORT_DESC');
|
||||
$articleIdsStates = helper::arrayCollumn($this->getData(['data_module', $this->getUrl(0), 'posts']), 'state', 'SORT_DESC');
|
||||
$articleIds = [];
|
||||
foreach($articleIdsPublishedOns as $articleId => $articlePublishedOn) {
|
||||
if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) {
|
||||
|
@ -1015,7 +1020,7 @@ class blog extends common {
|
|||
self::$pages = $pagination['pages'];
|
||||
// Articles en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
self::$articles[$articleIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i]]);
|
||||
self::$articles[$articleIds[$i]] = $this->getData(['data_module', $this->getUrl(0), 'posts', $articleIds[$i]]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
|
|
|
@ -109,7 +109,7 @@ $text['blog']['index'][1] = '<br/> Error de notificación: ';
|
|||
$text['blog']['index'][4] = 'Nuevo comentario publicado';
|
||||
$text['blog']['índex'][5] = 'Hola';
|
||||
$text['blog']['index'][6] = 'El artículo';
|
||||
$text['blog']['index'][7] = 'recibió un nuevo comentario';
|
||||
$text['blog']['index'][7] = ' recibió un nuevo comentario';
|
||||
$text['blog']['index'][8] = 'Aún no hay comentarios';
|
||||
$text['blog']['index'][9] = 'Escribe un comentario';
|
||||
$text['blog']['índex'][10] = 'Nombre';
|
||||
|
|
|
@ -109,7 +109,7 @@ $text['blog']['index'][1] = '<br/> Erreur de notification : ';
|
|||
$text['blog']['index'][4] = 'Nouveau commentaire déposé';
|
||||
$text['blog']['index'][5] = 'Bonjour';
|
||||
$text['blog']['index'][6] = 'L\'article ';
|
||||
$text['blog']['index'][7] = 'a reçu un nouveau commentaire';
|
||||
$text['blog']['index'][7] = ' a reçu un nouveau commentaire';
|
||||
$text['blog']['index'][8] = 'Pas encore de commentaire';
|
||||
$text['blog']['index'][9] = 'Ecrire un commentaire';
|
||||
$text['blog']['index'][10] = 'Nom';
|
||||
|
|
|
@ -71,7 +71,7 @@ $lang_flatpickr = $text['blog_view']['add'][25];
|
|||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('blogAddHidePicture', true, $text['blog_view']['add'][10], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture'])
|
||||
'checked' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -49,14 +49,14 @@ if( function_exists('datefmt_create') && function_exists('datefmt_format') && ex
|
|||
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
|
||||
<?php if ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) === false
|
||||
&& $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) !=='' ) {
|
||||
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
|
||||
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
|
||||
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
|
||||
<?php $pictureSize = $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
|
||||
<?php if ( $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) === false
|
||||
&& $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) !=='' ) {
|
||||
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
|
||||
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
|
||||
'" alt="' . $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
|
||||
} ?>
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
|
||||
<?php echo $this->getData(['data_module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row verticalAlignMiddle">
|
||||
|
@ -64,14 +64,14 @@ if( function_exists('datefmt_create') && function_exists('datefmt_format') && ex
|
|||
<!-- bloc signature et date -->
|
||||
<?php echo $module::$articleSignature . ' - ';?>
|
||||
<?php if( function_exists('datefmt_create') && function_exists('datefmt_format') && extension_loaded('intl') ){
|
||||
echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))));
|
||||
echo datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))));
|
||||
} else{
|
||||
$date = mb_detect_encoding( date('d/m/Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? date('d/m/Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(date('d/m/Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(date('H:i', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? date('H:i', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(date('H:i', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
$date = mb_detect_encoding( date('d/m/Y', $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? date('d/m/Y', $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(date('d/m/Y', $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(date('H:i', $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? date('H:i', $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(date('H:i', $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
|
||||
echo $date . ' - ' . $heure;
|
||||
} ?>
|
||||
|
||||
|
@ -82,19 +82,19 @@ if( function_exists('datefmt_create') && function_exists('datefmt_format') && ex
|
|||
AND
|
||||
( // Propriétaire
|
||||
(
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||
AND ( $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
OR (
|
||||
// Groupe
|
||||
( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
|
||||
OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
|
||||
( $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
|
||||
OR $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
|
||||
AND $this->getUser('group') >= $this->getData(['data_module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
|
||||
$this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
|
||||
AND $this->getUser('group') >= $module::$actions['config']
|
||||
)
|
||||
)
|
||||
|
@ -128,7 +128,7 @@ if( function_exists('datefmt_create') && function_exists('datefmt_format') && ex
|
|||
|
||||
|
||||
</div>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<?php if($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<p><?php echo $this->getData(['module', $this->getUrl(0), 'texts', 'ArticleNoComment']); ?></p>
|
||||
<?php else: ?>
|
||||
<h3 id="comment">
|
||||
|
@ -173,10 +173,10 @@ if( function_exists('datefmt_create') && function_exists('datefmt_format') && ex
|
|||
<?php endif; ?>
|
||||
<div class="humanBot">
|
||||
<?php echo template::textarea('blogArticleContent', [
|
||||
'label' => $this->getData(['module', $this->getUrl(0), 'texts', 'Maxi']).' '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' '.$this->getData(['module', $this->getUrl(0), 'texts', 'Cara']),
|
||||
'label' => $this->getData(['module', $this->getUrl(0), 'texts', 'Maxi']).' '.$this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' '.$this->getData(['module', $this->getUrl(0), 'texts', 'Cara']),
|
||||
'class' => 'editorWysiwygComment',
|
||||
'noDirty' => true,
|
||||
'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']),
|
||||
'maxlength' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']),
|
||||
'TinymceMaxi' => $this->getData(['module', $this->getUrl(0), 'texts', 'TinymceMaxi']),
|
||||
'TinymceCara' => $this->getData(['module', $this->getUrl(0), 'texts', 'TinymceCara']),
|
||||
'TinymceExceed' => $this->getData(['module', $this->getUrl(0), 'texts', 'TinymceExceed']),
|
||||
|
|
|
@ -43,7 +43,7 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
<div class="col12">
|
||||
<?php echo template::text('blogEditTitle', [
|
||||
'label' => $text['blog_view']['edit'][4],
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title'])
|
||||
'value' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -55,19 +55,19 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
'help' => $help,
|
||||
'label' => $text['blog_view']['edit'][6],
|
||||
'type' => 1,
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picture'])
|
||||
'value' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picture'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('blogEditPictureSize', $pictureSizes, [
|
||||
'label' => $text['blog_view']['edit'][7],
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'pictureSize'])
|
||||
'selected' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'pictureSize'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('blogEditPicturePosition', $picturePositions, [
|
||||
'label' => $text['blog_view']['edit'][8],
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picturePosition']),
|
||||
'selected' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'picturePosition']),
|
||||
'help' => $text['blog_view']['edit'][9]
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -75,7 +75,7 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('blogEditHidePicture', true, $text['blog_view']['edit'][10], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture'])
|
||||
'checked' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'hidePicture'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -84,7 +84,7 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
</div>
|
||||
<?php echo template::textarea('blogEditContent', [
|
||||
'class' => 'editorWysiwyg',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'content'])
|
||||
'value' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'content'])
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
|
@ -101,13 +101,13 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
<?php echo template::date('blogEditPublishedOn', [
|
||||
'help' => $text['blog_view']['edit'][13],
|
||||
'label' => $text['blog_view']['edit'][14],
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'publishedOn'])
|
||||
'value' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'publishedOn'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 <?php if($this->getUser('group') < self::GROUP_MODERATOR) echo 'displayNone'; ?> ">
|
||||
<?php echo template::select('blogEditConsent', $articleConsent , [
|
||||
'label' => $text['blog_view']['edit'][15],
|
||||
'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']),
|
||||
'selected' => is_numeric($this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'editConsent']),
|
||||
'help' => $text['blog_view']['edit'][16]
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -122,12 +122,12 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('blogEditCommentClose', true, $text['blog_view']['edit'][18], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentClose'])
|
||||
'checked' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentClose'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('blogEditCommentApproved', true, $text['blog_view']['edit'][19], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']),
|
||||
'checked' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentApproved']),
|
||||
''
|
||||
]); ?>
|
||||
</div>
|
||||
|
@ -135,7 +135,7 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
<?php echo template::select('blogEditCommentMaxlength', $commentLength,[
|
||||
'help' => $text['blog_view']['edit'][20],
|
||||
'label' => $text['blog_view']['edit'][21],
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength'])
|
||||
'selected' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentMaxlength'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
|
@ -143,12 +143,12 @@ $lang_flatpickr = $text['blog_view']['edit'][25];
|
|||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('blogEditCommentNotification', true, $text['blog_view']['edit'][22], [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentNotification']),
|
||||
'checked' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentNotification']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('blogEditCommentGroupNotification', $groupNews, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'selected' => $this->getData(['data_module', $this->getUrl(0), 'posts', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'help' => $text['blog_view']['edit'][23]
|
||||
]); ?>
|
||||
</div>
|
||||
|
|
|
@ -27,7 +27,7 @@ if($module::$articles): ?>
|
|||
|
||||
<?php foreach($module::$articles as $articleId => $article): ?>
|
||||
<div class="row rowArticle">
|
||||
<?php if( $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) !=='' ){ ?>
|
||||
<?php if( $this->getData(['data_module', $this->getUrl(0), 'posts', $articleId, 'picture']) !=='' ){ ?>
|
||||
<div class="col3">
|
||||
<?php if ( file_exists(self::FILE_DIR . 'source/' . $article['picture']) ): ?>
|
||||
<?php // Déterminer le nom de la miniature
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
class form extends common {
|
||||
|
||||
const VERSION = '5.1';
|
||||
const VERSION = '6.0';
|
||||
const REALNAME = 'Formulaire';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
|
||||
const DATADIRECTORY = '';
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_EDITOR,
|
||||
|
@ -84,8 +84,11 @@ class form extends common {
|
|||
$this->setData(['module', $this->getUrl(0), 'config', 'uploadTxt',false]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData','4.1']);
|
||||
}
|
||||
if( version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '5.1', '<') ){
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.1']);
|
||||
if( version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '6.0', '<') ){
|
||||
// Déplaement des données de page de module.json 'data' vers data_module/nom_page.json 'data'
|
||||
$this->setData(['data_module', $this->getUrl(0), 'data', $this->getData(['module', $this->getUrl(0), 'data']) ]);
|
||||
$this->deleteData(['module', $this->getUrl(0), 'data']);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '6.0']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,8 +145,8 @@ class form extends common {
|
|||
]
|
||||
]);
|
||||
// Génération des données vides
|
||||
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||
if ($this->getData(['data_module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['data_module', $this->getUrl(0), 'data', []]);
|
||||
}
|
||||
// Génération des champs
|
||||
$inputs = [];
|
||||
|
@ -199,7 +202,7 @@ class form extends common {
|
|||
// Lexique
|
||||
$param = '';
|
||||
include('./module/form/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_form.php');
|
||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||
$data = $this->getData(['data_module', $this->getUrl(0), 'data']);
|
||||
if($data) {
|
||||
// Pagination
|
||||
$pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE);
|
||||
|
@ -256,7 +259,7 @@ class form extends common {
|
|||
'notification' => $text['form']['export2csv'][0]
|
||||
]);
|
||||
} else {
|
||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||
$data = $this->getData(['data_module', $this->getUrl(0), 'data']);
|
||||
if ($data !== []) {
|
||||
$csvfilename = 'data-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.csv';
|
||||
if (!file_exists(self::FILE_DIR.'source/data')) {
|
||||
|
@ -309,11 +312,11 @@ class form extends common {
|
|||
'notification' => $text['form']['deleteall'][0]
|
||||
]);
|
||||
} else {
|
||||
$data = ($this->getData(['module', $this->getUrl(0), 'data']));
|
||||
$data = ($this->getData(['data_module', $this->getUrl(0), 'data']));
|
||||
if (count($data) > 0 ) {
|
||||
// Suppression multiple
|
||||
for ($i = 1; $i <= count($data) ; $i++) {
|
||||
echo $this->deleteData(['module', $this->getUrl(0), 'data', $i]);
|
||||
echo $this->deleteData(['data_module', $this->getUrl(0), 'data', $i]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
|
@ -358,7 +361,7 @@ class form extends common {
|
|||
]);
|
||||
} else {
|
||||
// La donnée n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'data', $this->getUrl(2)]) === null) {
|
||||
if($this->getData(['data_module', $this->getUrl(0), 'data', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
|
@ -366,7 +369,7 @@ class form extends common {
|
|||
}
|
||||
// Suppression
|
||||
else {
|
||||
$this->deleteData(['module', $this->getUrl(0), 'data', $this->getUrl(2)]);
|
||||
$this->deleteData(['data_module', $this->getUrl(0), 'data', $this->getUrl(2)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
||||
|
@ -572,7 +575,11 @@ class form extends common {
|
|||
$sent = true;
|
||||
if( $notice === ''){
|
||||
// Crée les données
|
||||
$this->setData(['module', $this->getUrl(0), 'data', helper::increment(1, $this->getData(['module', $this->getUrl(0), 'data'])), $data]);
|
||||
if( null !== $this->getData(['data_module', $this->getUrl(0), 'data']) ) {
|
||||
$this->setData(['data_module', $this->getUrl(0), 'data', helper::increment(1, $this->getData(['data_module', $this->getUrl(0), 'data'])), $data]);
|
||||
} else {
|
||||
$this->setData(['data_module', $this->getUrl(0), 'data', 1, $data]);
|
||||
}
|
||||
// Emission du mail
|
||||
// Rechercher l'adresse en fonction du mail
|
||||
$singleuser = $this->getData(['user',
|
||||
|
|
Loading…
Reference in New Issue