%@ Language=VBScript %>
<%Option Explicit%>
<%
Const appName = "WebFTP"
Const appVersion = ""
%>
<%
Dim FSO, re
Dim scriptName, wexId
Dim wexMessage, wexRootPath, targetPath
Dim encoding, codepage, charset
InitApp()
' Actions in the popup windows
Select Case Request.Form("command")
Case "Edit"
Editor()
Case "View"
Viewer()
Case "FileDetails", "FolderDetails"
Details()
Case "Upload"
Upload(false)
End Select
' Actions in the main window
Select Case Request.Form("command")
Case "NewFile", "NewFolder"
CreateItem()
Case "DeleteFile", "DeleteFolder"
DeleteItem()
Case "RenameFile", "RenameFolder"
RenameItem()
Case "OpenFolder"
targetPath = WexMapPath(Request.Form("folder") & Request.Form("parameter"))
Case "LevelUp"
targetPath = WexMapPath(FSO.GetParentFolderName(Request.Form("folder")))
Case "Logout"
Logout()
End Select
List()
DestroyApp()
' ------------------------------------------------------------
' - WebExplorer Free Functions -------------------------------
' Initializes some variables, creates instances of some objects and ensures security
Sub InitApp()
scriptName = Request.ServerVariables("SCRIPT_NAME")
wexId = appName & appVersion & "-"
Response.Buffer = true
If not Secure() Then
If Request.Form("popup")="true" or Request.QueryString("popup")="true" Then PopupRelogin() Else Login()
End If
Set FSO = server.CreateObject ("Scripting.FileSystemObject")
Set re = new regexp
wexRootPath = RealizePath("/"&session("pasta"))
encoding = -2 'System default encoding
' Commands with high priority
' These commands require to be performed before any Request.Form statement
Select Case Request.QueryString("precommand")
Case "ProcessUpload"
Upload(true)
Case "Download"
Download()
Case "Encoding"
If Request.QueryString("value")<>"" Then encoding = Int(Request.QueryString("value"))
If encoding=-1 Then 'Unicode encoding
codepage = Session.CodePage
Session.CodePage = 65001
Response.CharSet = "UTF-8"
End If
End Select
targetPath = WexMapPath(Request.Form("folder"))
End Sub
' Frees the objects and ends the application
Sub DestroyApp()
If encoding=-1 Then Session.CodePage = codepage
Set FSO = Nothing
Set re = Nothing
Response.End
End Sub
' Writes the html header
Sub HtmlHeader(title)
%>