File: /home/httpd/html/baretube.com/sitemapVideoPages.php
<?
ini_set('max_execution_time', 86400);
ini_set('memory_limit', '1G');
include('mb.php');
header('Content-type: text/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
';
$max = 10000;
$from = is_numeric($_GET['offset']) ? (int) $_GET['offset'] : 0;
$result = mysqli_query($dblink,"SELECT `content`.`record_num`, `content`.`encoded_date`, `content`.`photos`, `content`.`title`, `content`.`slug`, `content`.`filename`, `content`.`orig_filename`, `content`.`main_thumb`, `content`.`embed`, `content`.`description`, `content`.`length`, `content`.`keywords`, (SELECT `content_views`.`views` FROM `content_views` WHERE `content_views`.`content` = `content`.`record_num`) AS `views`, (SELECT `filename` FROM `images` WHERE `images`.`record_num` = `content`.`thumbnail`) AS `thumbfile` FROM `content` WHERE `enabled` = 1 ORDER BY `encoded_date` DESC LIMIT $from, $max");
while($row = mysqli_fetch_assoc($result)) {
if ($row['photos'] == 1) {
$link = generateUrl('galleries', $row['title'], $row['record_num'], $row['slug']);
$thumbnail = "$gallery_url/$row[filename]/thumbs/$row[thumbfile]";
} else {
$link = generateUrl('video', $row['title'], $row['record_num'], $row['slug']);
$dirname = str_replace('.flv', '', $row['orig_filename']);
$subdir = $row['filename'][0] . '/' . $row['filename'][1] . '/' . $row['filename'][2] . '/' . $row['filename'][3] . '/' . $row['filename'][4] . '/';
$dirname = $subdir . $dirname;
if ($row['embed']) {
$thumbnail = "$thumb_url/embedded/$row[record_num].jpg";
} else {
$thumbnail = "$thumb_url/$dirname/$row[orig_filename]-$row[main_thumb].jpg";
}
}
?>
<url>
<loc><? echo $link; ?></loc>
<priority>0.8</priority>
<changefreq>weekly</changefreq>
<lastmod><? echo date('c', strtotime($row['encoded_date'])); ?></lastmod>
<image:image>
<image:loc><? echo $thumbnail; ?></image:loc>
<image:title><![CDATA[<? echo $row['title']; ?>]]></image:title>
</image:image>
<? if ($row['photos'] == 0) { ?>
<video:video>
<video:thumbnail_loc><? echo $thumbnail; ?></video:thumbnail_loc>
<video:title><![CDATA[<? echo $row['title']; ?>]]></video:title>
<video:description><![CDATA[<? echo $row['description']; ?>]]></video:description>
<video:category><![CDATA[<? echo strip_tags(buildChannels($row['record_num'])); ?>]]></video:category>
<video:tag><![CDATA[<? echo strip_tags(buildTags($row['keywords'])); ?>]]></video:tag>
<video:player_loc allow_embed="yes"><? echo $basehttp; ?>/embed/<? echo $row['record_num']; ?></video:player_loc>
<video:duration><? echo $row['length']; ?></video:duration>
<video:view_count><? echo $row['views']; ?></video:view_count>
<video:publication_date><? echo date('Y-m-d', strtotime($row['encoded_date'])); ?></video:publication_date>
<video:family_friendly>no</video:family_friendly>
</video:video>
<? } ?>
</url>
<? } ?>
</urlset>