<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">News Blog RSS Feed</a></div>
			</div><br />
		  <div class="select-bar">
		    <label>
		    <h3>Sitemap Generator</h3>
		    </label>
		  </div>
<div align="center">
<a href="index.php?act=sitemap&state=create">Click here to generate a sitemap</a><br>
<?php
if (isset($_GET['state'])) {
switch($_GET['state']){
    case 'done':
		echo'<center><font size="3" color="#00CC33"><b>Sitemap created</b></font></center><br><br>URL to enter in Google Webmaster tools:<b> ' . $setting['siteurl'] . 'Sitemap.xml</b>';
		break;
    
    case 'create':
		echo'<center><font size="3" color="#FF0000"><b>Creating Sitemap...</b></font></center><br><br>';
		$sitemap='../Sitemap.xml';
		ob_start();
		echo'<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
       <url>
         <loc>' . $setting['siteurl'] . '</loc>
         <priority>0.5</priority>
       </url>';
		$query = yasDB_select("SELECT id, title FROM games order by id",false);
		while($row = mysqli_fetch_array($query)) {
			$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') {
				echo'<url>
					  <loc>' . $setting['siteurl'] . 'game/' . $row['id'] . '/' . $gameurl . '.html' . '</loc>
					  <priority>0.5</priority>
					</url>';
			} else {
			echo'<url>
				  <loc>' . $setting['siteurl'] . 'index.php?act=game&amp;id=' . $row['id'] . '</loc>
				  <priority>0.5</priority>
				</url>';
			}
		}
		$query->close();
		$query = yasDB_select("SELECT id FROM news order by id",false);
		while($row = mysqli_fetch_array($query)) {
			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>';
		}			
		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>