<?
/*
	[SueamCMS] (C)2009-2010 ZMRNet Studio
	cfg_site.php by 2009-10-06 zmrnet
*/
require_once(dirname(__FILE__).'/include/manage.php');

$cfg_act = trim($_POST['action']);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><? echo $sys_title; ?></title>
<link href="images/sueam.css" rel="stylesheet" type="text/css" />
<?
$_CFG = $vdb->open('index');

if($cfg_act=='set'){
	$site_dir	= trim($_POST['SiteDir']);
	$site_tpl	= trim($_POST['SiteTpl']);
	$site_name	= trim($_POST['SiteName']);
	$site_title	= trim($_POST['SiteTitle']);
	$site_url	= trim($_POST['SiteUrl']);
	$site_keys	= trim($_POST['Keywords']);
	$site_desc	= trim($_POST['Description']);
	$site_copy	= trim($_POST['Copyright']);
	$site_cert	= trim($_POST['CertNum']);
	
	if($site_dir==''){$site_dir=$cms_dir;}
	if(substr($site_dir,-1)!='/'){$site_dir.='/';}
	if($site_tpl==''){$site_tpl='sueam';}

	$_CFG['site_dir']	= $site_dir;
	$_CFG['site_tpl']	= $site_tpl;
	$_CFG['site_name']	= $site_name;
	$_CFG['site_title']	= $site_title;
	$_CFG['site_url']	= $site_url;
	$_CFG['site_keys']	= stripslashes($site_keys);
	$_CFG['site_desc']	= stripslashes($site_desc);
	$_CFG['site_copy']	= stripslashes($site_copy);
	$_CFG['site_cert']	= $site_cert;

	$vdb->update($_CFG);
	$vdb->write();

	die(refresh().'<script>alert(\'修改成功！\')</script>');
}else{
	if($row = ($rs = $_CFG)){
		$site_dir	= $row['site_dir'];
		$site_tpl	= $row['site_tpl'];
		$site_name	= $row['site_name'];
		$site_title	= $row['site_title'];
		$site_url	= $row['site_url'];
		$site_keys	= $row['site_keys'];
		$site_desc	= $row['site_desc'];
		$site_copy	= $row['site_copy'];
		$site_cert	= $row['site_cert'];
		
		if($site_dir==''){$site_dir=$cms_dir;}
		if($site_tpl==''){$site_tpl='sueam';}
	}else{
		$site_dir	= $cms_dir;
		$site_tpl	= 'sueam';
		$site_name	= 'Sueam CMS';
		$site_title	= 'Sueam CMS';
		$site_url	= 'http://www.sueam.cn';
		$site_keys	= 'Sueam CMS';
		$site_desc	= 'Sueam CMS';
		$site_copy	= 'CopyRight © 2009-2010 <a href="{$site_url}">{$site_name}</a> All rights reserved<br>备案编号：{$site_cert}';
		$site_cert	= '';
	}
	unset($rs);
}

unset($_CFG);
unset($_VDB);
unset($vdb);
?>
</head>
<body>
<div style="margin:20px;">
	<div style="margin:10px;font-size:14px;color:green"><b>系统配置</b></div>
	<div class="sec_menu">
	<form action="cfg_site.php" method="post" style="margin:auto;padding:25px;width:600px;text-align:left">
		网站名称：<input type="text" name="SiteName" value="<? echo $site_name; ?>" class="input_txt"><br><br>
		网站标题：<input type="text" name="SiteTitle" value="<? echo $site_title; ?>" class="input_txt"><br><br>
		网站地址：<input type="text" name="SiteUrl" value="<? echo $site_url; ?>" class="input_txt"><br><br>
		网站目录：<input type="text" name="SiteDir" value="<? echo $site_dir; ?>" class="input_txt"><br><br>
		网站模板：<input type="text" name="SiteTpl" value="<? echo $site_tpl; ?>" class="input_txt"><br><br>
		关 键 词：<textarea name="Keywords" rows="3" class="input_txt2"><? echo $site_keys; ?></textarea><br><br>
		网站描述：<textarea name="Description" rows="3" class="input_txt2"><? echo $site_desc; ?></textarea><br><br>
		版权信息：<textarea name="Copyright" rows="3" class="input_txt2"><? echo $site_copy; ?></textarea><br><br>
		备案编号：<input type="text" name="CertNum" value="<? echo $site_cert; ?>" class="input_txt"><br><br>
		<input type="reset" value="还 原" class="input_btn">&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="submit" value="提 交" class="input_btn">
		<input type="hidden" name="action" value="set">
	</form>
	</div><br>
</div>
</body>
</html>