t3lib_basicFileFunctions Class Reference

Inheritance diagram for t3lib_basicFileFunctions:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 init ($mounts, $f_ext)
 getTotalFileInfo ($wholePath)
 is_allowed ($iconkey, $type)
 checkIfFullAccess ($theDest)
 is_webpath ($path)
 checkIfAllowed ($ext, $theDest, $filename=')
 checkFileNameLen ($fileName)
 is_directory ($theDir)
 isPathValid ($theFile)
 init ($mounts, $f_ext)
 getTotalFileInfo ($wholePath)
 is_allowed ($iconkey, $type)
 checkIfFullAccess ($theDest)
 is_webpath ($path)
 checkIfAllowed ($ext, $theDest, $filename=')
 checkFileNameLen ($fileName)
 is_directory ($theDir)
 isPathValid ($theFile)

Public Attributes

 $getUniqueNamePrefix = ''
 $maxNumber = 20
 $uniquePrecision = 6
 $maxInputNameLen = 30
 $tempFN = '_temp_'
 $f_ext = Array()
 $mounts = Array()
 $webPath = ''
 $isInit = 0

Detailed Description

Definition at line 81 of file class.t3lib_basicfilefunc.php.


Member Function Documentation

t3lib_basicFileFunctions::checkFileNameLen fileName  ) 
 

Returns true if the input filename string is shorter than $this->maxInputNameLen.

Parameters:
string Filename, eg "somefile.html"
Returns:
boolean

Definition at line 239 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::checkFileNameLen fileName  ) 
 

Returns true if the input filename string is shorter than $this->maxInputNameLen.

Parameters:
string Filename, eg "somefile.html"
Returns:
boolean

Definition at line 239 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::checkIfAllowed ext,
theDest,
filename = '
 

If the filename is given, check it against the TYPO3_CONF_VARS[BE][fileDenyPattern] + Checks if the $ext fileextension is allowed in the path $theDest (this is based on whether $theDest is below the $this->webPath)

Parameters:
string File extension, eg. "php" or "html"
string Absolute path for which to test
string Filename to check against TYPO3_CONF_VARS[BE][fileDenyPattern]
Returns:
boolean True if extension/filename is allowed

Definition at line 229 of file class.t3lib_basicfilefunc.php.

References is_allowed(), and t3lib_div::verifyFilenameAgainstDenyPattern().

t3lib_basicFileFunctions::checkIfAllowed ext,
theDest,
filename = '
 

If the filename is given, check it against the TYPO3_CONF_VARS[BE][fileDenyPattern] + Checks if the $ext fileextension is allowed in the path $theDest (this is based on whether $theDest is below the $this->webPath)

Parameters:
string File extension, eg. "php" or "html"
string Absolute path for which to test
string Filename to check against TYPO3_CONF_VARS[BE][fileDenyPattern]
Returns:
boolean True if extension/filename is allowed

Definition at line 229 of file class.t3lib_basicfilefunc.php.

References is_allowed(), and t3lib_div::verifyFilenameAgainstDenyPattern().

t3lib_basicFileFunctions::checkIfFullAccess theDest  ) 
 

Returns true if you can operate of ANY file ('*') in the space $theDest is in ('webspace' / 'ftpspace')

Parameters:
string Absolute path
Returns:
boolean

Definition at line 195 of file class.t3lib_basicfilefunc.php.

References $type, and is_webpath().

t3lib_basicFileFunctions::checkIfFullAccess theDest  ) 
 

Returns true if you can operate of ANY file ('*') in the space $theDest is in ('webspace' / 'ftpspace')

Parameters:
string Absolute path
Returns:
boolean

Definition at line 195 of file class.t3lib_basicfilefunc.php.

References $type, and is_webpath().

t3lib_basicFileFunctions::getTotalFileInfo wholePath  ) 
 

Returns an array with a whole lot of fileinformation.

Parameters:
string Filepath to existing file. Should probably be absolute. Filefunctions are performed on this value.
Returns:
array Information about the file in the filepath

Definition at line 150 of file class.t3lib_basicfilefunc.php.

References size, and t3lib_div::split_fileref().

t3lib_basicFileFunctions::getTotalFileInfo wholePath  ) 
 

Returns an array with a whole lot of fileinformation.

Parameters:
string Filepath to existing file. Should probably be absolute. Filefunctions are performed on this value.
Returns:
array Information about the file in the filepath

Definition at line 150 of file class.t3lib_basicfilefunc.php.

