load_photo.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. $http_host = $_SERVER['HTTP_HOST'];
  3. include("../functions.php");
  4. $con = startdb();
  5. //Language
  6. $lang = selectLanguage();
  7. include("../lang/lang_" . $lang . ".php");
  8. //Get photo data
  9. $path = mysqli_real_escape_string($con, $_GET['path']);
  10. $q = mysqli_query($con, "SELECT id, file, permalink, title_$lang AS title, description_$lang AS description, dtime, size, user, username FROM photo WHERE file = '$path' AND approved = 1");
  11. if (mysqli_num_rows($q) == 0){
  12. exit(0);
  13. }
  14. else{
  15. $r = mysqli_fetch_array($q);
  16. echo "<div id='viewer_table'><div class='viewer_row'><div class='viewer_cell' id='cell_image'>\n";
  17. echo "<img id='photo_viewer_image' src='/img/galeria/preview/$r[file]'/>\n";
  18. echo "</br>\n";
  19. //Arrows
  20. echo "<div id='viewer_controls'>\n";
  21. echo "<img id='viewer_arrow_left' class='pointer' alt=' ' src='http://$http_host/img/misc/slid-left.png' onClick='scrollPhoto(-1);'/>\n";
  22. echo "<img id='viewer_arrow_right' class='pointer' alt=' ' src='http://$http_host/img/misc/slid-right.png' onClick='scrollPhoto(1);'/>\n";
  23. echo "<img id='viewer_close' class='pointer mobile' alt=' ' src='http://$http_host/img/misc/close.png' onClick='closeViewer();'/>\n";
  24. echo "</div>\n"; //viewer_controls
  25. echo "</div>\n"; //cell
  26. echo "<div class='viewer_cell' id='cell_details'>\n";
  27. echo "<div id='photo_viewer_details'>\n";
  28. echo "<div class='entry' id='photo_data'>\n";
  29. if (strlen($r['title']) > 0){
  30. echo "<h4>$r[title]</h4>\n";
  31. }
  32. if (strlen($r['description']) > 0){
  33. echo "<span id='photo_description'>$r[description]</span>\n";
  34. }
  35. echo "<span id='photo_date'>" . formatDate($r['dtime'], $lang) . "</span>\n";
  36. echo "</div>\n";
  37. $q_comment = mysqli_query($con, "SELECT * FROM photo_comment WHERE photo = $r[id];");
  38. $comment_count = mysqli_num_rows($q_comment);
  39. echo "<div class='entry' id='comments_section'/>\n";
  40. echo "<div id='photo_viewer_comment_counter'>\n";
  41. switch ($comment_count){
  42. case 0:
  43. echo "<h4><meta itemprop='interactionCount' content='0'/>$lng[gallery_comment_count_0]</h4>\n";
  44. break;
  45. case 1:
  46. echo "<h4><span itemprop='interactionCount'>1</span> $lng[gallery_comment_count_1]</h4>\n";
  47. break;
  48. default:
  49. echo "<h4><span itemprop='interactionCount'>$comment_count</span> $lng[gallery_comment_count_several]</h4>\n";
  50. }
  51. echo "</div>\n";
  52. echo "<div id='comment_list'>\n";
  53. //WARNING: If changes are done here, do the same in comment.php
  54. while ($r_comment = mysqli_fetch_array($q_comment)){
  55. echo "<div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_$r_comment[id]' class='comment'>\n";
  56. //When official users are implementes, see if there is user or username
  57. echo "<span itemprop='creator' class='comment_user'>$r_comment[username]</span>\n";
  58. echo "<span class='comment_date date'><meta itemprop='commentTime' content='$r_comment[isodate]'/>" . formatDate($r_comment['dtime'], $lang) . "</span>\n";
  59. echo "<p itemprop='commentText' class='comment_text'>$r_comment[text]</p>";
  60. echo "<hr class='comment_line'/>\n";
  61. echo "</div>\n";
  62. }
  63. echo "</div>\n";
  64. #Comment form
  65. echo "<div class='comment' id='comment_new'>\n";
  66. echo "<form id='comment_form' method='post' action='/' onsubmit='event.preventDefault();postComment($r[id], \"$lang\");'>\n";
  67. echo "<textarea id='new_comment_text' name='text' maxlength='1800' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);' placeholder='$lng[blog_placeholder_text]'></textarea>\n";
  68. //echo "<input type='hidden' name='id' value='$id'>\n";
  69. echo "<div id='identification_form'>\n";
  70. echo "<br><input id='new_comment_user' name='user' maxlength='50' type='text' placeholder='$lng[blog_placeholder_name]' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);'/>\n";
  71. echo "<input type='submit' value='$lng[blog_send]'/>\n";
  72. echo "</div>\n";
  73. echo "</form>\n";
  74. echo "</div>\n"; //New comment
  75. echo "</div>\n"; //Comments
  76. echo "</div>\n"; //Cell
  77. echo "</div>\n"; //Row
  78. echo "</div>\n"; //Table
  79. stats(-1, 0, "photo", "$r[id]");
  80. }
  81. ?>