%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% Option Explicit Const Version="2.6.4" %> <% '-------- '############## 'CONFIGURATION. Const cPageTitle="Photo Gallery of the Our World Is Not For Sale network" 'Page title. Change it at your will. 'IMPORTANT: 'Set the images virtual folder (with the last "/") 'Warning: The security restrictions of ASP.NET do not allow you to use ..'s to move up above the root of the application as defined in IIS. 'If you do that, thumbnails may fail to show up. Use always a relative path to your application root. Const cVirtualPath="images/" Const cSendEmailOnCommentAdded=false 'true or false. set this to true if you want to receive comment notifications. Const cAdminEmail="webmaster@ourworldisnotforsale.org" 'set email address to receive comment notifications. Dim cWritableXMLCommentsFile 'Physical folder where the xml comment files are going to be written. cWritableXMLCommentsFile=Server.Mappath(cVirtualPath) & "\comments.xml" 'Value: a valid physical folder. Must end with "\" 'cosmetic Const cMaxThumbnailsSize=70 ' Thumbnail's width. Values: a valid integer Const cNumberPicturesPerRowDefault=2 'set the default number of thumbails per row. Const cimgPlus="folder.gif" Const cimgChildNode="folder_open.gif" Const cimgMinus="folder_open.gif" Const cNumberRecentComments=10 'language 'I had took language configuration out, to make easier multilingual support %> <% 'functionality Const cShowEmptyFolders=false 'If a folder doesn't contain files inside, would it be displayed? Const cImageExtensions=".jpg,.gif,.png,.JPG,.GIF,.PNG" 'the system would considerar files with that extension as images Const cAllowUserChangePicturePerRow=true 'allow visitor to change the number of pictures he visualize per row Const cAllowUserEnterComments=false 'allow visitor to add comments to the pics. You will need write access permit to comments file! Const cHideFoldersPattern="_vti_cnf" 'thumbnail generator 'NEW in 2.6.4 use the file testthumb.aspx to check if you environment supports .NET thumbnail generation! Const cUseThumbnailFile=false 'Values: true or false. Set to true if you are using a server page to create the thumbnail (if your server has .NET Framework installed) Const cUseThumbnailFilePath="thumbnail.aspx" 'path to server page that will generate the thumbnail 'set here available sizes to display the big picture, separate by coma. Const cAvailableThumbnailSizes="original,200,300,500,600" ' "original" is a reserved word Const cDefaultThumbnailSize="original" 'set value that would appear as 'default' 'Main page text sub WriteMainText() 'write here whatever HTML you would like to add to the main page %> <% end sub 'Image Copyright text(apply to every picture) sub WriteCopyRightText() %> <% end sub 'Parse here the picture name as you wish, to take certain characters out of the display name, for example function ParsePictureName(filepath) Const maxPicNamesize=10 Dim output output=fs.GetBaseName(filepath) output=replace(replace(output,"_"," "),"-"," ") 'change "_" for " ", "-" for " " if len(output)>maxPicNamesize then output=left(output,maxPicNamesize) + ".." ParsePictureName=output end Function 'Do whatever you want then a visitor write a comment (send and email to the admin, for example) sub OnCommentAdded(author,email,text,picturelink) if cSendEmailOnCommentAdded then 'lets send an email using CDONTS (be sure you have installed it in your server) Dim objCDO Set objCDO = Server.CreateObject("CDONTS.NewMail") objCDO.To = cAdminEmail objCDO.From = cAdminEmail objCDO.Subject = "OWINFS Photo Gallery comment" objCDO.Body = "Author: " & author & vbcrlf & _ "Email: " & email & vbcrlf & _ "Comments: " & text & vbcrlf & _ "Picture: " & vbcrlf & picturelink & _ vbcrlf & "--" & vbcrlf & cPageTitle objCDO.Send Set objCDO = Nothing end if 'here you could trigger other actions when user writes a comment. end sub 'END CONFIGURATION '################# 'FUNCTIONS 'function to write formated output to response object. sub prt(strValue) response.write(strValue) & Vbcrlf end Sub 'get XML document from file or create a new one if it doesn't exist function GetXmlObj() Dim objXML Set objXML = Server.CreateObject("Microsoft.XMLDOM") If objXML.load(cWritableXMLCommentsFile) = False Then objXML.appendChild(objXML.createProcessingInstruction("xml","version=""1.0"" encoding=""utf-8""")) objXML.appendChild(objXML.createElement("comments")) End If set GetXmlObj=objXML end function 'BEGIN SEARCH ENGINE 'Show search engine form sub DisplaySearch() prt cSearchPictures prt "
" End sub 'Do search Sub DoSearch() Dim output if len(request("search")) then dim result,i result=split(searchPictures(cVirtualPath,request("search")),";") for i=0 to ubound(result) -1 output = output & (i+1) & ". " & ShowResultSearchPicture(result(i)) next if ubound(result)=-1 then prt "" & cNoResultsFoundFor & " " & request("search") & "
" else prt "| "
output=output & ""
if cUseThumbnailFile then
tempWriter=cUseThumbnailFilePath & "?ForceAspect=false&Height=" & cMaxThumbnailsSize & "&Width="& cMaxThumbnailsSize & "&image=" & Server.URLEncode(VirtualPath & File.Name)
output=output & " " & ParsePictureName(File.path) & " " if (fs.FileExists(replace(File.path, fs.GetExtensionName(File.path),"txt")))=true Then output=output & "" & cAComments & "" For each cA in cArray If cA=File.Name Then output=output & "" & cVComments & "" Exit For End If Next output=output & " | "
If cint(iRow)=cint(session("picsperrow")-1) then
iRow=0
output=output & "
" & cThisFolderHasNoImages & "
" else Prt output end if Set folder=nothing End Sub 'get subfolders from folder (recursive) Sub DisplaySubFolders(Item) Dim subfolder,folder, parentfolder,linktext, preHtml, nImages, File set folder = fs.GetFolder(Server.MapPath(Item)) If folder.subfolders.count > 0 then Prt "| "
thePrev=FindThePrev (request("item"))
If len(thePrev) Then Prt "" & " | " Prt cFileName & " " & fs.GetFilename(request("item")) & "" Prt " | "
theNext=FindTheNext (request("item"))
If len(theNext) Then Prt " |
")
Prt("Error: " & err.description + ".
" end if %>
" & cVisitorComments & "
" Prt "" & cErrorMessage & " " & err.Description & "
" prt FormatCommentsToDisplay(comment) prt "
" Next 'write form prt "" Prt "