%PDF- %PDF-
| Direktori : /home/cargonizer/public_html/admin/ |
| Current File : /home/cargonizer/public_html/admin/sitemaps.php |
<?php
@session_start();
@header('Content-Type: text/html; charset=utf-8');
ini_set('display_errors',1);
define('PATH','../');
if(!$_SESSION["admin"]) die();
if(!$_SESSION['LANG']) $_SESSION['LANG'] = 'tr';
define('LANG',$_SESSION['LANG']);
include_once '../includes/functions.php';
include_once '../includes/db.php';
include_once '../includes/config.php';
$tmp[] = '<url>
<loc>http://'.rtrim($_SERVER['HTTP_HOST'],'/').'/</loc>
<lastmod>'.date("c").'</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>';
$contents = getAllTables('pages',"WHERE type!='banner' && status=1 ORDER BY id ASC",LANG);
foreach($contents as $val) {
$tmp[] = '<url>
<loc>http://'.rtrim($_SERVER['HTTP_HOST'],'/').'/'.convertstring($val['name']).'-i'.$val['id'].'.html</loc>
<lastmod>'.date("c").'</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>';
}
unset($contents);
$contents = getAllTables('menus',"WHERE status=1 ORDER BY id ASC",LANG);
foreach($contents as $val) {
$tmp[] = '<url>
<loc>http://'.rtrim($_SERVER['HTTP_HOST'],'/').'/'.$val['links'].'</loc>
<lastmod>'.date("c").'</lastmod>
<changefreq>daily</changefreq>
<priority>1</priority>
</url>';
}
unset($contents);
$total = count($tmp);
$page = ceil($total/3000);
for($i=0;$i<$page;$i++) {
$temp [] = '<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="sheet.xsl"?>
<!--#Generated by Medyax sitemap generator, http://www.medyax.com-->
<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">';
$new = array_slice($tmp,($i*3000),3000);
$temp[] = implode("\r\n",$new);
$temp[] = '</urlset>';
file_put_contents("../sitemap/sitemap".($i+1).".xml",implode("\r\n",$temp));
unset($temp,$new);
}
echo message('Toplam <b>'.$page.'</b> adet site haritası oluşturulmuştur.',"success");
echo 'Oluşturulan Sitemap adresleri aşağıdaki gibidir.';
for($x=1;$x<=$page;$x++)
echo '<div><b>http://'.rtrim($_SERVER['HTTP_HOST'],'/').'/sitemap/sitemap'.$x.'.xml</b></div>';
?>