Source for file pcf_file.phpinc
Documentation is available at pcf_file.phpinc
* Common Directory Functions
* @project Open CSP-Management
* @author Peter Krebs (pk)<p.krebs@wpus.at>
* @copyright (c) 2002-2005 by Peter Krebs and WURM und Partner Unternehmensservice GmbH.
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* returns a filename where some special char are converted
* unknown chars are replaced with _
* @param string $fileName
* @param string $replChar
* @version pk-05-03-17 $replChar added
* returns a clean filepath (remove multiple $dirSep)
* @param string $filePath
$filePath =
trim($filePath);
if (substr($filePath,0,1) ==
$dirSep )
if ($arr_path =
explode($dirSep,$filePath))
foreach($arr_path as $str_part)
$str_ret .=
$cha_sep .
$str_part;
* removes a file from the project
* this function is designed to bypass safe_mode restrictions for
* some allowed directories see $GLOBALS['BYPASS_SAFEMODE']['PROJ_DIRS']
* if $file is within this path a unlink shellscript is executed
* otherwise the php unlink command is executed
* @todo only in design state now just calls unlink($file)
* this function is designed to bypass safe_mode restrictions for
* some allowed directories see $GLOBALS['BYPASS_SAFEMODE']['PROJ_DIRS']
* @todo only in design state now just calls file_exists($file)
if ($debug) echo
"<p><b>pcf_fileExists($file,$debug)</b></p>";
* this function is designed to bypass safe_mode restrictions for
* some allowed directories see $GLOBALS['BYPASS_SAFEMODE']['PROJ_DIRS']
* @todo only in design state now just calls symlink($source,$dest)
if ($debug) echo
"<p><b>pcf_fileLink($source,$dest,$debug)</b></p>";
* this function is designed to bypass safe_mode restrictions for
* some allowed directories see $GLOBALS['BYPASS_SAFEMODE']['PROJ_DIRS']
* @todo only in design state now just calls copy() and unlink()
if ($debug) echo
"<p><b>pcf_fileMove($source,$dest,$debug)</b></p>";
if (copy($source,$dest)) {
* size of a file in bytes
* this function is designed to bypass safe_mode restrictions for
* some allowed directories see $GLOBALS['BYPASS_SAFEMODE']['PROJ_DIRS']
if ($debug) echoDebug(__FILE__
,"<p><b>pcf_fileSize($file,$debug)</b></p>");
* returns the extension of a fileName (the last .xxx)
* @param string $fileName
if ($debug) echo
"<p><b>pcf_fileGetExtension($fileName)</b> (".__FILE__.
")</p>";
if (!strstr($fileName,".")) return "";
return ".".
$a_parts[sizeof($a_parts)-
1];
* generates a unique file name
* @param string $fileName
$s_ext=
".".
$a_exts[count($a_exts)-
1];
* checks if a file is a file (follow links)
Documentation generated on Thu, 08 Jan 2009 17:47:47 +0100 by phpDocumentor 1.4.0a2