forked from avscms/avscms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.php
executable file
·39 lines (35 loc) · 1.49 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
<?php
define('_VALID', true);
define('_ADMIN', true);
require 'include/config.php';
require 'include/function_admin.php';
header("Content-type: text/xml");
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">';
$characters_to_remove = array('&',"'",'"','>','<','-',',','/');
$replace_with = array('&',''','"','>','<','','','');
$sql = "SELECT VID, title, description, thumb, duration FROM video WHERE active = '1' ORDER by addtime DESC LIMIT 20000";
$rs = $conn->execute($sql);
$videos = $rs->getrows();
foreach ($videos as $video) {
$title = str_replace($characters_to_remove,$replace_with, $video['title']);
$description = str_replace($characters_to_remove,$replace_with, strip_tags($video['description']));
$VID = $video['VID'];
$thumbnail = get_thumb_url($video['VID']).'/'.$video['thumb'].'.jpg';
$duration = round($video['duration']);
if ($description == '') {
$description = strip_tags($title);
}
?>
<url>
<loc><?php echo $config['BASE_URL'] ?>/video/<?php echo $VID; ?>/<?php echo toAscii($title); ?></loc>
<video:video>
<video:thumbnail_loc><?php echo $thumbnail ?></video:thumbnail_loc>
<video:title><?php echo $title ?></video:title>
<video:description><?php echo $description ?></video:description>
<video:duration><?php echo $duration ?></video:duration>
</video:video>
</url>
<?php
}
echo '</urlset>';
?>