<%

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

dim is_super,bbs_num,BbsOnline
bbs_num=-1
BbsOnline=Cls.bbs_Online   '论坛版面在线总人数

function bbs_data(fd_num)
  bbs_data=dim_bbs_data(fd_num,bbs_num)
end function

function bbs_config(fc_num)
  if dim_bbs_config(fc_num) <> "" then 
     bbs_config=int(dim_bbs_config(fc_num))
  else
     bbs_config=int(dim_Bbss_config(fc_num))
  end if
end function

sub bbs_first()
  call bbs_class_load()
  bbs_num=-1
  for i=0 to bbs_cnum
    if int(Bbsid)=int(dim_bbs_data(1,i)) then
      bbs_num=i
      zid=dim_bbs_data(0,i)
      exit for
    end if
  next
  if bbs_num<0 then
    call bbs_redirect("Index.asp")
  end if
  dim_bbs_config=split(bbs_data(12),"|")
  dim_Bbss_config=split(Cls.Web_BbsConfig,"|")

  tit=bbs_data(2)&" - "&ftit

  if int(bbs_data(9))>0 then
    for i=0 to dim_bbs_num
      if int(bbs_data(9))=int(i+1) then
        page_power=left(dim_Bbs(i),instr(dim_Bbs(i),":")-1)
        exit for
      end if
    next
  end if
end sub

function bbs_get_classz()
  dim tmpstr
  for i=1 to bbs_cnum
    if int(zid)=int(dim_bbs_data(0,i)) and dim_bbs_data(1,i)>0 then
      if tmpstr="" then
        tmpstr=dim_bbs_data(1,i)
      else
        tmpstr=tmpstr&","&dim_bbs_data(1,i)
      end if
    end if
  next
  bbs_get_classz=tmpstr
end function

sub bbs_load_power()
  is_super=bbs_Power_True(bbs_data(8))
  if int(bbs_data(9))=0 then
    if is_super=false and (login_username="" or instr(","&lcase(Cls.cache_get("bbs_class")(11,bbs_num))&",",","&lcase(login_username)&",")=0) then
      call web_error("bbs_user")
    end if
  end if
  if is_super=false then   '管理员和斑竹不受限
    if BbsOnline>int(bbs_config(18)) then call web_error("bbs_online")'在线人数限制
  end if
end sub

'--------------------------论坛分级下拉导航---------------------------------
function BbsJumpList(bid,bname)
  dim temp1,tmp_cid,tmp_classid,tmp_j,j
  if Cls.Is_Null(temp1)<>"" then
    BbsJumpList=temp1
    exit function
  end if
  tmp_cid=0
  for j=0 to bbs_cnum
  tmp_classid=Cls.cache_get("bbs_class")(0,j)
    if bid=0 then
      if int(tmp_cid)<>int(tmp_classid) then
        temp1=temp1&"<div class=menuitems><b><a href=list.asp?fid="&Cls.cache_get("bbs_class")(1,j)&">╋"&Cls.cache_get("bbs_class")(2,j)&"</a></b></div>"
        tmp_cid=tmp_classid
      else
        temp1=temp1&"<div class=menuitems><a href=list.asp?fid="&Cls.cache_get("bbs_class")(1,j)&">"
        for tmp_j=1 to (Cls.cache_get("bbs_class")(6,j)-1)
          temp1=temp1&"│"
        next
        temp1=temp1&"├"&Cls.cache_get("bbs_class")(2,j)&"</a></div>"
      end if
    else
      if int(bid)=int(Split(Cls.cache_get("bbs_class")(7,j),",")(0)) then
	    if bname<>Cls.cache_get("bbs_class")(2,j) then
          temp1=temp1&"<div class=menuitems><a href=list.asp?fid="&Cls.cache_get("bbs_class")(1,j)&">"
          for tmp_j=1 to (Cls.cache_get("bbs_class")(6,j)-1)
            temp1=temp1&"│"
          next
		  temp1=temp1&"├"&Cls.cache_get("bbs_class")(2,j)&"</a></div>"
        end if
      end if
    end if
  next
  BbsJumpList=temp1
