<%@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="details" OR strPage="thumbs" then Set MyFolder = fso.GetFolder(strPath) Set MyFiles = MyFolder.Files %> <%if strDir<>"" then %> <%strStyle=2 end if '## If the folder is hidden then hide the content Set hidden = fso.GetFolder(strPath) if hidden.attributes=18 AND blnLogin=false then%> <% '## Display the folder content else y=0 For Each i in MyFolder.subfolders if i.attributes<>18 OR (blnLogin=true AND i.attributes=18) then y=y+1 strStyle = strStyle + 1 If strStyle > 1 Then strStyle = 0%> > <% if strDir<>"" then sTemp=strDir & "\" & i.name else sTemp=i.name end if%> <% end if next if strPage="thumbs" then else y=0 '## Loop through all the files in the current folder For Each i in MyFolder.files if FileType(i.name)=true then '## Used to count files in folder y=y+1 '## change background color on 0 strStyle = strStyle + 1 If strStyle > 1 Then strStyle = 0%> > <% end if next end if%>
 Path: <%response.write "images: \ " '## Create an array in order to split the dir string for the menu a=split(strDir, "\", -1) for i=0 to uBound(a) if i=0 then aDir=cStr(a(0)) else aDir=aDir & "\" & a(i) end if b=a(i) response.write "" & a(i) & "" if not uBound(a)=i then response.write " \ " next %>     <%if strPage="thumbs" then '## Check for changes in table size (dropdown) if ucase(trim(request.ServerVariables("REQUEST_METHOD")))="POST" then response.redirect("?page="&strPage&"&size="&int(request.form("frmSize"))&"&dir="& strDir) end if%> <%end if%> List Details List Thumbnails ')" href="#">Slideshow
 Filename  Size  Date Modified  Date Created  <%if blnSecurity=true then response.write "Actions"%>
  &size=<%=intTable%>"> ..
 The content of this folder is hidden. Please login in order to view it.
 
  <% '## Show different folder icon if the folder is hidden if i.attributes=18 then%> <%else%> <%end if%> <%=i.name%> <%=formatnumber(i.Size/1024, 2)%> KB   <%=i.DateLastModified%> <%=i.DateCreated%>  <%if blnSecurity=true then%> Copy folder Rename folder Delete folder<%end if%>
  ');" target="_self"><%if intOS<>1 then%><%end if%> <%=i.name%> <%=formatnumber(i.Size/1024, 2)%> KB   <%=i.DateLastModified%> <%=i.DateCreated%>  <%if blnSecurity=true then%> Copy image Rename image Delete image<%end if%>
<%end if if strPage="thumbs" AND (hidden.attributes<>18 OR blnLogin=true) then Set hidden = Nothing %> <% Set MyFolder = fso.GetFolder(strPath) For Each i in MyFolder.files x=x+1 if FileType(i.name)<>true then x=x-1 z=z+1 'Images to exclude k=k+i.size end if if iCount < x AND FileType(i.name)=true then strImage = "images/" if strDir="" then strImage = strImage & i.name else strImage = strImage & strDir & "/" & i.name end if%> <% end if '--- If x Mod intImages = 0 Then Response.Write "" If x >= iCount + intTotalFiles then Exit For End if next%>
')" target="_self"><% if blnComponent=false then response.write "" else response.write "" end if%>
<%if blnFileName=true then response.write left(i.name, len(i.name)-4)%>
<% if blnSecurity=true then%>
Copy image Rename image Delete image <%end if%>

<% 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%>
KMM Image Gallery © 2005

<%elseif strPage="slide" then%> Click to close <%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 %>