1<?php 2/* 3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 4 * Copyright (C) 2003-2009 Frederico Caldeira Knabben 5 * 6 * == BEGIN LICENSE == 7 * 8 * Licensed under the terms of any of the following licenses at your 9 * choice: 10 * 11 * - GNU General Public License Version 2 or later (the "GPL") 12 * http://www.gnu.org/licenses/gpl.html 13 * 14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 15 * http://www.gnu.org/licenses/lgpl.html 16 * 17 * - Mozilla Public License Version 1.1 or later (the "MPL") 18 * http://www.mozilla.org/MPL/MPL-1.1.html 19 * 20 * == END LICENSE == 21 * 22 * This is the File Manager Connector for PHP. 23 */ 24if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../../../../../../../').'/'); 25 26ob_start() ; 27function getAccessNum () { 28 usleep(300); 29 return microtime(true); 30 31} 32require('./config.php') ; 33require('./util.php') ; 34require('./io.php') ; 35require('./basexml.php') ; 36require('./commands.php') ; 37require('./phpcompat.php') ; 38require_once('./SafeFN.class.php'); 39require_once 'input_utils.php'; 40 41if ( !$Config['Enabled'] ) 42 SendError( 1, 'FileBrowserError_Connector') ; 43 44 45DoResponse() ; 46 47function DoResponse() 48{ 49 50 51 if (!isset($_GET)) { 52 global $_GET; 53 } 54 55 56 57 if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) 58 return ; 59 60 61 62 // Get the main request informaiton. 63 $sCommand = urlencode($_GET['Command'] ); 64 $sResourceType = urlencode($_GET['Type']) ; 65 $sCurrentFolder = GetCurrentFolder() ; 66 67 // Check if it is an allowed command 68 if ( ! IsAllowedCommand( $sCommand ) ) 69 SendError( 1, 'FileBrowserError_Command' . ';;' . $sCommand ) ; 70 71 // Check if it is an allowed type. 72 if ( !IsAllowedType( $sResourceType ) ) 73 SendError( 1, 'FileBrowserError_Type' . ';;' . $sResourceType) ; 74 75 76 // File Upload doesn't have to Return XML, so it must be intercepted before anything. 77 if ( $sCommand == 'FileUpload' ) 78 { 79 FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ; 80 return ; 81 } 82 83 if ( $sCommand == 'GetDwfckNs' ) 84 { 85 GetDwfckNs(); 86 return; 87 } 88 89 90 91 CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; 92 93 94 95 // Execute the required command. 96 switch ( $sCommand ) 97 { 98 case 'GetFolders' : 99 GetFolders( $sResourceType, $sCurrentFolder ) ; 100 break ; 101 case 'GetFoldersAndFiles' : 102 GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; 103 break ; 104 case 'CreateFolder' : 105 CreateFolder( $sResourceType, $sCurrentFolder ) ; 106 break ; 107 case 'UnlinkFile' : 108 UnlinkFile($sResourceType, $sCurrentFolder, $sCommand, input_strval('file')); 109 break; 110 111 } 112 113 CreateXmlFooter() ; 114 115 exit ; 116} 117 118function fck_write_debug($what) { 119if(is_array($what)) { 120 $what = print_r($what,true); 121} 122$dwfckFHandle = fopen("fckbrowser_dbg.txt", "a"); 123fwrite($dwfckFHandle, "$what\n"); 124fclose($dwfckFHandle); 125} 126 127?> 128