Blog 8.1
This commit is contained in:
parent
c13aa495f0
commit
b93e08e9a4
@ -16,7 +16,7 @@
|
||||
class blog extends common
|
||||
{
|
||||
|
||||
const VERSION = '8.0';
|
||||
const VERSION = '8.1';
|
||||
const REALNAME = 'Blog';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -42,9 +42,6 @@ class blog extends common
|
||||
|
||||
public static $articles = [];
|
||||
|
||||
// Signature de l'article
|
||||
public static $articleSignature = '';
|
||||
|
||||
// Signature du commentaire
|
||||
public static $editCommentSignature = '';
|
||||
|
||||
@ -179,6 +176,7 @@ class blog extends common
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'buttonBack', true]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'showTime', true]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'showDate', true]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'showPseudo', true]);
|
||||
$this->setData(['module', $this->getUrl(0), 'config', 'versionData', '8.0']);
|
||||
}
|
||||
}
|
||||
@ -198,7 +196,7 @@ class blog extends common
|
||||
$feeds = new \FeedWriter\RSS2();
|
||||
|
||||
// En-tête
|
||||
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']): '');
|
||||
$feeds->setTitle($this->getData(['page', $this->getUrl(0), 'title']) ? $this->getData(['page', $this->getUrl(0), 'title']) : '');
|
||||
$feeds->setLink(helper::baseUrl() . $this->getUrl(0));
|
||||
if ($this->getData(['page', $this->getUrl(0), 'metaDescription'])) {
|
||||
$feeds->setDescription($this->getData(['page', $this->getUrl(0), 'metaDescription']));
|
||||
@ -222,10 +220,10 @@ class blog extends common
|
||||
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']),
|
||||
'link' => helper::baseUrl() . $this->getUrl(0) . '/' . $articleId,
|
||||
'description' => '<img src="' . helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb
|
||||
. '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" title="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" />' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'content']),
|
||||
. '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" title="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
|
||||
. '" />' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'content']),
|
||||
]);
|
||||
$newsArticle->setAuthor($author, 'no@mail.com');
|
||||
$newsArticle->setId(helper::baseUrl() . $this->getUrl(0) . '/' . $articleId);
|
||||
@ -455,9 +453,12 @@ class blog extends common
|
||||
else {
|
||||
$approved = !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']);
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'posts', $this->getUrl(2),
|
||||
'comment', $this->getUrl(3),
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'posts',
|
||||
$this->getUrl(2),
|
||||
'comment',
|
||||
$this->getUrl(3),
|
||||
[
|
||||
'author' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']),
|
||||
'content' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']),
|
||||
@ -570,7 +571,8 @@ class blog extends common
|
||||
$this->isPost()
|
||||
) {
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'feeds' => $this->getInput('blogOptionShowFeeds', helper::FILTER_BOOLEAN),
|
||||
@ -583,6 +585,7 @@ class blog extends common
|
||||
'buttonBack' => $this->getInput('blogOptionButtonBack', helper::FILTER_BOOLEAN),
|
||||
'showDate' => $this->getInput('blogOptionShowDate', helper::FILTER_BOOLEAN),
|
||||
'showTime' => $this->getInput('blogOptionShowTime', helper::FILTER_BOOLEAN),
|
||||
'showPseudo' => $this->getInput('blogOptionShowPseudo', helper::FILTER_BOOLEAN),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
|
||||
]
|
||||
]);
|
||||
@ -757,63 +760,69 @@ class blog extends common
|
||||
and password_verify($this->getInput('blogArticleCaptcha', helper::FILTER_INT), $this->getInput('blogArticleCaptchaResult')) === false
|
||||
) {
|
||||
self::$inputNotices['blogArticleCaptcha'] = 'Incorrect';
|
||||
}
|
||||
// Crée le commentaire
|
||||
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']));
|
||||
$content = $this->getInput('blogArticleContent', null, true);
|
||||
$this->setData([
|
||||
'module', $this->getUrl(0),
|
||||
'posts', $this->getUrl(1),
|
||||
'comment',
|
||||
$commentId,
|
||||
[
|
||||
'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE),
|
||||
'content' => $content,
|
||||
'createdOn' => time(),
|
||||
'userId' => $this->getInput('blogArticleUserId'),
|
||||
'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
|
||||
]
|
||||
]);
|
||||
// Envoi d'une notification aux administrateurs
|
||||
// Init tableau
|
||||
$to = [];
|
||||
// Liste des destinataires
|
||||
foreach ($this->getData(['user']) as $userId => $user) {
|
||||
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification'])) {
|
||||
$to[] = $user['mail'];
|
||||
$firstname[] = $user['firstname'];
|
||||
$lastname[] = $user['lastname'];
|
||||
}
|
||||
}
|
||||
// Envoi du mail $sent code d'erreur ou de réussite
|
||||
$notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation' : 'Commentaire déposé';
|
||||
if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) {
|
||||
$error = 0;
|
||||
foreach ($to as $key => $adress) {
|
||||
$sent = $this->sendMail(
|
||||
$adress,
|
||||
'Nouveau commentaire déposé',
|
||||
'Bonjour' . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,<br><br>' .
|
||||
'L\'article <a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a> a reçu un nouveau commentaire.<br><br>',
|
||||
null,
|
||||
$this->getData(['config', 'smtp', 'from'])
|
||||
);
|
||||
if ($sent === false)
|
||||
$error++;
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
|
||||
'notification' => ($error === 0 ? $notification . '<br/>Une notification a été envoyée.' : $notification . '<br/> Erreur de notification : ' . $sent),
|
||||
'state' => ($sent === true ? true : null)
|
||||
]);
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
|
||||
'notification' => $notification,
|
||||
'state' => true
|
||||
|
||||
// Création du commentaire et notifcation par email
|
||||
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']));
|
||||
$content = $this->getInput('blogArticleContent', null, true);
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'posts',
|
||||
$this->getUrl(1),
|
||||
'comment',
|
||||
$commentId,
|
||||
[
|
||||
'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE),
|
||||
'content' => $content,
|
||||
'createdOn' => time(),
|
||||
'userId' => $this->getInput('blogArticleUserId'),
|
||||
'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
|
||||
]
|
||||
]);
|
||||
// Envoi d'une notification aux administrateurs
|
||||
// Init tableau
|
||||
$to = [];
|
||||
// Liste des destinataires
|
||||
foreach ($this->getData(['user']) as $userId => $user) {
|
||||
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification'])) {
|
||||
$to[] = $user['mail'];
|
||||
$firstname[] = $user['firstname'];
|
||||
$lastname[] = $user['lastname'];
|
||||
}
|
||||
}
|
||||
// Envoi du mail $sent code d'erreur ou de réussite
|
||||
$notification = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation' : 'Commentaire déposé';
|
||||
if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentNotification']) === true) {
|
||||
$error = 0;
|
||||
foreach ($to as $key => $adress) {
|
||||
$sent = $this->sendMail(
|
||||
$adress,
|
||||
'Nouveau commentaire déposé',
|
||||
'<p>Bonjour' . ' <strong>' . $firstname[$key] . ' ' . $lastname[$key] . '</strong>,</p>' .
|
||||
'<p>L\'article <a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a> a reçu un nouveau commentaire rédigé par <strong>' .
|
||||
$this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE) . '</strong></p>' .
|
||||
'<p>' . $content.'</p>',
|
||||
null,
|
||||
$this->getData(['config', 'smtp', 'from'])
|
||||
);
|
||||
if ($sent === false)
|
||||
$error++;
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
|
||||
'notification' => ($error === 0 ? $notification . '<br/>Une notification a été envoyée.' : $notification . '<br/> Erreur de notification : ' . $sent),
|
||||
'state' => ($sent === true ? true : null)
|
||||
]);
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
|
||||
'notification' => $notification,
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ids des commentaires approuvés par ordre de publication
|
||||
@ -831,8 +840,6 @@ class blog extends common
|
||||
$pagination = helper::pagination($commentIds, $this->getUrl(), $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']), '#comment');
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Signature de l'article
|
||||
self::$articleSignature = $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']));
|
||||
// Signature du commentaire édité
|
||||
if ($this->isConnected() === true) {
|
||||
self::$editCommentSignature = $this->signature($this->getUser('id'));
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Version 8.01
|
||||
- Un mail de notification est seulement envoyé lorsque le captcha est passé et que le commentaire est déposé.
|
||||
- Le mail de notification contient désormais le nom de l'auteur du commentaire ainsi que le commentaire.
|
||||
# Version 8.00
|
||||
- Ajoute deux nouvelles options pour afficher ou masquer la date et l'heure de l'article.
|
||||
- Ajoute trois nouvelles options pour afficher ou masquer le pseudo, la date et l'heure de l'article.
|
||||
- Corrige un bug d'affichage des articles lorsque le thème Moderne est sélectionné.
|
||||
- Corrige un bug dans la méthode de tronquage de l'article, nécessite Zwii 13.5
|
||||
- Corrige un mauvais format de la propriété buttonBack non stockée au type booléen.
|
||||
|
@ -1 +1 @@
|
||||
{"name":"blog","realName":"Blog","version":"7.12","update":"0.0","delete":true,"dataDirectory":""}
|
||||
{"name":"blog","realName":"Blog","version":"8.1","update":"0.0","delete":true,"dataDirectory":""}
|
@ -19,8 +19,13 @@
|
||||
</div>
|
||||
<div class="col6 newsDate textAlignRight">
|
||||
<!-- bloc signature -->
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $module::$articleSignature; ?>
|
||||
<?php if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'showPseudo']) === true
|
||||
): ?>
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId'])) ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- bloc date -->
|
||||
<?php if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||
|
@ -25,8 +25,12 @@
|
||||
<div class="row">
|
||||
<div class="col6 blogEdit">
|
||||
<!-- bloc signature -->
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
||||
<?php if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'showPseudo']) === true
|
||||
): ?>
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
||||
<?php endif; ?>
|
||||
<!-- bloc Date -->
|
||||
<?php if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||
@ -157,9 +161,12 @@
|
||||
</div>
|
||||
<div class="blogDate">
|
||||
<!-- bloc signature -->
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
||||
<!-- bloc date -->
|
||||
<?php if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'showPseudo']) === true
|
||||
): ?>
|
||||
<?php echo template::ico('user'); ?>
|
||||
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
|
||||
<?php endif; ?> <!-- bloc date -->
|
||||
<?php if (
|
||||
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|
||||
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
|
||||
|
@ -17,6 +17,18 @@
|
||||
<h4>
|
||||
<?php echo helper::translate('Paramètres'); ?>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('blogOptionButtonBack', true, 'Bouton de retour', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('blogOptionShowPseudo', true, 'Signature', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'showPseudo'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('blogOptionShowDate', true, 'Afficher la date', [
|
||||
@ -62,12 +74,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('newsOptionButtonBack', true, 'Bouton de retour', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
]); ?>
|
||||
|
Loading…
Reference in New Issue
Block a user