sitemap.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. header('Content-type: application/xml');
  3. $http_host = $_SERVER['HTTP_HOST'];
  4. include("functions.php");
  5. $con = startdb();
  6. $proto = getProtocol();
  7. $server = "$proto$http_host";
  8. ?>
  9. <?xml version="1.0" encoding="UTF-8"?>
  10. <urlset
  11. xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  12. xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
  13. <url>
  14. <loc><?=$server?>/</loc>
  15. <?php
  16. $res_date = mysqli_query($con, "(SELECT DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM post) UNION (SELECT DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM activity) UNION (SELECT DATE_FORMAT(uploaded, '%Y-%m-%d') AS cdate FROM photo) ORDER BY cdate DESC LIMIT 1;");
  17. $row_date = mysqli_fetch_array($res_date);
  18. ?>
  19. <lastmod><?=$row_date["cdate"]?></lastmod>
  20. <changefreq>weekly</changefreq>
  21. <priority>0.8</priority>
  22. <image:image>
  23. <image:loc><?=$server?>/img/logo/GasteizkoMargolariak.png</image:loc>
  24. <image:caption>Gasteizko Margolariak</image:caption>
  25. <image:title>Gasteizko Margolariak</image:title>
  26. </image:image>
  27. <image:image>
  28. <image:loc><?=$server?>/img/logo/GasteizkoMargolariak-0.png</image:loc>
  29. <image:caption>Gasteizko Margolariak Original</image:caption>
  30. <image:title>Gasteizko Margolariak Original</image:title>
  31. </image:image>
  32. </url>
  33. <url>
  34. <loc><?=$server?>/ayuda/</loc>
  35. <changefreq>monthly</changefreq>
  36. <priority>0.5</priority>
  37. </url>
  38. <url>
  39. <loc><?=$server?>/nosotros/</loc>
  40. <changefreq>monthly</changefreq>
  41. <priority>0.6</priority>
  42. </url>
  43. <url>
  44. <loc><?=$server?>/blog/</loc>
  45. <?php
  46. $res_date = mysqli_query($con, "SELECT DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM post ORDER BY cdate DESC LIMIT 1;");
  47. $row_date = mysqli_fetch_array($res_date);
  48. ?>
  49. <lastmod><?=$row_date["cdate"]?></lastmod>
  50. <changefreq>weekly</changefreq>
  51. <priority>0.8</priority>
  52. </url>
  53. <?php
  54. $res_post = mysqli_query($con, "SELECT id, title_es, permalink, DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM post WHERE visible = 1 ORDER BY cdate DESC;");
  55. $priority = 0.75;
  56. while ($row_post = mysqli_fetch_array($res_post)){
  57. ?>
  58. <url>
  59. <loc><?=$server?>/blog/<?=$row_post["permalink"]?></loc>
  60. <lastmod><?=$row_post["cdate"]?></lastmod>
  61. <changefreq>weekly</changefreq>
  62. <priority><?=$priority?></priority>
  63. <?php
  64. $q_i = mysqli_query($con, "SELECT image FROM post_image WHERE post = $row_post[id] ORDER BY idx;");
  65. while ($r_i = mysqli_fetch_array($q_i)){
  66. ?>
  67. <image:image>
  68. <image:loc><?=$server?>/img/blog/view/<?=$r_i["image"]?></image:loc>
  69. <image:title><?=$row_post["title_es"]?></image:title>
  70. </image:image>
  71. <?php
  72. }
  73. ?>
  74. </url>
  75. <?php
  76. $priority = $priority - 0.05;
  77. if ($priority < 0.45){
  78. $priority = 0.45;
  79. }
  80. }
  81. ?>
  82. <url>
  83. <loc><?=$server?>/actividades/</loc>
  84. <?php
  85. $res_date = mysqli_query($con, "SELECT DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM activity ORDER BY cdate DESC LIMIT 1;");
  86. $row_date = mysqli_fetch_array($res_date);
  87. ?>
  88. <lastmod><?=$row_date["cdate"]?></lastmod>
  89. <changefreq>weekly</changefreq>
  90. <priority>1</priority>
  91. </url>
  92. <?php
  93. $res = mysqli_query($con, "SELECT title_es, id, permalink, DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM activity WHERE visible = 1 ORDER BY cdate DESC;");
  94. $priority = 0.95;
  95. while ($row = mysqli_fetch_array($res)){
  96. ?>
  97. <url>
  98. <loc><?=$server?>/actividades/<?=$row["permalink"]?></loc>
  99. <lastmod><?=$row["cdate"]?></lastmod>
  100. <changefreq>weekly</changefreq>
  101. <priority><?=$priority?></priority>
  102. <?php
  103. $q_i = mysqli_query($con, "SELECT image FROM activity_image WHERE activity = $row[id] ORDER BY idx;");
  104. while ($r_i = mysqli_fetch_array($q_i)){
  105. ?>
  106. <image:image>
  107. <image:loc><?=$server?>/img/actividades/view/<?=$r_i["image"]?></image:loc>
  108. <image:title><?=$row_post["title_es"]?></image:title>
  109. </image:image>
  110. <?php
  111. }
  112. ?>
  113. </url>
  114. <?php
  115. $priority = $priority - 0.05;
  116. if ($priority < 0.65){
  117. $priority = 0.65;
  118. }
  119. }
  120. ?>
  121. <url>
  122. <loc><?=$server?>/galeria/</loc>
  123. <?php
  124. $res_date = mysqli_query($con, "SELECT DATE_FORMAT(uploaded, '%Y-%m-%d') AS cdate FROM photo ORDER BY cdate DESC LIMIT 1;");
  125. $row_date = mysqli_fetch_array($res_date);
  126. ?>
  127. <lastmod><?=$row_date["cdate"]?></lastmod>
  128. <changefreq>weekly</changefreq>
  129. <priority>0.8</priority>
  130. </url>
  131. <?php
  132. $res = mysqli_query($con, "SELECT DISTINCT album.id AS albumid, album.title_es AS title, album.permalink AS permalink, DATE_FORMAT(uploaded, '%Y-%m-%d') AS cdate FROM photo, album, photo_album WHERE photo = photo.id AND album = album.id ORDER BY cdate DESC;");
  133. $priority = 0.75;
  134. while ($row = mysqli_fetch_array($res)){
  135. ?>
  136. <url>
  137. <loc><?=$server?>/galeria/<?=$row["permalink"]?></loc>
  138. <lastmod><?=$row["cdate"]?></lastmod>
  139. <changefreq>weekly</changefreq>
  140. <priority><?=$priority?></priority>
  141. <?php
  142. $q_i = mysqli_query($con, "SELECT file, title_es FROM photo, photo_album WHERE id = photo AND album = $row[albumid];");
  143. while ($r_i = mysqli_fetch_array($q_i)){
  144. ?>
  145. <image:image>
  146. <image:loc><?=$server?>/img/galeria/view/<?=$r_i["file"]?></image:loc>
  147. <?php
  148. if (strlen($r_i['title_es']) > 0){
  149. ?>
  150. <image:title><?=$r_i["title_es"]?></image:title>
  151. <?php
  152. }
  153. else{
  154. ?>
  155. <image:title><?=$row["title"]?></image:title>
  156. <?php
  157. }
  158. ?>
  159. </image:image>
  160. <?php
  161. }
  162. ?>
  163. </url>
  164. <?php
  165. $priority = $priority - 0.05;
  166. if ($priority < 0.45){
  167. $priority = 0.45;
  168. }
  169. }
  170. ?>
  171. <url>
  172. <loc><?=$server?>/lablanca/</loc>
  173. <?php
  174. $res_lb = mysqli_query($con, 'SELECT value FROM settings WHERE name= "festivals";');
  175. if (mysqli_num_rows($res_lb) > 0){
  176. $r_lb = mysqli_fetch_array($res_lb);
  177. if ($r_lb["value"] == 1){
  178. ?>
  179. <changefreq>daily</changefreq>
  180. <priority>1</priority>
  181. <?php
  182. }
  183. else{
  184. ?>
  185. <changefreq>monthly</changefreq>
  186. <priority>0.5</priority>
  187. <?php
  188. }
  189. }
  190. else{
  191. ?>
  192. <changefreq>monthly</changefreq>
  193. <priority>0.5</priority>
  194. <?php
  195. }
  196. ?>
  197. </url>
  198. <?php
  199. $year = date("Y");
  200. $res_years = mysqli_query($con, "SELECT img, year FROM festival ORDER BY year DESC;");
  201. $priority = 0.55;
  202. while ($row_years = mysqli_fetch_array($res_years)){
  203. ?>
  204. <url>
  205. <loc><?=$server?>/lablanca/<?=$row_years["year"]?></loc>
  206. <changefreq>yearly</changefreq>
  207. <priority><?=$priority?></priority>
  208. <?php
  209. if (strlen($row_years["img"]) > 0){
  210. ?>
  211. <image:image>
  212. <image:loc><?=$server?>/img/fiestas/view/<?$row_years["img"]?></image:loc>
  213. <image:title>La Blanca <?=$row_years["year"]?></image:title>
  214. </image:image>
  215. <?php
  216. }
  217. ?>
  218. </url>
  219. <url>
  220. <loc><?=$server?>/lablanca/programa/margolariak/<?=$row_years["year"]?></loc>
  221. <changefreq>yearly</changefreq>
  222. <priority><?=($priority + 0.3)?></priority>
  223. <?php
  224. if (strlen($row_years["img"]) > 0){
  225. ?>
  226. <image:image>
  227. <image:loc><?=$server?>/img/fiestas/view/<?=$row_years["img"]?></image:loc>
  228. <image:title>La Blanca <?=$row_years["year"]?></image:title>
  229. </image:image>
  230. <?php
  231. }
  232. ?>
  233. </url>
  234. <url>
  235. <loc><?=$server?>/lablanca/programa/municipal/<?=$row_years["year"]?></loc>
  236. <changefreq>yearly</changefreq>
  237. <priority><?=($priority + 0.1)?></priority>
  238. <?php
  239. if (strlen($row_years["img"]) > 0){
  240. ?>
  241. <image:image>
  242. <image:loc><?=$server?>/img/fiestas/view/<?=$row_years["img"]?></image:loc>
  243. <image:title>La Blanca <?=$row_years["year"]?></image:title>
  244. </image:image>
  245. <?php
  246. }
  247. ?>
  248. </url>
  249. <?php
  250. $priority = $priority - 0.05;
  251. if ($priority < 0.40){
  252. $priority = 0.40;
  253. }
  254. } // while ($row_years = mysqli_fetch_array($res_years))
  255. ?>
  256. </urlset>