<?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">
	
	function setInnerHTML(){
		var path1 = document.getElementById("select2").value;
		document.getElementById("img1").innerHTML="<img src='../"+path1+"/"+path1+".jpg' width='400' />";
	}
	
</script> 

<body>
<table width="880" border="0" cellpadding="3" cellspacing="1" bgcolor="#6396d6">
	<tr bgcolor="#6396d6">
		<td colspan="4" bgcolor="#6396d6" align="center" height="18"><font color="#FFFFFF"><strong>系统配置</strong></font></td>
	</tr>
	<tr bgcolor="#6396d6">
		<td align="center" bgcolor="#D6DFF7" >
		<form name="fmconfig" method="post" action="<?php echo $PHP_SELF;?>">
			<input type="hidden" name="ls" value="modi" />
			<table width="829" style="margin-top:16px;">
				<tr>
					<td colspan="2" align="left">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
					<td width="402" colspan="2">&nbsp;</td>
					</tr>
				<tr>
			</table>
			<table width="829" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" style=" margin-bottom:20px;">
					<td colspan="4" bgcolor="#B9DAFF">&nbsp;</td>
					</tr>
				<tr bgcolor="#f4f4f4" >
					<td colspan="2">
						<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
							<legend>公司基本信息</legend>
							<table width="380" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="150" align="right">后台登录名称：</td>
									<td width="230"><textarea name="companyNameCn" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['companyNameCn'];?></textarea>
									</td>
								</tr>
								<tr>
									<td align="right">网站首页标题：</td>
									<td><textarea name="companyName" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['companyName'];?></textarea>
									</td>
								</tr>
							</table>
						</fieldset>
					</td>
					<td colspan="2">
						<fieldset class="infofield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
							<legend>SEO优化</legend>
							<table width="380" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="160" align="right">Keywords（网站关键字）：</td>
									<td width="220"><textarea name="siteKeywords" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['siteKeywords'];?></textarea>
									</td>
								</tr>
								<tr>
									<td align="right">Description（网站描述）：</td>
									<td><textarea name="siteDescription" class="inputareashort" onMouseOver="ibov(this);" onMouseOut="ibou(this);"><?php echo $config_rows['siteDescription'];?></textarea>
									</td>
								</tr>
							</table>
						</fieldset>
					</td>
					</tr>
				<tr bgcolor="#f4f4f4">
					<td colspan="4">
						<fieldset class="communfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
							<legend>公司基本联系信息</legend>
							<table width="800" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="160" height="32" align="right">Tel（电话）： </td>
									<td width="240"><input type="text" value="<?php echo $config_rows['tel'];?>" name="tel" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);"></td>
									<td width="160" align="right">Fax（传真）：</td>
									<td width="240"><input type="text" value="<?php echo $config_rows['fax'];?>" name="fax" class="ifinfoinputshort"  onMouseOver="ibov(this);" onMouseOut="ibou(this);"></td>
								</tr>
								<tr>
									<td align="right" height="32">E-Mail（底部菜单邮箱）：</td>
									<td><input type="text" value="<?php echo $config_rows['email'];?>" name="email" class="ifinfoinputshort"  onmouseover="ibov(this);" onmouseout="ibou(this);" /></td>
									<td align="right">MSN：</td>
									<td><input type="text" value="<?php echo $config_rows['MSN'];?>" name="MSN" class="ifinfoinputshort"  onmouseover="ibov(this);" onmouseout="ibou(this);" /></td>
								</tr>
								<tr>
									<td align="right" height="32">E-Mail（反馈表邮箱）：</td>
									<td><input type="text" value="<?php echo $config_rows['feedbackEmail'];?>" name="feedbackEmail" class="ifinfoinputshort"  onmouseover="ibov(this);" onmouseout="ibou(this);" /></td>
									<td align="right">ICP备案号：</td>
									<td><input type="text" value="<?php echo $config_rows['ICP'];?>" name="ICP" class="ifinfoinputshort"  onmouseover="ibov(this);" onmouseout="ibou(this);" /></td>
								</tr>
								<tr>
									<td align="right" height="32">Website（网址）：</td>
									<td><input type="text" value="<?php echo $config_rows['website'];?>" name="website" class="ifinfoinputshort"  onmouseover="ibov(this);" onmouseout="ibou(this);" /></td>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
								</tr>
								<tr>
									<td align="right" height="32">Address（经营地点）： </td>
									<td colspan="3" align="left"><input type="text" value="<?php echo $config_rows['address'];?>" name="address" class="ifinfoinputlong" style="width:50%;" onmouseover="ibov(this);" onmouseout="ibou(this);" />
									</td>
									</tr>
								<tr>
									<td height="32">&nbsp;</td>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
									<td align="left">
										<div class="ifproverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
											<input type="submit"  value="修改配置" class="submitbuttonsf4">
										</div>
									</td>
								</tr>
							</table>
						</fieldset>
					</td>
					</tr>
				<tr bgcolor="#f4f4f4">
					<td colspan="4">
