t3lib_extFileFunctions Class Reference

Inheritance diagram for t3lib_extFileFunctions:

Inheritance graph
[legend]
Collaboration diagram for t3lib_extFileFunctions:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 start ($fileCmds)
 init_actionPerms ($setup)
 processData ()
 printLogErrorMessages ($redirect= '')
 getErrorMessages ()
 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)

Public Attributes

 $maxCopyFileSize = 10000
 $maxMoveFileSize = 10000
 $maxUploadFileSize = 10000
 $unzipPath = ''
 $dontCheckForUnique = 0
 $actionPerms
 $recyclerFN = '_recycler_'
 $useRecycler = 1
 $PHPFileFunctions = 0
 $dont_use_exec_commands = 0
 $internalUploadMap = array()
 $lastError = ''

Detailed Description

Definition at line 105 of file class.t3lib_extfilefunc.php.


Member Function Documentation

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

Parameters:
string Takes a valid Path ($theFile)
Returns:
string Returns the path (without trailing slash) of the closest recycle-folder if found. Else false.

Definition at line 348 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::cleanDirectoryName(), t3lib_basicFileFunctions::isPathValid(), and t3lib_div::split_fileref().

Referenced by func_delete().

t3lib_extFileFunctions::func_copy ( cmds  ) 

Copying files and folders (action=2)

Parameters:
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
Returns:
string Returns the new filename upon success

