<!-- #include File="../Start.asp" -->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

'强制浏览器重新访问服务器下载页面，而不是从缓存读取页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"

Dim ChannelID, ShowType
Dim FilesPath, sql, rs
Dim AdminName,UserPassword,LastPassword
Dim sqlChannel,rsChannel
Dim ModuleType,DialogType,IsUpload,Anonymous


AdminName = ReplaceBadChar(Trim(request.Cookies(Site_Sn)("AdminName")))
UserName = ReplaceBadChar(Trim(request.Cookies(Site_Sn)("UserName")))
UserPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("UserPassword")))
LastPassword = ReplaceBadChar(Trim(Request.Cookies(Site_Sn)("LastPassword")))

ChannelID = Trim(request("ChannelID"))
ShowType = SQ_Clng(Trim(request("ShowType")))
Anonymous = SQ_Clng(Trim(request("Anonymous")))


If ChannelID = "" Then
    response.write "频道参数丢失！"
    response.End
Else
    ChannelID = SQ_CLng(ChannelID)
End If

If AdminName = "" And UserName = "" And Anonymous = 0  Then
    Response.Write "请先登录后再使用此功能！"
    Response.End
ElseIf Anonymous = 1 Then
    If ShowAnonymous = True Then
        Dim  rsGroup
        Set rsGroup = Conn.Execute("select * from SQ_UserGroup where GroupID=-1")
        arrClass_Input = Trim(rsGroup("arrClass_Input"))
        UserSetting = Split(Trim(rsGroup("GroupSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
        rsGroup.Close
        Set rsGroup = Nothing	
        If SQ_CBool(SQ_CLng(UserSetting(9))) = True Then
            IsUpload = True
        Else
            IsUpload = False	
        End If
    Else
        IsUpload = False			
    End If 
Else
    If AdminName <> "" And (ShowType=0 or ShowType=4 or ShowType=5) Then
        IsUpload = True
    ElseIf UserName <> "" Then
        If (UserName = "" Or UserPassword = "" Or LastPassword = "") Then
            IsUpload = False
        Else
            sql = "SELECT U.UserID,U.SpecialPermission,U.UserSetting,G.GroupSetting FROM SQ_User U inner join SQ_UserGroup G on U.GroupID=G.GroupID WHERE"
            sql = sql & " UserName='" & UserName & "' AND UserPassword='" & UserPassword & "' AND LastPassword='" & LastPassword & "' and IsLocked=" & SQ_False & ""
            Set rs = Conn.Execute(sql)
            If rs.BOF And rs.EOF Then
                IsUpload = False
            Else
                If rs("SpecialPermission") = True Then
                    UserSetting = Split(Trim(rs("UserSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
                Else
                    UserSetting = Split(Trim(rs("GroupSetting")) & ",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",")
                End If
                If CBool(SQ_CLng(UserSetting(9))) = True Then
                    IsUpload = True
                End If
            End If
            Set rs = Nothing
        End If
    End If
End If

If SQ_Clng(ChannelID) < 0 Then
    Select Case SQ_Clng(ChannelID)
    Case -1
        IsUpload = True
    Case -2
        IsUpload = True
    Case -3
        IsUpload = True
    End Select
Else

    sqlChannel = "select ChannelDir,UploadDir,Disabled,EnableUploadFile,ModuleType from SQ_Channel where ChannelID=" & SQ_Clng(ChannelID)
    Set rsChannel = Server.CreateObject("adodb.recordset")
    rsChannel.Open sqlChannel, Conn, 1, 1
    If rsChannel.BOF And rsChannel.EOF Then
        IsUpload = False
    Else
        If rsChannel("Disabled") = True Then
            IsUpload = False
        Else
            If rsChannel("EnableUploadFile") = False Then
                IsUpload = False
            End If
            FilesPath = InstallDir & rsChannel("ChannelDir") & "/" & rsChannel("UploadDir") & "/"
            ModuleType = rsChannel("ModuleType")
        End If
    End If
    rsChannel.Close
    Set rsChannel = Nothing
    If IsUpload = True Then
        Select Case ModuleType
        Case 1, 2, 3, 4, 5, 6, 7, 8 
            IsUpload = True
        Case Else
            IsUpload = False
        End Select
    End If
End If

Call CloseConn

%>