<?php
header("Content-Type:text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
include('class/mysql.php');
require_once('functions.php');
require_once(fileInclude('class/site.php'));
$https = (isset($_SERVER['HTTPS'])) ? 'https' : 'http';
$host = str_replace("www.", "", $_SERVER['SERVER_NAME']);
$host = ($host == 'demo.freesites.com.au') ? 'demo.freesites.com.au' : 'www.'.$host;
//homepage
echo '<url><loc>'.$https.'://'.$host.'</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
//other pages
$query = $mysql->query("ID,title", $mysql->perfix."pages", "status = 'Publish' AND ID != 2 AND ID != 1 AND hide_link = 'n'");
while($data = $mysql->get_array($query))
{
echo '<url><loc>'.$https.'://'.$host.'/'.$data['ID'].'/'.seo_str($data['title']).'</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
//blog posts
$b = settings('blog_page');
if((int)$b['blog_page'] > 0)
{
$query = $mysql->query("url_key", "fs_blog_entries", "status = 'Publish'");
while($data = $mysql->get_array($query))
{
echo '<url><loc>'.$https.'://'.$host.'/'.$b['blog_page'].'/'.$data['url_key'].'</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
}
//shop
$b = settings('shop_page');
$t = $site->pageTitle($b['shop_page']);
$seo_pageTitle = seo_str($t);
//shop static-ish page
if((int)$b['shop_page'] > 0)
{
$shop_settings = $site->shop_settings('show_bestsellers_page,show_newarrivals_page');
if($shop_settings['show_newarrivals_page'] == 'y')
{
echo '<url><loc>'.$https.'://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'/New-Arrivals</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
if($shop_settings['show_bestsellers_page'] == 'y')
{
echo '<url><loc>'.$https.'://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'/Best-Sellers</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
}
//shop categories
if((int)$b['shop_page'] > 0)
{
$query = $mysql->query("url_key", "fs_shop_cats", "1");
while($data = $mysql->get_array($query))
{
echo '<url><loc>'.$https.'://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'/'.$data['url_key'].'</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
}
//shop products
if((int)$b['shop_page'] > 0)
{
$query = $mysql->query("url_key", "fs_shop_products", "hide = 'n' AND cat > 0");
while($data = $mysql->get_array($query))
{
echo '<url><loc>'.$https.'://'.$host.'/'.$b['shop_page'].'/'.$seo_pageTitle.'/'.$data['url_key'].'</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
}
//FAQ
$b = settings('faq_page');
$seo_pageTitle = seo_str($site->pageTitle($b['faq_page']));
$query = $mysql->query("question", "fs_faq", "1 ORDER BY `order` ASC");
while($data = $mysql->get_array($query))
{
$array['url_key'] = seo_str($data['question']);
echo '<url><loc>'.$https.'://'.$host.'/'.$b['faq_page'].'/'.$seo_pageTitle.'/'.$array['url_key'].'</loc><changefreq>daily</changefreq><priority>1.00</priority></url>';
}
//end
echo '</urlset>';
?>