commentaires de bas de page + corrections

This commit is contained in:
Deltacms 2024-02-02 16:44:05 +01:00
parent 0994db49ee
commit 4f0a324b98
45 changed files with 1414 additions and 26 deletions

View File

@ -1,12 +1,15 @@
# Changelog
## Version 4.5.05 de Deltacms
## Version 5.0.01 de Deltacms
- Modifications :
-
- Edition de page : nouvelle option avec la possibilité d'autoriser des commentaires sur une page. la configuration des commentaires est commune à toutes les pages, la gestion propre à chaque page. Cette option n'utilise pas de module.
- Edition de page : nouveau gabarit de page "barre 2/12 - page 8/12 - barre 2/12"
- Gestion des langues : l'utilitaire de copie permet d'ajouter ou de modifier une page, sous-page ou barre,
- Editeur Tinymce : le visiteur peut déposer des commentaires avec des emoticônes
- Corrections :
-
- Menu : suppression de l'aléa lors du passage de petit écran à grand écran.
- Sur le site :
- Menu : transition entre petit écran et grand écran.
-
## Version 4.5.04 de Deltacms
- Modifications :

View File

@ -491,7 +491,9 @@ class helper {
if($nbPage > 1) {
for($i = 1; $i <= $nbPage; $i++) {
$disabled = ($i === $currentPage) ? ' class="disabled"' : false;
$pages .= '<a href="' . helper::baseUrl() . $urlCurrent . '/' . $i . $sufix . '"' . $disabled . '>' . $i . '</a>';
$pages .= '<a href="' . helper::baseUrl() . $urlCurrent . '/' . $i . $sufix . '"' . $disabled . '>' . $i . '</a>';
//$pages .= '<a href="' . helper::baseUrl() . $urlCurrent . $sufix . '"' . $disabled . '>' . $i . '</a>';
}
$pages = '<div class="pagination">' . $pages . '</div>';
}

View File

@ -699,5 +699,46 @@ core.relativeLuminanceW3C = function(rgba) {
});
});
<?php } ?>
/*
* Commentaire de page : affichage du formulaire
*/
$("#buttonCommentShowForm").click(function() {
if( $("#formCommentVisible").css("display") === "none" ){
$("#formCommentVisible").css("display","block");
} else {
$("#formCommentVisible").css("display","none");
}
});
/* Création d'un cookie à l'ouverture de la page formulaire*/
$(document).ready(function(){
const d = new Date();
time = d.getTime();
document.cookie = "evtO = " + time + ";SameSite=Strict";
});
/* Création d'un cookie à la validation de la checkbox 'je ne suis pas un robot'*/
$( ".commentHumanCheck" ).click(function() {
const d = new Date();
time = d.getTime();
document.cookie = "evtH = " + time + ";SameSite=Strict";
});
/* Création d'un cookie quand on arrive sur la checkbox 'je ne suis pas un robot' */
$( ".commentHumanCheck" ).mouseenter(function() {
const d = new Date();
time = d.getTime();
document.cookie = "evtA = " + time + ";SameSite=Strict";
});
/* Création d'un cookie quand on quitte la checkbox 'je ne suis pas un robot' */
$( ".commentHumanCheck" ).mouseleave(function() {
const d = new Date();
time = d.getTime();
document.cookie = "evtS = " + time + ";SameSite=Strict";
});
/* Création d'un cookie à la validation du formulaire */
$( ".commentHumanBotClose" ).click(function() {
const d = new Date();
time = d.getTime();
document.cookie = "evtV = " + time + ";SameSite=Strict";
});
});

View File

