[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> class.t3lib_extfilefunc.php (sommaire)

extending class to class t3lib_basicFileFunctions $Id: class.t3lib_extfilefunc.php 1706 2006-08-31 18:24:51Z baschny $ Revised for TYPO3 3.6 May/2004 by Kasper Skaarhoj

Author: Kasper Skaarhoj <kasperYYYY@typo3.com>
Poids: 869 lignes (40 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

t3lib_extFileFunctions:: (15 méthodes):
  start()
  init_actionPerms()
  processData()
  printLogErrorMessages()
  findRecycler()
  writeLog()
  func_delete()
  func_copy()
  func_move()
  func_rename()
  func_newfolder()
  func_newfile()
  func_edit()
  func_upload()
  func_unzip()


Classe: t3lib_extFileFunctions  - X-Ref

Contains functions for performing file operations like copying, pasting, uploading, moving, deleting etc. through the TCE
Extending class to class t3lib_basicFileFunctions.

see basicFileFunctions
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 the php3/php-extension.
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/'

start($fileCmds)   X-Ref
Initialization of the class

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

init_actionPerms($setup)   X-Ref
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'])

param: integer        File permission integer from BE_USER object.
return: void

processData()   X-Ref
Processing the command array in $this->fileCmdMap

return: void

printLogErrorMessages($redirect='')   X-Ref
Print log error messages from the operations of this script instance

param: string        Redirect URL (for creating link in message)
return: void        (Will exit on error)

findRecycler($theFile)   X-Ref
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

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

writeLog($action,$error,$details_nr,$details,$data)   X-Ref
Logging file operations

param: integer        The action number. See the functions in the class for a hint. Eg. edit is '9', upload is '1' ...
param: integer        The severity: 0 = message, 1 = error, 2 = System Error, 3 = security notice (admin)
param: 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.
param: string        This is the default, raw error message in english
param: array        Array with special information that may go into $details by "%s" marks / sprintf() when the log is shown
return: void

func_delete($cmds)   X-Ref
Deleting files and folders (action=4)

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

func_copy($cmds)   X-Ref
Copying files and folders (action=2)

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

func_move($cmds)   X-Ref
Moving files and folders (action=3)

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

func_rename($cmds)   X-Ref
Renaming files or foldes (action=5)

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

func_newfolder($cmds)   X-Ref
This creates a new folder. (action=6)

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

func_newfile($cmds)   X-Ref
This creates a new file. (action=8)

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

func_edit($cmds)   X-Ref
Editing textfiles or folders (action=9)

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

func_upload($cmds)   X-Ref
Upload of files (action=1)

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

func_unzip($cmds)   X-Ref
Unzipping file (action=7)
This is permitted only if the user has fullAccess or if the file resides

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



Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics