<?
header("Content-type: text/xml");
# EXCLUDE FILES
# HOW TO USE
# "filename" separated by comma
$Exclude_Files = ARRAY("/content.php", "/content.html", "/z-gallery.html","/mail_script.php", "/sitemap.html", "/sitemap.xml", "/floor_plan_list.html", "/staff-contact.html", "/gallery_print.html", "/staff-view.html", "/gallery_view.html", "/customer_tesimonials.html", "/floor_plan_view.html", "/maufacturers.html");

###################################################
# DO NOT EDIT BELOW

INCLUDE_ONCE ("/web/siteadmin/config/_inc-config.inc");
UNSET($Domain);

$Domain = $_SERVER["SERVER_NAME"];
$Domain = "https://www." . EREGI_REPLACE("www.","",$Domain);

PRINT '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
<url><loc><?=$Domain?>/</loc><lastmod><?=DATE("Y-m-d")?></lastmod><priority>1</priority><changefreq>weekly</changefreq></url>

<?
$Domain = $_SERVER["SERVER_NAME"];
$Domain = "https://www." . EREGI_REPLACE("www.","",$Domain);
$Date = DATE("Y-m-d\TH:i:s\+00:00");

$ContentQ = MQ("SELECT * FROM Content ORDER BY Sort, Link_Name");
WHILE ($ContentR = MF($ContentQ)) {
	IF (!IN_ARRAY($ContentR["Page_URL"], $Exclude_Files)) {
		if (!$ContentR["Page_URL"]) {
			$ContentR["Page_URL"] = "/content.html?ID=".$ContentR["ID"];
		} ELSE {
			$Exclude_Files[] = SUBSTR($ContentR["Page_URL"], 1, STRLEN($ContentR["Page_URL"])-1);
		}
		?>
	<url>
		<loc><?=$Domain?><?=$ContentR["Page_URL"]?></loc>
		<lastmod><?=DATE("Y-m-d")?></lastmod>
		<priority>0.6</priority>
		<changefreq>weekly</changefreq>
	</url>
<?
	}
}


$ContentQ = MQ("SELECT * FROM CMATION_Blog ORDER BY Sort, Title");
WHILE ($ContentR = MF($ContentQ)) {
  IF (!IN_ARRAY($ContentR["Page_URL"], $Exclude_Files)) {
    if (!$ContentR["Page_URL"]) {
      $ContentR["Blog_URL"] = "/blog/?ID=".$ContentR["ID"];
    } ELSE {
      $Exclude_Files[] = SUBSTR($ContentR["Blog_URL"], 1, STRLEN($ContentR["Blog_URL"])-1);
    }
    ?>
  <url>
    <loc><?=$Domain?><?=$ContentR["Blog_URL"]?></loc>
    <lastmod><?=DATE("Y-m-d")?></lastmod>
    <priority>0.5</priority>
    <changefreq>weekly</changefreq>
  </url>
<?
  }
}

$ContentQ = MQ("SELECT * FROM News");
WHILE ($ContentR = MF($ContentQ)) {
  IF (!IN_ARRAY($ContentR["Page_URL"], $Exclude_Files)) {
    if (!$ContentR["Page_URL"]) {
      $ContentR["Page_URL"] = "/latest-news/index.html?ID=".$ContentR["ID"];
    } ELSE {
      $Exclude_Files[] = SUBSTR($ContentR["Page_URL"], 1, STRLEN($ContentR["Page_URL"])-1);
    }
    ?>
  <url>
    <loc><?=$Domain?><?=$ContentR["Page_URL"]?></loc>
    <lastmod><?=DATE("Y-m-d")?></lastmod>
    <priority>0.5</priority>
    <changefreq>weekly</changefreq>
  </url>
<?
  }
}
?>
</urlset>

