<?

include_once($_SERVER['DOCUMENT_ROOT']."/inc_session_start.php");
include_once($_SERVER['DOCUMENT_ROOT']."/inc_common.php");
include_once($_SERVER['DOCUMENT_ROOT']."/db.php");

header("Content-Type: text/xml; charset=UTF-8");
header('Content-Disposition: inline; filename=sitemap-music-news.xml');
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

print '<?xml version="1.0" encoding="UTF-8"?>'."\n";
print '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">'."\n";

// grab all the info we'll need for the rss feed and build an array
$sql = "select newsID, newsTitle, newsKeywords, newsDate from musicNews order by newsDate desc limit 0,50";
$result = mysql_query($sql);
$arNewsItems = array();
while ($arThisRow = mysql_fetch_array($result)){
	if (!$arThisRow['newsKeywords']) $arThisRow['newsKeywords'] = "Entertainment, Music, Celebrities";
	$strArticleURL = cleanForSubDomain($arThisRow['newsTitle']);
	$strArticleURL .= "_".str_pad($arThisRow['newsID'],5,"0",STR_PAD_LEFT).".html";
	print "\t<url>\n";
	print "\t\t<loc>http://www.moshable.com/music-news/$strArticleURL</loc>\n";
	print "\t\t<news:news>\n";
	print "\t\t\t<news:publication_date>".date('Y-m-d',$arThisRow['newsDate'])."T09:00-05:00</news:publication_date>\n";
	print "\t\t\t<news:keywords>".$arThisRow['newsKeywords']."</news:keywords>\n";
	print "\t\t</news:news>\n";
	print "\t</url>\n\n";
}

print '</urlset>'."\n";

?>