www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/search.asp

    <!--#include file="conn.asp"-->
<!--#include file="const.asp"-->
<!--#include file="inc/cls_public.asp"-->
<!--#include file="inc/ubbcode.asp"-->
<%
Dim HtmlContent,strHtml,Page_Strings
Dim KeyWord,classid,TempListContent,ListContent
Dim SQL,Rs,ChannelID,j,CreateHtml,ChannelRootDir
Dim maxperpage, TotalNumber, TotalPageNum, CurrentPage, i, totalrec
Dim Action,moduleid,re

Dim db_ID,db_Title,db_Content,db_Datetime

Set Re = New RegExp
Re.IgnoreCase = True
Re.Global = True

CreateHtml = 1
ChannelRootDir = ""

Newasp.LoadTemplates 9999, 7, 0

LoadXsltPage("skin/search.xslt")

HtmlContent = Page_Strings(0).text

Call searchmain

Set Re = Nothing

HtmlContent = HtmlContent & Page_Strings(4).text

HtmlContent = Replace(HtmlContent,"{$InstallDir}", Newasp.InstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", 0)
HtmlContent = Replace(HtmlContent,"{$PageTitle}",KeyWord)

HtmlContent = Replace(HtmlContent, "{$ChannelRootDir}", "")
HtmlContent = Replace(HtmlContent, "{$ModuleName}", "站内搜索")
HtmlContent = Replace(HtmlContent, "{$SoftIndex}", "搜索引擎")
HtmlContent = Replace(HtmlContent, "{$KeyWord}", KeyWord)
HtmlContent = Replace(HtmlContent, "{$QueryKeyWord}", "<font color=""red""><strong>" & keyword & "</strong></font>")

HtmlContent = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
HtmlContent = HTML.ReadAnnounceList(HtmlContent)
HtmlContent = HTML.ReadStatistic(HtmlContent)
HtmlContent = HTML.ReadUserRank(HtmlContent)

Newasp.HTMLValue = HtmlContent
HtmlContent = Newasp.HTMLValue

Response.Write HtmlContent
CloseConn

Public Sub searchmain()
	Dim SearchMaxPageList
	Dim findword
	Dim rsClass, strNoResult
	Dim strWord, s

	keyword = Newasp.ChkQueryStr(Trim(Request("keyword")))
	keyword = Newasp.CheckInfuse(keyword,220)
	strWord = Newasp.ChkQueryStr(Trim(Request("word")))
	strWord = Newasp.CheckInfuse(strWord,220)
	s = Newasp.ChkNumeric(Request.QueryString("s"))
	classid = Newasp.ChkNumeric(Request("classid"))
	moduleid = Newasp.ChkNumeric(Request("m"))
	ChannelID = Newasp.ChkNumeric(Request("ChannelID"))

	SearchMaxPageList = 200
	
	If len(keyword) = 0 Then keyword = strWord
	If moduleid = 0 Then moduleid = Newasp.ChkNumeric(Request("field"))
	
	If keyword = "" Then
		HtmlContent = HtmlContent & Page_Strings(5).text
		Exit Sub
	End If
	
	If Not Newasp.CheckQuery(keyword) Then
		Call OutAlertScript("你查询的关键中有非法字符!\n请返回重新输入关键字查询。")
		Exit Sub
	End If
	
	On Error Resume Next
	HtmlContent = HtmlContent & Page_Strings(1).text
	maxperpage = 20
	If Not IsNumeric(Request("page")) And Len(Request("page")) <> 0 Then
		Response.Write ("错误的系统参数!请输入整数")
		Response.End
	End If
	If Not IsEmpty(Request("page")) And Len(Request("page")) <> 0 Then
		CurrentPage = CInt(Request("page"))
	Else
		CurrentPage = 1
	End If
	If CInt(CurrentPage) = 0 Then CurrentPage = 1
	
	strNoResult = Re_Replace(Page_Strings(6).text, "{$KeyWord}", keyword)
	
	Action = Newasp.CheckStr(Trim(Request("act")))
	Action = Newasp.CheckStr(Action)
	If moduleid = 1 Then
		If LCase(Action) = "topic" Then
			findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
		ElseIf LCase(Action) = "content" Then
			If CInt(Newasp.FullContQuery) <> 0 Then
				findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%' Or A.Content like '%" & keyword & "%')"
			Else
				findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
			End If
		Else
			findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
		End If
	ElseIf moduleid = 5 Then
		If LCase(Action) = "topic" Then
			findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
		ElseIf LCase(Action) = "content" Then
			If CInt(Newasp.FullContQuery) <> 0 Then
				findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%' Or A.Introduce like '%" & keyword & "%')"
			Else
				findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
			End If
		Else
			findword = "(A.title like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
		End If
	Else
		If LCase(Action) = "topic" Then
			findword = "(A.SoftName like '%" & keyword & "%' Or A.SoftVer like '%" & keyword & "%' Or A.subtitle like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
		ElseIf LCase(Action) = "content" Then
			If CInt(Newasp.FullContQuery) <> 0 Then
				findword = "(A.SoftName like '%" & keyword & "%' Or A.SoftVer like '%" & keyword & "%' Or A.subtitle like '%" & keyword & "%' Or A.Related like '%" & keyword & "%' Or A.Content like '%" & keyword & "%')"
			Else
				findword = "(A.SoftName like '%" & keyword & "%' Or A.SoftVer like '%" & keyword & "%' Or A.subtitle like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
			End If
		Else
			findword = "(A.SoftName like '%" & keyword & "%' Or A.SoftVer like '%" & keyword & "%' Or A.subtitle like '%" & keyword & "%' Or A.Related like '%" & keyword & "%')"
		End If
	End If
	
	If LCase(Action) <> "isweb" Then
		If IsEmpty(Session("QueryLimited")) Then
			Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
		Else
			Dim QueryLimited
			QueryLimited = Split(Session("QueryLimited"), "|")
			If UBound(QueryLimited) = 2 Then
				If CStr(Trim(QueryLimited(0))) = CStr(keyword) And CStr(Trim(QueryLimited(1))) = CStr(Action) Then
					Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
				Else
					If DateDiff("s", QueryLimited(2), Now()) < 5 Then
						Dim strLimited
						strLimited = "对不起!本站限制了每次搜索时间间隔为 1 秒"
						Call OutAlertScript(Replace(Replace(strLimited, Chr(34), "\"""), vbCrLf, ""))
						Exit Sub
					Else
						Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
					End If
				End If
			Else
				Session("QueryLimited") = keyword & "|" & Action & "|" & Now()
			End If
		End If
	End If
	
	If LCase(Action) <> "isweb" Then
	If classid > 0 Then
		Set rsClass = Newasp.Execute("SELECT ClassID,ChildStr FROM [NC_Classify] WHERE ChannelID=" & ChannelID & " And ClassID=" & CLng(Request("classid")))
		If rsClass.BOF And rsClass.EOF Then
			HtmlContent = HtmlContent & Page_Strings(3).text
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strNoResult)
			HtmlContent = Replace(HtmlContent, "{$totalrec}", 0)
			HtmlContent = Replace(HtmlContent, "{$TotalPageNum}", 0)
			Set rsClass = Nothing
			Response.Write HtmlContent
			Exit Sub
		Else
			findword = "A.ClassID IN (" & rsClass("ChildStr") & ") And " & findword
		End If
		rsClass.Close: Set rsClass = Nothing

	End If
	If Not IsObject(Conn) Then ConnectionDatabase
	If moduleid = 1 Then
		If ChannelID > 0 Then
			SQL = "SELECT TOP " & SearchMaxPageList & " A.ArticleID,A.ClassID,A.ChannelID,A.BriefTopic,A.title,A.content,A.Related,A.Author,A.username,A.star,A.isBest,A.WriteTime,A.Allhits,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,B.ChannelDir,B.Channel_Setting FROM ([NC_Article] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B On A.ChannelID=B.ChannelID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And " & findword & " ORDER BY A.WriteTime DESC,A.ArticleID DESC"
		Else
			SQL = "SELECT TOP " & SearchMaxPageList & " A.ArticleID,A.ClassID,A.ChannelID,A.BriefTopic,A.title,A.content,A.Related,A.Author,A.username,A.star,A.isBest,A.WriteTime,A.Allhits,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,B.ChannelDir,B.Channel_Setting FROM ([NC_Article] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B On A.ChannelID=B.ChannelID WHERE A.isAccept > 0 And " & findword & " ORDER BY A.WriteTime DESC,A.ArticleID DESC"
		End If
	ElseIf moduleid = 5 Then
		If ChannelID > 0 Then
			SQL = "SELECT TOP " & SearchMaxPageList & " A.flashid,A.ClassID,A.ChannelID,A.title,A.ColorMode,A.FontMode,A.Introduce,A.[filesize],A.Author,A.star,A.miniature,A.UserName,A.addTime,A.AllHits,A.[grade],A.HtmlFileDate,A.isBest,C.ClassName,C.HtmlFileDir,B.ChannelDir,B.Channel_Setting FROM ([NC_FlashList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B On A.ChannelID=B.ChannelID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And " & findword & " ORDER BY A.addTime DESC ,A.flashid DESC"
		Else
			SQL = "SELECT TOP " & SearchMaxPageList & " A.flashid,A.ClassID,A.ChannelID,A.title,A.ColorMode,A.FontMode,A.Introduce,A.[filesize],A.Author,A.star,A.miniature,A.UserName,A.addTime,A.AllHits,A.[grade],A.HtmlFileDate,A.isBest,C.ClassName,C.HtmlFileDir,B.ChannelDir,B.Channel_Setting FROM ([NC_FlashList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B On A.ChannelID=B.ChannelID WHERE A.isAccept > 0 And " & findword & " ORDER BY A.addTime DESC ,A.flashid DESC"
		End If
	Else
		If ChannelID > 0 Then
			SQL = "SELECT TOP " & SearchMaxPageList & " A.SoftID,A.ClassID,A.ChannelID,A.SoftName,A.SoftVer,A.content,A.Related,A.Languages,A.SoftType,A.RunSystem,A.impower,A.SoftSize,A.star,A.SoftTime,A.username,A.Allhits,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,B.ChannelDir,B.Channel_Setting FROM ([NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B On A.ChannelID=B.ChannelID WHERE A.ChannelID=" & ChannelID & " And A.isAccept > 0 And " & findword & " ORDER BY A.SoftTime DESC ,A.softid DESC"
		Else
			SQL = "SELECT TOP " & SearchMaxPageList & " A.SoftID,A.ClassID,A.ChannelID,A.SoftName,A.SoftVer,A.content,A.Related,A.Languages,A.SoftType,A.RunSystem,A.impower,A.SoftSize,A.star,A.SoftTime,A.username,A.Allhits,A.HtmlFileDate,A.isxmltext,A.xmlfilename,C.ClassName,C.HtmlFileDir,B.ChannelDir,B.Channel_Setting FROM ([NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID) INNER JOIN [NC_Channel] B On A.ChannelID=B.ChannelID WHERE A.isAccept > 0 And " & findword & " ORDER BY A.SoftTime DESC ,A.softid DESC"
		End If
	End If
	
	Set Rs = Server.CreateObject("ADODB.Recordset")
	Rs.Open SQL, Conn, 1, 1
	If Rs.BOF And Rs.EOF Then
		'如果没有找到相关内容,清除掉无用的标签代码
		HtmlContent = HtmlContent & Page_Strings(3).text
		HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strNoResult)
		HtmlContent = Replace(HtmlContent, "{$totalrec}", 0)
		HtmlContent = Replace(HtmlContent, "{$TotalPageNum}", 0)
	Else
		TotalNumber = Rs.RecordCount
		If (TotalNumber Mod maxperpage) = 0 Then
			TotalPageNum = TotalNumber \ maxperpage
		Else
			TotalPageNum = TotalNumber \ maxperpage + 1
		End If
		If CurrentPage > TotalPageNum Then CurrentPage = TotalPageNum
		If CurrentPage < 1 Then CurrentPage = 1
		HtmlContent = Replace(HtmlContent, "{$totalrec}", TotalNumber)
		'获取模板标签[ShowRepetend][/ReadSoftList]中的字符串
		TempListContent = Page_Strings(2).text
		Call LoadSearchList
	End If
	Rs.Close: Set Rs = Nothing
	Else
			HtmlContent = HtmlContent & Page_Strings(3).text
			HtmlContent = Replace(HtmlContent, "{$ReadListPage}", "")
			HtmlContent = Replace(HtmlContent, "{$totalrec}", 0)
			If s = 1 Then
				Call isWeb_Query()
				Exit Sub
			End If
			HtmlContent = HtmlContent & SearchObj
			Exit Sub
	End If
End Sub
'================================================
'过程名:LoadSearchResult
'作  用:装载搜索列表
'================================================
Public Sub LoadSearchList()
	If IsNull(TempListContent) Then Exit Sub
	i = 0
	If TotalPageNum > 1 Then Rs.Move (CurrentPage - 1) * maxperpage
	ListContent = ""
	j = (CurrentPage - 1) * maxperpage + 1
	Do While Not Rs.EOF And i < CInt(maxperpage)
		If Not Response.IsClientConnected Then Response.End
		If moduleid = 1 Then
			Call  ArticleSearchResult
		ElseIf moduleid = 5 Then
			Call  FlashSearchResult
		Else
			Call  DownSearchResult
		End If
		Rs.MoveNext
		i = i + 1
		j = j + 1
		If i >= maxperpage Then Exit Do
	Loop
	Dim strPagination
	strPagination = showlistpage(CurrentPage, TotalPageNum, TotalNumber, maxperpage, "&amp;m=" & moduleid & "&amp;act=" & Action & "&amp;classid=" & classid & "&amp;word=" & Server.URLEncode(keyword), "搜索结果")
	HtmlContent = HtmlContent &  ListContent & Page_Strings(3).text
	HtmlContent = Replace(HtmlContent, "{$TotalPageNum}", TotalPageNum)
	HtmlContent = Replace(HtmlContent, "{$ReadListPage}", strPagination)
	
End Sub

Public Sub DownSearchResult()
	Dim sTitle, sTopic, softname, ListStyle, TitleWord,HtmlFileName
	Dim LinksUrl, SoftTime, sClassName, SoftImage, SoftVer,SoftIntro
	Dim ChannelsetArray,xmlFilePath,m_xmlFilePath,m_strXMLPath,TextContent,isxmltext,xmlfilename

	ChannelID = Rs("ChannelID")
	Newasp.LoadChannel(ChannelID)
	ChannelRootDir = Newasp.ChannelPath
	CreateHtml = Newasp.ChannelUseHtml
	'-------------------------------------------
	ChannelsetArray = Split(Rs("Channel_Setting") & "|||||||||||||||", "|||")
	m_xmlFilePath = Trim(ChannelsetArray(12))
	If Len(m_xmlFilePath) > 2 And InStr(m_xmlFilePath, ":") > 0 Then
		m_strXMLPath = m_xmlFilePath &"\"
	Else
		m_strXMLPath = Server.MapPath(Newasp.InstallDir & Rs("ChannelDir") & m_xmlFilePath) & "\"
	End If
	m_strXMLPath = Replace(m_strXMLPath, "\\", "\")
	'--如果是XML文件,就从XML文件中读出内容------
	isxmltext = Newasp.ChkNumeric(Rs("isxmltext"))
	xmlfilename = Rs("xmlfilename") & ""
	If isxmltext = 1 Then
		xmlFilePath = m_strXMLPath & xmlfilename
		TextContent = Newasp.ReadXMLDocument(xmlFilePath,"softinfo/@content")
		If TextContent = "" Then TextContent = Rs("content") & ""
		TextContent = ubb.UBBCode(TextContent)
	Else
		TextContent = ubb.UBBCode(Rs("content"))
	End If
	'---------------------------------------------
	ListContent = ListContent & TempListContent
	If (i Mod 2) = 0 Then
		ListStyle = 1
	Else
		ListStyle = 2
	End If
	TitleWord = Re_Replace(Trim(Rs("SoftName") & " " & Rs("SoftVer")), keyword, "<span style=""font-size : 15px;color: red"">" & keyword & "</span>")
	sTitle = TitleWord
	
	If CInt(CreateHtml) <> 0 Then
		LinksUrl = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_InfoDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
		sClassName = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_SortDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("softid"),1,"")
	Else
		If IsURLRewrite Then
			LinksUrl = ChannelRootDir & Rs("softid") & Newasp.ChannelHtmlExt
			sClassName = ChannelRootDir & "list_1_" & Rs("ClassID") & Newasp.ChannelHtmlExt
		Else
			LinksUrl = ChannelRootDir & "show.asp?id=" & Rs("softid")
			sClassName = ChannelRootDir & "list.asp?classid=" & Rs("ClassID")
		End If
	End If
	
	sClassName = "<a href=""" & sClassName & """ title=""" & Rs("ClassName") & """ target=""_blank"">" & Rs("ClassName") & "</a>"
	softname = "<a href=""" & LinksUrl & """ title=""" & Trim(Rs("SoftName") & Rs("SoftVer")) & """ class=""searchtitle"" target=""_blank"">" & sTitle & "</a>"
	SoftIntro = Newasp.CutString(TextContent, 200)
	SoftIntro = Re_Replace(SoftIntro, keyword, "<span style=""font-size : 15px;color: red"">" & keyword & "</span>")
	
	SoftTime = Newasp.ShowDateTime(Rs("SoftTime"), 2)
	SoftTime = Replace(SoftTime, " globalDate", "")
	ListContent = Replace(ListContent, "{$KeyWord}", keyword)
	ListContent = Replace(ListContent, "{$totalrec}", TotalNumber)
	ListContent = Replace(ListContent, "{$ClassifyName}", sClassName)
	ListContent = Replace(ListContent, "{$LinksUrl}", LinksUrl)
	ListContent = Replace(ListContent, "{$Star}", Rs("star"))
	ListContent = Replace(ListContent, "{$Hits}", Rs("AllHits"))
	ListContent = Replace(ListContent, "{$UserName}", Rs("username"))
	ListContent = Replace(ListContent, "{$DateTime}", SoftTime)
	ListContent = Replace(ListContent, "{$ListStyle}", ListStyle)
	ListContent = Replace(ListContent, "{$AuthorSize}", "大小:" & ReadSoftsize(Rs("SoftSize")))
	ListContent = Replace(ListContent, "{$Impower}", "授权:"& Rs("impower"))
	ListContent = Replace(ListContent, "{$Language}", "语言:" & Rs("Languages"))
	ListContent = Replace(ListContent, "{$SoftType}", Rs("SoftType"))
	ListContent = Replace(ListContent, "{$ID}", Rs("SoftID"))
	ListContent = Replace(ListContent, "{$Order}", j)
	ListContent = Replace(ListContent, "{$ChannelModule}", Newasp.ChannelModule)
	ListContent = Replace(ListContent, "{$Title}", softname)
	ListContent = Replace(ListContent, "{$Topic}", sTitle)
	ListContent = Replace(ListContent, "{$Content}", SoftIntro)
End Sub

Sub ArticleSearchResult()
	Dim sTitle, sTopic, ArticleTitle, ListStyle, TitleWord
	Dim ArticleContent, LinksUrl, WriteTime, sClassName,HtmlFileName
	Dim ChannelsetArray,xmlFilePath,m_xmlFilePath,m_strXMLPath,TextContent,isxmltext,xmlfilename

	ChannelID = Rs("ChannelID")
	Newasp.LoadChannel(ChannelID)
	ChannelRootDir = Newasp.ChannelPath
	CreateHtml = Newasp.ChannelUseHtml
	'-------------------------------------------
	ChannelsetArray = Split(Rs("Channel_Setting") & "|||||||||||||||", "|||")
	m_xmlFilePath = Trim(ChannelsetArray(12))
	If Len(m_xmlFilePath) > 2 And InStr(m_xmlFilePath, ":") > 0 Then
		m_strXMLPath = m_xmlFilePath &"\"
	Else
		m_strXMLPath = Server.MapPath(Newasp.InstallDir & Rs("ChannelDir") & m_xmlFilePath) & "\"
	End If
	m_strXMLPath = Replace(m_strXMLPath, "\\", "\")
	'--如果是XML文件,就从XML文件中读出内容------
	isxmltext = Newasp.ChkNumeric(Rs("isxmltext"))
	xmlfilename = Rs("xmlfilename") & ""
	If isxmltext = 1 Then
		xmlFilePath = m_strXMLPath & xmlfilename
		TextContent = Newasp.ReadXMLDocument(xmlFilePath,"article/@content")
		If TextContent = "" Then TextContent = Rs("content") & ""
		TextContent = ubb.UBBCode(TextContent)
	Else
		TextContent = ubb.UBBCode(Rs("content"))
	End If
	'---------------------------------------------
	ListContent = ListContent & TempListContent
	If (i Mod 2) = 0 Then
		ListStyle = 1
	Else
		ListStyle = 2
	End If
	TitleWord = Re_Replace(Rs("title"), keyword, "<span style=""font-size : 15px;color: red"">" & keyword & "</span>")
	sTitle = TitleWord
	sTopic = Newasp.ReadPicTopic(Rs("BriefTopic"))
	If CInt(CreateHtml) <> 0 Then
		LinksUrl = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_InfoDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("ArticleID"),1,"")
		sClassName = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_SortDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("ArticleID"),1,"")
	Else
		If IsURLRewrite Then
			LinksUrl = ChannelRootDir & Rs("ArticleID") & Newasp.ChannelHtmlExt
			sClassName = ChannelRootDir & "list_1_" & Rs("ClassID") & Newasp.ChannelHtmlExt
		Else
			LinksUrl = ChannelRootDir & "show.asp?id=" & Rs("ArticleID")
			sClassName = ChannelRootDir & "list.asp?classid=" & Rs("ClassID")
		End If
	End If
	sClassName = "<a href=""" & sClassName & """ title=""" & Rs("ClassName") & """ target=""_blank"">" & Rs("ClassName") & "</a>"
	ArticleTitle = "<a href=""" & LinksUrl & """ title=""" & Rs("title") & """ class=""searchtitle"" target=""_blank"">" & sTitle & "</a>"
	ArticleContent = Newasp.CutString(TextContent, 200)
	ArticleContent = Re_Replace(ArticleContent, keyword, "<span style=""font-size : 15px;color: red"">" & keyword & "</span>")
	
	WriteTime = Newasp.ShowDateTime(Rs("WriteTime"), 2)
	WriteTime = Replace(WriteTime, " globalDate", "")
	ListContent = Replace(ListContent, "{$KeyWord}", keyword)
	ListContent = Replace(ListContent, "{$totalrec}", TotalNumber)
	ListContent = Replace(ListContent, "{$ClassifyName}", sClassName)
	ListContent = Replace(ListContent, "{$LinksUrl}", LinksUrl)
	ListContent = Replace(ListContent, "{$Star}", Rs("star"))
	ListContent = Replace(ListContent, "{$Hits}", Rs("AllHits"))
	ListContent = Replace(ListContent, "{$UserName}", Rs("username"))
	ListContent = Replace(ListContent, "{$DateTime}", WriteTime)
	ListContent = Replace(ListContent, "{$ListStyle}", ListStyle)
	ListContent = Replace(ListContent, "{$AuthorSize}", "作者:" & Newasp.ChkNull(Rs("Author")))
	ListContent = Replace(ListContent, "{$ID}", Rs("ArticleID"))
	ListContent = Replace(ListContent, "{$Order}", j)
	ListContent = Replace(ListContent, "{$ChannelModule}", Newasp.ChannelModule)
	ListContent = Replace(ListContent, "{$Impower}", "")
	ListContent = Replace(ListContent, "{$Language}", "")
	ListContent = Replace(ListContent, "{$SoftType}", "")
	ListContent = Replace(ListContent, "{$Title}", sTopic & ArticleTitle)
	ListContent = Replace(ListContent, "{$Topic}", sTopic & sTitle)
	ListContent = Replace(ListContent, "{$Content}", ArticleContent)
End Sub

Sub FlashSearchResult()
	Dim sTitle, sTopic, title, ListStyle, TitleWord
	Dim FlashUrl, addTime, sClassName, FlashImage, FlashIntro
	Dim miniatureUrl,miniature,strminiature
	
	ChannelID = Rs("ChannelID")
	Newasp.LoadChannel(ChannelID)
	ChannelRootDir = Newasp.ChannelPath
	CreateHtml = Newasp.ChannelUseHtml
	
	ListContent = ListContent & TempListContent
	If (i Mod 2) = 0 Then
		ListStyle = 1
	Else
		ListStyle = 2
	End If
	TitleWord = Replace(Rs("title"), keyword, "<font color=""red"">" & keyword & "</font>")
	sTitle = Newasp.ReadFontMode(TitleWord, Rs("ColorMode"), Rs("FontMode"))
	
	If CInt(CreateHtml) <> 0 Then
		FlashUrl = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_InfoDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("flashid"),1,"")
		sClassName = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_SortDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("flashid"),1,"")
	Else
		If IsURLRewrite Then
			FlashUrl = ChannelRootDir & Rs("flashid") & Newasp.ChannelHtmlExt
			sClassName = ChannelRootDir & "list_1_" & Rs("ClassID") & Newasp.ChannelHtmlExt
		Else
			FlashUrl = ChannelRootDir & "show.asp?id=" & Rs("flashid")
			sClassName = ChannelRootDir & "list.asp?classid=" & Rs("ClassID")
		End If
	End If
	
	sClassName = "<a href=""" & sClassName & """ target=""_blank"">" & Rs("ClassName") & "</a>"
	title = "<a href=""" & FlashUrl & """" & LoadRemark(Rs("title")) & " class=""showtopic"" target=""_blank"">" & sTitle & "</a>"
	FlashIntro = Newasp.CutString(ubb.UbbCode(Rs("Introduce")), 200)
	FlashIntro = Replace(FlashIntro, keyword, "<font color=""red"">" & keyword & "</font>")
	If Not IsNull(Rs("miniature")) Then
		strminiature = Rs("miniature")
	End If
	miniatureUrl = Newasp.GetImageUrl(strminiature, ChannelRootDir)
	miniature = Newasp.GetFlashAndPic(miniatureUrl, CInt(Newasp.HtmlSetting(11)), CInt(Newasp.HtmlSetting(12)))
	miniature = "<a href='" & FlashUrl & "' title='" & Rs("title") & "'>" & miniature & "</a>"
	
	addTime = Newasp.ShowDateTime(Rs("addTime"), 2)
	addTime = Replace(addTime, " globalDate", "")
	ListContent = Replace(ListContent, "{$KeyWord}", keyword)
	ListContent = Replace(ListContent, "{$totalrec}", TotalNumber)
	ListContent = Replace(ListContent, "{$ClassifyName}", sClassName)
	ListContent = Replace(ListContent, "{$FlashUrl}", FlashUrl)
	ListContent = Replace(ListContent, "{$LinksUrl}", FlashUrl)
	ListContent = Replace(ListContent, "{$Miniature}", miniature)
	ListContent = Replace(ListContent, "{$Star}", Rs("star"))
	ListContent = Replace(ListContent, "{$FlashHits}", Rs("AllHits"))
	ListContent = Replace(ListContent, "{$UserName}", Rs("username"))
	ListContent = Replace(ListContent, "{$DateTime}", addTime)
	ListContent = Replace(ListContent, "{$ListStyle}", ListStyle)
	ListContent = Replace(ListContent, "{$AuthorSize}", "大小:" & ReadSoftsize(Rs("filesize")))
	ListContent = Replace(ListContent, "{$Author}", Newasp.ChkNull(Rs("Author")))
	ListContent = Replace(ListContent, "{$ID}", Rs("flashid"))
	ListContent = Replace(ListContent, "{$Order}", j)
	ListContent = Replace(ListContent, "{$ChannelModule}", Newasp.ChannelModule)
	ListContent = Replace(ListContent, "{$Impower}", "")
	ListContent = Replace(ListContent, "{$Language}", "")
	ListContent = Replace(ListContent, "{$SoftType}", "")
	ListContent = Replace(ListContent, "{$Title}", title)
	ListContent = Replace(ListContent, "{$Topic}", sTitle)
	ListContent = Replace(ListContent, "{$Content}", FlashIntro)
End Sub

'================================================
'函数名:ReadSoftsize
'作  用:读取软件的大小
'================================================
Function ReadSoftsize(ByVal para)
	On Error Resume Next
	Dim parasize
	parasize = Clng(para)
	
	If parasize = 0 Then
		ReadSoftsize = "未知"
		Exit Function
	End If
	If parasize > 1024*1024 Then
		ReadSoftsize = Round(parasize / (1024*1024), 2) & " GB"
		Exit Function
	ElseIf parasize > 1024 Then
		ReadSoftsize = Round(parasize / 1024, 2) & " MB"
		Exit Function
	Else
		ReadSoftsize = parasize & " KB"
		Exit Function
	End If
	ReadSoftsize = "未知"
End Function

Public Function showlistpage(page,Pcount,totalnumber,maxperpage,strLink,ListName)
	Dim strTemp, b, e
	Dim i, n, p, s
	b = 5 : e = 5 : s = "五"
	
	If (page - 1) Mod b = 0 Then
		p = (page-1) \ b
	Else
		p = ((page-1) - (page-1) Mod b) \ b
	End If
	If totalnumber Mod maxperpage = 0 Then
		n = totalnumber \ maxperpage
	Else
		n = (totalnumber - totalnumber Mod maxperpage) \ maxperpage + 1
	End If
	
	strTemp = "<table border=""0"" cellpadding=""0"" cellspacing=""1"" class=""Tableborder5"">" & vbNewLine
	strTemp = strTemp & "	<form method=""post"" action=""?pcount="& Pcount & strLink & """>" & vbNewLine
	strTemp = strTemp & "	<tr align=""center"">" & vbNewLine
	strTemp = strTemp & "		<td class=""tabletitle1"" title=""" & ListName & """>&nbsp;" & ListName & "&nbsp;</td>" & vbNewLine
	strTemp = strTemp & "		<td class=""tabletitle1"" title=""总数"">&nbsp;" & totalnumber & "&nbsp;</td>" & vbNewLine
	strTemp = strTemp & "		<td class=""tabletitle1"" title=""每页"">&nbsp;" & maxperpage & "&nbsp;</td>" & vbNewLine
	strTemp = strTemp & "		<td class=""tabletitle1"" title=""页次"">&nbsp;" & page & "/" & Pcount & "页&nbsp;</td>" & vbNewLine
	
	If page = 1 Then
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<img border=""0"" src=""" & ImagePath & "First.gif"" alt=""首页"" />&nbsp;</td>" & vbNewLine
	Else
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<a href=""?page=1" & strLink & """ title=""首页""><img border=""0"" src=""" & ImagePath & "First.gif"" /></a>&nbsp;</td>" & vbNewLine
	End If
	If p * b > 0 Then
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<a href=""?page="& p * b & strLink & """ title=""上" & s & "页""><img border=""0"" src=""" & ImagePath & "Previous.gif"" /></a>&nbsp;</td>" & vbNewLine
	Else
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<img border=""0"" src=""" & ImagePath & "Previous.gif"" />&nbsp;</td>" & vbNewLine
	End If
	
	For i = p * b + 1 To p * b + e
		
		If i = page Then
			strTemp = strTemp & "		<td class=""tablebody2"">&nbsp;<font class=""normalTextSmall""><u><b>" & i & "</b></u></font>&nbsp;</td>" & vbNewLine
		Else
			strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<a href=""?page=" & i & strLink & """ title=""第" & i & "页"">" & i & "</a>&nbsp;</td>" & vbNewLine
		End if
		If i = n Then Exit For
	Next
	
	If i < n Then
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<a href=""?page=" & i & strLink & """ title=""下" & s & "页""><img border=""0"" src=""" & ImagePath & "Next.gif"" /></a>&nbsp;<td>" & vbNewLine
	Else
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<img border=""0"" src=""" & ImagePath & "Next.gif"" />&nbsp;<td>" & vbNewLine
	End If

	If page = n Then
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<img border=""0"" src=""" & ImagePath & "Last.gif"" alt=""尾页"" />&nbsp;</td>" & vbNewLine
	Else
		strTemp = strTemp & "		<td class=""tablebody1"">&nbsp;<a href=""?page=" & n & strLink & """ title=""尾页""><img border=""0"" src=""" & ImagePath & "Last.gif"" /></a>&nbsp;</td>" & vbNewLine
	End If
	
	strTemp = strTemp & "		<td class=""tablebody1""><input class=""PageInput"" type=""text"" name=""page"" size=""1"" maxlength=""10"" value=""" & page & """></td>" & vbNewLine
	strTemp = strTemp & "		<td class=""tablebody1""><input type=""submit"" value=""Go"" name=""submit"" class=""button""></td>" & vbNewLine
	strTemp = strTemp & "	</tr>" & vbNewLine
	strTemp = strTemp & "	</form>" & vbNewLine
	strTemp = strTemp & "</table>" & vbNewLine
	showlistpage = strTemp
End Function

'页面加载
Public Sub LoadXsltPage(ByVal StyleFile)
	Dim XslDoc,Page_File
	Page_File = Server.MapPath(StyleFile)
	Set XslDoc=Server.CreateObject("Msxml2.FreeThreadedDOMDocument")
	If Not XslDoc.Load(Page_File) Then
		Response.Write "模板不存在"
		Response.End
		Exit Sub
	Else
		Set Page_Strings = XslDoc.DocumentElement.selectNodes("xsl:variable")
	End If
	Set XslDoc = Nothing
End Sub

Public Function Re_Replace(ByVal str,ByVal retxt,ByVal replacetxt)
	retxt = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(retxt, "[", "\["), "]", "\]"), "(", "\("), ")", "\)"), "$", "\$"), "^", "\^"), "{", "\{"), "}", "\}"), "+", "\+"), ".", "\.")
	Re.Pattern = retxt
	Re_Replace = Re.Replace(str,replacetxt)
End Function
%>