Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

get_comment.php 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. require_once('../includes/config.php');
  3. if(isset($_POST))
  4. {
  5. $postID = rawurldecode($_POST['postID']);
  6. $service = rawurldecode($_POST['service']);
  7. $postCount = rawurldecode($_POST['postCount']);
  8. $startPost = rawurldecode($_POST['startPost']);
  9. $comments = get_comments($service, $postID, $db, $postCount, $startPost);
  10. if ($comments)
  11. {
  12. foreach ($comments as $comment)
  13. {
  14. $own_comment = false;
  15. $post_id = $comment['id'];
  16. $author_id = $comment['user_id'];
  17. $reply_id = $comment['reply_id'];
  18. $author = $userTools->get($author_id);
  19. $date = $comment['date_posted'];
  20. $comment = $comment['post'];
  21. $reply_user_id = -1;
  22. $reply = $db->select($service, "id=? LIMIT 1", array($reply_id));
  23. if ($reply)
  24. {
  25. $reply_user_id = $reply['author_id'];
  26. }
  27. if ($author_id == $user->id || $user->admin || $user->id == $reply_user_id)
  28. {
  29. $own_comment = true;
  30. }
  31. ?>
  32. <script>
  33. var converter = new Markdown.getSanitizingConverter();
  34. var old_post = $("#comment_<?php echo $post_id; ?>").html();
  35. var new_post = converter.makeHtml(old_post);
  36. $("#comment_<?php echo $post_id; ?>").html(new_post);
  37. </script>
  38. <hr>
  39. <div class="row">
  40. <div class="col-sm-8 col-sm-offset-2">
  41. <div class="post-comment">
  42. <p class="post-comment-meta text-muted">
  43. <a href="<?php echo get_page_url("home", $CONF); ?>/<?php echo $author->username; ?>"><?php echo $author->username; ?></a> replied at <?php echo date("g:i:s a",strtotime($date)); ?> on <?php echo date("F d, Y",strtotime($date)); ?>
  44. <?php
  45. if ($own_comment && $logged_in)
  46. {
  47. ?>
  48. <br />
  49. <?php
  50. if ($author_id == $user->id || $user->admin)
  51. {
  52. ?>
  53. <button type="button" class="btn btn-info edit_comment" id="<?php echo $post_id; ?>" data-toggle="modal" data-target="#editComment">Edit</button>
  54. <?php
  55. }
  56. ?>
  57. <button type="button" class="btn btn-danger delete_comment" id="<?php echo $post_id; ?>">Delete</button>
  58. <?php
  59. }
  60. ?>
  61. </p>
  62. <p id="comment_<?php echo $post_id; ?>"><?php echo $comment; ?></p>
  63. </div>
  64. </div>
  65. </div>
  66. <?php
  67. }
  68. }
  69. }
  70. ?>