<!-- #Include File="../../Include/Inc_post.asp" -->
<!-- #Include File="../../Editor/UBB/Editor.asp" -->
<%

'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

dim word_size_min,word_size_max
word_size_min=0
word_size_max=0

sub word_size_load()
  word_size_min=bbs_config(5)
  word_size_max=bbs_config(6)
end sub

function word_size_true(wst_var)
  word_size_true=false
  if wst_var="" then exit function
  dim tmp_wnum
  tmp_wnum=len(wst_var)
  if tmp_wnum<int(word_size_min) then exit function
  if tmp_wnum>(word_size_max*1024) then exit function
  word_size_true=true
end function

function bbs_is_readonly()
  bbs_is_readonly=true
  if bbs_data(5)=false then
    bbs_is_readonly=false
    exit function
  end if
  if int(bbs_data(10))<>1 then
    exit function
  end if
  if is_super=false then
    bbs_is_readonly=false
  end if
end function


Function Get_Remark_FileType(Byval strer)
  dim TmpFileType,TmpDim,t
  'TmpDim=split("jpg,jpeg,gif,png,bmp",",")
  TmpDim=split(Cls.ChannelUpFileType(0)&"|"&Cls.ChannelUpFileType(1)&"|"&Cls.ChannelUpFileType(2)&"|"&Cls.ChannelUpFileType(3),"|")
  strer=lcase(strer)
  For t=0 To ubound(TmpDim)
    If instr(strer,"[upload="&TmpDim(t)&"]")>0 Then
      TmpFileType=TmpDim(t)
      Exit For
    End If
  Next
  Get_Remark_FileType=TmpFileType
End Function

function frm_topic(fn,tn)
  dim tmp1
  tmp1=vbcrlf&"<select onchange=""document."&fn&"."&tn&".focus(); document."&fn&"."&tn&".value = this.options[this.selectedIndex].value + document."&fn&"."&tn&".value;"">" & _
       vbcrlf&"<option value='' selected>选择</option>" & _
       vbcrlf&"<option value=[原创]>[原创]</option>" & _
       vbcrlf&"<option value=[转帖]>[转帖]</option>" & _
       vbcrlf&"<option value=[Hack]>[Hack]</option>" & _
       vbcrlf&"<option value=[砖头]>[砖头]</option>" & _
       vbcrlf&"<option value=[乱弹]>[乱弹]</option>" & _
       vbcrlf&"<option value=[灌水]>[灌水]</option>" & _
       vbcrlf&"<option value=[讨论]>[讨论]</option>" & _
       vbcrlf&"<option value=[警告]>[警告]</option>" & _
       vbcrlf&"<option value=[求助]>[求助]</option>" & _
       vbcrlf&"<option value=[推荐]>[推荐]</option>" & _
       vbcrlf&"<option value=[公告]>[公告]</option>" & _
       vbcrlf&"<option value=[成人]>[成人]</option>" & _
       vbcrlf&"<option value=[注意]>[注意]</option>" & _
       vbcrlf&"<option value=[贴图]>[贴图]</option>" & _
       vbcrlf&"<option value=[建议]>[建议]</option>" & _
       vbcrlf&"<option value=[下载]>[下载]</option>" & _
       vbcrlf&"<option value=[分享]>[分享]</option>" & _
       vbcrlf&"</select>"
  frm_topic=tmp1
end function

function bbs_color_fk(ByVal iColor,ByVal jColor)
  bbs_color_fk=bbs_color_fk&"&nbsp;#&nbsp;<input type=text class=txt name="&iColor&" value='"&jColor&"' maxlength=6 size=6 onclick=""SelectColor('"&iColor&"');"""
  If Len(jColor) = 6 then bbs_color_fk=bbs_color_fk&" style=""background:#"&jColor&";"""
  bbs_color_fk=bbs_color_fk&" readonly>&nbsp;&nbsp;<a href=""javascript:ClearColor('"&iColor&"')"" class=blue>清空颜色值</a>"
end function

