sitemap.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. header('Content-type: application/xml');
  3. $http_host = $_SERVER['HTTP_HOST'];
  4. include("functions.php");
  5. $con = startdb();
  6. //registerVisit($_SERVER['REQUEST_URI'], false);
  7. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  8. ?>
  9. <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  10. <url>
  11. <loc>http://<?php echo $http_host; ?>/</loc>
  12. <?php
  13. $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;");
  14. $row_date = mysqli_fetch_array($res_date);
  15. ?>
  16. <lastmod><?php echo $row_date['cdate']; ?></lastmod>
  17. <changefreq>weekly</changefreq>
  18. <priority>0.8</priority>
  19. </url>
  20. <url>
  21. <loc>http://<?php echo $http_host; ?>/help/</loc>
  22. <changefreq>monthly</changefreq>
  23. <priority>0.5</priority>
  24. </url>
  25. <url>
  26. <loc>http://<?php echo $http_host; ?>/nosotros/</loc>
  27. <changefreq>monthly</changefreq>
  28. <priority>0.6</priority>
  29. </url>
  30. <url>
  31. <loc>http://<?php echo $http_host; ?>/blog/</loc>
  32. <?php
  33. $res_date = mysqli_query($con, "SELECT DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM post ORDER BY cdate DESC LIMIT 1;");
  34. $row_date = mysqli_fetch_array($res_date);
  35. ?>
  36. <lastmod><?php echo $row_date['cdate']; ?></lastmod>
  37. <changefreq>weekly</changefreq>
  38. <priority>0.8</priority>
  39. </url>
  40. <?php
  41. $res_post = mysqli_query($con, "SELECT id, permalink, DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM post WHERE visible = 1 ORDER BY cdate DESC;");
  42. $priority = 0.75;
  43. while ($row_post = mysqli_fetch_array($res_post)){
  44. echo "\t<url>\n";
  45. echo "\t\t<loc>http://$http_host/blog/$row_post[permalink]</loc>\n";
  46. echo "\t\t<lastmod>$row_post[cdate]</lastmod>\n";
  47. echo "\t\t<changefreq>weekly</changefreq>\n";
  48. echo "\t\t<priority>$priority</priority>\n";
  49. echo "\t</url>\n";
  50. $priority = $priority - 0.05;
  51. if ($priority < 0.45)
  52. $priority = 0.45;
  53. }
  54. ?>
  55. <url>
  56. <loc>http://<?php echo $http_host; ?>/actividades/</loc>
  57. <?php
  58. $res_date = mysqli_query($con, "SELECT DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM activity ORDER BY cdate DESC LIMIT 1;");
  59. $row_date = mysqli_fetch_array($res_date);
  60. ?>
  61. <lastmod><?php echo $row_date['cdate']; ?></lastmod>
  62. <changefreq>weekly</changefreq>
  63. <priority>1</priority>
  64. </url>
  65. <?php
  66. $res = mysqli_query($con, "SELECT id, permalink, DATE_FORMAT(dtime, '%Y-%m-%d') AS cdate FROM activity WHERE visible = 1 ORDER BY cdate DESC;");
  67. $priority = 0.95;
  68. while ($row = mysqli_fetch_array($res)){
  69. echo "\t<url>\n";
  70. echo "\t\t<loc>http://$http_host/actividades/$row[permalink]</loc>\n";
  71. echo "\t\t<lastmod>$row[cdate]</lastmod>\n";
  72. echo "\t\t<changefreq>weekly</changefreq>\n";
  73. echo "\t\t<priority>$priority</priority>\n";
  74. echo "\t</url>\n";
  75. $priority = $priority - 0.05;
  76. if ($priority < 0.65)
  77. $priority = 0.65;
  78. }
  79. ?>
  80. <url>
  81. <loc>http://<?php echo $http_host; ?>/galeria/</loc>
  82. <?php
  83. $res_date = mysqli_query($con, "SELECT DATE_FORMAT(uploaded, '%Y-%m-%d') AS cdate FROM photo ORDER BY cdate DESC LIMIT 1;");
  84. $row_date = mysqli_fetch_array($res_date);
  85. ?>
  86. <lastmod><?php echo $row_date['cdate']; ?></lastmod>
  87. <changefreq>weekly</changefreq>
  88. <priority>0.8</priority>
  89. </url>
  90. <?php
  91. $res = mysqli_query($con, "SELECT DISTINCT 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;");
  92. $priority = 0.75;
  93. while ($row = mysqli_fetch_array($res)){
  94. echo "\t<url>\n";
  95. echo "\t\t<loc>http://$http_host/galeria/$row[permalink]</loc>\n";
  96. echo "\t\t<lastmod>$row[cdate]</lastmod>\n";
  97. echo "\t\t<changefreq>weekly</changefreq>\n";
  98. echo "\t\t<priority>$priority</priority>\n";
  99. echo "\t</url>\n";
  100. $priority = $priority - 0.05;
  101. if ($priority < 0.45)
  102. $priority = 0.45;
  103. }
  104. ?>
  105. <url>
  106. <loc>http://<?php echo $http_host; ?>/lablanca/</loc>
  107. <?php
  108. $res_lb = mysqli_query($con, 'SELECT value FROM settings WHERE name= "festivals";');
  109. if (mysqli_num_rows($res_lb) > 0){
  110. $r_lb = mysqli_fetch_array($res_lb);
  111. if ($r_lb['value'] == 1){
  112. echo "\t\t<changefreq>monthly</changefreq>\n";
  113. echo "\t\t<priority>0.5</priority>\n";
  114. }
  115. else{
  116. echo "\t\t<changefreq>monthly</changefreq>\n";
  117. echo "\t\t<priority>0.5</priority>\n";
  118. }
  119. }
  120. else{
  121. echo "\t\t<changefreq>monthly</changefreq>\n";
  122. echo "\t\t<priority>0.5</priority>\n";
  123. }
  124. ?>
  125. </url>
  126. <?php
  127. $year = date("Y");
  128. $res_post = mysqli_query($con, "SELECT year FROM festival WHERE year != " . date("Y") . " ORDER BY year;");
  129. $priority = 0.55;
  130. while ($row_post = mysqli_fetch_array($res_post)){
  131. echo "\t<url>\n";
  132. echo "\t\t<loc>http://$http_host/lablanca/$r_years[year]</loc>\n";
  133. echo "\t\t<changefreq>yearly</changefreq>\n";
  134. echo "\t\t<priority>$priority</priority>\n";
  135. echo "\t</url>\n";
  136. $priority = $priority - 0.05;
  137. if ($priority < 0.40)
  138. $priority = 0.40;
  139. }
  140. ?>
  141. </urlset>