
<%
dim forumf,forumn,forumw,forumstar,forumparent,forumname,forumpower,forumtype,forumpro,forumtopicnum,forumdatanum,n_names,utit
dim etc,etb,etcb,vote_n,max_word_size,min_word_size,forum_rule

'-------------------------------------初始化 1--------------------------------------
sub forum_first()
   sql="select top 1 forum_id,class_id,forum_f,forum_n,forum_w,forum_star,forum_parent,forum_name,forum_power,forum_type,forum_pro,forum_topic_num,forum_data_num,forum_user,forum_config,forum_rule from bbs_forum where forum_id="&forumid&" and forum_hidden=0"
   set rs=joekoe_cms.exec(sql,1)
   if rs.eof then
     rs.close
     call format_redirect("index.asp")
   end if
   'classid=rs(1)
   forumf=rs(2)
   forumn=rs(3)
   forumw=rs(4)
   forumstar=rs(5)
   forumparent=rs(6)
   forumname=rs(7)
   forumpower=rs(8)
   forumtype=rs(9)
   forumpro=rs(10)
   forumtopicnum=rs(11)
   forumdatanum=rs(12)
   n_names=rs(13)
   forum_config=split(rs(14),"|")
   forum_rule=rs(15)
   rs.close
   tit=forumname&"（"&ftit&"）"
   if login_mode="admin" then exit sub
 if forum_config(9)>0 then '颜色扣分
   etc=forum_config(9)
 else
   etc=dim_num(11)
 end if
 if forum_config(10)>0 then '加粗扣分
   etb=forum_config(10)
 else
   etb=dim_num(12) 
 end if
 if forum_config(12)>0 then '论坛投票项数
   vote_n=forum_config(12)
 else
   vote_n=dim_num(29)
 end if
 if forum_config(6)>0 then '最大字节长度
   max_word_size=forum_config(6)
 else
   max_word_size=dim_num(4)
 end if
 if forum_config(5)>0 then '最小字节长度
   min_word_size=forum_config(5)
 else
   min_word_size=dim_num(35)
 end if
   if forumtype=0 then
     if login_username="" then call web_error("power")
     dim names,n
     names=split(n_names,",")
     for n=0 to ubound(names)
       if login_username=names(n) then
         if isarray(names) then erase names
         exit Sub
       end if
     next
   call web_error("power")
   end if
   call forum_get_tip()
   page_power=format_forum_type(forumtype,0,forumpro)
 end sub

