<?php

/**
 * Return absolute url (with page name)
 *
 * @return string
 */
function getAbsoluteUrl()
{
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https' : 'http';
    return $protocol . '://' . $_SERVER['SERVER_NAME'] . getPage();
}

/**
 * Return canonical request url
 *
 * @return string
 */
function getPage() {
    $urlBits = explode("/", $_SERVER['REQUEST_URI']);
    array_pop($urlBits);
    return implode("/",$urlBits);
}

header("Content-Type: text/xml");
header('Cache-Control: no-cache');
header('Expires: -1');
header('Pragma: no-cache');
print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

$baseURL = getAbsoluteUrl();

?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

            <url>
                            <loc><?php echo $baseURL; ?>/</loc>
                <lastmod>2018-05-03T19:40:57+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>1.0</priority>
                    </url>
                    <url>
                            <loc><?php echo $baseURL; ?>/about.php</loc>
                <lastmod>2018-05-03T19:40:58+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
                    </url>
                    <url>
                            <loc><?php echo $baseURL; ?>/Estrutura.php</loc>
                <lastmod>2018-05-03T20:01:12+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
                    </url>
                    <url>
                            <loc><?php echo $baseURL; ?>/Localização.php</loc>
                <lastmod>2018-05-03T20:01:56+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
                    </url>
                    <url>
                            <loc><?php echo $baseURL; ?>/Contato.php</loc>
                <lastmod>2018-05-03T19:40:58+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
                    </url>
                    <url>
                            <loc><?php echo $baseURL; ?>/WebMail.php</loc>
                <lastmod>2018-05-03T19:59:33+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
                    </url>
                    <url>
                            <loc><?php echo $baseURL; ?>/Área-Restrita.php</loc>
                <lastmod>2018-05-03T20:43:26+00:00</lastmod>
                <changefreq>weekly</changefreq>
                <priority>0.5</priority>
                    </url>
            
    </urlset>
