t3lib_extFileFunctions Klassenreferenz
Aufstellung aller Elemente
Öffentliche Methoden |
| | start ($fileCmds) |
| | init_actionPerms ($setup) |
| | processData () |
| | printLogErrorMessages ($redirect='') |
| | findRecycler ($theFile) |
| | writeLog ($action, $error, $details_nr, $details, $data) |
| | func_delete ($cmds) |
| | func_copy ($cmds) |
| | func_move ($cmds) |
| | func_rename ($cmds) |
| | func_newfolder ($cmds) |
| | func_newfile ($cmds) |
| | func_edit ($cmds) |
| | func_upload ($cmds) |
| | func_unzip ($cmds) |
| | 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) |
| | getUniqueName ($theFile, $theDest, $dontCheckForUnique=0) |
| | checkPathAgainstMounts ($thePath) |
| | findFirstWebFolder () |
| | blindPath ($thePath) |
| | findTempFolder () |
| | cleanDirectoryName ($theDir) |
| | rmDoubleSlash ($string) |
| | slashPath ($path) |
| | cleanFileName ($fileName, $charset='') |
| | formatSize ($sizeInBytes) |
Öffentliche Attribute |
|
| $maxCopyFileSize = 10000 |
|
| $maxMoveFileSize = 10000 |
|
| $maxUploadFileSize = 10000 |
|
| $unzipPath = '' |
|
| $dontCheckForUnique = 0 |
| | $actionPerms |
|
| $recyclerFN = '_recycler_' |
|
| $useRecycler = 1 |
|
| $PHPFileFunctions = 0 |
|
| $dont_use_exec_commands = 0 |
|
| $internalUploadMap = array() |
|
| $lastError = '' |
|
| $getUniqueNamePrefix = '' |
|
| $maxNumber = 99 |
|
| $uniquePrecision = 6 |
|
| $maxInputNameLen = 60 |
|
| $tempFN = '_temp_' |
|
| $f_ext = Array() |
|
| $mounts = Array() |
|
| $webPath = '' |
|
| $isInit = 0 |
Dokumentation der Elementfunktionen
| t3lib_basicFileFunctions::blindPath |
( |
$ |
thePath |
) |
[inherited] |
Removes filemount part of a path, thus blinding the position. Takes a path, $thePath, and removes the part of the path which equals the filemount.
- Parameter:
-
| string | $thePath is a path which MUST be found within one of the internally set filemounts, $this->mounts |
- Rückgabe:
- string The processed input path
| t3lib_basicFileFunctions::checkFileNameLen |
( |
$ |
fileName |
) |
[inherited] |
Returns true if the input filename string is shorter than $this->maxInputNameLen.
- Parameter:
-
| string | Filename, eg "somefile.html" |
- Rückgabe:
- boolean
| t3lib_basicFileFunctions::checkIfAllowed |
( |
$ |
ext, |
|
|
$ |
theDest, |
|
|
$ |
filename = '' | |
|
) |
| | [inherited] |
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)
- Parameter:
-
| string | File extension, eg. "php" or "html" |
| string | Absolute path for which to test |
| string | Filename to check against TYPO3_CONF_VARS[BE][fileDenyPattern] |
- Rückgabe:
- boolean True if extension/filename is allowed
| t3lib_basicFileFunctions::checkIfFullAccess |
( |
$ |
theDest |
) |
[inherited] |
Returns true if you can operate of ANY file ('*') in the space $theDest is in ('webspace' / 'ftpspace')
- Parameter:
-
- Rückgabe:
- boolean
| t3lib_basicFileFunctions::checkPathAgainstMounts |
( |
$ |
thePath |
) |
[inherited] |
Checks if $thePath is a path under one of the paths in $this->mounts See comment in the header of this class.
- Parameter:
-
| string | $thePath MUST HAVE a trailing '/' in order to match correctly with the mounts |
- Rückgabe:
- string The key to the first mount found, otherwise nothing is returned.
- Siehe auch:
- init()
| t3lib_basicFileFunctions::cleanDirectoryName |
( |
$ |
theDir |
) |
[inherited] |
Removes all dots, slashes and spaces after a path...
- Parameter:
-
- Rückgabe:
- string Output string
| t3lib_basicFileFunctions::cleanFileName |
( |
$ |
fileName, |
|
|
$ |
charset = '' | |
|
) |
| | [inherited] |
Returns a string where any character not matching [.a-zA-Z0-9_-] is substituted by '_' and trailing dots are removed
- Parameter:
-
| string | Input string, typically the body of a filename |
| string | Charset of the a filename (defaults to current charset; depending on context) |
- Rückgabe:
- string Output string with any characters not matching [.a-zA-Z0-9_-] is substituted by '_', trailing dots are simply removed
| t3lib_basicFileFunctions::findFirstWebFolder |
( |
|
) |
[inherited] |
Find first web folder (relative to PATH_site.'fileadmin') in filemounts array
- Rückgabe:
- string The key to the first mount inside PATH_site."fileadmin" found, otherwise nothing is returned.
| t3lib_extFileFunctions::findRecycler |
( |
$ |
theFile |
) |
|
Goes back in the path and checks in each directory if a folder named $this->recyclerFN (usually '_recycler_') is present. If a folder in the tree happens to be a _recycler_-folder (which means that we're deleting something inside a _recycler_-folder) this is ignored
- Parameter:
-
| string | Takes a valid Path ($theFile) |
- Rückgabe:
- string Returns the path (without trailing slash) of the closest recycle-folder if found. Else false.
| t3lib_basicFileFunctions::findTempFolder |
( |
|
) |
[inherited] |
Find temporary folder Finds the first $this->tempFN ('_temp_' usually) -folder in the internal array of filemounts, $this->mounts
- Rückgabe:
- string Returns the path if found, otherwise nothing if error.
| t3lib_basicFileFunctions::formatSize |
( |
$ |
sizeInBytes |
) |
[inherited] |
Formats an integer, $sizeInBytes, to Mb or Kb or just bytes
- Parameter:
-
| integer | Bytes to be formated |
- Rückgabe:
- string Formatted with M,K or appended.
| t3lib_extFileFunctions::func_copy |
( |
$ |
cmds |
) |
|
Copying files and folders (action=2)
- Parameter:
-
| array | $cmds['data'] is the file/folder to copy. $cmds['target'] is the path where to copy to. $cmds['altName'] (boolean): If set, another filename is found in case the target already exists |
- Rückgabe:
- string Returns the new filename upon success
| t3lib_extFileFunctions::func_delete |
( |
$ |
cmds |
) |
|
Deleting files and folders (action=4)
- Parameter:
-
| array | $cmds['data'] is the file/folder to delete |
- Rückgabe:
- boolean Returns true upon success
| t3lib_extFileFunctions::func_edit |
( |
$ |
cmds |
) |
|
Editing textfiles or folders (action=9)
- Parameter:
-
| array | $cmds['data'] is the new content. $cmds['target'] is the target (file or dir) |
- Rückgabe:
- boolean Returns true on success
| t3lib_extFileFunctions::func_move |
( |
$ |
cmds |
) |
|
Moving files and folders (action=3)
- Parameter:
-
| array | $cmds['data'] is the file/folder to move. $cmds['target'] is the path where to move to. $cmds['altName'] (boolean): If set, another filename is found in case the target already exists |
- Rückgabe:
- string Returns the new filename upon success
| t3lib_extFileFunctions::func_newfile |
( |
$ |
cmds |
) |
|
This creates a new file. (action=8)
- Parameter:
-
| array | $cmds['data'] is the new filename. $cmds['target'] is the path where to create it |
- Rückgabe:
- string Returns the new filename upon success
| t3lib_extFileFunctions::func_newfolder |
( |
$ |
cmds |
) |
|
This creates a new folder. (action=6)
- Parameter:
-
| array | $cmds['data'] is the foldername. $cmds['target'] is the path where to create it. |
- Rückgabe:
- string Returns the new foldername upon success
| t3lib_extFileFunctions::func_rename |
( |
$ |
cmds |
) |
|
Renaming files or foldes (action=5)
- Parameter:
-
| array | $cmds['data'] is the new name. $cmds['target'] is the target (file or dir). |
- Rückgabe:
- string Returns the new filename upon success
| t3lib_extFileFunctions::func_unzip |
( |
$ |
cmds |
) |
|
Unzipping file (action=7) This is permitted only if the user has fullAccess or if the file resides
- Parameter:
-
| array | $cmds['data'] is the zip-file. $cmds['target'] is the target directory. If not set we'll default to the same directory as the file is in. |
- Rückgabe:
- boolean Returns true on success
| t3lib_extFileFunctions::func_upload |
( |
$ |
cmds |
) |
|
Upload of files (action=1)
- Parameter:
-
| array | $cmds['data'] is the ID-number (points to the global var that holds the filename-ref ($_FILES['upload_'.$id]['name']). $cmds['target'] is the target directory |
- Rückgabe:
- string Returns the new filename upon success
| t3lib_basicFileFunctions::getTotalFileInfo |
( |
$ |
wholePath |
) |
[inherited] |
Returns an array with a whole lot of fileinformation.
- Parameter:
-
| string | Filepath to existing file. Should probably be absolute. Filefunctions are performed on this value. |
- Rückgabe:
- array Information about the file in the filepath
| t3lib_basicFileFunctions::getUniqueName |
( |
$ |
theFile, |
|
|
$ |
theDest, |
|
|
$ |
dontCheckForUnique = 0 | |
|
) |
| | [inherited] |
Returns the destination path/filename of a unique filename/foldername in that path. If $theFile exists in $theDest (directory) the file have numbers appended up to $this->maxNumber. Hereafter a unique string will be appended. This function is used by fx. TCEmain when files are attached to records and needs to be uniquely named in the uploads/* folders
- Parameter:
-
| string | The input filename to check |
| string | The directory for which to return a unique filename for $theFile. $theDest MUST be a valid directory. Should be absolute. |
| boolean | If set the filename is returned with the path prepended without checking whether it already existed! |
- Rückgabe:
- string The destination absolute filepath (not just the name!) of a unique filename/foldername in that path.
- Siehe auch:
- t3lib_TCEmain::checkValue()
| t3lib_basicFileFunctions::init |
( |
$ |
mounts, |
|
|
$ |
f_ext | |
|
) |
| | [inherited] |
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']= PHP_EXTENSIONS_DEFAULT; $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']);
- Parameter:
-
| 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'] |
- Rückgabe:
- void
- Siehe auch:
- typo3/init.php, t3lib_userAuthGroup::returnFilemounts()
| t3lib_extFileFunctions::init_actionPerms |
( |
$ |
setup |
) |
|
Sets up permission to perform file/directory operations. See below or the be_user-table for the significanse of the various bits in $setup ($BE_USER->user['fileoper_perms'])
- Parameter:
-
| integer | File permission integer from BE_USER object. |
- Rückgabe:
- void
| t3lib_basicFileFunctions::is_allowed |
( |
$ |
iconkey, |
|
|
$ |
type | |
|
) |
| | [inherited] |
Checks if a $iconkey (fileextension) is allowed according to $this->f_ext.
- Parameter:
-
| string | The extension to check, eg. "php" or "html" etc. |
| string | Either "webspage" or "ftpspace" - points to a key in $this->f_ext |
- Rückgabe:
- boolean True if file extension is allowed.
| t3lib_basicFileFunctions::is_directory |
( |
$ |
theDir |
) |
[inherited] |
Cleans $theDir for slashes in the end of the string and returns the new path, if it exists on the server.
- Parameter:
-
| string | Directory path to check |
- Rückgabe:
- string Returns the cleaned up directory name if OK, otherwise false.
| t3lib_basicFileFunctions::is_webpath |
( |
$ |
path |
) |
[inherited] |
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...
- Parameter:
-
| string | Absolute path to check |
- Rückgabe:
- boolean
| t3lib_basicFileFunctions::isPathValid |
( |
$ |
theFile |
) |
[inherited] |
| t3lib_extFileFunctions::printLogErrorMessages |
( |
$ |
redirect = '' |
) |
|
Print log error messages from the operations of this script instance
- Parameter:
-
| string | Redirect URL (for creating link in message) |
- Rückgabe:
- void (Will exit on error)
| t3lib_extFileFunctions::processData |
( |
|
) |
|
Processing the command array in $this->fileCmdMap
- Rückgabe:
- void
| t3lib_basicFileFunctions::rmDoubleSlash |
( |
$ |
string |
) |
[inherited] |
Converts any double slashes (//) to a single slash (/)
- Parameter:
-
- Rückgabe:
- string Returns the converted string
| t3lib_basicFileFunctions::slashPath |
( |
$ |
path |
) |
[inherited] |
Returns a string which has a slash '/' appended if it doesn't already have that slash
- Parameter:
-
- Rückgabe:
- string Output string with a slash in the end (if not already there)
| t3lib_extFileFunctions::start |
( |
$ |
fileCmds |
) |
|
Initialization of the class
- Parameter:
-
| array | The $file array with the commands to execute. See "TYPO3 Core API" document |
- Rückgabe:
- void
| t3lib_extFileFunctions::writeLog |
( |
$ |
action, |
|
|
$ |
error, |
|
|
$ |
details_nr, |
|
|
$ |
details, |
|
|
$ |
data | |
|
) |
| | |
Logging file operations
- Parameter:
-
| integer | The action number. See the functions in the class for a hint. Eg. edit is '9', upload is '1' ... |
| integer | The severity: 0 = message, 1 = error, 2 = System Error, 3 = security notice (admin) |
| integer | This number is unique for every combination of $type and $action. This is the error-message number, which can later be used to translate error messages. |
| string | This is the default, raw error message in english |
| array | Array with special information that may go into $details by "%s" marks / sprintf() when the log is shown |
- Rückgabe:
- void
- Siehe auch:
- class.t3lib_userauthgroup.php
Dokumentation der Datenelemente
| t3lib_extFileFunctions::$actionPerms |
Initialisierung: Array(
'deleteFile' => 0,
'deleteFolder' => 0,
'deleteFolderRecursively' => 0,
'moveFile' => 0,
'moveFolder' => 0,
'copyFile' => 0,
'copyFolder' => 0,
'newFolder' => 0,
'newFile' => 0,
'editFile' => 0,
'unzipFile' => 0,
'uploadFile' => 0,
'renameFile' => 0,
'renameFolder' => 0
)
Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei:
- /srv/www/vhosts/typo3.local/typo3_src-4.2.10/t3lib/class.t3lib_extfilefunc.php