d.blog.view.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!DOCTYPE html>
  2. <html lang="fr">
  3. <? include('blocks/d.head.html'); ?>
  4. <body>
  5. <? include('blocks/d.nav.html'); ?>
  6. <section id="blog_article" <?=$blogArticle->is_archive=="t"||$blogArticle->is_public=="f"?'class="archive"':''?>>
  7. <h1><?=$blogArticle->name?></h1>
  8. <? if($user->rankIsHigher('premium')) { ?>
  9. <span class="subtitle">
  10. <? if(isset($blogHistory)) { ?>
  11. <select id="bloghistory">
  12. <? $i = 0;
  13. foreach ($blogHistory->objs as $row) { ?>
  14. <option <?=$row->version_id==$blogArticle->version_id?'selected':''?> value="<?=$i?>"><?=$row->is_archive=="f"?'&bull; ':''?><? echo strftime('%d/%m/%Y %H:%M:%S',strtotime($row->update_date)) ?></option>
  15. <? $i++;
  16. } ?>
  17. </select>
  18. <? }
  19. if ($user->rankIsHigher('moderator') && isset($blogHistory)) { ?>
  20. &mdash;
  21. <? }
  22. if ($user->rankIsHigher("moderator")) { ?>
  23. <a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/edit"><i class="fas fa-pencil-alt"></i> Éditer l'article</a> &mdash;
  24. <? if ($blogArticle->is_public == 't') { ?>
  25. <a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete"><i class="fas fa-trash"></i> Effacer l'article</a>
  26. <? } else { ?>
  27. <a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/restore"><i class="fas fa-eye"></i> Restaurer l'article</a>
  28. <? } ?>
  29. <? } ?>
  30. </span>
  31. <? } ?>
  32. <div id="blogContent">
  33. <?=$blogArticle->content_html?>
  34. </div>
  35. <p id="blogTimestamp">Article écrit par
  36. <? if ($user->rankIsHigher("blocked")) { ?>
  37. <a href="<?=$config['rel_root_folder']?>user/p/<?=$blogArticle->author?>"><?=$blogArticle->author_name?></a>
  38. <? }
  39. else { ?>
  40. <?=$blogArticle->author_name?>
  41. <? } ?>
  42. le <? echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($blogArticle->creation_date)) ?> <small><abbr title="Temps Universel Coordonné">UTC</abbr></small></p>
  43. <!-- COMMENTS -->
  44. <? if ($blogArticle->is_commentable == "t") { ?>
  45. <div id="new_comment">
  46. <form class="form" action="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/new_comment" method="post">
  47. <div id="new_comment_label" <?=$user->rank=="visitor"?"class='sent' ":""?>>
  48. <? if ($blogArticle->is_archive == "t" || $blogArticle->is_public == "f") { ?>
  49. <p>Impossible de commenter un article non publié</p>
  50. <? } else if ($user->rankIsHigher("registered")) { ?>
  51. <input name="submit" type="submit" value="Envoyer">
  52. <p>Ajouter un nouveau commentaire</p>
  53. <? } else { ?>
  54. <p>Veuillez vous connecter pour ajouter un commentaire</p>
  55. <? } ?>
  56. </div>
  57. <div id="new_comment_form">
  58. <textarea id="comment" name="comment" rows="5" placeholder="Votre commentaire"></textarea>
  59. </div>
  60. </form>
  61. </div>
  62. <? if($blogArticle->is_commentable == 't') {
  63. foreach ($blogArticles_comments->objs as $comment) { ?>
  64. <article <? if($comment->is_archive == 't' || $comment->is_public == 'f') echo 'class="comment_archive" '; ?>>
  65. <div class="comment_title">
  66. <? if ($comment->author_obj->is_avatar_present=='t') { ?>
  67. <img alt="Avatar" class="icon avatar" src="<?=$config['rel_root_folder']?>medias/avatars/<?=$comment->author_obj->id?>_s.jpg">
  68. <? } else { ?>
  69. <i class="icon fas fa-user-secret"></i>
  70. <? } ?>
  71. <? if ($user->rankIsHigher("blocked")) { ?>
  72. <a class="username" href="<?=$config['rel_root_folder']?>user/p/<?=$comment->author_obj->id?>"><?=$comment->author_obj->name?></a>
  73. <? } else { ?>
  74. <?=$comment->author_obj->name?>
  75. <? } ?>
  76. le <? echo strftime('%e %B %G, %kh%Mm%Ss',strtotime($comment->update_date)) ?> <small><abbr title="Temps Universel Coordonné">UTC</abbr></small>
  77. <? if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 't') { ?>
  78. <span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/delete_comment/<?=$comment->id?>"><i class="fas fa-trash"></i> Effacer le commentaire</a></span>
  79. <? } ?>
  80. <? if (($user->rankIsHigher("moderator") || $user->id == $comment->author) && $comment->is_public == 'f') { ?>
  81. <span class="delete_link"><a href="<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/restore_comment/<?=$comment->id?>"><i class="fas fa-eye"></i> Restaurer le commentaire</a></span>
  82. <? } ?>
  83. </div>
  84. <div class="comment_content">
  85. <?=$comment->comment_html?>
  86. </div>
  87. </article>
  88. <? }
  89. }
  90. } ?>
  91. <br>
  92. <br>
  93. <div style="clear: both;"> </div>
  94. </section>
  95. <? if($user->rankIsHigher("premium")) { ?>
  96. <script type="text/javascript">
  97. $( "#bloghistory" ).change(function() {
  98. window.location.href = "<?=$config['rel_root_folder']?>blog/<?=$blogArticle->permalink?>/"+$( this ).val();
  99. });
  100. </script>
  101. <? } ?>
  102. <? if($user->rankIsHigher("registered") && $blogArticle->is_archive == "f" && $blogArticle->is_public == "t") { ?>
  103. <script type="text/javascript">
  104. $( "#new_comment_label" ).click(function() {
  105. $( "#new_comment_form" ).show(400);
  106. $( "#new_comment_label input" ).show(0);
  107. $( "#new_comment_label").addClass('sent');
  108. });
  109. </script>
  110. <? } ?>
  111. <? include('blocks/d.footer.html'); ?>
  112. </body>
  113. </html>