summaryrefslogtreecommitdiff
path: root/tpl/blog/view.php
blob: e453a19a4424b64ad87f7cca7719f9869a29a30e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

$title = $post['title'];

require("tpl/general/top.php");

echo '<div class="small_align_right">';
echo 'Écrit par ' . $post['owner'];
if ($can_edit && $post['owner_id'] == $user['id'])
	echo ' | <a href="?p=edit-blog-' . $post['id'] . '">modifier</a>';
if ($can_delete && $post['owner_id'] == $user['id'])
	echo ' | <a href="?p=delete-blog-' . $post['id'] . '">supprimer</a>';
if ($can_comment && !$is_draft)
	echo ' | <a href="?p=comment-blog-' . $post['id'] . '">commenter</a>';
if ($is_draft)
	echo ' | <a href="?p=publish-blog-' . $post['id'] . '">publier</a>';
echo '</div>';
echo '<div class="small_align_right">publié le ' . $post['date'] . '</div>';
if ($post['tags'] != '') {
	echo '<div class="small_align_right">tags: ' . $post['tags'] . '</div>';
}
echo $post['text_html'];

if (!$is_draft) {

	echo '<h2>Commentaires</h2>';

	if (count($comments) == 0) {
		echo 'Pas de commentaires pour l\'instant.';
	} else {
		foreach ($comments as $comment) {
			echo '<div class="blog_post">';
			$a = array();
			if ($can_delcom) $a[] = '<a href="?p=delcom-blog-' . $comment['id'] . '">supprimer</a>';
			if ($can_comment && $comment['author_id'] == $user['id'])
				$a[] = '<a href="?p=edcom-blog-' . $comment['id'] . '">modifier</a>';
			if (count($a) > 0)
				echo '<div class="small_right">' . implode(" | ", $a) . '</div>';

			echo '<h3>' . $comment['date'] . ' par ' . $comment['author'] . '</h3>';
			echo '<div class="inside">' . $comment['text_html'] . '</div>';
			echo '</div>';
		}
	}

	echo '<h3>Écrire un commentaire</h3>';
	if ($can_comment) {
		echo '<form class="blog_post" method="POST" action="index.php?p=comment-blog-' . $post['id'] . '"><textarea name="comment" style="height: 200px"></textarea><br /><div class="empty_label">&nbsp;</div><input type="submit" value="Enregistrer" /></form>';
	} else {
		echo 'Veuillez vous identifier pour poster un commentaire.';
	}

}


require("tpl/general/bottom.php");