'-------------------------------------论坛分级--------------------------------------
sub forum_grade()
  dim temp1,mdim,mnum,is_forum_grade
  is_forum_grade=false
  if int(format_mid_num(38))=1 or forum_config(0)=1 then is_forum_grade=true
  temp1=application(joekoe_cms.web_cookies&"_forum_grade_"&forumid)
  if var_null(temp1)="" then
    sql="select forum_id,forum_name from bbs_forum where forum_id in ("&forumparent&") order by forum_star desc,forum_order"
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,1
    mdim=rs.getrows()
    rs.close
    mnum=ubound(mdim,2)
    for i=0 to mnum
      temp1="&nbsp;→&nbsp;<a href='list.asp?forum_id="&mdim(0,i)&"'>"&mdim(1,i)&"</a>"&temp1
    next
    erase mdim
    application.lock
    application(joekoe_cms.web_cookies&"_forum_grade_"&forumid)=temp1
    application.unlock
  end if  
  if is_forum_grade=false then
  dim tmp1
   tmp1= vbcrlf&"<tr><td class=bbs_td>本版版规及导航</td></tr>" 
   if var_null(forum_rule)<>"" then tmp1= tmp1&     vbcrlf&"<tr class=bbs_tr><td>"&forum_rule&"</td></tr>" 
   tmp1= tmp1&vbcrlf&"<tr class=bbs_tr><td height=25>" & _
		 vbcrlf&"<table border=0 width='100%'><tr>" & _
		 vbcrlf&"<td width='72%' class=bw>&nbsp;<img src='"&joekoe_cms.web_dir_skin&"/forum/ico_nav.gif' align=absMiddle border=0>&nbsp;" & _
		 vbcrlf&"<a href='index.asp'><b>"&tit_fir&"</b></a>&nbsp;<b>"&temp1&"</b>&nbsp;→&nbsp;<font title='"&joekoe_cms.code_html(ftit,1,0)&"'>"&joekoe_cms.code_html(ftit,1,34)&"</font>" & _
		 vbcrlf&"</td>" 
    dim f_online
  sql="select count(l_forum_online) from user_login where l_forum_online="&forumid&""
  set rs=joekoe_cms.exec(sql,1)
  f_online=rs(0)
  rs.close
   tmp1=tmp1&vbcrlf&"<script language=javascript>" & _
   		vbcrlf&"function forum_load_online(fname)" & _
   		vbcrlf&"{" & _
   		vbcrlf&"  var targetimg =eval(""document.all.forum_online_img"");" & _
   		vbcrlf&"  var targetDivtr =eval(""document.all.forum_online_tr"");" & _
   		vbcrlf&"  var targetDiv =eval(""document.all.forum_online"");" & _
   		vbcrlf&"  if (targetDivtr.style.display!=""block"")" & _
   		vbcrlf&"  {" & _
   		vbcrlf&"    document.all.forum_online_var.innerHTML=""[关闭列表]"";" & _
   		vbcrlf&"    targetDivtr.style.display=""block"";" & _
   		vbcrlf&"    targetimg.src="""&joekoe_cms.web_dir_skin&"/small/fk_minus.gif"";" & _
   		vbcrlf&"    if (targetimg.loaded==""no"")" & _
   		vbcrlf&"    {" & _
   		vbcrlf&"      targetimg.loaded="""";" & _
   		vbcrlf&"      document.frames[""hiddenframe""].location.replace(""loadonline.asp?forum_id="&forumid&"&uppath=forum_list_view"");" & _
   		vbcrlf&"    }" & _
   		vbcrlf&"  }" & _
   		vbcrlf&"  else" & _
   		vbcrlf&"  {" & _
   		vbcrlf&"    document.all.forum_online_var.innerHTML=""[在线列表]"";" & _
   		vbcrlf&"    targetDivtr.style.display=""none"";" & _
   		vbcrlf&"    targetimg.src="""&joekoe_cms.web_dir_skin&"/small/fk_plus.gif"";" & _
   		vbcrlf&"  }" & _
   		vbcrlf&"}" & _
   		vbcrlf&"</script>" & _		 
		vbcrlf&"<td width='*' align='right'>当前论坛在线&nbsp;<font class='red' >"&f_online&"</font>&nbsp;人&nbsp;&nbsp;<img id=forum_online_img loaded=no src='"&joekoe_cms.web_dir_skin&"/small/fk_plus.gif' align=absMiddle border=0>&nbsp;<span style=cursor:hand onclick='javascript:forum_load_online();' id=forum_online_var alt=打开当前论坛在线列表 style=""font-weight:100"">[在线列表]</a></span></td>"& _
		vbcrlf&"</tr></table>" & _
	    vbcrlf&"</td></tr>" & _
		vbcrlf&"<tr style='display:none' id=forum_online_tr height=30><td id=forum_online width='100%' class=trb><div class=div_alt onclick='javascript:forum_load_online();'>正在读取在线用户数据，请稍侯……</div></td></tr>"
  end if
  call forum_bar_top("",tmp1,1)
  call forum_grade_tip()
 ' response.write ukong
 ' call forum_online_view()
end sub

sub forum_grade2()
  dim tmp1
  tmp1=  vbcrlf&"<tr><td class=bbs_td>本版版规及导航</td></tr>"  & _
		 vbcrlf&"<tr class=bbs_tr>" & _
		 vbcrlf&"<td width='100%' class=bw>&nbsp;<img src='"&joekoe_cms.web_dir_skin&"/forum/ico_nav.gif' align=absMiddle border=0>&nbsp;" & _
		 vbcrlf&"<a href='index.asp'>"&tit_fir&"</a>&nbsp;"&temp1&"&nbsp;→&nbsp;<font title='"&joekoe_cms.code_html(ftit,1,0)&"'>"&joekoe_cms.code_html(ftit,1,34)&"</font>" & _
		 vbcrlf&"</td></tr>" 
		 call forum_bar_top("",tmp1,1)
end sub

