<?php
header('Content-Type: application/xml; charset=utf-8');

define("APP_SIGNATURE", "raccoonsquare");
include_once("sys/core/init.inc.php");

$dbo = new PDO(DB_DSN, DB_USER, DB_PASSWORD);
$dbo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
     xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0">' . "\n";

$base_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'];

$mobile_pages = array(
    array('url' => '/mobile', 'priority' => 1.0, 'changefreq' => 'daily'),
    array('url' => '/mobile/signup', 'priority' => 0.9, 'changefreq' => 'daily'),
    array('url' => '/mobile/login', 'priority' => 0.9, 'changefreq' => 'daily'),
);

foreach ($mobile_pages as $page) {
    echo "  <url>\n";
    echo "    <loc>" . htmlspecialchars($base_url . $page['url']) . "</loc>\n";
    echo "    <mobile:mobile />\n";
    echo "    <lastmod>" . date('Y-m-d') . "</lastmod>\n";
    echo "    <changefreq>" . $page['changefreq'] . "</changefreq>\n";
    echo "    <priority>" . $page['priority'] . "</priority>\n";
    echo "  </url>\n";
}

echo '</urlset>';
?>
