<?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");

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>2009-05-10T16:03:07+00:00</lastmod>
        	<changefreq>weekly</changefreq>
	        <priority>1.0</priority>
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/despre-noi.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/servicii.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/oferta.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/contact.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/ofertafizic.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/ofertajuridic.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
                <url>
    	        	<loc><?php echo $baseurl; ?>/spot.php</loc>
    	    <lastmod>2009-05-10T16:03:07+00:00</lastmod>
	        <changefreq>weekly</changefreq>
    	    <priority>0.5</priority>        
            </url>
            </urlset>