<?php
define('THIS_SCRIPT', 'sitemap');
require_once 'global.php';
header('Content-Type:text/xml; charset='.$charset);
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<!-- generator="http://www.iteam5.net/francesco/sitemap_gen"-->';
echo '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">';

switch($t){
	case 1:
		showtopiclist();
		break;
	default:
		showboardlist();
		break;
}
function showboardlist(){
	global $dv,$db,$ForumUrl;
	$query=$db->query("Select boardid From {$dv}board Where ishidden='0' And ischeckout='0'");
	while($ts = $db->fetch_array($query)){
		echo "<url><loc>{$ForumUrl}index.php?boardid={$ts['boardid']}</loc><lastmod>".date('Y-m-d H:i:s')."</lastmod><priority>1.0</priority></url>";
	}
}
function showtopiclist(){
	global $dv,$db,$ForumUrl;
	$query=$db->query("Select topicid,boardid,dateandtime From {$dv}topic Where boardid<>444 And boardid<>777 Order By topicid Desc Limit 2000");
	while($ts = $db->fetch_array($query)){
		echo "<url><loc>{$ForumUrl}dispbbs.php?boardid={$ts['boardid']}&amp;id={$ts['topicid']}</loc><lastmod>{$ts['dateandtime']}</lastmod><priority>1.0</priority></url>";
	}
}

echo '</urlset>';
?>