📄 cls.asp
字号:
if int(DateDiff("h",PostTime,Now()))<=24 then NewHtml=" <span class=blue>[新]</span> "
if Replies=>Cache("PostsPerPage") then
MaxPostPage=fix(Replies/Cache("PostsPerPage"))+1 '共多少页
ShowPostPage="<span class='small'> <img alt='' src=Images/multiPage.gif /> "
if MaxPostPage>11 Then MaxPostPage=10
For PostPage = 1 To MaxPostPage
ShowPostPage=""&ShowPostPage&"<a href=Threads.asp?Tid="&id&"&PageIndex="&PostPage&">"&PostPage&"</a> "
Next
ShowPostPage=""&ShowPostPage&"</span>"
else
ShowPostPage=""
end if
if IsTop=0 and TopEnd=0 then
Response.write "<div class=""tc b"" style=""height:10px;""></div>"
TopEnd=1
end if
%>
<div class="tc b cb">
<div class="licon"><%=IconImage%></div>
<div class="ltitle"><%
if Icon=11 Then Response.write "<img src='Images/money.gif' alt='悬赏金币 "&PayTopicMoney&" 个' /> "
if IsTop>0 then Response.write "<img alt='' src=Images/f_top"&IsTop&".gif />"
Response.write CategoryHtml
if icon>0 and icon<11 Then Response.write "<img alt="""" src=""Images/brow/"&icon&".gif"" /> "
%><a href="Threads.asp?Tid=<%=id%>"><%=Topic%></a> <%=NewHtml&HotHtml&StatusHtml&ShowPostPage%><%if IsGood=1 then Response.write "<img alt='精华帖子' src=Images/f_good.gif />"%></div>
<div class="luser"><a href="User.asp?Name=<%=UserName%>"><%=UserName%></a></div>
<div class="lnum"><%=Views%></div>
<div class="lnum"><%=Replies%></div>
<div class="ltopic"><a href="User.asp?Name=<%=lastname%>"><%=lastname%></a>┇<%=lasttime%></div>
</div><%
end sub
sub UpStat(addTopicNum,addPostNum,addUserNum)
XMLDOM.loadxml(Cache("Stat.xml"))
Set objRoot=XMLDOM.documentElement
if objRoot.SelectSingleNode("SysDate").text<>""&date()&"" Then
objRoot.SelectSingleNode("SysDate").text=""&date()&""
Conn.Execute("update [WxForums] set ForumToday=0")
objRoot.SelectSingleNode("daysTopics").text=0
objRoot.SelectSingleNode("daysPosts").text=0
CacheAdd "SysDate",date()
end if
if addTopicNum>0 or addPostNum>0 then
objRoot.SelectSingleNode("TotalTopics").text=int(objRoot.SelectSingleNode("TotalTopics").text)+addTopicNum
objRoot.SelectSingleNode("TotalPosts").text=int(objRoot.SelectSingleNode("TotalPosts").text)+addPostNum
objRoot.SelectSingleNode("daysTopics").text=int(objRoot.SelectSingleNode("daysTopics").text)+addTopicNum
objRoot.SelectSingleNode("daysPosts").text=int(objRoot.SelectSingleNode("daysPosts").text)+addPostNum
end if
if addUserNum>0 Then
objRoot.SelectSingleNode("TotalUsers").text=int(objRoot.SelectSingleNode("TotalUsers").text)+addUserNum
NewUsers=Conn.Execute("select top 1 UserName from [WxUsers] order By ID Desc")(0)
objRoot.SelectSingleNode("NewUsers").text=NewUsers
end if
CacheAdd "NewUsers",objRoot.SelectSingleNode("NewUsers").text
CacheAdd "TotalTopics",objRoot.SelectSingleNode("TotalTopics").text
CacheAdd "TotalPosts",objRoot.SelectSingleNode("TotalPosts").text
CacheAdd "TotalUsers",objRoot.SelectSingleNode("TotalUsers").text
CacheAdd "BestOnline",objRoot.SelectSingleNode("BestOnline").text
CacheAdd "BestOnlineTime",objRoot.SelectSingleNode("BestOnlineTime").text
if Cache("TotalTopics")=0 then CacheAdd "TotalPosts",0
CacheAdd "daysTopics",objRoot.SelectSingleNode("daysTopics").text
CacheAdd "daysPosts",objRoot.SelectSingleNode("daysPosts").text
XMLDOM.Save Server.MapPath(BBSPath&XmlPath&"Stat.xml")
CacheAdd "Stat.xml",XMLDOM.documentElement.xml
Set objRoot=Nothing
end sub
sub CreateCache()
Application.Contents.RemoveAll
XMLDOM.load Server.MapPath(BBSPath&XmlPath&"Kernel.xml")
Set objRoot = XMLDOM.documentElement
for i=0 to objRoot.childNodes.length-1
if IsNumeric(objRoot.childNodes(i).Text) then
CacheAdd objRoot.childNodes(i).nodeName,cDbl(objRoot.childNodes(i).Text)
Else
CacheAdd objRoot.childNodes(i).nodeName,objRoot.childNodes(i).Text
end if
next
Set objRoot = Nothing
CacheAdd "DisplayApplyAdmin",Not (Cache("AdminName")=Empty)
Set Rs=Conn.Execute("select ID,Name from [WxRoles] order by ID")
Do While Not Rs.Eof
CacheAdd "Role"&Rs(0),Rs(1)
Rs.MoveNext
Loop
Rs.Close
Select case Cache("DisplayLink")
case 0
CacheAdd "LinkHtml",""
case 1,2
Set Rs=Conn.Execute("select Url,Name,Intro,Logo from [WxLink] where Review=1")
Do While Not Rs.Eof
Url=Rs(0)
Name=Rs(1)
Logo=Rs(3)
Intro=Rs(2)
LinkHtmlSEO=LinkHtmlSEO&"<a href="&Url&" target=_blank>"&Name&"</a> "
if Logo<>Empty And Logo<>"http://" then
LinkHtmlLogo=LinkHtmlLogo&"<a title="&chr(34)&Name&":"&Intro&chr(34)&" href='"&Url&"' target=_blank><img src="&Logo&" width=88 height=31 /></a> "
Else
LinkHtmlWord=LinkHtmlWord&"<a title='"&Intro&"' href='"&Url&"' target=_blank>"&Name&"</a> "
end if
Rs.MoveNext
Loop
Rs.Close
if Cache("DisplayLink")=1 Then
CacheAdd "LinkHtml",LinkHtmlSEO
Else
CacheAdd "LinkHtml",Replace(Cache("LinkHtml"),"$link",LinkHtmlWord&"<br />"&LinkHtmlLogo)
end if
end Select
XMLDOM.Load Server.MapPath(BBSPath&XmlPath&"Stat.xml")
CacheAdd "Stat.xml",XMLDOM.documentElement.xml
UpStat 0,0,0
XMLDOM.Load Server.MapPath(BBSPath&XmlPath&"Forum.xml")
CacheAdd "forum-0.xml",XMLDOM.documentElement.xml
Set Rs=Conn.Execute("select ID from [WxForums] order By ID Desc")
Do While Not Rs.Eof
ForumCache(Rs("ID"))
Rs.MoveNext
Loop
Rs.Close
CacheAdd "System",Now()
end sub
sub ForumCache(ForumID)
Rs1.Open "select * from [WxForums] where id="&ForumID,Conn,1
ForumXmlC=Cache("Forum-0.xml")
ForumTemplate=Cache("ForumTemplate")
ForumName=Rs1("ForumName")
ForumToday=Rs1("ForumToday")
LastTopic=""
LastName=""
ForumIcon=""
ForumIntro=""
Moderated=""
if Rs1("Moderated")<>"" Then Moderated=Rs1("Moderated")
if Rs1("ForumIcon")<>"" Then ForumIcon=Rs1("ForumIcon")
if Rs1("LastName")<>"" Then LastName=Rs1("LastName")
if Rs1("LastTopic")<>"" Then LastTopic=Rs1("LastTopic")
if Rs1("ForumIntro")<>"" Then ForumIntro=YBBEncode(Rs1("ForumIntro"))
TolC=Rs1("Categories")
if TolC<>Empty Then
TolCHtml="(分类:"
filtrate=split(TolC,"|")
for i = 0 to UBound(filtrate)
TolCHtml=TolCHtml&"[<a href='Forums.asp?Fid="&ForumID&"&Category="&filtrate(i)&"'>"&filtrate(i)&"</a>] "
next
TolCHtml=TolCHtml&")"
Else
TolC=""
TolCHtml=""
end if
ForumTemplate=Replace(ForumTemplate,"$id",ForumID)
ForumTemplate=Replace(ForumTemplate,"$ForumName",ForumName)
ForumTemplate=Replace(ForumTemplate,"$ForumIntro",ForumIntro)
ModeratedList=""
if Moderated<>Empty then
filtrate=split(Moderated,"|")
for i = 0 to UBound(filtrate)
ModeratedList=ModeratedList&"<a href=User.asp?Name="&filtrate(i)&">"&filtrate(i)&"</a> "
next
end if
ForumTemplate=Replace(ForumTemplate,"$ModeratedList",ModeratedList)
if ForumToday>0 and ForumIcon="" then
ForumTemplate=Replace(ForumTemplate,"$ForumIconHtml","<script type=""text/javascript"">ShowForumImg(1)</script>")
ForumTemplate=Replace(ForumTemplate,"$ForumTodayHtml","<span class=""or"">("&ForumToday&")</span>")
ElseIf ForumIcon<>"" Then
ForumTemplate=Replace(ForumTemplate,"$ForumIconHtml","<img alt='' src="&ForumIcon&" />")
ForumTemplate=Replace(ForumTemplate,"$ForumTodayHtml","")
Else
ForumTemplate=Replace(ForumTemplate,"$ForumIconHtml","<script type=""text/javascript"">ShowForumImg(0)</script>")
ForumTemplate=Replace(ForumTemplate,"$ForumTodayHtml","")
end if
ForumTemplate=Replace(ForumTemplate,"$LastTopic",LastTopic)
ForumTemplate=Replace(ForumTemplate,"$LastName",LastName)
ForumXmlC=Replace(ForumXmlC,"$ParentID",Rs1("ParentID"))
ForumXmlC=Replace(ForumXmlC,"$SortNum",Rs1("SortNum"))
ForumXmlC=Replace(ForumXmlC,"$ForumName",ForumName)
ForumXmlC=Replace(ForumXmlC,"$Moderated",Moderated)
ForumXmlC=Replace(ForumXmlC,"$Categories",TolC)
ForumXmlC=Replace(ForumXmlC,"$ForumIntro",ForumIntro)
ForumXmlC=Replace(ForumXmlC,"$ForumToday",ForumToday)
ForumThreads=Rs1("ForumThreads")
ForumXmlC=Replace(ForumXmlC,"$ForumThreads",ForumThreads)
ForumTemplate=Replace(ForumTemplate,"$ForumThreads",ForumThreads)
ForumPosts=Rs1("ForumPosts")
ForumTemplate=Replace(ForumTemplate,"$ForumPosts",ForumPosts)
ForumXmlC=Replace(ForumXmlC,"$ForumPosts",ForumPosts)
ForumXmlC=Replace(ForumXmlC,"$ForumIcon",ForumIcon)
ForumXmlC=Replace(ForumXmlC,"$LastTopic",LastTopic)
ForumXmlC=Replace(ForumXmlC,"$LastName",LastName)
LastTime=Rs1("LastTime")
ForumTemplate=Replace(ForumTemplate,"$LastTime",LastTime)
ForumXmlC=Replace(ForumXmlC,"$LastTime",LastTime)
ForumXmlC=Replace(ForumXmlC,"$ForumRules",Rs1("ForumRules"))
ForumXmlC=Replace(ForumXmlC,"$IsModerated",Rs1("IsModerated"))
ForumXmlC=Replace(ForumXmlC,"$BoardStyle",Rs1("BoardStyle"))
ForumXmlC=Replace(ForumXmlC,"$CategorysHtml",Replace(Cache("boardtb"),"$category$",TolCHtml))
ForumXmlC=Replace(ForumXmlC,"$ForumHtml",ForumTemplate)
CacheAdd "Forum-"&Rs1("ID")&".xml",ForumXmlC
Rs1.close
end sub
Function GetForumData(ForumID)
XMLData=Cache("forum-"&ForumID&".xml")
if ForumID=0 or Len(XMLData)<16 then Error 5,"<li>该版块不存在</li>"
XMLDOM.Loadxml XMLData
Set XMLRoot=XMLDOM.documentElement
GetForumData=Array(int(XMLRoot.SelectSingleNode("ParentID").text),int(XMLRoot.SelectSingleNode("SortNum").text),XMLRoot.SelectSingleNode("ForumName").text,XMLRoot.SelectSingleNode("Moderated").text,XMLRoot.SelectSingleNode("Categories").text,YbbEncode(Replace(XMLRoot.SelectSingleNode("ForumIntro").text,"<br />",chr(10))),int(XMLRoot.SelectSingleNode("ForumToday").text),int(XMLRoot.SelectSingleNode("ForumThreads").text),int(XMLRoot.SelectSingleNode("ForumPosts").text),XMLRoot.SelectSingleNode("ForumIcon").text,XMLRoot.SelectSingleNode("LastTopic").text,XMLRoot.SelectSingleNode("LastName").text,YbbEncode(Replace(XMLRoot.SelectSingleNode("ForumRules").text,"<br />",chr(10))),int(XMLRoot.SelectSingleNode("IsModerated").text),int(XMLRoot.SelectSingleNode("BoardStyle").text),XMLRoot.SelectSingleNode("LastTime").text,XMLRoot.SelectSingleNode("CategorysHtml").text,XMLRoot.SelectSingleNode("ForumHtml").text)
'数组排序查询:ParentID=0'SortNum=1'ForumName=2'Moderated=3'Categories=4'ForumIntro=5'ForumToday=6'ForumThreads=7'ForumPosts=8'ForumIcon=9'LastTopic=10'LastName=11'ForumRules=12'IsModerated=13'BoardStyle=14'LastTime=15'CategorysHtml=16'ForumHtml=17
Set XMLRoot=Nothing
end Function
sub WxEditor(style,name,width,height)
if style<>"mini" Then style="full"
%><script src='Inc/Editor.js' type='text/javascript'></script>
<script type='text/javascript'>
var EditorType = "<%=style%>";
var editor = new WxEditor('editor');
editor.hiddenName = "<%=name%>";
editor.editorwidth = "<%=width%>";
editor.editorheight = "<%=height%>";
editor.show();
</script>
<%
end sub
sub WxLine
if IsUser then SqlLineUser=" and UserName='"&CookieUserName&"'"
sql="select * from [WxUsersOnline] where ip='"&Request.ServerVariables("REMOTE_ADDR")&"' "&SqlLineUser&" or sessionid='"&session.sessionid&"' "
Rs.Open sql,Conn,1,3
if Rs.Eof then Rs.addNew
Rs("act")=""&act&""
Rs("acturl")=""&Request.ServerVariables("script_name")&"?"&Request.ServerVariables("Query_String")&""
Rs("ForumID")=ForumID
Rs("ForumName")=""&ForumName&""
Rs("lasttime")=now()
if Cookies("Eremite")<>Empty then Rs("Eremite")=ChkNumeric(Cookies("Eremite"))
Rs("ip")=Request.ServerVariables("REMOTE_ADDR")
Rs("UserName")=CookieUserName
Rs("sessionid")=session.sessionid
Rs.update
Rs.close
Conn.Execute("delete from [WxUsersOnline] where DateDiff("&SqlChar&"n"&SqlChar&",lasttime,"&SqlNowString&")>"&Cache("UserOnlineTime")&" ")
Onlinemany=Conn.Execute("select count(sessionid)from [WxUsersOnline]")(0)
regOnline=Conn.Execute("select count(sessionid)from [WxUsersOnline] where UserName<>''")(0)
if Onlinemany>int(Cache("BestOnline")) then
Set objXML=Server.CreateObject("Microsoft.XMLDOM")
objXML.loadxml(Cache("Stat.xml"))
objXML.documentElement.SelectSingleNode("//WxBBS/BestOnline").text=Onlinemany
objXML.documentElement.SelectSingleNode("//WxBBS/BestOnlineTime").text=Now()
objXML.Save Server.MapPath(BBSPath&XmlPath&"Stat.xml")
CacheAdd "Stat.xml",objXML.documentElement.xml
set objXML=Nothing
CacheAdd "BestOnline",Onlinemany
CacheAdd "BestOnlineTime",Now()
end if
end sub
sub UpForumData(ForumID)
AllThreads=Conn.Execute("select count(ID) from [WxThreads] where IsDel=0 and ForumID="&ForumID&"")(0)
if AllThreads>0 then
AllTopic=Conn.Execute("select sum(Replies) from [WxThreads] where IsDel=0 and ForumID="&ForumID&"")(0)
else
AllTopic=0
end if
Set Rs2=Conn.Execute("select * from [WxThreads] where IsDel=0 and ForumID="&ForumID&" Order by LastTime Desc")
if Not Rs2.Eof Then Conn.Execute("update [WxForums] Set LastTopic='<a href=Threads.asp?Tid="&Rs2("ID")&">"&Left(ReplaceText(Rs2("Topic"),"<[^>]*>",""),11)&"</a>',LastName='"&Rs2("LastName")&"',LastTime="&SqlNowString&" Where id="&ForumID&"")
Rs2.Close
Set Rs2=Nothing
Conn.Execute("update [WxForums] set ForumThreads="&AllThreads&",ForumPosts="&AllThreads+AllTopic&" where id="&ForumID&"")
end sub
startime=timer()%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -