sitemap.php 4.9 KB

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