<?php
session_start();  
	require_once('inc/conn.php');
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/check.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');

function getolddir($content)
{	
	require_once('inc/conn.php');
	$opendb=new mydb();
	require_once('inc/char_set.php');
	$olddir_sql="select * from ls_products where position('ls_admin' IN ".$content.")>0 ";
	$olddir_query=$opendb->query($olddir_sql);
	$olddir_rows=mysql_fetch_assoc($olddir_query); 
	$olddirstr=$olddir_rows[$content];
	$olddir=substr($olddirstr,0,strpos($olddirstr,'ls_admin'));
	$olddir=substr($olddir,strrpos($olddir,'"')+1).'ls_admin';
	
	return($olddir);
}

	$ls=$_POST['ls'];
	$replacedir=$_POST['replacedir'];
	$ls_msg="修改网站配制操作";
	
	if ($ls=="modi")
	{
		$modi_sql="update ls_config set 
					companyNameCn =  '".$_POST['companyNameCn']."'  ,
				  	companyName   =  '".$_POST['companyName']."'	,
					siteKeywords  =  '".$_POST['siteKeywords']."'   ,
					siteDescription = '".$_POST['siteDescription']."',
					address ='".$_POST['address']."' ,
					tel = '".$_POST['tel']."' ,
					fax = '".$_POST['fax']."' ,
					email ='".$_POST['email']."' ,
					MSN ='".$_POST['MSN']."' ,
					feedback ='".$_POST['feedback']."',
					ICP = '".$_POST['ICP']."',
					feedbackEmail = '".$_POST['feedbackEmail']."',
					bottomMenu = '".$_POST['bottomMenu']."',
					website = '".$_POST['website']."',
					templates = '".$_POST['select2']."'
				  ";
		//echo $modi_sql;
		$modi_query=$opendb->query($modi_sql);
		$ls_msg="修改配制操作成功！";
	}
	if($replacedir=="进行目录整理")
	{
		$currentdir=trim($_POST['currentdir']);
		$olddir=trim($_POST['olddir']);
		$replacedir_sql="update  ls_products set productSpecification=replace(productSpecification,'".$olddir."','".$currentdir."'),   cateBrief=replace(cateBrief,'".$olddir."','".$currentdir."'), cateDetail=replace(cateDetail,'".$olddir."','".$currentdir."'), midcateBrief=replace(midcateBrief,'".$olddir."','".$currentdir."'), midcateDetail=replace(midcateDetail,'".$olddir."','".$currentdir."'), subcateBrief=replace(subcateBrief,'".$olddir."','".$currentdir."'), subcateDetail=replace(subcateDetail,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);
	}
	
	$config_sql="select * from ls_config ";
	$config_query=$opendb->query($config_sql);
	$config_rows=mysql_fetch_assoc($config_query);
	$olddir=getolddir('productSpecification');
	if($olddir=='ls_admin'){$olddir=getolddir('cateBrief');}
	if($olddir=='ls_admin'){$olddir=getolddir('cateDetail');}
	if($olddir=='ls_admin'){$olddir=getolddir('midcateBrief');}
	if($olddir=='ls_admin'){$olddir=getolddir('midcateDetail');}
	if($olddir=='ls_admin'){$olddir=getolddir('subcateBrief');}
	if($olddir=='ls_admin'){$olddir=getolddir('subcateDetail');}
	//echo $olddir;
	$currentdir=dirname($_SERVER['HTTP_REFERER']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/admin.css" rel="stylesheet" type="text/css">
<link href="css/newui.css" rel="stylesheet" type="text/css">
<title>无标题文档</title>
</head>
<script type="text/javascript" src="js/newui.js"></script>
<body>
<div class="maintitle"> <strong>系统配置</strong> </div>
<div class="mainfield">
	<form name="fmconfig" method="post" action="<?php echo $PHP_SELF;?>">
		<input type="hidden" name="ls" value="modi" />
		<div class="messagebox"> 提示：<font color="#FF0000"><?php echo $ls_msg; ?></font> </div>
		<div class="tabletitle"> </div>
		<div class="editableoverall">
			<div class="parellelleft">
				<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					<legend>公司基本信息</legend>
					<div class="infolabel">后台登录名称：</div>
					<div class="infoinput">
						<textarea name="companyNameCn" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['companyNameCn'];?></textarea>
					</div>
					<div class="infolabel">网站首页标题：</div>
					<div class="infoinput">
						<textarea name="companyName" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['companyName'];?></textarea>
					</div>
				</fieldset>
			</div>
			<div class="parellelright">
				<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					<legend>SEO优化</legend>
					<div class="infolabel">Keywords（网站关键字）：</div>
					<div class="infoinput">
						<textarea name="siteKeywords" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['siteKeywords'];?></textarea>
					</div>
					<div class="infolabel">Description（网站描述）：</div>
					<div class="infoinput">
						<textarea name="siteDescription" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['siteDescription'];?></textarea>
					</div>
				</fieldset>
			</div>
			<div class="communinputoverall">
				<fieldset class="communfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					<legend>公司基本联系信息</legend>
					<div class="ifparellelleft">
						<div class="ifinfolabel">Tel（电话）：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['tel'];?>" name="tel" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifparellelright">
						<div class="ifinfolabel">Fax（传真）：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['fax'];?>" name="fax" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifparellelleft">
						<div class="ifinfolabel">E-Mail（底部菜单邮箱）：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['email'];?>" name="email" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifparellelright">
						<div class="ifinfolabel">E-Mail（反馈表邮箱）：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['feedbackEmail'];?>" name="feedbackEmail" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifparellelleft">
						<div class="ifinfolabel">MSN：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['MSN'];?>" name="MSN" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifparellelright">
						<div class="ifinfolabel">Website（网址）：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['website'];?>" name="website" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifparellelleft">
						<div class="ifinfolabel">ICP备案号：</div>
						<div>
							<input type="text" value="<?php echo $config_rows['ICP'];?>" name="ICP" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);">
						</div>
					</div>
					<div class="ifsingle">
						<div class="ifinfolabel" style="width:30%; ">Address（经营地点）：</div>
						<input type="text" value="<?php echo $config_rows['address'];?>" name="address" class="ifinfoinputlong" style="width:50%;" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					</div>
					<div class="ifparellelright">
						<div class="ifproverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
							<input type="submit"  value="修改配置" class="submitbuttonsf4">
						</div>
					</div>
				</fieldset>
				<fieldset class="communfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					<legend>模板</legend>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="16%" align="right">当前模板为：</td>
						<td width="34%"><input type="text" value="<?php echo $config_rows['templates'];?>" name="templates" class="ifinfoinputshort" disabled= "disabled " onMouseOver="ibov(this);" onMouseOut="ibou(this);"></td>
						<td width="18%" align="right">选择模板：</td>
						<td width="32%"><select name="select2" id="select2" onChange="show()" >
								<option value="Templates1">Templates1</option>
								<option value="Templates2">Templates2</option>
								<option value="Templates1">Templates3</option>
								<option value="Templates2">Templates4</option>
							</select></td>
					</tr>
				</table>
				</fieldset>
				<fieldset class="lsconeditorsfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					<legend>底部菜单代码</legend>
					<div class="lsconeditorarea">
						<?php
								require_once('fckeditor/fckeditor.php');
								$sBasePath=$_SERVER['PHP_SELF'];
								$sBasePath=substr($sBasePath,0,strpos($sBasePath,"ls_admin"));
								$sBasePath.="ls_admin/fckeditor/";
									
								$oFCKeditor=new FCKeditor('bottomMenu');
								$oFCKeditor->BasePath=$sBasePath;
								$oFCKeditor->Config['SkinPath']=$sBasePath.'editor/skins/silver/';
								$oFCKeditor->Config['AutoDetectLanguage']=true;
								$oFCKeditor->ToolbarSet='Default';
								$oFCKeditor->Height='350';
								$oFCKeditor->Value=$_POST['bottomMenu'];
								$oFCKeditor->Create();
							?>
					</div>
				</fieldset>
				<fieldset class="lsconeditorsfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
					<legend>反馈表</legend>
					<div class="lsconeditorarea">
						<?php
								require_once('fckeditor/fckeditor.php');
								$sBasePath=$_SERVER['PHP_SELF'];
								$sBasePath=substr($sBasePath,0,strpos($sBasePath,"ls_admin"));
								$sBasePath.="ls_admin/fckeditor/";
									
								$oFCKeditor=new FCKeditor('feedback');
								$oFCKeditor->BasePath=$sBasePath;
								$oFCKeditor->Config['SkinPath']=$sBasePath.'editor/skins/silver/';
								$oFCKeditor->Config['AutoDetectLanguage']=true;
								$oFCKeditor->ToolbarSet='Default';
								$oFCKeditor->Height='350';
								$oFCKeditor->Value=$_POST['feedback'];
								$oFCKeditor->Create();
							?>
					</div>
				</fieldset>
			</div>
		</div>
		<div class="tablefooter">
			<div class="tfoverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
				<input type="submit"  value="修改配置" class="submitbuttonsb9">
			</div>
		</div>
	</form>
	<div class="condircon">
		<form name="changedir" method="post" action="">
			<div class="condirlabel">原来系统目录</div>
			<div class="condirinput">
				<input name="olddir" type="text" id="textfield2" size="40" value="<? echo $olddir ?>" class="condirinputbox" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
			</div>
			<div class="condirlabel">当前系统目录</div>
			<div class="condirinput">
				<input name="currentdir" type="text" id="textfield" size="40" value="<? echo $currentdir ?>" class="condirinputbox" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
			</div>
			<div class="condiroverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
				<input type="submit" name="replacedir" id="button" value="进行目录整理" class="submitbunttonsc4">
			</div>
		</form>
	</div>
</div>
</body>
</html>