<?

$PageConfig = [	
	'title' =>  'Настройки системы',
];
PageConfig($PageConfig);

$TempSet = $set;
if (isset($_POST['save'])) {

    $TempSet['default_description'] = $_POST['default_description'];
    $TempSet['default_title'] = $_POST['default_title'];
    $TempSet['default_keywords'] = $_POST['default_keywords'];
	$TempSet['timezone'] = $_POST['timezone'];
	$TempSet['user_cookie'] = abs((int) $_POST['user_cookie']);
    $TempSet['systemEmail'] = $_POST['systemEmail'];
    $TempSet['cron_system_limit'] = abs((int) $_POST['cron_system_limit']);
    $TempSet['cron_trash_time'] =  abs((int) $_POST['cron_trash_time']);
    $TempSet['http'] = ($_POST['http'] == 'http' ? 'http' : 'https');
	$TempSet['copyfoot'] = $_POST['copyfoot'];
	$TempSet['rules'] = $_POST['rules'];

	save_settings($TempSet);
	Redirection('?','Успешно');
}

if (isset($_GET['setType'], $_GET['setTypeVal'])) {
	$setType = output($_GET['setType'], 'html');
	$TempSet[$setType] = (int) $_GET['setTypeVal'];
	save_settings($TempSet);
	exit(header('Location: ?ok#'.$setType));
}

?>
<!--
<div class="title">
	<a class="title" style="color:#607d8b;" href="/apanel/">
		Админка
	</a> /
	<?=$PageConfig['title']?> 