sub forum_online_view()
  dim f_online
  sql="select count(l_forum_online) from user_login where l_forum_online="&forumid&""
  set rs=joekoe_cms.exec(sql,1)
  f_online=rs(0)
  rs.close
  response.write vbcrlf&"<script language=javascript>" & _
   		vbcrlf&"function forum_load_online(fname)" & _
   		vbcrlf&"{" & _
   		vbcrlf&"  var targetimg =eval(""document.all.forum_online_img"");" & _
   		vbcrlf&"  var targetDivtr =eval(""document.all.forum_online_tr"");" & _
   		vbcrlf&"  var targetDiv =eval(""document.all.forum_online"");" & _
   		vbcrlf&"  if (targetDivtr.style.display!=""block"")" & _
   		vbcrlf&"  {" & _
   		vbcrlf&"    document.all.forum_online_var.innerHTML=""[关闭在线列表]"";" & _
   		vbcrlf&"    targetDivtr.style.display=""block"";" & _
   		vbcrlf&"    targetimg.src="""&joekoe_cms.web_dir_skin&"/small/fk_minus.gif"";" & _
   		vbcrlf&"    if (targetimg.loaded==""no"")" & _
   		vbcrlf&"    {" & _
   		vbcrlf&"      targetimg.loaded="""";" & _
   		vbcrlf&"      document.frames[""hiddenframe""].location.replace(""loadonline.asp?forum_id="&forumid&"&uppath=forum_list_view"");" & _
   		vbcrlf&"    }" & _
   		vbcrlf&"  }" & _
   		vbcrlf&"  else" & _
   		vbcrlf&"  {" & _
   		vbcrlf&"    document.all.forum_online_var.innerHTML=""[打开在线列表]"";" & _
   		vbcrlf&"    targetDivtr.style.display=""none"";" & _
   		vbcrlf&"    targetimg.src="""&joekoe_cms.web_dir_skin&"/small/fk_plus.gif"";" & _
   		vbcrlf&"  }" & _
   		vbcrlf&"}" & _
   		vbcrlf&"</script>" & _
		vbcrlf&"<table border=0 cellspacing=0 cellpadding=0 class=table><tr><td class=bg_td>" & _
 	    vbcrlf&"&nbsp;"&img_skin("m_forum")&"当前论坛在线&nbsp;<font class= white>"&f_online&"</font>&nbsp;人&nbsp;&nbsp;<img id=forum_online_img loaded=no src='"&joekoe_cms.web_dir_skin&"/small/fk_plus.gif' align=absMiddle border=0>&nbsp;<span style=cursor:hand onclick='javascript:forum_load_online();' id=forum_online_var alt=打开当前论坛在线列表 style=""font-weight:100"">[打开在线列表]</a></span></td></tr>" & _
 	    vbcrlf&"<tr style='display:none' id=forum_online_tr height=30><td id=forum_online width='100%'><div class=div_alt onclick='javascript:forum_load_online();'>正在读取在线用户数据，请稍侯……</div></td></tr>" & _
		vbcrlf&"</table>" & _
	    vbcrlf&ukong
end sub

sub forum_ad()
  dim tmp1
  tmp1=  vbcrlf&"<tr class=bbs_tr align=center>" & _
   vbcrlf&"<td width='25%' class=bw><a href='http://www.sinoxz.com/forum/view.asp?view_id=113'><font color=#ff0000><b>[天助网络]整站近期供下载！</b></font></a> <img border=0 src='http://www.35me.com/skin/skin_1/small/ico_new.gif' align=absmiddle></td>" & _
   vbcrlf&"<td width='25%' class=bw><a href='http://www.sinoxz.com/forum/view.asp?forum_id=12&view_id=114'>【广告】天助网络广告招商处</a></td>" & _
   vbcrlf&"<td width='25%' class=bw><a href='http://www.sinoxz.com/forum/view.asp?forum_id=12&view_id=111'><font color=#ff0000><b>[公告]新版论坛管理条例</b></font></a></td>" & _
   vbcrlf&"<td width='25%' class=bw><a href='http://www.sinoxz.com/forum/view.asp?forum_id=12&view_id=110'><font color=#0000FF><b>论坛发帖须知，来者必读</b></font></a></td></tr>" & _
   vbcrlf&"<tr class=bbs_tr align=center>" & _
   vbcrlf&"<td><a href='http://www.sinoxz.com/forum/view.asp?forum_id=12&view_id=116'><font color=#0000FF><b>招贤纳仕榜 封官进爵书</b></font></a></td>" & _
   vbcrlf&"<td><a href='http://www.sinoxz.com/forum/view.asp?forum_id=12&view_id=112'><font color=#CE161D><b>申请友情链接的朋友请看这里</b></font></a></td>" & _
   vbcrlf&"<td><a href='http://www.sinoxz.com/common/help.asp?action=forum'><b>论坛帮助中心</b></a></td>" & _
   vbcrlf&"<td><a href='http://www.sinoxz.com/forum/view.asp?forum_id=12&view_id=109'><font color=#ff0000><b>长期招聘版主（申请版主者必看）</b></font></a> <img border=0 src='http://www.35me.com/skin/skin_1/small/ico_new.gif' align=absmiddle></td>" & _
