<!-- #Include File="Include/Config.asp" -->
<!-- #include file="Include/Con_bbs_Fir.asp" -->
<!-- #include file="Include/Con_bbs_Post.asp" -->
<!-- #include file="Include/Con_bbs_Special.asp" -->
<!-- #include file="../Include/Cls_UbbCode.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

tit_fir=Cls.ChannelName
dim replyid,fir_topic,fir_tim,fir_istop,fir_islock,fir_bbs_data,rword,chk_true,quote,topic_day,max_reply_day,tmpdata,t_isspecial
chk_true=true
rword=""
replyid=Cls.code_id("rid")
quote=Cls.code_query("quote")
call bbs_list_load()
Bbsid=dim_topic(0,0)
fir_topic=dim_topic(1,0)
fir_tim=dim_topic(16,0)
fir_islock=dim_topic(4,0)
fir_istop=dim_topic(5,0)
fir_bbs_data=dim_topic(10,0)
t_isspecial=dim_topic(11,0)
tmpdata=dim_topic(13,0)
ftit="回复主题"
call bbs_first()
call word_size_load()
call DoWebHead(2,1)
call bbs_load_power()
'----------------------------中间 开始----------------------------
topic_day=datediff("d",fir_tim,Cls.now_time)
max_reply_day=bbs_config(14)
call bbs_grade(0)
call bbs_top(0,"")
if bbs_is_readonly()=false then
  call bbs_msg("本论坛已设置为不可发贴模式！")
elseif int(fir_islock)=1 then
  call bbs_msg("您要回复或引用的贴子所属的主题已被锁定！")
elseif  int(max_reply_day)>0 and int(topic_day)>int(max_reply_day) then
  call bbs_msg("您要回复的主题已发布 <font class=blue>"&topic_day&"</font> 天，本版设置主题在 <font class=blue>"&max_reply_day&"</font> 天后不可回复！")
else
  if quote="yes" then
    sql="select top 1 d.username,d.word,d.tim,u.ispb,d.is_topic,d.is_shield from "&fir_bbs_data&" as d,AsaiMHUserData as u where d.userid=u.id and d.id="&replyid
    call Cls.exe_conn(rs,sql,1)
    if rs.eof then
      rs.close
      chk_true=false
      call bbs_msg("您要编辑的主题或回贴不存在！")
    else
      if rs("ispb")=false then	
	    if rs("is_shield")=0  then
          rword=rs("word")
		  if int(dim_topic(11,0))>0 and rs("is_topic")=true then rword=""
	      if rword<>"" then rword="[quote][b]以下是引用 [u]"&rs("username")&"[/u] 在 [i]"&rs("tim")&"[/i] 的发言：[/b]"&vbcrlf&rword&"[/quote]"
		end if
      end if
    end if
    rs.close
  end if
  if chk_true=true then
    if Cls.chk() then
      call bbs_reply_chk()
    else
      call bbs_reply_main()
    end if
  end if
end if
'----------------------------中间 结束----------------------------
call bbs_end()
call DoWebEnd()
sub bbs_reply_chk()
  dim tmp1,num_plus,num_strength,num_expression,orderid,topic,icon,word,found_err
  num_plus=bbs_config(8)
  num_strength=bbs_config(25)
  num_expression=bbs_config(27)
  topic=Cls.code_form("topic")
  icon=Cls.Code_Int("icon",0)
  word=Cls.Code_Remark("AsaiMHword")
  found_err=""
  if Not Cls.CodeIsTrue() and int(bbs_config(16))=1 then
    found_err=found_err&"+您输入的 <font class=red>验 证 码</font> 为空或有错误，请勿非法提交！<br>"
  end if
  if Cint(login_strength)<Cint(num_strength) then
    found_err=found_err&"+您的 <font class=red>体力</font> 不够发贴了,要多多在线增加体力哦！<br>"
  end if
  if len(topic)>50 then
    found_err=found_err&"+贴子的 <font class=red>主题</font> 长度不能超过50个字符！<br>"
  end if
  if word_size_true(word)=false then
    found_err=found_err&"+贴子的 <font class=red>内容</font> 是必须要的，不能少于"&word_size_min&"或超过"&word_size_max&"KB！<br>"
  end if
  if found_err="" then
    if not Cls.Put_Space("post_tim",Format_Mid_Num(18)) then
      found_err=found_err&"+论坛重复发贴间隔不得超过 <font class=red>"&Format_Mid_Num(18)&"</font> 秒钟！请勿重复发贴。<br>"
    end if
  end if
  if found_err<>"" then
    call bbs_msg(found_err) 'Response.Write found_error(found_err,320)
    exit sub
  end if
  sql="select * from "&fir_bbs_data&" where id is null"
  call Cls.exe_conn(rs,sql,3)
  rs.addnew
  rs("bbs_id")=Bbsid
  rs("reply_id")=viewid
  rs("username")=login_username
  rs("userid")=login_id
  rs("topic")=topic
  rs("icon")=icon
  rs("word")=word
  rs("tim")=Cls.now_time
  rs("ip")=Cls.ip_sys(0)
  rs("sys")=Cls.ip_sys(1)
  rs("is_topic")=0
  rs("is_shield")=0
  if request.Form("codeMode") <> "1" then 
    rs("cod")=0
  else
    rs("cod")=1
  end if
  rs.update
  rs.close
  orderid=Cls.Max_ID("AsaiMHBbstopic","order_id","bbs_id="&Bbsid)
  orderid=orderid+1
  sql="update AsaiMHBbstopic set order_id="&orderid&",re_counter=re_counter+1,re_username='"&login_username&"',re_tim='"&Cls.now_time&"' where id="&viewid
  call Cls.exec(sql,0)
  sql="update AsaiMHBbsClass set bbs_new_num=bbs_new_num+1,bbs_data_num=bbs_data_num+1 where bbs_id in ("&bbs_data(7)&")"
  call Cls.exec(sql,0)
  sql="update AsaiMHBbsClass set bbs_new_info='"&login_username&"|"&Cls.now_time&"|"&viewid&"|"&fir_topic&"' where bbs_id="&Bbsid
  call Cls.exec(sql,0)
  sql="update AsaiMHUserData set bbs_counter=bbs_counter+1,strength=strength-"&num_strength&",expression=expression+"&num_expression&",integral=integral+"&num_plus&" where id="&login_id
  call Cls.exec(sql,0)
  sql="update AsaiMHconfigs set num_new=num_new+1 where id=1"
  call Cls.exec(sql,0)
  If t_isspecial=3 then '回复贴，更新浏览权限
  if tmpdata=""  then
    tmpdata=login_username
  else
    If instr(1,","&tmpdata&",",","&login_username&",",1)=0 then tmpdata=tmpdata&","&login_username
  end if
  sql="update AsaiMHBbstopic set t_special_data='"&tmpdata&"' where id="&viewid
  call Cls.exec(sql,0)
  End if
  call Cls.exec("update AsaiMHChannel set ChannelHits=ChannelHits+1 Where ChannelIDs=4",0)
  'call upload_note(Index_Url,viewid)
  select case int(fir_istop)
  case 1
    call Cls.cache_del("bbs_istop_"&Bbsid)
  case 2
    call Cls.cache_del("bbs_istopz_"&zid)
  case 3
    call Cls.cache_del("bbs_istops")
  end select
  Call Cls.Cache_Del("web_menu")
  Call Cls.Cache_Del("Web_Info")
  Call Cls.Cache_Del("bbs_class")
  call bbs_post_chk()
