diff --git a/module/blog/blog.php b/module/blog/blog.php index 59730c2e..bb414d88 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -210,7 +210,7 @@ class blog extends common { $newuserid = $this->getUser('id'); } // Incrémente l'id de l'article - $articleId = helper::increment($this->getInput('blogAddTitle', helper::FILTER_ID), $this->getData(['page'])); + $articleId = helper::increment($this->getInput('blogAddPermalink'), $this->getData(['page'])); $articleId = helper::increment($articleId, (array) $this->getData(['module', $this->getUrl(0)])); $articleId = helper::increment($articleId, array_keys(self::$actions)); // Crée l'article @@ -218,9 +218,8 @@ class blog extends common { $this->getUrl(0), 'posts', $articleId, [ - 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']), 'content' => $this->getInput('blogAddContent', null), - 'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true), + 'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT), 'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN), 'pictureSize' => $this->getInput('blogAddPictureSize', helper::FILTER_STRING_SHORT), 'picturePosition' => $this->getInput('blogAddPicturePosition', helper::FILTER_STRING_SHORT), @@ -234,6 +233,7 @@ class blog extends common { 'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN), 'commentNotification' => $this->getInput('blogAddCommentNotification', helper::FILTER_BOOLEAN), 'commentGroupNotification' => $this->getInput('blogAddCommentGroupNotification', helper::FILTER_INT), + 'comment' => [] ] ]); // Valeurs en sortie @@ -655,7 +655,7 @@ class blog extends common { else{ $newuserid = $this->getUser('id'); } - $articleId = $this->getInput('blogEditTitle', helper::FILTER_ID, true); + $articleId = $this->getInput('blogEditPermalink', null, true); // Incrémente le nouvel id de l'article if($articleId !== $this->getUrl(2)) { $articleId = helper::increment($articleId, $this->getData(['page'])); @@ -667,10 +667,9 @@ class blog extends common { 'posts', $articleId, [ 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), - 'permalink' => $this->getInput('blogEditPermalink', helper::FILTER_STRING_SHORT, true), 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']), 'content' => $this->getInput('blogEditContent', null), - 'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true), + 'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT), 'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN), 'pictureSize' => $this->getInput('blogEditPictureSize', helper::FILTER_STRING_SHORT), 'picturePosition' => $this->getInput('blogEditPicturePosition', helper::FILTER_STRING_SHORT), @@ -859,7 +858,7 @@ class blog extends common { if($articlePublishedOn <= time() AND $articleIdsStates[$articleId]) { $articleIds[] = $articleId; // Nombre de commentaires approuvés par article - self::$comments [$articleId] = count ( $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'comment'])); + self::$comments [$articleId] = count ( $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'comment'])); } } // Pagination diff --git a/module/blog/changes.md b/module/blog/changes.md index 6a7c5b5c..59b428a1 100644 --- a/module/blog/changes.md +++ b/module/blog/changes.md @@ -1,4 +1,6 @@ # version 6 - mise à la norme avec le module news : le formulaire est sorti de l'écran principal - Présentation moderner de la liste des articles - - Respect des balises headings \ No newline at end of file + - Respect des balises headings + - permalink des articles + - Image de couverture non obligatoire, présentation adaptive de la liste classique des articles. \ No newline at end of file diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index feada688..88f5c011 100644 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -37,7 +37,7 @@
'Permalink', - 'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'permalink']) + 'value' => $this->getUrl(2) ]); ?>
diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 7f3f691f..22358db9 100644 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -12,13 +12,16 @@
- getData(['module', $this->getUrl(0), 'posts',$articleId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'pictureSize']); ?> - getData(['module', $this->getUrl(0), 'posts',$articleId, 'hidePicture']) == false) { - echo '' . $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'picture']) . ''; - } ?> - getData(['module', $this->getUrl(0),'posts',$articleId, 'content']); ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) && + file_exists( self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])) ): ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']); ?> + getData(['module', $this->getUrl(0), 'posts', $articleId, 'hidePicture']) == false) { + echo '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) . ''; + } ?> + + getData(['module', $this->getUrl(0),'posts', $articleId, 'content']); ?>
@@ -27,12 +30,12 @@ signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?> - getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])), 'UTF-8', true) - ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])) - : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn']))); - $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])), 'UTF-8', true) - ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])) - : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn']))); + getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) + ? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) + : utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); + $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])), 'UTF-8', true) + ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) + : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); echo $date . ' à ' . $heure; ?> @@ -42,15 +45,15 @@ AND ( // Propriétaire ( - $this->getData(['module', $this->getUrl(0), 'posts',$articleId,'editConsent']) === $module::EDIT_OWNER - AND ( $this->getData(['module', $this->getUrl(0), 'posts',$articleId,'userId']) === $this->getUser('id') + $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'editConsent']) === $module::EDIT_OWNER + AND ( $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'userId']) === $this->getUser('id') OR $this->getUser('group') === self::GROUP_ADMIN ) ) OR ( // Groupe ( $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'editConsent']) === self::GROUP_ADMIN OR $this->getData(['module', $this->getUrl(0), 'posts', $articleId,'editConsent']) === self::GROUP_MODERATOR) - AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts',$articleId,'editConsent']) + AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $articleId,'editConsent']) ) OR ( // Tout le monde @@ -85,24 +88,27 @@
-
- - makeThumb( self::FILE_DIR . 'source/' . $article['picture'], - self::FILE_DIR . 'thumb/' . $thumb, - self::THUMBS_WIDTH); - } - ?> - - <?php echo $article['picture']; ?> - + +
+ makeThumb( self::FILE_DIR . 'source/' . $article['picture'], + self::FILE_DIR . 'thumb/' . $thumb, + self::THUMBS_WIDTH); + } + ?> + + <?php echo $article['picture']; ?> + +
+
+ +
-
-