index.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. session_start();
  3. include("../functions.php");
  4. $con = startdb();
  5. $proto = getProtocol();
  6. $http_host = $_SERVER['HTTP_HOST'];
  7. $server = "$proto" . "$http_host";
  8. //Language
  9. $lang = selectLanguage();
  10. include("../lang/lang_" . $lang . ".php");
  11. $cur_section = $lng['section_lablanca'];
  12. //Is festivals enabled in settings?
  13. $q = mysqli_query($con, "SELECT value FROM settings WHERE name = 'festivals';");
  14. if (mysqli_num_rows($q) == 0)
  15. $is_festivals = false;
  16. else{
  17. $r = mysqli_fetch_array($q);
  18. if ($r['value'] == 1){
  19. $is_festivals = true;
  20. }
  21. else{
  22. $is_festivals = false;
  23. }
  24. }
  25. //Get year
  26. $year = date("Y");
  27. //if (is_int($_GET['year']) == false){
  28. if ($_GET['year'] != ''){
  29. $q_year = mysqli_query($con, "SELECT id FROM festival WHERE year = " . mysqli_real_escape_string($con, $_GET['year']));
  30. if (mysqli_num_rows($q_year) > 0){
  31. $year = $_GET['year'];
  32. $is_festivals = true;
  33. }
  34. }
  35. //echo $_GET['year'];
  36. ?>
  37. <!DOCTYPE html>
  38. <html>
  39. <head>
  40. <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
  41. <meta charset="utf-8"/>
  42. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  43. <title>
  44. <?php
  45. if ($is_festivals){
  46. echo str_replace('#', $year, $lng['lablanca_title']);
  47. }
  48. else{
  49. echo $lng['lablanca_no_title'];
  50. }
  51. ?>
  52. - Gasteizko Margolariak
  53. </title>
  54. <link rel="shortcut icon" href="<?php echo "$proto$http_host/img/logo/favicon.ico";?>">
  55. <!-- CSS files -->
  56. <style>
  57. <?php
  58. include("../css/ui.css");
  59. include("../css/lablanca.css");
  60. ?>
  61. </style>
  62. <!-- CSS for mobile version -->
  63. <style media="(max-width : 990px)">
  64. <?php
  65. include("../css/m/ui.css");
  66. include("../css/m/lablanca.css");
  67. ?>
  68. </style>
  69. <!-- Script files -->
  70. <script type="text/javascript">
  71. <?php
  72. include("../script/ui.js");
  73. include("../script/lablanca.js");
  74. ?>
  75. </script>
  76. <!-- Meta tags -->
  77. <link rel="canonical" href="<?php echo "$proto$http_host/lablanca/"; ?>"/>
  78. <link rel="author" href="<?php echo "$proto$http_host"; ?>"/>
  79. <link rel="publisher" href="<?php echo "$proto$http_host"; ?>"/>
  80. <meta name="description" content="<?php echo $lng['lablanca_description'];?>"/>
  81. <meta property="og:title"
  82. content="<?php
  83. if ($is_festivals){
  84. echo str_replace('#', $year, $lng['lablanca_title']);
  85. }
  86. else{
  87. echo $lng['lablanca_no_title'];
  88. }
  89. ?> - Gasteizko Margolariak"
  90. />
  91. <meta property="og:url" content="<?php echo "$proto$http_host"; ?>"/>
  92. <meta property="og:description" content="<?php echo $lng['lablanca_description'];?>"/>
  93. <meta property="og:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
  94. <meta property="og:site_name" content="<?php echo $lng['lablanca_title'];?>"/>
  95. <meta property="og:type" content="website"/>
  96. <meta property="og:locale" content="<?php echo $lang; ?>"/>
  97. <meta name="twitter:card" content="summary"/>
  98. <meta name="twitter:title"
  99. content="<?php
  100. if ($is_festivals){
  101. echo str_replace('#', $year, $lng['lablanca_title']);
  102. }
  103. else{
  104. echo $lng['lablanca_no_title'];
  105. }
  106. ?> - Gasteizko Margolariak"
  107. />
  108. <meta name="twitter:description" content="<?php echo $lng['lablanca_description'];?>"/>
  109. <meta name="twitter:image" content="<?php echo "$proto$http_host/img/logo/logo.png";?>"/>
  110. <meta name="twitter:url" content="<?php echo"$proto$http_host"; ?>"/>
  111. <meta name="robots" content="index follow"/>
  112. </head>
  113. <body>
  114. <?php include("../header.php"); ?>
  115. <div id="content">
  116. <?php
  117. //Include file
  118. if ($is_festivals){
  119. include("fiestas.php");
  120. }
  121. else{
  122. include("nofiestas.php");
  123. }
  124. ?>
  125. <?php
  126. //If the program of previous years exist, show a drop list
  127. $year = date("Y");
  128. if (date("M") <= 8 || (date("M") == 8 && date("D") < 25)){
  129. $year --;
  130. }
  131. if (date("M") <= 8){
  132. $q_years = mysqli_query($con, "SELECT year FROM festival WHERE year != " . date("Y") . " ORDER BY year DESC;");
  133. }
  134. else{
  135. $q_years = mysqli_query($con, "SELECT year FROM festival WHERE year <= " . date("Y") . " ORDER BY year DESC;");
  136. }
  137. if (mysqli_num_rows($q_years) >= 0){
  138. echo("<br/><br/><div class='section' id='past_festivals'>\n");
  139. echo("<h3 class='section_title'>$lng[lablanca_past_title]</h3>\n");
  140. echo("<div class='entry'><ul>\n");
  141. while ($r_years = mysqli_fetch_array($q_years)){
  142. echo("<li><a href='$proto$http_host/lablanca/$r_years[year]'>$lng[lablanca_past_link] $r_years[year]</a></li>\n");
  143. }
  144. echo("</ul></div>\n");
  145. echo("</div>\n");
  146. }
  147. ?>
  148. </div>
  149. <?php
  150. include("../footer.php");
  151. $ad = ad($con, $lang, $lng);
  152. stats($ad, $ad_static, "fiestas", "");
  153. ?>
  154. </body>
  155. </html>