<%@ CODEPAGE=65001 %> <% '/////////////////////////////////////////////////////////////////////////////// '// Z-Blog '// 作 者: 朱煊(zx.asd) & Sipo '// 版权所有: RainbowSoft Studio '// 技术支持: rainbowsoft@163.com '// 程序名称: '// 程序版本: '// 单元名称: guestbook.asp '// 开始时间: 2007-01-03 '// 最后修改: '// 备 注: GuestBook '/////////////////////////////////////////////////////////////////////////////// %> <% Option Explicit %> <% On Error Resume Next %> <% Response.Charset="UTF-8" %> <% Response.Buffer=True %> <% '********************************************************* ' 目的: 定义TGuestBook类 ' 输入: 无 ' 返回: 无 '********************************************************* Class TGuestBook Public Template_Article_Single Public Template_Article_Comment Public Template_Article_Commentpost Public Template_PageBar Public Template_Article_Commentpost_Verify Public html Private Ftemplate Public Property Let template(strFileName) Application.Lock Ftemplate=Application(ZC_BLOG_CLSID & "TEMPLATE_" & strFileName) Application.UnLock End Property Public Property Get template template = Ftemplate End Property Public Function Export(intPage) Dim i,j,strC_Count,objComment,strC If IsNumeric(intPage)=False Then intPage=1 Call CheckParameter(intPage,"int",1) Template_Article_Single=Application(ZC_BLOG_CLSID & "TEMPLATE_B_ARTICLE-GUESTBOOK") If (Template_Article_Single="") Then Template_Article_Single=Application(ZC_BLOG_CLSID & "TEMPLATE_B_ARTICLE-SINGLE") End If Template_Article_Commentpost=Application(ZC_BLOG_CLSID & "TEMPLATE_B_ARTICLE_COMMENTPOST") If ZC_COMMENT_VERIFY_ENABLE=True Then Template_Article_Commentpost_Verify=Application(ZC_BLOG_CLSID & "TEMPLATE_B_ARTICLE_COMMENTPOST-VERIFY") End If Dim objRS Set objRS=Server.CreateObject("ADODB.Recordset") objRS.CursorType = adOpenKeyset objRS.LockType = adLockReadOnly objRS.ActiveConnection=objConn objRS.Source="" objRS.Open("SELECT COUNT([comm_ID])AS allComment FROM [blog_Comment] WHERE [blog_Comment].[log_ID]=0") If (Not objRS.bof) And (Not objRS.eof) Then strC_Count=objRS("allComment") End If objRS.Close Set objRS=Nothing Set objRS=Server.CreateObject("ADODB.Recordset") objRS.CursorType = adOpenKeyset objRS.LockType = adLockReadOnly objRS.ActiveConnection=objConn objRS.Source="SELECT [comm_ID],[log_ID],[comm_AuthorID],[comm_Author],[comm_Content],[comm_Email],[comm_HomePage],[comm_PostTime],[comm_IP],[comm_Agent] FROM [blog_Comment] WHERE [blog_Comment].[log_ID]=0 ORDER BY [comm_PostTime] DESC" objRS.Open() objRS.PageSize=ZC_MSG_COUNT If objRS.PageCount>0 Then objRS.AbsolutePage = intPage If (not objRS.bof) And (not objRS.eof) Then For i=1 To objRS.PageSize Set objComment=New TComment objComment.LoadInfoByArray(Array(objRS("comm_ID"),objRS("log_ID"),objRS("comm_AuthorID"),objRS("comm_Author"),objRS("comm_Content"),objRS("comm_Email"),objRS("comm_HomePage"),objRS("comm_PostTime"),"","")) Application.Lock strC=Application(ZC_BLOG_CLSID & "TEMPLATE_B_ARTICLE_COMMENT") Application.UnLock objComment.Count=strC_Count-i-(ZC_MSG_COUNT * (intPage-1))+1 strC=objComment.MakeTemplate(strC) If ZC_COMMENT_REVERSE_ORDER_EXPORT=True Then Template_Article_Comment=Template_Article_Comment & strC Else Template_Article_Comment=strC & Template_Article_Comment End If Set objComment=Nothing objRS.MoveNext If objRS.eof Then Exit For Next End If j=objRS.PageCount If j>0 Then Dim a,b,s,t,intNowPage,strPageBar s=ZC_BLOG_HOST & "guestbook.asp" t="" intNowPage=intPage Application.Lock strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR") Application.UnLock strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s) strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",ZC_MSG285) Template_PageBar=Template_PageBar & strPageBar If j>ZC_PAGEBAR_COUNT Then a=intNowPage b=intNowPage+ZC_PAGEBAR_COUNT If a>ZC_PAGEBAR_COUNT Then a=a-1:b=b-1 If b>j Then b=j:a=j-ZC_PAGEBAR_COUNT Else a=1:b=j End If For i=a to b s=ZC_BLOG_HOST & "guestbook.asp?"& t &"page="& i If i=1 Then s=ZC_BLOG_HOST & "guestbook.asp" End If Application.Lock strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR") Application.UnLock If i=intNowPage then Template_PageBar=Template_PageBar & "" & i & "" Else strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s) strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",i) Template_PageBar=Template_PageBar & strPageBar End If Next s=ZC_BLOG_HOST & "guestbook.asp?"& t &"page="& j If j=1 Then s=ZC_BLOG_HOST & "guestbook.asp" End If Application.Lock strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR") Application.UnLock strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s) strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",ZC_MSG286) Template_PageBar=Template_PageBar & strPageBar End If objRS.Close Set objRS=Nothing Template_Article_Comment=Template_Article_Comment & "
" Template_Article_Commentpost=Replace(Template_Article_Commentpost,"<#template:article_commentpost-verify#>",Template_Article_Commentpost_Verify) Template_Article_Single=Replace(Template_Article_Single,"<#template:article_trackback#>","") Template_Article_Single=Replace(Template_Article_Single,"<#template:article_comment#>",Template_Article_Comment) Template_Article_Single=Replace(Template_Article_Single,"<#template:article_commentpost#>",Template_Article_Commentpost) Template_Article_Single=Replace(Template_Article_Single,"<#template:article_tag#>","") Template_Article_Single=Replace(Template_Article_Single,"<#template:article_navbar_l#>","") Template_Article_Single=Replace(Template_Article_Single,"<#template:article_navbar_r#>","") Template_Article_Single=Replace(Template_Article_Single,"<#template:article_mutuality#>","") Template_Article_Single=Replace(Template_Article_Single,"<#template:pagebar#>",Template_PageBar) Dim aryTemplateTagsName(49) Dim aryTemplateTagsValue(49) j=49 Dim PostTime PostTime=GetTime(Now()) aryTemplateTagsName(1)="<#article/id#>" aryTemplateTagsValue(1)=0 aryTemplateTagsName(2)="<#article/level#>" aryTemplateTagsValue(2)=4 aryTemplateTagsName(3)="<#article/title#>" aryTemplateTagsValue(3)=ZC_MSG275 aryTemplateTagsName(4)="<#article/intro#>" aryTemplateTagsValue(4)=ZC_GUESTBOOK_CONTENT aryTemplateTagsName(5)="<#article/content#>" aryTemplateTagsValue(5)=ZC_GUESTBOOK_CONTENT & "
" & "
" & ZC_MSG042 & ":" & Template_PageBar & "
" aryTemplateTagsName(6)="<#article/posttime#>" aryTemplateTagsValue(6)=PostTime aryTemplateTagsName(7)="<#article/commnums#>" aryTemplateTagsValue(7)=strC_Count aryTemplateTagsName(8)="<#article/viewnums#>" aryTemplateTagsValue(8)=0 aryTemplateTagsName(9)="<#article/trackbacknums#>" aryTemplateTagsValue(9)=0 aryTemplateTagsName(10)="<#article/trackback_url#>" aryTemplateTagsValue(10)="" aryTemplateTagsName(11)="<#article/url#>" aryTemplateTagsValue(11)=ZC_BLOG_HOST & "guestbook.asp" aryTemplateTagsName(12)="<#article/category/id#>" aryTemplateTagsValue(12)=0 aryTemplateTagsName(13)="<#article/category/name#>" aryTemplateTagsValue(13)=ZC_BLOG_NAME aryTemplateTagsName(15)="<#article/category/order#>" aryTemplateTagsValue(15)=0 aryTemplateTagsName(16)="<#article/category/count#>" aryTemplateTagsValue(16)=0 aryTemplateTagsName(17)="<#article/category/url#>" aryTemplateTagsValue(17)="" aryTemplateTagsName(18)="<#article/author/id#>" aryTemplateTagsValue(18)=0 aryTemplateTagsName(19)="<#article/author/name#>" aryTemplateTagsValue(19)=ZC_BLOG_MASTER aryTemplateTagsName(20)="<#article/author/level#>" aryTemplateTagsValue(20)=4 aryTemplateTagsName(21)="<#article/author/email#>" aryTemplateTagsValue(21)="" aryTemplateTagsName(22)="<#article/author/homepage#>" aryTemplateTagsValue(22)="" aryTemplateTagsName(23)="<#article/author/count#>" aryTemplateTagsValue(23)=0 aryTemplateTagsName(24)="<#article/author/url#>" aryTemplateTagsValue(24)="" aryTemplateTagsName(25)="<#article/posttime/longdate#>" aryTemplateTagsValue(25)=FormatDateTime(PostTime,vbLongDate) aryTemplateTagsName(26)="<#article/posttime/shortdate#>" aryTemplateTagsValue(26)=FormatDateTime(PostTime,vbShortDate) aryTemplateTagsName(27)="<#article/posttime/longtime#>" aryTemplateTagsValue(27)=FormatDateTime(PostTime,vbLongTime) aryTemplateTagsName(28)="<#article/posttime/shorttime#>" aryTemplateTagsValue(28)=FormatDateTime(PostTime,vbShortTime) aryTemplateTagsName(29)="<#article/posttime/year#>" aryTemplateTagsValue(29)=Year(PostTime) aryTemplateTagsName(30)="<#article/posttime/month#>" aryTemplateTagsValue(30)=Month(PostTime) aryTemplateTagsName(31)="<#article/posttime/monthname#>" aryTemplateTagsValue(31)=ZVA_Month(Month(PostTime)) aryTemplateTagsName(32)="<#article/posttime/day#>" aryTemplateTagsValue(32)=Day(PostTime) aryTemplateTagsName(33)="<#article/posttime/weekday#>" aryTemplateTagsValue(33)=Weekday(PostTime) aryTemplateTagsName(34)="<#article/posttime/weekdayname#>" aryTemplateTagsValue(34)=ZVA_Week(Weekday(PostTime)) aryTemplateTagsName(35)="<#article/posttime/hour#>" aryTemplateTagsValue(35)=Hour(PostTime) aryTemplateTagsName(36)="<#article/posttime/minute#>" aryTemplateTagsValue(36)=Minute(PostTime) aryTemplateTagsName(37)="<#article/posttime/second#>" aryTemplateTagsValue(37)=Second(PostTime) aryTemplateTagsName(38)="<#article/commentrss#>" aryTemplateTagsValue(38)="" aryTemplateTagsName(39)="<#article/commentposturl#>" aryTemplateTagsValue(39)=ZC_BLOG_HOST & "cmd.asp?act=cmt&key=" & Left(MD5(ZC_BLOG_HOST & ZC_BLOG_CLSID & CStr(0) & CStr(Day(GetTime(Now())))),8) aryTemplateTagsName(40)="<#article/pretrackback_url#>" aryTemplateTagsValue(40)="" aryTemplateTagsName(41)="<#article/trackbackkey#>" aryTemplateTagsValue(41)="00000" aryTemplateTagsName(42)="<#article/commentkey#>" aryTemplateTagsValue(42)="00000" aryTemplateTagsName(43)="<#article/staticname#>" aryTemplateTagsValue(43)="" aryTemplateTagsName(44)="<#article/category/staticname#>" aryTemplateTagsValue(44)="" aryTemplateTagsName(45)="<#article/author/staticname#>" aryTemplateTagsValue(45)="" aryTemplateTagsName(46)="<#article/tagtoname#>" aryTemplateTagsValue(46)="" aryTemplateTagsName(47)="<#article/firsttagintro#>" aryTemplateTagsValue(47)="" aryTemplateTagsName(48)="<#article/posttime/monthnameabbr#>" aryTemplateTagsValue(48)=ZVA_Month_Abbr(Month(PostTime)) aryTemplateTagsName(49)="<#article/posttime/weekdaynameabbr#>" aryTemplateTagsValue(49)=ZVA_Week_Abbr(Weekday(PostTime)) For i=1 to j Template_Article_Single=Replace(Template_Article_Single,aryTemplateTagsName(i),aryTemplateTagsValue(i)) Ftemplate=Replace(Ftemplate,aryTemplateTagsName(i),aryTemplateTagsValue(i)) Next Dim aryTemplateTagsName2 Dim aryTemplateTagsValue2 html=Replace(template,"<#template:article-single#>",Template_Article_Single) html=Replace(html,"<#template:article-guestbook#>",Template_Article_Single) Application.Lock aryTemplateTagsName2=Application(ZC_BLOG_CLSID & "TemplateTagsName") aryTemplateTagsValue2=Application(ZC_BLOG_CLSID & "TemplateTagsValue") Application.UnLock aryTemplateTagsName2(0)="BlogTitle" aryTemplateTagsValue2(0)=ZC_MSG275 j=UBound(aryTemplateTagsName2) For i=0 to j html=Replace(html,"<#" & aryTemplateTagsName2(i) & "#>",aryTemplateTagsValue2(i)) Next Export=True End Function End Class '********************************************************* Call System_Initialize() 'plugin node For Each sAction_Plugin_Guestbook_Begin in Action_Plugin_Guestbook_Begin If Not IsEmpty(sAction_Plugin_Guestbook_Begin) Then Call Execute(sAction_Plugin_Guestbook_Begin) Next Dim GuestBook Set GuestBook=New TGuestBook GuestBook.template="SINGLE" If GuestBook.Export(Request.QueryString("page")) Then Response.Write GuestBook.html End If 'plugin node For Each sAction_Plugin_Guestbook_End in Action_Plugin_Guestbook_End If Not IsEmpty(sAction_Plugin_Guestbook_End) Then Call Execute(sAction_Plugin_Guestbook_End) Next Call System_Terminate() %><% If Err.Number<>0 then Call ShowError(0) End If %>