<?php
  if ('127.0.0.1'==@$_SERVER['REMOTE_ADDR']) { error_reporting(E_ALL); } else { error_reporting(0); }
  set_time_limit(60);
  @ini_set('pcre.backtrack_limit', 1048576);
  @ini_set('pcre.recursion_limit', 1048576);
  
  require_once('_define.php');
  $t_1 = $_SERVER['PHP_SELF'];
  $t_1 = substr($t_1,0,-12);
  if (''==IWW_ROOT) { $_root = dirname(__FILE__); }
  if (''==IWW_HOST) { $_host = $_SERVER['HTTP_HOST'].$t_1; }
  require_once($_root.'/_c/iww.php');
  $_db = new iww_mysql();
  $_db->db_connect();
  list($d_n,$d_a) = $_db->arr('SELECT cfg_data FROM '.IWW_DB_UNIQ.'cfg;');
  $_cfg = unserialize(iww_u2w($d_a[0]['cfg_data']));
  
  $_out = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.google.com/schemas/sitemap/0.84" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84 http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">';
  list($d_n,$d_a) = $_db->arr('SELECT lang_strid,page_strid FROM '.IWW_DB_UNIQ.'page ORDER BY lang_strid,page_strid;');
  for ($d_i=0; $d_i<$d_n; $d_i++) {
    if (1<sizeof($_cfg['L'])) { $t_1 = $d_a[$d_i]['lang_strid'].'/'.$d_a[$d_i]['page_strid']; }
    else { $t_1 = $d_a[$d_i]['page_strid']; }
    $_out .= '<url><loc>http://'.$_host.'/'.$t_1.'.html</loc></url>';
  }
  
$_out .= '</urlset>';


header("Content-Type: text/xml");
header("Pragma: no-cache");
print $_out;
?>
