UNIX_TIMESTAMP()'
: '';
// Начало
$_start = 0;
// Конец
$_end = 2000;
// Часть
$parts = 1;
$changefreq = array(
'0' => 'always',
'1' => 'hourly',
'2' => 'daily',
'3' => 'weekly',
'4' => 'monthly',
'5' => 'yearly',
'6' => 'never'
);
// Вытаскиваем кол-во документов
$sql = "
SELECT STRAIGHT_JOIN SQL_CALC_FOUND_ROWS
COUNT(doc.Id)
FROM
" . PREFIX . "_documents doc
LEFT JOIN
" . PREFIX . "_rubrics rub
ON rub.Id = doc.rubric_id
LEFT JOIN
" . PREFIX . "_rubric_permissions rubperm
ON rubperm.rubric_id = doc.rubric_id
WHERE
rub.rubric_template NOT LIKE ''
AND doc.document_status = 1
AND doc.document_deleted = 1
$publish
AND doc.Id != " . PAGE_NOT_FOUND_ID . "
AND (document_meta_robots NOT LIKE '%noindex%' or document_meta_robots NOT LIKE '%nofollow%')
AND (rubperm.user_group_id = 2 AND rubperm.rubric_permission LIKE '%docread%')
";
$num = $AVE_DB->Query($sql)->GetCell();
if ($num > $_end)
$parts = ceil($num/$_end);
if (! isset($_REQUEST['id'])):
echo '' . PHP_EOL;
echo '' . PHP_EOL;
for ($i = 1; $i <= $parts; $i++):
?>
= $domain . '/sitemap-' . $i . '.xml'; ?>
= date("c"); ?>
endfor;
echo '';
else:
?>
if ((int)$_REQUEST['id'] > 1)
$_start = ((int)$_REQUEST['id']-1) * $_end;
$sql = "
SELECT STRAIGHT_JOIN SQL_CALC_FOUND_ROWS
doc.Id,
doc.document_alias,
doc.document_published,
doc.document_changed,
doc.document_sitemap_freq,
doc.document_sitemap_pr
FROM " . PREFIX . "_documents doc
LEFT JOIN " . PREFIX . "_rubrics rub
ON rub.Id = doc.rubric_id
LEFT JOIN " . PREFIX . "_rubric_permissions rubperm
ON rubperm.rubric_id = doc.rubric_id
WHERE
rub.rubric_template NOT LIKE ''
AND doc.document_status = 1
AND doc.document_deleted = 1
$publish
AND doc.Id != " . PAGE_NOT_FOUND_ID . "
AND (document_meta_robots NOT LIKE '%noindex%' or document_meta_robots NOT LIKE '%nofollow%')
AND (rubperm.user_group_id = 2 AND rubperm.rubric_permission LIKE '%docread%')
ORDER BY doc.document_published ASC
LIMIT ".$_start.",".$_end."
";
$res = $AVE_DB->Query($sql);
echo '' . PHP_EOL;
echo '' . PHP_EOL;
if ((int)$_REQUEST['id'] == 1):
?>
echo $domain . '/'; ?>
echo date("c", time()); ?>
weekly
0.8
endif; ?>
while($row = $res->FetchAssocArray()):
$document_alias = $abs_path . $row['document_alias'] . URL_SUFF;
$document_alias = $domain . str_ireplace($abs_path . '/' . URL_SUFF, '/', $document_alias);
$date = $row["document_published"] ? date("c", $row["document_published"]) : date("c");
?>
echo $document_alias; ?>
echo $date; ?>
echo $changefreq[$row['document_sitemap_freq']]; ?>
echo $row['document_sitemap_pr']; ?>
endwhile; ?>
endif; ?>