</div>
-->
<div class="mf2"></div><br/>
<div class="mf2">
	<span name="display_errors"></span>
	Показ ошибок :<br/>
	<a href="?setType=display_errors&setTypeVal=1" class="span"><span style="color:#<?=($set['display_errors'] == 1 ? '18b31e' : 'de5f52')?>;">Всем</span></a>
	<a href="?setType=display_errors&setTypeVal=2" class="span"><span style="color:#<?=($set['display_errors'] == 2 ? '18b31e' : 'de5f52')?>;">Администрации</span></a>
	<a href="?setType=display_errors&setTypeVal=3" class="span"><span style="color:#<?=($set['display_errors'] == 3 ? '18b31e' : 'de5f52')?>;">Скрыты от всех</span></a>
	
	<hr/><span id="log_errors"></span>
	Создание лога ошибок   :<br/>
	<a href="?setType=log_errors&setTypeVal=1" class="span"><span style="color:#<?=($set['log_errors'] == 1 ? '18b31e' : 'de5f52')?>;">Включено</span></a>
	<a href="?setType=log_errors&setTypeVal=0" class="span"><span style="color:#<?=($set['log_errors'] == 0 ? '18b31e' : 'de5f52')?>;">Выключено</span></a>
	
	<hr/><span id="show_GenPage"></span>
	Показ ген. страниц   :<br/>
	<a href="?setType=show_GenPage&setTypeVal=1" class="span"><span style="color:#<?=($set['show_GenPage'] == 1 ? '18b31e' : 'de5f52')?>;">Включено</span></a>
	<a href="?setType=show_GenPage&setTypeVal=0" class="span"><span style="color:#<?=($set['show_GenPage'] == 0 ? '18b31e' : 'de5f52')?>;">Выключено</span></a>
	
	<hr/><span id="show_SqlCount"></span>
	Показ числа SQL запросов на странице   :<br/>
	<a href="?setType=show_SqlCount&setTypeVal=1" class="span"><span style="color:#<?=($set['show_SqlCount'] == 1 ? '18b31e' : 'de5f52')?>;">Включено</span></a>
	<a href="?setType=show_SqlCount&setTypeVal=0" class="span"><span style="color:#<?=($set['show_SqlCount'] == 0 ? '18b31e' : 'de5f52')?>;">Выключено</span></a>

	<hr/><span id="cron_trash"></span>
	Крон задание (корзина)  :<br/>
	<a href="?setType=cron_trash&setTypeVal=1" class="span"><span style="color:#<?=($set['cron_trash'] == 1 ? '18b31e' : 'de5f52')?>;">Включено</span></a>
	<a href="?setType=cron_trash&setTypeVal=0" class="span"><span style="color:#<?=($set['cron_trash'] == 0 ? '18b31e' : 'de5f52')?>;">Выключено</span></a>
	
	<hr/><span id="cron_parser"></span>
	Крон задание (парсер)  :<br/>
	<a href="?setType=cron_parser&setTypeVal=1" class="span"><span style="color:#<?=($set['cron_parser'] == 1 ? '18b31e' : 'de5f52')?>;">Включено</span></a>
	<a href="?setType=cron_parser&setTypeVal=0" class="span"><span style="color:#<?=($set['cron_parser'] == 0 ? '18b31e' : 'de5f52')?>;">Выключено</span></a>
	
	<hr/><span id="cron_public"></span>
	Крон задание (авто-публикация новостей)  :<br/>
	<a href="?setType=cron_public&setTypeVal=1" class="span"><span style="color:#<?=($set['cron_public'] == 1 ? '18b31e' : 'de5f52')?>;">Включено</span></a>
	<a href="?setType=cron_public&setTypeVal=0" class="span"><span style="color:#<?=($set['cron_public'] == 0 ? '18b31e' : 'de5f52')?>;">Выключено</span></a>
	<br/><br/>

	<form method="post" name="message" action="">
	
		<div class="post_title_3">У сайта http или https ?</div>
		<select name="http">
		<option value="https" <?=($TempSet['http'] == 'https' ? 'selected="selected"' : '')?>>https</option>
		<option value="http" <?=($TempSet['http'] == 'http' ? 'selected="selected"' : '')?>>http</option>
		</select><br/>
		
		<div class="post_title_3">Временаня метка сервера</div>
		<input class="form-input" type="text" name="timezone" value="<?=$TempSet['timezone']?>">
		<br/><br/>
		
		<div class="post_title_3">Системный почтовый ящик</div>
		<input class="form-input" type="text" name="systemEmail" value="<?=$TempSet['systemEmail']?>">
		<br/><br/>	
		
		<div class="post_title_3">Время хранения куки пользователя</div>
		<input class="form-input" type="text" name="user_cookie" value="<?=$TempSet['user_cookie']?>">
		<br/><br/>	

		<div class="post_title_3">Сколько публиковать новостей за 1 раз </div>
		<select name="cron_system_limit">
		<option value="1" <?=($TempSet['cron_system_limit'] == 1 ? 'selected="selected"' : '')?>>1 новость</option>
		<option value="2" <?=($TempSet['cron_system_limit'] == 2 ? 'selected="selected"' : '')?>>2 новости</option>
		<option value="3" <?=($TempSet['cron_system_limit'] == 3 ? 'selected="selected"' : '')?>>3 новости</option>
		<option value="5" <?=($TempSet['cron_system_limit'] == 5 ? 'selected="selected"' : '')?>>5 новостей</option>
		<option value="7" <?=($TempSet['cron_system_limit'] == 7 ? 'selected="selected"' : '')?>>7 новостей</option>
		<option value="10" <?=($TempSet['cron_system_limit'] == 10 ? 'selected="selected"' : '')?>>10 новостей</option>
		<option value="20" <?=($TempSet['cron_system_limit'] == 20 ? 'selected="selected"' : '')?>>20 новостей</option>
		<option value="50" <?=($TempSet['cron_system_limit'] == 50 ? 'selected="selected"' : '')?>>50 новостей</option>
		<option value="9999" <?=($TempSet['cron_system_limit'] == 9999 ? 'selected="selected"' : '')?>>Все новости</option>
		</select><br/>

		<div class="post_title_3">Авто-удаление новостей из корзины (сутки)</div>
		<input class="form-input" type="text" name="cron_trash_time" value="<?=$TempSet['cron_trash_time']?>">
		<br/><br/>		
		
		<div class="post_title_3">Копирайт внизу страниц</div>
		<input class="form-input" type="text" name="copyfoot" value="<?=$TempSet['copyfoot']?>">
		<br/><br/>		
		
		<div class="post_title_3">Title страниц по умолчанию</div>
		<input class="form-input" type="text" name="default_title" value="<?=$TempSet['default_title']?>">
		<br/><br/>	

		<div class="post_title_3">Description страниц по умолчанию</div>
		<textarea name="default_description"><?=$TempSet['default_description']?></textarea>
		<br/><br/>
			
		<div class="post_title_3">Keywords страниц по умолчанию</div>
		<textarea name="default_keywords"><?=$TempSet['default_keywords']?></textarea>
		<br/><br/>		
		
		<div class="post_title_3">Правила сайта</div>
		<textarea name="rules"><?=$TempSet['rules']?></textarea>
		<br/><br/>	
	
		<br/>
		<input name="save" value="Сохранить" type="submit">
	</form>	
	
</div>

