File size: 3.51Kb
<?php
/**
* @package JohnCMS
* @link http://johncms.com
* @copyright Copyright (C) 2008-2011 JohnCMS Community
* @license LICENSE.txt (see attached file)
* @version VERSION.txt (see attached file)
* @author http://johncms.com/about
*/
defined('_IN_JOHNADM') or die('Error: restricted access');
// Проверяем права доступа
if ($rights < 9) {
header('Location: http://johncms.com/?err');
exit;
}
echo '<div class="phdr"><a href="index.php"><b>' . $lng['admin_panel'] . '</b></a> | ' . $lng['site_map'] . '</div>';
/*
-----------------------------------------------------------------
Настройки карты сайта
-----------------------------------------------------------------
*/
if (!isset($set['sitemap']) || isset($_GET['reset'])) {
// Задаем настройки по умолчанию
$settings = array (
'forum' => 1,
'lib' => 1,
'users' => 0,
'browsers' => 0
);
@mysql_query("DELETE FROM `cms_settings` WHERE `key` = 'sitemap'");
mysql_query("INSERT INTO `cms_settings` SET
`key` = 'sitemap',
`val` = '" . mysql_real_escape_string(serialize($settings)) . "'
");
echo '<div class="rmenu"><p>' . $lng['settings_default'] . '</p></div>';
} elseif (isset($_POST['submit'])) {
// Принимаем настройки из формы
$settings['forum'] = isset($_POST['forum']);
$settings['lib'] = isset($_POST['lib']);
$settings['users'] = isset($_POST['users']) && $_POST['users'] == 1 ? 1 : 0;
$settings['browsers'] = isset($_POST['browsers']) && $_POST['browsers'] == 1 ? 1 : 0;
mysql_query("UPDATE `cms_settings` SET
`val` = '" . mysql_real_escape_string(serialize($settings)) . "'
WHERE `key` = 'sitemap'
");
echo '<div class="gmenu"><p>' . $lng['settings_saved'] . '</p></div>';
} else {
// Получаем сохраненные настройки
$settings = unserialize($set['sitemap']);
}
/*
-----------------------------------------------------------------
Форма ввода настроек
-----------------------------------------------------------------
*/
echo '<form action="index.php?act=sitemap" method="post"><div class="menu"><p>' .
'<h3>' . $lng['include_in_map'] . '</h3>' .
'<input name="forum" type="checkbox" value="1" ' . ($settings['forum'] ? 'checked="checked"' : '') . ' /> ' . $lng['forum'] . '<br />' .
'<input name="lib" type="checkbox" value="1" ' . ($settings['lib'] ? 'checked="checked"' : '') . ' /> ' . $lng['library'] . '</p>' .
'<p><h3>' . $lng['browsers'] . '</h3>' .
'<input type="radio" value="1" name="browsers" ' . ($settings['browsers'] == 1 ? 'checked="checked"' : '') . '/> ' . $lng['show_all'] . '<br />' .
'<input type="radio" value="0" name="browsers" ' . (!$settings['browsers'] ? 'checked="checked"' : '') . '/> ' . $lng['show_only_computers'] . '</p>' .
'<p><h3>' . $lng['users'] . '</h3>' .
'<input type="radio" value="1" name="users" ' . ($settings['users'] == 1 ? 'checked="checked"' : '') . '/> ' . $lng['show_all'] . '<br />' .
'<input type="radio" value="0" name="users" ' . (!$settings['users'] ? 'checked="checked"' : '') . '/> ' . $lng['show_only_guests'] . '</p>' .
'<p><input type="submit" value="' . $lng['save'] . '" name="submit" /></p>' .
'</div></form>' .
'<div class="phdr"><a href="index.php?act=sitemap&reset">' . $lng['reset_settings'] . '</a></div>' .
'<p><a href="index.php">' . $lng['admin_panel'] . '</a></p>';
?>