diff --git a/CHANGES.md b/CHANGES.md index fb063f90..15b25abb 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ # Améliorations - Supprime la gestion d'erreur à l'étape 4 de la mise à jour automatique. - Modifie l'URL de téléchargement des mises à jour. +- Améliore l'affichage des dats dans les langues étrangères. ## Version 13.0.03 # Améliorations diff --git a/core/class/helper.class.php b/core/class/helper.class.php index 7f7a3379..d3119d98 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -43,10 +43,10 @@ class helper * Date au format time() * $format strftime */ - public static function dateUTF8($format, $date) + public static function dateUTF8($format, $date, $locale = 'fr_FR') { require_once 'core/class/strftime/php-8.1-strftime.class.php'; - return mb_convert_encoding(\PHP81_BC\strftime($format, $date), 'UTF-8', mb_list_encodings()); + return mb_convert_encoding(\PHP81_BC\strftime($format, $date, $locale), 'UTF-8', mb_list_encodings()); } /** diff --git a/core/core.php b/core/core.php index baf1d10c..161a0673 100644 --- a/core/core.php +++ b/core/core.php @@ -1384,7 +1384,7 @@ class common public function saveLog($message = '') { // Journalisation - $dataLog = helper::dateUTF8('%Y %m %d', time()) . ' - ' . helper::dateUTF8('%H:%M', time()); + $dataLog = helper::dateUTF8('%Y %m %d', time(), self::$i18nContent) . ' - ' . helper::dateUTF8('%H:%M', time(), self::$i18nContent); $dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';'; $dataLog .= empty($this->getUser('id')) ? 'visitor;' : $this->getUser('id') . ';'; $dataLog .= $message ? $this->getUrl() . ';' . $message : $this->getUrl(); diff --git a/core/module/config/config.php b/core/module/config/config.php index fcfe2495..85374707 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -780,7 +780,7 @@ class config extends common $d = $this->getData(['blacklist']); $data = ''; foreach ($d as $key => $item) { - $data .= helper::dateUTF8('%Y %m %d', $item['lastFail']) . ' - ' . helper::dateUTF8('%H:%M', time()); + $data .= helper::dateUTF8('%Y %m %d', $item['lastFail'], self::$i18nContent) . ' - ' . helper::dateUTF8('%H:%M', time(), self::$i18nContent); $data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL; } file_put_contents($fileName, $data, FILE_APPEND); diff --git a/core/module/language/language.php b/core/module/language/language.php index e3b14897..6c54f758 100644 --- a/core/module/language/language.php +++ b/core/module/language/language.php @@ -255,7 +255,7 @@ class language extends common self::$languagesUiInstalled[$file] = [ template::flag($file, '20 %') . ' ' . self::$languages[$file], $value['version'], - helper::dateUTF8('%d/%m/%Y', $value['date']), + helper::dateUTF8('%d/%m/%Y', $value['date'], self::$i18nContent), //self::$i18nUI === $file ? helper::translate('Interface') : '', '', /* @@ -290,7 +290,7 @@ class language extends common self::$languagesStore[$file] = [ template::flag($file, '20 %') . ' ' . self::$languages[$file], $value['version'], - helper::dateUTF8('%d/%m/%Y', $value['date']), + helper::dateUTF8('%d/%m/%Y', $value['date'], self::$i18nContent), '', template::button('translateContentLanguageUIDownload' . $file, [ 'class' => 'buttonGreen', diff --git a/core/module/plugin/plugin.php b/core/module/plugin/plugin.php index 9cbf7fcc..86516167 100644 --- a/core/module/plugin/plugin.php +++ b/core/module/plugin/plugin.php @@ -377,7 +377,7 @@ class plugin extends common $store[$key]['category'], '' . $store[$key]['title'] . '', $store[$key]['version'], - helper::dateUTF8('%d %B %Y', $store[$key]['versionDate']), + helper::dateUTF8('%d %B %Y', $store[$key]['versionDate'], self::$i18nContent), implode(' - ', $pageInfos), template::button('moduleExport' . $key, [ 'class' => $class, @@ -403,7 +403,7 @@ class plugin extends common { $store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true); self::$storeItem = $store[$this->getUrl(2)]; - self::$storeItem['fileDate'] = helper::dateUTF8('%d %B %Y', self::$storeItem['fileDate']); + self::$storeItem['fileDate'] = helper::dateUTF8('%d %B %Y', self::$storeItem['fileDate'], self::$i18nContent); // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Module ' . self::$storeItem['title']), diff --git a/module/blog/blog.php b/module/blog/blog.php index 1bf734a1..f4be80b3 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -359,7 +359,7 @@ class blog extends common self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']); self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']); self::$comments[] = [ - helper::dateUTF8(self::$dateFormat, $comment['createdOn']) . ' - ' . helper::dateUTF8(self::$timeFormat, $comment['createdOn']), + helper::dateUTF8(self::$dateFormat, $comment['createdOn'], self::$i18nContent) . ' - ' . helper::dateUTF8(self::$timeFormat, $comment['createdOn'], self::$i18nContent), $comment['content'], $comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'], $buttonApproval, @@ -528,7 +528,7 @@ class blog extends common '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . '', - helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), + helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']), self::$i18nContent), self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])], // Bouton pour afficher les commentaires de l'article template::button('blogConfigComment' . $articleIds[$i], [ diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 48dd1df6..46a422ba 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -15,7 +15,7 @@ - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])); ?> + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nContent); ?> - + diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 0f608e10..d12c5bf8 100755 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -28,7 +28,7 @@ signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> - getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nContent); ?>
@@ -143,7 +143,7 @@ signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> - getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'], self::$i18nContent), self::$i18nContent); ?>
getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?> diff --git a/module/news/news.php b/module/news/news.php index ed2b5038..27a5246e 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -230,9 +230,9 @@ class news extends common // News en fonction de la pagination for ($i = $pagination['first']; $i < $pagination['last']; $i++) { // Met en forme le tableau - $dateOn = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn'])); + $dateOn = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn']), self::$i18nContent); if ($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) { - $dateOff = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])); + $dateOff = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff']), self::$i18nContent) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff']), self::$i18nContent); } else { $dateOff = helper::translate('Permanent'); } @@ -332,9 +332,9 @@ class news extends common // News en fonction de la pagination for ($i = $pagination['first']; $i < $pagination['last']; $i++) { // Met en forme le tableau - $dateOn = $dateOn = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn'])); + $dateOn = $dateOn = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOn']), self::$i18nContent); if ($this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) { - $dateOff = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff'])); + $dateOff = helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff']), self::$i18nContent) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $newsIds[$i], 'publishedOff']), self::$i18nContent); } else { $dateOff = helper::translate('Permanent'); } diff --git a/module/news/view/article/article.php b/module/news/view/article/article.php index 67c4ee21..c006e6e3 100644 --- a/module/news/view/article/article.php +++ b/module/news/view/article/article.php @@ -9,7 +9,7 @@ - getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])); ?> + getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nContent) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nContent); ?> getUser('password') === $this->getInput('ZWII_USER_PASSWORD') diff --git a/module/news/view/index/index.php b/module/news/view/index/index.php index ee5cf9e0..4e3d649b 100644 --- a/module/news/view/index/index.php +++ b/module/news/view/index/index.php @@ -23,7 +23,7 @@ - +