[ Index ]
 

Code source de vtiger CRM 5.0.2

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

title

Body

[fermer]

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

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


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7