@ -52,8 +52,11 @@ class common {
// Numéro de version
const DELTA_UPDATE_URL = 'https://update.deltacms.fr/master/';
const DELTA_VERSION = '4.5.05';
const DELTA_UPDATE_CHANNEL = "v4";
const DELTA_VERSION = '5.0.01';
const DELTA_UPDATE_CHANNEL = "v5";
// Pour la pagination des commentaires de bas de page
const ITEMSPAGE = 3;
public static $actions = [];
public static $coreModuleIds = [
@ -231,6 +234,7 @@ class common {
private $page = [];
private $module = [];
private $locale = [];
private $comment = [];
// Descripteur de données Entrées / Sorties
// Liste ici tous les fichiers de données
@ -245,7 +249,8 @@ class common {
'blacklist' => '',
'locale' => '',
'fonts' => '',
'session' =>''
'session' =>'',
'comment' =>''
];
/**
@ -848,7 +853,8 @@ class common {
// Sauf pour les pages et les modules
if ($id === 'page' ||
$id === 'module' ||
$id === 'locale' ) {
$id === 'locale' ||
$id === 'comment') {
$folder = self::DATA_DIR . $lang . '/' ;
} else {
$folder = self::DATA_DIR;
@ -1254,10 +1260,10 @@ class common {
}
// Page pleine pour la configuration des modules et l'édition des pages sauf l'affichage d'un article de blog
$pattern = ['config','edit','add','comment','data'];
if ((sizeof($blocks) === 1 ||
in_array($this->getUrl(1),$pattern) )
) { // Pleine page en mode configuration
if ((sizeof($blocks) === 1 || in_array($this->getUrl(1),$pattern) ) ) {
// Pleine page en mode configuration
$this->showContent();
if( $this->getData(['page', $this->getUrl(0), 'commentEnable']) === true && strlen($this->getUrl(1)) < 3 ) $this->showComment();
if (file_exists(self::DATA_DIR . 'body.inc.php')) {
include( self::DATA_DIR . 'body.inc.php');
}
@ -1293,6 +1299,7 @@ class common {
*/
echo '<div class="'. $content . '" id="contentSite">';
$this->showContent();
if( $this->getData(['page', $this->getUrl(0), 'commentEnable']) === true ) $this->showComment();
if (file_exists(self::DATA_DIR . 'body.inc.php')) {
include(self::DATA_DIR . 'body.inc.php');
}
@ -1345,6 +1352,14 @@ class common {
echo $this->output['content'];
}
/**
* Affiche les commentaires de page quand ils sont autorisés
*
*/
public function showComment() {
include('./core/include/comment.inc.php');
}
/**
* Affiche le pied de page
@ -1593,7 +1608,7 @@ class common {
default:
$socialUrl = '';
}
if($socialId !== '') {
if($socialId !== '' && is_string($socialName) && is_string($socialUrl) && is_string($socialId) ) {
$socials .= '<a href="' . $socialUrl . $socialId . '" onclick="window.open(this.href);return false" data-tippy-content="' . $title . '">' . template::ico(substr(str_replace('User','',$socialName), 0, -2)) . '</a>';
}
}

View File

@ -0,0 +1,332 @@
<?php // Commentaires de page, fichier inclus dans showComment() ?>
<?php // Style lié au thème du site ?>
<style>.msgs > hr { --hr_color : <?=$this->getData(['theme', 'block', 'borderColor'])?>; }</style>
<?php
// Lexique
include('./core/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_core.php');
// Création du brouillon s'il n'existe pas
if( !isset($_SESSION['draftPage'])){
$_SESSION['draftPage'] = [];
$_SESSION['draftPage']['textarea'] = "";
$_SESSION['draftPage']['text'] = "";
}
// Traitement des boutons pagination
$commentNumPage = 'commentNumPage'. $this->getUrl(0);
if($this->isPost() && isset($_POST['commentPageFormNext' ])){
$_SESSION[$commentNumPage] = $_SESSION[$commentNumPage] + 1;
}
if($this->isPost() && isset($_POST['commentPageFormPrev' ])){
$_SESSION[$commentNumPage] = $_SESSION[$commentNumPage] - 1;
}
// Traitement de l'envoi du formualire
if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) {
// $notice concerne la détection d'erreurs
$notice = '';
$code = null !== $this->getInput('codeCaptcha') ? $this->getInput('codeCaptcha') : '';
// Captcha demandée
if( $this->getData(['config', 'social', 'comment', 'captcha']) ){
// option de détection de robot en premier cochée et $_SESSION['humanBot']==='human'
if( $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot'])=== true ) {
// Présence des 5 cookies et checkbox cochée ?
$detectBot ='bot';
if ( isset ($_COOKIE['evtO']) && isset ($_COOKIE['evtV']) && isset ($_COOKIE['evtH'])
&& isset ($_COOKIE['evtS']) && isset ($_COOKIE['evtA']) && $this->getInput('commentPageFormHumanCheck', helper::FILTER_BOOLEAN) === true ) {
// Calcul des intervals de temps
$time2 = $_COOKIE['evtH'] - $_COOKIE['evtO']; // temps entre click checkbox et ouverture de la page
$time3 = $_COOKIE['evtV'] - $_COOKIE['evtH']; // temps entre validation formulaire et click checkbox
$time4 = $_COOKIE['evtS'] - $_COOKIE['evtA']; // temps passé sur la checkbox
if( $time2 >= 1000 && $time3 >=300 && $time4 >=300 ) $detectBot = 'human';
}
// Bot présumé
if( $detectBot === 'bot') $_SESSION['humanBot']='bot';
}
// $_SESSION['humanBot']==='bot' ou option 'Pas de Captcha pour un humain' non validée
elseif( md5($code) !== $_SESSION['captcha'] ) {
$notice = $text['core']['showComment'][1];
}
}
// Lecture des inputs
$valueText = $this->getInput('commentPageFormInput[0]', helper::FILTER_STRING_SHORT, true);
$valueTextarea = $this->getInput('commentPageFormInput[1]', helper::FILTER_STRING_LONG_NOSTRIP, true);
// Mise à jour du brouillon
$_SESSION['draftPage']['text'] = $valueText;
$_SESSION['draftPage']['textarea'] = $valueTextarea;
// Préparation du contenu des données ($data) et du mail
$data = [];
$content = '';
$file_name = '';
// Mail
if( $valueText !== '') $content .= '<strong>' . $text['core']['showComment'][9] . ' :</strong> ' . $valueText . '<br>';
if( $valueTextarea !== '') $content .= '<strong>' . $text['core']['showComment'][10] . ' :</strong> ' . $valueTextarea . '<br>';
// Données
$data[$text['core']['showComment'][9]] = $valueText;
$data[$text['core']['showComment'][10]] = $valueTextarea;
// Bot présumé, la page sera actualisée avec l'affichage du captcha complet
if( $detectBot === 'bot') $notice = $text['core']['showComment'][1];
// Si absence d'erreur
$sent = true;
if( $notice === ''){
// Crée les données, l'indice des messages est la date unix
$id = time();
$this->setData(['comment', $this->getUrl(0), 'data', $id , $data]);
// Ajout de la date en clair pour les données dans le json
if( $this->getData(['config', 'i18n', 'langAdmin']) === 'en' ){
$dateMessage = date('m/d/Y H:i', $id);
} else {
$dateMessage = date('d/m/Y H:i', $id);
}
$this->setData(['comment', $this->getUrl(0), 'data', $id , 'Date' , $dateMessage ]);
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
$listUsers [] = '';
foreach($userIdsFirstnames as $userId => $userFirstname) {
$listUsers [] = $userId;
}
// Emission du mail
// Rechercher l'adresse en fonction du mail
$singleuser = $this->getData(['user', $listUsers[$this->getData(['config', 'social', 'comment', 'user'])], 'mail']);
$singlemail = $this->getData(['config', 'social', 'comment', 'mail']);
$group = $this->getData(['config', 'social', 'comment', 'group']);
// Verification si le mail peut être envoyé
if(
self::$inputNotices === [] && (
$group > 0 ||
$singleuser !== '' ||
$singlemail !== '' )
) {
// Utilisateurs dans le groupe
$to = [];
if ($group > 0){
foreach($this->getData(['user']) as $userId => $user) {
if($user['group'] >= $group) {
$to[] = $user['mail'];
}
}
}
// Utilisateur désigné
if (!empty($singleuser)) {
$to[] = $singleuser;
}
// Mail désigné
if (!empty($singlemail)) {
$to[] = $singlemail;
}
if($to) {
// Sujet du mail
$subject = $this->getData(['config', 'social', 'comment', 'subject']);
if($subject === '') {
$subject = $text['core']['showComment'][2];
}
// Envoi le mail
$sent = $this->sendMail(
$to,
$subject,
$text['core']['showComment'][3] . $this->getData(['page', $this->getUrl(0), 'title']) . ' :<br><br>' .
$content
);
}
}
// Redirection
$redirect = helper::baseUrl() . $this->getUrl(0);
if ( $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) !== '') $redirect = helper::baseUrl() . $this->getData(['module', $this->getUrl(0), 'config', 'pageId']);
// Effacement des données provisoires
if( self::$inputNotices === [] ){
$_SESSION['draftPage'] = [];
$_SESSION['draftPage']['textarea'] = "";
$_SESSION['draftPage']['text'] = "";
} else {
$sent = false;
}
} else {
$sent = false;
}
// Notifications
if( $sent === true) {
$_SESSION['DELTA_NOTIFICATION_SUCCESS']= $text['core']['showComment'][4];
$_SESSION['DELTA_NOTIFICATION_ERROR'] = '';
} else {
$_SESSION['DELTA_NOTIFICATION_SUCCESS']= '';
$_SESSION['DELTA_NOTIFICATION_ERROR'] = $text['core']['showComment'][5];
}
$this->showNotification();
}
// Préparation de la liste paginée des commentaires // Initialisation de la pagination
$nbPage =0;
if ( !isset($_SESSION[$commentNumPage] )) $_SESSION[$commentNumPage] = 1;
$dataPage = $this->getData(['comment', $this->getUrl(0), 'data']);
if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) {
$nbPage = round(count( $dataPage) / self::ITEMSPAGE, 0, PHP_ROUND_HALF_UP);
if( $_SESSION[$commentNumPage] > $nbPage ) $_SESSION[$commentNumPage] = $nbPage;
if( $_SESSION[$commentNumPage] <= 0 ) $_SESSION[$commentNumPage] = 1;
$paramPage = $this->getUrl() .'/'. $_SESSION[$commentNumPage];
// Pagination
$pagination = helper::pagination($dataPage, $paramPage, self::ITEMSPAGE);
// Liste des pages
$pagesComment = $pagination['pages'];
// Inverse l'ordre du tableau
$dataIds = array_reverse(array_keys($dataPage));
$dataPage = array_reverse($dataPage);
// Données en fonction de la pagination et suppression des adresses e-mail
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
$content = '';
foreach($dataPage[$i] as $input => $value) {
if (!empty($value) && strpos($value, 'Д') === false) $content .= '<div class=\'clef\'>' . $input . '</div> : <div class=\'valeur\'>' . $value . '</div>';
}
$horizontalRule = '';
if( $i < $pagination['last'] - 1) : $horizontalRule = '<hr>';
else : $horizontalRule = '<br>';
endif;
$data[] = [
$content.$horizontalRule
];
}
}
// Partie affichage (View dans la structure classique)
// Adaptation de la langue dans tinymce pour la rédaction d'un message en fonction de la langue de la page, originale ou en traduction rédigée
$lang = $this->getData(['config', 'i18n', 'langBase']);
if ( !empty($_COOKIE["DELTA_I18N_SITE"])) {
if( $this->getInput('DELTA_I18N_SITE') !== 'base' ) $lang = $this->getInput('DELTA_I18N_SITE');
}
$lang_page = $lang;
switch ($lang) {
case 'en' :
$lang_page = 'en_GB';
break;
case 'pt' :
$lang_page = 'pt_PT';
break;
case 'sv' :
$lang_page = 'sv_SE';
break;
case 'fr' :
$lang_page = 'fr_FR';
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;
}
echo '<script> var lang_admin = "'.$lang_page.'"; </script>';
// Vendor tinymce ?>
<script src="core/vendor/tinymce/tinymce.min.js"></script><script src="core/vendor/tinymce/init.js"></script>
<div class="row">
<div class="col4 offset4">
<?php echo template::button('buttonCommentShowForm', [
'value' => $text['core']['showComment'][0],
'ico' => 'pencil'
]); ?>
</div>
</div>
<div id="formCommentVisible" style="display: none;">
<?php // Formulaire
echo template::formOpenFile('commentPageFormForm'); ?>
<div class="humanBot">
<?php echo template::text('commentPageFormInput[0]', [
'id' => 'commentPageFormInput_0',
'label' => $text['core']['showComment'][9],
'value' => $_SESSION['draftPage']['text']
]);
echo template::textarea('commentPageFormInput[1]', [
'id' => 'commentPageFormInput_1',
'label' => $text['core']['showComment'][10],
'value' => $_SESSION['draftPage']['textarea'],
'class' => 'editorWysiwygComment',
'noDirty' => true
]); ?>
</div>
<?php if( $this->getData(['config', 'social', 'comment', 'captcha']) && ( $_SESSION['humanBot']==='bot') || $this->getData(['config', 'connect', 'captchaBot'])===false ): ?>
<div class="row">
<div class="col12 textAlignCenter">
<?php echo template::captcha('commentPageFormCaptcha', ''); ?>
</div>
</div>
<?php endif; ?>
<?php if( $this->getData(['config', 'social', 'comment', 'captcha']) && $_SESSION['humanBot']==='human' && $this->getData(['config', 'connect', 'captchaBot']) ): ?>
<div class="row formCheckBlue">
<?php echo template::text('commentPageFormInputBlue', [
'label' => 'Input Blue',
'value' => ''
]); ?>
</div>
<br>
<div class="row formOuter">
<div class="formInner commentHumanCheck">
<?php echo template::checkbox('commentPageFormHumanCheck', true, $this->getData(['locale', 'captchaSimpleText']), [
'checked' => false,
'help' => $this->getData(['locale', 'captchaSimpleHelp'])
]); ?>
</div>
</div>
<br>
<?php endif; ?>
<div class="row textAlignCenter">
<div class="formInner commentHumanBotClose">
<?php echo template::submit('commentPageFormSubmit', [
'value' => $this->getData(['config', 'social', 'comment', 'button']) ? $this->getData(['config', 'social', 'comment', 'button']) : $text['core']['showComment'][8],
'ico' => ''
]); ?>
</div>
</div>
<br>
</div>
<?php
// Affichage des messages
echo '<div class="block msgs">';
if($data):
foreach( $data as $key1=>$value1){
if( is_array($value1)){
foreach( $value1 as $key2=>$value2){
echo $value2;
}
}
}
else:
echo template::speech('<div style=" text-align: center;">'.$text['core']['showComment'][6].'</div>' );
endif;
echo '</div>';
if($pagesComment && $nbPage > 1){ ?>
<div class="row" >
<?php if($_SESSION[$commentNumPage] > 1) { ?>
<div class="col1">
<?php echo template::submit('commentPageFormPrev', [
'class' => 'commentPageButtonPrevNext',
'value' => '',
'ico' =>'left'
]); ?>
</div>
<?php } ?>
<div class="col1" style="padding-top:20px;text-align:center;">
<?php echo template::label('','Page '.$_SESSION[$commentNumPage].'/'.$nbPage,[]); ?>
</div>
<?php if($_SESSION[$commentNumPage] < $nbPage ) { ?>
<div class="col1">
<?php echo template::submit('commentPageFormNext', [
'class' => 'commentPageButtonPrevNext',
'value' => '',
'ico' =>'plus'
]); ?>
</div>
<?php } ?>
</div> <?php
}
echo template::formClose();
?>

View File

@ -179,7 +179,7 @@ if ($this->getData(['core', 'dataVersion']) < 4502) {
$this->deleteData(['theme', 'menu', 'burgerIconLink2']);
$this->setData(['core', 'dataVersion', 4502]);
}
if ($this->getData(['core', 'dataVersion']) < 4504) {
$this->setData(['core', 'dataVersion', 4504]);
if ($this->getData(['core', 'dataVersion']) < 4505) {
$this->setData(['core', 'dataVersion', 4505]);
}
?>

View File

@ -31,6 +31,16 @@ $text['core']['router'][3] = 'Access denied';
$text['core']['router'][4] = 'You are not authorised to view this page (error 403)';
$text['core']['router'][5] = 'Page unavailable';
$text['core']['router'][6] = 'The requested page does not exist or cannot be found (error 404)';
$text['core']['showComment'][0] = 'Write a comment';
$text['core']['showComment'][1] = 'Robot detected';
$text['core']['showComment'][2] = 'Subject';
$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'][8] = 'Send';
$text['core']['showComment'][9] = 'Name or nickname';
$text['core']['showComment'][10] = 'Comment';
// core.js.php
$text['core_js'][0] = "Updating ?";
// Select File

View File

@ -31,6 +31,16 @@ $text['core']['router'][3] = 'Acceso denegado';
$text['core']['router'][4] = 'No está autorizado para ver esta página (error 403)';
$text['core']['router'][5] = 'Página no disponible';
$text['core']['router'][6] = 'La página solicitada no existe o no se encuentra (error 404)';
$text['core']['showComment'][0] = 'Escribir un comentario';
$text['core']['showComment'][1] = 'Robot detectado';
$text['core']['showComment'][2] = 'Asunto';
$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'][8] = 'Enviar';
$text['core']['showComment'][9] = 'Nombre o apodo';
$text['core']['showComment'][10] = 'Comentario';
// core.js.php
$text['core_js'][0] = "¿Realizar actualización?";
// Seleccione Archivo

View File

@ -31,6 +31,16 @@ $text['core']['router'][3] = 'Accès interdit';
$text['core']['router'][4] = 'Vous n\'êtes pas autorisé à consulter cette page (erreur 403)';
$text['core']['router'][5] = 'Page indisponible';
$text['core']['router'][6] = 'La page demandée n\'existe pas ou est introuvable (erreur 404)';
$text['core']['showComment'][0] = 'Ecrire un commentaire';
$text['core']['showComment'][1] = 'Robot détecté';
$text['core']['showComment'][2] = 'Sujet';
$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'][8] = 'Envoyer';
$text['core']['showComment'][9] = 'Nom ou pseudo';
$text['core']['showComment'][10] = 'Commentaire';
// core.js.php
$text['core_js'][0] = "Effectuer la mise à jour ?";
// Select File

View File

@ -17,6 +17,7 @@ else { echo '<html lang="'.$lang.'">'; }
<link rel="stylesheet" href="core/vendor/normalize/normalize.min.css">
<link rel="stylesheet" href="core/layout/common.css">
<link rel="stylesheet" href="<?php echo self::DATA_DIR; ?>theme.css">
<?php if( $this->getData(['page', $this->getUrl(0), 'commentEnable']) === true && strlen($this->getUrl(1)) < 3 ) {?> <link rel="stylesheet" href="core/layout/pageComment.css"><?php }?>
<link rel="stylesheet" href="core/layout/mediaqueries.css">
<?php $this->showStyle();
$this->showSharedVariables();

View File

@ -337,6 +337,10 @@
.navBodyWidth {
width: 100%;
}
/* Pour les formulaires */
.formOuter{
width: 100%;
}
}
/* Autres tailles d'écrans */

View File

@ -0,0 +1,82 @@
/**
* This file is part of DeltaCMS.
*/
#formFileReset {
background-color: red;
border-width:1px;
border-color: orange;
font-size: 1.15em;
font-style: bold;
color: yellow;
}
#formFileReset:hover {
background-color: orange;
border-color: orange;
font-style: normal;
color:black;
}
.formInputFile {
padding: 9px;
border-radius: 2px;
border: 1px solid;
}
.formOuter{
text-align: center;
margin: 0 auto;
width: 50%;
border-radius: 2px;
border: 1px solid;
}
/*formulaire*/
#commentPageFormForm {
max-width: 85vw;
margin: auto;
}
/* messages */
.msgs {
max-width: 85vw;
margin: auto;
overflow: hidden;
box-sizing: border-box;
border: ridge rgba(0,0,0,0.3) 2px;
padding: 5px;
}
div.clef {
font-weight: 600;
display: inline-block;
margin: 3px 0 2px;
}
div.valeur {
display: block;
padding: 3px;
}
div.valeur > p {
margin: 0;
line-height: 1.2;
}
.msgs > hr {
width: 50%;
border: ridge var(--hr_color) 2px;
margin: 25px auto;
}
#commentPageFormForm .editorWysiwygComment {
overflow: auto;
resize: vertical;
min-height: 220px;
}
.formInner{
display: inline-block;
}
.formCheckBlue {
display: none;
}

