Файл: adultscript-2.0.3-pro/files/admin/modules/tools/components/sitemap.php
Строк: 51
<?php
defined('_VALID') or die('Restricted Acccess!');
class VComponent_Admin_tools_sitemap
{
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' => 45000,
'sitemap_frontpage' => '1',
'sitemap_category' => '1',
'sitemap_pornstar' => '1',
'sitemap_static' => 0,
'sitemap_users' => 0,
'sitemap_albums' => '1',
'sitemap_photos' => '1',
'sitemap_videos' => '1',
'sitemap_forum' => 0,
'video_sitemap' => 0,
'ping_google' => 0,
'ping_bing' => 0
);
$file = BASE_DIR.'/sitemap.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));
}
if (isset($_POST['submit_sitemap'])) {
$options['sitemap_frontpage'] = (isset($_POST['sitemap_frontpage'])) ? 1 : 0;
$options['sitemap_category'] = (isset($_POST['sitemap_category'])) ? 1 : 0;
$options['sitemap_static'] = (isset($_POST['sitemap_static'])) ? 1 : 0;
$options['sitemap_pornstar'] = (isset($_POST['sitemap_pornstar'])) ? 1 : 0;
$options['sitemap_users'] = (isset($_POST['sitemap_users'])) ? 1 : 0;
$options['sitemap_albums'] = (isset($_POST['sitemap_albums'])) ? 1 : 0;
$options['sitemap_photos'] = (isset($_POST['sitemap_photos'])) ? 1 : 0;
$options['sitemap_videos'] = (isset($_POST['sitemap_videos'])) ? 1 : 0;
// $options['sitemap_forum'] = (isset($_POST['sitemap_forum'])) ? 1 : 0;
$options['video_sitemap'] = (isset($_POST['video_sitemap'])) ? 1 : 0;
$options['max_per_file'] = (int) trim($_POST['max_per_file']);
$options['ping_google'] =
VHelper::load('admin.tools.sitemap');
if (VHelper_tools_sitemap::build($options)) {
$messages[] = 'Sitemap generated!';
} else {
$errors[] = VHelper_tools_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', 'footer'));
$tpl->display();
}
}