<?php
	session_start();
	$funCode = true;
	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');
	
	$act=$_POST['Changehtaccess'];
	
	$statistics=$_POST['statistics'];
	$statisticsCodeURL=$_POST['statisticsUrl'];
	$onlines=$_POST['onlines'];
	$maps=$_POST['maps'];
	$share=$_POST['share'];
	$indexKeywords=$_POST['indexKeywords'];
	$productsKeywords=$_POST['productsKeywords'];
	$shield=$_POST['shield'];
	$aboutLenght=$_POST['aboutLenght'];
	$indexPassword=$_POST['indexPassword'];
	$htaccess=$_POST['htaccess'];
	$robot=$_POST['robot'];
	$statisticsUrl=$_POST['statisticsUrl'];
	
	$onlinechartUrl=$_POST['onlinechartUrl'];
	$mapsAddress=$_POST['mapsAddress'];
	$onlinechartName=$_POST['onlinechartName'];
	$onlinechartPsd=$_POST['onlinechartPsd'];
	
	$code2=$_POST['code2'];
	$onlinechart=$_POST['onlinechart'];
	$reserve1=$_POST['reserve1'];
	$reserve2=$_POST['reserve2'];
	$reserve3=$_POST['reserve3'];
	$ls=$_POST['ls'];
	
	//二维码参数  开始
	$data=$_POST['data'];
	$olddata=$_POST['olddata'];
	$level=$_POST['level'];
	$size=$_POST['size'];
	
	$logo_name=$_FILES['logoFile']['name'];
	$logo_size=$_FILES['logoFile']['size'];
	$logo_type=$_FILES['logoFile']['type'];
	$ChangecatePagePic=$_POST['ChangecatePagePic'];
	$ChangecatePage=$_POST['ChangecatePage'];
	//二维码参数  结束
	
	//是否启用
	if($_POST['statistics2_enable']!=NULL){$statistics2_enable = 1;}else{$statistics2_enable = 0;}
	if($_POST['onlines2_enable']!=NULL){$onlines2_enable = 1;}else{$onlines2_enable = 0;}
	if($_POST['onlinechart_enable']!=NULL){$onlinechart_enable = 1;}else{$onlinechart_enable = 0;}
	if($_POST['maps2_enable']!=NULL){$maps2_enable = 1;}else{$maps2_enable = 0;}
	if($_POST['share2_enable']!=NULL){$share2_enable = 1;}else{$share2_enable = 0;}
	if($_POST['indexKeywords2_enable']!=NULL){$indexKeywords2_enable = 1;}else{$indexKeywords2_enable = 0;}
	if($_POST['productsKeywords2_enable']!=NULL){$productsKeywords2_enable = 1;}else{$productsKeywords2_enable = 0;}
	if($_POST['htaccess2_enable']!=NULL){$htaccess2_enable = 1;}else{$htaccess2_enable = 0;}
	if($_POST['robot2_enable']!=NULL){$robot2_enable = 1;}else{$robot2_enable = 0;}
	if($_POST['shield2_enable']!=NULL){$shield2_enable = 1;}else{$shield2_enable = 0;}
	if($_POST['canshu2_enable']!=NULL){$canshu2_enable = 1;}else{$canshu2_enable = 0;}
	if($_POST['basicInfo2_enable']!=NULL){$basicInfo2_enable = 1;}else{$basicInfo2_enable = 0;}
	if($_POST['additionalInfo2_enable']!=NULL){$additionalInfo2_enable = 1;}else{$additionalInfo2_enable = 0;}
	
	switch($ls)
	{
		case "insert":
			$select_sql="select * from ls_functioncode ";
			$select_query=$opendb->query($select_sql);
			
			while ($select_rows = mysql_fetch_assoc($select_query)){
				switch($select_rows['codeID']){
					case "statistics":  //访问统计
						$update_sql=sprintf("update ls_functioncode set code=%s, codeURL=%s, enable=%s where codeID=%s", 
							GetSQLValueString($statistics, "text"),
							GetSQLValueString($statisticsCodeURL, "text"),
							GetSQLValueString($statistics2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "onlinechart":  //在线联系代码 （QQ）
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($onlinechart, "text"),
							GetSQLValueString($onlines2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "onlinechartUrl":  //在线客服
						$update_sql=sprintf("update ls_functioncode set code=%s, codeURL=%s, enable=%s where codeID=%s", 
							GetSQLValueString($onlinechartPsd, "text"),
							GetSQLValueString($onlinechartUrl, "text"),
							GetSQLValueString($onlinechart_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "maps":
						$update_sql=sprintf("update ls_functioncode set code=%s, codeURL=%s, enable=%s where codeID=%s", 
							GetSQLValueString($maps, "text"),
							GetSQLValueString($mapsAddress, "text"),
							GetSQLValueString($maps2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "share":
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($share, "text"),
							GetSQLValueString($share2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "indexKeywords":
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($indexKeywords, "text"),
							GetSQLValueString($indexKeywords2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "productsKeywords":
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($productsKeywords, "text"),
							GetSQLValueString($productsKeywords2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "htaccess":
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($htaccess, "text"),
							GetSQLValueString($htaccess2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "robot":
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($robot, "text"),
							GetSQLValueString($robot2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "shield":
						$update_sql=sprintf("update ls_functioncode set code=%s, enable=%s where codeID=%s", 
							GetSQLValueString($shield, "text"),
							GetSQLValueString($shield2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "qrdata":
						$update_sql=sprintf("update ls_functioncode set code=%s where codeID=%s", 
							GetSQLValueString($data, "text"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "aboutLenght":
						$update_sql=sprintf("update ls_functioncode set code=%s where codeID=%s", 
							GetSQLValueString($aboutLenght, "text"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "indexPassword":
						$update_sql=sprintf("update ls_functioncode set code=%s where codeID=%s", 
							GetSQLValueString($indexPassword, "text"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "canshu":
						$update_sql=sprintf("update ls_functioncode set enable=%s where codeID=%s", 
							GetSQLValueString($canshu2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "basicInfo":
						$update_sql=sprintf("update ls_functioncode set enable=%s where codeID=%s", 
							GetSQLValueString($basicInfo2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
					case "additionalInfo":
						$update_sql=sprintf("update ls_functioncode set enable=%s where codeID=%s", 
							GetSQLValueString($additionalInfo2_enable, "int"),
							GetSQLValueString($select_rows['codeID'], "text")
							);
						$update_query=$opendb->query($update_sql);
					break;
				}
			}
			
			break;
	}
	
	$select_sql="select * from ls_functioncode ";
	$select_query=$opendb->query($select_sql);
	
	while ($select_rows = mysql_fetch_assoc($select_query)){
		switch($select_rows['codeID']){
			case "statistics":  //访问统计
				$statistics2 = $select_rows['code'];
				$statisticsCodeURL2 = $select_rows['codeURL'];
				$statistics2_enable = $select_rows['enable'];
			break;
			case "onlinechart":  //在线联系代码 （QQ）
				$onlines2 = $select_rows['code'];
				$onlines2_enable = $select_rows['enable'];
			break;
			case "onlinechartUrl":  //在线客服
				$onlinechart=$select_rows['code'];
				$onlinechartUrl2 = $select_rows['codeURL'];
				$onlinechart_enable = $select_rows['enable'];
			break;
			case "maps":  //地图代码
				$maps2=$select_rows['code'];
				$mapsAddress2 = $select_rows['codeURL'];
				$maps2_enable = $select_rows['enable'];
			break;
			case "share":  //社交网站分享 代码
				$share2=$select_rows['code'];
				$share2_enable = $select_rows['enable'];
			break;
			case "indexKeywords":  //首页关键词
				$indexKeywords2=$select_rows['code'];
				$indexKeywords2_enable = $select_rows['enable'];
			break;
			case "productsKeywords":  //产品页关键词
				$productsKeywords2=$select_rows['code'];
				$productsKeywords2_enable = $select_rows['enable'];
			break;
			case "htaccess":  //.htaccess
				$htaccess2=$select_rows['code'];
				$htaccess2_enable = $select_rows['enable'];
			break;
			case "robot":  //robots.txt
				$robot2=$select_rows['code'];
				$robot2_enable = $select_rows['enable'];
			break;
			case "shield":  //屏蔽代码
				$shield2=$select_rows['code'];
				$shield2_enable = $select_rows['enable'];
			break;
			case "qrdata":  //二维码生成
				$qr_data=$select_rows['code'];
				$qr_data_enable = $select_rows['enable'];
			break;
			case "aboutLenght":  //首页“关于我们”截取长度
				$aboutLenght=$select_rows['code'];
				$aboutLenght_enable = $select_rows['enable'];
			break;
			case "indexPassword":  //访问密码
				$indexPassword=$select_rows['code'];
				$indexPassword_enable = $select_rows['enable'];
			break;
			case "canshu":  //业务信息
				$canshu2_enable = $select_rows['enable'];
			break;
			case "basicInfo":  //基本信息
				$basicInfo2_enable = $select_rows['enable'];
			break;
			case "additionalInfo":  //附加信息
				$additionalInfo2_enable = $select_rows['enable'];
			break;
		}
	}

	$ls_msg="功能代码操作";
	
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);
}
	$replacedir=trim($_POST['replacedir']);
	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);  //产品表目录整理
		
		$replacedir_sql="update  ls_singlepages set pageText=replace(pageText,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //singlepage目录整理
		
		$replacedir_sql="update  ls_article  set articleText =replace(articleText ,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //article目录整理
		
		$replacedir_sql="update   ls_news   set newsText =replace(newsText ,'".$olddir."','".$currentdir."') where 1 ";
		$replacedir_query=$opendb->query($replacedir_sql);  //news目录整理
		
		$replacedir_sql="update   ls_information   set content =replace(content, '".$olddir."','".$currentdir."') where inMenu ='aboutus' ";
		$replacedir_query=$opendb->query($replacedir_sql);  //aboutus目录整理
		
		$replacedir_sql="update   ls_information   set content =replace(content, '".$olddir."','".$currentdir."') where inMenu ='contact' ";
		$replacedir_query=$opendb->query($replacedir_sql);  //contact目录整理
		
		$replacedir_sql="update   ls_information   set content =replace(content, '".$olddir."','".$currentdir."') where inMenu ='notice' ";
		$replacedir_query=$opendb->query($replacedir_sql);  //notice目录整理
		
		 $ls_msg="已经进行了目录整理操作";
	}
	
	$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']);
	
	$htaccess_path = "../.htaccess";
	$robots_path = "../robots.txt";
	
	if($act == "htaccess"){
		
		if(file_exists($htaccess_path)){
			if (is_file ($htaccess_path)){ 
				@unlink ($htaccess_path); //若文件已存在，则删除
			}
		}
		
		$fp = fopen($htaccess_path,"w");
		fwrite($fp,$htaccess2);
		fclose($fp);
	}
	
	if(file_exists($robots_path)){
		if (is_file ($robots_path)){ 
			@unlink ($robots_path); //若文件已存在，则删除
		}
	}
	$fp = fopen($robots_path,"w");
	fwrite($fp,$robot2);
	fclose($fp);
?>
<!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">
		<title>无标题文档</title>
		<link href="css/admin.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" href="../themes/default/default.css" />
        <script language="JavaScript" src="js/jquery.js"></script>
		<script language="JavaScript" src="js/ls.js"></script>
</head>
<body>
		<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
			<tr>
				<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>高级配置</strong></font></div>
				</td>
			</tr>
			<tr>
				<td height="213" valign="top" bgcolor="#dee7ff"><br>
				 <form name="newsform" enctype="multipart/form-data" method="post" action="ls_functioncode.php" >
					<input type="hidden" value="insert" name="ls">
                    <input type="hidden" value="<?=$code?>" name="code2">
                    <input type="hidden" name="ChangecatePagePic" value="no">
                    <input type="hidden" name="ChangecatePage" value="no">
                    <input type="hidden" name="Changehtaccess" value="no">
				   <table border="0" width="98%" align="center">
						<tr>
							<td>提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
							<td align="right">&nbsp;</td>
						</tr>
					</table>
					<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
					  <tr bgcolor="#B9DAFF"> 
						<td height="28" colspan="5" style="padding-left:30px;" ><font color="#FF3300">“确定”将保存以下项目内容，网站生成时，会把“启用”的内容写入相应页面或文件。</font></td>
                      </tr>
                      <tr bgcolor="#f4f4f4">
                        <td width="10%">&nbsp;</td>
                        <td style="padding-left:30px;"  colspan="2" >
                        	首页“关于我们”长度                       	    <input type="text" value="<?php echo $aboutLenght;?>" name="aboutLenght" class="ifinfoinputshort"  >
                        </td>
                        <td width="42%">&nbsp;</td>
                        <td align="right">&nbsp;</td>
                      </tr>
					  <tr bgcolor="#f4f4f4">
                      	<td width="10%" rowspan="2" align="center">统计代码</td>
						<td colspan="4" valign="middle"  style="padding-left:30px;">
                        <textarea name="statistics" style="width:85%;height:120px;"><?php echo htmlspecialchars($statistics2); ?></textarea>
                        启用
                        <label>
                          <?php if($statistics2_enable == 1){ ?><input name="statistics2_enable" type="checkbox" value="1" id="statistics2_enable" checked="checked" /> <?php }else{ ?><input name="statistics2_enable" type="checkbox" id="statistics2_enable"  value="0"  /><?php } ?>
                        </label></td>
					  </tr>
                      <tr bgcolor="#f4f4f4">
                      	<td style="padding-left:30px;" colspan="2" >
                        	访问统计链接地址 
                        	  <input type="text" value="<?php echo $statisticsCodeURL2?>" name="statisticsUrl" style="width:230px;" >
                        </td>
                        <td width="42%"><input type="button" onclick="window.open('<?=$statisticsCodeURL2?>')" value="查看统计" /></td>
                        <td width="13%" align="right"><input type="submit" value="确定" /></td>
                      </tr>
                        <tr bgcolor="#f4f4f4">
                        <td align="center">在线联系QQ</td>
						<td colspan="4"  style="padding-left:30px;">
                        <textarea name="onlines" style="width:85%;height:120px;"><?php echo htmlspecialchars($onlines2); ?></textarea>
                        启用
                        <label>
                          <?php if($onlines2_enable == 1){ ?><input name="onlines2_enable" type="checkbox" id="onlines2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="onlines2_enable" type="checkbox" id="onlines2_enable" value="0"  /><?php } ?>
                        </label></td>
						</tr>
                        <tr bgcolor="#f4f4f4">
                          <td width="10%" rowspan="2" align="center">在线客服</td>
                          <td colspan="4"  style="padding-left:30px;"><textarea name="onlinechart" style="width:85%;height:120px;"><?php echo htmlspecialchars($onlinechart); ?></textarea>
                            启用
                            <label>
                              <?php if($onlinechart_enable == 1){ ?><input name="onlinechart_enable" type="checkbox" id="onlinechart_enable" value="1" checked="checked" /> <?php }else{ ?><input name="onlinechart_enable" type="checkbox" id="onlinechart_enable"  value="0" /><?php } ?>
                          </label></td>
                        </tr>
                          <tr bgcolor="#f4f4f4">
                            <td style="padding-left:30px;" colspan="2" >
                                在线客服登录地址 
                                  <input type="text" value="<?php echo $onlinechartUrl2;?>" name="onlinechartUrl" style="width:230px;" >
                            </td>
                            <td width="42%"><input type="button" onclick="window.open('<?=$onlinechartUrl2?>')" value="登录客服" /></td>
                            <td width="13%" align="right">&nbsp;</td>
                          </tr>
                          <?php
						  if($mapsAddress2 != NULL){
						  	$mapsAddressArray = explode(",", str_replace(' ', '', $mapsAddress2));
						  }
						   ?>
                         <tr bgcolor="#f4f4f4">
                          <td width="10%" rowspan="2" align="center">地图代码</td>
                          <td colspan="4"  style="padding-left:30px;"><textarea name="maps" id="maps" style="width:85%;height:120px;"><?php echo htmlspecialchars($maps2); ?></textarea>
                        启用
                        <label>
                          <?php if($maps2_enable == 1){ ?><input name="maps2_enable" type="checkbox" id="maps2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="maps2_enable" type="checkbox" id="maps2_enable"  value="0" /><?php } ?>
                        </label></td>
                        </tr>
                          <tr bgcolor="#f4f4f4">
                            <td style="padding-left:30px;" colspan="3" >
                            地图地址 <input type="text" value="<?php echo $mapsAddress2;?>" name="mapsAddress" id="mapsAddress" style="width:600px;" > &nbsp;
                            <input type="button" value="生成代码" onclick="
                            if($('#mapsAddress').val().length>0){
						$('#maps').val('&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.cn/maps/api/js?sensor=false&amp;language=en&quot;&gt;&lt;/script&gt;   &lt;script type=&quot;text/javascript&quot;&gt;   var geocoder;   var map;   function initialize() {   geocoder = new google.maps.Geocoder();   var myOptions = { \n  zoom : 8,  \n mapTypeId : google.maps.MapTypeId.ROADMAP  \n } \n  map = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;),  \n myOptions); \n  codeAddress(); \n } \n function codeAddress() {   var address = &quot;<?=$mapsAddress2;?>&quot;;   geocoder.geocode({   &quot;address&quot; : address   }, function(results, status) {   if (status == google.maps.GeocoderStatus.OK) {   map.setCenter(results[0].geometry.location);   var marker = new google.maps.Marker({   map : map,   position : results[0].geometry.location,   title : address,   animation : google.maps.Animation.DROP   });   var display = &quot;Address: &quot; + results[0].formatted_address;  var infowindow = new google.maps.InfoWindow({   content : &quot;&lt;span style=font-size:11px &gt;&lt;b&gt;Name: &lt;/b&gt;&quot;   + address + &quot;&lt;br&gt;&quot; + display + &quot;&lt;/span&gt;&quot;,   pixelOffset : 0,   position : results[0].geometry.location     });   infowindow.open(map, marker);   google.maps.event.addListener(marker, &quot;click&quot;, function() {   infowindow.open(map, marker);   });   } else {   alert(&quot;Geocode was not successful for the following reason: &quot; + status);   }   });   }   &lt;/script&gt;  &lt;div id=&quot;map_canvas&quot; style=&quot;width: 100%; height: 600px;&quot;&gt;&lt;/div&gt; &lt;script&gt;initialize()&lt;/script&gt;');
                        }else{
                        alert('地图地址不能为空！');
                        }"/></td>
                            <td width="13%" align="right"><input type="submit" value="确定" /></td>
                          </tr>
                        <tr bgcolor="#f4f4f4"> 
                        <td align="center">社交分享</td>
						<td colspan="4"  style="padding-left:30px;">
                        <textarea name="share" style="width:85%;height:120px;"><?php echo htmlspecialchars($share2); ?></textarea>
                        启用
                        <label>
                          <?php if($share2_enable == 1){ ?><input name="share2_enable" type="checkbox" id="share2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="share2_enable" type="checkbox" id="share2_enable"  value="0"  /><?php } ?>
                        </label></td>
						</tr>
                       <tr bgcolor="#f4f4f4">
                      	<td align="center">首页底部<br />
                   	     关键词</td>
						<td colspan="4"  style="padding-left:30px;">
                        <textarea name="indexKeywords" style="width:85%;height:120px;"><?php echo htmlspecialchars($indexKeywords2); ?></textarea>
                        启用
                        <label>
                          <?php if($indexKeywords2_enable == 1){ ?><input name="indexKeywords2_enable" type="checkbox" id="indexKeywords2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="indexKeywords2_enable" type="checkbox" id="indexKeywords2_enable"  value="0" /><?php } ?>
                        </label></td>
					  </tr>
                        <tr bgcolor="#f4f4f4">
                        <td align="center">产品页底部<br />
                          关键词</td>
						<td colspan="4"  style="padding-left:30px;">
                        <textarea name="productsKeywords" style="width:85%;height:120px;"><?php echo htmlspecialchars($productsKeywords2); ?></textarea>
                        启用
                        <label>
                          <?php if($productsKeywords2_enable == 1){ ?><input name="productsKeywords2_enable" type="checkbox" id="productsKeywords2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="productsKeywords2_enable" type="checkbox" id="productsKeywords2_enable"  value="0"  /><?php } ?>
                        </label></td>
						</tr>
                      <tr bgcolor="#f4f4f4">
                        <td width="10%" align="center">产品信息;</td>
                        <td colspan="3" style="padding-left:30px;">
                        <label>
                          <?php if($canshu2_enable == 1){ ?><input name="canshu2_enable" type="checkbox" id="canshu2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="canshu2_enable" type="checkbox" id="canshu2_enable"  value="0" /><?php } ?>
                        </label>业务信息 &nbsp; 
                        <label>
                          <?php if($basicInfo2_enable == 1){ ?><input name="basicInfo2_enable" type="checkbox" id="basicInfo2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="basicInfo2_enable" type="checkbox" id="basicInfo2_enable"  value="0" /><?php } ?>
                        </label>基本信息 &nbsp; 
                        <label>
                          <?php if($additionalInfo2_enable == 1){ ?><input name="additionalInfo2_enable" type="checkbox" id="additionalInfo2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="additionalInfo2_enable" type="checkbox" id="additionalInfo2_enable"  value="0" /><?php } ?>
                        </label>附加信息 &nbsp; <font color="#CC0000">（产品添加修改时，产品属性信息是否启用）</font></td>
                        <td width="13%" align="right" style="padding-right:10px;" ><input type="submit" value="确定" /></td>
                      </tr>
                      <tr bgcolor="#f4f4f4">
                        <td rowspan="3" align="center">.htaccess</td>
                        <td colspan="3" rowspan="3" style="padding-left:30px;">
                          <textarea name="htaccess" id="htaccess" style="width:100%;height:120px;"><?php echo htmlspecialchars($htaccess2); ?></textarea>
                       </td>
                       <?php
					   $htaccessUrl = explode(".", $_SERVER['HTTP_HOST']);
					   ?>
                        <td align="center"><input type="button" name="button" id="button" value="自动添加内容" onClick="
						$('#htaccess').val('ErrorDocument 404 /sitemap.html \n\nRewriteEngine on \nRewriteCond %{HTTP_HOST} ^([a-z.]+)?<?=$htaccessUrl[count( $htaccessUrl)-2]?>\.<?=$htaccessUrl[count( $htaccessUrl)-1]?>$ [NC] \nRewriteCond %{HTTP_HOST} !^www\. [NC] \nRewriteRule .? http://www.<?php echo $_SERVER['HTTP_HOST']; ?>%{REQUEST_URI} [R=301,L] \n\nRewriteRule ^search\.html$ search.php \nRewriteRule ^search_([0-9]+)_([0-9]+)_(.*)\.html$ search.php?page=$1&page2=$2&keywords=$3 [QSA,L] \nRewriteRule ^search_(.*)\.html$ search.php?keywords=$1');  " /></td>
                      </tr>
                      
                      <tr bgcolor="#f4f4f4">
                        <td align="center">
                        	<input type="submit" onclick="newsform.Changehtaccess.value='htaccess';return ConfirmDelSubAct();" value="更新htaccess" style=" height:26px; border:0px; background-color:#F60; color:#FFF; cursor: pointer;" /><br />
                            <font color="#CC0000">请确保该内容正确，否则网站可能无法打开。</font>
						</td>
                      </tr>
                       <tr bgcolor="#f4f4f4">
                        <td valign="bottom"> 启用
                        <label>
                          <?php if($htaccess2_enable == 1){ ?><input name="htaccess2_enable" type="checkbox" id="htaccess2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="htaccess2_enable" type="checkbox" id="htaccess2_enable"  value="0" /><?php } ?>
                        </label>
						</td>
                      </tr>
                        <tr bgcolor="#f4f4f4"> 
                        <td align="center">robots.txt</td>
						<td colspan="4"  style="padding-left:30px;">
                        <textarea name="robot" style="width:85%;height:120px;"><?php echo htmlspecialchars($robot2); ?></textarea>启用
                        <label>
                          <?php if($robot2_enable == 1){ ?><input name="robot2_enable" type="checkbox" id="robot2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="robot2_enable" type="checkbox" id="robot2_enable"  value="0" /><?php } ?>
                        </label>
						</td>
						</tr>
                        <tr bgcolor="#f4f4f4">
                        <td width="10%" align="center">&nbsp;</td>
                        <td width="12%">&nbsp;</td>
                        <td width="23%">&nbsp;</td>
                        <td align="right" style="padding-right:10px;" colspan="2" ><input type="submit" value="确定" /></td>
                      </tr>
                        <tr bgcolor="#f4f4f4">
                        <td align="center">屏蔽代码<br /></td>
						<td style="padding-left:30px;" colspan="2">
                        <textarea name="shield" style="width:100%;height:120px;"><?php echo $shield2; ?></textarea>
						</td>
                        <td width="42%" align="left" valign="bottom"><p><span style="">启用
                              <label>
                                <?php if($shield2_enable == 1){ ?><input name="shield2_enable" type="checkbox" id="shield2_enable" value="1" checked="checked" /> <?php }else{ ?><input name="shield2_enable" type="checkbox" id="shield2_enable"  value="0" /><?php } ?>
                              </label>
                        </span></p></td>
                        <td width="13%"><p>密码
                            <input type="text" value="<?php echo $indexPassword;?>" name="indexPassword" class="ifinfoinputshort"  >
                        </p></td>
						</tr>
<?php
include 'phpqrcode/phpqrcode.php';

$value = $data; //二维码内容 
$errorCorrectionLevel = $level;//容错级别  
$matrixPointSize = $size;//生成图片大小  //生成二维码图片
if($value != $olddata || $ChangecatePage=="yes")
	QRcode::png($value, 'qr/qrcode.png', $errorCorrectionLevel, $matrixPointSize, 2);
if($ChangecatePagePic=="yes"){
	if ($logo_type == "image/gif" || $logo_type == "image/png" || $logo_type == "image/x-png" || $logo_type == "image/pjpeg" || $logo_type == "image/jpeg" ){
		if($logo_size < $PicSize){
			
			$pathBigPic="company_logo";

			//echo $pic;
			$productPic="logo.".substr($logo_name,-3);																			
			$pathBigPic=$pathBigPic."/".$productPic;
			//echo $pathBigPic;
			//上传文件
			move_uploaded_file($_FILES['logoFile']['tmp_name'], $pathBigPic);
			$toW=60;			//宽度
			$toH=60;			//高度
			$toFile=$pathBigPic;		//目标地址
			$srcFile=$pathBigPic;	//目标地址
			if(!$_POST['automationGif'])  //是动画则不缩小
			{
				ImageResize($srcFile,$toW,$toH,$toFile);	//resize the big pic width & height to stand size
			}
			chmod($toFile,0644);

			$logo = $pathBigPic;//准备好的logo图片  
			$QR = 'qr/qrcode.png';//已经生成的原始二维码图     
			if ($logo !== FALSE) {   
				$QR = imagecreatefromstring(file_get_contents($QR));   
				$logo = imagecreatefromstring(file_get_contents($logo));   
				$QR_width = imagesx($QR);//二维码图片宽度   
				$QR_height = imagesy($QR);//二维码图片高度   
				$logo_width = imagesx($logo);//logo图片宽度   
				$logo_height = imagesy($logo);//logo图片高度
				$logo_qr_width = $QR_width / 5;
				$scale = $logo_width/$logo_qr_width;
				$logo_qr_height = $logo_height/$scale;
				$from_width = ($QR_width - $logo_qr_width) / 2;   //重新组合图片并调整大小   
				imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,   $logo_qr_height, $logo_width, $logo_height);  
			}  //输出图片  
			imagepng($QR, 'qr/qrcode.png');
		}else{
			echo "	<script>alert('图片最大为".$PicSize."！');history.go(-1);</script>";
		}
	}else{
		echo "	<script>alert('请选择图片上传，或者你选择的文件不符合要求!\\n只允许格式 .gif .png .jpeg');history.go(-1);</script>";
	}
}
?>
                        <tr bgcolor="#f4f4f4"> 
                        <td align="center">二维码生成</td>
						<td colspan="4"  style="padding-left:30px;" >
               	    <table width="93%" border="0" align="left" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
                              <tr bgcolor="#f4f4f4">
                                <td width="34%">&nbsp;</td>
                                <td width="12%">&nbsp;</td>
                                <td width="54%">&nbsp;</td>
                              </tr>
                              <tr bgcolor="#f4f4f4">
                                <td rowspan="4" align="center">
                                <img src="qr/qrcode.png<?php echo "?t=".rand();?>">
                                </td>
                                <td align="right">文本内容</td>
                                <td>
                                    <textarea name="data" style="width:90%;height:120px;"><?php echo (isset($_REQUEST['data'])?htmlspecialchars($_REQUEST['data']):$qr_data)?></textarea>
                                </td>
                              </tr>
                              <tr bgcolor="#f4f4f4">
                                <td align="right">质量</td>
                                <td><select name="level" onChange="newsform.ChangecatePage.value='yes';">
                                        <option value="L"'.(($errorCorrectionLevel=='L')?' selected':'').'>L - smallest</option>
                                        <option value="M"'.(($errorCorrectionLevel=='M')?' selected':'').'>M</option>
                                        <option value="Q"'.(($errorCorrectionLevel=='Q')?' selected':'').'>Q</option>
                                        <option value="H"'.(($errorCorrectionLevel=='H')?' selected':'').'>H - best</option>
                                    </select></td>
                              </tr>
                              <tr bgcolor="#f4f4f4">
                                <td align="right">尺寸</td>
                                <td>
                                <select name="size" onChange="newsform.ChangecatePage.value='yes';">;
                                <?php 
								$matrixPointSize = 4;
								for($i=1;$i<=10;$i++)
                                    echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>';
                                ?>
                                </select>
                                </td>
                              </tr>
                              <tr bgcolor="#f4f4f4">
                                <td align="right">Logo:</td>
                                <td><input type="file" name="logoFile" style="width:400px;" onChange="newsform.ChangecatePagePic.value='yes';"></td>
                              </tr>
                              <tr bgcolor="#f4f4f4">
                                <td colspan="3">修改二维码信息后，请点击“确定”按钮进行生成。                                  <input type="hidden" name="olddata" value="<?=$qr_data?>" /></td>
                              </tr>
                          </table>
                        </td>
                        <tr bgcolor="#f4f4f4">
                            <td colspan="5" align="center"><?php file_exists("widget/ls_config_replacedir.php")?include "widget/ls_config_replacedir.php":""?></td>
                        </tr>
                        <tr bgcolor="#c4cfff"> 
						<td height="28" colspan="5" style="padding-left:60px;" ><font color="#FF3300">“确定”将保存以下项目内容，网站生成时，会把“启用”的内容写入相应页面或文件。</font></td>
                      </tr>
					  <tr bgcolor="#B9DAFF"> 
						<td height="25" colspan="5" align="center"><input type="submit" value="确定">
						    <input type="reset" name="button" id="button" value="重置" /></td>
					  </tr>
					</table>
				</form>
				</td>
			</tr>
		</table>
	</body>
</html>

