%
Dim deletefile:deletefile = CheckDelimitedFormat(request.queryString("deletefile"),"|")
Dim appid:appid = request.queryString("appid")
Dim memori:memori = request.queryString("memori")
Dim allforum, forumid, strSQL, objRS, UpRestriction, temparr, isUploadAllowed, memAllowSigpic, PMUpload, mode,profileUpload,avatarUpload
Dim calendarID:calendarID = request.querystring("calendarID")
isUploadAllowed = true
mode = request.queryString("mode")
Dim maxnumupload:maxnumupload = iff(len(""&request.querystring("maxnumupload")),request.querystring("maxnumupload"),1)
Dim i
'response.write maxnumupload
SELECT Case mode
Case "cal"
Dim objCalendar
Set objCalendar = new calClass
With objCalendar
.calendarID = calendarID
.mem = memID
.getPermission
UpLoadSizeLimit = .uploadSize
uploadformat = .uploadFormat
end with
Set objCalendar = nothing
if UploadSizeLimit = "0" or len(UploadSizeLimit) = 0 then isUploadAllowed = false
if len(uploadformat) = 0 then isUploadAllowed = false
Case "sig"
set objRS = server.createobject("adodb.recordset")
With objRS
.open "SELECT allowSigpicture FROM pgd_members WHERE mem="&Clng(memID), datastore, , , adCmdText
memAllowSigpic = objRS(0)
.close
End With
set objRS = nothing
if Application(dbName&"allowsigupload") = 0 or memAllowSigpic = 0 then response.end
set objRS = server.createobject("adodb.recordset")
With objRS
.open "SELECT avatarUpload FROM pgd_Config", datastore, , , adCmdText
avatarUpload = split(objRS(0),"|")
.close
End With
set objRS = nothing
UpLoadSizeLimit = avatarUpload(0)
uploadformat = avatarUpload(1)
if UploadSizeLimit = "0" or len(UploadSizeLimit) = 0 then isUploadAllowed = false
if len(uploadformat) = 0 then isUploadAllowed = false
Case "PM"
set objRS = server.createobject("adodb.recordset")
With objRS
.open "SELECT PMUpload FROM pgd_Config", datastore, , , adCmdText
PMUpload = split(objRS(0),"|")
.close
End With
set objRS = nothing
UpLoadSizeLimit = PMUpload(0)
uploadformat = PMUpload(1)
if UploadSizeLimit = "0" or len(UploadSizeLimit) = 0 then isUploadAllowed = false
if len(uploadformat) = 0 then isUploadAllowed = false
Case "prof"
if Application(dbName&"allowProfPhoto") < 2 then response.end
set objRS = server.createobject("adodb.recordset")
With objRS
.open "SELECT profileUpload FROM pgd_Config", datastore, , , adCmdText
profileUpload = split(objRS(0),"|")
.close
End With
set objRS = nothing
UpLoadSizeLimit = profileUpload(0)
uploadformat = profileUpload(1)
if UploadSizeLimit = "0" or len(UploadSizeLimit) = 0 then isUploadAllowed = false
if len(uploadformat) = 0 then isUploadAllowed = false
Case Else
'if mode = "edit" then
Dim existingUpfileCount:existingUpfileCount = ubound(split(deletefile,"|"))+1
'end if
allforum = Application(dbName&"foruminfo")
if len(appid) = 0 then response.end
Dim upsetting
Dim objPermission
Set objPermission = new PermissionSetting
With objPermission
.memID = memID
.appid = appid
upsetting = .Upload
End With
Set objPermission = nothing
if not isAdmin then
if upsetting<>"" then 'see if the user is allowed to upload
temparr = split(upsetting,"|")
if isArray(temparr) then 'see if the user is allowed to upload again
UpLoadSizeLimit = temparr(0)
if ubound(temparr)=1 then 'these two lines are requirements for user to upload
uploadformat = temparr(1) 'both uploadformat and UpLoadSizeLimit have to have some values
else
uploadformat = ""
end if
if (UpLoadSizeLimit = "0" or len(UpLoadSizeLimit)=0) or (len(uploadformat)=0) then 'user not allowed to upload
isUploadAllowed = false
end if
else
isUploadAllowed = false 'temparr is empty
end if
else
isUploadAllowed = false
end if
end if
if (maxnumupload - existingUpfileCount <= 0) then
isUploadAllowed = false
RightViolationMessage = replace(upfileMaxNumReached,"{num}",maxnumupload)
end if
maxnumupload = maxnumupload - existingUpfileCount
End SELECT
'if not isUploadAllowed then
' response.write (RightViolationMessage)
' session.contents.remove(dbName&"UpLoadSizeLimit")
' response.end
'end if
if isAdmin then
UpLoadSizeLimit = "9999"
uploadformat = uploadAllFormat
end if
' all user upload check is done at this point.
%>
<%= Application(dbName&"forumtitle") %>
<%= NoScript() %>
<%= OutputCSS() %>
>
<% if isUploadAllowed then %>
<% session(dbName&"UpLoadSizeLimit") = UpLoadSizeLimit %>
<% Else %>
<% session.contents.remove(dbName&"UpLoadSizeLimit") %>
<% End If %>