include($_SERVER['DOCUMENT_ROOT'].'/'.'config.php');
include($_SERVER['DOCUMENT_ROOT'].'/'.'functions.php');
################################################
################################################
#### LANG about subDOMAIN #######
################################################
$hostArray = array_reverse(explode('.', $_SERVER['HTTP_HOST']));
//print_r($hostArray);
if(count($hostArray) == 3 && $hostArray[2] != 'www' && in_array($hostArray[2], array_keys($cfg['host']['lang'])) ) {
// echo 'KOOL!';
$tmpArray = array();
foreach($cfg['host']['lang'][$hostArray[2]] as $lngKey){
$tmpArray[$lngKey] = $cfg['g']['lang'][$lngKey];
}
//$cfg['g']['lang'] = $tmpArray;
if(!$lang) $lang = $cfg['host']['lang'][$hostArray[2]][0];
}
if(!$lang && $hostArray[2] == 'us') $lang = 'en';
################################################
header("Content-type: text/xml; charset=utf-8");
echo '';
/*
*
* НАСТРОЙКИ
*
*/
$lastmod = date("Y-m-d");
$freqArray = explode(' ', 'always hourly daily weekly monthly yearly never');
$changefreq = $freqArray[2];
if($_GET['full']=='ok'){
if($_GET['index']){
$lang = $_GET['index'];
langFile($cfg['txt'], $lang);
echo '';
foreach($cfg['txt']['page'] as $key => $value){
$thisLink = text2link(htmlspecialchars(strip_tags($value['topic'])));
echo ''.
'http://'.$_SERVER['HTTP_HOST'].'/'.$index.'/'.$thisLink .'-'.$key.'/'.
''.$lastmod.''.
''.$changefreq.''.
'1.0'.
'';
}
foreach($cfg['txt']['page'] as $key => $value){
$thisLink = text2link(htmlspecialchars(strip_tags($value['topic'])));
foreach($value['list'] as $key2 => $value2){
$thisSubLink = text2link(htmlspecialchars(strip_tags($value2['topic'])));
echo ''.
'http://'.$_SERVER['HTTP_HOST'].'/'.$index.'/'.$thisLink .'-'.$key.'/'.$thisSubLink .'-'.$key2.'/'.
''.$lastmod.''.
''.$changefreq.''.
'0.9'.
'';
}
}
echo '';
}else{
echo '';
///*
echo ''.
'http://'.$_SERVER['HTTP_HOST'].'/sitemap'.$gen.'_all.xml'.
''.$lastmod.''.
''.
'';
//*/
//$cfg['g']['lang'] = array('ru' => 'Russian', 'en' => 'English');
foreach($cfg['g']['lang'] as $key => $value){
echo ''.
'http://'.$_SERVER['HTTP_HOST'].'/sitemap'.$gen.'_'.$key.'.xml'.
''.$lastmod.''.
''.
'';
}
echo '';
}
exit();
}
echo '';
/*
*
* цикл, массив
*
*/
foreach($cfg['g']['lang'] as $key => $value){
echo ''.
'http://'.$_SERVER['HTTP_HOST'].'/'.$key.'/'.
''.$lastmod.''.
''.$changefreq.''.
'0.8'.
'';
}
echo '';
?>