<!-- #include file="include/config.asp" -->
<!-- #include file="../include/jk_ubb.asp" -->
<!-- #include file="../include/jk_ubbtst.asp" -->
<!-- #include file="../common/HtmlEdit/Include/DeCode.asp"-->
<!-- #include file="../include/jk_put.asp" -->
<!-- #include file="include/main.asp" -->
<!-- #include file="../pet/pet_conn.asp" -->

<script language = "JavaScript" src = "../style/magic.js"></script>
<%
call time_lock()
dim replyid
replyid=trim(request.querystring("reply_id"))
if not joekoe_cms.int_true(viewid) or not joekoe_cms.int_true(replyid) then
  call format_redirect("index.asp")
end if
%>
<!-- #include file="include/fir.asp" -->
<!-- #include file="include/write.asp" -->
<%
dim fir_topic,fir_username,fir_islock,istop,fir_tim,special,rword,reword,chk_true,quote,topic_day,max_reply_day
iframe=true
chk_true=true
rword=""
quote=trim(request.querystring("quo"))
sql="select top 1 forum_id,username,topic,islock,tim,istop,special from bbs_topic where  id="&viewid
set rs=joekoe_cms.exec(sql,1)
if rs.eof then
  call web_error("forum_viewid")
end if
forumid=rs(0)
fir_username=rs(1)
fir_topic=rs(2)
fir_islock=rs(3)
fir_tim=rs(4)
istop=rs(5)
special=rs(6)
rs.close
ftit="回复主题"

call forum_first()
'-----------------------不可回复参数设置-------------------------------
topic_day=datediff("d",fir_tim,joekoe_cms.now_time)
if forum_config(18)>0 then
  max_reply_day=forum_config(18)
else
  max_reply_day=dim_num(33)
end if
'-----------------------不可回复参数结束-------------------------------
call web_head(2,1,h_var3,0,0)
call forum_readonly()
call forum_load()
'----------------------------中间 开始----------------------------
call forum_ad()
call forum_grade()
call forum_top(tit)

if forumw=false then
call forum_msg("本论坛已设置为不可发贴模式！",1)
elseif int(fir_islock)=1 then
  call forum_msg("您要回复或引用的贴子所属的主题已被锁定！",1)
else
  if quote="yes" then
    sql="select top 1 bbs_data.username,bbs_data.word,bbs_data.tim,user_data.popedom from bbs_data,user_data where bbs_data.userid=user_data.id and bbs_data.reply_id="&viewid&" and bbs_data.id="&replyid
    call joekoe_cms.exec("",-1)
    rs.open sql,conn,1,3
    if rs.eof then
      rs.close
      call forum_msg("您要编辑的主题或回贴不存在！",1)
    else
      if joekoe_cms.popedom_p(rs("popedom"),42)=0 then
	    reword=rs(1)
		if cstr(rs(0))=cstr(fir_username) and cstr(rs(2))=cstr(fir_tim) and special>1 then reword="★★ 特殊贴内容不能察看 ★★"
        rword="[quote][b]以下是引用 [u]"&rs(0)&"[/u] 在 [i]"&rs(2)&"[/i] 的发言：[/b]"&vbcrlf&reword&vbcrlf&"[/quote]"
      end if
    end if
    rs.close
  end if
  if not forum_power_true(forumpower) then
      if int(max_reply_day)>0 and int(topic_day)>int(max_reply_day) then
        chk_true=false
        call forum_msg("您要回复的主题已发布 <font class=blue>"&topic_day&"</font> 天，本版设置主题在 <font class=blue>"&max_reply_day&"</font> 天后不可回复！",1)
      end if
  end if
  if chk_true then
    if joekoe_cms.chk() then
      call forum_reply_chk()
    else
      call forum_reply_main()
    end if
  end if
end if
'----------------------------中间 结束----------------------------
call forum_end()
call web_end(0,0)