end function

'------------------------------论坛分级-----------------------------
function bbs_grade(ltype)
    Dim temps
  if bbs_config(0)=0 then
    exit function
  end if
  dim temp1
  if Cls.Is_Null(temp1)="" then
    for i=0 to bbs_cnum
	  if int(dim_bbs_data(0,i))=int(bbs_data(0)) and instr(","&bbs_data(7)&",",","&dim_bbs_data(1,i)&",")>0 then
	    if dim_bbs_data(3,i)=0 then
          temp1=temp1&"&nbsp;→&nbsp;<a href=""List.asp?fid="&dim_bbs_data(1,i)&""" onMouseOver=""showmenu(event,'"&BbsJumpList(dim_bbs_data(1,i),dim_bbs_data(2,i))&"',0)""><b>"&dim_bbs_data(2,i)&"</b></a>"
	    else
          temp1=temp1&"&nbsp;→&nbsp;<a href=""List.asp?fid="&dim_bbs_data(1,i)&"""><b>"&dim_bbs_data(2,i)&"</b></a>"
        end if
      end if
    next
  end if
  
  
  
   temps=vbcrlf&"<div><div class=""notice"">" & _
   		 vbcrlf&"<span style=""float:left;"">" & _
		 vbcrlf&"<img src='"&Cls.web_skindir&"Bbs/bbs_tit.gif' align=absMiddle border=0> " & _
		 vbcrlf&"<a href='Index.asp' onMouseOver=""showmenu(event,'"&BbsJumpList(0,"")&"',0)""><b>"&tit_fir&"</b></a>&nbsp;"&temp1&"&nbsp;→&nbsp;"&ftit&"" & _
         vbcrlf&"<div class=""menuskin"" id=""popmenu"" onmouseover=""clearhidemenu()"" onmouseout=""dynamichide(event)"" style=""z-index:100;""></div></span>" & _
		 vbcrlf&"</div>"
          
		 temps=temps&vbcrlf&"<div class=""mainbox"" style=""overflow:hidden""><div class=""rollboder"">" & _
		 vbcrlf&"<ul>" & _
		 vbcrlf&"<li class=""rollleft"">" & _
		 vbcrlf&"<div class=""rollTextMenus"" style=""padding-left:10px"">" & _
		vbcrlf&"<font color=red>本版规则及论坛导航</font>" 
		 temps=temps&vbcrlf&""
		 if bbs_data(15)<>"" then
		 temps=temps&vbcrlf&bbs_data(15)
		 else
		 temps=temps&vbcrlf&"&nbsp;请遵守论坛规则，勿发表与本论坛无关的信息！谢谢合作！" & _
		 vbcrlf&"</div>" & _
		 vbcrlf&"</li>" & _
		 vbcrlf&"</ul>" & _
		 vbcrlf&"</div></div></div>"
		 end if



         if ltype=1 then temps=temps&vbcrlf& Channel_Special()		 
         temps=temps&vbcrlf&""
  
         bbs_grade = temps
end function

