From 77c13948fd824ff729460b9cabba0c4ffb6bf653 Mon Sep 17 00:00:00 2001 From: Deltacms Date: Wed, 7 Feb 2024 12:08:25 +0100 Subject: [PATCH] commentaires de page simplification de la configuration --- core/core.php | 3 -- core/include/comment.inc.php | 24 +++++-------- core/module/config/config.php | 15 ++++---- core/module/config/lang/en/lex_config.php | 10 ++---- core/module/config/lang/es/lex_config.php | 10 ++---- core/module/config/lang/fr/lex_config.php | 10 ++---- core/module/config/view/social/social.php | 36 ++++--------------- core/module/install/ressource/defaultdata.php | 10 +++++- core/module/page/page.php | 2 +- 9 files changed, 38 insertions(+), 82 deletions(-) diff --git a/core/core.php b/core/core.php index 8296d27..c8f49ba 100644 --- a/core/core.php +++ b/core/core.php @@ -55,9 +55,6 @@ class common { 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 = [ 'config', diff --git a/core/include/comment.inc.php b/core/include/comment.inc.php index 307b19f..35b505b 100644 --- a/core/include/comment.inc.php +++ b/core/include/comment.inc.php @@ -99,14 +99,12 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) { // Rechercher l'adresse en fonction du mail $singleuser = ''; if( $this->getData(['config', 'social', 'comment', 'user']) !== '' ) $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 !== '' ) + $singleuser !== '') ) { // Utilisateurs dans le groupe $to = []; @@ -121,10 +119,6 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) { 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']); @@ -173,12 +167,13 @@ $pagesComment = ''; if ( !isset($_SESSION[$commentNumPage] )) $_SESSION[$commentNumPage] = 1; $dataPage = $this->getData(['comment', $this->getUrl(0), 'data']); if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) { - $nbPage = ceil(count( $dataPage) / self::ITEMSPAGE); + $nbItemPage = $this->getData(['config', 'social', 'comment', 'nbItemPage']); + $nbPage = ceil(count( $dataPage) / $nbItemPage); 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); + $pagination = helper::pagination($dataPage, $paramPage, $nbItemPage); // Liste des pages $pagesComment = $pagination['pages']; // Inverse l'ordre du tableau @@ -295,8 +290,8 @@ echo template::formOpenFile('commentPageFormForm', $action); '; -if($data): +if( $data ){ + echo '
'; foreach( $data as $key1=>$value1){ if( is_array($value1)){ foreach( $value1 as $key2=>$value2){ @@ -304,10 +299,9 @@ if($data): } } } - else: - echo template::speech('
'.$text['core']['showComment'][6].'
' ); - endif; -echo '
'; + echo ''; +} + if($pagesComment && $nbPage > 1){ ?> '40%', - '60' => '60%', - '80' => '80%', - '100' => '100%' + public static $nbItemPage = [ + '1' => '1', + '3' => '3', + '5' => '5', + '10' => '10' ]; /** @@ -496,12 +496,9 @@ class config extends common { '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') + 'nbItemPage' => $this->getInput('socialConfigNbItemPage') ] ], 'smtp' => [ diff --git a/core/module/config/lang/en/lex_config.php b/core/module/config/lang/en/lex_config.php index ac3d43a..f49dfed 100644 --- a/core/module/config/lang/en/lex_config.php +++ b/core/module/config/lang/en/lex_config.php @@ -186,22 +186,16 @@ $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'][24] = 'Select at least one group or one user. 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
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'][37] = 'Number of comments displayed on a page'; $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'; diff --git a/core/module/config/lang/es/lex_config.php b/core/module/config/lang/es/lex_config.php index 6ce054e..9848e9a 100644 --- a/core/module/config/lang/es/lex_config.php +++ b/core/module/config/lang/es/lex_config.php @@ -186,22 +186,16 @@ $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'][24] = 'Seleccione al menos un grupo o un usuario. 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
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'][37] = 'Número de comentarios mostrados en una página'; $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'; diff --git a/core/module/config/lang/fr/lex_config.php b/core/module/config/lang/fr/lex_config.php index e9c012d..e5ecd7f 100644 --- a/core/module/config/lang/fr/lex_config.php +++ b/core/module/config/lang/fr/lex_config.php @@ -186,22 +186,16 @@ $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'][24] = 'Sélectionnez au moins un groupe ou un utilisateur. 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
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'][37] = 'Nombre de commentaires affichés sur une page'; $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'; diff --git a/core/module/config/view/social/social.php b/core/module/config/view/social/social.php index b48093a..823849f 100644 --- a/core/module/config/view/social/social.php +++ b/core/module/config/view/social/social.php @@ -108,43 +108,21 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm 'selected' => $this->getData(['config', 'social', 'comment', 'user']) ]); ?> -
- $text['core_config_view']['social'][30], - 'value' => $this->getData(['config', 'social', 'comment', 'mail']), - 'help' => $text['core_config_view']['social'][31] - ]); ?> -
-
-
- $text['core_config_view']['social'][34], - 'selected' => $this->getData(['config', 'social', 'comment', 'signature']) - ]); ?> -
-
- $text['core_config_view']['social'][35], - 'label' => $text['core_config_view']['social'][36], - 'value' => $this->getData(['config', 'social', 'comment', 'logoUrl']) - ]); ?> -
-
- $text['core_config_view']['social'][37], - 'selected' => $this->getData(['config', 'social', 'comment', 'logoWidth']) - ]); ?> -
-
-
+
$this->getData(['config', 'social', 'comment', 'captcha']) ]); ?>
+
+ $text['core_config_view']['social'][37], + 'selected' => $this->getData(['config', 'social', 'comment', 'nbItemPage']) + ]); ?> +
diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 39202e4..731fe36 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -17,7 +17,15 @@ class init extends common { 'twitterId' => '', 'youtubeId' => '', 'youtubeUserId' => '', - 'githubId' => '' + 'githubId' => '', + 'comment' => [ + 'button' => '', + 'group' => '', + 'user' => '', + 'subject' => '', + 'captcha' => true, + 'nbItemPage' => '3' + ] ], 'timezone' => 'Europe/Paris', 'proxyUrl' => '', diff --git a/core/module/page/page.php b/core/module/page/page.php index 64cccc6..93d5d3d 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -330,7 +330,7 @@ class page extends common { $data = $this->getData(['comment', $this->getUrl(2), 'data']); if($data) { // Pagination - $pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE); + $pagination = helper::pagination($data, $this->getUrl(), $this->getData(['config', 'social', 'comment', 'nbItemPage' ])); // Liste des pages self::$pages = $pagination['pages']; // Inverse l'ordre du tableau