<div id="center-column">
<div class="top-bar">
				<a href="index.php?act=rssfeed" title="RSS Feed" class="button">RSS Feed</a>
				<h1>Cpanel - Sitemap</h1>
				<div class="breadcrumbs"><a href="index.php?act=sitemap" title="Sitemap">Sitemap</a> / <a href="index.php?act=rssfeed" title="RSS Feed">RSS Feed</a> / <a href="index.php?act=newsblogfeed" title="RSS Feed">Blog de Noticias feed RSS</a></div>
			</div><br />
		  <div class="select-bar">
		    <label>
		    <h3>Generador de Sitemap</h3>
		    </label>
		  </div>
<div align="center">
<a href="index.php?act=sitemap&state=create">Pulse aqui para crear un mapa del sitio</a><br>
<?php
if (isset($_GET['state'])) {
switch($_GET['state']){
    case 'done':
		echo'<center><font size="3" color="#00CC33"><b>El mapa del sitio ha sido creado</b></font></center><br><br>URL para entrar en Google Webmaster Tools:<b> ' . $setting['siteurl'] . 'Sitemap.xml</b>';
		break;
    
    case 'create':
		echo'<center><font size="3" color="#FF0000"><b>Creando mapa del sitio...</b></font></center><br><br>';
		$sitemap='../Sitemap.xml';
		ob_start();
		echo'<?xml version="1.0" encoding="UTF-8"?>
    <urlset
      xmlns="http://www.google.com/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.9
	  http://www.google.com/schemas/sitemap/0.9/sitemap.xsd">
       <url>
         <loc>' . $setting['siteurl'] . '</loc>
         <priority>0.5</priority>
       </url>';
		$query = yasDB_select("SELECT * FROM games ORDER BY id DESC");
		while($row = $query->fetch_array(MYSQLI_ASSOC)) {
					$ID = $row['id'];
					$description = $row['description'];
					$gameurl = $row['title'];
					$gameurl = str_replace(" ", "-", $gameurl);
					$gameurl = str_replace("'", "_", $gameurl);
					$gameurl = str_replace('"', "_", $gameurl);
					$gameurl = str_replace('/', "_", $gameurl);
					$gameurl = str_replace("\\", "_", $gameurl);
					$gameurl = rawurlencode($gameurl);
					if ($setting['seo'] == 'yes') {
						$playlink = ''. $setting['siteurl'] . 'game/' . $ID . '/' . $gameurl . '.html';
					} else {
						$playlink = ''. $setting['siteurl'] . 'index.php?act=game&id=' . $ID;
					}
				echo'<url>
				<loc>' .$playlink . '</loc>
				<priority>0.5</priority>
				</url>';
		}
		$query->close();
		$query = yasDB_select("SELECT id FROM news order by id",false);
		while($row = $query->fetch_array(MYSQLI_ASSOC)) {
			if ($setting['seo'] == 'yes') {
				$url = $setting['siteurl'] . 'shownews/' . $row['id'] . '.html';
			} else {
				$url = $setting['siteurl'] . 'index.php?act=shownews&amp;id=' . $row['id'];
			}
			echo '<url>
					<loc>' . $url . '</loc>
					<priority>0.5</priority>
					</url>';
		}
		$query = yasDB_select("SELECT id FROM categories order by id",false);
		while($row = $query->fetch_array(MYSQLI_ASSOC)) {
			if ($setting['seo'] == 'yes') {
				$url = $setting['siteurl'] . 'category/' . $row['id'] . '/1.html';
			} else {
				$url = $setting['siteurl'] . 'index.php?act=category&amp;id=' . $row['id'];
			}
			echo '<url>
					<loc>' . $url . '</loc>
					<priority>0.5</priority>
					</url>';
		}	
		echo '</urlset>';
		$fopen = fopen($sitemap, 'w');
		fwrite($fopen, ob_get_contents());
		fclose($fopen);
		ob_end_flush();
		echo '<META http-equiv="refresh" content="2; URL=index.php?act=sitemap&state=done">';
		break;
	default:
		break;
}
}
?>
</div></div>