load_photo.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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, uploaded, 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['uploaded'], $lang) . "</span>\n";
  36. if (strlen($r['username']) > 0){
  37. echo "<span id='photo_user'>$lng[gallery_user]$r[username]</span>\n";
  38. }
  39. echo "</div>\n";
  40. $q_comment = mysqli_query($con, "SELECT * FROM photo_comment WHERE photo = $r[id];");
  41. $comment_count = mysqli_num_rows($q_comment);
  42. echo "<div class='entry' id='comments_section'/>\n";
  43. echo "<div id='photo_viewer_comment_counter'>\n";
  44. switch ($comment_count){
  45. case 0:
  46. echo "<h4><meta itemprop='interactionCount' content='0'/>$lng[gallery_comment_count_0]</h4>\n";
  47. break;
  48. case 1:
  49. echo "<h4><span itemprop='interactionCount'>1</span> $lng[gallery_comment_count_1]</h4>\n";
  50. break;
  51. default:
  52. echo "<h4><span itemprop='interactionCount'>$comment_count</span> $lng[gallery_comment_count_several]</h4>\n";
  53. }
  54. echo "</div>\n";
  55. echo "<div id='comment_list'>\n";
  56. //WARNING: If changes are done here, do the same in comment.php
  57. while ($r_comment = mysqli_fetch_array($q_comment)){
  58. echo "<div itemprop='comment' itemscope itemtype='http://schema.org/UserComments' id='comment_$r_comment[id]' class='comment'>\n";
  59. //When official users are implementes, see if there is user or username
  60. echo "<span itemprop='creator' class='comment_user'>$r_comment[username]</span>\n";
  61. echo "<span class='comment_date date'><meta itemprop='commentTime' content='$r_comment[isodate]'/>" . formatDate($r_comment['dtime'], $lang) . "</span>\n";
  62. echo "<p itemprop='commentText' class='comment_text'>$r_comment[text]</p>";
  63. echo "<hr class='comment_line'/>\n";
  64. echo "</div>\n";
  65. }
  66. echo "</div>\n";
  67. #Comment form
  68. echo "<div class='comment' id='comment_new'>\n";
  69. echo "<form id='comment_form' method='post' action='/' onsubmit='event.preventDefault();postComment($r[id], \"$lang\");'>\n";
  70. echo "<textarea id='new_comment_text' name='text' maxlength='1800' onChange='defaultInputBorder(this);' onKeyDown='defaultInputBorder(this);' placeholder='$lng[blog_placeholder_text]'></textarea>\n";
  71. //echo "<input type='hidden' name='id' value='$id'>\n";
  72. echo "<div id='identification_form'>\n";
  73. 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";
  74. echo "<input type='submit' value='$lng[blog_send]'/>\n";
  75. echo "</div>\n";
  76. echo "</form>\n";
  77. echo "</div>\n"; //New comment
  78. echo "</div>\n"; //Comments
  79. echo "</div>\n"; //Cell
  80. echo "</div>\n"; //Row
  81. echo "</div>\n"; //Table
  82. stats(-1, 0, "photo", "$r[id]");
  83. }
  84. ?>