/
sitemap.php
118 lines (108 loc) · 3.66 KB
/
sitemap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?
/****************************/
/* SITEMAP */
/****************************/
header('Content-type: application/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
/* INDEX */
if(!isset($_GET['type']))
{ ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc><?= kGetSiteURL().kGetBaseDir(); ?>sitemap.xml?type=pages</loc>
<lastmod><?= date("c"); ?></lastmod>
</sitemap>
<sitemap>
<loc><?= kGetSiteURL().kGetBaseDir(); ?>sitemap.xml?type=news</loc>
<lastmod><?= date("c"); ?></lastmod>
</sitemap>
<?
foreach(array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","other") as $letter)
{ ?>
<sitemap>
<loc><?= kGetSiteURL().kGetBaseDir(); ?>sitemap.xml?type=shop&letter=<?= $letter; ?></loc>
<lastmod><?= date("c"); ?></lastmod>
</sitemap>
<?php
}
?>
</sitemapindex>
<?php
/* PAGES */
} elseif($_GET['type']=="pages") { ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?
foreach(kGetLanguages() as $l)
{
foreach(kGetPageList($l['ll']) as $p)
{
kSetPageByDir($p['dir']);
$md=kGetSeoMetadata($p['dir']);
if(strpos($md['robots'],"noindex")===false)
{
?>
<url>
<loc><?= b3_unhtmlize(kGetSiteURL().kGetPagePermalink()); ?></loc>
<lastmod><?= kGetPageDateModified()!=""?date("c",mktime(substr(kGetPageDateModified(),11,2),substr(kGetPageDateModified(),14,2),substr(kGetPageDateModified(),17,2),substr(kGetPageDateModified(),5,2),substr(kGetPageDateModified(),8,2),substr(kGetPageDateModified(),0,4))):date("c"); ?></lastmod>
<changefreq><?= $md['changefreq']; ?></changefreq>
<priority><?= $md['priority']; ?></priority>
</url>
<?
}
}
}
?></urlset><?
/* NEWS */
} elseif($_GET['type']=="news") { ?>
<urlset xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
<?
foreach(kGetLanguages() as $l)
{
foreach(kGetNewsList("*",false,9999,0,"","","",$l['ll']) as $p)
{
kSetNewsByDir($p['dir']);
$md=kGetSeoMetadata(kGetNewsDir($l['ll']).'/'.$p['categorie'][0]['dir'].'/'.$p['dir']);
if(strpos($md['robots'],"noindex")===false)
{
?>
<url>
<loc><?= b3_unhtmlize(kGetSiteURL().kGetNewsPermalink()); ?></loc>
<lastmod><?= kGetNewsDateModified()!=""?date("c",mktime(substr(kGetNewsDateModified(),11,2),substr(kGetNewsDateModified(),14,2),substr(kGetNewsDateModified(),17,2),substr(kGetNewsDateModified(),5,2),substr(kGetNewsDateModified(),8,2),substr(kGetNewsDateModified(),0,4))):date("c"); ?></lastmod>
<changefreq><?= $md['changefreq']; ?></changefreq>
<priority><?= $md['priority']; ?></priority>
</url>
<?
}
}
}
?></urlset><?
/* SHOP */
} elseif($_GET['type']=="shop") { ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<?
foreach(kGetLanguages() as $l)
{
$vars=array( "category"=>"*", "limit"=>9999, "ll"=>$l['ll'] );
if(isset($_GET['letter']))
{
if($_GET['letter']!="other") $vars['conditions']="`titolo` LIKE '".mysql_real_escape_string($_GET['letter'])."%' ";
else $vars['conditions']="`titolo` RLIKE '^[^[A-Za-z].*'";
}
foreach(kGetShopItemQuickList($vars) as $p)
{
$md=kGetSeoMetadata(substr($p['permalink'],strlen(kGetSiteURL().kGetBaseDir())));
if(strpos($md['robots'],"noindex")===false)
{
?>
<url>
<loc><?= b3_unhtmlize(kGetSiteURL().$p['permalink']); ?></loc>
<lastmod><?= date("c",mktime(substr($p['modified'],11,2),substr($p['modified'],14,2),substr($p['modified'],17,2),substr($p['modified'],5,2),substr($p['modified'],8,2),substr($p['modified'],0,4))); ?></lastmod>
<changefreq><?= $md['changefreq']; ?></changefreq>
<priority><?= $md['priority']; ?></priority>
</url>
<?
}
}
}
?></urlset><?
}?>