⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recycle.asp

📁 公司企业网站管理系统全站源码,用于企业内部对网站的管理
💻 ASP
📖 第 1 页 / 共 2 页
字号:
						Node.attributes.setNamedItem(XMLDom.createNode(2,"stats","")).text="成功。"
						Dvbbs.Execute("update " & posttable &" set boardid="&boardid&",LockTopic=0 Where RootID="& Rootid &" and boardid<> 777")
						Dvbbs.Execute("update dv_topic Set boardid="&boardid&",LockTopic=0,Child="&Child&"  Where topicid="& rootid)
					Else
						Node.attributes.setNamedItem(XMLDom.createNode(2,"topic","")).text=0
						Node.attributes.setNamedItem(XMLDom.createNode(2,"child","")).text=0
						Node.attributes.setNamedItem(XMLDom.createNode(2,"stats","")).text="失败,原因:主题不在回收站中。"
					End If
				Else
					Set Rs=Dvbbs.Execute("Select ParentID  From " & posttable &" where RootID="& Rootid &" and AnnounceID="& AnnounceID &" and boardid=444")
					If Rs.EOF Then
						Node.attributes.setNamedItem(XMLDom.createNode(2,"topic","")).text=0
						Node.attributes.setNamedItem(XMLDom.createNode(2,"child","")).text=0
						Node.attributes.setNamedItem(XMLDom.createNode(2,"stats","")).text="失败,原因:此贴不在回收站中。"
					Else
						If Rs(0)=0 Then '主题贴,还原单个主题贴。跟贴不还原。
							Child=0
							If LockTopic <> 444  Then
								boardid=LockTopic
							End If
							Dvbbs.Execute("update dv_topic Set boardid="&boardid&",LockTopic=0,Child="&Child&"  Where topicid="& rootid)
							Dvbbs.Execute("update " & posttable &" set boardid="&boardid&",LockTopic=0 Where RootID="& Rootid &" and AnnounceID="& AnnounceID)
							Node.attributes.setNamedItem(XMLDom.createNode(2,"topic","")).text=1
							Node.attributes.setNamedItem(XMLDom.createNode(2,"child","")).text=Child
							Node.attributes.setNamedItem(XMLDom.createNode(2,"boardid","")).text=boardid
							Node.attributes.setNamedItem(XMLDom.createNode(2,"stats","")).text="成功。"
						Else
							If LockTopic <> 444  Then
								boardid=LockTopic
								Dvbbs.Execute("update " & posttable &" set boardid="&boardid&",LockTopic=0 Where RootID="& Rootid &" and AnnounceID="& AnnounceID)
								Dvbbs.Execute("update dv_topic Set boardid="&boardid&",LockTopic=0,Child=Child+1  Where topicid="& rootid)
								Node.attributes.setNamedItem(XMLDom.createNode(2,"topic","")).text=0
								Node.attributes.setNamedItem(XMLDom.createNode(2,"child","")).text=1
								Node.attributes.setNamedItem(XMLDom.createNode(2,"boardid","")).text=boardid
								Node.attributes.setNamedItem(XMLDom.createNode(2,"stats","")).text="成功。"
							Else
								Node.attributes.setNamedItem(XMLDom.createNode(2,"topic","")).text=0
								Node.attributes.setNamedItem(XMLDom.createNode(2,"child","")).text=0
								Node.attributes.setNamedItem(XMLDom.createNode(2,"stats","")).text="失败,原因:主题贴还在回收站中,请先还原主题。"
							End If
						End If
					End If
				End If
			End If
	Next
	Dim allpost,alltopic
	allpost=0
	alltopic=0
	'统计一下更新情况
	For each boardid in Application(Dvbbs.CacheName&"_boardlist").documentElement.selectNodes("board/@boardid")
		Set Node =XMLDom.documentElement.selectNodes("result[@boardid="& boardid.text &"]")
		If Node.length > 0 Then
			topic=0
			Child=0
			For Each TmpID in node
				topic=topic+CLng(tmpid.selectSingleNode("@topic").text)
				Child=Child+CLng(tmpid.selectSingleNode("@child").text)
			Next
			If topic+Child >0 Then
				alltopic=alltopic+topic
				allpost=allpost+topic+Child
				UpDate_BoardInfoAndCache BoardID.text,topic,Child
			End If
		End If
	Next
	If allpost >0 Or alltopic >0 Then
		Dvbbs.Execute("update dv_setup Set forum_postNum=forum_postNum+"& allpost &",forum_TopicNum=forum_topicNum +"& alltopic )
		Dvbbs.loadSetup
	End If
	Tolog("还原主题:"&alltopic&"个,贴子"& allpost &"条")
