<?php

/**
 * Return absolute url (with page name)
 *
 * @return string
 */
function getAbsoluteUrl() {

    $host = $_SERVER['HTTP_HOST'];

    $docRoot = getPage();

    return $absPath = "http://" . $host . $docRoot;
}

/**
 * Return canonical request url
 *
 * @return string
 */ 
function getPage() {

    $urlBits = split("/", $_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>2010-10-10T13:23:54+00:00</lastmod>
        	<changefreq>weekly</changefreq>
	        <priority>1.0</priority>
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/eu-projects.php</loc>
    	    <lastmod>2010-10-09T20:26:35+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/hrd-projects.php</loc>
    	    <lastmod>2010-10-09T20:52:00+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/qm-projects.php</loc>
    	    <lastmod>2010-10-09T20:53:22+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/about-me.php</loc>
    	    <lastmod>2010-10-10T13:32:48+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/contact-me.php</loc>
    	    <lastmod>2010-10-10T13:59:22+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/references.php</loc>
    	    <lastmod>2010-10-09T22:19:24+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
            </urlset>