<?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']."',
					email2 = '".$_POST['email2']."' ,
					email3 = '".$_POST['email3']."' ,
					email4 = '".$_POST['email4']."' ,
					tel2 = '".$_POST['tel2']."' ,
					tel3 = '".$_POST['tel3']."' ,
					tel4 = '".$_POST['tel4']."' ,
					MSN2 = '".$_POST['MSN2']."' ,
					MSN3 = '".$_POST['MSN3']."' ,
					MSN4 = '".$_POST['MSN4']."' ,
					skype = '".$_POST['skype']."' ,
					skype2 = '".$_POST['skype2']."' ,
					skype3 = '".$_POST['skype3']."' ,
					skype4 = '".$_POST['skype4']."' 
				  ";
		//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/ls2.js"></SCRIPT>
<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" >
							<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"  ><?php echo $config_rows['companyNameCn'];?></textarea>
									</td>
								</tr>
								<tr>
									<td align="right">网站首页标题：</td>
									<td><textarea name="companyName" class="inputareashort"  ><?php echo $config_rows['companyName'];?></textarea>
									</td>
								</tr>
							</table>
						</fieldset>
					</td>
					<td colspan="2">
						<fieldset class="infofield"  >
							<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"  ><?php echo $config_rows['siteKeywords'];?></textarea>
									</td>
								</tr>
								<tr>
									<td align="right">Description（网站描述）：</td>
									<td><textarea name="siteDescription" class="inputareashort" ><?php echo $config_rows['siteDescription'];?></textarea>
									</td>
								</tr>
							</table>
						</fieldset>
					</td>
					</tr>
				<tr bgcolor="#f4f4f4">
					<td colspan="4">
						<fieldset class="communfield"  >
							<legend>基本联系信息</legend>
						  <table width="800" border="0" cellspacing="0" cellpadding="0">
								<tr>
								  <td width="160" height="32" align="right">Tel（电话）： </td>
									<td width="240" align="left"><input type="text" value="<?php echo $config_rows['tel'];?>" name="tel" class="ifinfoinputshort"   ></td>
									<td width="160" align="right">Fax（传真）：</td>
									<td width="240"><input type="text" value="<?php echo $config_rows['fax'];?>" name="fax" class="ifinfoinputshort" /></td>
								</tr>
								<tr>
								  <td align="right" height="32">E-Mail（底部菜单邮箱）：</td>
									<td align="left"><input type="text" value="<?php echo $config_rows['email'];?>" name="email" class="ifinfoinputshort"   onblur="this.form.feedbackEmail.value==''?this.form.feedbackEmail.value=this.value:''"  /></td>
									<td align="right">MSN：</td>
									<td><input type="text" value="<?php echo $config_rows['MSN'];?>" name="MSN" class="ifinfoinputshort"    /></td>
								</tr>
								<tr>
								  <td align="right" height="32">E-Mail（反馈表邮箱）：</td>
									<td align="left"><input type="text" value="<?php echo $config_rows['feedbackEmail'];?>" name="feedbackEmail" class="ifinfoinputshort"    /></td>
									<td align="right">ICP备案号：</td>
									<td><input type="text" value="<?php echo $config_rows['ICP'];?>" name="ICP" class="ifinfoinputshort"    /></td>
								</tr>
								<tr>
								  <td align="right" height="32">Website（网址）：</td>
									<td align="left"><input type="text" value="<?php echo $config_rows['website'];?>" name="website" class="ifinfoinputshort"    /></td>
									<td align="right">Skype：</td>
									<td><input type="text" value="<?php echo $config_rows['skype'];?>" name="skype" class="ifinfoinputshort" /></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:97%;"   />
									</td>
							</tr>
								<tr>
									<td height="32" align="right"><a id=requestimg 
      onclick="javascript:showtable('notmust');" href="javascript:void(0);"><img src="../img/ico-.gif" border="0" 
      id=ico /> 更多联系</a></td>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
									<td align="left"><div class="ifproverbutton"  >
										<input type="submit"  value="修改配置" class="submitbuttonsf4">
									  </div>
								  </td>
								</tr>
							</table>
							<table width="95%" height="80" border="0" align="right" cellpadding="0" cellspacing="0" id="notmust" style="DISPLAY:none ; " >
							  <tr>
							    <td width="120" align="right">Tel 2： </td>
							    <td width="162" align="left"><input type="text" value="<?php echo $config_rows['tel2'];?>" name="tel2" class="ifinfoinputshort2" /></td>
							    <td width="69" align="right">Tel 3： </td>
							    <td width="162" align="left"><input type="text" value="<?php echo $config_rows['tel3'];?>" name="tel3" class="ifinfoinputshort2" /></td>
							    <td width="70" align="right">Tel 4：</td>
							    <td width="187" align="left"><input type="text" value="<?php echo $config_rows['tel4'];?>" name="tel4" class="ifinfoinputshort2" /></td>
						      </tr>
							  <tr>
							    <td align="right">Email 2： </td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['email2'];?>" name="email2" class="ifinfoinputshort2" /></td>
							    <td align="right">Email 3： </td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['email3'];?>" name="email3" class="ifinfoinputshort2" /></td>
							    <td align="right">Email 4：</td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['email4'];?>" name="email4" class="ifinfoinputshort2" /></td>
						      </tr>
							  <tr>
							    <td align="right">MSN 2： </td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['MSN2'];?>" name="MSN2" class="ifinfoinputshort2" /></td>
							    <td align="right">MSN 3： </td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['MSN3'];?>" name="MSN3" class="ifinfoinputshort2" /></td>
							    <td align="right">MSN 4：</td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['MSN4'];?>" name="MSN4" class="ifinfoinputshort2" /></td>
						      </tr>
							  <tr>
							    <td align="right">Skype 2： </td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['skype2'];?>" name="skype2" class="ifinfoinputshort2" /></td>
							    <td align="right">Skype 3： </td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['skype3'];?>" name="skype3" class="ifinfoinputshort2" /></td>
							    <td align="right">Skype 4：</td>
							    <td align="left"><input type="text" value="<?php echo $config_rows['skype4'];?>" name="skype4" class="ifinfoinputshort2" /></td>
						      </tr>
						  </table>
                        </fieldset>
					</td>
					</tr>
					<tr bgcolor="#f4f4f4">
					<td colspan="4">
					<?php file_exists("widget/ls_config_template.php")?include "widget/ls_config_template.php":"" ?>
						
					</td>
					</tr>
				<tr bgcolor="#f4f4f4">
					<td colspan="4">
                   <?php file_exists("widget/ls_config_feedback.php")?include "widget/ls_config_feedback.php":""  ?>
						</td>
					</tr>
				<tr bgcolor="#c4cfff">
					<td colspan="4" align="center">
					<?php file_exists("widget/ls_config_replacedir.php")?include "widget/ls_config_replacedir.php":""?>
					</td>
					</tr>
			</table>
			</form>
		</td>
	</tr>
</table>

</body>
</html>