End Sub
Sub Main()
	bid=Request("bid")
	If Not IsNumeric(BID) Then bid="0"
	If bid="" Then bid="0"
	tableid=Request("tableid")
	If Not IsNumeric(tableid) Then tableid="0"
	If Trim(tableid)="" Then tableid="0"
	Dim i,SQL,node,keyword,tmpsql,Rs,SQL1,Pagesize,Page,pagecount
	keyword=Trim(Request("keyword"))
	posttable="dv_topic"
	If tableid <> "0" Then
		For i= 0 to UBound(TableList,2)
			If CStr(TableList(0,i))=tableid Then
				posttable=TableList(1,i)
				Exit For
			End If
		Next
	End If
	If posttable="dv_topic" Then tableid="0"
	Page=Request("Page")
	If Not IsNumeric(Page) Then Page="1"
	If Page="" Then Page="1"
	Page=CLng(Page)
	'传送参数到xml
	Pagesize=30'手工设置每页最大显示30条
	Set Node = XMLDom.documentElement.appendChild(XMLDom.createNode(1,"param",""))
	Node.attributes.setNamedItem(XMLDom.createNode(2,"bid","")).text=bid
	Node.attributes.setNamedItem(XMLDom.createNode(2,"tableid","")).text=tableid
	Node.attributes.setNamedItem(XMLDom.createNode(2,"keyword","")).text=keyword
	Node.attributes.setNamedItem(XMLDom.createNode(2,"pagesize","")).text=Pagesize
	Node.attributes.setNamedItem(XMLDom.createNode(2,"posttable","")).text=posttable
	Node.attributes.setNamedItem(XMLDom.createNode(2,"action","")).text=Request("action")
	If session("flag")<>"" Then
		Node.attributes.setNamedItem(XMLDom.createNode(2,"admin","")).text=1
	End If
	'根据页面参数产生查询代码
	keyword=Dvbbs.Checkstr(keyword)
	SQl ="Select "
	SQl1 ="Select Count(*) as length From "& posttable
	If tableid="0" Then
		SQL= SQL &"topicid as id,Title as topic,LockTopic as bid,PostUsername as username,PostUserid as userid,PostTable,DateAndTime From "& posttable
		tmpsql="and (title like '%"&keyword&"%' or PostUsername='"&keyword&"') "
	Else
		SQL= SQL &"rootid as id,topic,body,LockTopic as bid,username,PostUserid as userid,AnnounceID as replyID,DateAndTime,ParentID From "& posttable
		tmpsql="and (topic like '%"&keyword&"%' or Username='"&keyword&"') "
	End If
	SQL= SQL &" Where Boardid=444 "
	SQL1= SQL1 &" Where Boardid=444 "
	If Bid <> "0" Then
		SQL= SQL &"and LockTopic="&bid&" "
		SQL1= SQL1 &"and LockTopic="&bid&" "
	End If
	If keyword<>"" Then
		SQL= SQL & tmpsql
		SQL1= SQL1 & tmpsql
	End If
	If tableid="0" Then
		SQL= SQL &" order by topicid desc"
	Else
		SQL= SQL &" order by AnnounceID desc"
	End If
	Set Rs=Dvbbs.Execute(SQL1)
	Node.attributes.setNamedItem(XMLDom.createNode(2,"count","")).text =Rs(0)
	'计算一下当前Page参数是否合法。如果超出范围,强制为最后一页
	If Rs(0) mod Pagesize =0 then
			PageCount= Rs(0) \ Pagesize
	Else
			PageCount= Rs(0) \ Pagesize+1
	End If
	If Page > PageCount Then Page=PageCount
	Node.attributes.setNamedItem(XMLDom.createNode(2,"page","")).text=Page
	If Rs(0) <> 0  and Not IsNull(Rs(0))Then
		Set Rs=Dvbbs.Execute(SQL)
		If Not page=1 Then 	Rs.Move(pagesize*(page-1))
		SQL=RS.GetRows(Pagesize)
		Set Node=Dvbbs.ArrayToxml(SQL,rs,"row","datarows")
		XMLDom.documentElement.appendChild(node.documentElement)
	End If
	XMLDom.documentElement.appendChild(Application(Dvbbs.CacheName&"_boardlist").documentElement.cloneNode(True))