end sub
sub bbs_reply_main()
  dim tmp1
  tmp1=bbs_post_head(0,0)&vbcrlf&"<form name=frm_post action='?fid="&Bbsid&"&id="&viewid&"&rid="&replyid&"&quote="&quote&"' method=post  onsubmit=""javascript:frm_submitonce(this);""><input type=hidden name=chk value='yes'><input type=hidden name=upid value=''>" & _
       vbcrlf&"<tr class=bbs_tr><td width='20%'>用户信息：</td><td width='80%'>&nbsp;<b>"&format_user_name(login_username,0,0)&"</b>&nbsp;&nbsp;您现在有&nbsp;<font class=red><b>"&login_emoney&" </b></font>"&Cls.Web_Unit&",&nbsp;<font class=red><b>"&login_integral&"</b></font>&nbsp;积分,&nbsp;<font class=red><b>"&login_strength&"</b></font>&nbsp;点体力,&nbsp;<font class=red><b>"&login_expression&"</b></font>点经验&nbsp;<font class=Gys>[<a href='"&Cls.Web_Dir&"user/index.asp'>用户中心</a>]&nbsp;</font></td></tr>"&bbs_GetCode()&"<tr class=tr><td>贴子主题：</td><td><table border=0 cellspacing=0 cellpadding=0><tr><td>"&frm_topic("frm_post","topic")&"</td><td>&nbsp;<input type=text class=txt name=topic value='回复："&Cls.Code_Html(fir_topic,1,0)&"' size=60 maxlength=50>"&redx&"长度不能超过50</td></tr></table></td></tr>" & _
	   vbcrlf&"<tr class=tr>" & _
       vbcrlf&"<td>当前心情：</td>" & _
       vbcrlf&"<td>"&LoadIcon(0)&"</td>" & _
       vbcrlf&"</tr>" & _
       vbcrlf&"<tr class=tr>" & _
       vbcrlf&"<td valign=top class=s>贴子内容：<br><br>[<a href='javascript:;'  onclick=""post_check_length2("&word_size_max&")"">字数检查</a>]</td>" & _
       vbcrlf&"<td>"&LoadNewEditor("frm_post","AsaiMHword",rword)&"</td>" & _
       vbcrlf&"</tr>" & _
       vbcrlf&"<tr class=tr>" & _
       vbcrlf&"<td>上传文件：</td>" & _
       vbcrlf&"<td><iframe id=UploadFiles width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/upload.asp?ID="&ChannelIDs&"&Type=0&Obj=AsaiMHword'></iframe></td>" & _
       vbcrlf&"</tr>" & _
       vbcrlf&bbs_post_end(0)
  Cls.LoadTemplate(4)
  Cls.ReadPage "post"
  Cls.HtmlRcod "title",tit
  Cls.HtmlRcod "BbsGrade",bbs_grade(0)
  Cls.HtmlRcod "BbsTopBar",bbs_top(0,"")
  Cls.HtmlRcod "body",tmp1
  Cls.OutPage
end sub


%>