References size, and t3lib_div::split_fileref().

t3lib_basicFileFunctions::init mounts,
f_ext
 

Constructor This function should be called to initialise the internal arrays $this->mounts and $this->f_ext

A typical example of the array $mounts is this: $mounts[xx][path] = (..a mounted path..) the 'xx'-keys is just numerical from zero. There are also a [name] and [type] value that just denotes the mountname and type. Not used for athentication here. $this->mounts is traversed in the function checkPathAgainstMounts($thePath), and it is checked that $thePath is actually below one of the mount-paths The mountpaths are with a trailing '/'. $thePath must be with a trailing '/' also! As you can see, $this->mounts is very critical! This is the array that decides where the user will be allowed to copy files!! Typically the global var $WEBMOUNTS would be passed along as $mounts

A typical example of the array $f_ext is this: $f_ext['webspace']['allow']=''; $f_ext['webspace']['deny']='php3,php'; $f_ext['ftpspace']['allow']='*'; $f_ext['ftpspace']['deny']=''; The control of fileextensions goes in two catagories. Webspace and Ftpspace. Webspace is folders accessible from a webbrowser (below TYPO3_DOCUMENT_ROOT) and ftpspace is everything else. The control is done like this: If an extension matches 'allow' then the check returns true. If not and an extension matches 'deny' then the check return false. If no match at all, returns true. You list extensions comma-separated. If the value is a '*' every extension is allowed The list is case-insensitive when used in this class (see init()) Typically TYPO3_CONF_VARS['BE']['fileExtensions'] would be passed along as $f_ext.

Example: $basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);

Parameters:
array Contains the paths of the file mounts for the current BE user. Normally $GLOBALS['FILEMOUNTS'] is passed. This variable is set during backend user initialization; $FILEMOUNTS = $BE_USER->returnFilemounts(); (see typo3/init.php)
array Array with information about allowed and denied file extensions. Typically passed: $TYPO3_CONF_VARS['BE']['fileExtensions']
Returns:
void
See also:
typo3/init.php, t3lib_userAuthGroup::returnFilemounts()

Definition at line 133 of file class.t3lib_basicfilefunc.php.

References $mounts, t3lib_div::getIndpEnv(), and t3lib_div::uniqueList().

t3lib_basicFileFunctions::init mounts,
f_ext
 

Constructor This function should be called to initialise the internal arrays $this->mounts and $this->f_ext

A typical example of the array $mounts is this: $mounts[xx][path] = (..a mounted path..) the 'xx'-keys is just numerical from zero. There are also a [name] and [type] value that just denotes the mountname and type. Not used for athentication here. $this->mounts is traversed in the function checkPathAgainstMounts($thePath), and it is checked that $thePath is actually below one of the mount-paths The mountpaths are with a trailing '/'. $thePath must be with a trailing '/' also! As you can see, $this->mounts is very critical! This is the array that decides where the user will be allowed to copy files!! Typically the global var $WEBMOUNTS would be passed along as $mounts

A typical example of the array $f_ext is this: $f_ext['webspace']['allow']=''; $f_ext['webspace']['deny']='php3,php'; $f_ext['ftpspace']['allow']='*'; $f_ext['ftpspace']['deny']=''; The control of fileextensions goes in two catagories. Webspace and Ftpspace. Webspace is folders accessible from a webbrowser (below TYPO3_DOCUMENT_ROOT) and ftpspace is everything else. The control is done like this: If an extension matches 'allow' then the check returns true. If not and an extension matches 'deny' then the check return false. If no match at all, returns true. You list extensions comma-separated. If the value is a '*' every extension is allowed The list is case-insensitive when used in this class (see init()) Typically TYPO3_CONF_VARS['BE']['fileExtensions'] would be passed along as $f_ext.

Example: $basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);

Parameters:
array Contains the paths of the file mounts for the current BE user. Normally $GLOBALS['FILEMOUNTS'] is passed. This variable is set during backend user initialization; $FILEMOUNTS = $BE_USER->returnFilemounts(); (see typo3/init.php)
array Array with information about allowed and denied file extensions. Typically passed: $TYPO3_CONF_VARS['BE']['fileExtensions']
Returns:
void
See also:
typo3/init.php, t3lib_userAuthGroup::returnFilemounts()

Definition at line 133 of file class.t3lib_basicfilefunc.php.

References $mounts, t3lib_div::getIndpEnv(), and t3lib_div::uniqueList().

