Advertisement
Guest User

xchan recent images crappy fix

a guest
Feb 3rd, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. <?php
  2. /*
  3. * Hurrchan 0.1.x EDIT
  4. * Recent Images Script CRAPPY EDIT, v 1.3
  5. * http://www.hurrchan.net/dev/
  6. *
  7. * NEW IN THIS VERSION:
  8. * - Uses config.php to get database & site information
  9. * - Added the ability to omit boards completely
  10. * - Added the ability to display the thread number under the image
  11. *
  12. * Report software bugs to services@hurrchan.net
  13. */
  14. $only_op = false; // Enable this if you want to show only OP's pic
  15. $displayimages = 10; // Number of images to display
  16. $nsfw = Array('a', 'b', 'c'); // NSFW boards to not display images from
  17. $hidensfw = true; // Replace images from NSFW boards with a placeholder
  18. $nsfwholder = "nsfw.png"; // Path to NSFW image placeholder
  19. $showthreadname = true; // Show thread number link under each image
  20. $omitboards = "1, 2"; // ID numbers of boards to omit completely
  21.  
  22. /*
  23. * DO NOT MODIFY ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
  24. */
  25.  
  26. require_once ('config.php');
  27. $sqlquery = "SELECT HIGH_PRIORITY * FROM `".KU_DBPREFIX."posts` WHERE (`file_type` = 'jpg' OR `file_type` = 'gif' OR `file_type` = 'png') AND `boardid` NOT IN (". $omitboards .") AND `is_deleted` = 0";
  28.  
  29. if ($only_op)
  30. $sqlquery .= " AND `parentid` = 0";
  31. $sqlquery .= " ORDER BY `timestamp` DESC LIMIT " . $displayimages ;
  32.  
  33. $results = $tc_db->GetAll($sqlquery);
  34.  
  35. echo "<br />";
  36.  
  37. foreach ($results as $result) {
  38. $real_parentid = ($result['parentid'] == 0) ? $result['id'] : $result['parentid'];
  39. $result['boardname'] = $tc_db->GetOne("SELECT `name` FROM `".KU_DBPREFIX."boards` WHERE `id` = '".$result['boardid']."'");
  40. echo '<td align="center"><br /><a href="'. KU_WEBPATH . '/' . $result['boardname'] . '/res/'. $real_parentid . '.html#'. $result['id'] . '">';
  41.  
  42. if (in_array($result['boardname'], $nsfw)) {
  43. if ($hidensfw) {
  44. echo '<img src="' . $nsfwholder . '"border="0">';
  45. if ($showthreadname) {
  46. echo "<br />";
  47. echo '>>>/' . $result['boardname'] . '/' . $result['id'] . '</a></tr>';
  48. } else {
  49. echo '</a></td>';
  50. }
  51. } else {
  52. echo '<img src="'. KU_WEBPATH . '/' . $result['boardname'] . '/thumb/'. $result['file'] . 's.'. $result['file_type'] . '" width="'. $result['thumb_w'] . '" height="'. $result['thumb_h'] . '" border="0" />';
  53. if ($showthreadname) {
  54. echo "<br />";
  55. echo '>>>/' . $result['boardname'] . '/' . $result['id'] . '</a></td>';
  56. } else {
  57. echo '</a></td>';
  58. }
  59. }
  60. } else {
  61. echo '<img src="'. KU_WEBPATH . '/' . $result['boardname'] . '/thumb/'. $result['file'] . 's.'. $result['file_type'] . '" width="'. $result['thumb_w'] . '" height="'. $result['thumb_h'] . '" border="0" />';
  62. if ($showthreadname) {
  63. echo "<br />";
  64. echo '>>>/' . $result['boardname'] . '/' . $result['id'] . '</a></tr>';
  65. } else {
  66. echo '</a></td>';
  67. }
  68. }
  69. }
  70. echo "</tr>";
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement