Home > Panele > Ostatnie komentarze

Ostatnie komentarze

Dodane przez: piciu
opis:
Kod pokazuje ostatnie 10 komentarzy
Kod:
  1. if (!defined("IN_FUSION")) { die("Access Denied"); }
  2.  
  3. $displayComments = 15;
  4.  
  5. openside($locale['global_025']);
  6.  
  7. $result
  8. = dbquery(" SELECT comment_id, comment_item_id, comment_type, comment_message
  9. FROM "
  10. .DB_COMMENTS."
  11. WHERE comment_hidden='0'
  12. ORDER BY comment_datestamp DESC
  13. "
  14. );
  15. if (dbrows($result)) {
  16. $output = "";
  17. $i = 0;
  18. while($data = dbarray($result)) {
  19. if ($i == $displayComments) { break; }
  20. switch ($data['comment_type']) {
  21. case "N":
  22. $access = dbcount( "(news_id)", DB_NEWS,
  23. "news_id='".$data['comment_item_id'
  24. ]."' AND
  25. "
  26. .groupaccess('news_visibility'
  27. )." AND
  28. (news_start='0'||news_start<="
  29. .time().") AND
  30. (news_end='0'||news_end>="
  31. .time().") AND
  32. news_draft='0'
  33. "
  34. );
  35. if ($access > 0) {
  36. $comment = trimlink($data['comment_message'], 60);
  37. $commentStart = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$data['comment_item_id']."' AND comment_type='N' AND comment_id<=".$data['comment_id']);
  38. if ($commentStart > $settings['comments_per_page']) {
  39. $commentStart = "&amp;c_start=".floor($commentStart / $settings['comments_per_page']) * $settings['comments_per_page'];
  40. } else {
  41. $commentStart = "";
  42. }
  43. $output .= THEME_BULLET." <font color='yellow' style='box-shadow: 0 0 8px 2px yellow'>[NEWS]</font> <a href='".BASEDIR."news.php?readmore=".$data['comment_item_id'].$commentStart."#c".$data['comment_id']."' title='".$comment."' class='side'>".$comment."</a><br />\n";
  44. $i++;
  45. }
  46. case "A":
  47. $access = dbquery(" SELECT article_id FROM ".DB_ARTICLES." a, "
  48. .DB_ARTICLE_CATS." c WHERE
  49. a.article_id='"
  50. .$data['comment_item_id'
  51. ]."' AND
  52. a.article_cat=c.article_cat_id AND
  53. "
  54. .groupaccess('c.article_cat_access'
  55. )." AND
  56. a.article_draft='0'
  57. "
  58. );
  59. if (dbrows($access) > 0) {
  60. $comment = trimlink($data['comment_message'], 60);
  61. $commentStart = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$data['comment_item_id']."' AND comment_type='A' AND comment_id<=".$data['comment_id']);
  62. if ($commentStart > $settings['comments_per_page']) {
  63. $commentStart = "&amp;c_start=".floor($commentStart / $settings['comments_per_page']) * $settings['comments_per_page'];
  64. } else {
  65. $commentStart = "";
  66. }
  67. $output .= THEME_BULLET." [ARTYKUŁ] <a href='".BASEDIR."articles.php?article_id=".$data['comment_item_id'].$commentStart."#c".$data['comment_id']."' title='".$comment."' class='side'>".$comment."</a><br />\n";
  68. $i++;
  69. }
  70. case "P":
  71. $access = dbquery(" SELECT photo_id FROM ".DB_PHOTOS." p, "
  72. .DB_PHOTO_ALBUMS." a WHERE
  73. p.photo_id='"
  74. .$data['comment_item_id'
  75. ]."' AND
  76. p.album_id=a.album_id AND
  77. "
  78. .groupaccess('a.album_access')
  79. );
  80. if (dbrows($access) > 0) {
  81. $comment = trimlink($data['comment_message'], 60);
  82. $commentStart = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$data['comment_item_id']."' AND comment_type='P' AND comment_id<=".$data['comment_id']);
  83. if ($commentStart > $settings['comments_per_page']) {
  84. $commentStart = "&amp;c_start=".floor($commentStart / $settings['comments_per_page']) * $settings['comments_per_page'];
  85. } else {
  86. $commentStart = "";
  87. }
  88. $output .= THEME_BULLET." <font color='greenyellow' style='box-shadow: 0 0 8px 2px yellowgreen'>[GALERIA]</font> <a href='".BASEDIR."photogallery.php?photo_id=".$data['comment_item_id'].$commentStart."#c".$data['comment_id']."' title='".$comment."' class='side'>".$comment."</a><br />\n";
  89. $i++;
  90. }
  91. case "C":
  92. $access = dbcount("(page_id)", DB_CUSTOM_PAGES, "page_id='".$data['comment_item_id']."' AND ".groupaccess('page_access'));
  93. if ($access > 0) {
  94. $comment = trimlink($data['comment_message'], 60);
  95. $commentStart = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$data['comment_item_id']."' AND comment_type='C' AND comment_id<=".$data['comment_id']);
  96. if ($commentStart > $settings['comments_per_page']) {
  97. $commentStart = "&amp;c_start=".floor($commentStart / $settings['comments_per_page']) * $settings['comments_per_page'];
  98. } else {
  99. $commentStart = "";
  100. }
  101. $output .= THEME_BULLET." <a href='".BASEDIR."viewpage.php?page_id=".$data['comment_item_id'].$commentStart."#c".$data['comment_id']."' title='".$comment."' class='side'>".$comment."</a><br />\n";
  102. $i++;
  103. }
  104. case "D":
  105. $access = dbquery(" SELECT download_id FROM ".DB_DOWNLOADS." d, "
  106. .DB_DOWNLOAD_CATS." c WHERE
  107. d.download_id='"
  108. .$data['comment_item_id'
  109. ]."' AND
  110. d.download_cat=c.download_cat_id AND
  111. "
  112. .groupaccess('c.download_cat_access')
  113. );
  114. if (dbrows($access) > 0) {
  115. $comment = trimlink($data['comment_message'], 60);
  116. $commentStart = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='".$data['comment_item_id']."' AND comment_type='D' AND comment_id<=".$data['comment_id']);
  117. if ($commentStart > $settings['comments_per_page']) {
  118. $commentStart = "&amp;c_start=".floor($commentStart / $settings['comments_per_page']) * $settings['comments_per_page'];
  119. } else {
  120. $commentStart = "";
  121. }
  122. $output .= THEME_BULLET." [PLIK] <a href='".BASEDIR."downloads.php?download_id=".$data['comment_item_id'].$commentStart."#c".$data['comment_id']."' title='".$comment."' class='side'>".$comment."</a><br />\n";
  123. $i++;
  124. }
  125. }
  126. }
  127. echo $output;
  128. } else {
  129. echo "<div style='text-align:center'>".$locale['global_026']."</div>\n";
  130. }
  131. closeside();

©