'//* 读取当前版块专题 *//
function Special_InitSelect(oSpecialID)
	If Not Cls.SpecialTrue or int(bbs_config(23))=0 or bbs_data(14)="" Then Exit function
	Dim Tmpstr, Sii, j, Fid_Special
    Fid_Special=split(bbs_data(14)&"",",")
    Tmpstr = Tmpstr&"<tr  class=bbs_tr>"
    Tmpstr = Tmpstr&"<td>主题所属：</td>"
    Tmpstr = Tmpstr&"<td>"	
	Tmpstr = Tmpstr& "<select name=SpecialID value='"&oSpecialID&"' size=1>"
	Tmpstr = Tmpstr& "<option value='0'>不属于任何专题</option>"
    For j = 0 To Ubound(Fid_Special)'
	  For Sii = 0 To Ubound(Cls.ChannelSpecial,2)'显示的专题数最好不要超过9个（数字编号图片只有9个^_^）
	    If Fid_Special(j)=Cls.ChannelSpecial(1,Sii) Then
		  Tmpstr = Tmpstr & "<option value='"&Cls.ChannelSpecial(0,Sii)&"' class=bg_2"
		  If oSpecialID = Cls.ChannelSpecial(0,Sii) Then Tmpstr = Tmpstr & " selected"
		  Tmpstr = Tmpstr & ">"&Cls.ChannelSpecial(1,Sii)&"</option>"
		End if
	  Next
	Next	
	Tmpstr = Tmpstr& "</select>&nbsp;<font class=red>请如实选择所属专题</font>"
    Tmpstr = Tmpstr& "</td>"
    Tmpstr = Tmpstr& "</tr>"
	Special_InitSelect=Tmpstr
End function

function bbs_color_fk(ByVal iColor,ByVal jColor)
  bbs_color_fk=bbs_color_fk&"&nbsp;#&nbsp;<input type=text class=txt name="&iColor&" value='"&jColor&"' maxlength=6 size=6 onclick=""SelectColor('"&iColor&"');"""
  If Len(jColor) = 6 then bbs_color_fk=bbs_color_fk&" style=""background:#"&jColor&";"""
  bbs_color_fk=bbs_color_fk&" readonly>&nbsp;&nbsp;<a href=""javascript:ClearColor('"&iColor&"')"" class=blue>清空颜色值</a>"
end function

'//* 读取当前版块专题 *//
function bbs_GetCode()
	If int(bbs_config(16))=0 Then Exit function
	Dim Tmpstr
    Tmpstr = Tmpstr&"<tr  class=bbs_tr>"
    Tmpstr = Tmpstr&"<td>验 证 码：</td>"
    Tmpstr = Tmpstr&"<td>"&Cls.GetCode()&"</td>"
    Tmpstr = Tmpstr& "</tr>"
	bbs_GetCode=Tmpstr
End function
Function LoadNewEditor(frms,names,word)
        Dim EditorCode
		EditorCode = "<input type=""hidden"" name=""codeMode"" value=""0"" /><textarea name="""&names&"""  style='display:none'>"&word&"</textarea>"
		EditorCode = EditorCode & vbcrlf & "<iframe id=""editorFrame"" width=""100%"" style=""height:400px"" frameborder=""0"" scrolling=""no"" src="""&Cls.Web_Dir&"Editor/HTML_UBB/editor.htm"" onload=""writeToEditor()""></iframe><br />"
	    LoadNewEditor = EditorCode
End Function

