Файл: adultscript-2.0.3-pro/files/admin/modules/tools/components/sitemap_video.php
Строк: 51
<?php
defined('_VALID') or die('Restricted Acccess!');
// here we need to add some content protection stuff, like reverse dns lookup or something
// to identify robots and allow only robots to crawl video video files
class VComponent_Admin_tools_sitemap_video
{
public function __construct()
{
}
public function render()
{
$errors = array();
$messages = array();
$warnings = array();
$sitemap = array(
'file' => '',
'created' => 0,
'size' => 0,
'date' => '',
'created' => FALSE
);
$options = array(
'max_per_file' => 35000,
'use_location' => 0,
'use_player' => 1,
'ping_google' => 1
);
$file = BASE_DIR.'/sitemap-video.xml';
if (!file_exists($file) OR !is_file($file) OR !is_writable($file)) {
$warnings[] = 'Sitemap file ('.$file.') not found or not writable!';
}
if (file_exists($file) && is_file($file) && filesize($file) > 10) {
$sitemap['created'] = 1;
$sitemap['name'] = $file;
$sitemap['size'] = filesize($file);
$sitemap['date'] = date('Y-m-d h:i:s', filemtime($file));
}
VHelper::load('admin.video.sitemap');
if (isset($_POST['submit_sitemap'])) {
$options['max_per_file'] = (int) trim($_POST['max_per_file']);
$options['use_location'] = (isset($_POST['use_location'])) ? (int) trim($_POST['use_location']) : 0;
$options['use_player'] = (isset($_POST['use_player'])) ? (int) trim($_POST['use_player']) : 0;
$options['ping_google'] = (isset($_POST['ping_google'])) ? 1 : 0;
if (VHelper_video_sitemap::build($options)) {
$messages[] = 'Video sitemap generated!';
} else {
$errors[] = VHelper_video_sitemap::getError();
}
}
$tpl = VF::factory('template');
$tpl->menu = 'tools';
$tpl->submenu = 'cache';
$tpl->meta_title = 'Admin::Tools::Sitemap';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->sitemap = $sitemap;
$tpl->options = $options;
$tpl->load(array('header', 'tools_sitemap_video', 'footer'));
$tpl->display();
}
}