album.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. $cur_section = $lng['section_gallery'];
  9. //Get album
  10. $perm = mysqli_real_escape_string($con, $_GET['perm']);
  11. $q = mysqli_query($con, "SELECT id, permalink, title_$lang AS title, description_$lang AS description, user, open, dtime FROM album WHERE permalink = '$perm';");
  12. if (mysqli_num_rows($q) == 0){
  13. header("Location: /galeria/");
  14. exit (-1);
  15. }
  16. else{
  17. $r = mysqli_fetch_array($q);
  18. ?>
  19. <!DOCTYPE html>
  20. <html>
  21. <head>
  22. <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
  23. <meta charset="utf-8"/>
  24. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  25. <title><?php echo $r['title'];?></title>
  26. <link rel="shortcut icon" href="<?php echo "http://$http_host/img/logo/favicon.ico";?>">
  27. <!-- CSS files -->
  28. <style>
  29. <?php
  30. include("../css/ui.css");
  31. include("../css/galeria.css");
  32. ?>
  33. </style>
  34. <!-- CSS for mobile version -->
  35. <style media="(max-width : 990px)">
  36. <?php
  37. include("../css/m/ui.css");
  38. include("../css/m/galeria.css");
  39. ?>
  40. </style>
  41. <!-- Script files -->
  42. <script type="text/javascript">
  43. <?php
  44. include("../script/ui.js");
  45. include("../script/galeria.js");
  46. ?>
  47. </script>
  48. <!-- Meta tags -->
  49. <link rel="canonical" href="<?php echo "http://$http_host/galeria/$perm"; ?>"/>
  50. <link rel="author" href="<?php echo "http://$http_host"; ?>"/>
  51. <link rel="publisher" href="<?php echo "http://$http_host"; ?>"/>
  52. <meta name="description" content="<?php echo strip_tags($r['description']);?>"/>
  53. <meta property="og:title" content="<?php echo $l['title'];?>"/>
  54. <meta property="og:url" content="<?php echo "http://$http_host/galeria/$perm"; ?>"/>
  55. <meta property="og:description" content="<?php echo strip_tags($r['description']); ?>"/>
  56. <meta property="og:image" content="<?php echo "http://$http_host/img/logo/logo.png";?>"/>
  57. <meta property="og:site_name" content="Gasteizko Margolariak"/>
  58. <meta property="og:type" content="website"/>
  59. <meta property="og:locale" content="<?php echo $lang; ?>"/>
  60. <meta name="twitter:card" content="summary"/>
  61. <meta name="twitter:title" content="<?php echo $l['title'];?>"/>
  62. <meta name="twitter:description" content="<?php echo strip_tags($r['description']); ?>"/>
  63. <meta name="twitter:image" content="<?php echo "http://$http_host/img/logo/logo.png";?>"/>
  64. <meta name="twitter:url" content="<?php echo "http://$http_host/galeria/$perm"; ?>"/>
  65. <meta name="robots" content="index follow"/>
  66. </head>
  67. <body onLoad="populatePhotos();" onkeypress="keyDown(event);">
  68. <?php include("../header.php"); ?>
  69. <div id="content">
  70. <div class="section" id="album">
  71. <?php
  72. //Header
  73. echo "<h3 id='album_title'>$r[title]</h3>\n";
  74. if ($r['description'] != ''){
  75. echo "<div class='entry' id='album_header'>\n";
  76. echo $r['description'];
  77. echo "</div>\n";
  78. }
  79. //Photos of the album
  80. $q_photo = mysqli_query($con, "SELECT id, file, permalink, title_$lang AS title, description_$lang AS description, photo.dtime AS dtime, uploaded, width, height, size, user, username FROM photo, photo_album WHERE photo_album.photo = id AND album = $r[id] ORDER BY photo.dtime DESC;");
  81. /* TODO AND approved = 1*/
  82. while ($r_photo = mysqli_fetch_array($q_photo)){
  83. echo "<div class='entry photo'>\n<div class='photo_container'>\n";
  84. echo "<img class='pointer photo_img' path='$r_photo[file]' onClick=\"showPhotoByPath('$r_photo[file]');\" src='/img/galeria/miniature/$r_photo[file]' /></div>\n";
  85. if (strlen($r_photo['title']) > 0 ){
  86. echo "<h4><a href='javascript:;' onClick=\"showPhotoByPath('$r_photo[file]');\">$r_photo[title]</a></h4>\n";
  87. }
  88. if (strlen($r_photo['description']) > 0 ){
  89. echo "<span class='photo_description'>" . cutText($r_photo['description'], 50) . "</span>\n";
  90. }
  91. //Count comments
  92. $q_comments = mysqli_query($con, "SELECT id FROM photo_comment WHERE photo = $r_photo[id];");
  93. echo "<span class='comment_counter'>" . mysqli_num_rows($q_comments) . "<img src='http://$http_host/img/misc/comment.png' alt=' '/></span>\n"; //TODO: icon
  94. echo "\n</div>\n";
  95. }
  96. ?>
  97. </div>
  98. </div>
  99. <div id="screen_cover" onClick="closeViewer();">
  100. </div>
  101. <div id="photo_viewer" class="section">
  102. </div>
  103. <?php include("../footer.php"); ?>
  104. </body>
  105. </html>
  106. <?php } ?>