summaryrefslogblamecommitdiff
path: root/tpl/blog/view.php
blob: 83c49c0bde3fc322c47dff08c9ed11e8b4813779 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                  
                                                                       
                                                    
                                                                          
                               
                                                                           
              
                                                                         
              
                                                                       




                                                                          

                 
                                     

                                    
                                                            



                                                       
                                                                                                             
                                                                                 
                                                                                                  


                                                                                                 
                                                                                                




                                                                                       
                                               
                           
                                                                                                                                                                                                                                                                           
                
                                                                            
         
 



                                  
<?php

$title = $post['title'];

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

echo '<div class="small_right">';
echo 'Written by ' . $post['owner'];
if ($can_edit && $post['owner_id'] == $user['id'])
	echo ' | <a href="edit-blog-' . $post['id'] . '">modifier</a>';
if ($can_delete && $post['owner_id'] == $user['id'])
	echo ' | <a href="delete-blog-' . $post['id'] . '">supprimer</a>';
if ($can_comment && !$is_draft)
	echo ' | <a href="comment-blog-' . $post['id'] . '">commenter</a>';
if ($is_draft)
	echo ' | <a href="publish-blog-' . $post['id'] . '">publier</a>';
echo '</div>';
echo '<div class="small_right">publié le ' . $post['date'] . '</div>';
if ($post['tags'] != '') {
	echo '<div class="small_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="delcom-blog-' . $comment['id'] . '">supprimer</a>';
			if ($can_comment && $comment['author_id'] == $user['id'])
				$a[] = '<a href="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");