function bbs_post_head(ptype,pcod)
dim tmp1
tmp1=vbcrlf&"<script type=""text/javascript"">" & _
vbcrlf&"  function writeToEditor()" & _
vbcrlf&"   {" & _
vbcrlf&"    editorFrame.newEditor("&pcod&");" & _
vbcrlf&"    if(document.getElementById('AsaiMHword').value!=''){" & _
vbcrlf&"        editorFrame.writeEditorContents(document.getElementById('AsaiMHword').value);" & _
vbcrlf&"    }" & _
vbcrlf&"  }" & _
vbcrlf&"  function uploadToEditor(appendstr)" & _
vbcrlf&"   {" & _
vbcrlf&"    var appstr=appendstr.split('@@@');" & _
vbcrlf&"        editorFrame.writeEditorContents(editorFrame.getEditorContents()+appstr[editorFrame.wysiwyg]);" & _
vbcrlf&"  }" & _
vbcrlf&"  function frm_post_check(topic_true)" & _
vbcrlf&"   {" & _
vbcrlf&"    if (topic_true==1)" & _
vbcrlf&"    {" & _
vbcrlf&"     if(frm_post.topic.value=="""" || frm_post.topic.value.length>50)" & _
vbcrlf&"     {" & _
vbcrlf&"      alert(""你还没完全留下所需信息！\r\n\n贴子的 主题 是必须要的；\n且长度不能超过50个字符。"");" & _
vbcrlf&"      frm_post.topic.focus();" & _
vbcrlf&"      return false;" & _
vbcrlf&"     }" & _
vbcrlf&"   }" & _
vbcrlf&"   if("&login_strength&"<0)" & _
vbcrlf&"    {" & _
vbcrlf&"     alert(""你的体力不够发表或回复帖子！\r\n\n回复帖子要消耗体力；\n请多多在线增加体力。"");" & _
vbcrlf&"     return false;" & _
vbcrlf&"    }" & _
vbcrlf&"   //保存内容" & _
vbcrlf&"   	var editorContent = editorFrame.getEditorContents();" & _
vbcrlf&"   if(editorContent=="""" || editorContent.length>"&word_size_max*1024&")" & _
vbcrlf&"    {" & _
vbcrlf&"     alert(""你还没完全留下所需信息！\r\n\n贴子的 内容 是必须要的；\n且大小不能超过"&word_size_max&"KB(千字节)。"");" & _
vbcrlf&"     return false;" & _
vbcrlf&"    }else{" & _
vbcrlf&"    frm_post.AsaiMHword.value=editorContent;" & _
vbcrlf&"    frm_post.codeMode.value=editorFrame.wysiwyg;" & _
vbcrlf&"    }" & _
vbcrlf&"  }" & _
vbcrlf&"  </script>"
if ptype=1 then 
tmp1=tmp1&vbcrlf&"<script language=javascript>" & _
vbcrlf&"var special_num=5;" & _
vbcrlf&"var ary_special=new Array(special_num);" & _
vbcrlf&"var special_no_limit=""<br>注：以下用户不受限制，多个用户名之间用“,”分开。<br><textarea name=t_special_data class=txtarea cols=70 rows=4></textarea>"";" & _
vbcrlf&"var special_var_num="""&Cls.web_unit&"<input type=input class=txt_num name=s_emoney value=\""0\"" size=5 maxlength=10>个"";" & _
vbcrlf&"special_var_num+=""、积分<input type=input class=txt_num name=s_integral value=\""0\"" size=5 maxlength=10>分"";" & _
vbcrlf&"var special_var_num2=""、体力<input type=input class=txt_num name=s_strength value=\""0\"" size=5 maxlength=10>点"";" & _
vbcrlf&"special_var_num2+=""、经验<input type=input class=txt_num name=s_expression value=\""0\"" size=5 maxlength=10>点"";" & _
vbcrlf&"special_var_num2+=""、发贴<input type=input class=txt_num name=s_bbs_counter value=\""0\"" size=4 maxlength=10>贴"";" & _
vbcrlf&"special_var_num2+=""、在线<input type=input class=txt_num name=s_online value=\""0\"" size=4 maxlength=10>分钟"";" & _
vbcrlf&"ary_special[0]="""";" & _
vbcrlf&"ary_special[1]=""购买本贴内容需 ""+special_var_num+""<br>在未审核前用户购买分值将记录在系统中，当审核后将直接计入您的的个人帐户中。""+special_no_limit;" & _
vbcrlf&"ary_special[2]=""本贴内容需 ""+special_var_num+special_var_num2+"" 可见。""+special_no_limit;" & _
vbcrlf&"ary_special[3]=""只有回复本贴的用户才可浏览本贴的主要内容。""+special_no_limit;" & _
vbcrlf&"ary_special[4]=""只有指定用户才可浏览本贴的主要内容，多个用户名之间用“,”分开。""+special_no_limit;" & _
vbcrlf&"" & _
vbcrlf&"function change_special(strn)" & _
vbcrlf&"{" & _
vbcrlf&"  if (strn>special_num || special_num<0) return true;" & _
vbcrlf&"  var tmpobj,tmpvalue,tmpdisplay;" & _
vbcrlf&"  tmpvalue=ary_special[strn];" & _
vbcrlf&"  tmpdisplay=""""" & _
vbcrlf&"  if (tmpvalue=="""" || tmpvalue==null) tmpdisplay=""none"";" & _
vbcrlf&"" & _
vbcrlf&"  tmpobj=get_id(""div_special"");" & _
vbcrlf&"  tmpobj.style.display=tmpdisplay;" & _
vbcrlf&"  tmpobj_remark=get_id(""div_special_remark"");" & _
vbcrlf&"  tmpobj_remark.style.display=tmpdisplay;" & _
vbcrlf&"  tmpobj=get_id(""div_special2"");" & _
vbcrlf&"  tmpobj.innerHTML=tmpvalue;" & _
vbcrlf&"}" & _
vbcrlf&"function check_special()" & _
vbcrlf&"{" & _
vbcrlf&"  var tmpreturn="""";" & _
vbcrlf&"  //return tmpreturn;" & _
vbcrlf&"  var tmpisspecial=post_value(""frm_post"",""t_isspecial"");" & _
vbcrlf&"  switch (tmpisspecial)" & _
vbcrlf&"  {" & _
vbcrlf&"    case ""1"":" & _
vbcrlf&"      var tmpremark=post_value(""frm_post"",""t_special_remark"");" & _
vbcrlf&"      var tmpemoney=is_num(post_value(""frm_post"",""s_emoney""),1,1);" & _
vbcrlf&"      var tmpintegral=is_num(post_value(""frm_post"",""s_integral""),0,1);" & _
vbcrlf&"      if (tmpintegral<=0 && tmpemoney<=0) tmpreturn=""num"";" & _
vbcrlf&"      if (tmpremark=="""") tmpreturn=""remark"";" & _
vbcrlf&"      break;" & _
vbcrlf&"    case ""2"":" & _
vbcrlf&"      var tmpemoney=is_num(post_value(""frm_post"",""s_emoney""),1,1);" & _
vbcrlf&"      var tmpintegral=is_num(post_value(""frm_post"",""s_integral""),0,1);" & _
vbcrlf&"      var tmpbbs_counter=is_num(post_value(""frm_post"",""s_bbs_counter""),0,1);" & _
vbcrlf&"      var tmponline=is_num(post_value(""frm_post"",""s_online""),0,1);" & _
vbcrlf&"      if (tmpintegral<=0 && tmpemoney<=0 && tmpbbs_counter<=0 && tmponline<=0) tmpreturn=""num"";" & _
vbcrlf&"      break;" & _
vbcrlf&"    case ""3"":" & _
vbcrlf&"      var tmpremark=post_value(""frm_post"",""t_special_remark"");" & _
vbcrlf&"      if (tmpremark=="""") tmpreturn=""remark"";" & _
vbcrlf&"      break;" & _
vbcrlf&"    case ""4"":" & _
vbcrlf&"      var tmpremark=post_value(""frm_post"",""t_special_remark"");" & _
vbcrlf&"      var tmpdata=post_value(""frm_post"",""t_special_data"");" & _
vbcrlf&"      if (tmpremark=="""") tmpreturn=""remark"";" & _
vbcrlf&"      if (tmpdata=="""") tmpreturn=""data"";" & _
vbcrlf&"      break;" & _
vbcrlf&"  }" & _
vbcrlf&"  //tmpreturn=""xxx"";" & _
vbcrlf&"  return tmpreturn;" & _
vbcrlf&"}" & _
vbcrlf&"</script>"
end if
bbs_post_head=tmp1
end function

function bbs_post_end(topic_true)
 dim tmp1
  tmp1=vbcrlf&"<tr class=bbs_trb>" & _
       vbcrlf&"<td>发表帖子：</td>" & _
       vbcrlf&"<td height=40><input class=btn type=submit value='可以发表啦' onclick=""javascript:return frm_post_check("&topic_true&");"">　&nbsp;<input type=button class=btn onclick=""javascript:post_preview('frm_post','topic','AsaiMHword',0);"" value='预览内容'>　&nbsp;<input class=btn type=reset value='清除重写'>　&nbsp;（按 Ctrl + Enter 或 Alt + S 可快速复发表）</td>" & _
       vbcrlf&"</tr>" & _
       vbcrlf&"</form>"& _
	   vbcrlf&"<form name=frm_preview action='"&Cls.web_dir&"common/preview.asp' method=post target='win_preview'>" & _
       vbcrlf&"<input type=hidden name=p_code value=''>" & _
       vbcrlf&" <input type=hidden name=p_topic value=''>" & _
       vbcrlf&" <input type=hidden name=p_mod value=''>" & _
       vbcrlf&" <input type=hidden name=p_remark value=''></form>"
  bbs_post_end=tmp1
end function
%>
