Просмотр файла admin/server/settings.php

Размер файла: 2.11Kb
<?php

	include '../../engine/includes/start.php';
	$title = $set['title'];
	$set['title']='Настройки системы';
	include incDir . 'head.php';

	if (isset($_POST['save']))
	{
		$set['title'] = $title = Core::form('title');
		$set['antimat'] = isset($_POST['antimat']);
		$set['meta_keywords'] = Core::form('meta_keywords');
		$set['meta_description'] = Core::form('meta_description');

		if (is_dir(H.'style/themes/'.$_POST['theme']))
		{
			$set['theme'] = $_POST['theme'];
			$sql->query('ALTER TABLE `user` CHANGE `set_them` `set_them` VARCHAR( 32 ) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '.$set['theme']);
		}

		Core::save_settings($set);
		Core::msg_show('Настройки успешно приняты');
	}

	Core::get('cache.class');
	$cache = new cache(tmpDir . 'themes.swc');
	if (!$cache->life())
	{
		$opendir = opendir(H.'style/themes/');
		while ($theme = readdir($opendir))
		{
			if ($theme == '.' || $theme == '..' || !is_dir(H.'style/themes/'.$theme))
				continue;
			$conf= parse_ini_file(H.'style/themes/'.$theme.'/theme.ini');
			$themes[$theme] = $conf['name'];
		}
		$cache->write(serialize($themes));
	}
	
	$themes = unserialize($cache->read());

	?>
	<form method="post">
		Название сайта:<br />
		<input name="title" value="<?=$title?>" type="text" /><br />
		Тема :<br />
		<select name='theme'>
		<?php
		foreach($themes as $theme => $name)
		{
			echo '<option value="'.$theme.'">'.$name.'</option>';
		}
		?>
		</select><br />
		Ключевые слова (META):<br />
		<textarea name='meta_keywords'><?=$set['meta_keywords']?></textarea><br />
		Описание (META):<br />
		<textarea name='meta_description'><?=$set['meta_description']?></textarea><br />
		<label><input type='checkbox' <?=$set['antimat'] ? "checked='checked'":null?> name='antimat' value='1' /> Анти-Мат</label><br />
		<input value="Изменить" name='save' type="submit" />
	</form>
	<div class="menu_razd">См. также</div>
	<div class="link"><a href="..?act=server">Сервер</a></div>
	<div class="link"><a href="..">Админка</a></div>
	<?php
	include incDir . 'foot.php';