vbcrlf&"</td></tr>" 
   call forum_bar_top("",tmp1,1)
   
end sub


'-------------------------------------论坛标头--------------------------------------
sub forum_top(ft)
  dim temp1,RecnetVisit
  RecnetVisit="<script language=javascript>"&_
  vbcrlf&"var AllForumNameList=GetCookieData(""ForumNameList"");"&_
  vbcrlf&"var NowForumName=""<option value='list.asp?Forum_ID="&ForumID&"'>"&ForumName&"</option>"";"&_
  vbcrlf&"if(AllForumNameList.indexOf(NowForumName)==-1){document.cookie= ""ForumNameList"" + ""="" + escape(NowForumName+AllForumNameList);}"&_
  vbcrlf&"document.write(""<select onchange='location=this.options[this.selectedIndex].value;'><option>最近访问的版块...</option>"" + AllForumNameList+ ""</select>"");"&_
  vbcrlf&"</script>"
   temp1=vbcrlf&"<table border=0 cellspacing=0 cellpadding=0 width='97%'>" & _
	vbcrlf&"<tr>" & _
	vbcrlf&"<td ><a href='write.asp?forum_id="&forumid&"'><img src='"&joekoe_cms.web_dir_skin&"/forum/new_topic.gif' align=absMiddle border=0 title='在 "&forumname&" 里发表新主题'></a>&nbsp;" & _
	vbcrlf&"<a href='write.asp?forum_id="&forumid&"&isvote=yes'><img src='"&joekoe_cms.web_dir_skin&"/forum/new_vote.gif' align=absMiddle border=0 title='在 "&forumname&" 里发表新调查'></a>&nbsp;" 
	if ft="（浏览主题）" then
	temp1=temp1&vbcrlf&"<a href='reply.asp?forum_id="&forumid&"&view_id="&viewid&"&reply_id="&replyid&"'><img src='"&joekoe_cms.web_dir_skin&"/forum/reply.gif' align=absMiddle border=0 title='在 "&forumname&" 回复帖子'></a>&nbsp;" 
	temp1=temp1&"&nbsp;"&forum_super_view(forumpower,forum_config(1),99)&" </td>"
	temp1=temp1&vbcrlf&"<td align=right><table border=0><tr><td>您是本贴第&nbsp;<font class=red>"&counter&"</font>&nbsp;位浏览者&nbsp;</td>" 
	'temp1=temp1&vbcrlf&"<td><a href='javascript:;' onclick=""javascript:window.external.AddFavorite('"&joekoe_cms.web_url&"forum/view.asp?forum_id="&forumid&"&view_id="&viewid&"','"&joekoe_cms.web_name&" - "&tit&" - "&fir_topic&"');""><img src='"&joekoe_cms.web_dir_skin&"forum/page_fav.gif' alt='将本页加入收藏夹' border=0></a>&nbsp;</td>"
	'temp1=temp1&vbcrlf&"<td><a href=""javascript:;"" onclick=""javascript:document.location.reload();""><img src="""&joekoe_cms.web_dir_skin&"forum/page_refresh.gif"" alt=""刷新本页"" border=0></a></td></tr></table>" 
	temp1=temp1&vbcrlf&"</tr></table>" 
  else
  temp1=temp1&"&nbsp;"&forum_super_view(forumpower,forum_config(1),99)&" </td>" & _
  vbcrlf&"<td align=right><table border=0><tr>" & _
  vbcrlf&"<td><a href=xml.asp?forum_id="&forumid&" target=_blank ><img src='../images/rss_xml.gif' border=0 alt=""RSS 2.0 支持""></a></td>"&_
  vbcrlf&" <td width=1></td>"&_
  vbcrlf&"<td>[<a href='action.asp?action=my&fid=2'>我的帖子</a>]</td>"&_
  vbcrlf&" <td width=1></td>"&_
  vbcrlf&"<td>[<a href='list.asp?forum_id="&forumid&"&action=isgood'>精华库</a>]</td>"&_
  vbcrlf&" <td width=1></td>"&_
  vbcrlf&"<td>[<a href='event.asp?forum_id="&forumid&"'>事件</a>]</td>"&_
  vbcrlf&" <td width=1></td>"&_
  vbcrlf&"<td>[<a href='list.asp?forum_id="&forumid&"&action=manage'>管理</a>]</td>"&_
  vbcrlf&" <td width=1></td>"&_
  vbcrlf&"<td>[<a href='recycle.asp?forum_id="&forumid&"'>回收站</a>]</td>"
  'vbcrlf&" <td width=1></td>"&_
  'vbcrlf&"<td>"&RecnetVisit&"</td>"
  temp1=temp1&vbcrlf&" </tr>"&_
  vbcrlf&" </table>"
  end if
  temp1=temp1&vbcrlf&"</td></tr></table>"&_
  vbcrlf&ukong
  response.write temp1
  %>
  <script language=javascript>
  function GetCookieData(sL)
{
    var sRet="";
    var sC=""+document.cookie;
    if(sC.length>0)
    {
        var aC=sC.split(";",100);
        var iC=aC.length;
        for(var i=0;i<iC;i++)
        {
            if(aC[i].indexOf(sL+"=")!=-1)
            {
                var aRet=aC[i].split("=");
                sRet=unescape(aRet[1]);
                break;
            }
        }
    }
    return sRet;
}
</script>
  <%