sub forum_reply_chk()
  dim tmp1,topic,icon,word,found_err
  topic=joekoe_cms.code_form(request.form("topic"))
  icon=form_icon()
  word=request.form("jk_word")
  found_err=""
  if not post_tim() then
    found_err=found_err&"+对不起，回帖的间隔时间为 <font class=red>"&int(dim_num(28))&"</font> 秒！<br>"
  end if
  if login_mode="" then
    found_err=found_err&"+<font class=red>您还没有注册或登陆本站！因此不能发表主题。</font><br>"
  end if
  if val_chk("f_reply_"&forumid)=false then
    found_err=found_err&"+您输入的 <font class=red>验 证 码</font> 为空或有错误，请勿非法提交！<br>"
  end if
  if login_strength<"0" 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> 是必须要的，不能少于 "&min_word_size&" B或超过 "&max_word_size&" KB！<br>"
  end if
  '强制回贴包含中文字符 --太讨厌了!注释掉,需要的把下面三的‘删掉就可以了
  'if chinese(word)<>"yes" then
  ' found_err=found_err&"+你不想发表回帖吗？请认真回贴。回帖中必须含有一个以上的中文字符。"
  'end if
  if found_err<>"" then
    response.write found_error(found_err,320)
    exit sub
  end if
  
  sql="select * from bbs_data where id is null"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,3
  rs.addnew
  rs("forum_id")=forumid
  rs("reply_id")=viewid
  rs("username")=login_username
  rs("userid")=login_id
  rs("topic")=topic
  rs("icon")=icon
  rs("word")=word
  rs("tim")=joekoe_cms.now_time
  rs("ip")=user_ip
  rs("sys")=user_sys
  rs("cod")=cod_type()
  rs("pb")=false
  rs.update
  rs.close
  sql="update bbs_topic set re_counter=re_counter+1,re_username='"&login_username&"',re_tim='"&joekoe_cms.now_time&"' where id="&viewid
  call joekoe_cms.exec(sql,0)
  sql="update bbs_forum set forum_new_num=forum_new_num+1,forum_data_num=forum_data_num+1 where forum_id in ("&forumparent&")"
  call joekoe_cms.exec(sql,0)
  sql="update bbs_forum set forum_new_info='"&login_username&"|"&joekoe_cms.now_time&"|"&viewid&"|"&fir_topic&"' where forum_id="&forumid
  call joekoe_cms.exec(sql,0)
  dim getinter '回贴得分  
  if forum_config(8)>0 then
    getinter=forum_config(8)
  else
    getinter=dim_num(10)
  end if
  sql="update user_data set bbs_counter=bbs_counter+1,strength=strength-"&dim_num(40)&",integral=integral+"&getinter&" where id="&login_id
  call joekoe_cms.exec(sql,0)
  sql="update configs set num_data=num_data+1,num_new=num_new+1 where id=1"
  call joekoe_cms.exec(sql,0)

connpet.ExeCute="update mypetdata set mypetexp=mypetexp+"&dim_num(9)&" where username='"&login_username&"' and mypetdead=0"
  call upload_note(index_url,viewid)
  
  '开始更新固顶缓存

  
  application.lock
  if istop=1 then application(joekoe_cms.web_cookies&"_forum_istop_"&forumid)=""
  if istop=2 then application(joekoe_cms.web_cookies&"_forum_istops_state")=""
  application(joekoe_cms.web_cookies&"_configs_num_data")=application(joekoe_cms.web_cookies&"_configs_num_data")+1
  application(joekoe_cms.web_cookies&"_configs_new_num")=application(joekoe_cms.web_cookies&"_configs_new_num")+1
  application.contents.remove(joekoe_cms.web_cookies&"_web_config")
  application.unlock
  
  
 tmp1=vbcrlf&"<tr><td class=bbs_td>"&tit&"</td></tr><tr class=bbs_tr><td height=220>" & _
             vbcrlf&"<table border=0 width=300 align=center>" & _
        	 vbcrlf&"<tr><td align=center height=30><font class=red>"&tit&"成功！谢谢您的发贴。</font></td></tr>" & _
        	 vbcrlf&"<tr><td height=30>您现在可以选择以下操作：</td></tr>" & _
        	 vbcrlf&"<tr><td>　　1、<a href='view.asp?forum_id=" & forumid & "&view_id=" & viewid & "'>您所回复的主题</a>" & _
        	 vbcrlf&"<tr><td>　　2、<a href='list.asp?forum_id=" & forumid & "'>返回 <b>" & forumname & "</b></a></td></tr>" & _
        	 vbcrlf&"<tr><td>　　3、<a href='index.asp'>返回论坛首页</a></td></tr>" & _
        	 vbcrlf&"<tr><td height=30>系统将在 "&dim_num(21)&" 秒钟后自动返回 您所回复的主题 ……</td></tr>" & _
		 vbcrlf&"</table></td></tr><meta http-equiv='refresh' content='"&dim_num(21)&"; url=view.asp?view_id=" & viewid & "'>"
    call forum_bar_top(tit,tmp1,1) 
    call val_chk_end_forum("f_reply_"&forumid)