<!--						<fieldset class="communfield" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
							<legend>模板</legend>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="26%" align="right" height="40">当前模板为：</td>
									<td width="24%" align="left"><input type="text" value="<?php echo $config_rows['templates'];?>" name="templates" class="ifinfoinputshort" disabled= "disabled" onmouseover="ibov(this);" onmouseout="ibou(this);" /></td>
									<td width="16%" align="right">选择模板：</td>
									<td width="34%" align="left"><select name="select2" id="select2" onchange="setInnerHTML()" >
<?
	for($i = 1; $i < 5; $i++){
		$file = "../Templates".$i;
		if(is_dir($file)){
			$file2 = str_replace("../","",$file)
?>
			<option value="<?=$file2?>"><?=$file2?></option>
<?
		}
	}
?>
									</select></td>
								</tr>
								<tr>
									<td colspan="4" align="center">&nbsp;
										
									</td>
									</tr>
								<tr>
									<td colspan="4" align="center">
										<table width="400" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td id="img1"><img src="../Templates1/Templates1.jpg" width="400" /></td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td colspan="4" align="center">&nbsp;
										
									</td>
									</tr>
							</table>
						</fieldset>
                        
                        
					</td>
					</tr>-->
				<tr bgcolor="#f4f4f4">
					<td colspan="4">
						<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>
						
					</td>
					</tr>
				<tr bgcolor="#f4f4f4">
					<td colspan="4">
						<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>
						</td>
					</tr>
				<tr>
						<td colspan="4" bgcolor="#B9DAFF" align="center" height="18"><strong>系统配置</strong></td>
					</tr>
				<tr bgcolor="#c4cfff">
					<td colspan="4" align="center">
						<table width="820" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="150" align="right">原来系统目录：</td>
								<td width="670">
									<input name="olddir" type="text" id="textfield2" size="40" value="<? echo $olddir ?>" class="condirinputbox" onmouseover="ibov(this);" onmouseout="ibou(this);" />
								</td>
							</tr>
							<tr>
								<td align="right">当前系统目录：</td>
								<td>
									<input name="currentdir" type="text" id="textfield" size="40" value="<? echo $currentdir ?>" class="condirinputbox" onMouseOver="ibov(this);" onMouseOut="ibou(this);">
								</td>
							</tr>
							<tr height="32">
								<td>&nbsp;</td>
								<td>
									<div class="ifproverbutton" onMouseOver="ibov(this);" onMouseOut="ibou(this);" style="background:#ccc">
										<input type="submit" name="replacedir" id="button" value="进行目录整理" class="submitbunttonsc4">
									</div>
								</td>
							</tr>
						</table>
					</td>
					</tr>
			</table>
			</form>
		</td>
	</tr>
</table>

</body>
</html>