-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.php
executable file
·73 lines (72 loc) · 3.04 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
<?php
/*
* ====================================================================================
* Sitemap Plugin for Premium URL Shortener 2.0
* ----------------------------------------------------------------------------------
* This simple plugin generates the sitemap of public* URLs and your custom pages of your URL
* shortener. If you want Google to crawl them, simply login to Google Webmaster Tools,
* add and validate your site and add the sitemap.
* *Public = URLs generated by anonymous users or the ones that not pass=protected.
* ====================================================================================
* Configurations
* ------------------------------------------------------------------------------------
* The sitemap doesn't need much configuration. It only requires the number urls to output.
* Just change $number=50;
*
* If you want to rewrite sitemap.php to sitemap.xml (some search engines prefer .xml)
* Add the following rule in your .htaccess file.
*
* RewriteRule ^sitemap.xml?$ sitemap.php [QSA,NC,L]
* ====================================================================================
*/
$number=50;
/*
* ====================================================================================
* ----------------------------------------------------------------------------------
* Warning! Please do not modify anything below this line if you don't have the
* knowledge.
* ----------------------------------------------------------------------------------
* ====================================================================================
*/
include('includes/config.php');
header('Content-type: application/xml');
$db->object = TRUE;
$urls=$db->get("url",array("userid"=>0,"pass"=>""),array("limit"=>$number));
$pages=$db->get("page","",array("order"=>"id"));
echo "<?xml version='1.0' encoding='UTF-8'?>\n";
?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc><?php echo $config["url"]?></loc>
<lastmod><?php echo date('Y-m-d', time()); ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc><?php echo $config["url"]?>/login</loc>
<lastmod><?php echo date('Y-m-d', time()); ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc><?php echo $config["url"]?>/register</loc>
<lastmod><?php echo date('Y-m-d', time()); ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc><?php echo $config["url"]?>/contact</loc>
<lastmod><?php echo date('Y-m-d', time()); ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<?php foreach($pages as $page): ?>
<url>
<loc><?php echo $config["url"].'/page/'.$page->seo?></loc>
<lastmod><?php echo date('Y-m-d', time()); ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<?php endforeach;?>
</urlset>
<?php echo "<!--Sitemap generated on ".date('Y-m-d H:i:s', time())."-->"; ?>