<%
'**************************************
'* 最后更新 2011-05-08 by 56770.kingdge
'* Copyright www.56770.com
'**************************************
Showpath = "<a href='"& Eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → "& Lebi_word(20)
Dim GuestBookMain
Dim page : page = checknum(request("page"),1)
GuestBookMain = GuestBookList(1,1)

Function GuestBookList(showheadpage,showfootpage)
        Dim strFile,RLoadStyle(8),LoadGuestBookList,LoadGuestBookList_s,TmpLoadGuestBookList,headpage,footpage
		showheadpage = checknum(showheadpage,0) : showfootpage = checknum(showfootpage,0)
		strFile = Eshop_url& Style_Folder &"Lebi.GuestBookList."
		RLoadStyle(0) = LoadStyle(strFile&"0.style")
		RLoadStyle(1) = LoadStyle(strFile&"1.style")
		RLoadStyle(7) = LoadStyle(strFile&"7.style")
		RLoadStyle(8) = LoadStyle(strFile&"8.style")
        Dim sql,content,DataCount,DataList,i,filename
	    Dim ors
	    Set ors=new Cls_vbsPage
	    Set ors.Conn=conn
	    With ors
		    .PageSize=10
		    .PageName="Page"
			If IsSqlDataBase = 0 Then
		            .DbType="AC"
			Else
			        .DbType="MSSQL"
			End If
		    .RecType=0
		    .Pkey="id"
    	    .Field="name,time,face,[select],title,show,isadmin,content,reply,ip"
		    .Table="[guestbook]"
		    .Condition="(show=1 or ip = '"& GetIp() &"')"
            .OrderBy="id desc"
	    End With
	    DataCount=ors.RecCount()
	    DataList=ors.ResultSet()
		filename="default.asp"
	    GuestBookList = RLoadStyle(0)
		If showheadpage = 1 Then
		        headpage = RLoadStyle(1)
				ReplaceStyle "headpage",ors.ShowPageHead(Filename),headpage
		End If
		GuestBookList = GuestBookList & headpage
	    If DataCount < 1 Then
		        RLoadStyle(2) = splits(LoadStyle(strFile&"2.style"))
                TmpLoadGuestBookList = RLoadStyle(2)
        Else
		        RLoadStyle(3) = splits(LoadStyle(strFile&"3.style"))
				RLoadStyle(4) = splits(LoadStyle(strFile&"4.style"))
				RLoadStyle(5) = splits(LoadStyle(strFile&"5.style"))
				RLoadStyle(6) = splits(LoadStyle(strFile&"6.style"))
				TmpLoadGuestBookList = RLoadStyle(3)
                For i = 0 To Ubound(DataList,2)
						LoadGuestBookList = RLoadStyle(4)
						if DataList(5,i)=1 and DataList(6,i)=0 Then
								content = replace(DataList(7,i), chr(13), "<br>")
								content = replace(content, chr(32), "&nbsp;")
						elseif DataList(6,i)=1 Then
								If DataList(9,i) = GetIp() Then
										content = replace(DataList(7,i), chr(13), "<br>")
										content = replace(content, chr(32), "&nbsp;")
								Else
										content = ""
								End If
								content = content & "&nbsp;<em>"& Lebi_book(10) &"</em>"
						Else
								If DataList(9,i) = GetIp() Then
										content = replace(DataList(7,i), chr(13), "<br>")
										content = replace(content, chr(32), "&nbsp;")
								Else
										content = ""
								End If
								content = content & "&nbsp;<em>"& Lebi_book(15) &"</em>"
						end If
						If Eshop_url <> "/" Then
								ReplaceStyle "face",Replace(DataList(3,i),Eshop_url,""),LoadGuestBookList
						Else
								ReplaceStyle "face",Replace(DataList(3,i),"/images","images"),LoadGuestBookList
						End If
						ReplaceStyle "name",DataList(0,i),LoadGuestBookList
						ReplaceStyle "time",DataList(1,i),LoadGuestBookList
						ReplaceStyle "smile",DataList(2,i),LoadGuestBookList
						ReplaceStyle "title",DataList(4,i),LoadGuestBookList
						ReplaceStyle "content",content,LoadGuestBookList
						If trim(DataList(8,i))<>"" Then
								dim reply
								reply = replace(DataList(8,i),chr(13),"<br>")
								reply = replace(reply,chr(32),"&nbsp;")
								LoadGuestBookList_s = RLoadStyle(5)
								ReplaceStyle "content",reply,LoadGuestBookList_s
								ReplaceStyle "reply",LoadGuestBookList_s,LoadGuestBookList
						Else
								ReplaceStyle "reply","",LoadGuestBookList
						End If
						ReplaceStyle "loop_num",i + 1,LoadGuestBookList
						TmpLoadGuestBookList = TmpLoadGuestBookList & LoadGuestBookList
						LoadGuestBookList_s = ""
                Next
        End If
		GuestBookList = GuestBookList & TmpLoadGuestBookList & RLoadStyle(6)
		If showfootpage = 1 Then
		        footpage = RLoadStyle(7)
				ReplaceStyle "footpage",ors.ShowPageFoot(Filename),footpage
		End If
        GuestBookList = GuestBookList & footpage & RLoadStyle(8)
End Function
%>