TYPO3
7.6
|
Public Member Functions | |
getExistingFilesConflictMode () | |
setExistingFilesConflictMode ($existingFilesConflictMode) | |
start ($fileCmds) | |
setActionPermissions (array $permissions=array()) | |
processData () | |
pushErrorMessagesToFlashMessageQueue () | |
getErrorMessages () | |
writeLog ($action, $error, $details_nr, $details, $data) | |
func_rename ($cmds) | |
func_newfolder ($cmds) | |
func_newfile ($cmds) | |
func_edit ($cmds) | |
func_unzip ($cmds) | |
Public Member Functions inherited from BasicFileUtility | |
init ($mounts, $f_ext) | |
is_allowed ($iconkey, $type) | |
checkIfFullAccess ($theDest) | |
is_webpath ($path) | |
checkIfAllowed ($ext, $theDest, $filename= '') | |
is_directory ($theDir) | |
getUniqueName ($theFile, $theDest, $dontCheckForUnique=0) | |
checkPathAgainstMounts ($thePath) | |
findFirstWebFolder () | |
slashPath ($path) | |
cleanFileName ($fileName, $charset= '') | |
Public Attributes | |
$unzipPath = '' | |
$dontCheckForUnique = 0 | |
$actionPerms | |
$recyclerFN = '_recycler_' | |
$internalUploadMap = array() | |
$lastError = '' | |
Public Attributes inherited from BasicFileUtility | |
const | UNSAFE_FILENAME_CHARACTER_EXPRESSION = '\\x00-\\x2C\\/\\x3A-\\x3F\\x5B-\\x60\\x7B-\\xBF' |
$getUniqueNamePrefix = '' | |
$maxNumber = 99 | |
$uniquePrecision = 6 | |
$maxInputNameLen = 60 | |
$tempFN = '_temp_' | |
$f_ext = array() | |
$mounts = array() | |
$webPath = '' | |
$isInit = 0 | |
$csConvObj | |
Protected Member Functions | |
transformFileReferenceToRecordReference (array $referenceRecord) | |
getFileObject ($identifier) | |
func_move ($cmds) | |
replaceFile (array $cmdArr) | |
getIndexer (ResourceStorage $storage) | |
getDatabaseConnection () | |
getBackendUser () | |
Protected Attributes | |
$existingFilesConflictMode | |
$errorMessages = array() | |
$fileCmdMap | |
$fileFactory | |
Contains functions for performing file operations like copying, pasting, uploading, moving, deleting etc. through the TCE
See document "TYPO3 Core API" for syntax
This class contains functions primarily used by tce_file.php (TYPO3 Core Engine for file manipulation) Functions include copying, moving, deleting, uploading and so on...
Important internal variables:
$filemounts (see basicFileFunctions) $f_ext (see basicFileFunctions)
All fileoperations must be within the filemount-paths. Further the fileextension MUST validate TRUE with the f_ext array
The unzip-function allows unzip only if the destination path has it's f_ext[]['allow'] set to '*'!! You are allowed to copy/move folders within the same 'space' (web/ftp). You are allowed to copy/move folders between spaces (web/ftp) IF the destination has it's f_ext[]['allow'] set to '*'!
Advice: You should always exclude php-files from the webspace. This will keep people from uploading, copy/moving and renaming files to become executable php scripts. You should never mount a ftp_space 'below' the webspace so that it reaches into the webspace. This is because if somebody unzips a zip-file in the ftp-space so that it reaches out into the webspace this will be a violation of the safety For example this is a bad idea: you have an ftp-space that is '/www/' and a web-space that is '/www/htdocs/'
Definition at line 59 of file ExtendedFileUtility.php.
func_edit | ( | $cmds | ) |
Editing textfiles or folders (action=9)
array | $cmds | $cmds['data'] is the new content. $cmds['target'] is the target (file or dir) |
Definition at line 899 of file ExtendedFileUtility.php.
References $GLOBALS, ExtendedFileUtility\getFileObject(), and GeneralUtility\inList().
Referenced by ExtendedFileUtility\processData().
|
protected |
Moving files and folders (action=3)
$cmds['data'] (string): The file/folder to move
array | $cmds | Command details as described above |
Definition at line 690 of file ExtendedFileUtility.php.
References DuplicationBehavior\CANCEL, ExtendedFileUtility\getFileObject(), and DuplicationBehavior\RENAME.
Referenced by ExtendedFileUtility\processData().
func_newfile | ( | $cmds | ) |
This creates a new file. (action=8) $cmds['data'] (string): The new file name $cmds['target'] (string): The path where to create it.
array | $cmds | Command details as described above |
Definition at line 862 of file ExtendedFileUtility.php.
References ExtendedFileUtility\getFileObject(), and ExtendedFileUtility\writeLog().
Referenced by ExtendedFileUtility\processData().
func_newfolder | ( | $cmds | ) |
This creates a new folder. (action=6)
$cmds['data'] (string): The new folder name $cmds['target'] (string): The path where to copy to.
array | $cmds | Command details as described above |
Definition at line 824 of file ExtendedFileUtility.php.
References ExtendedFileUtility\getFileObject().
Referenced by ExtendedFileUtility\processData().
func_rename | ( | $cmds | ) |
Renaming files or foldes (action=5)
$cmds['data'] (string): The file/folder to copy
array | $cmds | Command details as described above |
Definition at line 770 of file ExtendedFileUtility.php.
References ExtendedFileUtility\getFileObject().
Referenced by ExtendedFileUtility\processData().
func_unzip | ( | $cmds | ) |
Unzipping file (action=7) This is permitted only if the user has fullAccess or if the file resides
array | $cmds | $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. |
Definition at line 1040 of file ExtendedFileUtility.php.
References BasicFileUtility\checkIfFullAccess(), BasicFileUtility\checkPathAgainstMounts(), CommandUtility\exec(), BasicFileUtility\is_directory(), and GeneralUtility\split_fileref().
Referenced by ExtendedFileUtility\processData().
|
protected |
Definition at line 1191 of file ExtendedFileUtility.php.
References $GLOBALS.
Referenced by ExtendedFileUtility\writeLog().
|
protected |
Get database connection
Definition at line 1183 of file ExtendedFileUtility.php.
References $GLOBALS.
Referenced by ExtendedFileUtility\transformFileReferenceToRecordReference().
getErrorMessages | ( | ) |
Return all error messages from the file operations of this script instance
Definition at line 343 of file ExtendedFileUtility.php.
References ExtendedFileUtility\$errorMessages.
Referenced by ExtendedFileUtility\pushErrorMessagesToFlashMessageQueue().
getExistingFilesConflictMode | ( | ) |
Get existingFilesConflictMode
Definition at line 157 of file ExtendedFileUtility.php.
References ExtendedFileUtility\$existingFilesConflictMode.
|
protected |
Gets a File or a Folder object from an identifier [storage]:[fileId]
string | $identifier |
\TYPO3\CMS\Core\Resource\Exception\InvalidFileException |
Definition at line 588 of file ExtendedFileUtility.php.
Referenced by ExtendedFileUtility\func_edit(), ExtendedFileUtility\func_move(), ExtendedFileUtility\func_newfile(), ExtendedFileUtility\func_newfolder(), ExtendedFileUtility\func_rename(), and ExtendedFileUtility\replaceFile().
|
protected |
Gets Indexer
\TYPO3\CMS\Core\Resource\ResourceStorage | $storage |
Definition at line 1173 of file ExtendedFileUtility.php.
References GeneralUtility\makeInstance().
processData | ( | ) |
Processing the command array in $this->fileCmdMap
\UnexpectedValueException |
Definition at line 225 of file ExtendedFileUtility.php.
References $GLOBALS, ExtendedFileUtility\func_edit(), ExtendedFileUtility\func_move(), ExtendedFileUtility\func_newfile(), ExtendedFileUtility\func_newfolder(), ExtendedFileUtility\func_rename(), ExtendedFileUtility\func_unzip(), GeneralUtility\getUserObj(), ExtendedFileUtility\replaceFile(), and ExtendedFileUtility\writeLog().
pushErrorMessagesToFlashMessageQueue | ( | ) |
Adds all log error messages from the operations of this script instance to the FlashMessageQueue
Definition at line 324 of file ExtendedFileUtility.php.
References AbstractMessage\ERROR, ExtendedFileUtility\getErrorMessages(), and GeneralUtility\makeInstance().
|
protected |
Replaces a file on the filesystem and changes the identifier of the persisted file object in sys_file if keepFilename is not checked. If keepFilename is checked, only the file content will be replaced.
array | $cmdArr |
\TYPO3\CMS\Core\Resource\Exception\InsufficientFileAccessPermissionsException | |
\TYPO3\CMS\Core\Resource\Exception\InvalidFileException |
Definition at line 1095 of file ExtendedFileUtility.php.
References ExtendedFileUtility\getFileObject(), DuplicationBehavior\RENAME, and DuplicationBehavior\REPLACE.
Referenced by ExtendedFileUtility\processData().
setActionPermissions | ( | array | $permissions = array() | ) |
Sets the file action permissions. If no argument is given, permissions of the currently logged in backend user are taken into account.
array | $permissions | File Permissions. |
Definition at line 211 of file ExtendedFileUtility.php.
References $GLOBALS.
setExistingFilesConflictMode | ( | $existingFilesConflictMode | ) |
Set existingFilesConflictMode
\TYPO3\CMS\Core\Resource\DuplicationBehavior | string | $existingFilesConflictMode | Instance or constant of |
Exception |
Definition at line 169 of file ExtendedFileUtility.php.
References ExtendedFileUtility\$existingFilesConflictMode, Enumeration\cast(), and Enumeration\getConstants().
start | ( | $fileCmds | ) |
Initialization of the class
array | $fileCmds | Array with the commands to execute. See "TYPO3 Core API" document |
Definition at line 190 of file ExtendedFileUtility.php.
References $GLOBALS, ExtendedFileUtility\$unzipPath, and ResourceFactory\getInstance().
|
protected |
Maps results from the fal file reference table on the structure of the normal reference index table.
array | $referenceRecord |
Definition at line 564 of file ExtendedFileUtility.php.
References ExtendedFileUtility\getDatabaseConnection().
writeLog | ( | $action, | |
$error, | |||
$details_nr, | |||
$details, | |||
$data | |||
) |
int | $action | The action number. See the functions in the class for a hint. Eg. edit is '9', upload is '1' ... |
int | $error | The severity: 0 = message, 1 = error, 2 = System Error, 3 = security notice (admin) |
int | $details_nr | 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 | $details | This is the default, raw error message in english |
array | $data | Array with special information that may go into $details by "%s" marks / sprintf() when the log is shown |
Definition at line 356 of file ExtendedFileUtility.php.
References ExtendedFileUtility\$lastError, and ExtendedFileUtility\getBackendUser().
Referenced by ExtendedFileUtility\func_newfile(), and ExtendedFileUtility\processData().
$actionPerms |
Definition at line 93 of file ExtendedFileUtility.php.
$dontCheckForUnique = 0 |
Definition at line 76 of file ExtendedFileUtility.php.
|
protected |
Definition at line 138 of file ExtendedFileUtility.php.
Referenced by ExtendedFileUtility\getErrorMessages().
|
protected |
Definition at line 84 of file ExtendedFileUtility.php.
Referenced by ExtendedFileUtility\getExistingFilesConflictMode(), and ExtendedFileUtility\setExistingFilesConflictMode().
|
protected |
Definition at line 143 of file ExtendedFileUtility.php.
|
protected |
Definition at line 150 of file ExtendedFileUtility.php.
$internalUploadMap = array() |
Definition at line 126 of file ExtendedFileUtility.php.
$lastError = '' |
Definition at line 131 of file ExtendedFileUtility.php.
Referenced by ExtendedFileUtility\writeLog().
$recyclerFN = '_recycler_' |
Definition at line 119 of file ExtendedFileUtility.php.
$unzipPath = '' |
Definition at line 68 of file ExtendedFileUtility.php.
Referenced by ExtendedFileUtility\start().