diff --git a/core/class/helper.class.php b/core/class/helper.class.php
index ca32b975..8156bd4c 100644
--- a/core/class/helper.class.php
+++ b/core/class/helper.class.php
@@ -32,6 +32,18 @@ class helper
return (array_key_exists($text, core::$dialog) && !empty(core::$dialog[$text]) ? core::$dialog[$text] : $text);
}
+ /**
+ * Formate la date avec le script strftime en UTF8
+ * Date au format time()
+ * $format strftime
+ */
+ public static function dateUTF8($format, $date)
+ {
+ return mb_detect_encoding(\PHP81_BC\strftime($format, $date), 'UTF-8', true)
+ ? \PHP81_BC\strftime($format, $date)
+ : utf8_encode(\PHP81_BC\strftime($format, $date));
+ }
+
/**
* Fonction pour assurer la traduction des messages
*/
diff --git a/module/blog/blog.php b/module/blog/blog.php
index 2d0dae85..1542129e 100755
--- a/module/blog/blog.php
+++ b/module/blog/blog.php
@@ -15,7 +15,7 @@
class blog extends common {
- const VERSION = '6.21';
+ const VERSION = '6.22';
const REALNAME = 'Blog';
const DELETE = true;
const UPDATE = '0.0';
@@ -307,16 +307,8 @@ class blog extends common {
'value' => $comment['approval'] === true ? 'A' : 'R'
]);
}
- //Date et heure
- $gdh = mb_detect_encoding(\PHP81_BC\strftime('%d/%m/%y', $comment['createdOn']), 'UTF-8', true)
- ? \PHP81_BC\strftime('%d/%m/%y', $comment['createdOn'])
- : utf8_encode(\PHP81_BC\strftime('%d/%m/%y', $comment['createdOn']));
- $gdh .= ' - ';
- $gdh .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $comment['createdOn']), 'UTF-8', true)
- ? \PHP81_BC\strftime('%H:%M', $comment['createdOn'])
- : utf8_encode(\PHP81_BC\strftime('%H:%M', $comment['createdOn']));
self::$comments[] = [
- $gdh,
+ helper::dateUTF8('%d %B %Y',$comment['createdOn']) . ' - ' . helper::dateUTF8('%H:%M',$comment['createdOn']),
$comment['content'],
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
$buttonApproval,
@@ -476,17 +468,11 @@ class blog extends common {
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
}
// Met en forme le tableau
- $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
- $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
self::$articles[] = [
'' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'',
- $date .' à '. $heure,
+ helper::dateUTF8('%d %B %Y',$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M',$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])),
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], [
@@ -577,17 +563,11 @@ class blog extends common {
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
}
// Met en forme le tableau
- $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
- $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
self::$articles[] = [
'' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'',
- $date .' à '. $heure,
+ helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M', $$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])),
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/changes.md b/module/blog/changes.md
index ec93162f..9bc92965 100755
--- a/module/blog/changes.md
+++ b/module/blog/changes.md
@@ -1,3 +1,7 @@
+# version 6.22
+- mise en oeuvre du helper dateUTF8
+# version 6.2
+- date des commentaires
# version 6.1
- Icône RSS, lien incorrectd ans l'article.
# version 6
diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php
index 33bc7c00..d92bcf94 100755
--- a/module/blog/view/article/article.php
+++ b/module/blog/view/article/article.php
@@ -3,159 +3,151 @@
getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
echo '';
+ ' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
+ '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
} ?>
- getData(['module', $this->getUrl(0),'posts', $this->getUrl(1), 'content']); ?>
+ getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'content']); ?>
-
+
- getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
- $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
- echo $date . ' à ' . $heure;
- ?>
+ 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'])); ?>
getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
- AND
+ and
( // Propriétaire
- (
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
- AND ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'userId']) === $this->getUser('id')
- OR $this->getUser('group') === self::GROUP_ADMIN )
- )
- OR (
+ ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === $module::EDIT_OWNER
+ and ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']) === $this->getUser('id')
+ or $this->getUser('group') === self::GROUP_ADMIN)
+ )
+ or (
// Groupe
- ( $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
- OR $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
- AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
- )
- OR (
+ ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_ADMIN
+ or $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_MODERATOR)
+ and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent'])
+ )
+ or (
// Tout le monde
- $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
- AND $this->getUser('group') >= $module::$actions['config']
+ $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === $module::EDIT_ALL
+ and $this->getUser('group') >= $module::$actions['config']
)
)
- ): ?>
-
- Éditer
-
+ ) : ?>
+
+ Éditer
+
- getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
+ getData(['module', $this->getUrl(0), 'config', 'feeds'])) : ?>
-getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
+getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])) : ?>
Cet article ne reçoit pas de commentaire.
-
+
- 'Rédiger un commentaire...',
- 'readonly' => true
- ]); ?>
-
- getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
- 'Nom',
- 'readonly' => true,
- 'value' => $module::$editCommentSignature
- ]); ?>
- $this->getUser('id')
- ]); ?>
-
-
-
- 'Nom'
- ]); ?>
-
-
-
- helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
- 'value' => 'Connexion'
- ]); ?>
-
-
-
- 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']).' caractères',
- 'class' => 'editorWysiwygComment',
- 'noDirty' => true,
- 'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
+ 'Rédiger un commentaire...',
+ 'readonly' => true
+ ]); ?>
+
+ getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) : ?>
+ 'Nom',
+ 'readonly' => true,
+ 'value' => $module::$editCommentSignature
]); ?>
-
- getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
-
-
- $this->getData(['config','connect', 'captchaStrong']),
- 'type' => $this->getData(['config','connect', 'captchaType'])
- ]); ?>
-
-
-
+ $this->getUser('id')
+ ]); ?>
+
-
- 'buttonGrey',
- 'value' => 'Annuler'
+
+ 'Nom'
]); ?>
-
- 'Envoyer',
- 'ico' => ''
+
+
+ helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
+ 'value' => 'Connexion'
]); ?>
+
+ 'Commentaire avec maximum ' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']) . ' caractères',
+ 'class' => 'editorWysiwygComment',
+ 'noDirty' => true,
+ 'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
+ ]); ?>
+
+ getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) : ?>
+
+
+ $this->getData(['config', 'connect', 'captchaStrong']),
+ 'type' => $this->getData(['config', 'connect', 'captchaType'])
+ ]); ?>
+
+
+
+
+
+ 'buttonGrey',
+ 'value' => 'Annuler'
+ ]); ?>
+
+
+ 'Envoyer',
+ 'ico' => ''
+ ]); ?>
+
-
+
+
- $comment): ?>
+ $comment) : ?>
-
- le
+
+
+
+
+
diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php
index 5f78d7ee..345c02d8 100755
--- a/module/blog/view/index/index.php
+++ b/module/blog/view/index/index.php
@@ -17,14 +17,7 @@
signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
- getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])));
- $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])));
- echo $date . ' à ' . $heure;
- ?>
+ getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
@@ -137,14 +130,7 @@
signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?>
- getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
- $heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
- ? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
- : utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
- echo $date . ' à ' . $heure;
- ?>
+ getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?>