<?php
    require_once('defaults.php');
    require_once(INCLUDES_DIR.'includes.php');
    if (function_exists('system_init')) {
        system_init();
    }
    else {
        plugin_loadall();
    }
    header('Content-Type: text/xml; charset=utf-8');
    error_reporting(E_ALL);
    echo("<?");
?>xml version="1.0" encoding="UTF-8"<?php echo("?>"); ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc><?=BLOG_BASEURL?></loc>
    <lastmod><?=date("c");?></lastmod>
    <priority>1.0</priority>
  </url>
<?php
    $q = new FPDB_Query(array('start'=>0, 'count'=>-1, 'fullparse'=>true), null);
    while($q->hasMore()) {
        list($id, $e) = $q->getEntry();
        $offset = $fp_config['locale']['timeoffset'];
        if (isset($e['lastupdate'])) {
                $lastmod = $e['lastupdate'] - (60 * 60 * $offset);
        }
        else {
                $lastmod = $e['date'] - (60 * 60 * $offset);
        }
        $loc =  BLOG_BASEURL . "index.php?x=entry:" . $id;
?>
  <url>
    <loc><?=$loc?></loc>
    <lastmod><?=date("c", $lastmod);?></lastmod>
  </url>
<?php
    }
?>
</urlset>