sitemap.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. define('IN_SMT', true);
  3. define('CURSCRIPT', 'sitemap');
  4. define('IN_MYMPS', true);
  5. require_once dirname(__FILE__) . '/include/global.php';
  6. require_once dirname(__FILE__) . '/data/config.php';
  7. require_once MYMPS_DATA . '/config.db.php';
  8. require_once MYMPS_INC . '/db.class.php';
  9. @header('Content-type: text/xml');
  10. @header('Content-Type: text/html; charset=utf-8');
  11. !in_array($part, array('info', 'category', 'news', 'store', 'docu')) && $part == 'info';
  12. $mayi = '<?xml version="1.0" encoding="UTF-8"?>
  13. <urlset>
  14. ';
  15. switch ($part) {
  16. case 'info':
  17. $info = mymps_get_infos(5000);
  18. if (is_array($info)) {
  19. foreach ($info as $k => $v) {
  20. $mayi .= '<url>
  21. <loc>';
  22. $mayi .= $mymps_global['SiteUrl'] . $v['uri'] . '</loc>
  23. ';
  24. $mayi .= '<lastmod>';
  25. $mayi .= GetTime($v['begintime'], 'Y-m-d H:i:s');
  26. $mayi .= '</lastmod>
  27. ';
  28. $mayi .= '<changefreq>weekly</changefreq>
  29. ';
  30. $mayi .= '<priority>0.9</priority>
  31. ';
  32. $mayi .= '</url>
  33. ';
  34. }
  35. }
  36. break;
  37. case 'category':
  38. $categories = get_categories_tree(0, 'category');
  39. if (is_array($categories)) {
  40. foreach ($categories as $k => $v) {
  41. $mayi .= '<url>
  42. <loc>';
  43. $mayi .= $v[uri] . '</loc>
  44. ';
  45. $mayi .= '<lastmod>';
  46. $mayi .= GetTime($timestamp, 'Y-m-d');
  47. $mayi .= '</lastmod>
  48. ';
  49. $mayi .= '<changefreq>daily</changefreq>
  50. ';
  51. $mayi .= '<priority>0.9</priority>
  52. ';
  53. $mayi .= '</url>
  54. ';
  55. if (is_array($v[children])) {
  56. foreach ($v[children] as $u => $w) {
  57. $mayi .= '<url>
  58. <loc>';
  59. $mayi .= $w[uri] . '</loc>
  60. ';
  61. $mayi .= '<lastmod>';
  62. $mayi .= GetTime($timestamp, 'Y-m-d');
  63. $mayi .= '</lastmod>
  64. ';
  65. $mayi .= '<changefreq>daily</changefreq>
  66. ';
  67. $mayi .= '<priority>0.8</priority>
  68. ';
  69. $mayi .= '</url>
  70. ';
  71. }
  72. }
  73. }
  74. }
  75. break;
  76. case 'store':
  77. $store = mymps_get_members(5000);
  78. if (is_array($store)) {
  79. foreach ($store as $k => $v) {
  80. $mayi .= '<url>
  81. <loc>';
  82. $mayi .= $mymps_global['SiteUrl'] . $v['uri'] . '</loc>
  83. ';
  84. $mayi .= '<lastmod>';
  85. $mayi .= GetTime($v['jointime'], 'Y-m-d H:i:s');
  86. $mayi .= '</lastmod>
  87. ';
  88. $mayi .= '<changefreq>daily</changefreq>
  89. ';
  90. $mayi .= '<priority>0.9</priority>
  91. ';
  92. $mayi .= '</url>
  93. ';
  94. }
  95. }
  96. break;
  97. case 'news':
  98. $news = mymps_get_news(5000);
  99. if (is_array($news)) {
  100. foreach ($news as $k => $v) {
  101. $mayi .= '<url>
  102. <loc>';
  103. $mayi .= $mymps_global['SiteUrl'] . $v['uri'] . '</loc>
  104. ';
  105. $mayi .= '<lastmod>';
  106. $mayi .= GetTime($v['begintime'], 'Y-m-d H:i:s');
  107. $mayi .= '</lastmod>
  108. ';
  109. $mayi .= '<changefreq>daily</changefreq>
  110. ';
  111. $mayi .= '<priority>0.9</priority>
  112. ';
  113. $mayi .= '</url>
  114. ';
  115. }
  116. }
  117. break;
  118. case 'docu':
  119. $docu = get_member_docu(1000);
  120. if (is_array($docu)) {
  121. foreach ($docu as $k => $v) {
  122. $mayi .= '<url>
  123. <loc>';
  124. $mayi .= $mymps_global['SiteUrl'] . $v['uri'] . '</loc>
  125. ';
  126. $mayi .= '<lastmod>';
  127. $mayi .= GetTime($v['pubtime'], 'Y-m-d H:i:s');
  128. $mayi .= '</lastmod>
  129. ';
  130. $mayi .= '<changefreq>weekly</changefreq>
  131. ';
  132. $mayi .= '<priority>0.9</priority>
  133. ';
  134. $mayi .= '</url>
  135. ';
  136. }
  137. }
  138. break;
  139. }
  140. $mayi .= '</urlset>';
  141. echo $mayi;
  142. is_object($db) && $db->Close();
  143. $db = $db_mymps = NULL;
  144. ?>