<?php 	$ChangecateCompanyLogo2=$_POST['ChangecateCompanyLogo2'];
	
	$openck=new cktb();
	if($openck->checkfield("ls_config","facebook","ALTER TABLE  `ls_config` ADD  `facebook` VARCHAR( 200 ) NULL AFTER  `bottomMenu`"))	$ls_msg = $ls_msg .$openck->ls_msg;
	if($openck->checkfield("ls_config","twitter","ALTER TABLE  `ls_config` ADD  `twitter` VARCHAR( 200 ) NULL AFTER  `facebook`"))	$ls_msg = $ls_msg .$openck->ls_msg;
	if($openck->checkfield("ls_config","linkedin","ALTER TABLE  `ls_config` ADD  `linkedin` VARCHAR( 200 ) NULL AFTER  `twitter`"))	$ls_msg = $ls_msg .$openck->ls_msg;
	if($openck->checkfield("ls_config","google","ALTER TABLE  `ls_config` ADD  `google` VARCHAR( 200 ) NULL AFTER  `linkedin`"))	$ls_msg = $ls_msg .$openck->ls_msg;
	if($openck->checkfield("ls_config","company_logo","ALTER TABLE  `ls_config` ADD  `company_logo` VARCHAR( 200 ) NULL AFTER  `google`"))	$ls_msg = $ls_msg .$openck->ls_msg;
	
	$config_sql="select * from ls_config ";
	$config_query=$opendb->query($config_sql);
	$config_row=mysqli_fetch_assoc($config_query);
	
	if($config_row['company_logo'] == null){
		$classPath = "images/picture.gif";
	}else{
		$classPath = "company_logo/".$config_row['company_logo'];
	}
	
	$image=$_FILES['company_logo']['name'];   
	$size=$_FILES['company_logo']['size'];   
	$type=$_FILES['company_logo']['type'];
	
	if($ls=="modi"){ 
			createFolder("company_logo");
			if($ChangecateCompanyLogo2=="yes"){
				//
				//判断图像格式
				if($type == "image/gif" || $type == "image/png" || $type == "image/pjpeg" || $type == "image/jpeg" )
					{
						if($size < 600000) //开始判断图像大小
						{
							$oldbigpic="company_logo/".$config_row['company_logo'];
							if(file_exists($oldbigpic)){
								unlink($oldbigpic);		//delete old big pic
							}
							
							$dest="logo";
	
							$pic = $_FILES['company_logo']['name'];
							$pic=substr($pic,(strlen($pic)-4),strlen($pic));
							$picName = $dest.$pic;
							$pathBigPic = "company_logo/".$picName;
							$classPath="company_logo/".$picName;
							//上传文件
							move_uploaded_file($_FILES['company_logo']['tmp_name'], $pathBigPic);
							echo $pathBigPic;
						}
						else
						{
							echo "	<script>alert('图像最大为".$PicSize."！');history.go(-1);</script>";
						}
					}else{
						echo "	<script>alert('请选择图片上传，或者你选择的文件不符合要求!\\n只允许格式 .gif .png .jpeg');history.go(-1);</script>";
					}
				$update_pic_sql=sprintf("update ls_config set company_logo=%s ",
				GetSQLValueString($picName, "text")
				);
				//更新产品图片
				$update_query=$opendb->query($update_pic_sql);
				//echo $update_sql;
				//更新数据
			}
	}

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="50%">
			<fieldset class="infofield" style="height:">
				<legend>社交网站</legend>
                <?php if($lang == "en"){ ?>
			  <table width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
						<tr height="32">
							<td width="14%" align="right">Facebook </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['facebook'];?>" name="facebook" class="ifinfoinputshort"  style="width:94%;"   /></td>
						</tr>
						<tr height="32">
							<td width="14%" align="right">Twitter </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['twitter'];?>" name="twitter" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
						<tr height="32">
							<td width="14%" align="right">Linkedin </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['linkedin'];?>" name="linkedin" class="ifinfoinputshort"  style="width:94%;"   /></td>
						</tr>
                        <tr height="32">
							<td width="14%" align="right">Pinterest </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['pinterest'];?>" name="pinterest" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
                        <tr height="32">
							<td width="14%" align="right">Instagram </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['google'];?>" name="google" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
						<tr height="32">
							<td width="14%" align="right">Youtube </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['youtube'];?>" name="youtube" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
					</table>
                    <?php }else{  if($lang == "cn"){?>
 					<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center">
						<tr height="32">
							<td width="14%" align="right">微信 </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['facebook'];?>" name="facebook" class="ifinfoinputshort"  style="width:94%;"   /></td>
						</tr>
						<tr height="32">
							<td width="14%" align="right">微博 </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['twitter'];?>" name="twitter" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
						<tr height="32">
							<td width="14%" align="right">抖音 </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['linkedin'];?>" name="linkedin" class="ifinfoinputshort"  style="width:94%;"   /></td>
						</tr>
                        <tr height="32">
							<td width="14%" align="right">今日头条 </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['pinterest'];?>" name="pinterest" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
						<tr height="32">
							<td width="14%" align="right">QQ空间 </td>
							<td width="86%"><input type="text" value="<?php echo $config_row['youtube'];?>" name="youtube" class="ifinfoinputshort" style="width:94%;"   /></td>
						</tr>
					</table>                   
                    <?php } }?>
			</fieldset>
		</td>
		<td width="50%" height="">
			<fieldset class="infofield" style="height:">
				<legend>公司Logo</legend>
					<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
						<tr>
							<td height="126" align="center"><input type="hidden" name="ChangecateCompanyLogo2" value="no"><img src="<?php echo $classPath ?>" width="" height="100" border="1" name="pic"></td>
						</tr>
						<tr>
							<td align="center"><input type="file" name="company_logo" style="width:300px;" onchange="ChangecateCompanyLogo2.value='yes';">
                            <br/><br/>只能上传png图片
                            </td>
						</tr>
					</table>
			</fieldset>
		</td>
	</tr>
</table>
