source: companies/serpro/news_admin/templates/celepar/fckeditor/editor/filemanager/browser/default/connectors/asp/connector.asp @ 903

Revision 903, 3.3 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

Line 
1<%@ CodePage=65001 Language="VBScript"%>
2<%
3Option Explicit
4Response.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
32If ( ConfigIsEnabled = False ) Then
33        SendError 1, "This connector is disabled. Please check the ""editor/filemanager/browser/default/connectors/asp/config.asp"" file"
34End If
35
36' Get the "UserFiles" path.
37Dim sUserFilesPath
38
39If ( Not IsEmpty( ConfigUserFilesPath ) ) Then
40        sUserFilesPath = ConfigUserFilesPath
41
42        If ( Right( sUserFilesPath, 1 ) <> "/" ) Then
43                sUserFilesPath = sUserFilesPath & "/"
44        End If
45Else
46        sUserFilesPath = "/UserFiles/"
47End If
48
49' Map the "UserFiles" path to a local directory.
50Dim sUserFilesDirectory
51sUserFilesDirectory = Server.MapPath( sUserFilesPath )
52
53If ( Right( sUserFilesDirectory, 1 ) <> "\" ) Then
54        sUserFilesDirectory = sUserFilesDirectory & "\"
55End If
56
57DoResponse
58
59Sub 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
107End Sub
108
109Function 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
119End Function
120%>
Note: See TracBrowser for help on using the repository browser.