album.php 4.6 KB

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