[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php /* 2 * FCKeditor - The text editor for internet 3 * Copyright 2006 osCMax2003-2005 Frederico Caldeira Knabben 4 * 5 * Licensed under the terms of the GNU Lesser General Public License: 6 * http://www.opensource.org/licenses/lgpl-license.php 7 * 8 * For further information visit: 9 * http://www.fckeditor.net/ 10 * 11 * File Name: io.php 12 * This is the File Manager Connector for ASP. 13 * 14 * File Authors: 15 * Frederico Caldeira Knabben ([email protected]) 16 */ 17 18 function GetUrlFromPath( $resourceType, $folderPath ) 19 { 20 if ( $resourceType == '' ) 21 return RemoveFromEnd( $GLOBALS["UserFilesPath"], '/' ) . $folderPath ; 22 else 23 return $GLOBALS["UserFilesPath"] . $resourceType . $folderPath ; 24 } 25 26 function RemoveExtension( $fileName ) 27 { 28 return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ; 29 } 30 31 function ServerMapFolder( $resourceType, $folderPath ) 32 { 33 // Get the resource type directory. 34 // $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . $resourceType . '\\' ; 35 $sResourceTypePath = $GLOBALS["UserFilesDirectory"] . $resourceType . '/' ; 36 37 // Ensure that the directory exists. 38 CreateServerFolder( $sResourceTypePath ) ; 39 40 // Return the resource type directory combined with the required path. 41 // return $sResourceTypePath . str_replace( '/', '\\', RemoveFromStart( $folderPath, '/' ) ) ; 42 return $sResourceTypePath . RemoveFromStart( $folderPath, '/' ) ; 43 } 44 45 function GetParentFolder( $folderPath ) 46 { 47 $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; 48 return preg_replace( $sPattern, '', $folderPath ) ; 49 } 50 51 function CreateServerFolder( $folderPath ) 52 { 53 $sParent = GetParentFolder( $folderPath ) ; 54 55 // Check if the parent exists, or create it. 56 if ( !file_exists( $sParent ) ) 57 { 58 $sErrorMsg = CreateServerFolder( $sParent ) ; 59 if ( $sErrorMsg != '' ) 60 return $sErrorMsg ; 61 } 62 63 if ( !file_exists( $folderPath ) ) 64 { 65 // Turn off all error reporting. 66 error_reporting( 0 ) ; 67 // Enable error tracking to catch the error. 68 ini_set( 'track_errors', '1' ) ; 69 70 // To create the folder with 0777 permissions, we need to set umask to zero. 71 $oldumask = umask(0) ; 72 mkdir( $folderPath, 0777 ) ; 73 umask( $oldumask ) ; 74 75 $sErrorMsg = $php_errormsg ; 76 77 // Restore the configurations. 78 ini_restore( 'track_errors' ) ; 79 ini_restore( 'error_reporting' ) ; 80 81 return $sErrorMsg ; 82 } 83 else 84 return '' ; 85 } 86 87 function GetRootPath() 88 { 89 $sRealPath = realpath( './' ) ; 90 91 // $sSelfPath = str_replace( '/', '\\', $_SERVER['PHP_SELF'] ) ; 92 $sSelfPath = $_SERVER['PHP_SELF'] ; 93 // $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '\\' ) ) ; 94 $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ; 95 96 return substr( $sRealPath, 0, strlen( $sRealPath ) - strlen( $sSelfPath ) ) ; 97 } 98 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |