<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
$temp_set=$set;
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';
user_access('adm_set_sys',null,'index.php?'.SID);
adm_check();
$set['title']='Настройки системы';
include_once '../sys/inc/thead.php';
title();
if (isset($_POST['save']))
{
$temp_set['title']=esc($_POST['title']);
$temp_set['mail_backup']=esc($_POST['mail_backup']);
$temp_set['p_str']=intval($_POST['p_str']);
mysql_query("ALTER TABLE `user` CHANGE `set_p_str` `set_p_str` INT( 11 ) DEFAULT '$temp_set[p_str]'");
if (!preg_match('#\.\.#',$_POST['set_them']) && is_dir(H.'style/themes/'.$_POST['set_them']))
{
$temp_set['set_them']=$_POST['set_them'];
mysql_query("ALTER TABLE `user` CHANGE `set_them` `set_them` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '$temp_set[set_them]'");
}
if (!preg_match('#\.\.#',$_POST['set_them2']) && is_dir(H.'style/themes/'.$_POST['set_them2']))
{
$temp_set['set_them2']=$_POST['set_them2'];
mysql_query("ALTER TABLE `user` CHANGE `set_them2` `set_them2` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '$temp_set[set_them2]'");
}
$temp_set['show_err_php']=(isset($_POST['show_err_php']) && $_POST['show_err_php']);
$temp_set['antidos']=(isset($_POST['antidos']) && $_POST['antidos']);
$temp_set['antimat']=(isset($_POST['antimat']) && $_POST['antimat']);
$temp_set['meta_keywords']=$_POST['meta_keywords'];
$temp_set['meta_description']=$_POST['meta_description'];
if (save_settings($temp_set))
{
admin_log('Настройки','Система','Изменение системных настроек');
msg('Настройки успешно приняты');
}
else
$err='Нет прав для изменения файла настроек';
}
err();
aut();
$smarty = new Smarty_conf();
$smarty->assign('form_title','Настройки системы');
$smarty->assign('method','POST');
$smarty->assign('action',"?$passgen");
$elements=array();
$elements[]=array('type'=>'input_text', 'title'=>'Название сайта', 'br'=>1,
'info'=>array('name' => 'title','value'=>$temp_set['title']));
$elements[]=array('type'=>'input_text', 'title'=>'Пунктов на страницу', 'br'=>1,
'info'=>array('name' => 'p_str','value'=>$temp_set['p_str']));
$options=array(); // темы оформления WAP
$themes_list=themes_list('wap'); // только для определенного типа браузера
foreach ($themes_list as $theme)$options[]=array($theme['dir'],"$theme[name] ($theme[autor])",$temp_set['set_them']==$theme['dir']);
$elements[]=array('type'=>'select', 'title' => 'Тема оформления (WAP)', 'br'=>1, 'info'=>array('name' => 'set_them','options'=>$options));
$options=array(); // темы оформления WEB
$themes_list=themes_list('web'); // только для определенного типа браузера
foreach ($themes_list as $theme)$options[]=array($theme['dir'],"$theme[name] ($theme[autor])",$temp_set['set_them2']==$theme['dir']);
$elements[]=array('type'=>'select', 'title' => 'Тема оформления (WEB)', 'br'=>1, 'info'=>array('name' => 'set_them2','options'=>$options));
$elements[]=array('type'=>'textarea', 'title'=>'Ключевые слова *', 'br'=>1,
'info'=>array('name' => 'meta_keywords','value'=>$temp_set['meta_keywords']));
$elements[]=array('type'=>'textarea', 'title'=>'Описание сайта *', 'br'=>1,
'info'=>array('name' => 'meta_description','value'=>$temp_set['meta_description']));
$elements[]=array('type'=>'checkbox', 'br'=>1,
'info'=>array('value'=>1,'checked'=>$temp_set['antimat'], 'name'=>'antimat', 'text'=>'Анти-мат **'));
$elements[]=array('type'=>'checkbox', 'br'=>1,
'info'=>array('value'=>1,'checked'=>$temp_set['antidos'], 'name'=>'antidos', 'text'=>'Анти-Dos ***'));
$elements[]=array('type'=>'checkbox', 'br'=>1,
'info'=>array('value'=>1,'checked'=>$temp_set['show_err_php'], 'name'=>'show_err_php', 'text'=>'Показывать ошибки'));
$elements[]=array('type'=>'input_text', 'title'=>'E-mail для Back-UP', 'br'=>1,
'info'=>array('name' => 'mail_backup','value'=>$temp_set['mail_backup']));
$elements[]=array('type'=>'text', 'value'=>'* META теги в коде страницы. Информация для поисковых систем.', 'br'=>1);
$elements[]=array('type'=>'text', 'value'=>'** При обнаружении нецензурной лексики в сообщении выводится предупреждение. На третий раз задействуется БАН.', 'br'=>1);
$elements[]=array('type'=>'text', 'value'=>'*** Анти-Dos - защита от частых запросов с одного IP-адреса', 'br'=>1);
$elements[]=array('type'=>'submit', 'br'=>0, 'info'=>array('name'=>'save', 'value'=>'Применить')); // кнопка
$smarty->assign('el',$elements);
$smarty->display('input.form.tpl');
$smarty = new Smarty_conf();
$smarty->assign('menu_title','Навигация');
$menu=array();
$menu[]=array('.','Админка');
$smarty->assign('menu',$menu);
$smarty->display('links.path.tpl');
include_once '../sys/inc/tfoot.php';
?>