<?php
include_once("inc/config.php");
include_once("inc/publicfun.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/ftcode.php");
include_once("conn.php");
include_once("admin/check_master.php");

if ($_POST["act"]=="y"){
   $userip=GetUserIP();
   $id=intval($_POST["id"]);
   $blogtitle = ftbbs_request(trim($_POST["blogtitle"]));
   $blogqs=trim($_POST["blogqs"]);
   $plqs=trim($_POST["plqs"]);
   $blogtypeid=intval(trim($_POST["blogtypeid"]));
   $xinqin=trim($_POST["DiaryHeart"]);
   $writedate=trim($_POST["writedate"]);
   $remenu=trim($_POST["menu"]);
   $blogtag=ftbbs_request(trim($_POST["blogtag"]));
   $bbstag=trim($_POST["bbstag"]);
   
   $remenu=ubb($remenu);
   $remenu=nojs($remenu);
   $str="update {$tablepre}ftblog set blogtitle='".$blogtitle."',blogcontent='".$remenu."',blogtypeid=".$blogtypeid.",blogqs=".$blogqs.",writedate='".$writedate."',xinqin='".$xinqin."',userip='".$userip."',blogtag='".$blogtag."',plqs=".$plqs." where id=".$id;
   mysql_query($str);
   header("Location:../adminftblog/userblog.php");
}
$sql="select * from {$tablepre}ftblog where id=".$id;
$rs=mysql_query($sql);
$row = mysql_fetch_array($rs);
$blogtypeid=$row["blogtypeid"];
?>
<html><head><meta http-equiv=content-type content="text/html; charset=utf-8>">
<link href="css/xmwuye.css" rel="stylesheet" type="text/css">
</head>
<body>             
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
   <td height="50" bgcolor="#FFFFFF" align="center"><strong>编辑日志</strong></td>
  </tr>
</table>
              
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                <form name="myform" method="post" action="" onsubmit="return CheckReForm(this)">
                  <tr> 
                    <td width="16%" height="27"> 
                      <div align="center">标题：</div></td>
                    <td width="86%"> 
                      <input name="blogtitle" type="text" id="blogtitle" value="<?=$row["blogtitle"]?>" size="40">
                      是否公开发表？ 
                      <select name="blogqs" id="blogqs">
                        <option value="0" <? if ($row["blogqs"]==0){?>selected<? }?>>是</option>
                        <option value="1" <? if ($row["blogqs"]==1){?>selected<? }?>>否</option>
                      </select></td>
                  </tr>
                  <tr> 
                    <td height="28"> 
                      <div align="center">分类：</div></td>
                    <td> 
                      <select name="blogtypeid" id="blogtypeid">
<?
$sql="select * from {$tablepre}ftblog_type where blogphoto=0 order by id desc";
$rs=mysql_query($sql);
$myrow = mysql_fetch_array($rs);
do{
?>
                        <option value="<?=$myrow["id"]?>" <? if ($myrow["id"]==$blogtypeid){?>selected<? }?>><?=$myrow["blogtype"]?></option>
<?
}
while ($myrow = mysql_fetch_array($rs));
?>
                      </select>
                      心情： 
                      <select name="select" id="postheart" Onchange="setHeart();">
                        <option value="" <? if ($row["xinqin"]==""){?>selected<? }?>>无</option>
                        <option value="一般" <? if ($row["xinqin"]=="一般"){?>selected<? }?>>一般</option>
                        <option value="开心" <? if ($row["xinqin"]=="开心"){?>selected<? }?>>开心</option>
                        <option value="伤心" <? if ($row["xinqin"]=="伤心"){?>selected<? }?>>伤心</option>
                        <option value="郁闷" <? if ($row["xinqin"]=="郁闷"){?>selected<? }?>>郁闷</option>
                        <option value="茫然" <? if ($row["xinqin"]=="茫然"){?>selected<? }?>>茫然</option>
                        <option value="说不清" <? if ($row["xinqin"]=="说不清"){?>selected<? }?>>说不清</option>
                        <option value="selfHeart">自填心情</option>
                      </select> &nbsp; <input name="DiaryHeart" id="myheart" style="display:none;" size="14" maxlength="10"> 
                      <script language="JavaScript">
function setHeart()
{
if(document.getElementById("postheart").value == "selfHeart")
{
document.getElementById("myheart").style.display = "";
document.getElementById("myheart").style.color = "#c0c0c0";
document.getElementById("myheart").value = "请输入自填心情";
}
else
{
document.getElementById("myheart").style.display = "none";
document.getElementById("myheart").value = document.getElementById("postheart").value;
}
}
function isNum(theNum)
{
if (theNum =="")
return false;
for(var i=0;i<theNum.length;i++){
oneNum=theNum.substring(i,i+1);
if (oneNum<"0" || oneNum>"9")
return false;
}
return true;
}
</script> </td>
                  </tr>
                  <tr> 
                    <td height="28"> 
                      <div align="center">时间：</div></td>
                    <td> 
                      <input name="writedate" type="text" id="writedate" value="<?=$row["writedate"]?>" size="26"></td>
                  </tr>
                  <tr> 
                    <td height=300></td>
                    <td> 
<TEXTAREA type="hidden" rows=1 cols=1 name="menu" style="position:absolute;left:0;visibility:hidden;"><?=$row["blogcontent"]?></textarea>
<script type="text/javascript" src="fteditor/editor.js"></script> 
<script type="text/javascript">
var editor = new FtEditor("editor");
editor.hiddenName = "menu";
editor.editorWidth = "600px";
editor.editorHeight = "250px";
editor.show();
</script>
                    </td>
                  </tr>
                  <tr> 
                    <td height="28"> 
                      <div align="center">标签：</div></td>
                    <td> 
                      <input name="blogtag" type="text" id="blogtag" value="<?=$row["blogtag"]?>" size="28">
                      多个标签用&quot;|&quot;线分开.</td>
                  </tr>
                  <tr> 
                    <td height="28"> 
                      <div align="center">评论：</div></td>
                    <td> 
                      <input name="plqs" type="radio" value="0" <? if ($row["plqs"]==0){?>checked<? }?>>
                      允许 
                      <input type="radio" name="plqs" value="1" <? if ($row["plqs"]==1){?>checked<? }?>>
                      禁止</td>
                  </tr>
                  <tr> 
                    <td height="35"> 
                      <div align="right"></div></td>
                    <td> 
                      <input type="submit" name="submit1" value="修改" class="button"> 
                      <input name="act" type="hidden" id="act" value="y"> <INPUT type="hidden" name="id" value="<?=$row["id"]?>"> 
                    </td>
                  </tr>
                </form>
</table>
</body>
</html>
<?
$db->close();
?>