[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/editor/filemanager/browser/default/connectors/asp/ -> connector.asp (source)

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


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7