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_post.php 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. require_once('../includes/config.php');
  3. if(isset($_POST))
  4. {
  5. $postCount = rawurldecode($_POST['postCount']);
  6. $startPost = rawurldecode($_POST['startPost']);
  7. if (isset($_POST['postID']))
  8. {
  9. $posts = get_post('podcast', rawurldecode($_POST['postID']), $db);
  10. }
  11. else
  12. {
  13. $posts = get_podcast($db, $postCount, $startPost);
  14. }
  15. if ($posts)
  16. {
  17. foreach ($posts as $post)
  18. {
  19. $post_id = $post['id'];
  20. $date = $post['date_posted'];
  21. $title = $post['title'];
  22. $tags = $post['tags'];
  23. $file = $post['file_name'];
  24. $files = explode(',', $file);
  25. $post = $post['description'];
  26. $reply_msg = "";
  27. $replies = $db->select('comments', "reply_id=? AND service=?", array($post_id, 'podcast'), 'count(*) cnt');
  28. $reply_count = $replies['cnt'];
  29. if ($reply_count > 0)
  30. {
  31. $reply_msg = " | <a href='".get_page_url("podcast", $CONF)."/".$post_id."#replies'>Replies:".$reply_count."</a>";
  32. }
  33. ?>
  34. <script>
  35. var converter = new Markdown.getSanitizingConverter();
  36. var old_post = $("#post_<?php echo $post_id; ?>").text();
  37. var new_post = converter.makeHtml(old_post);
  38. $("#post_<?php echo $post_id; ?>").html(new_post);
  39. </script>
  40. <div class="row">
  41. <div class="col-sm-10 col-sm-offset-1">
  42. <div class="podcast-post">
  43. <h2 class="podcast-post-title text-center"><a href="<?php echo get_page_url("podcast", $CONF); ?>/<?php echo $post_id; ?>" id="title_<?php echo $post_id; ?>"><?php echo $title; ?></a></h2>
  44. <p class="podcast-post-meta text-center text-muted">
  45. Posted on <?php echo date("F d, Y",strtotime($date)); ?><?php echo $reply_msg; ?>
  46. <?php
  47. if ($user->admin)
  48. {
  49. ?>
  50. <br />
  51. <button type="button" class="btn btn-info edit_post" id="<?php echo $post_id; ?>" data-toggle="modal" data-target="#editPodcast">Edit</button>
  52. <button type="button" class="btn btn-danger delete_post" id="<?php echo $post_id; ?>">Delete</button>
  53. <?php
  54. }
  55. ?>
  56. </p>
  57. <div class="text-center">
  58. <audio preload="none" controls>
  59. <?php
  60. foreach ($files as $filename)
  61. {
  62. $file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
  63. $direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
  64. if (file_exists($direct_path))
  65. {
  66. $file_type = mime_content_type($direct_path);
  67. ?>
  68. <source src="<?php echo $file_path; ?>" type="<?php echo $file_type; ?>" />
  69. <?php
  70. }
  71. }
  72. ?>
  73. </audio>
  74. </div>
  75. <br />
  76. <p id="post_<?php echo $post_id; ?>"><?php echo $post; ?></p>
  77. <?php
  78. foreach ($files as $filename)
  79. {
  80. $file_path = get_page_url("podcast", $CONF).'/Podcasts/'.$title.'/'.$filename;
  81. $direct_path = $CONF['podcast_dir'].$title.'/'.$filename;
  82. if (file_exists($direct_path))
  83. {
  84. $file_type = mime_content_type($direct_path);
  85. ?>
  86. <div class="row text-center">
  87. <a href="<?php echo $file_path; ?>">Direct Download - <?php echo explode('/', $file_type)[1]; ?></a>
  88. </div>
  89. <?php
  90. }
  91. }
  92. ?>
  93. </div>
  94. </div>
  95. </div>
  96. <?php
  97. }
  98. }
  99. }
  100. ?>