[903] | 1 | <%@ CodePage=65001 Language="VBScript"%>
|
---|
| 2 | <%
|
---|
| 3 | Option Explicit
|
---|
| 4 | Response.Buffer = True
|
---|
| 5 | %>
|
---|
| 6 | <!--
|
---|
| 7 | * FCKeditor - The text editor for internet
|
---|
| 8 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben
|
---|
| 9 | *
|
---|
| 10 | * Licensed under the terms of the GNU Lesser General Public License:
|
---|
| 11 | * http://www.opensource.org/licenses/lgpl-license.php
|
---|
| 12 | *
|
---|
| 13 | * For further information visit:
|
---|
| 14 | * http://www.fckeditor.net/
|
---|
| 15 | *
|
---|
| 16 | * "Support Open Source software. What about a donation today?"
|
---|
| 17 | *
|
---|
| 18 | * File Name: connector.asp
|
---|
| 19 | * This is the File Manager Connector for ASP.
|
---|
| 20 | *
|
---|
| 21 | * File Authors:
|
---|
| 22 | * Frederico Caldeira Knabben (fredck@fckeditor.net)
|
---|
| 23 | -->
|
---|
| 24 | <!--#include file="config.asp"-->
|
---|
| 25 | <!--#include file="util.asp"-->
|
---|
| 26 | <!--#include file="io.asp"-->
|
---|
| 27 | <!--#include file="basexml.asp"-->
|
---|
| 28 | <!--#include file="commands.asp"-->
|
---|
| 29 | <!--#include file="class_upload.asp"-->
|
---|
| 30 | <%
|
---|
| 31 |
|
---|
| 32 | If ( ConfigIsEnabled = False ) Then
|
---|
| 33 | SendError 1, "This connector is disabled. Please check the ""editor/filemanager/browser/default/connectors/asp/config.asp"" file"
|
---|
| 34 | End If
|
---|
| 35 |
|
---|
| 36 | ' Get the "UserFiles" path.
|
---|
| 37 | Dim sUserFilesPath
|
---|
| 38 |
|
---|
| 39 | If ( Not IsEmpty( ConfigUserFilesPath ) ) Then
|
---|
| 40 | sUserFilesPath = ConfigUserFilesPath
|
---|
| 41 |
|
---|
| 42 | If ( Right( sUserFilesPath, 1 ) <> "/" ) Then
|
---|
| 43 | sUserFilesPath = sUserFilesPath & "/"
|
---|
| 44 | End If
|
---|
| 45 | Else
|
---|
| 46 | sUserFilesPath = "/UserFiles/"
|
---|
| 47 | End If
|
---|
| 48 |
|
---|
| 49 | ' Map the "UserFiles" path to a local directory.
|
---|
| 50 | Dim sUserFilesDirectory
|
---|
| 51 | sUserFilesDirectory = Server.MapPath( sUserFilesPath )
|
---|
| 52 |
|
---|
| 53 | If ( Right( sUserFilesDirectory, 1 ) <> "\" ) Then
|
---|
| 54 | sUserFilesDirectory = sUserFilesDirectory & "\"
|
---|
| 55 | End If
|
---|
| 56 |
|
---|
| 57 | DoResponse
|
---|
| 58 |
|
---|
| 59 | Sub DoResponse()
|
---|
| 60 | Dim sCommand, sResourceType, sCurrentFolder
|
---|
| 61 |
|
---|
| 62 | ' Get the main request information.
|
---|
| 63 | sCommand = Request.QueryString("Command")
|
---|
| 64 | If ( sCommand = "" ) Then Exit Sub
|
---|
| 65 |
|
---|
| 66 | sResourceType = Request.QueryString("Type")
|
---|
| 67 | If ( sResourceType = "" ) Then Exit Sub
|
---|
| 68 |
|
---|
| 69 | sCurrentFolder = Request.QueryString("CurrentFolder")
|
---|
| 70 | If ( sCurrentFolder = "" ) Then Exit Sub
|
---|
| 71 |
|
---|
| 72 | ' Check if it is an allower resource type.
|
---|
| 73 | if ( Not IsAllowedType( sResourceType ) ) Then Exit Sub
|
---|
| 74 |
|
---|
| 75 | ' Check the current folder syntax (must begin and start with a slash).
|
---|
| 76 | If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/"
|
---|
| 77 | If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder
|
---|
| 78 |
|
---|
| 79 | ' Check for invalid folder paths (..)
|
---|
| 80 | If ( InStr( 1, sCurrentFolder, ".." ) <> 0 OR InStr( 1, sResourceType, ".." ) <> 0 ) Then
|
---|
| 81 | SendError 102, ""
|
---|
| 82 | End If
|
---|
| 83 |
|
---|
| 84 | ' File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
---|
| 85 | If ( sCommand = "FileUpload" ) Then
|
---|
| 86 | FileUpload sResourceType, sCurrentFolder
|
---|
| 87 | Exit Sub
|
---|
| 88 | End If
|
---|
| 89 |
|
---|
| 90 | SetXmlHeaders
|
---|
| 91 |
|
---|
| 92 | CreateXmlHeader sCommand, sResourceType, sCurrentFolder
|
---|
| 93 |
|
---|
| 94 | ' Execute the required command.
|
---|
| 95 | Select Case sCommand
|
---|
| 96 | Case "GetFolders"
|
---|
| 97 | GetFolders sResourceType, sCurrentFolder
|
---|
| 98 | Case "GetFoldersAndFiles"
|
---|
| 99 | GetFoldersAndFiles sResourceType, sCurrentFolder
|
---|
| 100 | Case "CreateFolder"
|
---|
| 101 | CreateFolder sResourceType, sCurrentFolder
|
---|
| 102 | End Select
|
---|
| 103 |
|
---|
| 104 | CreateXmlFooter
|
---|
| 105 |
|
---|
| 106 | Response.End
|
---|
| 107 | End Sub
|
---|
| 108 |
|
---|
| 109 | Function IsAllowedType( resourceType )
|
---|
| 110 | Dim oRE
|
---|
| 111 | Set oRE = New RegExp
|
---|
| 112 | oRE.IgnoreCase = True
|
---|
| 113 | oRE.Global = True
|
---|
| 114 | oRE.Pattern = "^(File|Image|Flash|Media)$"
|
---|
| 115 |
|
---|
| 116 | IsAllowedType = oRE.Test( resourceType )
|
---|
| 117 |
|
---|
| 118 | Set oRE = Nothing
|
---|
| 119 | End Function
|
---|
| 120 | %> |
---|