<?php

	/* find the base path
		*/
	$script_uri = 	Func::getBaseUrl();
	$data_contact = 	$this->getData("contact");
	$rewrite = 		$this->getTypedValue("setup", "settings", "use_clean_urls_bool");

	/* print doctype
		*/
	print '<?xml version="1.0"?>' . "\n";

?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<url><loc><?php echo $script_uri . "/" . SA_DIR_INDEXPATH; ?></loc></url>
<?php
	/* loop through and spit it all out
		*/
	foreach ($this->getData("page") as $page_id => $page_info) {
		$page_data = Flatfile::getXmlArray("set", $page_id);
		if ($rewrite) $uri = "/" . $this->cleanTitleFragment($page_info[1]) . "/";
		else $uri = "/" . SA_DIR_INDEXPATH . "?/" . $this->flag_label_page . "/" . $page_id . "/" . $this->cleanTitleFragment($page_info[1]) . "/";
?>
	<url><loc><?php echo $script_uri . $uri; ?></loc></url>
<?php
	}
	if ($data_contact!=false) {
		if ($rewrite) $uri = "/" . $this->cleanTitleFragment($data_contact->getNodeVal("data.settings.title")) . "/";
		else $uri = "/" . SA_DIR_INDEXPATH . "?/" . $this->flag_label_special . "/" . $this->flag_label_contact . "/" . $this->cleanTitleFragment($data_contact->getNodeVal("data.settings.title")) . "/";
?>
	<url><loc><?php echo $script_uri . $uri ?></loc></url>
<?php
	}
?>
</urlset>