<?
# EXCLUDE FILES
# HOW TO USE
# "filename" separated by comma
$Exclude_Files = ARRAY("/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");
MYSQL_CONNECT ($DB_HOST, $DB_USER, $DB_PASS) or die ("ERROR");
MYSQL_SELECT_DB ($DB);
INCLUDE_ONCE ("/web/siteadmin/_load-config.inc");
INCLUDE_ONCE ("/web/siteadmin/_inc-functions.inc");
UNSET($Domain);

$Domain = $_SERVER["SERVER_NAME"];
$Domain = "http://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>0.5</priority><changefreq>weekly</changefreq></url>
<?

$d = DIR($_SERVER["DOCUMENT_ROOT"]);
WHILE (false !== ($entry = $d->read())) {
   IF ((EREG("html",$entry) || EREG("php",$entry)) && $entry != "content.html" && !IN_ARRAY($entry, $Exclude_Files)) {
     $Date = filemtime ($_SERVER["DOCUMENT_ROOT"] . "/" . $entry);
     $Date = DATE("Y-m-d", $Date);
?>
<url><loc><?=$Domain?>/<?=$entry?></loc><lastmod><?=$Date?></lastmod><priority>0.5</priority><changefreq>weekly</changefreq></url>
<?
  } ELSEIF ($entry == "content.html") {
     $Date = filemtime ($_SERVER["DOCUMENT_ROOT"] . "/" . $entry);
     $Date = DATE("Y-m-d");
     
     $Q = MQ("SELECT * FROM Content WHERE Page_URL=''");
     WHILE ($R = MF($Q)) {
			IF ($R["Page_URL"] == "") {
				$entry = "/content.html?ID=" . $R["ID"];
			} ELSE {
				$entry = $R["Page_URL"];
			}
			?>
<url><loc><?=$Domain?>/<?=$entry?></loc><lastmod><?=$Date?></lastmod><priority>0.5</priority><changefreq>weekly</changefreq></url>
<?
    }
  }
}
$d->close();
?></urlset>
