<%@ language="vbscript" codepage="936" %>
<!-- #include file="../common/contencrypt.asp" -->
<!-- #include file="../language/Lang_Base.asp" -->
<!-- #include file="../common/commfun.asp" -->
<!-- #include file="../common/ip_purview.asp" -->
<!-- #include file="../common/purview_default.asp" -->
<!-- #include file="../common/connect.asp" -->
<!-- #include file="../common/checkru.asp" -->
<%
'========================================================================================
' 文 件 名: topnew.asp
' 版    本: 岭峰网行业专用留言系统3.10.0 (LFMessS 2020 - 3.10.0.F Build 200604)
' 说    明: 留言调用文件 | 请勿自行修改该处文件，以确保程序正确的执行
' 文件日期: 2020-06-04
' 设 计 者: 疾风之狼
'========================================================================================
' 郑州文达岭峰网络科技有限公司.
'========================================================================================
' Copyright (C) 2001-2020 岭峰网. All rights reserved.
' 网    站: http://www.lfmesss.com
' 电子邮件: support@lfmesss.com
' 联系ＱＱ: 85112407
'========================================================================================

maxLen = Int(Trim(Request.Querystring("maxLen"))) '调用留言每条的字数
maxly = Trim(Request.Querystring("maxly")) '调用留言的条数
bullet = Trim(Request.Querystring("bullet")) '调用留言前的图片或符号,不要在调用代码里包含“#”、“&”等
new_color = "#"&Trim(Request.Querystring("new_color")) '新留言的颜色,不要在调用代码里包含“#”、“&”等
old_color = "#"&Trim(Request.Querystring("old_color")) '旧留言的颜色，不要在调用代码里包含“#”、“&”等
show_time = Trim(Request.Querystring("show_time")) '调用留言时是否显示时间，0为显示，1为不显示

Path = "http://"&Request.ServerVariables("server_name") & Replace(Request.ServerVariables("script_name"), "topnew.asp", "")
Set rs = Server.CreateObject("Adodb.recordset")

IF Session("LingFengNet_MS_admin") <> "ok" and Session("LingFengNet_MS_admin_flg") <> "3" Then
	sql = "SELECT TOP "&maxly&" * FROM lfmessb WHERE (Auditing=2 or Auditing=5) and silentlywords=0 ORDER BY addtime Desc"
Else
	sql = "SELECT TOP "&maxly&" * FROM lfmessb ORDER BY addtime Desc"
End IF

rs.open sql,conn,1,1
IF rs.bof and rs.eof Then 
	str = str & LingFengNet_MS_language_Warning_topnew_1
Else
	rs.movefirst
	Do while Not rs.eof
		IF rs("encrypt") = 1 Then
			content = DeCrypt(rs("content"))
			re = DeCrypt(rs("re"))
		Else
			content = rs("content")
			re = rs("re")
		End IF
		addtime = rs("addtime")
		IF show_time = "0" Then
			n = Year(addtime)
			y = Month(addtime)
			r = Day(addtime)
			IF len(y) = 1 Then y = "0" & y
			IF len(r) = 1 Then r = "0" & r
			IF len(s) = 1 Then s = "0" & s
			addtime = n&"-"&y&"-"&r
			addtime = "（"& addtime &"）"
		Else
			addtime = ""
		End IF
		content = Replace(content, ""& Chr(13) &"", "")
		content = Replace(content, ""& Chr(10) &"", "")
		content = Replace(content, "<br>", "")
		content = Replace(content, "'", "&ensp;")
		IF re <> "0" Then
			re = re
		Else
			re = content
		End IF
		topic = getTopic(content,maxLen)
		IF rs("addtime") = now() Then
			topic = "<span style=color:"&new_color&">"&topic&"</span>"
			addtime = "<span style=color:"&new_color&">"&addtime&"</span>"
		Else
			topic = "<span style=color:"&old_color&">"&topic&"</span>"
			addtime = "<span style=color:"&old_color&">"&addtime&"</sapn>"
		End IF
		'''你可以自行设计以下HTML代码，以做出符合自己需求的格式'''
		str = str & bullet &"&ensp;<a href='"&Path&"default"& Get_Suffix() &"?topid="&Cstr(rs("id"))&"' target='_blank'  title='"& re &"') >"+topic+""& addtime &"</a><br>"
		''''''''''''''''''''''''
		rs.moveNext
	Loop
End IF
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
Response.AddHeader "content-type","text/javascript"
Response.Write "document.write ("&Chr(34)&str&Chr(34)&");"
%>