Update of /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25920/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php Modified Files: basexml.php commands.php connector.php io.php util.php Log Message: Commiting file additions and modification from SVN revision 1841 to 1842... Changes made by vinicius on 2005-08-23 15:49:13 +0200 (Tue, 23 Aug 2005) corresponding to SVN revision 1842 with message: License file included in thyapi Index: io.php =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php/io.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** io.php 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- io.php 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,17 **** * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-17 07:50:01 * * File Authors: --- 12,17 ---- * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-19 16:03:39 * * File Authors: *************** *** 37,41 **** // $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . $resourceType . '\\' ; $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . $resourceType . '/' ; ! // Ensure that the directory exists. CreateServerFolder( $sResourceTypePath ) ; --- 37,41 ---- // $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . $resourceType . '\\' ; $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . $resourceType . '/' ; ! // Ensure that the directory exists. CreateServerFolder( $sResourceTypePath ) ; *************** *** 57,61 **** // Check if the parent exists, or create it. ! if ( !file_exists( $sParent ) ) { $sErrorMsg = CreateServerFolder( $sParent ) ; --- 57,61 ---- // Check if the parent exists, or create it. ! if ( !file_exists( $sParent ) ) { $sErrorMsg = CreateServerFolder( $sParent ) ; *************** *** 63,67 **** return $sErrorMsg ; } ! if ( !file_exists( $folderPath ) ) { --- 63,67 ---- return $sErrorMsg ; } ! if ( !file_exists( $folderPath ) ) { *************** *** 71,75 **** --- 71,78 ---- ini_set( 'track_errors', '1' ) ; + // To create the folder with 0777 permissions, we need to set umask to zero. + $oldumask = umask(0) ; mkdir( $folderPath, 0777 ) ; + umask( $oldumask ) ; $sErrorMsg = $php_errormsg ; *************** *** 87,91 **** function GetRootPath() { ! $sRealPath = realpath( './' ) ; // $sSelfPath = str_replace( '/', '\\', $_SERVER['PHP_SELF'] ) ; --- 90,94 ---- function GetRootPath() { ! $sRealPath = realpath( './' ) ; // $sSelfPath = str_replace( '/', '\\', $_SERVER['PHP_SELF'] ) ; Index: connector.php =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php/connector.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** connector.php 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- connector.php 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 10,17 **** * * File Name: connector.php ! * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-17 07:47:40 * * File Authors: --- 10,17 ---- * * File Name: connector.php ! * This is the File Manager Connector for PHP. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-08 11:48:55 * * File Authors: *************** *** 19,22 **** --- 19,23 ---- */ + include('config.php') ; include('util.php') ; include('io.php') ; *************** *** 27,39 **** $GLOBALS["UserFilesPath"] = '' ; ! if ( isset( $_GET['ServerPath'] ) ) ! { $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ; - if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) ) - $GLOBALS["UserFilesPath"] .= '/' ; - } else $GLOBALS["UserFilesPath"] = '/UserFiles/' ; // Map the "UserFiles" path to a local directory. //$GLOBALS["UserFilesDirectory"] = GetRootPath() . str_replace( '/', '\\', $GLOBALS["UserFilesPath"] ) ; --- 28,41 ---- $GLOBALS["UserFilesPath"] = '' ; ! if ( isset( $Config['UserFilesPath'] ) ) ! $GLOBALS["UserFilesPath"] = $Config['UserFilesPath'] ; ! else if ( isset( $_GET['ServerPath'] ) ) $GLOBALS["UserFilesPath"] = $_GET['ServerPath'] ; else $GLOBALS["UserFilesPath"] = '/UserFiles/' ; + if ( ! ereg( '/$', $GLOBALS["UserFilesPath"] ) ) + $GLOBALS["UserFilesPath"] .= '/' ; + // Map the "UserFiles" path to a local directory. //$GLOBALS["UserFilesDirectory"] = GetRootPath() . str_replace( '/', '\\', $GLOBALS["UserFilesPath"] ) ; *************** *** 52,55 **** --- 54,61 ---- $sCurrentFolder = $_GET['CurrentFolder'] ; + // Check if it is an allowed type. + if ( !in_array( $sResourceType, array('File','Image','Flash','Media') ) ) + return ; + // Check the current folder syntax (must begin and start with a slash). if ( ! ereg( '/$', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; Index: basexml.php =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php/basexml.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** basexml.php 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- basexml.php 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,16 **** * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC2 * Modified: 2004-12-10 17:49:19 * --- 12,16 ---- * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC3 * Modified: 2004-12-10 17:49:19 * Index: commands.php =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php/commands.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** commands.php 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- commands.php 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,17 **** * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC2 ! * Modified: 2004-12-10 17:49:19 * * File Authors: --- 12,17 ---- * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC3 ! * Modified: 2005-02-19 16:02:38 * * File Authors: *************** *** 29,33 **** $oCurrentFolder = opendir( $sServerDir ) ; ! while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) ) --- 29,33 ---- $oCurrentFolder = opendir( $sServerDir ) ; ! while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) ) *************** *** 36,40 **** closedir( $oCurrentFolder ) ; ! // Close the "Folders" node. echo "</Folders>" ; --- 36,40 ---- closedir( $oCurrentFolder ) ; ! // Close the "Folders" node. echo "</Folders>" ; *************** *** 51,56 **** $oCurrentFolder = opendir( $sServerDir ) ; ! ! while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' ) --- 51,56 ---- $oCurrentFolder = opendir( $sServerDir ) ; ! ! while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' ) *************** *** 75,79 **** // Close the "Folders" node. echo '</Folders>' ; ! echo $sFiles ; // Close the "Files" node. --- 75,79 ---- // Close the "Folders" node. echo '</Folders>' ; ! echo $sFiles ; // Close the "Files" node. *************** *** 92,96 **** // Map the virtual path to the local server path of the current folder. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; ! if ( is_writable( $sServerDir ) ) { --- 92,96 ---- // Map the virtual path to the local server path of the current folder. $sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ; ! if ( is_writable( $sServerDir ) ) { *************** *** 138,161 **** $sFileName = $oFile['name'] ; $sOriginalFileName = $sFileName ; ! $iCounter = 0 ; ! while ( true ) { ! $sFilePath = $sServerDir . $sFileName ; ! if ( is_file( $sFilePath ) ) ! { ! $iCounter++ ; ! $oPathInfo = pathinfo( $sFilePath ) ; ! $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $oPathInfo['extension'] ; ! $sErrorNumber = '201' ; ! } ! else { ! move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; ! break ; } } } else --- 138,179 ---- $sFileName = $oFile['name'] ; $sOriginalFileName = $sFileName ; + $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; ! global $Config ; ! $arAllowed = $Config['AllowedExtensions'][$resourceType] ; ! $arDenied = $Config['DeniedExtensions'][$resourceType] ; ! ! if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) ) { ! $iCounter = 0 ; ! while ( true ) { ! $sFilePath = $sServerDir . $sFileName ; ! ! if ( is_file( $sFilePath ) ) ! { ! $iCounter++ ; ! $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; ! $sErrorNumber = '201' ; ! } ! else ! { ! move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; ! ! if ( is_file( $sFilePath ) ) ! { ! $oldumask = umask(0) ; ! chmod( $sFilePath, 0777 ) ; ! umask( $oldumask ) ; ! } ! ! break ; ! } } } + else + $sErrorNumber = '202' ; } else Index: util.php =================================================================== RCS file: /cvsroot/thyapi/thyapi/thywidgets/external/fckeditor/editor/filemanager/browser/default/connectors/php/util.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** util.php 28 Feb 2005 00:33:27 -0000 1.1.1.1 --- util.php 23 Aug 2005 13:14:07 -0000 1.2 *************** *** 12,16 **** * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC2 * Modified: 2004-12-10 17:46:39 * --- 12,16 ---- * This is the File Manager Connector for ASP. * ! * Version: 2.0 RC3 * Modified: 2004-12-10 17:46:39 * |