<?php
#------------------------------------------------------#
#               本程序为zChain.net提供                 #
#                zChain论坛(ZBB)v2.00                  #
#------------------------------------------------------#
# INPUT: $bid,$tid,$rid,$sv_user

require_once('bin/config.php');
require_once('bin/common.php');
require_once('bin/zbbcodec.php');

require_once('core/class_forum_base.php');
CForumBase::setFileBase("$filepath");
require_once('core/base_memo_file.php');
require_once('core/class_board.php');
require_once('core/class_topic.php');
require_once('core/base_array_file.php');
require_once('core/class_reply_set.php');

#--- Prepare topic data ---
$oBrd=new CBoard;
if(!$oBrd->load($bid)){errorview("论坛信息读取错误!");}
$oTpc=new CTopic;
if(!$oTpc->load($bid,$tid)){errorview("主题读取错误！");}

$oRpl=new CReplySet;
$oRpl->load($bid,$oTpc->replyid);
if(!$oRpl->find($rid)){errorview("回复读取错误");}
if($sv_user != $oRpl->user){errorview("对不起，您没有此项操作的权限！");}

zbbdecode(&$oRpl->body);

#--- Print reply form ---
page_header('编辑回复');
print "<CENTER>";
$posText="您当前位置：";
if($ck_root){$posText.="<a href=viewblist.php>$commname</a> >>";}
$posText.="<a href=viewboard.php?bid=$bid>$oBrd->name</a>";
$posText.=" >> $oTpc->title >> 编辑回复";
menu_bar($posText);

print <<<EOT
<SCRIPT>
var MessageMax="$maxpostsize";
var Override="";
function ValidateForm() {
titlesLength=document.form.titles.value.length;
if (titlesLength <2) {alert("文章标题不能小于2个字符！");return false;}
MessageLength  = document.form.comment.value.length;
errors = "";
if (MessageLength < 2) {
errors = "文章内容不能小于2个字符！";
}
if (MessageMax !=0) {
if (MessageLength > MessageMax) {
errors = "本论坛限制文章长度不得超过 " + MessageMax + " 字节\\n目前您的文章字节: " + MessageLength;
}
}
if (errors != "" && Override == "") {
alert(errors);
return false;
} else {
document.form.submit1.disabled = true;
return true;
}
}
function emoticon(theSmilie) {
document.form.comment.value += theSmilie + ' ';
document.form.comment.focus();
}
var i=0;
function presskey(eventobject){if(event.ctrlKey && window.event.keyCode==13){i++;if (i>1) {alert('帖子正在发出，请耐心等待！');return false;}this.document.form.submit();}}
</SCRIPT>
<BR>
<FORM METHOD=POST action=zreply_edit_s.php name=form onsubmit="return ValidateForm()">
<input type=hidden name=bid value=$bid>
<input type=hidden name=tid value=$tid>
<input type=hidden name=rid value=$rid>
<TABLE cellSpacing=1 cellPadding=5 border=0 width=600 class="forumLine">
<TR><TD class="rowCaption" colSpan=2>编辑回复</TD></TR>
<TR>
 <TD class="row1" width=100>回复标题</TD>
 <TD class="row1">
  <INPUT onmouseover=this.focus() maxLength=50 size=59 name=f_title value="$oRpl->title" class="plain">
 </TD>
</TR>
<TR>
 <TD vAlign=top class="row1" width=100>回复内容</TD>
 <TD class="row1">
  <TEXTAREA name=f_comment rows=10 cols=60 onkeydown=presskey(); class="plain">{$oRpl->body}</TEXTAREA>
 </TD>
</TR>
<TR>
 <TD vAlign=top width=100 class="row1">选项</TD>
 <TD class="row1">
  <input type=checkbox value=1 name=f_nocode>
  禁止 <a href=bin/zbbcode.htm onclick="popWin(this.href,500,300);">ZBB代码</a><br>
  <input type=checkbox value=1 name=f_nosmile>
  禁止 <a href=bin/zbbcode.htm#smilies onclick="popWin(this.href,500,300);">表情字符</a>
 </TD>
</TR>
<TR>
 <TD class="row2" colspan="2" align="center"> 
  <INPUT tabIndex=4 type=submit value=" 确 定 " name=submit1>&nbsp;
  <INPUT type=reset value=" 重 写 ">
 </TD>
</TR>
</TABLE>
</FORM>
<a href=javascript:history.back();><IMG src=$imgurl/back.gif border=0></a>
</CENTER>
EOT;

page_footer();

?>