diff --git a/core/include/comment.inc.php b/core/include/comment.inc.php index 29a215e..e5165cb 100644 --- a/core/include/comment.inc.php +++ b/core/include/comment.inc.php @@ -7,6 +7,23 @@ // Lexique include('./core/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_core.php'); +// Pour les dates suivant la langue de rédaction du site (langue principale ou langue de traduction rédigée) +if( function_exists('datefmt_create') && function_exists('datefmt_format') && extension_loaded('intl') ){ + if( isset( $_SESSION['langFrontEnd']) && isset( $_SESSION['translationType']) && $_SESSION['translationType'] === 'site' ){ + $lang_date = $_SESSION['langFrontEnd']; + } else { + $lang_date = $this->getData(['config', 'i18n', 'langBase']); + } + $zone = 'Europe/Paris'; + $fmt = datefmt_create( + $lang_date, + IntlDateFormatter::LONG, + IntlDateFormatter::SHORT, + $zone, + IntlDateFormatter::GREGORIAN + ); +} + // Création du brouillon s'il n'existe pas if( !isset($_SESSION['draftPage'])){ $_SESSION['draftPage'] = []; @@ -81,12 +98,16 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) { // 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); + // Enregistrement de la date formatée + if( function_exists('datefmt_create') && function_exists('datefmt_format') && extension_loaded('intl') ){ + $dateMessage = datefmt_format($fmt, strtotime( date('Y/m/d H:i:s',$id))); } else { - $dateMessage = date('d/m/Y H:i', $id); - } + if( mb_detect_encoding(date('d/m/Y - H:i', $id), 'UTF-8', true)){ + $dateMessage = date('d/m/Y - H:i', $id); + } else { + $dateMessage = utf8_encode(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'); @@ -182,7 +203,7 @@ if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) { for($i = $pagination['first']; $i < $pagination['last']; $i++) { $content = ''; $dataKeys = array_keys($dataPage[$i]); - $content .= '
'. $dataPage[$i][$dataKeys[0]] . ''. $text['core']['showComment'][12] .' ' . $dataPage[$i][$dataKeys[2]] .'
'; + $content .= '
'. $dataPage[$i][$dataKeys[0]] . $text['core']['showComment'][12] . $dataPage[$i][$dataKeys[2]] .'
'; $content .= '
' . $dataPage[$i][$dataKeys[1]] . '

'; $data[] = [$content]; } diff --git a/core/lang/en/lex_core.php b/core/lang/en/lex_core.php index 04c0cf7..17c0540 100644 --- a/core/lang/en/lex_core.php +++ b/core/lang/en/lex_core.php @@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Send'; $text['core']['showComment'][9] = 'Name or nickname'; $text['core']['showComment'][10] = 'Comment'; $text['core']['showComment'][11] = 'Page '; -$text['core']['showComment'][12] = ' posted this comment on '; +$text['core']['showComment'][12] = ' on '; // core.js.php $text['core_js'][0] = "Updating ?"; // Select File diff --git a/core/lang/es/lex_core.php b/core/lang/es/lex_core.php index e3421dd..9fa605e 100644 --- a/core/lang/es/lex_core.php +++ b/core/lang/es/lex_core.php @@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Enviar'; $text['core']['showComment'][9] = 'Nombre o apodo'; $text['core']['showComment'][10] = 'Comentario'; $text['core']['showComment'][11] = 'Página '; -$text['core']['showComment'][12] = ' publicó este comentario en '; +$text['core']['showComment'][12] = ' en '; // core.js.php $text['core_js'][0] = "¿Realizar actualización?"; // Seleccione Archivo diff --git a/core/lang/fr/lex_core.php b/core/lang/fr/lex_core.php index b78b6df..7ae89a7 100644 --- a/core/lang/fr/lex_core.php +++ b/core/lang/fr/lex_core.php @@ -42,7 +42,7 @@ $text['core']['showComment'][8] = 'Envoyer'; $text['core']['showComment'][9] = 'Nom ou pseudo'; $text['core']['showComment'][10] = 'Commentaire'; $text['core']['showComment'][11] = 'Page '; -$text['core']['showComment'][12] = ' a posté ce commentaire le '; +$text['core']['showComment'][12] = ' le '; // core.js.php $text['core_js'][0] = "Effectuer la mise à jour ?"; diff --git a/core/layout/pageComment.css b/core/layout/pageComment.css index d67987a..ee69680 100644 --- a/core/layout/pageComment.css +++ b/core/layout/pageComment.css @@ -50,10 +50,6 @@ font-weight: normal; } -.msgs .block .dataNameDate span{ - font-style: italic; -} - .msgs .block .dataComment{ }