end sub

sub forum_reply_main()
dim tmp1
response.write forum_main_head()
call forum_write_frm_check()
 tmp1=vbcrlf&"<tr><td colspan=2 class=bbs_td>"&tit&"</td></tr>" & _
vbcrlf&"<form name=frm_post action='?forum_id="&forumid&"&view_id="&viewid&"&reply_id="&replyid&"&quote="&quote&"' method=post onsubmit=""javascript:frm_submitonce(this);"">" & _
vbcrlf&"<input type=hidden name=chk value='yes'>" & _
vbcrlf&"<input type=hidden name=upid value=''>" & _
vbcrlf&""&val_code_num("f_reply_"&forumid,1)&"" & _
       vbcrlf&"<tr class=bbs_tr>" & _
       vbcrlf&"<td width='20%'>用户信息：</td>" & _
       vbcrlf&"<td width='80%'>&nbsp;<font class=blue><b>"&login_username&"</b></font>&nbsp;&nbsp;您现在有&nbsp;<font class=red><b>"&login_emoney&"</b></font>&nbsp;"&joekoe_cms.web_unit&",&nbsp;<font class=red><b>"&login_integral&"</b></font>&nbsp;积分"&_ 
       vbcrlf&"&nbsp;<font class=gray>[ <a href='../user/'>用户中心</a> ]&nbsp;&nbsp;[ <a href='../user/login.asp?action=logout'>退出登陆</a> ]</font></td>" & _
       vbcrlf&"</tr>" & _
vbcrlf&"<tr class=bbs_tre>" & _
vbcrlf&"<td>贴子主题：</td>" & _
vbcrlf&"<td>" & _
  vbcrlf&"<table border=0 cellspacing=0 cellpadding=0>" & _
  vbcrlf&"<tr>" & _
  vbcrlf&"<td>"&frm_topic("frm_post","topic")&"</td>" & _
  vbcrlf&"<td>&nbsp;<input type=text name=topic value='回复："&fir_topic&"' size=50 maxlength=50>"&redx&"长度不能超过50</td>" & _
  vbcrlf&"</tr>" & _
  vbcrlf&"</table>" & _
vbcrlf&"</td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr class=bbs_tr>" & _
vbcrlf&"<td>当前心情：</td>" & _
vbcrlf&"<td>"&jk_icon(0)&"</td>" & _



vbcrlf&"</tr>" & _
vbcrlf&bbs_html_edit(1,"frm_post","jk_word","")& _
vbcrlf&"<input type=hidden name=sp_cod value='1'>" & _
vbcrlf&"<tr class=bbs_tr>" & _
vbcrlf&"<td class=s><script language=javascript>post_textarea_caption('贴子内容：','<!--<input type=checkbox name=d_isubb value=""yes"" checked><使用UBB标签<br><input type=checkbox name=d_issign value=""yes"" checked>显示个性签名-->"&web_frm_word&"');</script></td>" & _
vbcrlf&"<td class=s><script language=javascript>post_textarea(0,12,'"&format_remark_var(rword,1)&"');</script></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr class=bbs_tr>" & _
vbcrlf&"<td>上传文件：</td>" & _
vbcrlf&"<td class=bg><iframe frameborder=0 name=upload_frame width='98%' height=30 scrolling=no src='../common/upload.asp?uppath=forum&upname=&uptext=jk_word'></iframe></td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr class=bbs_tr>" & _
vbcrlf&"<td>E M 贴图：</td>" & _
vbcrlf&"<td>"&jk_em("frm_post","jk_word")&"</td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr class=bbs_tr>" & _
vbcrlf&"<td>巧嘴娃娃：</td>" & _
vbcrlf&"<td oncontextmenu=self.event.returnValue=false>&nbsp;"&jk_wawa("frm_post","jk_word")&"</td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"<tr class=bbs_trb>" & _
vbcrlf&"<td>发表新贴：</td>" & _
vbcrlf&"<td height=40><input type=submit class=btn value='可以发表啦' onclick=""javascript:return check_post('reply');"">　&nbsp;"&preview_b("frm_post","jk_word","预览回复")&"　&nbsp;<input type=reset class=btn value='清除重写'>　&nbsp;（按 Ctrl + Enter 可快速发表）</td>" & _
vbcrlf&"</tr>" & _
vbcrlf&"</form>" 
response.write tmp1
response.write forum_main_end()
call preview_form("frm_post","jk_word")
end sub
%>
