Changeset 290

Show
Ignore:
Timestamp:
2007-05-05 23:59:07 (3 years ago)
Author:
alfonsoml
Message:

Changes for the PHP connector as part of #454 as well as some other little adjustments in the asp part.

Location:
FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors
Files:
8 added
4 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/asp/commands.asp

    r288 r290  
    3333        Dim oFSO, oCurrentFolder, oFolders, oFolder 
    3434        Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) 
     35        if not (oFSO.FolderExists( sServerDir ) ) then 
     36                Set oFSO = Nothing 
     37                SendError 102, currentFolder 
     38        end if 
     39 
    3540        Set oCurrentFolder = oFSO.GetFolder( sServerDir ) 
    3641        Set oFolders = oCurrentFolder.SubFolders 
     
    5358        Dim oFSO, oCurrentFolder, oFolders, oFolder, oFiles, oFile 
    5459        Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" ) 
     60        if not (oFSO.FolderExists( sServerDir ) ) then 
     61                Set oFSO = Nothing 
     62                SendError 102, currentFolder 
     63        end if 
     64 
    5565        Set oCurrentFolder = oFSO.GetFolder( sServerDir ) 
    5666        Set oFolders    = oCurrentFolder.SubFolders 
  • FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/asp/connector.asp

    r288 r290  
    4545        ' Get the main request information. 
    4646        sCommand = Request.QueryString("Command") 
     47 
     48        sResourceType = Request.QueryString("Type") 
     49        If ( sResourceType = "" ) Then sResourceType = "File" 
     50 
     51        sCurrentFolder = GetCurrentFolder() 
     52 
     53        ' Check if it is an allowed command  
    4754        if ( Not IsAllowedCommand( sCommand ) ) then 
    4855                SendError 1, "The """ & sCommand & """ command isn't allowed" 
    4956        end if 
    5057 
    51         sResourceType = Request.QueryString("Type") 
    52         If ( sResourceType = "" ) Then sResourceType = "File" 
    53  
    54         sCurrentFolder = Request.QueryString("CurrentFolder") 
    55         If ( sCurrentFolder = "" ) Then sCurrentFolder = "/" 
    56  
    57         ' Check if it is an allower resource type. 
     58        ' Check if it is an allowed resource type. 
    5859        if ( Not IsAllowedType( sResourceType ) ) Then  
    5960                SendError 1, "The """ & sResourceType & """ resource type isn't allowed" 
    6061        end if 
    61  
    62         ' Check the current folder syntax (must begin and start with a slash). 
    63         If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/" 
    64         If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder 
    65  
    66         ' Check for invalid folder paths (..) 
    67         If ( InStr( 1, sCurrentFolder, ".." ) <> 0 OR InStr( 1, sResourceType, ".." ) <> 0 ) Then 
    68                 SendError 102, "" 
    69         End If 
    7062 
    7163        ' File Upload doesn't have to Return XML, so it must be intercepted before anything. 
  • FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/asp/io.asp

    r288 r290  
    140140End Function 
    141141 
     142function GetCurrentFolder() 
     143{ 
     144        dim sCurrentFolder 
     145        sCurrentFolder = Request.QueryString("CurrentFolder") 
     146        If ( sCurrentFolder = "" ) Then sCurrentFolder = "/" 
     147 
     148        ' Check the current folder syntax (must begin and start with a slash). 
     149        If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/" 
     150        If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder 
     151 
     152        ' Check for invalid folder paths (..) 
     153        If ( InStr( 1, sCurrentFolder, ".." ) <> 0 ) Then 
     154                SendError 102, "" 
     155        End If 
     156 
     157        GetCurrentFolder = sCurrentFolder 
     158end function 
    142159 
    143160' This is the function that sends the results of the uploading process. 
  • FCKeditor/branches/developers/alfonsoml/editor/filemanager/connectors/asp/upload.asp

    r288 r290  
    4141 
    4242        sCommand = "FileUpload" 
    43         if ( Not IsAllowedCommand( sCommand ) ) then 
    44                 SendError 1, "The """ & sCommand & """ command isn't allowed" 
    45         end if 
    4643 
    4744        sResourceType = Request.QueryString("Type") 
    4845        If ( sResourceType = "" ) Then sResourceType = "File" 
    4946 
    50         sCurrentFolder = Request.QueryString("CurrentFolder") 
    51         If ( sCurrentFolder = "" ) Then sCurrentFolder = "/" 
     47        sCurrentFolder = GetCurrentFolder() 
    5248 
    53         ' Check if it is an allower resource type. 
     49        ' Is Upload enabled? 
     50        if ( Not IsAllowedCommand( sCommand ) ) then 
     51                SendUploadResults "1", "", "", "The """ & sCommand & """ command isn't allowed" 
     52        end if 
     53 
     54        ' Check if it is an allowed resource type. 
    5455        if ( Not IsAllowedType( sResourceType ) ) Then 
    5556                SendUploadResults "1", "", "", "The " & sResourceType & " resource type isn't allowed" 
    5657        end if 
    5758 
    58         ' Check the current folder syntax (must begin and start with a slash). 
    59         If ( Right( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = sCurrentFolder & "/" 
    60         If ( Left( sCurrentFolder, 1 ) <> "/" ) Then sCurrentFolder = "/" & sCurrentFolder 
    61  
    62         ' Check for invalid folder paths (..) 
    63         If ( InStr( 1, sCurrentFolder, ".." ) <> 0 OR InStr( 1, sResourceType, ".." ) <> 0 ) Then 
    64                 SendUploadResults "102", "", "", "Invalid path" 
    65         End If 
    66  
    6759        FileUpload sResourceType, sCurrentFolder 
    6860