End Sub
Sub View()
	Dim Node,id,replyid,Rs,posttable,SQL
	Set Node = XMLDom.documentElement.appendChild(XMLDom.createNode(1,"param",""))
	Node.attributes.setNamedItem(XMLDom.createNode(2,"action","")).text=Request("action")
	If Dvbbs.Master Then 
		Node.attributes.setNamedItem(XMLDom.createNode(2,"master","")).text=1
	End If
	id=Request("id")
	replyid=Request("replyid")
	If Not IsNumeric(replyid) Or replyid="" Then replyid=0
	If Not IsNumeric(id) Or id="" Then
		Response.redirect "showerr.asp?ErrCodes=<li>请指定所需参数。&action=OtherErr"
	End If
	Id =CLng(id)
	Set rs=Dvbbs.Execute("Select posttable,boardid From Dv_topic Where topicid="&Id)
	If Rs.EOF Then
			Response.redirect "showerr.asp?ErrCodes=<li>记录不存在!&action=OtherErr"
	Else
		posttable=Rs(0)
		Node.attributes.setNamedItem(XMLDom.createNode(2,"boardid","")).text=Rs(1)
		If replyid=0 Then
			SQL="Select * From "&posttable & " where rootid="&ID&" and ParentID=0 and Boardid=444"
		Else
			SQL="Select * From "&posttable & " where rootid="&ID&" and AnnounceID="&replyid&"and Boardid=444"
		End If
		Set Rs=Dvbbs.Execute(SQL)
		If Rs.EOF Then
			Response.redirect "showerr.asp?ErrCodes=<li>找不到匹配记录!&action=OtherErr"
		Else
			XMLDom.documentElement.appendChild(Dvbbs.RecordsetToxml(rs,"row","").documentElement.firstChild)
		End If
	End If
End Sub

Sub ShowHTML()
	Dim xslt,proc,XMLStyle
	Set XMLStyle=Server.CreateObject("Msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	XMLStyle.loadxml template.html(1)
	Set XSLT=Server.CreateObject("Msxml2.XSLTemplate" & MsxmlVersion)
	XSLT.stylesheet=XMLStyle
	Set proc = XSLT.createProcessor()
	proc.input = XMLDom
  proc.transform()
  Response.Write  proc.output
	Set XMLDOM=Nothing
	Set XSLt=Nothing
	Set proc=Nothing	
End Sub
Sub UpDate_BoardInfoAndCache(BoardID,topic,Child)
		Dim UpdateBoardID,parentstr,SQL
		parentstr =Application(Dvbbs.CacheName&"_boardlist").documentElement.selectSingleNode("board[@boardid='"&BoardID&"']/@parentstr").text
		If parentstr <> "0" Then 
			UpdateBoardID= parentstr & "," & BoardID	
		Else
			UpdateBoardID=BoardID
		End If
		Dim updateboard,i
		SQL="update Dv_board set PostNum=PostNum+"&topic+Child&",TopicNum=TopicNum+"&topic&" where boardid in ("&UpdateBoardID&")"
		Dvbbs.Execute(sql)
		UpdateBoardID=Split(UpdateBoardID,",")
		For Each updateboard in UpdateBoardID
			If IsObject(Application(Dvbbs.CacheName &"_information_" & updateboard)) Then
				Application(Dvbbs.CacheName &"_information_" & updateboard).documentElement.selectSingleNode("information/@postnum").text=CLng(Application(Dvbbs.CacheName &"_information_" & updateboard).documentElement.selectSingleNode("information/@postnum").text)+topic+Child
				Application(Dvbbs.CacheName &"_information_" & updateboard).documentElement.selectSingleNode("information/@topicnum").text=CLng(Application(Dvbbs.CacheName &"_information_" & updateboard).documentElement.selectSingleNode("information/@topicnum").text)+topic
			End If
		Next
	End Sub
	Sub Tolog(Info)
		Dvbbs.Execute("Insert Into Dv_Log (l_AnnounceID,l_BoardID,l_touser,l_username,l_content,l_ip,l_type) values (0,0,'回收站','" & Dvbbs.MemberName & "','" & Dvbbs.CheckStr(Info) & "','" & Dvbbs.userTrueIP & "',0)")
	End Sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -