Modificare il file:
\iwgallery\ScriptLibrary\incFSClass.asp
<SCRIPT LANGUAGE="VBScript" RUNAT="SERVER"> '*** File Genie ---------------------------------------------------- ' Copyright 2001-2002 (c) George Petrov, www.DMXzone.com ' ' Version: 1.0.3 '------------------------------------------------------------------------------ Class FolderList Private m_FL Private m_fso Private m_Path Private m_allowedExt Private m_includeFolders Private m_Count Private m_ThumbnailsSuffix Private m_ShowsThumbnailsOnly Private m_officeAttributes Private m_index Private m_pageRecs Private m_curPageRecs Private m_pageCols Private m_curCol Private Sub Class_Initialize() Set m_fso = CreateObject("Scripting.FileSystemObject") Set m_FL = CreateObject("Scripting.Dictionary") m_Path = "" m_allowedExt = "" m_includeFolders = False m_Count = 0 m_ThumbnailsSuffix = "_small" m_ShowsThumbmailssOnly = False m_pageRecs = 0 m_curPageRecs = 2 m_pageCols = 1 m_curCol = 1 m_index = 0 If Request.QueryString("flOffset") <> "" then m_index = CLng(Request.QueryString("flOffset"))-1 End Sub Private Sub Class_Terminate() Dim fi For fi = 1 to m_Count Set m_FL.Item(fi) = nothing Next m_Count = 0 Set m_fso = Nothing Set m_FL = Nothing End Sub Public Function Files(fl_attr) if m_index >= 0 then if m_FL.Exists(m_index) then Files = m_FL.Item(m_index).Item(fl_attr) end if end if End Function Public Property Get Path() Path = m_Path End Property Public Property Let Path(FL_Path) m_Path = FL_Path if right(m_Path,1) <> "/" then m_Path = m_Path & "/" End Property Public Property Get allowedExtensions() allowedExtensions = m_allowedExt End Property Public Property Let allowedExtensions(FL_allowedExt) m_allowedExt = FL_allowedExt if m_allowedExt <> "" then m_allowedExt = "," & UCase(m_allowedExt) & "," End Property Public Property Get ShowThumbnailsOnly() ShowThumbnailsOnly = m_ShowsThumbnailsOnly End Property Public Property Let ShowThumbnailsOnly(FL_ShowsThumbnailsOnly) m_ShowsThumbnailsOnly = FL_ShowsThumbnailsOnly End Property Public Property Get ThumbnailsSuffix() ThumbnailsSuffix = m_ThumbnailsSuffix End Property Public Property Let ThumbnailsSuffix(FL_ThumbnailsSuffix) m_ThumbnailsSuffix = FL_ThumbnailsSuffix End Property Public Property Get OfficeAttributes() OfficeAttributes = m_officeAttributes End Property Public Property Let OfficeAttributes(FL_officeAttributes) m_officeAttributes = FL_officeAttributes End Property Public Property Get includeFolders() includeFolders = m_includeFolders End Property Public Property Let includeFolders(FL_includeFolders) m_includeFolders = FL_includeFolders End Property Public Property Get pageRecs() pageRecs = m_pageRecs End Property Public Property Let pageRecs(FL_pageRecs) m_pageRecs = FL_pageRecs if m_pageRecs > 0 then m_curPageRecs = m_pageRecs end if End Property Public Property Get pageCols() pageCols = m_pageCols End Property Public Property Let pageCols(FL_pageCols) m_pageCols = FL_pageCols End Property Public Function CanRepeat() if m_index < m_count and m_curPageRecs <> 0 then CanRepeat = true else CanRepeat = false end if End Function Public Function IsLastColumn() if m_curCol = m_pageCols and (m_index < m_count - 1 and m_curPageRecs <> 1) then m_curCol = 0 IsLastColumn = true else IsLastColumn = false end if End Function Public Sub MoveNext() m_index = m_index + 1 if m_pageRecs > 0 then m_curPageRecs = m_curPageRecs - 1 end if m_curCol = m_curCol + 1 End Sub Public Sub EndRepeater() while m_curCol - 1 < m_pageCols Response.Write "<td> </td>" m_curCol = m_curCol + 1 wend End Sub Public Property Get Count() Count = m_count End Property Private Sub ProcessFolder(FL_Path) Dim FL_file_name,FL_file_ext,FL_dp,FL_file,FL_file_obj Dim FL_index,FL_folder,FL_folders Set FL_fld = m_fso.GetFolder(Server.MapPath(FL_Path)) FL_index = 0 if m_includeFolders then Set FL_folders = FL_fld.SubFolders For Each FL_folder in FL_folders Set FL_file_obj = CreateObject("Scripting.Dictionary") FL_file_obj.Add "Path", FL_Path & FL_folder.Name FL_file_obj.Add "Name", FL_folder.Name FL_file_obj.Add "FileName", FL_folder.Name FL_file_obj.Add "Extension", FL_file_ext FL_file_obj.Add "Thumbnail_name", FL_folder.Name FL_file_obj.Add "Thumbnail_image", "" FL_file_obj.Add "Type", FL_folder.Type FL_file_obj.Add "Size", FL_folder.Size FL_file_obj.Add "Size_name", getSizeName(FL_folder.Size) FL_file_obj.Add "DateLastModified", FL_folder.DateLastModified FL_file_obj.Add "Attributes", FL_folder.Attributes m_FL.Add FL_index, FL_file_obj FL_index = FL_index + 1 Next end if Set FL_files = FL_fld.Files For Each FL_file in FL_files FL_file_name = FL_file.Name FL_file_ext = "" FL_dp = InStrRev(FL_file.Name,".") if FL_dp > 0 then FL_file_ext = right(FL_file.Name,len(FL_file.Name)-FL_dp) FL_file_name = left(FL_file.Name,FL_dp-1) end if if m_allowedExt = "" or (m_allowedExt <> "" and InStr(m_allowedExt,"," & UCase(FL_file_ext) & ",") > 0) then if not m_ShowsThumbnailsOnly then Set FL_file_obj = CreateObject("Scripting.Dictionary") FL_file_obj.Add "Path", FL_Path & FL_file.Name FL_file_obj.Add "Name", FL_file.Name FL_file_obj.Add "FileName", FL_file_name FL_file_obj.Add "Extension", FL_file_ext FL_file_obj.Add "Thumbnail_name", FL_Path & getThumbnailName(m_ThumbnailsSuffix,FL_file.Name) FL_file_obj.Add "Thumbnail_image", "<img src=""" & FL_Path & getThumbnailName(m_ThumbnailsSuffix,FL_file.Name) & """>" FL_file_obj.Add "Type", FL_file.Type FL_file_obj.Add "Size", FL_file.Size FL_file_obj.Add "Size_name", getSizeName(FL_file.Size) FL_file_obj.Add "DateLastModified", FL_file.DateLastModified FL_file_obj.Add "Attributes", FL_file.Attributes m_FL.Add FL_index, FL_file_obj FL_index = FL_index + 1 else if m_ShowsThumbnailsOnly and InStr(UCase(FL_file.Name),UCase(m_ThumbnailsSuffix)&".") > 0 then Set FL_file_obj = CreateObject("Scripting.Dictionary") FL_realFileName = getRealNameFromThumbnail(FL_Path,FL_file.Name) if FL_realFileName <> "" then Set RFL_file = m_fso.GetFile(Server.MapPath(FL_Path & FL_realFileName)) FL_file_obj.Add "Path", FL_Path & RFL_file.Name FL_file_obj.Add "Name", RFL_file.Name FL_file_obj.Add "FileName", getFileName(RFL_file.Name) FL_file_obj.Add "Extension", getFileExtension(RFL_file.Name) FL_file_obj.Add "Thumbnail_name", FL_Path & getThumbnailName(m_ThumbnailsSuffix,RFL_file.Name) FL_file_obj.Add "Thumbnail_image", "<img src=""" & FL_Path & getThumbnailName(m_ThumbnailsSuffix,RFL_file.Name) & """>" FL_file_obj.Add "Type", RFL_file.Type FL_file_obj.Add "Size", RFL_file.Size FL_file_obj.Add "Size_name", getSizeName(RFL_file.Size) FL_file_obj.Add "DateLastModified", RFL_file.DateLastModified FL_file_obj.Add "Attributes", RFL_file.Attributes m_FL.Add FL_index, FL_file_obj FL_index = FL_index + 1 end if end if end if end if next m_Count = m_Count + FL_index End Sub Private Function getRealNameFromThumbnail(TN_path,TN_filename) Dim GTN_fso, GTN_file_name, GTN_file_ext, GTN_dp GTN_file_name = TN_filename GTN_file_ext = "" GTN_dp = InStrRev(TN_filename,".") if GTN_dp > 0 then GTN_file_ext = right(TN_filename,len(TN_filename)-GTN_dp) GTN_file_name = left(TN_filename,GTN_dp-1) end if GTN_file_name = Left(GTN_file_name,Len(GTN_file_name)-Len(m_ThumbnailsSuffix)) GTN_path_file_name = Server.MapPath(TN_Path) & "\" & GTN_file_name Set GTN_fso = CreateObject("Scripting.FileSystemObject") If (GTN_fso.FileExists(GTN_path_file_name & ".jpg")) Then getRealNameFromThumbnail = GTN_file_name & ".jpg" Else If (GTN_fso.FileExists(GTN_path_file_name & ".gif")) Then getRealNameFromThumbnail = GTN_file_name & ".gif" Else If (GTN_fso.FileExists(GTN_path_file_name & ".png")) Then getRealNameFromThumbnail = GTN_file_name & ".png" Else If (GTN_fso.FileExists(GTN_path_file_name & ".bmp")) Then getRealNameFromThumbnail = GTN_file_name & ".bmp" Else If (GTN_fso.FileExists(GTN_path_file_name & ".tiff")) Then getRealNameFromThumbnail = GTN_file_name & ".tiff" end if end if end if end if end if Set GTN_fso = nothing End Function Private Function getFileName(T_filename) Dim GTN_file_name, GTN_file_ext, GTN_dp GTN_file_name = T_filename GTN_file_ext = "" GTN_dp = InStrRev(T_filename,".") if GTN_dp > 0 then GTN_file_ext = right(T_filename,len(T_filename)-GTN_dp) GTN_file_name = left(T_filename,GTN_dp-1) end if getFileName = GTN_file_name End Function Private Function getFileExtension(T_filename) Dim GTN_file_name, GTN_file_ext, GTN_dp GTN_file_name = T_filename GTN_file_ext = "" GTN_dp = InStrRev(T_filename,".") if GTN_dp > 0 then GTN_file_ext = right(T_filename,len(T_filename)-GTN_dp) GTN_file_name = left(T_filename,GTN_dp-1) end if getFileExtension = GTN_file_ext End Function Private Function getSizeName(fg_FileSize) Dim numFileSize, newFileSize if not isnull(fg_FileSize) then numFileSize = CLng(fg_FileSize) if numFileSize < 1024 then newFileSize = numFileSize & " Bytes" elseif numFileSize >= 1024 and numFileSize < 1048576 then newFileSize = round((numFileSize/1024),0) & " KB" elseif numFileSize >= 1048576 then newFileSize = round((numFileSize/1048576),2) & " MB" end if end if getSizeName = newFileSize end function Private Function getThumbnailName(GTN_suff,GTN_filename) Dim GTN_NewFilename, GTN_Path, GTN_PosPath, GTN_PosExt if not isnull(GTN_filename) then GTN_PosPath = InStrRev(GTN_filename,"/") GTN_Path = "" if GTN_PosPath > 0 then GTN_Path = mid(GTN_filename,1,GTN_PosPath) end if GTN_PosExt = InStrRev(GTN_filename,".") if InStr(LCase(GTN_filename),LCase(GTN_suff) & ".") = 0 then if GTN_PosExt > 0 then GTN_NewFilename = GTN_Path & mid(GTN_filename,GTN_PosPath+1,GTN_PosExt-(GTN_PosPath+1)) & GTN_suff & ".jpg" else GTN_NewFilename = GTN_Path & mid(GTN_filename,GTN_PosPath+1,len(GTN_filename)-GTN_PosPath) & GTN_suff & ".jpg" end if end if end if getThumbnailName = GTN_NewFilename end function Private Sub ProcessOfficeAttributes() Dim objDSOfile, OA_keys, OA_i, OA_curKey, FL_file_obj Set objDSOfile = Server.CreateObject("DSOleFile.PropertyReader") OA_keys = m_FL.Keys for OA_i = 0 to m_FL.Count - 1 OA_curKey = OA_keys(OA_i) Set FL_file_obj = m_FL.Item(OA_curKey) FL_fullPath = Server.MapPath(m_FL.Item(OA_curKey).Item("Path")) Set oDocProp = objDSOfile.GetDocumentProperties(FL_fullPath) on error resume next FL_file_obj.Add "AppName", oDocProp.AppName FL_file_obj.Add "Title", oDocProp.Title FL_file_obj.Add "Author", oDocProp.Author FL_file_obj.Add "Comments", oDocProp.Comments FL_file_obj.Add "Subject", oDocProp.Subject FL_file_obj.Add "Category", oDocProp.Category FL_file_obj.Add "Company", oDocProp.Company FL_file_obj.Add "Manager", oDocProp.Manager FL_file_obj.Add "WordCount", oDocProp.WordCount FL_file_obj.Add "PageCount", oDocProp.PageCount FL_file_obj.Add "ParagraphCount", oDocProp.ParagraphCount FL_file_obj.Add "LineCount", oDocProp.LineCount FL_file_obj.Add "LastEditedBy", oDocProp.LastEditedBy FL_file_obj.Add "DateCreated", oDocProp.DateCreated FL_file_obj.Add "DateLastPrinted", oDocProp.DateLastPrinted FL_file_obj.Add "DateLastSaved", oDocProp.DateLastSaved FL_file_obj.Add "Version", oDocProp.Version FL_file_obj.Add "RevisionNumber", oDocProp.RevisionNumber on error goto 0 Set oDocProp = nothing next Set objDSOfile = nothing End Sub Private Sub CheckForDSOfile() Dim objDSOfile on error resume next Set objDSOfile = Server.CreateObject("DSOleFile.PropertyReader") if err.number <> 0 then Response.Write "DSOfile Server Component is not installed!<br>If you want to read the Office Document properties you need to install this component.<br>Otherwise don't select the ""Include Extended Office Attributes"" option" Response.End end if on error goto 0 Set objDSOfile = nothing End Sub Public Sub ReadFolder() if m_officeAttributes then CheckForDSOfile end if ProcessFolder m_Path if m_officeAttributes then ProcessOfficeAttributes end if End Sub Public Sub DisplayNavigation(FL_navType, FL_navDelimeter) Dim navBar, currentPage, nav_i, pageStep, endPageRec, pageNum navBar = "" if m_pageRecs <> 0 then if FL_navDelimeter = "" then FL_navDelimeter = "|" if m_pageRecs > 0 then pageStep = m_pageRecs else pageStep = 1 end if currentPage = Request.ServerVariables("SCRIPT_NAME") select case FL_navType case 1 'List Recs for nav_i = 1 to m_count step pageStep endPageRec = (nav_i-1)+pageStep if endPageRec > m_count then endPageRec = m_count if m_index >= nav_i and m_index <= endPageRec then navBar = navBar & "<b>" & nav_i & " - " & endPageRec & "</b> " & FL_navDelimeter & " " else navBar = navBar & "<a href=""" & currentPage & "?flOffset=" & nav_i & """>" & nav_i & " - " & endPageRec & "</a>" & " " & FL_navDelimeter & " " end if next if Len(navBar) > len(FL_navDelimeter)+2 then navBar = left(navBar,len(navBar)-(len(FL_navDelimeter)+2)) end if case 2 'Page Recs pageNum = 1 for nav_i = 1 to m_count step pageStep if m_index >= nav_i and m_index <= (nav_i-1)+pageStep then navBar = navBar & "<b>" & pageNum & "</b> " & FL_navDelimeter & " " else navBar = navBar & "<a href=""" & currentPage & "?flOffset=" & nav_i & """>" & pageNum & "</a>" & " " & FL_navDelimeter & " " end if pageNum = pageNum + 1 next if Len(navBar) > len(FL_navDelimeter)+2 then navBar = left(navBar,len(navBar)-(len(FL_navDelimeter)+2)) end if end select Response.Write navBar End If End Sub Public Function getDeleteLink() Dim currentPage currentPage = Request.ServerVariables("SCRIPT_NAME") getDeleteLink = currentPage & "?Action=delete&file=" & Server.Urlencode(Files("Path")) End Function End Class Function CreateFolderList() Set CreateFolderList = New FolderList End Function Sub fm_DeleteListedFile() Dim fileToDelete,currentPage, cur_fso Set cur_fso = CreateObject("Scripting.FileSystemObject") if LCase(Request.QueryString("Action")) = "delete" then if Request.QueryString("file") <> "" then currentPage = Request.ServerVariables("SCRIPT_NAME") fileToDelete = Server.MapPath(Request.QueryString("file")) if cur_fso.FileExists(fileToDelete) then cur_fso.DeleteFile fileToDelete,true elseif cur_fso.FolderExists(fileToDelete) then cur_fso.DeleteFolder fileToDelete,true end if Response.Redirect currentPage end if end if End Sub </SCRIPT>
[
Íàçàä
]