<? require "../../admin_header.php"?>
<?
/**
 * @version		1.0
 * @package		HonoWeb->HonoBBS
 * @copyright	Copyright (C) HonoWeb. All rights reserved.
 * @Website		www.honoweb.com.
 */
 ?>
<?

	$status=$_POST['status'];
	$id="1";
	if($status=="edit")
	{
		$indate=date('Y-n-j H:i:s');
		$id=$_POST['id'];//
		$bbs_name=$_POST['bbs_name'];
		$bbs_url=$_POST['bbs_url'];
		$bbs_email=$_POST['bbs_email'];
		
		$bbs_banner_extension=substr($bbs_banner_name,strrpos($bbs_banner_name,'.'),strlen($bbs_banner_name)-strrpos($bbs_banner_name,'.'));
		$bbs_banner="bbs_banner".$bbs_banner_extension;
		$bbs_style=$_POST['bbs_style'];
		$bbs_link_style=$_POST['bbs_link_style'];
		
		$sql="update  ".$TableBbs_config." set ";
		$sql.="	bbs_name='".$bbs_name."',";
		$sql.="	bbs_url='".$bbs_url."',";
		if(!empty($bbs_banner_extension))
		{
			$sql.="	bbs_banner='".$bbs_banner."',";
		}
		
		$sql.="	bbs_style='".$bbs_style."', ";
		$sql.="	bbs_link_style=".$bbs_link_style.", ";
		$sql.="	bbs_email='".$bbs_email."' ";
		$sql.="	  where id=".$id;
		$query=$db->query($sql);
		
		if(!empty($bbs_banner_extension))
		{
			$FileName=$UploadPath."upload/bbs_config/".$bbs_banner;
			$file = $_FILES['bbs_banner']['tmp_name'];
			if(copy($file,$FileName))
			{
				unlink($file);
			}
		}
		if(!empty($query))
		{
			$message="1";
		}
	}
	$sql="select * from  ".$TableBbs_config."  where id=".$id;
	$row=$db->getRow($sql);
?>
<html>
<head>
<title><?=$TitleName?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../../css/css.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../../js/check.js"></script>
<link href="../../css/date.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script src="../../js/ShowDate.js"></script>
<script language="javascript">
    init();
</script>
</head>
<script language="javascript">
	function back()
	{
		location="config.php";
	}

	function Check()
	{
		var form=form1;
		if(form.bbs_name.value=="")
		{
			alert("请输入论坛名称!");
			form.bbs_name.focus();
			return;
		}
		if(form.bbs_url.value=="")
		{
			alert("请输入论坛网址!");
			form.bbs_url.focus();
			return;
		}
		if(form.bbs_email.value=="")
		{
			alert("请输入论坛Email!");
			form.bbs_email.focus();
			return;
		}
		 form.status.value="edit";
		 form.submit();
  	}
</script>
<body>
<form action=""  method="post"  name="form1"  enctype="multipart/form-data">
  <table class="firsttable">
      <tr>
    	<td align="center" valign="top">
        	    <table class="centertable">
          	<tr>
            		<td></td>
          	</tr>
          	<tr>
            		<td align="center" class="addborder">
					<table  class="addTable"  border='0'  cellpadding='0'  cellspacing='1'>
							<tr  class='tr1'  >
								  <td colspan="2" align="center"   class="fontb"><font  class="message">
									<?
																	if($message=="1")
																	{
																		echo "提交成功";
																	}
															   ?>
								  </font></td>
							  </tr>
								<tr  class='tr1' >
									<td   class="fontb">论坛信息:</td>
								  <td >									</td>
								</tr>
								<tr  class='tr2' >
									<td >论坛名称:</td>
								  <td ><input name="bbs_name" type="text" id="bbs_name"  value="<?=$row['bbs_name']?>"></td>
								</tr>
								<tr  class='tr2' >
									<td >论坛网址:</td>
							      <td ><input name="bbs_url" type="text" id="bbs_url"  value="<?=$row['bbs_url']?>"></td>
								</tr>
								<tr  class='tr2' >
									<td >论坛邮箱:</td>
								    <td ><input name="bbs_email" type="text" id="bbs_email" value="<?=$row['bbs_email']?>"></td>
								</tr>
								<tr  class='tr2' >
                				<td >论坛横幅:</td>
                				<td ><img  src="../../upload/bbs_config/<?=$row['bbs_banner']?>?>" border="0" ><br><input name="bbs_banner" type="file" id="bbs_banner" size="50"></td>
              				</tr>
							<tr  class='tr2' >
									<td >论坛友情链接:</td>
						      <td ><?
										for($i=1;$i<=count($T_Booklet_type);$i++)
										{
											if((int)$row['bbs_link_style']==$i)
												echo "<input name='bbs_link_style' type='radio' checked  value=".$i.">".$T_Booklet_type[$i];
											else
												echo "<input name='bbs_link_style' type='radio'   value=".$i.">".$T_Booklet_type[$i];
										}
									?></td>
					  </tr>
							<tr  class='tr1' style="display:none;" >
								<td   class="fontb">Forum Style:</td>
							  <td >									</td>
							</tr>
							<tr  class='tr2'  style="display:none;" >
								<td >Skin Style:</td>
						      <td >
								<select name="bbs_style"		id="bbs_style">
									<?
										for($i=1;$i<=count($T_BBS_Style_Name);$i++)
										{
											if($row['bbs_style']==$T_BBS_Style_CSS[$i])
												echo "<option  selected  value=".$T_BBS_Style_CSS[$i].">".$T_BBS_Style_Name[$i]."</option>";
											else
												echo "<option    value=".$T_BBS_Style_CSS[$i].">".$T_BBS_Style_Name[$i]."</option>";
										}
									?>	
								</select>
								</td>
							</tr>
              				<tr  class='tr2' >
       				          <td colspan="2" align="center">
							     <input type="button"  class='button' name="Button" value="提交" onClick="Check()"></td>
              				</tr>
           			  </table>
				  </td>
          		</tr>
          		<tr>
            		  <td></td>
          		</tr>
       	           </table>
    	   </td>
     </tr>
</table>
<input type="hidden" name="status" value="">
<input type="hidden" name="id" value=<?=$id?>>
</form>
</body>
</html>
<? $db->close_db();?>
 