end sub

'-------------------------------------论坛等级--------------------------------------
function format_forum_type(fvars,ft,fpros)
  if isnumeric(fpros) and int(ft)=1 then
    if int(fpros)=1 then
      format_forum_type="只读论坛"
      exit function
    end if
  end if
  dim fvar
  fvar=fvars-1
  format_forum_type=""
  for i=0 to ubound(dim_forum)
    if int(ft)=0 then
      if fvar=i then
        format_forum_type=left(dim_forum(i),instr(dim_forum(i),":")-1)
        exit for
      end if
    else
      if fvar=i then
        format_forum_type=right(dim_forum(i),len(dim_forum(i))-instr(dim_forum(i),":"))
        exit for
      end if
    end if
  next
end function

'******************************************************
'论坛专题过程
'sub forum_get_tip() 从数据库中读取专题数据到dimforumtip
'sub forum_grade_tip()显示专题数据
'******************************************************
sub forum_get_tip()
  dim mdim,cnum,rnum,r,c
  sql="select * from bbs_special where fid="&forumid
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if not rs.eof then 
    mdim=rs.getrows()
  else
    rs.close
    exit sub
  end if  
  rs.close
  cnum=-1
  rnum=-1
  cnum=ubound(mdim)
  if isarray(mdim) then 
  rnum=ubound(mdim,2)
  redim dimforumtip(cnum+1,rnum)
  for r=0 to rnum
    for c=0 to cnum
    dimforumtip(c,r)=mdim(c,r)
    next
    dimforumtip(cnum+1,r)=""&joekoe_cms.web_dir&"forum/list.asp?forum_id="&mdim(1,r)&"&tip_id="&mdim(2,r)&""
  next 
  end if 
  if cnum>=0 then erase mdim
end sub

sub forum_grade_tip()
dim i
if isarray(dimforumtip) then
%>
<table border=0 cellspacing=0 cellpadding=0 class=bbs_table>
<tr class=bbs_trb><td  class=sl>
  <table border=0 cellspacing=0 cellpadding=0 width="98%">
  <tr>
  <td align=left>
    <table border=0 align=left>
   <tr class=bbs_trb>
    <td class=btd>本版专题：</td>
<%
    for i=0 to ubound(dimforumtip,2)
     response.write vbcrlf&"<td class=sl><img src='"&joekoe_cms.web_dir&"images/number/n"&i+1&".gif' border=0 align=absMiddle>&nbsp;<a href="""&dimforumtip(6,i)&""">"&dimforumtip(4,i)&"</a></td>"
    next
%>
    </tr>
    </table>
  </td>
  </tr>
  </table>
</td></tr>
  </table>
<table border=0><tr><td height=3></td></tr></table>
<%
  end if
end sub
%>