t3lib_basicFileFunctions::is_allowed iconkey,
type
 

Checks if a $iconkey (fileextension) is allowed according to $this->f_ext.

Parameters:
string The extension to check, eg. "php" or "html" etc.
string Either "webspage" or "ftpspace" - points to a key in $this->f_ext
Returns:
boolean True if file extension is allowed.

Definition at line 170 of file class.t3lib_basicfilefunc.php.

References t3lib_div::inList().

t3lib_basicFileFunctions::is_allowed iconkey,
type
 

Checks if a $iconkey (fileextension) is allowed according to $this->f_ext.

Parameters:
string The extension to check, eg. "php" or "html" etc.
string Either "webspage" or "ftpspace" - points to a key in $this->f_ext
Returns:
boolean True if file extension is allowed.

Definition at line 170 of file class.t3lib_basicfilefunc.php.

References t3lib_div::inList().

Referenced by checkIfAllowed().

t3lib_basicFileFunctions::is_directory theDir  ) 
 

Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.

Parameters:
string Directory path to check
Returns:
string Returns the cleaned up directory name if OK, otherwise false.

Definition at line 249 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::is_directory theDir  ) 
 

Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.

Parameters:
string Directory path to check
Returns:
string Returns the cleaned up directory name if OK, otherwise false.

Definition at line 249 of file class.t3lib_basicfilefunc.php.

Referenced by t3lib_extFileFunctions::func_copy(), t3lib_extFileFunctions::func_delete(), t3lib_extFileFunctions::func_move(), t3lib_extFileFunctions::func_newfile(), t3lib_extFileFunctions::func_newfolder(), t3lib_extFileFunctions::func_unzip(), and t3lib_extFileFunctions::func_upload().

t3lib_basicFileFunctions::is_webpath path  ) 
 

Checks if $this->webPath (should be TYPO3_DOCUMENT_ROOT) is in the first part of $path Returns true also if $this->init is not set or if $path is empty...

Parameters:
string Absolute path to check
Returns:
boolean

Definition at line 209 of file class.t3lib_basicfilefunc.php.

References t3lib_div::isFirstPartOfStr().

t3lib_basicFileFunctions::is_webpath path  ) 
 

Checks if $this->webPath (should be TYPO3_DOCUMENT_ROOT) is in the first part of $path Returns true also if $this->init is not set or if $path is empty...

Parameters:
string Absolute path to check
Returns:
boolean

Definition at line 209 of file class.t3lib_basicfilefunc.php.

References t3lib_div::isFirstPartOfStr().

Referenced by checkIfFullAccess().

t3lib_basicFileFunctions::isPathValid theFile  ) 
 

Wrapper for t3lib_div::validPathStr()

Parameters:
string Filepath to evaluate
Returns:
boolean True, if no '//', '..' or '\' is in the $theFile
See also:
t3lib_div::validPathStr()

Definition at line 266 of file class.t3lib_basicfilefunc.php.

References t3lib_div::validPathStr().

t3lib_basicFileFunctions::isPathValid theFile  ) 
 

Wrapper for t3lib_div::validPathStr()

Parameters:
string Filepath to evaluate
Returns:
boolean True, if no '//', '..' or '\' is in the $theFile
See also:
t3lib_div::validPathStr()

Definition at line 266 of file class.t3lib_basicfilefunc.php.

References t3lib_div::validPathStr().

Referenced by t3lib_extFileFunctions::func_copy(), and t3lib_extFileFunctions::func_move().


Member Data Documentation

t3lib_basicFileFunctions::$f_ext = Array()
 

Definition at line 89 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$getUniqueNamePrefix = ''
 

Definition at line 82 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$isInit = 0
 

Definition at line 92 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$maxInputNameLen = 30
 

Definition at line 85 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$maxNumber = 20
 

Definition at line 83 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$mounts = Array()
 

Definition at line 90 of file class.t3lib_basicfilefunc.php.

Referenced by init().

t3lib_basicFileFunctions::$tempFN = '_temp_'
 

Definition at line 86 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$uniquePrecision = 6
 

Definition at line 84 of file class.t3lib_basicfilefunc.php.

t3lib_basicFileFunctions::$webPath = ''
 

Definition at line 91 of file class.t3lib_basicfilefunc.php.


The documentation for this class was generated from the following files:
Generated on Wed Aug 10 07:57:26 2005 for TYPO3 3.8.0 by  doxygen 1.4.3-20050530