#2
cx100net2007-02-13 15:06
接上段 Sub Passport_Main() <noframes> |
index.asp源码:
<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/dv_clsother.asp"-->
<%
Rem 首页页面设置
Const CachePage=false '是否做页面缓存
Const CacheTime=60 '缓存失效时间
Dim XMLDom,page,TopicMode,Cmd
If Request("w") = "1" Then
Passport_Main()
Response.End
End If
If (Not Response.IsClientConnected) and Dvbbs.userid=0 Then
Session(Dvbbs.CacheName & "UserID")=empty
Response.Clear
Response.End
Else
If Request("action")="xml" Then
Showxml()
Else
Main()
End If
End If
Sub Showxml()
Dim node
Set XMLDOM=Application(Dvbbs.CacheName&"_ssboardlist").cloneNode(True)
If Dvbbs.GroupSetting(37)="0" Then'去掉隐藏论坛
For each node in XMLDOM.documentElement.getElementsByTagName("board")
If node.attributes.getNamedItem("hidden").text="1" Then
node.parentNode.removeChild(node)
End If
Next
End If
Response.Clear
Response.CharSet="gb2312"
Response.ContentType="text/xml"
Response.Write "<?xml version=""1.0"" encoding=""gb2312""?>"&vbNewLine
Response.Write XMLDom.documentElement.XML
Response.Flush
Set XMLDOM=Nothing
Set Dvbbs=Nothing
Response.End
End Sub
Sub Main()
Dvbbs.LoadTemplates("index")
If Dvbbs.BoardID=0 Then
Dvbbs.Stats=Replace(template.Strings(0),"动网先锋论坛",Dvbbs.Forum_Info(0))
Response.Write Dvbbs.mainhtml(18)
Dvbbs.Nav()
Dvbbs.ActiveOnline()
GetForumTextAd(0)
BoardList()
Else
Chk_List_Err()
TopicMode=0
If Request("topicmode")<>"" and IsNumeric(Request("topicmode")) Then TopicMode=Cint(Request("topicmode"))
If Dvbbs.Board_Setting(43)="0" Then
Dvbbs.Stats=Dvbbs.LanStr(7)
Else
Dvbbs.Stats=Dvbbs.LanStr(8)
End If
Response.Write Dvbbs.mainhtml(18)
Dvbbs.Nav()
Dvbbs.ActiveOnline()
Dvbbs.Head_var 1,Application(Dvbbs.CacheName&"_boardlist").documentElement.selectSingleNode("board[@boardid='"&Dvbbs.BoardID&"']/@depth").text,"",""
GetForumTextAd(1)
BoardList()
Page=Request("Page")
If ( Not isNumeric(Page) )or Page="" Then Page=1
Page=Clng(Page)
If Page <1 Then Page=1
If Dvbbs.Board_Setting(43)="0" Then
topicList()
End If
End If
Dvbbs.Footer
End Sub
Sub Chk_List_Err()
If Dvbbs.Board_Setting(1)="1" and Dvbbs.GroupSetting(37)="0" Then
Dvbbs.AddErrCode(26)
ElseIf Request("action")="batch" and Dvbbs.GroupSetting(45)<>"1"Then
Dvbbs.AddErrCode(28)
End If
Dvbbs.showerr()
End Sub
Sub topicList()
Dim Node,modelist,modelistimg,i,cpost,ctopic
cpost=0
ctopic=0
If Application(Dvbbs.CacheName&"_boardlist").documentElement.selectSingleNode("board[@boardid='"&Dvbbs.BoardID&"']/@child").text<>"0" Then
For Each Node In Application(Dvbbs.CacheName&"_boardlist").documentElement.selectNodes("board[@parentid='"&Dvbbs.BoardID&"']/@boardid")
ctopic=ctopic+CLng(Application(Dvbbs.CacheName &"_information_" & node.text).documentElement.selectSingleNode("information/@topicnum").text)
cpost=cpost+CLng(Application(Dvbbs.CacheName &"_information_" & node.text).documentElement.selectSingleNode("information/@postnum").text)
Next
End If
Set XMLDom=Application(Dvbbs.CacheName &"_boarddata_" & Dvbbs.boardid).cloneNode(True)
XMLDom.documentElement.firstChild.attributes.removeNamedItem("boarduser")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("board_ads")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("board_user")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("isgroupsetting")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("rootid")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("board_setting")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("sid")
XMLDom.documentElement.firstChild.attributes.removeNamedItem("cid")
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"boardtype","")).text=Dvbbs.boardtype
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"forum_online","")).text=MyBoardOnline.Forum_Online
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"board_useronline","")).text=MyBoardOnline.Board_UserOnline
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"board_guestonline","")).text=MyBoardOnline.Board_GuestOnline
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"postnum","")).text=CLng(Application(Dvbbs.CacheName &"_information_" & Dvbbs.boardid).documentElement.selectSingleNode("information/@postnum").text)-cpost
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"topicnum","")).text=CLng(Application(Dvbbs.CacheName &"_information_" & Dvbbs.boardid).documentElement.selectSingleNode("information/@topicnum").text)-ctopic
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"todaynum","")).text=CLng(Application(Dvbbs.CacheName &"_information_" & Dvbbs.boardid).documentElement.selectSingleNode("information/@todaynum").text)
modelist=Split(Dvbbs.Board_Setting(48),"$$")
modelistimg=Split(Dvbbs.Board_Setting(49),"$$")
For i= 0 to UBound(modelist) -1
Set Node = XMLDom.documentElement.firstChild.appendChild(XMLDom.createNode(1,"mode",""))
Node.text=modelist(i)
If i < UBound(modelistimg) Then Node.attributes.setNamedItem(XMLDom.createNode(2,"pic","")).text=modelistimg(i)
Next
XMLDOM.documentElement.attributes.setNamedItem(XMLDOM.createNode(2,"picurl","")).text=Dvbbs.Forum_PicUrl
If Dvbbs.Forum_Setting(14)="1" Or Dvbbs.Forum_Setting(15)="1" Then
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"showonline","")).text="1"
Else
XMLDom.documentElement.firstChild.attributes.setNamedItem(XMLDom.createNode(2,"showonline","")).text="0"
End If
XMLDom.documentElement.appendChild(Application(Dvbbs.CacheName &"_boardmaster").documentElement.selectSingleNode("boardmaster[@boardid='"& Dvbbs.boardid&"']").cloneNode(True))
Rem ===============传送论坛信息和设置数据到XML===============================================================
Set Node=XMLDom.documentElement.appendChild(XMLDom.createNode(1,"forum_setting",""))
Node.attributes.setNamedItem(XMLDom.createNode(2,"logincheckcode","")).text=Dvbbs.forum_setting(79)'登录验证码设置
If Dvbbs.Forum_ChanSetting(0)=1 And Dvbbs.Forum_ChanSetting(10)=1 Then Node.attributes.setNamedItem(XMLDom.createNode(2,"loginmobile","")).text=""'手机会员登录
Node.attributes.setNamedItem(XMLDom.createNode(2,"rss","")).text=Dvbbs.Forum_ChanSetting(2)'rss订阅
Node.attributes.setNamedItem(XMLDom.createNode(2,"wap","")).text=Dvbbs.Forum_ChanSetting(1)'wap访问
Node.attributes.setNamedItem(XMLDom.createNode(2,"ishot","")).text=Dvbbs.Forum_Setting(44)'热贴最少回复
Node.attributes.setNamedItem(XMLDom.createNode(2,"pagesize","")).text=Dvbbs.Board_Setting(26)'列表分页大小
Node.attributes.setNamedItem(XMLDom.createNode(2,"postalipay","")).text=Dvbbs.Board_Setting(67)
Node.attributes.setNamedItem(XMLDom.createNode(2,"dispsize","")).text=Dvbbs.Board_Setting(27) '贴子分页大小
Node.attributes.setNamedItem(XMLDom.createNode(2,"tools","")).text=Dvbbs.Forum_Setting(90)'道具中心开关
Node.attributes.setNamedItem(XMLDom.createNode(2,"newfalgpic","")).text=Dvbbs.Board_Setting(60) '显示新贴标志的设置
Node.attributes.setNamedItem(XMLDom.createNode(2,"ForumUrl","")).text=Dvbbs.Get_ScriptNameUrl()
If Dvbbs.Board_Setting(3)="1" Or Dvbbs.Board_Setting(57)="1" Then
Node.attributes.setNamedItem(XMLDom.createNode(2,"auditcount","")).text=auditcount
End If
Rem 参数传递
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"action","")).text=Request("action")
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"page","")).text=Page
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"topicmode","")).text=topicmode
If Dvbbs.Boardmaster Then
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"ismaster","")).text="1"
Else
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"ismaster","")).text="0"
End If
If Dvbbs.Board_Setting(68)="1" Then
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"cananony","")).text="1"
Else
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"cananony","")).text="0"
End If
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"canlookuser","")).text=Dvbbs.GroupSetting(1)
If Not IsObject(Application(Dvbbs.CacheName & "_smallpaper")) Then LoadBoardNews_Paper()
For Each Node in Application(Dvbbs.CacheName & "_smallpaper").documentElement.SelectNodes("smallpaper[@s_boardid='"&Dvbbs.Boardid&"']")
XMLDom.documentElement.appendChild(Node.cloneNode(True))
Next
LoadTopiclist()
Response.Write vbNewLine & "<script language=""javascript"" type=""text/javascript"">" & vbNewLine
Response.Write LoadToolsInfo & vbNewLine
Response.Write "</script>" & vbNewLine
If Cint(TopicMode) <> "0" Then
XMLDom.documentElement.attributes.setNamedItem(XMLDom.createNode(2,"modecount","")).text=Dvbbs.Execute("Select Count(*) From Dv_Topic Where Mode="&TopicMode&" and BoardID="&Dvbbs.BoardID&" And IsTop=0")(0)
End If
transform_topicList()
End Sub
Function auditcount()
Dim Rs
Set Rs=Dvbbs.Execute("select count(*) from "& Dvbbs.Nowusebbs &" where boardid=777 and locktopic="&Dvbbs.BoardID)
If IsNull(Rs(0)) Then
auditcount=0
Else
auditcount=Rs(0)
End If
Set Rs=Nothing
End Function
Sub LoadTopiclist()
If (Not Response.IsClientConnected) and Dvbbs.userid=0 Then
Session(Dvbbs.CacheName & "UserID")=empty
Response.Clear
Response.End
End If
Dim Node,nodes,topidlist,Rs,Sql,lastpost,i,PostTime,limitime
If Page=1 Then
topidlist=Dvbbs.CacheData(28,0)
If topidlist="" Then
topidlist=Application(Dvbbs.CacheName &"_information_" & Dvbbs.boardid).documentElement.selectSingleNode("information/@boardtopstr").text
ElseIf Trim(Application(Dvbbs.CacheName &"_information_" & Dvbbs.boardid).documentElement.selectSingleNode("information/@boardtopstr").text)<>"" Then
topidlist=topidlist &","& Application(Dvbbs.CacheName &"_information_" & Dvbbs.boardid).documentElement.selectSingleNode("information/@boardtopstr").text
End If
If Trim(topidlist) <>"" Then
Set Rs=Dvbbs.Execute("Select topicid,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,expression,topicmode,mode,getmoney,getmoneytype,usetools,issmstopic,hidename from dv_topic Where istop > 0 and topicid in ("& Dvbbs.Checkstr(topidlist) &") Order By istop desc, Lastposttime Desc")
If Not Rs.EOF Then
SQL=Rs.GetRows(-1)
Set topidlist=Dvbbs.ArrayToxml(sql,rs,"row","toptopic")
SQL=Empty
For Each Node in topidlist.documentElement.SelectNodes("row")
Node.selectSingleNode("@title").text=Dvbbs.ChkBadWords(Node.selectSingleNode("@title").text)
If Not Node.selectSingleNode("@topicmode").text ="1" Then
Node.selectSingleNode("@title").text=replace(Node.selectSingleNode("@title").text,"<","<")
End If
Node.selectSingleNode("@lastpost").text=Dvbbs.ChkBadWords(Node.selectSingleNode("@lastpost").text)
Node.selectSingleNode("@postusername").text=Dvbbs.ChkBadWords(Node.selectSingleNode("@postusername").text)
i=0
For each lastpost in split(Node.selectSingleNode("@lastpost").text,"$")
Node.attributes.setNamedItem(topidlist.createNode(2,"lastpost_"& i,"")).text=lastpost
i=i+1
Next
If Dvbbs.Board_Setting(60)<>"" And Dvbbs.Board_Setting(60)<>"0" Then
If Dvbbs.Board_Setting(38) = "0" Then
PostTime = Node.selectSingleNode("@lastpost_2").text
Else
PostTime = Node.selectSingleNode("@dateandtime").text
End If
If DateDiff("n",Posttime,Now)+Cint(Dvbbs.Forum_Setting(0)) < CLng(Dvbbs.Board_Setting(61)) Then
Node.attributes.setNamedItem(topidlist.createNode(2,"datedifftime","")).text=DateDiff("n",Posttime,Now)+Cint(Dvbbs.Forum_Setting(0))
End If
End If
Next
XMLDom.documentElement.appendChild(topidlist.documentElement)
End If
Set Rs=Nothing
End If
End If
If IsSqlDataBase=1 And IsBuss=1 Then
Set Cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection=conn
Cmd.CommandText="dv_list"
Cmd.CommandType=4
Cmd.Parameters.Append cmd.CreateParameter("@boardid",3)
Cmd.Parameters.Append cmd.CreateParameter("@pagenow",3)
Cmd.Parameters.Append cmd.CreateParameter("@pagesize",3)
Cmd.Parameters.Append cmd.CreateParameter("@tl",3)
Cmd.Parameters.Append cmd.CreateParameter("@topicmode",3)
Cmd.Parameters.Append cmd.CreateParameter("@totalrec",3,2)
Cmd("@boardid")=Dvbbs.BoardID
Cmd("@pagenow")=page
Cmd("@pagesize")=Cint(Dvbbs.Board_Setting(26))
Cmd("@topicmode")=TopicMode
Cmd("@tl")=0
Set Rs=Cmd.Execute
If Not Rs.EoF Then
SQL=Rs.GetRows(-1)
Set topidlist=Dvbbs.ArrayToxml(sql,rs,"row","topic")
Else
Set topidlist=Nothing
End If
Else
Set Rs = Server.CreateObject ("adodb.recordset")
If Cint(TopicMode)=0 Then
Sql="Select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode,GetMoney,GetMoneyType,UseTools,IsSmsTopic,hidename From Dv_Topic Where BoardID="&Dvbbs.BoardID&" And IsTop=0 Order By LastPostTime Desc"
Else
Sql="Select TopicID,boardid,title,postusername,postuserid,dateandtime,child,hits,votetotal,lastpost,lastposttime,istop,isvote,isbest,locktopic,Expression,TopicMode,Mode,GetMoney,GetMoneyType,UseTools,IsSmsTopic,hidename From Dv_Topic Where Mode="&TopicMode&" and BoardID="&Dvbbs.BoardID&" And IsTop=0 Order By LastPostTime Desc"
End If
Rs.Open Sql,Conn,1,1
If Page >1 Then
Rs.Move (page-1) * Clng(Dvbbs.Board_Setting(26))
End If
If Not Rs.EoF Then
SQL=Rs.GetRows(Dvbbs.Board_Setting(26))
Set topidlist=Dvbbs.ArrayToxml(sql,rs,"row","topic")
Else
Set topidlist=Nothing
End If
End If
SQL=Empty
If Not topidlist Is Nothing Then
For Each Node in topidlist.documentElement.SelectNodes("row")
Node.selectSingleNode("@title").text=Dvbbs.ChkBadWords(Node.selectSingleNode("@title").text)
If Not Node.selectSingleNode("@topicmode").text ="1" Then
Node.selectSingleNode("@title").text=replace(Node.selectSingleNode("@title").text,"<","<")
End If
Node.selectSingleNode("@postusername").text=Dvbbs.ChkBadWords(Node.selectSingleNode("@postusername").text)
i=0
For each lastpost in split(Node.selectSingleNode("@lastpost").text,"$")
Node.attributes.setNamedItem(topidlist.createNode(2,"lastpost_"& i,"")).text=lastpost
i=i+1
Next
If Dvbbs.Board_Setting(60)<>"" And Dvbbs.Board_Setting(60)<>"0" Then
If Dvbbs.Board_Setting(38) = "0" Then
PostTime = Node.selectSingleNode("@lastpost_2").text
Else
PostTime = Node.selectSingleNode("@dateandtime").text
End If
If DateDiff("n",Posttime,Now)+Cint(Dvbbs.Forum_Setting(0)) < CLng(Dvbbs.Board_Setting(61)) Then
Node.attributes.setNamedItem(topidlist.createNode(2,"datedifftime","")).text=DateDiff("n",Posttime,Now)+Cint(Dvbbs.Forum_Setting(0))
End If
End If
Next
XMLDom.documentElement.appendChild(topidlist.documentElement)
End If
Set Rs=Nothing
Dvbbs.SqlQueryNum = Dvbbs.SqlQueryNum + 1
End Sub