cls_public.asp

来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 1,482 行 · 第 1/5 页

ASP
1,482
字号
<!--#include file="classmenu.asp"-->
<%
Dim HTML
Set HTML = New NewaspPublic_Cls
Class NewaspPublic_Cls
	Public CurrentClass,ThisHtmlPath,FirstCalss,ParentClass
	
	Private Sub Class_Initialize()
		On Error Resume Next
		Newasp.LoadTemplates 0, 0, 0
	End Sub
	'================================================
	'函数名:LoadArticleList
	'作  用:装载文章列表
	'参  数:ClassID   ----分类ID
	'        ChannelID   ----频道ID
	'        SpecialID  ----专题ID
	'        sType   ----调用文章类型,0=所有最新文章,1=推荐文章,2=热门文章,3=图文文章,4=分类最新文章
	'        TopNum   ----显示文章列表数
	'        strlen   ----显示标题长度
	'        ShowClass   ----是否显示分类
	'        ShowPic   ----是否显示图文标题
	'        ShowDate   ----是否显示日期
	'        DateMode   ----显示日期模式
	'        newindow   ----新窗口打开
	'================================================
	Public Function LoadArticleList(ByVal ChannelID, ByVal ClassID, ByVal SpecialID, _
		ByVal stype, ByVal TopNum, ByVal strLen, _
		ByVal showclass, ByVal showpic, ByVal showdate, _
		ByVal DateMode, ByVal newindow, ByVal styles)
		
		Dim Rs, SQL, i, strContent, foundstr
		Dim sTitle, sTopic, ChildStr, ListStyle, BestCode, BestString, ClassLength
		Dim ArticleTopic, ClassName, HtmlFileUrl, WriteTime, LinkTarget, HtmlFileName

		ChannelID = Newasp.ChkNumeric(ChannelID)
		ClassID = Newasp.ChkNumeric(ClassID)
		SpecialID = Newasp.ChkNumeric(SpecialID)
		stype = Newasp.ChkNumeric(stype)
		
		Newasp.LoadChannel(ChannelID)
		
		If CLng(ClassID) > 0 Then
			SQL = "SELECT ChildStr FROM [NC_Classify] WHERE ChannelID=" & ChannelID & " And ClassID=" & ClassID
			Set Rs = Newasp.Execute(SQL)
			If Rs.BOF And Rs.EOF Then
				Set Rs = Nothing
				LoadArticleList = ""
				Exit Function
			Else
				ChildStr = Rs("ChildStr")
			End If
			Set Rs = Nothing
		Else
			ChildStr = "0"
		End If
		
		Select Case CInt(stype)
			Case 0,4: foundstr = "ORDER BY A.Writetime DESC ,A.Articleid DESC"
			Case 1,5: foundstr = "And A.isBest > 0 ORDER BY A.Writetime DESC ,A.Articleid DESC"
			Case 2,6: foundstr = "ORDER BY A.AllHits DESC ,A.Articleid DESC"
			Case 3,7: foundstr = "And (A.BriefTopic = 1 Or A.BriefTopic = 2) ORDER BY A.Writetime DESC ,A.Articleid DESC"
			Case 9
			If IsSqlDataBase = 1 Then
				foundstr = "ORDER BY newid()"
			Else
				foundstr = "ORDER BY rnd(A.Articleid)"
			End If
		Case Else
			foundstr = "ORDER BY A.Writetime DESC ,A.Articleid DESC"
		End Select
		If CLng(ClassID) > 0 Then
			foundstr = "And A.ClassID in (" & ChildStr & ") " & foundstr
		End If
		If CLng(SpecialID) > 0 Then
			foundstr = "And A.SpecialID =" & CLng(SpecialID) & " " & foundstr
		End If
		SQL = " A.ArticleID,A.ClassID,A.ColorMode,A.FontMode,A.title,A.BriefTopic,A.AllHits,A.WriteTime,A.HtmlFileDate,A.isBest,"
		SQL = "SELECT Top " & CInt(TopNum) & SQL & " C.ClassName,C.ColorModes,C.FontModes,C.HtmlFileDir,C.UseHtml FROM [NC_Article] A INNER JOIn [NC_Classify] C ON A.ClassID=C.ClassID WHERE A.isAccept>0 And A.ChannelID=" & ChannelID & " " & foundstr & ""
		Set Rs = Newasp.Execute(SQL)
		i = 0
		If Rs.BOF And Rs.EOF Then
			strContent = "<li>该分类还没有添加任何内容!</li>"
		Else
			strContent = ""
			Do While Not Rs.EOF
				If (i Mod 2) = 0 Then
					ListStyle = Trim(styles) & 1
				Else
					ListStyle = Trim(styles) & 2
				End If
				If Rs("isBest") <> 0 Then
					BestCode = 2
					BestString = "<font color=""" & Newasp.MainSetting(3) & """>推荐</font>"
				Else
					BestCode = 1
					BestString = ""
				End If
				
				strContent = strContent & Newasp.MainSetting(13)
				If showclass > 0 Then
					ClassLength = Newasp.strLength(Rs("ClassName"))
				Else
					ClassLength = 0
				End If
				sTopic = Newasp.ReadPicTopic(Rs("BriefTopic"))
				If CInt(showpic) = 0 Then sTopic = ""
				
				If Len(sTopic) = 0 Then
					sTitle = Newasp.GotTopic(Rs("title"), CInt(strLen) - ClassLength)
				Else
					sTitle = Newasp.GotTopic(Rs("title"), CInt(strLen) - 6 - ClassLength)
				End If
				sTitle = Newasp.ReadFontMode(sTitle, Rs("ColorMode"), Rs("FontMode"))
				
				ClassName = Newasp.ReadFontMode(Rs("ClassName"), Rs("ColorModes"), Rs("FontModes"))
				If CInt(Newasp.ChannelUseHtml) <> 0 Then
					HtmlFileUrl = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_InfoDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("ArticleID"),1,"")
					HtmlFileName = Newasp.ChannelDomain & Newasp.ReadDestination(Newasp.m_SortDestination, Newasp.m_ChannelDir, Rs("HtmlFileDate"),Rs("HtmlFileDir"),Rs("ClassID"),Rs("ArticleID"),1,"")
					ClassName = "<a href=""" & HtmlFileName & """>" & ClassName & "</a>"
				Else
					If IsURLRewrite Then
						HtmlFileUrl = Newasp.ChannelPath & Rs("ArticleID") & Newasp.ChannelHtmlExt
						ClassName = "<a href=""" & Newasp.ChannelPath & "list_1_" & Rs("ClassID") & Newasp.ChannelHtmlExt & """>" & ClassName & "</a>"
					Else
						HtmlFileUrl = Newasp.ChannelPath & "show.asp?id=" & Rs("ArticleID")
						ClassName = "<a href=""" & Newasp.ChannelPath & "list.asp?classid=" & Rs("ClassID") & """>" & ClassName & "</a>"
					End If
				End If
				
				If CInt(showclass) = 0 Then ClassName = ""
				
				If CInt(showdate) <> 0 Then
					WriteTime = Newasp.ShowDateTime(Rs("WriteTime"), CInt(DateMode))
				Else
					WriteTime = ""
				End If
				If CInt(newindow) <> 0 Then
					LinkTarget = " target=""_blank"""
				Else
					LinkTarget = ""
				End If
				ArticleTopic = "<a href=""" & HtmlFileUrl & """" & LinkTarget & LoadRemark(Rs("title")) &">" & sTitle & "</a>"
				strContent = Replace(strContent, "{$ArticleTopic}", ArticleTopic)
				strContent = Replace(strContent, "{$ArticleID}", Rs("ArticleID"))
				strContent = Replace(strContent, "{$InstallDir}", Newasp.InstallDir)
				strContent = Replace(strContent, "{$ArticleTitle}", sTitle)
				strContent = Replace(strContent, "{$Title}", Rs("title"))
				strContent = Replace(strContent, "{$DateAndTitle}", Rs("WriteTime"))
				strContent = Replace(strContent, "{$BriefTopic}", sTopic)
				'strContent = Replace(strContent, "{$BriefTopic}", "")
				strContent = Replace(strContent, "{$HtmlFileUrl}", HtmlFileUrl)
				strContent = Replace(strContent, "{$ClassName}", ClassName)
				strContent = Replace(strContent, "[]", "")
				strContent = Replace(strContent, "{$Target}", LinkTarget)
				strContent = Replace(strContent, "{$WriteTime}", WriteTime)
				strContent = Replace(strContent, "{$AticleHits}", Rs("AllHits"))
				strContent = Replace(strContent, "{$ListStyle}", ListStyle)
				strContent = Replace(strContent, "{$BestCode}", BestCode)
				strContent = Replace(strContent, "{$BestString}", BestString)
				Rs.MoveNext
				i = i + 1
				strContent = Replace(strContent, "{$OrderID}", i) & vbNewLine
			Loop
		End If
		
		Rs.Close: Set Rs = Nothing
		LoadArticleList = strContent
	End Function
	'================================================
	'函数名:ReadArticleList
	'作  用:读取文章列表
	'参  数:str ----原字符串
	'================================================
	Public Function ReadArticleList(ByVal str)
		Dim strTemp, i
		Dim sTempContent, nTempContent
		Dim arrTempContent, arrTempContents, ArrayList
		strTemp = str
		If InStr(strTemp, "{$ReadArticleList(") > 0 Then
			sTempContent = Newasp.CutMatchContent(strTemp, "{$ReadArticleList(", ")}", 1)
			nTempContent = Newasp.CutMatchContent(strTemp, "{$ReadArticleList(", ")}", 0)
			arrTempContents = Split(sTempContent, "|||")
			arrTempContent = Split(nTempContent, "|||")
			
			For i = 0 To UBound(arrTempContents)
				ArrayList = Split(arrTempContent(i), ",")
				strTemp = Replace(strTemp, arrTempContents(i), LoadArticleList(ArrayList(0), ArrayList(1), ArrayList(2), ArrayList(3), ArrayList(4), ArrayList(5), ArrayList(6), ArrayList(7), ArrayList(8), ArrayList(9), ArrayList(10), ArrayList(11)))
			Next
		End If
		ReadArticleList = strTemp
	End Function
	'================================================
	'函数名:LoadSoftList
	'作  用:装载软件列表
	'参  数:ClassID   ----分类ID
	'        ChannelID   ----频道ID
	'        sType   ----调用类型
	'        TopNum   ----显示列表数
	'        strlen   ----显示标题长度
	'        ShowClass   ----是否显示分类
	'        ShowDate   ----是否显示日期
	'        DateMode   ----显示日期模式
	'        newindow   ----新窗口打开
	'================================================
	Public Function LoadSoftList(ByVal ChannelID, ByVal ClassID, ByVal SpecialID, _
		ByVal stype, ByVal TopNum, ByVal strLen, ByVal showclass, _
		ByVal showdate, ByVal DateMode, ByVal newindow, ByVal styles, ByVal strType,ByVal intDirect)
		
		Dim Rs, SQL, i, strContent, foundstr,j
		Dim strSoftName, ChildStr, ListStyle, ClassLength
		Dim HtmlFileName, BestCode, BestString,ChannelPath
		Dim ClassName, HtmlFileUrl, SoftTime, LinkTarget, SoftTopic,iNewindow
		
		ChannelID = Newasp.ChkNumeric(ChannelID)
		ClassID = Newasp.ChkNumeric(ClassID)
		SpecialID = Newasp.ChkNumeric(SpecialID)
		stype = Newasp.ChkNumeric(stype)
		intDirect = Newasp.ChkNumeric(intDirect)
		iNewindow = Newasp.ChkNumeric(newindow)
		strType = Replace(Trim(strType), "'", "")
		Newasp.LoadChannel(ChannelID)
		
		If CLng(ClassID) > 0 Then
			SQL = "SELECT ChildStr FROM [NC_Classify] WHERE ChannelID=" & ChannelID & " And ClassID = " & ClassID
			
			Set Rs = Newasp.Execute(SQL)
			If Rs.BOF And Rs.EOF Then
				Set Rs = Nothing
				LoadSoftList = ""
				Exit Function
			Else
				ChildStr = Rs("ChildStr")
			End If
			Rs.Close
		Else
			ChildStr = 0
		End If
		Select Case CInt(stype)
			Case 0,3: foundstr = "ORDER BY A.SoftTime DESC ,A.softid DESC"
			Case 1,4: foundstr = "And A.isBest>0 ORDER BY A.SoftTime DESC ,A.softid DESC"
			Case 2,5: foundstr = "ORDER BY A.AllHits DESC ,A.softid DESC"
			Case 9
			If IsSqlDataBase = 1 Then
				foundstr = "ORDER BY newid()"
			Else
				foundstr = "ORDER BY rnd(A.softid)"
			End If
		Case Else
			foundstr = "ORDER BY A.SoftTime DESC ,A.softid DESC"
		End Select
		If CLng(ClassID) > 0 Then
			foundstr = "And A.ClassID in (" & ChildStr & ") " & foundstr
		End If
		If Len(strType) > 1 Then
			foundstr = "And A.SoftType='" & strType & "' " & foundstr
		End If
		If CLng(SpecialID) > 0 Then
			foundstr = "And A.SpecialID =" & CLng(SpecialID) & " " & foundstr
		End If
		
		SQL = " A.softid,A.ClassID,A.ColorMode,A.FontMode,A.SoftName,A.SoftVer,A.AllHits,A.SoftTime,A.HtmlFileDate,A.isBest,A.OuterLinks,A.Regsite,"
		SQL = "SELECT TOP " & CInt(TopNum) & SQL & " C.ClassName,C.ColorModes,C.FontModes,C.HtmlFileDir,C.UseHtml FROM [NC_SoftList] A INNER JOIN [NC_Classify] C On A.ClassID=C.ClassID WHERE A.isAccept>0 And A.ChannelID=" & ChannelID & " " & foundstr & ""
		Set Rs = Newasp.Execute(SQL)
		j = 0
		
		If Rs.BOF And Rs.EOF Then
			strContent = "<li>没有添加任何软件!</li>"
		Else
			SQL=Rs.GetRows(-1)
			strContent = ""
			For i=0 To Ubound(SQL,2)
				If (j Mod 2) = 0 Then
					ListStyle = Trim(styles) & 1
				Else
					ListStyle = Trim(styles) & 2
				End If
				If CInt(SQL(9,i)) <> 0 Then
					BestCode = 2
					BestString = "<font color=""" & Newasp.MainSetting(3) & """>推荐</font>"
				Else
					BestCode = 1
					BestString = ""
				End If
				If showclass > 0 Then
					ClassLength = Newasp.strLength(SQL(12,i))
				Else
					ClassLength = 0
				End If
				strContent = strContent & Newasp.MainSetting(14)
				strSoftName = Newasp.GotTopic(Trim(SQL(4,i) & " " & SQL(5,i)), CInt(strLen) - ClassLength)
				strSoftName = Newasp.ReadFontMode(strSoftName, SQL(2,i), SQL(3,i))
				ClassName = Newasp.ReadFontMode(SQL(12,i), SQL(13,i), SQL(14,i))
				If intDirect = 1 And Len(SQL(11,i) & "") > 5 Then
					If InStr(SQL(11,i), "://") > 0 Then
						HtmlFileUrl = Trim(SQL(11,i))
					Else

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?