View File

@ -162,6 +162,22 @@ class config extends common {
// Variable pour construire la liste des pages du site
public static $pagesList = [];
public static $orphansList = [];
// Constantes pour les champs de commentaires dans Social
const TYPE_MAIL = 'mail';
const TYPE_TEXT = 'text';
const TYPE_TEXTAREA = 'textarea';
const TYPE_DATETIME = 'date';
const ITEMSPAGE = 10;
// Variable pour les champs de commentaires dans Social
public static $listUsers = [];
public static $logoWidth = [
'40' => '40%',
'60' => '60%',
'80' => '80%',
'100' => '100%'
];
/**
* Génére les fichiers pour les crawlers
@ -179,6 +195,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// Mettre à jour le site map
@ -210,6 +227,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// Soumission du formulaire
@ -254,6 +272,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
$texte='';
@ -288,6 +307,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// Soumission du formulaire
@ -375,8 +395,17 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// Liste des utilisateurs
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
ksort($userIdsFirstnames);
self::$listUsers [] = '';
foreach($userIdsFirstnames as $userId => $userFirstname) {
self::$listUsers [] = $userId;
}
// Soumission du formulaire
if($this->isPost()) {
@ -462,7 +491,18 @@ class config extends common {
'youtubeId' => $this->getInput('socialYoutubeId'),
'youtubeUserId' => $this->getInput('socialYoutubeUserId'),
'githubId' => $this->getInput('socialGithubId'),
'headFacebook' => $this->getInput('socialHeadFacebook', helper::FILTER_BOOLEAN)
'headFacebook' => $this->getInput('socialHeadFacebook', helper::FILTER_BOOLEAN),
'comment' => [
'button' => $this->getInput('socialConfigButton'),
'group' => $this->getInput('socialConfigGroup'),
'user' => $this->getInput('socialConfigUser'),
'mail' => $this->getInput('socialConfigMail'),
'subject' => $this->getInput('socialConfigSubject'),
'captcha' => $this->getInput('socialConfigCaptcha', helper::FILTER_BOOLEAN),
'signature' => $this->getInput('socialConfigSignature'),
'logoUrl' => $this->getInput('socialConfigLogo'),
'logoWidth' => $this->getInput('socialConfigLogoWidth')
]
],
'smtp' => [
'enable' => $this->getInput('smtpEnable',helper::FILTER_BOOLEAN),
@ -570,6 +610,7 @@ class config extends common {
// Met à jour la baseUrl
$this->setData(['core', 'baseUrl', helper::baseUrl(true,false) ]);
}
// Générer robots.txt et sitemap
// $this->generateFiles();
// Valeurs en sortie
@ -578,9 +619,9 @@ class config extends common {
'redirect' => helper::baseUrl() . 'config',
'notification' => $text['core_config']['index'][1] ,
'state' => true
]);
]);
}
// Générer la list des pages disponibles
// Générer la liste des pages disponibles
self::$pagesList = $this->getData(['page']);
foreach(self::$pagesList as $page => $pageId) {
if ($this->getData(['page',$page,'block']) === 'bar' ||
@ -597,9 +638,14 @@ class config extends common {
unset(self::$orphansList[$page]);
}
}
// Valeurs en sortie
$this->addOutput([
'title' => $text['core_config']['index'][0],
'vendor' => [
'html-sortable',
'flatpickr'
],
'view' => 'index'
]);
}
@ -617,6 +663,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// Soumission du formulaire
@ -665,6 +712,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
if ( file_exists(self::DATA_DIR . 'journal.log') ) {
@ -707,6 +755,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
$fileName = self::DATA_DIR . 'journal.log';
@ -745,6 +794,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
ob_start();
@ -796,6 +846,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
if ( file_exists(self::DATA_DIR . 'blacklist.json') ) {
@ -833,6 +884,7 @@ class config extends common {
]);
} else {
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// Créer le répertoire manquant

View File

@ -41,7 +41,7 @@ $text['core_config_view']['index'][1] = 'Help';
$text['core_config_view']['index'][2] = 'Configuration';
$text['core_config_view']['index'][3] = 'Register';
$text['core_config_view']['index'][4] = 'Location';
$text['core_config_view']['index'][5] = 'Referencing';
$text['core_config_view']['index'][5] = 'Social';
$text['core_config_view']['index'][6] = 'Connection';
$text['core_config_view']['index'][7] = 'Network';
$text['core_config_view']['index'][8] = 'Scripts';
@ -181,6 +181,28 @@ $text['core_config_view']['social'][15] = 'Enter your Github ID: https://github.
$text['core_config_view']['social'][16] = 'head Facebook';
$text['core_config_view']['social'][17] = 'Insert in the head of the page the meta properties specific to Facebook';
$text['core_config_view']['social'][18] = 'Youtube channel';
$text['core_config_view']['social'][19] = 'Footer comments';
$text['core_config_view']['social'][20] = 'Configuration';
$text['core_config_view']['social'][21] = 'Leave empty to keep the default text.';
$text['core_config_view']['social'][22] = 'Submit button text';
$text['core_config_view']['social'][23] = 'Send the entered data by email:';
$text['core_config_view']['social'][24] = 'Select at least one group, one user or enter an email. Your server must allow email sending.';
$text['core_config_view']['social'][25] = 'Leave empty to keep the default text.';
$text['core_config_view']['social'][26] = 'Mail subject';
$text['core_config_view']['social'][27] = 'To groups from ';
$text['core_config_view']['social'][28] = 'Editors = editors + administrators<br> Members = members + editors + administrators';
$text['core_config_view']['social'][29] = 'Has one member';
$text['core_config_view']['social'][30] = 'Has an email address';
$text['core_config_view']['social'][31] = 'An email or a mailing list';
$text['core_config_view']['social'][32] = 'Reply to sender from notification email';
$text['core_config_view']['social'][33] = 'This option allows you to respond directly to the sender of the message if they have indicated a valid email.';
$text['core_config_view']['social'][34] = 'Select signature type';
$text['core_config_view']['social'][35] = 'Select the site logo';
$text['core_config_view']['social'][36] = 'Logo';
$text['core_config_view']['social'][37] = 'Select logo width';
$text['core_config_view']['social'][38] = '38';
$text['core_config_view']['social'][39] = '39';
$text['core_config_view']['social'][40] = 'Validate a captcha in order to submit the form';
$text['core_config']['generateFiles'][0] = 'Updated sitemap and robots.txt files';
$text['core_config']['generateFiles'][1] = 'Writing failure, site map not updated';
$text['core_config']['backup'][0] = 'Save';
@ -247,4 +269,26 @@ $captchaTypes = [
'num' => 'Numbers',
'alpha' => 'Letters'
];
if( $param === 'social_view'){
$groupNews = [
self::GROUP_MEMBER => 'Member',
self::GROUP_EDITOR => 'Editor',
self::GROUP_MODERATOR => 'Moderator',
self::GROUP_ADMIN => 'Administrator'
];
$commentTypes = [
$module::TYPE_TEXT => 'Champ texte',
$module::TYPE_TEXTAREA => 'Grand champ texte',
$module::TYPE_MAIL => 'Champ mail'
];
}
// Initialisation de flatpickr
$lang_flatpickr = 'default';
// Langue d'administration pour tinymce
$lang_admin = 'en_GB';
// Selects
$signature = [
'text' => 'Site name',
'logo' => 'Site logo'
];
?>

View File

@ -41,7 +41,7 @@ $text['core_config_view']['index'][1] = 'Ayuda';
$text['core_config_view']['index'][2] = 'Configuración';
$text['core_config_view']['index'][3] = 'Guardar';
$text['core_config_view']['index'][4] = 'Ubicación';
$text['core_config_view']['index'][5] = 'Referencia';
$text['core_config_view']['index'][5] = 'Social';
$text['core_config_view']['index'][6] = 'Conexión';
$text['core_config_view']['index'][7] = 'Red';
$text['core_config_view']['index'][8] = 'Scripts';
@ -181,6 +181,29 @@ $text['core_config_view']['social'][15] = 'Ingrese su ID de Github: https://gith
$text['core_config_view']['social'][16] = 'encabezar Facebook';
$text['core_config_view']['social'][17] = 'Insertar metapropiedades específicas de Facebook en el encabezado de la página';
$text['core_config_view']['social'][18] = 'Canal de Youtube';
$text['core_config_view']['social'][19] = 'Comentarios de pie de página';
$text['core_config_view']['social'][20] = 'Configuración';
$text['core_config_view']['social'][21] = 'Déjelo vacío para mantener el texto predeterminado.';
$text['core_config_view']['social'][22] = 'Enviar texto del botón';
$text['core_config_view']['social'][23] = 'Enviar los datos ingresados por correo electrónico:';
$text['core_config_view']['social'][24] = 'Seleccione al menos un grupo, un usuario o ingrese un correo electrónico. Su servidor debe permitir el envío de correo electrónico.';
$text['core_config_view']['social'][25] = 'Déjelo vacío para mantener el texto predeterminado.';
$text['core_config_view']['social'][26] = 'Asunto del correo';
$text['core_config_view']['social'][27] = 'A grupos de';
$text['core_config_view']['social'][28] = 'Editores = editores + administradores<br> Miembros = miembros + editores + administradores';
$text['core_config_view']['social'][29] = 'Tiene un miembro';
$text['core_config_view']['social'][30] = 'Tiene una dirección de correo electrónico';
$text['core_config_view']['social'][31] = 'Un correo electrónico o una lista de correo';
$text['core_config_view']['social'][32] = 'Responder al remitente desde el correo electrónico de notificación';
$text['core_config_view']['social'][33] = 'Esta opción le permite responder directamente al remitente del mensaje si ha indicado un correo electrónico válido.';
$text['core_config_view']['social'][34] = 'Seleccionar tipo de firma';
$text['core_config_view']['social'][35] = 'Seleccione el logotipo del sitio';
$text['core_config_view']['social'][36] = 'Logotipo';
$text['core_config_view']['social'][37] = 'Seleccionar ancho del logotipo';
$text['core_config_view']['social'][38] = '38';
$text['core_config_view']['social'][39] = '39';
$text['core_config_view']['social'][40] = 'Validar un captcha para enviar el formulario';
$text['core_config']['generateFiles'][0] = 'Mapa del sitio actualizado y archivos robots.txt';
$text['core_config']['generateFiles'][1] = 'No se pudo escribir, el mapa del sitio no se actualizó';
$text['core_config']['backup'][0] = 'Backup';
@ -247,4 +270,26 @@ $captchaTypes = [
'num' => 'Números',
'alpha' => 'Letras'
];
if( $param === 'social_view'){
$groupNews = [
self::GROUP_MEMBER => 'Miembro',
self::GROUP_EDITOR => 'Editor',
self::GROUP_MODERATOR => 'Moderador',
self::GROUP_ADMIN => 'Administrador'
];
$commentTypes = [
$module::TYPE_TEXT => 'Texto campeón',
$module::TYPE_TEXTAREA => 'Texto del gran campeón',
$module::TYPE_MAIL => 'Correo campeón'
];
}
// Initialisation de flatpickr
$lang_flatpickr = 'es';
// Langue d'administration pour tinymce
$lang_admin = 'es';
// Selects
$signature = [
'text' => 'Nombre del sitio',
'logo' => 'logotipo del sitio'
];
?>

View File

@ -41,7 +41,7 @@ $text['core_config_view']['index'][1] = 'Aide';
$text['core_config_view']['index'][2] = 'Configuration';
$text['core_config_view']['index'][3] = 'Enregistrer';
$text['core_config_view']['index'][4] = 'Localisation';
$text['core_config_view']['index'][5] = 'Référencement';
$text['core_config_view']['index'][5] = 'Social';
$text['core_config_view']['index'][6] = 'Connexion';
$text['core_config_view']['index'][7] = 'Réseau';
$text['core_config_view']['index'][8] = 'Scripts';
@ -181,6 +181,29 @@ $text['core_config_view']['social'][15] = 'Saisissez votre ID Github : https://g
$text['core_config_view']['social'][16] = 'head Facebook';
$text['core_config_view']['social'][17] = 'Insère dans le head de la page les propriétés meta propres à Facebook';
$text['core_config_view']['social'][18] = 'Chaîne Youtube';
$text['core_config_view']['social'][19] = 'Commentaires de bas de page';
$text['core_config_view']['social'][20] = 'Configuration';
$text['core_config_view']['social'][21] = 'Laissez vide afin de conserver le texte par défaut.';
$text['core_config_view']['social'][22] = 'Texte du bouton de soumission';
$text['core_config_view']['social'][23] = 'Envoyer par mail les données saisies :';
$text['core_config_view']['social'][24] = 'Sélectionnez au moins un groupe, un utilisateur ou saississez un email. Votre serveur doit autoriser les envois de mail.';
$text['core_config_view']['social'][25] = 'Laissez vide afin de conserver le texte par défaut.';
$text['core_config_view']['social'][26] = 'Sujet du mail';
$text['core_config_view']['social'][27] = 'Aux groupes à partir de ';
$text['core_config_view']['social'][28] = 'Editeurs = éditeurs + administrateurs<br> Membres = membres + éditeurs + administrateurs';
$text['core_config_view']['social'][29] = 'A un membre';
$text['core_config_view']['social'][30] = 'A une adresse email';
$text['core_config_view']['social'][31] = 'Un email ou une liste de diffusion';
$text['core_config_view']['social'][32] = 'Répondre à l\'expéditeur depuis le mail de notification';
$text['core_config_view']['social'][33] = 'Cette option permet de répondre directement à l\'expéditeur du message si celui-ci a indiqué un email valide.';
$text['core_config_view']['social'][34] = 'Sélectionner le type de signature';
$text['core_config_view']['social'][35] = 'Sélectionnez le logo du site';
$text['core_config_view']['social'][36] = 'Logo';
$text['core_config_view']['social'][37] = 'Sélectionner la largeur du logo';
$text['core_config_view']['social'][38] = '38';
$text['core_config_view']['social'][39] = '39';
$text['core_config_view']['social'][40] = 'Valider un captcha afin de soumettre le formulaire';
$text['core_config']['generateFiles'][0] = 'Mises à jour des fichiers sitemap et robots.txt';
$text['core_config']['generateFiles'][1] = 'Echec d\'écriture, le site map n\'a pas été mis à jour';
$text['core_config']['backup'][0] = 'Sauvegarder';
@ -247,4 +270,26 @@ $captchaTypes = [
'num' => 'Chiffres',
'alpha' => 'Lettres'
];
if( $param === 'social_view'){
$groupNews = [
self::GROUP_MEMBER => 'Membre',
self::GROUP_EDITOR => 'Éditeur',
self::GROUP_MODERATOR => 'Modérateur',
self::GROUP_ADMIN => 'Administrateur'
];
$commentTypes = [
$module::TYPE_TEXT => 'Champ texte',
$module::TYPE_TEXTAREA => 'Grand champ texte',
$module::TYPE_MAIL => 'Champ mail'
];
}
// Initialisation de flatpickr
$lang_flatpickr = 'fr';
// Langue d'administration pour tinymce
$lang_admin = 'fr_FR';
// Selects
$signature = [
'text' => 'Nom du site',
'logo' => 'Logo du site'
];
?>

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
echo template::formOpen('configBackupForm'); ?>

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
?>
<div id="scriptContainer">

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
?>
<div id="connectContainer">

View File

@ -297,3 +297,192 @@ $(".configUpdate").on("click", function() {
});
});
/**
* Onglet Social configuration des commentaires de bas de page
*/
/**
* Ajout d'un champ
*/
function add(inputUid, input) {
// Nouveau champ
var newInput = $($("#socialConfigCopy").html());
// Ajout de l'ID unique aux champs
newInput.find("a, input, select").each(function() {
var _this = $(this);
_this.attr({
id: _this.attr("id").replace("[]", "[" + inputUid + "]"),
name: _this.attr("name").replace("[]", "[" + inputUid + "]")
});
});
newInput.find("label").each(function() {
var _this = $(this);
_this.attr("for", _this.attr("for").replace("[]", "[" + inputUid + "]"));
});
// Attribue les bonnes valeurs
if(input) {
// Nom du champ
newInput.find("[name='socialConfigName[" + inputUid + "]']").val(input.name);
// Type de champ
newInput.find("[name='socialConfigType[" + inputUid + "]']").val(input.type);
// Largeur du champ
newInput.find("[name='socialConfigWidth[" + inputUid + "]']").val(input.width);
// Valeurs du champ
newInput.find("[name='socialConfigValues[" + inputUid + "]']").val(input.values);
// Champ obligatoire
newInput.find("[name='socialConfigRequired[" + inputUid + "]']").prop("checked", input.required);
}
// Ajout du nouveau champ au DOM
$("#socialConfigInputs")
.append(newInput.hide())
.find(".socialConfigInput").last().show();
// Cache le texte d'absence de champ
$("#socialConfigNoInput:visible").hide();
// Check le type
$(".socialConfigType").trigger("change");
// Actualise les positions
position();
}
/**
* Calcul des positions
*/
function position() {
$("#socialConfigInputs").find(".socialConfigPosition").each(function(i) {
$(this).val(i + 1);
});
}
/**
* Ajout des champs déjà existant
*/
var inputUid = 0;
var inputs = <?php echo json_encode($this->getData(['config', 'social', 'comment', 'input'])); ?>;
if(inputs) {
var inputsPerPosition = <?php echo json_encode(helper::arrayCollumn($this->getData(['config', 'social', 'comment', 'input']), 'position', 'SORT_ASC')); ?>;
$.each(inputsPerPosition, function(id) {
add(inputUid, inputs[id]);
inputUid++;
});
}
/**
* Afficher/cacher les options supplémentaires
*/
$(document).on("click", ".socialConfigMoreToggle", function() {
$(this).parents(".socialConfigInput").find(".socialConfigMore").slideToggle();
$(this).parents(".socialConfigInput").find(".socialConfigMoreLabel").slideToggle();
});
/**
* Crée un nouveau champ à partir des champs cachés
*/
$("#socialConfigAdd").on("click", function() {
add(inputUid);
inputUid++;
});
/**
* Actions sur les champs
*/
// Tri entre les champs
sortable("#socialConfigInputs", {
forcePlaceholderSize: true,
containment: "#socialConfigInputs",
handle: ".socialConfigMove"
});
$("#socialConfigInputs")
// Actualise les positions
.on("sortupdate", function() {
position();
})
// Suppression du champ
.on("click", ".socialConfigDelete", function() {
var inputDOM = $(this).parents(".socialConfigInput");
// Cache le champ
inputDOM.hide();
// Supprime le champ
inputDOM.remove();
// Affiche le texte d'absence de champ
if($("#socialConfigInputs").find(".socialConfigInput").length === 0) {
$("#socialConfigNoInput").show();
}
// Actualise les positions
position();
});
// Simule un changement de type au chargement de la page
$(".socialConfigType").trigger("change");
/**
* Affiche/cache les options de la case à cocher du mail
*/
$("#socialConfigMailOptionsToggle").on("change", function() {
if($(this).is(":checked")) {
$("#socialConfigMailOptions").slideDown();
}
else {
$("#socialConfigMailOptions").slideUp(function() {
$("#socialConfigGroup").val("");
$("#socialConfigSubject").val("");
$("#socialConfigMail").val("");
$("#socialConfigUser").val("");
});
}
}).trigger("change");
/**
* Affiche/cache les options de la case à cocher de la redirection
*/
$("#socialConfigPageIdToggle").on("change", function() {
if($(this).is(":checked")) {
$("#socialConfigPageIdWrapper").slideDown();
}
else {
$("#socialConfigPageIdWrapper").slideUp(function() {
$("#socialConfigPageId").val("");
});
}
}).trigger("change");
/**
* Paramètres par défaut au chargement
*/
$( document ).ready(function() {
/**
* Masquer ou afficher la sélection du logo
*/
if ($("#socialConfigSignature").val() !== "text") {
$("#socialConfigLogoWrapper").addClass("disabled");
$("#socialConfigLogoWrapper").slideDown();
$("#socialConfigLogoWidthWrapper").addClass("disabled");
$("#socialConfigLogoWidthWrapper").slideDown();
} else {
$("#socialConfigLogoWrapper").removeClass("disabled");
$("#socialConfigLogoWrapper").slideUp();
$("#socialConfigLogoWidthWrapper").removeClass("disabled");
$("#socialConfigLogoWidthWrapper").slideUp();
}
});
/**
* Masquer ou afficher la sélection du logo
*/
var socialConfigSignatureDOM = $("#socialConfigSignature");
socialConfigSignatureDOM.on("change", function() {
if ($(this).val() !== "text") {
$("#socialConfigLogoWrapper").addClass("disabled");
$("#socialConfigLogoWrapper").slideDown();
$("#socialConfigLogoWidthWrapper").addClass("disabled");
$("#socialConfigLogoWidthWrapper").slideDown();
} else {
$("#socialConfigLogoWrapper").removeClass("disabled");
$("#socialConfigLogoWrapper").slideUp();
$("#socialConfigLogoWidthWrapper").removeClass("disabled");
$("#socialConfigLogoWidthWrapper").slideUp();
}
});

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
echo template::formOpen('configForm');?>

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
// drapeau pour la langue d'origine ou la langue en traduction rédigée

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
?>
<div id="networkContainer">

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
echo template::formOpen('configRestoreForm'); ?>

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
echo template::formOpen('configScript'); ?>

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param='';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
?>
<div id="setupContainer">

View File

@ -1,5 +1,6 @@
<?php
// Lexique
$param = 'social_view';
include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_config.php');
?>
<div id="socialContainer">
@ -62,6 +63,93 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<div class="blockTitle"><?php echo $text['core_config_view']['social'][19]; ?></div>
<?php echo template::text('socialConfigButton', [
'help' =>$text['core_config_view']['social'][21],
'label' => $text['core_config_view']['social'][22],
'value' => $this->getData(['config', 'social', 'comment', 'button'])
]); ?>
<div>
<?php echo template::checkbox('socialConfigMailOptionsToggle', true, $text['core_config_view']['social'][23], [
'checked' => (bool) $this->getData(['config', 'social', 'comment', 'group']) ||
!empty($this->getData(['config', 'social', 'comment', 'user'])) ||
!empty($this->getData(['config', 'social', 'comment', 'mail'])),
'help' => $text['core_config_view']['social'][24]
]); ?>
<div id="socialConfigMailOptions" class="displayNone">
<div class="row">
<div class="col11 offset1">
<?php echo template::text('socialConfigSubject', [
'help' => $text['core_config_view']['social'][25],
'label' => $text['core_config_view']['social'][26],
'value' => $this->getData(['config', 'social', 'comment', 'subject'])
]); ?>
</div>
</div>
<?php
// Element 0 quand aucun membre a été sélectionné
$groupMembers = [''] + $groupNews;
?>
<div class="row">
<div class="col3 offset1">
<?php echo template::select('socialConfigGroup', $groupMembers, [
'label' => $text['core_config_view']['social'][27],
'selected' => $this->getData(['config', 'social', 'comment', 'group']),
'help' => $text['core_config_view']['social'][28]
]); ?>
</div>
<div class="col3">
<?php echo template::select('socialConfigUser', config::$listUsers, [
'label' => $text['core_config_view']['social'][29],
'selected' => $this->getData(['config', 'social', 'comment', 'user'])
]); ?>
</div>
<div class="col4">
<?php echo template::text('socialConfigMail', [
'label' => $text['core_config_view']['social'][30],
'value' => $this->getData(['config', 'social', 'comment', 'mail']),
'help' => $text['core_config_view']['social'][31]
]); ?>
</div>
</div>
</div>
</div>
<div class="row" >
<div class="col4">
<?php echo template::select('socialConfigSignature', $signature, [
'label' => $text['core_config_view']['social'][34],
'selected' => $this->getData(['config', 'social', 'comment', 'signature'])
]); ?>
</div>
<div class="col4">
<?php echo template::file('socialConfigLogo', [
'help' => $text['core_config_view']['social'][35],
'label' => $text['core_config_view']['social'][36],
'value' => $this->getData(['config', 'social', 'comment', 'logoUrl'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('socialConfigLogoWidth', config::$logoWidth, [
'label' => $text['core_config_view']['social'][37],
'selected' => $this->getData(['config', 'social', 'comment', 'logoWidth'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('socialConfigCaptcha', true, $text['core_config_view']['social'][40], [
'checked' => $this->getData(['config', 'social', 'comment', 'captcha'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">

View File

@ -0,0 +1,3 @@
{
"comment": []
}

View File

@ -0,0 +1,3 @@
{
"comment": []
}

View File

@ -0,0 +1,3 @@
{
"comment": []
}

View File

@ -0,0 +1,3 @@
{
"comment": []
}

View File

@ -0,0 +1,3 @@
{
"comment": []
}

View File

@ -69,7 +69,7 @@ class init extends common {
]
],
'core' => [
'dataVersion' => 4504,
'dataVersion' => 4505,
'lastBackup' => 0,
'lastClearTmp' => 0,
'lastAutoUpdate' => 0,
@ -138,6 +138,7 @@ class init extends common {
]
],
'module' => [],
'comment' => [],
'fonts'=> [
'liberation-sans'=> [
'name'=> 'Liberation Sans',

View File

@ -46,6 +46,11 @@ $text['core_page_view']['edit'][42] = "The data in the module ";
$text['core_page_view']['edit'][43] = " will be deleted. Do you confirm?";
$text['core_page_view']['edit'][44] = "Group required to edit the page :";
$text['core_page_view']['edit'][45] = "You do not have editing rights, contact an administrator.";
$text['core_page_view']['edit'][46] = 'Allows visitors to leave a comment on the page. The configuration is common to all pages, the management specific to each page.';
$text['core_page_view']['edit'][47] = 'Comments';
$text['core_page_view']['edit'][48] = 'Configure';
$text['core_page_view']['edit'][49] = 'Manage comments';
$text['core_page_view']['edit'][50] = 'Allow comments';
$text['core_page']['duplicate'][0] = "Invalid token";
$text['core_page']['duplicate'][1] = "Unauthorised duplication";
$text['core_page']['duplicate'][2] = "The page has been duplicated";
@ -60,6 +65,20 @@ $text['core_page']['delete'][3] = "Cannot delete a page containing children";
$text['core_page']['delete'][4] = "Deleted page";
$text['core_page']['edit'][0] = "Changes saved";
$text['core_page']['edit'][1] = "None";
$text['core_page_view']['comment'][1] = 'Return';
$text['core_page_view']['comment'][2] = 'Data';
$text['core_page_view']['comment'][3] = 'Export CSV';
$text['core_page_view']['comment'][4] = 'Clear all';
$text['core_page_view']['comment'][5] = 'No data';
$text['core_page_view']['comment'][6] = 'Are you sure you want to delete this data?';
$text['core_page_view']['comment'][7] = 'Are you sure you want to delete all data?';
$text['core_page']['commentDelete'][1] = 'Data deleted';
$text['core_page']['commentDelete'][2] = 'Unauthorized access';
$text['core_page']['exportToCsv'][1] = 'Data exported to file ';
$text['core_page']['exportToCsv'][2] = 'No data to export';
$text['core_page']['commentAllDelete'][1] = 'Unauthorized access';
$text['core_page']['commentAllDelete'][2] = 'Data deleted';
$text['core_page']['commentAllDelete'][3] = 'No data to delete';
// Tinymce et Flatpickr
$lang_admin = 'en_GB';

View File

@ -46,6 +46,11 @@ $text['core_page_view']['edit'][42] = "Datos del módulo";
$text['core_page_view']['edit'][43] = "será eliminado. ¿Confirmas?";
$text['core_page_view']['edit'][44] = "Se requiere grupo para editar la página:";
$text['core_page_view']['edit'][45] = "No tiene derechos de edición, póngase en contacto con un administrador.";
$text['core_page_view']['edit'][46] = 'Permite a los visitantes dejar un comentario en la página. La configuración es común a todas las páginas, la gestión específica de cada página.';
$text['core_page_view']['edit'][47] = 'Comentarios';
$text['core_page_view']['edit'][48] = 'Configurar';
$text['core_page_view']['edit'][49] = 'Administrar comentarios';
$text['core_page_view']['edit'][50] = 'Permitir comentarios';
$text['core_page']['duplicate'][0] = "Token no válido";
$text['core_page']['duplicate'][1] = "Duplicación no autorizada";
$text['core_page']['duplicate'][2] = "La página ha sido duplicada";
@ -60,7 +65,20 @@ $text['core_page']['delete'][3] = "No se puede eliminar una página que contiene
$text['core_page']['delete'][4] = "Página eliminada";
$text['core_page']['edit'][0] = "Cambios guardados";
$text['core_page']['edit'][1] = "Ninguno";
$text['core_page_view']['comment'][1] = 'Volver';
$text['core_page_view']['comment'][2] = 'Datos';
$text['core_page_view']['comment'][3] = 'Exportar CSV';
$text['core_page_view']['comment'][4] = 'Borrar todo';
$text['core_page_view']['comment'][5] = 'Sin datos';
$text['core_page_view']['comment'][6] = '¿Está seguro de que desea eliminar estos datos?';
$text['core_page_view']['comment'][7] = '¿Está seguro de que desea eliminar todos los datos?';
$text['core_page']['commentDelete'][1] = 'Datos eliminados';
$text['core_page']['commentDelete'][2] = 'Acceso no autorizado';
$text['core_page']['exportToCsv'][1] = 'Datos exportados al archivo';
$text['core_page']['exportToCsv'][2] = 'No hay datos para exportar';
$text['core_page']['commentAllDelete'][1] = 'Acceso no autorizado';
$text['core_page']['commentAllDelete'][2] = 'Datos eliminados';
$text['core_page']['commentAllDelete'][3] = 'No hay datos para eliminar';
// Tinymce et Flatpickr
$lang_admin = 'es';

View File

@ -46,6 +46,11 @@ $text['core_page_view']['edit'][42] = "Les données du module ";
$text['core_page_view']['edit'][43] = " seront effacées. Confirmez-vous ?";
$text['core_page_view']['edit'][44] = "Groupe requis pour modifier la page :";
$text['core_page_view']['edit'][45] = "Vous n'avez pas les droits d'édition, contactez un administrateur.";
$text['core_page_view']['edit'][46] = 'Permet aux visiteurs de laisser un commentaire sur la page. La configuration est commune à toutes les pages, la gestion propre à chaque page.';
$text['core_page_view']['edit'][47] = 'Commentaires';
$text['core_page_view']['edit'][48] = 'Configurer';
$text['core_page_view']['edit'][49] = 'Gérer les commentaires';
$text['core_page_view']['edit'][50] = 'Autoriser les commentaires';
$text['core_page']['duplicate'][0] = "Jeton invalide";
$text['core_page']['duplicate'][1] = "Duplication non autorisée";
$text['core_page']['duplicate'][2] = "La page a été dupliquée";
@ -60,7 +65,20 @@ $text['core_page']['delete'][3] = "Impossible de supprimer une page contenant de
$text['core_page']['delete'][4] = "Page supprimée";
$text['core_page']['edit'][0] = "Modifications enregistrées";
$text['core_page']['edit'][1] = "Aucun";
$text['core_page_view']['comment'][1] = 'Retour';
$text['core_page_view']['comment'][2] = 'Données';
$text['core_page_view']['comment'][3] = 'Export CSV';
$text['core_page_view']['comment'][4] = 'Tout effacer';
$text['core_page_view']['comment'][5] = 'Pas de données';
$text['core_page_view']['comment'][6] = 'Êtes-vous sûr de vouloir supprimer cette donnée ?';
$text['core_page_view']['comment'][7] = 'Êtes-vous sûr de vouloir supprimer toutes les données ?';
$text['core_page']['commentDelete'][1] = 'Donnée supprimée';
$text['core_page']['commentDelete'][2] = 'Accès non autorisé';
$text['core_page']['exportToCsv'][1] = 'Données exportées dans le fichier ';
$text['core_page']['exportToCsv'][2] = 'Pas de données à exporter';
$text['core_page']['commentAllDelete'][1] = 'Accès non autorisé';
$text['core_page']['commentAllDelete'][2] = 'Données effacées';
$text['core_page']['commentAllDelete'][3] = 'Aucune donnée à effacer';
// Tinymce et Flatpickr
$lang_admin = 'fr_FR';

View File

@ -24,12 +24,18 @@ class page extends common {
'add' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_EDITOR,
'duplicate' => self::GROUP_MODERATOR
'duplicate' => self::GROUP_MODERATOR,
'comment' => self::GROUP_MODERATOR,
'commentDelete' => self::GROUP_MODERATOR,
'commentAllDelete' => self::GROUP_MODERATOR,
'commentExport2csv' => self::GROUP_MODERATOR
];
public static $moduleIds = [];
public static $pagesBarId = [];
public static $pagesNoParentId = [];
public static $data = [];
public static $pages = [];
/**
* Duplication
@ -307,6 +313,200 @@ class page extends common {
}
}
/**
* Gestion des commentaires
*/
public function comment() {
// Autorisation
$group = $this->getUser('group');
if ($group === false ) $group = 0;
if( $group < page::$actions['comment'] ) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
// Préparation des commentaires avec pagination
$data = $this->getData(['comment', $this->getUrl(2), 'data']);
if($data) {
// Pagination
$pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE);
// Liste des pages
self::$pages = $pagination['pages'];
// Inverse l'ordre du tableau
$dataIds = array_reverse(array_keys($data));
$data = array_reverse($data);
// Données en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
$content = '';
foreach($data[$i] as $input => $value) {
$value = str_replace('Д','',$value);
$content .= $input . ' : ' . $value . '<br>';
}
self::$data[] = [
$content,
template::button('formDataDelete' . $dataIds[$i], [
'class' => 'formDataDelete buttonRed',
'href' => helper::baseUrl() . 'page/commentDelete/' . $this->getUrl(2) .'/'. $dataIds[$i] . '/' . $_SESSION['csrf'],
'value' => template::ico('cancel')
])
];
}
}
$this->addOutput([
'title' => $this->getData(['page', $this->getUrl(2), 'title']),
'view' => 'comment'
]);
}
}
/**
* commentDelete
*/
public function commentDelete() {
// Autorisation
$group = $this->getUser('group');
if ($group === false ) $group = 0;
if( $group < page::$actions['commentDelete'] ) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
// Lexique
include('./core/module/page/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_page.php');
// Jeton incorrect
if ($this->getUrl(4) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $this->getUrl(2),
'notification' => $text['core_page']['commentDelete'][2]
]);
} else {
// La donnée n'existe pas
if( $this->getData(['comment', $this->getUrl(2), 'data', $this->getUrl(3)]) === null) {
// Valeurs en sortie
$this->addOutput([
'access' => false,
'redirect' => helper::baseUrl() . 'page/comment/' . $this->getUrl(2)
]);
}
// Suppression
else {
$this->deleteData(['comment', $this->getUrl(2), 'data', $this->getUrl(3)]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/comment/' . $this->getUrl(2),
'notification' => $text['core_page']['commentDelete'][1],
'state' => true
]);
}
}
}
}
/**
* commentAllDelete
*/
public function commentAllDelete() {
// Autorisation
$group = $this->getUser('group');
if ($group === false ) $group = 0;
if( $group < page::$actions['commentAllDelete'] ) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
include('./core/module/page/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_page.php');
// Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $this->getUrl(2),
'notification' => $text['core_page']['commentAllDelete'][1]
]);
} else {
$data = $this->getData(['comment', $this->getUrl(2), 'data']);
if (count($data) > 0 ) {
// Suppression multiple
foreach( $data as $key=>$value ){
$this->deleteData(['comment', $this->getUrl(2), 'data', $key]);
}
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/comment/'. $this->getUrl(2),
'notification' => $text['core_page']['commentAllDelete'][2],
'state' => true
]);
} else {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/comment/'. $this->getUrl(2),
'notification' => $text['core_page']['commentAllDelete'][3]
]);
}
}
}
}
/**
* commentExport2csv
*/
public function commentExport2csv() {
// Autorisation
$group = $this->getUser('group');
if ($group === false ) $group = 0;
if( $group < page::$actions['commentExport2csv'] ) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
// Lexique
include('./core/module/page/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_page.php');
// Jeton incorrect
if ($this->getUrl(3) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/'. $this->getUrl(2),
'notification' => '0'
]);
} else {
$data = $this->getData(['comment', $this->getUrl(2), 'data']);
foreach( $data as $key=>$value){
$data[$key] = str_replace('Д ','',$value);
}
if ($data !== []) {
$csvfilename = 'data-'.date('dmY').'-'.date('hm').'-'.rand(10,99).'.csv';
if (!file_exists(self::FILE_DIR.'source/data')) {
mkdir(self::FILE_DIR.'source/data', 0755);
}
$fp = fopen(self::FILE_DIR.'source/data/'.$csvfilename, 'w');
fputcsv($fp, array_keys($data[1]), ';','"');
foreach ($data as $fields) {
fputcsv($fp, $fields, ';','"');
}
fclose($fp);
// Valeurs en sortie
$this->addOutput([
'notification' => $text['core_page']['exportToCsv'][1].$csvfilename,
'redirect' => helper::baseUrl() . 'page/comment/'. $this->getUrl(2),
'state' => true
]);
} else {
$this->addOutput([
'notification' => $text['core_page']['exportToCsv'][2],
'redirect' => helper::baseUrl() . 'page/edit/'. $this->getUrl(2)
]);
}
}
}
}
/**
* Édition
@ -462,6 +662,7 @@ class page extends common {
'hideMenuSide' => $this->getinput('pageEditHideMenuSide', helper::FILTER_BOOLEAN),
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
'commentEnable' => $this->getinput('pageEditCommentEnable', helper::FILTER_BOOLEAN)
]
]);
// Creation du contenu de la page

View File

@ -0,0 +1,7 @@
/**
* This file is part of DeltaCMS.
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,23 @@
/**
* This file is part of DeltaCMS.
*/
/**
* Confirmation de suppression
*/
$(".formDataDelete").on("click", function() {
var _this = $(this);
return core.confirm(textConfirm, function() {
$(location).attr("href", _this.attr("href"));
});
});
/**
* Confirmation de suppression de toutes les donénes
*/
$(".formDataDeleteAll").on("click", function() {
var _this = $(this);
return core.confirm(textConfirm2, function() {
$(location).attr("href", _this.attr("href"));
});
});

