load_photo.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. $http_host = $_SERVER["HTTP_HOST"];
  3. include("../functions.php");
  4. $con = startdb();
  5. $proto = getProtocol();
  6. $server = "$proto$http_host";
  7. //Language
  8. $lang = selectLanguage();
  9. include("../lang/lang_$lang.php");
  10. //Get photo data
  11. $path = mysqli_real_escape_string($con, $_GET["path"]);
  12. $q = mysqli_query($con, "SELECT id, file, permalink, title_$lang AS title, description_$lang AS description, uploaded, size, user, username FROM photo WHERE file = '$path' AND approved = 1");
  13. if (mysqli_num_rows($q) == 0){
  14. exit(0);
  15. }
  16. else{
  17. $r = mysqli_fetch_array($q);
  18. // Get album name
  19. $q_album = mysqli_query($con, "SELECT album.title_$lang AS title FROM album, photo_album WHERE album = album.id AND photo = $r[id]");
  20. $r_album = mysqli_fetch_array($q_album);
  21. ?>
  22. <h3 class='section_title'>
  23. <?php
  24. if (strlen($r["title"]) > 0){
  25. echo($r["title"]);
  26. }
  27. else{
  28. echo($r_album["title"]);
  29. }
  30. ?>
  31. <div id='viewer_close_container'>
  32. <img id='viewer_close' class='pointer' alt=' ' src='<?=$server?>/img/misc/close.png' onClick='closeViewer();'/>
  33. </div>
  34. </h3>
  35. <div id='viewer_container'>
  36. <div id='viewer_table'>
  37. <div class='viewer_row'>
  38. <div class='viewer_cell' id='cell_image'>
  39. <div class='entry' id='photo_data'>
  40. <table>
  41. <tr>
  42. <td class='arrow'>
  43. <img id='viewer_arrow_left' class='viewer_arrow pointer' alt=' ' src='<?=$server?>/img/misc/slid-left.png' onClick='scrollPhoto(-1);'/>
  44. </td>
  45. <td id='image'>
  46. <div id='photo_viewer_image_container'>
  47. <img id='photo_viewer_image' src='/img/galeria/preview/<?=$r["file"]?>'/>
  48. </div>
  49. </td>
  50. <td class='arrow'>
  51. <img id='viewer_arrow_right' class='viewer_arrow pointer' alt=' ' src='<?=$server?>/img/misc/slid-right.png' onClick='scrollPhoto(1);'/>
  52. </td>
  53. </tr>
  54. </table>
  55. <?php
  56. if (strlen($r["description"]) > 0){
  57. ?>
  58. <span id='photo_description'><?=$r["description"]?></span>
  59. <?php
  60. }
  61. ?>
  62. <span id='photo_date'><?=formatDate($r["uploaded"], $lang)?></span>
  63. <?php
  64. if (strlen($r["username"]) > 0){
  65. ?>
  66. <span id='photo_user'><?=$lng["gallery_user"]?><?=$r["username"]?></span>
  67. <?php
  68. }
  69. ?>
  70. </div> <!-- #photo_data -->
  71. </div> <!-- #cell_image -->
  72. <div class='viewer_cell' id='cell_comments'>
  73. <div id='photo_viewer_details'>
  74. <?php
  75. $q_comment = mysqli_query($con, "SELECT * FROM photo_comment WHERE photo = $r[id];");
  76. $comment_count = mysqli_num_rows($q_comment);
  77. ?>
  78. <div class='entry' id='comments_section'>
  79. <div id='photo_viewer_comment_counter'>
  80. <?php
  81. switch ($comment_count){
  82. case 0:
  83. ?>
  84. <h3 class='entry_title'>
  85. <meta itemprop='interactionCount' content='0'/><?=$lng["gallery_comment_count_0"]?>
  86. </h3>
  87. <?php
  88. break;
  89. case 1:
  90. ?>
  91. <h3 class='entry_title'>
  92. <span itemprop='interactionCount'>1 </span><?=$lng["gallery_comment_count_1"]?>
  93. </h3>
  94. <?php
  95. break;
  96. default:
  97. ?>
  98. <h3 class='entry_title'>
  99. <span itemprop='interactionCount'><?=$comment_count?></span> <?=$lng["gallery_comment_count_several"]?>
  100. </h3>
  101. <?php
  102. }
  103. ?>
  104. </div> <!-- #photo_viewer_comment_counter -->
  105. <div id='comment_list'>
  106. <?php
  107. while ($r_comment = mysqli_fetch_array($q_comment)){
  108. ?>
  109. <div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_<?=$r_comment["id"]?>' class='comment'>
  110. <span itemprop='creator' class='comment_user'><?=$r_comment["username"]?></span>
  111. <span class='comment_date date'><meta itemprop='commentTime' content='<?=$r_comment["isodate"]?>'/><?=formatDate($r_comment["dtime"], $lang)?></span>
  112. <p itemprop='commentText' class='comment_text'><?=$r_comment["text"]?></p>
  113. <hr class='comment_line'/>
  114. </div>
  115. <?php
  116. }
  117. ?>
  118. </div> <!-- #comment_list -->
  119. <!-- Comment form -->
  120. <div class='comment' id='comment_new'>
  121. <form id='comment_form' method='post' action='/' onsubmit='event.preventDefault();postComment(<?=$r["id"]?>, "<?=$lang?>");'>
  122. <textarea id='new_comment_text' name='text' maxlength='1800' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);' placeholder='<?=$lng[blog_placeholder_text]?>'></textarea>
  123. <div id='identification_form'>
  124. <br/>
  125. <input id='new_comment_user' name='user' maxlength='50' type='text' placeholder='<?=$lng["blog_placeholder_name"]?>' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);'/>
  126. <input type='submit' value='<?=$lng["blog_send"]?>'/>
  127. </div> <!-- #identification_form -->
  128. </form>
  129. </div> <!-- #comment_new -->
  130. </div> <!-- #comments_section -->
  131. </div> <!-- $photo_viewer_details -->
  132. </div> <!-- #cell_comments -->
  133. </div> <!-- #viewer_row -->
  134. </div> <!-- #viewer_table -->
  135. </div> <!-- #viewer_container -->
  136. <?php
  137. stats(-1, 0, "photo", "$r[id]");
  138. }
  139. ?>