'------------------------------论坛标头-----------------------------
function bbs_top(ft_var,ft_view)
  dim temp1
  temp1=vbcrlf&"" & _
  vbcrlf&"" & _
  vbcrlf&"<table border=0 cellspacing=0 cellpadding=0 class=postbut>" & _
	vbcrlf&"<tr>" & _
	vbcrlf&"<td height=30 align=left><a href='Write.asp?fid="&Bbsid&"'><img src='"&Cls.web_skindir&"Bbs/new_topic.gif' align=absMiddle border=0></a>&nbsp;" & _
	vbcrlf&"&nbsp;<a href='Write.asp?fid="&Bbsid&"&isvote=yes'><img src='"&Cls.web_skindir&"Bbs/new_vote.gif' align=absMiddle border=0></a>&nbsp;"
  if ft_var=1 then
    temp1=temp1&vbcrlf&"&nbsp;<a href='Reply.asp?fid="&Bbsid&"&id="&viewid&"'><img src='"&Cls.web_skindir&"/Bbs/re_topic.gif' align=absMiddle border=0></a>&nbsp;"
  end if
	temp1=temp1&vbcrlf&"&nbsp;"&bbs_super_type(bbs_data(8),bbs_config(1))&"&nbsp;</td>"
  if ft_var=1 then
	temp1=temp1&vbcrlf&"<td align=right><a href='"&LoadViewAbout(Viewid,Bbsid,"Up")&"'><img src='"&Cls.web_skindir&"Bbs/prethread.gif' align=absMiddle border=0></a>  <a href='"&LoadViewAbout(Viewid,Bbsid,"Down")&"'><img src='"&Cls.web_skindir&"Bbs/nextthread.gif' align=absMiddle border=0></a> 您是本贴第 <font class=red>"&ft_view&"</font> 位浏览者</td>"
  else
    temp1=temp1&vbcrlf&""
    
  end if
  
  
  
  
  
temp1=temp1&vbcrlf&"</tr>" & _ 

vbcrlf&"</table>" & _



vbcrlf&"<table class=""mainbox tableborder"" cellspacing=""0"" cellpadding=""0"" style=""margin-top:0px; "">" & _
vbcrlf&"<tr class=""a_list_title"">" & _
vbcrlf&"<td colspan=""6"">" & _
vbcrlf&"<span>主题列表</span>" & _
vbcrlf&"<a href='Search.asp?action=my'>我的主题</a> | " & _ 
vbcrlf&"<a href='List.asp?fid="&Bbsid&"&action=isgood'><font color=""#FFFF00"">精华主题</font></a> | " & _
vbcrlf&"<a href='Event.asp?fid="&Bbsid&"'>论坛事件</a>  |  " & _
vbcrlf&"<a href='List.asp?fid="&Bbsid&"&action=manage'>贴子管理</a> | " & _
vbcrlf&"<a href='Recycle.asp?fid="&Bbsid&"'>回 收 站</a>" & _
vbcrlf&"</td>" & _
vbcrlf&"</tr>" & _
vbcrlf&""
bbs_top = temp1
end function

'//* 浏览相关 *//
Public Function LoadViewAbout(Viewid,Bbsid,va_t)
  dim tmp1,tmp_sql
  if va_t="Up" then
    If SqlType = 1 Then 
	  tmp_sql="Select top 1 ID,Reply_ID,topic from "&now_bbs_data&" where Is_Topic=1 and bbs_ID="&Bbsid&" and Reply_ID<"&Viewid&" order by ID desc"
    else
      tmp_sql="Select top 1 ID,Reply_ID,topic from "&now_bbs_data&" where Is_Topic=True and bbs_ID="&Bbsid&" and Reply_ID<"&Viewid&" order by ID desc"
    End if
  End if
  if va_t="Down" then
    If SqlType = 1 Then 
      tmp_sql="Select top 1 ID,Reply_ID,topic from "&now_bbs_data&" where Is_Topic=1 and bbs_ID="&Bbsid&" and Reply_ID>"&Viewid&" order by ID"
    else
      tmp_sql="Select top 1 ID,Reply_ID,topic from "&now_bbs_data&" where Is_Topic=True and bbs_ID="&Bbsid&" and Reply_ID>"&Viewid&" order by ID"
    End if
  End if
    set rs=Cls.exec(tmp_sql,1)
  if not rs.eof then
    tmp1=tmp1&vbcrlf&"View.asp?id="&rs(1)&"' title='"&Cls.code_html(rs(2),1,0)&""
  else
    tmp1=tmp1&vbcrlf&"#' title='没有找到主题"
  End if
  rs.close
  LoadViewAbout=tmp1
End Function

%>
