📄 io.php
字号:
<?php
function geturlfrompath( $resourceType, $folderPath )
{
if ( $resourceType == "" )
{
return removefromend( $GLOBALS['UserFilesPath'], "/" ).$folderPath;
}
else
{
return $UserFilesPath.strtolower( $resourceType ).$folderPath;
}
}
function removeextension( $fileName )
{
return substr( $fileName, 0, strrpos( $fileName, "." ) );
}
function servermapfolder( $resourceType, $folderPath )
{
$sResourceTypePath = $UserFilesDirectory.strtolower( $resourceType )."/";
$sErrorMsg = createserverfolder( $sResourceTypePath );
if ( $sErrorMsg != "" )
{
if ( isset( $HeaderSent ) && $HeaderSent )
{
senderrornode( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" );
createxmlfooter( );
exit( );
}
else
{
senderror( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" );
}
}
return $sResourceTypePath.removefromstart( $folderPath, "/" );
}
function getparentfolder( $folderPath )
{
$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?\$-";
return preg_replace( $sPattern, "", $folderPath );
}
function createserverfolder( $folderPath )
{
$sParent = getparentfolder( $folderPath );
if ( !file_exists( $sParent ) )
{
$sErrorMsg = createserverfolder( $sParent );
if ( $sErrorMsg != "" )
{
return $sErrorMsg;
}
}
if ( !file_exists( $folderPath ) )
{
error_reporting( 0 );
ini_set( "track_errors", "1" );
$oldumask = umask( 0 );
mkdir( $folderPath, 511 );
umask( $oldumask );
$sErrorMsg = $php_errormsg;
ini_restore( "track_errors" );
ini_restore( "error_reporting" );
return $sErrorMsg;
}
else
{
return "";
}
}
function getrootpath( )
{
$sRealPath = realpath( "./" );
$sSelfPath = $_SERVER['PHP_SELF'];
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, "/" ) );
$slash = strpos( $sRealPath, "/" ) === false ? "\\" : "/";
$sSelfPath = str_replace( "/", $slash, $sSelfPath );
$position = strpos( $sRealPath, $sSelfPath );
if ( $position === false || $position != strlen( $sRealPath ) - strlen( $sSelfPath ) )
{
senderror( 1, "Sorry, can't map \"UserFilesPath\" to a physical path. You must set the \"UserFilesAbsolutePath\" value in \"editor/filemanager/browser/default/connectors/php/config.php\"." );
}
return substr( $sRealPath, 0, $position );
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -