PageRenderTime 70ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/search/google_sitemap.php

https://bitbucket.org/molusc/sma-website
PHP | 77 lines | 57 code | 9 blank | 11 comment | 9 complexity | cbac7aa3a6b1c696a2e7df7c80698867 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /******************************************************************************
  3. * iSearch2 - website search engine *
  4. * *
  5. * Visit the iSearch homepage at http://www.iSearchTheNet.com/isearch *
  6. * *
  7. * Copyright (C) 2002-2007 Z-Host. All rights reserved. *
  8. * *
  9. ******************************************************************************/
  10. // PHPLOCKITOPT NOENCODE
  11. $isearch_path = dirname(__FILE__);
  12. define('IN_ISEARCH', true);
  13. require_once "$isearch_path/inc/core.inc.php";
  14. require_once "$isearch_path/inc/search.inc.php";
  15. /* Open the search component (read only) */
  16. isearch_open(True);
  17. /* Show flat site map (ordered by url) */
  18. $result = mysql_query("SELECT url, lastmod, changefreq, priority FROM $isearch_table_urls ORDER BY url", $isearch_ro_db);
  19. if (!$result)
  20. {
  21. echo "<p>MySQL error : " . mysql_error() . ' File: ' . __FILE__ . ', Line:' . __LINE__ . "</p>\n";
  22. }
  23. else if (mysql_num_rows($result) > 0)
  24. {
  25. if ($isearch_config['char_set_8_bit'])
  26. {
  27. $trans = get_html_translation_table(HTML_ENTITIES);
  28. }
  29. else
  30. {
  31. $trans = get_html_translation_table(HTML_SPECIALCHARS);
  32. }
  33. echo '<?xml version="1.0" encoding="UTF-8"?>
  34. <!-- Powered by iSearch2 -->
  35. <!-- http://www.iSearchTheNet.com/isearch -->
  36. <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
  37. ';
  38. while ($item = mysql_fetch_object($result))
  39. {
  40. echo '
  41. <url>
  42. <loc>'.strtr($item->url, $trans).'</loc>
  43. ';
  44. if ($item->lastmod > 0)
  45. {
  46. echo ' <lastmod>'.date('Y-m-d', $item->lastmod).'T'.date('H:i:s', $item->lastmod).'+00:00</lastmod>
  47. ';
  48. }
  49. if ($item->changefreq != '')
  50. {
  51. echo ' <changefreq>'.$item->changefreq.'</changefreq>
  52. ';
  53. }
  54. if ($item->priority >= 0)
  55. {
  56. echo ' <priority>'.$item->priority.'</priority>
  57. ';
  58. }
  59. echo ' </url>
  60. ';
  61. }
  62. echo '
  63. </urlset>
  64. ';
  65. }
  66. ?>