%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'## Declaring variables
dim aDir, strDir, strPath, strCmd, strFolder, strName, strFile, strPage, pagenum
dim fso, MyFolder, FileObject, MyFiles, hidden, strStyle, sTemp, strImage
dim intFiles, intTotal, intTotalFiles, intTable, intImages, intOS, iCount
dim a, b, i, k, x, y, z
strDir=cStr(request.QueryString("dir"))
strPath=Server.MapPath("images\" & strDir)
strCmd = request.QueryString("cmd")
strFolder = request.QueryString("folder")
intTable=int(request.QueryString("size"))
strPage=request.QueryString("page")
'## Select the default view (details / thumbs)
if strPage="" then strPage="thumbs"
strFile=cStr(request.QueryString("file"))
strDir=cStr(request.QueryString("dir"))
strPath=Server.MapPath("images\" & strDir)
i=strPath & "\" & strFile
strName=request.QueryString("name")
'## Check OS in order to disable unavailable features in Linux
if left(Request.ServerVariables("ASP_OS"), 5)="Linux" then intOS=1
'## Set the table width to 700 as default (5 images)
if intTable="" or intTable=0 or isNull(intTable)=true then intTable=700
intImages=round(intTable/106-2)
'## Total files per page
intTotalFiles=int(intImages*intRows)
'## Remove ../ and \ from the folder string
if left(strDir, 3)="../" OR left(strDir, 3)="..\" then strDir=""
if right(strDir, 1)="\" then strDir = mid(strDir,1, len(strDir)-1)
'## Paging
PageNum = request.querystring("pagenum")
If PageNum="" or int(PageNum)=1 Then PageNum=1
iCount = (PageNum -1) * intTotalFiles
Set fso=Server.CreateObject("Scripting.FileSystemObject")
%>
KMM Image Gallery
<%if strPage<>"slide" then%>
<%end if
if strPage="thumbs" AND (hidden.attributes<>18 OR blnLogin=true) then
Set hidden = Nothing %>
<%
intFiles=int(MyFolder.Files.Count-z)
if intTotalFiles
<%
'######### LEFT ########
If Clng(pagenum) > 1 Then
Response.Write "[<<]"
Else
Response.Write "[<<]"
End If
response.write " "
If Clng(pagenum) > 1 Then
Response.Write "[<]"
Else
Response.Write "[<]"
End If
'######### NUM ########
intTotal = MyFolder.Files.Count
y = round(intTotal/intTotalFiles+0.4)
For x = 1 to y
if x=int(PageNum) then
Response.Write " " & x & " "
if x<>y then response.write "|"
else
Response.Write " " & x & " "
if x<>y then response.write "|"
end if
Next
'######### RIGHT ########
If Clng(pagenum) < Clng(y) Then
Response.Write "[>] "
Else
Response.Write "[>]"
End If
If Clng(pagenum) < Clng(y) Then
Response.Write "[>>] "
Else
Response.Write " [>>]"
End If
response.write "
"
end if
%> |
<%end if
if blnStatusBar=true then%>
| <%=intFiles%> object(s) |
<%=formatnumber(int(MyFolder.Size-k)/1024, 2) & " KB"%> |
|
Image Gallery |
<%end if%>
<%elseif strPage="slide" then%>
<%end if%>
<%
if strCmd="delete" then '------------------------------------------------ DELETE FILE
if strFile<>"" OR strFolder<>"" AND blnSecurity=true then
if strFile<>"" then
Set fileObject = fso.GetFile(strPath & "\" & strFile)
elseif strFolder<>"" then
Set fileObject = fso.GetFolder(strPath & "\" & strFolder & "\")
end if
fileObject.Delete
Set fileObject = Nothing
Set fso = Nothing
end if
response.redirect ("default.asp?page="&strPage&"&dir=" & strDir)
elseif strCmd="copy" then '------------------------------------------------ COPY FILE
if strFile<>"" OR strFolder<>"" AND blnSecurity=true then
Set fso = CreateObject("Scripting.FileSystemObject")
if strFolder="" then
if fso.FileExists (strPath & "\" & "copy of " & strFile)=false then
Set fileObject = fso.GetFile(strPath & "\" & strFile)
fileObject.Copy (strPath & "\" & "copy of " & strFile),false
end if
elseif strFolder<>"" then
if fso.FolderExists (strPath & "\" & "copy of " & strFolder)=false then
Set fileObject = fso.GetFolder(strPath & "\" & strFolder & "\")
fileObject.Copy (strPath & "\" & "copy of " & strFolder),false
end if
end if
Set fileObject = Nothing
Set fso = Nothing
end if
response.redirect ("default.asp?page="&strPage&"&dir=" & strDir)
elseif strCmd="rename" then '--------------------------------------------- RENAME FILE
if strFile<>"" OR strFolder<>"" AND blnSecurity=true then
Set fso = CreateObject("Scripting.FileSystemObject")
if strFolder="" then
if fso.FileExists (strPath & "\" & strName)=false then
fso.MoveFile strPath & "\" & strFile, strPath & "\" & strName
end if
elseif strFolder<>"" then
if fso.FolderExists (strPath & "\" & strName)=false then
fso.MoveFolder strPath & "\" & strFolder, strPath & "\" & strName
end if
end if
Set fileObject = Nothing
Set fso = Nothing
end if
response.redirect ("default.asp?page="&strPage&"&dir=" & strDir)
end if
'## What files will be displayed
function FileType(strFile)
strFile = lcase(right(strFile, 3))
select case strFile
case "jpg" strFile=true
case "gif" strFile=true
case "png" strFile=true
case "bmp" strFile=true
case "peg" strFile=true 'jpeg
case "jpe" strFile=true 'jpeg
end select
FileType=strFile
end function
Set MyFolder = Nothing
Set fso = Nothing
%>