📄 view.asp
字号:
<%
Class ImplMocomWAPmoWAPView
Private objMatter
Private strReferer
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
Public Sub main()
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Call doPost
Else
Call doGet
End If
End Sub
Private Sub doGet()
Dim intType
Dim hexMatter
intType = atoi(Request.QueryString("Type"))
hexMatter = Request.QueryString("Matter")
strReferer = Request.QueryString("Referer")
If strReferer = "" Then strReferer = "index.asp"
Set objMatter = MyKernel.Table(T_MATTER)
If Not objMatter.Execute("*", "MARK=" & atol("&H" & hexMatter)) Then
MyRedirect strReferer
ElseIf objMatter("Hidden") = 1 Then
MyRedirect strReferer
Else
Call ExportMatter
End If
Set objMatter = Nothing
End Sub
Private Sub doPost()
End Sub
Private Sub ExportMatter()
Dim strExt1, strExt2
Dim strPath1, strPath2
Dim strExt
Dim intWidth, intHeight
Dim fso
Dim blnDownload
Set fso = vbsre.mocom.util.com.forName("Scripting.FileSystemObject")
strExt = Request.QueryString("Ext")
intWidth = atoi(Request.QueryString("Width"))
intHeight = atoi(Request.QueryString("Height"))
blnDownload = False
If objMatter("Category") = wmTypeImage Then
strExt1 = objMatter("Ext")
strExt2 = getImageExt(strExt1)
strPath1 = getMatterFile(objMatter("Category"), objMatter("Intime"), objMatter("Mark"), strExt1)
strPath2 = getMatterCacheFile(objMatter("Category"), objMatter("Intime"), objMatter("Mark"), "D", strExt2)
If Not fso.FileExists(getMapPath(strPath1)) Then
'pass
ElseIf ImageConvert(getMapPath(strPath1), getMapPath(strPath2)) Then
If intWidth <= 0 Or intHeight <= 0 Then
If MyKernel.Modlist(16) = "1" Then
If Not getUAConfig(intWidth, intHeight) Then
intWidth = objMatter("Width")
intHeight = objMatter("Height")
End If
Else
intWidth = objMatter("Width")
intHeight = objMatter("Height")
End If
ElseIf intWidth > atoi(MyKernel.Config("KeepWidth")) Or intHeight > atoi(MyKernel.Config("KeepHeight")) Then
intWidth = objMatter("Width")
intHeight = objMatter("Height")
End If
ImageResize1 getMapPath(strPath2), intWidth, intHeight
End If
ElseIf UCase(strExt) = "JAD" Then
strPath2 = getMatterFile(objMatter("Category"), objMatter("Intime"), objMatter("Mark"), "jad")
Else
strPath2 = getMatterFile(objMatter("Category"), objMatter("Intime"), objMatter("Mark"), objMatter("Ext"))
End If
If fso.FileExists(getMapPath(strPath2)) Then
If MyKernel.Config("DownloadType") <> "1" Then
blnDownload = ExportFile(getMapPath(strPath2))
Else
blnDownload = True
End If
End If
Set fso = Nothing
If blnDownload Then
Call doLog("download", objMatter("SeqId"), strReferer)
If MyKernel.Config("DownloadType") = "1" Then
MyRedirect strPath2
End If
Else
MyRedirect strReferer
End If
End Sub
Private Function getUAConfig(ByRef intWidth, ByRef intHeight)
getUAConfig = False
Dim strUA
strUA = Request.ServerVariables("HTTP_USER_AGENT")
If strUA = "" Then Exit Function
Dim rs, strSQL
strSQL = getLimitSQL(1, "ImageWidth,ImageHeight", T_USER_AGENT, "MobileFace LIKE '%$(UserAgent)%'", "", "")
strSQl = Replace(strSQL, "$(UserAgent)", SafeString(strUA))
Set rs = MyKernel.DB.Execute(strSQL)
getUAConfig = CBool(rs.EOF = False)
If getUAConfig Then
ingWidth = atoi(rs("ImageWidth"))
ingHeight = atoi(rs("ImageHeight"))
End If
rs.Close
Set rs = Nothing
End Function
Private Function getMIMEType(ByVal strPath)
Dim objMIME
Set objMIME = getMIME()
Dim objNode
Set objNode = objMIME.documentElement.selectSingleNode("mime_" & LCase(getFileExt(strPath)))
If TypeName(objNode) <> "Nothing" Then
getMIMEType = objNode.Text
Else
getMIMEType = "application/octet-stream"
End If
Set objMIME = Nothing
End Function
Private Function ExportFile(ByVal strPath)
Dim objFile
Dim lngSize, lngChunk
Set objFile = Server.CreateObject("ADODB.Stream")
objFile.Type = adTypeBinary
objFile.Open
objFile.LoadFromFile strPath
lngSize = objFile.Size
lngChunk = KBYTE * 200
Response.ContentType = getMIMEType(strPath)
Response.AddHeader "Content-Length", lngSize
Do While lngSize > 0
If Not Response.IsClientConnected Then Exit Do
If lngSize > lngChunk Then
Response.BinaryWrite objFile.Read(lngChunk)
Else
Response.BinaryWrite objFile.Read(lngSize)
End If
Response.Flush
lngSize = lngSize - lngChunk
Loop
objFile.Close
Set objFile = Nothing
ExportFile = True
End Function
Public Function newInstance()
Set newInstance = New ImplMocomWAPmoWAPView
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -