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

require "bin/config.php";
require "bin/common.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');
require_once('core/base_record_file.php');
require_once('core/class_topic_list.php');

$oBrd=new CBoard;
if(!$oBrd->load($bid)){errorview("error board");}
if(!$oBrd->isModerator($sv_user)){errorview("对不起，您没有此项操作的权限！");}

$oTpc=new CTopic;
$oRpl=new CReplySet;

if(!$oTpc->load($bid,$tid)) {
 errorview('回复所在主题已经被删除了！');
}

if($oRpl->load($bid,$oTpc->replyid)) {
 $oRpl->find($rid);
 $oRpl->delete();
 $oRpl->store($bid,$oTpc->replyid);

 $oTpc->numreply=$oRpl->itemCount();
 $oTpc->store($bid,$tid);
}

$oTpcLst=new CTopicList;
if($oTpcLst->open($bid)){
 $oTpcLst->updateTopic($oTpc->refid, $oTpc->id, $oTpc->getBrief());
 $oTpcLst->close();
}

print "<script>alert('已经成功删除该回复!');history.back();</script>";

?>