Definition at line 468 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkIfAllowed(), t3lib_basicFileFunctions::checkIfFullAccess(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_div::fixPermissions(), t3lib_basicFileFunctions::getUniqueName(), t3lib_basicFileFunctions::is_directory(), t3lib_div::isFirstPartOfStr(), t3lib_basicFileFunctions::isPathValid(), and t3lib_div::split_fileref().

Referenced by processData().

t3lib_extFileFunctions::func_delete ( cmds  ) 

Deleting files and folders (action=4)

Parameters:
array $cmds['data'] is the file/folder to delete
Returns:
boolean Returns true upon success

Definition at line 405 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkPathAgainstMounts(), findRecycler(), func_move(), t3lib_basicFileFunctions::is_directory(), t3lib_basicFileFunctions::isPathValid(), and t3lib_div::rmdir().

Referenced by processData().

t3lib_extFileFunctions::func_edit ( cmds  ) 

Editing textfiles or folders (action=9)

Parameters:
array $cmds['data'] is the new content. $cmds['target'] is the target (file or dir)
Returns:
boolean Returns true on success

Definition at line 767 of file class.t3lib_extfilefunc.php.

References $content, $GLOBALS, t3lib_basicFileFunctions::checkIfAllowed(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_div::inList(), t3lib_div::split_fileref(), and t3lib_div::writeFile().

Referenced by processData().

t3lib_extFileFunctions::func_move ( cmds  ) 

Moving files and folders (action=3)

Parameters:
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
Returns:
string Returns the new filename upon success

Definition at line 559 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkIfAllowed(), t3lib_basicFileFunctions::checkIfFullAccess(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::getUniqueName(), t3lib_basicFileFunctions::is_directory(), t3lib_div::isFirstPartOfStr(), t3lib_basicFileFunctions::isPathValid(), and t3lib_div::split_fileref().

Referenced by func_delete(), and processData().

t3lib_extFileFunctions::func_newfile ( cmds  ) 

This creates a new file. (action=8)

Parameters:
array $cmds['data'] is the new filename. $cmds['target'] is the path where to create it
Returns:
string Returns the new filename upon success

Definition at line 730 of file class.t3lib_extfilefunc.php.

References $GLOBALS, t3lib_basicFileFunctions::checkFileNameLen(), t3lib_basicFileFunctions::checkIfAllowed(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::cleanFileName(), t3lib_div::inList(), t3lib_basicFileFunctions::is_directory(), t3lib_div::split_fileref(), and t3lib_div::writeFile().

Referenced by processData().

t3lib_extFileFunctions::func_newfolder ( cmds  ) 

This creates a new folder. (action=6)

Parameters:
array $cmds['data'] is the foldername. $cmds['target'] is the path where to create it.
Returns:
string Returns the new foldername upon success

Definition at line 700 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkFileNameLen(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::cleanFileName(), t3lib_basicFileFunctions::is_directory(), and t3lib_div::mkdir().

Referenced by processData().

t3lib_extFileFunctions::func_rename ( cmds  ) 

Renaming files or foldes (action=5)

Parameters:
array $cmds['data'] is the new name. $cmds['target'] is the target (file or dir).
Returns:
string Returns the new filename upon success

Definition at line 654 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkFileNameLen(), t3lib_basicFileFunctions::checkIfAllowed(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::cleanFileName(), and t3lib_div::split_fileref().

Referenced by processData().

t3lib_extFileFunctions::func_unzip ( cmds  ) 

Unzipping file (action=7) This is permitted only if the user has fullAccess or if the file resides

Parameters:
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.
Returns:
boolean Returns true on success

Definition at line 838 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkIfFullAccess(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::is_directory(), and t3lib_div::split_fileref().

Referenced by processData().

t3lib_extFileFunctions::func_upload ( cmds  ) 

Upload of files (action=1)

Parameters:
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, $cmds['charset'] is the the character set of the file name (utf-8 is needed for JS-interaction)
Returns:
string Returns the new filename upon success

Definition at line 799 of file class.t3lib_extfilefunc.php.

References t3lib_basicFileFunctions::checkIfAllowed(), t3lib_basicFileFunctions::checkPathAgainstMounts(), t3lib_basicFileFunctions::cleanFileName(), t3lib_basicFileFunctions::getUniqueName(), t3lib_basicFileFunctions::is_directory(), t3lib_div::split_fileref(), and t3lib_div::upload_copy_move().

Referenced by processData().

t3lib_extFileFunctions::getErrorMessages (  ) 

Adds log error messages from the previous file operations of this script instance to the FlashMessageQueue

Returns:
void

Definition at line 316 of file class.t3lib_extfilefunc.php.

References $GLOBALS, $res, $row, t3lib_FlashMessageQueue::addMessage(), t3lib_FlashMessage::ERROR, and t3lib_div::makeInstance().

Referenced by printLogErrorMessages().

t3lib_extFileFunctions::init_actionPerms ( setup  ) 

Sets up permission to perform file/directory operations. See below or the be_user-table for the significance of the various bits in $setup.

Parameters:
integer File permission integer from BE_USER OR'ed with permissions of back-end groups this user is a member of
Returns:
void

Definition at line 183 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::printLogErrorMessages ( redirect = ''  ) 

Adds log error messages from the operations of this script instance to the FlashMessageQueue

Parameters:
string Redirect URL (for creating link in message)
Returns:
void

Definition at line 305 of file class.t3lib_extfilefunc.php.

References getErrorMessages().

t3lib_extFileFunctions::processData (  ) 

Processing the command array in $this->fileCmdMap

Returns:
mixed false, if the file functions were not initialized otherwise returns an array of all the results that are returned from each command, separated in each action.

Definition at line 217 of file class.t3lib_extfilefunc.php.

References $GLOBALS, func_copy(), func_delete(), func_edit(), func_move(), func_newfile(), func_newfolder(), func_rename(), func_unzip(), func_upload(), and t3lib_div::getUserObj().

t3lib_extFileFunctions::start ( fileCmds  ) 

Initialization of the class

Parameters:
array The $file array with the commands to execute. See "TYPO3 Core API" document
Returns:
void

Definition at line 153 of file class.t3lib_extfilefunc.php.

References $GLOBALS, and t3lib_div::getMaxUploadFileSize().

t3lib_extFileFunctions::writeLog ( action,
error,
details_nr,
details,
data 
)

Logging file operations

Parameters:
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
Returns:
void
See also:
class.t3lib_userauthgroup.php

Definition at line 377 of file class.t3lib_extfilefunc.php.

References $GLOBALS.


Member Data Documentation

t3lib_extFileFunctions::$actionPerms

Initial value:

 Array(             // This array is self-explaning (look in the class below). It grants access to the functions. This could be set from outside in order to enabled functions to users. See also the function init_actionPerms() which takes input directly from the user-record
        'deleteFile' => 0,                  // Deleting files physically
        'deleteFolder' => 0,                // Deleting foldes physically
        'deleteFolderRecursively' => 0,     // normally folders are deleted by the PHP-function rmdir(), but with this option a user deletes with 'rm -Rf ....' which is pretty wild!
        'moveFile' => 0,
        'moveFolder' => 0,
        'copyFile' => 0,
        'copyFolder' => 0,
        'newFolder' => 0,
        'newFile' => 0,
        'editFile' => 0,
        'unzipFile' => 0,
        'uploadFile' => 0,
        'renameFile' => 0,
        'renameFolder' => 0
    )

Definition at line 115 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$dont_use_exec_commands = 0

Definition at line 137 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$dontCheckForUnique = 0

Definition at line 113 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$internalUploadMap = array()

Definition at line 140 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$lastError = ''

Definition at line 142 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$maxCopyFileSize = 10000

Definition at line 109 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$maxMoveFileSize = 10000

Definition at line 110 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$maxUploadFileSize = 10000

Definition at line 111 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$PHPFileFunctions = 0

Definition at line 136 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$recyclerFN = '_recycler_'

Definition at line 132 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$unzipPath = ''

Definition at line 112 of file class.t3lib_extfilefunc.php.

t3lib_extFileFunctions::$useRecycler = 1

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


The documentation for this class was generated from the following file:
Generated on Sat Sep 4 04:18:21 2010 for TYPO3 API by  doxygen 1.4.7