<?php
require_once ("../config/config.inc");
require_once ("../includes/mysqlwrapper.php");
header('Content-Type: text/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://'.$config['host']['name'].'/</loc>
      <priority>1.0</priority>
      <changefreq>always</changefreq>
   </url>';
  $areas=sql('Select * from page_areas where up=0 and hide=0 order by pos asc, name asc',1);
  while($it=mysqli_fetch_array($areas))
  {
    if($it['page']!=1)
    {
    echo '
   <url>
      <loc>http://'.$config['host']['name'].'/'.($it['lang']!='ru'?$it['lang'].'/':'').$it['name'].'/</loc>
      <priority>0.8</priority>
   </url>';
    }
    $subareas=sql('Select * from page_areas where up='.$it['id'].' and hide=0 order by name',1);
    while($sit=mysqli_fetch_array($subareas))
    {
      if($it['page']!=1)
      {
    echo '
   <url>
      <loc>http://'.$config['host']['name'].'/'.($sit['lang']!='ru'?$sit['lang'].'/':'').$sit['name'].'/</loc>
      <priority>0.6</priority>
   </url>';
      }
    }
  }=
  echo '
</urlset>';
?>

