<?
require("include/global.php");
require_once("admin/bll/site.php");
require_once("admin/bll/state.php");
require_once("admin/bll/article.php");
require_once("admin/bll/content_category.php");
require_once("include/site_id.php");
require_once("include/page.php");

$statesArray = State::GetListNames();

$articles= new Article('sr','news');
$list = $articles->GetList('date_posted','desc',0,10000);
$list = $list[0];


$categories = ContentCategory::GetList('id','asc',0,1000); 
$categories = $categories[0];

$themed_articles = new Article('t');
$themed_articles->CategoryID = 0;
$themed_articles->UserId = -1;
$themed_articles->Visible = true;
$ret = $themed_articles->GetList('id','asc',0,1000);

$site_url = $_SESSION['ses_site_url'];
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<? foreach ($statesArray AS $key=>$value){?>
<url>
	<loc><?=$site_url.preg_replace('/[^a-zA-Z0-9]/','',$value)?>MortgageLenders/</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<? }?>

<? foreach ($statesArray AS $value){?>		
<url>
	<loc><?=$site_url.preg_replace('/[^a-zA-Z0-9]/','',$value)?>MortgageRates/</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<? }?>	
<url>
	<loc><?=$site_url?>index.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>findalender.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>getaquote.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>comparequotes.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>calculators.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>loanprograms.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>terminology.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>

<url>
	<loc><?=$site_url?>askaprofessional.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>conditionsofuse.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>privacypolicy.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>aboutus.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>advertising.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>register.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>rateyourexperience.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<url>
	<loc><?=$site_url?>contactus.php</loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<? 
if($_SESSION['ses_site_id']==5){
foreach ($list as $a){?>
<url>
	<loc><?=$site_url?>news/<?=$a['url_title'];?></loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>
<? }
foreach ($categories as $v) {?>

  <url>
	<loc><?=$site_url?>articles/<?=str_replace(" ","",ucwords($v['category_name']))?></loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>	
<? }?>
<? foreach ($ret[0] as $v) {?>
<url>
	<loc><?=$site_url?>articles/<?=str_replace(" ","",ucwords($v['category_name']))?>/<?=$v['url_title']?></loc>
	<lastmod><?=date("Y-m-d")?></lastmod>
	<changefreq>weekly</changefreq>
</url>	
<? }}?>
</urlset>