View File

@ -0,0 +1,45 @@
<?php
// Lexique
include('./core/module/page/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_page.php');
?>
<div class="row">
<div class="col2">
<?php echo template::button('pageEditCommentBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(2),
'ico' => 'left',
'value' => $text['core_page_view']['comment'][1]
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('formDataDeleteAll', [
'class' => 'formDataDeleteAll buttonRed',
'href' => helper::baseUrl() . 'page/commentAllDelete/' . $this->getUrl(2) . '/' . $_SESSION['csrf'],
'ico' => 'cancel',
'value' => $text['core_page_view']['comment'][4]
]); ?>
</div>
<div class="col2">
<?php echo template::button('formDataBack', [
'href' => helper::baseUrl() . 'page/commentExport2csv/' . $this->getUrl(2) . '/'. $_SESSION['csrf'],
'ico' => 'download',
'value' => $text['core_page_view']['comment'][3]
]); ?>
</div>
</div>
<?php if($module::$data): ?>
<?php echo template::table([11,1], $module::$data,[ $text['core_page_view']['comment'][2], '']); ?>
<?php echo $module::$pages; ?>
<?php else: ?>
<?php echo template::speech($text['core_page_view']['comment'][5]); ?>
<?php endif; ?>
<script>
var textConfirm = <?php echo '"'.$text['core_page_view']['comment'][6].'"'; ?>;
var textConfirm2 = <?php echo '"'.$text['core_page_view']['comment'][7].'"'; ?>;
</script>

View File

@ -17,6 +17,15 @@ $("#pageEditModuleId").on("click", function() {
protectModule();
});
// Masquage des boutons des commentaires
$("#pageEditCommentEnable").on("change", function() {
if ($(this).is(':checked') ) {
$(".pageCommentEnable").slideDown();
} else {
$(".pageCommentEnable").slideUp();
}
}).trigger("change");
function protectModule() {
var oldModule = $("#pageEditModuleIdOld").val();
var oldModuleText = $("#pageEditModuleIdOldText").val();
@ -599,3 +608,11 @@ $("#pageEditParentPageId").on("change", function() {
// Sélectionne la bonne position
positionDOM.val(positionSelected);
}).trigger("change");
/*
* Bouton de configuration des commentaires de page
*/
$("#pageEditCommentConfig").on("click", function() {
document.cookie = "configLayout" + "=" + ("social" || "") + "" + "; path=/; samesite=lax";
console.log( 'cookie écrit');
});

View File

@ -147,6 +147,43 @@ else {
echo '<div style="display: block;">';
}
?>
<div class="row">
<div class="col12" >
<div class="block">
<div class="blockTitle"><?php echo $text['core_page_view']['edit'][47]; ?>
<span id="specialeHelpButton" class="helpDisplayButton">
<a href="https://doc.deltacms.fr/commentaires-de-page" target="_blank">
<?php echo template::ico('help', 'left');?>
</a>
</span>
</div>
<div class="blockContainer">
<div class="row">
<div class="col4">
<?php echo template::checkbox('pageEditCommentEnable', true, $text['core_page_view']['edit'][50], [
'checked' => $this->getData(['page', $this->getUrl(2), 'commentEnable']),
'help' => $text['core_page_view']['edit'][46]
]); ?>
</div>
<div class="col4 pageCommentEnable">
<?php echo template::button('pageEditCommentConfig', [
'href' => helper::baseUrl() . 'config',
'ico' => 'gear',
'value' => $text['core_page_view']['edit'][48]
]); ?>
</div>
<div class="col4 pageCommentEnable">
<?php echo template::button('pageEditCommentManage', [
'href' => helper::baseUrl() . 'page/comment/' . $this->getUrl(2),
'ico' => 'gear',
'value' => $text['core_page_view']['edit'][49]
]); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12" id="pageEditBlockLayout">
<div class="block">

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
[
"html-sortable.min.js"
]

View File

@ -0,0 +1 @@
https://github.com/lukasoppermann/html5sortable