📄 cls_tag.asp
字号:
<%
Class Cls_Tag
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
Public Sub GetIndex()
Dim Action
Action=Trim(Request("Action"))
If Action="Upload" Then
If ClsPub.TW_Config(41)=1 Then ClsPub.CodeIsTrue
Dim Links,I
Links=Upload()
Links=Split(Links,"|")
ClsTemp.SetTemplateFile "link.html"
ClsTemp.UpdateBlock "links_block"
For i=0 To Ubound(Links)
ClsTemp.SetVariable "links",Links(i)
ClsTemp.ParseBlock "links_block"
Next
ClsPub.TW_OutPut=ReplacePubTag( ClsTemp.GetOutPut )
Else
If ClsPub.TW_Config(18)<=1 Then
ClsTemp.SetVariable "filenum","<input name=""upcount"" type=""hidden"" id=""upcount"" value=""1"" size=""4"" maxlength=""3"">"
ClsTemp.SetVariable "setnum",""
Else
ClsTemp.SetVariable "filenum","<input name=""upcount"" type=""text"" id=""upcount"" value=""1"" size=""4"" maxlength=""3"">"
ClsTemp.SetVariable "setnum","<input type=""button"" id=""setids"" name=""setids"" value="""&Language("Index",1)&""" onclick=""setid();"">"
End If
If ClsPub.TW_Config(41)=1 Then
ClsTemp.SetVariable "vcode",Language("Index",3)&":<input name=""CodeStr"" type=""text"" id=""CodeStr"">"&ClsPub.GetCode
Else
ClsTemp.SetVariable "vcode","<input name=""CodeStr"" type=""hidden"" id=""CodeStr"">"
End If
ClsTemp.SetVariable "maxfilenum",ClsPub.TW_Config(18)
ClsPub.TW_OutPut=ReplacePubTag(ClsTemp.GetOutPut)
End If
End Sub
Public Sub GetGet()
Dim Action,GetFileId
Action=Trim(Request("Action"))
GetFileId=ClsPub.SafeRequest(1,"Id",1,0,0)
If GetFileId="" Then
GetFileId=ClsPub.SafeRequest(2,"Id",1,0,0)
End If
If Action="Download" Then
If ClsPub.TW_Config(43)=1 Then ClsPub.CodeIsTrue
SysMsg=Language("Get",1)
If GetFileId="" Then Call ClsPub.Alert("?",0)
Dim Temp
Temp=ClsPub.DB_Query("Select Top 1 F_Ext,F_Path,F_ContentType,F_Size From TW_FilesList Where F_GetFileId='"&GetFileId&"'")
If IsArray(Temp) Then
Select Case ClsPub.TW_Config(44)
Case "1"
Call GetFileFrom(Temp(1,0),Temp(0,0),Temp(2,0),Temp(3,0))
Case "2"
Response.Redirect(Temp(1,0))
Case Else
If Clng(Temp(3,0))<"102400" Then
Call GetFileFrom(Temp(1,0),Temp(0,0),Temp(2,0),Temp(3,0))
Else
Response.Redirect(Temp(1,0))
End If
End Select
ClsPub.DB_Execute("Update TW_FilesList Set F_DownloadTimes=F_DownloadTimes+1 Where F_GetFileId='"&GetFileId&"'")
Else
SysMsg=Language("Get",2)
Call ClsPub.Alert("?",0)
End If
Else
ClsTemp.SetVariable "getfileid",GetFileId
If ClsPub.TW_Config(43)=1 Then
ClsTemp.SetVariable "vcode",Language("Index",3)&":<input name=""CodeStr"" type=""text"" id=""CodeStr"">"&ClsPub.GetCode
End If
End If
ClsPub.TW_OutPut=ReplacePubTag( ClsTemp.GetOutPut )
End Sub
Public Sub GetMyFiles()
Dim Action
Action=Trim(Request("Action"))
If Action="ClearCookie" Then
Call ClsPub.SetCookie("MyFiles","",Date()-ClsPub.TW_Config(47))
SysMsg=Language("MyFiles",1)
Call ClsPub.Alert("Index.asp",0)
Else
Dim ClsPage,UserCookieId
UserCookieId=ClsPub.SafeRequest(4,CacheName&"_MyFiles",1,0,0)
If Len(UserCookieId)>=12 Then
Dim Temp,i,MyItem,PageSize,FileCount,Page
Temp=ClsPub.DB_Query("Select F_GetFileId,F_AddTime From TW_FilesList Where F_UserCookieId='"&UserCookieId&"' Order By F_AddTime Desc")
If IsArray(Temp) Then
PageSize=ClsPub.TW_Config(50)
Page=Request.QueryString("Page")
If Page="" OR Not IsNumeric(Page) Then
Page=1
Else
Page=Int(Page)
End If
FileCount=Ubound(Temp,2)
ClsTemp.UpdateBlock "links_block"
For i=0 To FileCount
MyItem=MyItem+1
If MyItem>(Page-1)*PageSize And MyItem<=Page*Pagesize Then
ClsTemp.SetVariable "links",ClsPub.GetCurrentUrl&"Get.asp?Id="&Temp(0,i)
ClsTemp.SetVariable "addtime",Temp(1,i)
ClsTemp.ParseBlock "links_block"
ElseIf MyItem>Page*PageSize Then
Exit For
End If
Next
ClsTemp.SetVariable "showpage",ClsPub.PageList(Pagesize,FileCount+1,Page,"","")
End If
End If
ClsPub.TW_OutPut=ReplacePubTag( ClsTemp.GetOutPut )
End If
End Sub
Public Sub GetHelp()
With ClsTemp
.SetVariable "filesize",ClsPub.TW_Config(16)
.SetVariable "filetype",Replace(ClsPub.TW_Config(17),"|"," , ")
.SetVariable "maxfilenum",ClsPub.TW_Config(18)
.SetVariable "keep",ClsPub.TW_Config(42)
End With
ClsPub.TW_OutPut=ReplacePubTag( ClsTemp.GetOutPut )
End Sub
Private Function ReplacePubTag(StrContent)
StrContent=Replace(StrContent,"{{syspath}}",SysRoot)
StrContent=Replace(StrContent,"{{skinpath}}",ClsPub.SkinPath)
StrContent=Replace(StrContent,"{{sitename}}",ClsPub.TW_Config(0))
StrContent=Replace(StrContent,"{{sitetitle}}",ClsPub.TW_Config(1))
StrContent=Replace(StrContent,"{{siteurl}}",ClsPub.TW_Config(2))
StrContent=Replace(StrContent,"{{keywords}}",ClsPub.TW_Config(3))
StrContent=Replace(StrContent,"{{description}}",ClsPub.TW_Config(4))
StrContent=Replace(StrContent,"{{logo}}",ClsPub.TW_Config(5))
StrContent=Replace(StrContent,"{{banner}}",ClsPub.TW_Config(6))
StrContent=Replace(StrContent,"{{bottom}}",ClsPub.TW_Config(7))
StrContent=Replace(StrContent,"{{email}}",ClsPub.TW_Config(9))
StrContent=Replace(StrContent,"{{vcode}}","")
StrContent=Replace(StrContent,"{{links}}",Language("MyFiles",2))
StrContent=Replace(StrContent,"{{showpage}}","")
StrContent=Replace(StrContent,"{{addtime}}","")
StrContent=Replace(StrContent,"{{textad}}",AdLink("TextAd"))
StrContent=Replace(StrContent,"{{logoad}}",AdLink("LogoAd"))
ReplacePubTag=StrContent
End Function
Private Function Upload()
ClsPub.Chk_Post()
ClsPub.SysConfig()
Dim FormName,F_FileName,F_Viewname,IsCreatePreview,IsCreateLogoBox,FilePath,PreviewPath,UserCookieId
ClsUp.UpLoadType=ClsPub.TW_Config(14) '上传组件类型
ClsUp.PreviewType=ClsPub.TW_Config(15) '缩略图/水印组件
ClsUp.MaxSize=ClsPub.TW_Config(16) '文件大小限制
ClsUp.InceptFileType=Trim(ClsPub.TW_Config(17)) '文件类型限制
ClsUp.InceptMaxFile=ClsPub.TW_Config(18) '上传总大小限制
If ClsPub.TW_Config(19)<>"0" Then
ClsUp.RName=ClsPub.TW_Config(19) '设置文件名前缀
End If
ClsUp.AutoDir=ClsPub.TW_Config(20) '文件目录创建方式
ClsUp.FormatType=ClsPub.TW_Config(21) '定义文件命名方法
ClsUp.SetRanNums=ClsPub.TW_Config(22) '定义提取文件的ID随机数
FilePath=ClsUp.CreatePath(0,ClsPub.TW_Config(23))
ClsUp.UpLoadPath=FilePath '文件保存路径
PreviewPath=ClsUp.CreatePath(1,ClsPub.TW_Config(24)) '预览图片保存路径
ClsUp.DrawType=ClsPub.TW_Config(25) ' 0=不加载水印 ,1=加载水印文字,2=加载水印图片
ClsUp.PreviewImageWidth=ClsPub.TW_Config(26) ' 设置预览图片宽度
ClsUp.PreviewImageHeight=ClsPub.TW_Config(27) ' 设置预览图片高度
ClsUp.DrawSizeType=ClsPub.TW_Config(28) ' "0"=固定缩小,"1"=等比例缩小
ClsUp.DrawFontSize=ClsPub.TW_Config(30) ' 设置水印文字字体大小
ClsUp.DrawFontColor=ClsPub.TW_Config(31) ' 设置水印文字颜色
ClsUp.DrawFontFamily=ClsPub.TW_Config(32) ' 设置水印文字字体格式
ClsUp.DrawFontBold=ClsPub.TW_Config(33) ' 设置水印文字是否粗体
If ClsPub.TW_Config(25)=1 Then
ClsUp.DrawInfo=ClsPub.TW_Config(29) ' 设置水印文字信息
ElseIf ClsPub.TW_Config(25)=2 Then
ClsUp.DrawInfo=SysPath&ClsPub.TW_Config(34) ' 设置水印图片信息
End If
ClsUp.DrawGraph=ClsPub.TW_Config(35) ' 设置水印透明度
ClsUp.TransitionColor=ClsPub.TW_Config(36) ' 透明度颜色设置 水印图片去除底色
ClsUp.DrawImageWidth=ClsPub.TW_Config(37) ' 设置水印图片或文字区域宽度
ClsUp.DrawImageHeight=ClsPub.TW_Config(38) ' 设置水印图片或文字区域高度
ClsUp.DrawXYType=ClsPub.TW_Config(39) ' "0"=左上,"1"=左下,"2"=居中,"3"=右上,"4"=右下
ClsUp.SaveUpFile '执行上传
If ClsUp.Count > 0 Then
If ClsPub.TW_Config(40)=1 Then
IsCreatePreview=True
Else
IsCreatePreview=False
End If
If ClsPub.TW_Config(25)=0 Then
IsCreateLogoBox=False
Else
IsCreateLogoBox=True
End If
If ClsPub.TW_Config(47)=1 Then
UserCookieId=ClsPub.SafeRequest(4,CacheName&"_MyFiles",1,0,0)
If Len(UserCookieId)<12 Then
UserCookieId=ClsPub.CreateId(2,ClsPub.TW_Config(49))
End If
Else
UserCookieId=""
End If
For Each FormName In ClsUp.UpLoadFiles
Set File = ClsUp.UpLoadFiles(FormName)
F_FileName = FilePath & File.FileName
F_Viewname = ""
If IsCreatePreview=True Or IsCreateLogoBox=True Then
If ClsUp.PreviewType <> 999 And File.FileType = 1 Then
F_Viewname = PreviewPath & "Pre" & Replace(File.FileName, File.FileExt, "") & "jpg"
Call ClsUp.CreateView(F_FileName, F_Viewname, File.FileExt,IsCreatePreview,IsCreateLogoBox)
End If
End If
ClsPub.DB_Execute("Insert Into TW_FilesList(F_Type,F_Ext,F_Path,F_PrePath,F_ContentType,F_Size,F_Width,F_Height,F_GetFileId,F_UserCookieId,F_AddTime,F_UserIp)Values("&File.FileType&",'"&File.FileExt&"','"&FilePath&File.FileName&"','"&F_Viewname&"','"&Lcase(File.FileContentType)&"','"&File.FileSize&"',"&File.FileWidth&","&File.FileHeight&",'"&File.GetFileId&"','"&UserCookieId&"',"&SqlNowString&",'"&ClsPub.Get_UserIp&"')")
TempValue=TempValue&ClsPub.GetCurrentUrl&"Get.asp?Id="&File.GetFileId&"|"
Set File = Nothing
Next
If Trim(ClsPub.TW_Config(14))<>"0" Then
Call ClsPub.SetCookie("MyFiles",UserCookieId,Date()+ClsPub.TW_Config(48))
End If
Upload=TempValue
Else
SysMsg=ClsUp.Description
If SysMsg="" Then
SysMsg=Language("Public",15)
End If
Call ClsPub.Alert("Back",0)
End If
End Function
Private Sub GetFileFrom(FilePath,FileExt,FileContentType,FileSize)
Dim sFilePath,FileStream,File,IsAttachment,FileNameString
If ClsPub.TW_Config(45)=1 Then
Dim Server_V1,Server_V2
Server_V1=Cstr(Request.ServerVariables("HTTP_REFERER"))
Server_V2=Cstr(Request.ServerVariables("SERVER_NAME"))
If Mid(Server_V1,8,Len(Server_V2))<>Server_V2 Then
FilePath=ClsPub.TW_Config(46)
End If
End If
FileNameString=ClsPub.TW_Config(19)&ClsPub.CreateId(0,0)
Set FileStream = Server.CreateObject(ServerObject_003)
FileStream.Open
FileStream.Type = 1
File = Server.MapPath(FilePath)
FileStream.LoadFromFile(File)
FileContentType = Trim(FileContentType)
If FileContentType <> "image/gif" And FileContentType <> "image/pjpeg" And FileContentType <> "image/jpeg" Then
IsAttachment = "attachment; "
Else
IsAttachment = ""
End If
Response.AddHeader "Content-Disposition", IsAttachment & "filename=" & FileNameString&"."&FileExt
Response.AddHeader "Content-Length", FileSize
Response.Charset = "gb2312"
Response.ContentType = FileContentType
If Lcase(FileExt)="gif" Then
Server.Execute(FilePath)
Else
Response.BinaryWrite FileStream.Read
End If
Response.Flush
FileStream.Close
Set FileStream = Nothing
If Err.Number <> 0 Then
Err.Clear
Server.Execute(Server.MapPath(ClsPub.TW_Config(46)))
Response.End()
End If
End Sub
Private Function AdLink(LinkType)
If Clng(ClsPub.TW_Config(51))=0 Then
AdLink=""
Exit Function
End If
Dim Temp,i,TempHtml,TableRows
ClsPub.Name=LinkType
If ClsPub.ObjIsEmpty() Then
If LinkType="TextAd" Then
ClsPub.Value=ClsPub.DB_Query("Select SiteName,SiteUrl,SiteDescribe From TW_FriendLink Where FType=1 And IsOpen=-1")
Else
ClsPub.Value=ClsPub.DB_Query("Select SiteName,SiteUrl,LogoUrl,SiteDescribe From TW_FriendLink Where FType=0 And IsOpen=-1")
End If
End If
Temp=ClsPub.Value
If Not IsArray(Temp) Then
AddLink=""
Exit Function
End If
TempHtml="<table border=""0"" width=""100%""><tr>"&Chr(10)
If LinkType="TextAd" Then
TableRows=Split(ClsPub.TW_Config(52),"*")
For i=0 TO Ubound(Temp,2)
TempHtml=TempHtml&"<td class=""textad""><a href="&Temp(1,i)&" title="&Temp(2,i)&">"&Temp(0,i)&"</a></td>"&Chr(10)
If (i+1) Mod TableRows(1)=0 Then TempHtml=TempHtml&"</tr><tr>"
If (i+1)*TableRows(1)>=TableRows(1)*TableRows(0) Then Exit For
Next
Else
Dim LogoWH
TableRows=Split(ClsPub.TW_Config(53),"*")
LogoWH=Split(ClsPub.TW_Config(54),"*")
For i=0 TO Ubound(Temp,2)
TempHtml=TempHtml&"<td class=""logoad""><a href="&Temp(1,i)&" title="&Temp(3,i)&"><img src="&Temp(2,i)&" border=0 width="""&LogoWH(0)&""" height="""&LogoWH(1)&"""></a></td>"&Chr(10)
If (i+1) Mod TableRows(1)=0 Then TempHtml=TempHtml&"</tr><tr>"
If (i+1)*TableRows(1)>=TableRows(1)*TableRows(0) Then Exit For
Next
End If
TempHtml=TempHtml&"</tr></table>"
AdLink=TempHtml
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -