Project

General

Profile

Feature #18890 ยป t3lib_extfilefunc.patch

Administrator Admin, 2008-06-01 23:38

View differences:

typo3_src-4.2.0/t3lib/class.t3lib_extfilefunc.php 2008-06-01 12:43:25.000000000 +0200
/***************************************************************
* Copyright notice
*
* (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com)
* (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
......
/**
* extending class to class t3lib_basicFileFunctions
*
* $Id: class.t3lib_extfilefunc.php 2663 2007-11-05 09:22:23Z ingmars $
* $Id: class.t3lib_extfilefunc.php 3439 2008-03-16 19:16:51Z ingorenner $
* Revised for TYPO3 3.6 May/2004 by Kasper Skaarhoj
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
......
$this->writelog(1,1,108,'No file was uploaded!','');
}
}
// Traverse each set of actions
foreach($this->fileCmdMap as $action => $actionData) {
......
clearstatcache();
if (@is_file($theDestFile)) {
$this->writelog(2,0,1,'File "%s" copied to "%s"',Array($theFile,$theDestFile));
// Hook: Call post processing function to fire vents on file copy
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcCopy_file_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcCopy_file_PostProc'])) {
$_params = array(
'destFile' => &$theDestFile,
'theFile' => &$theFile,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcCopy_file_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return $theDestFile;
} else $this->writelog(2,2,109,'File "%s" WAS NOT copied to "%s"! Write-permission problem?',Array($theFile,$theDestFile));
} else $this->writelog(2,1,110,'Target or destination was not within your mountpoints! T="%s", D="%s"',Array($theFile,$theDestFile));
......
clearstatcache();
if (@is_dir($theDestFile)) {
$this->writelog(2,0,2,'Directory "%s" copied to "%s"',Array($theFile,$theDestFile));
// Hook: Call post processing function to fire vents on dir copy
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcCopy_dir_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcCopy_dir_PostProc'])) {
$_params = array(
'destFile' => &$theDestFile,
'theFile' => &$theFile,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcCopy_dir_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return $theDestFile;
} else $this->writelog(2,2,119,'Directory "%s" WAS NOT copied to "%s"! Write-permission problem?',Array($theFile,$theDestFile));
} else $this->writelog(2,1,120,'Target or destination was not within your mountpoints! T="%s", D="%s"',Array($theFile,$theDestFile));
......
}
clearstatcache();
if (@is_file($theDestFile)) {
// Hook: Call post processing function to fire vents on file move
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcMove_file_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcMove_file_PostProc'])) {
$_params = array(
'destFile' => &$theDestFile,
'theFile' => &$theFile,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcMove_file_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
$this->writelog(3,0,1,'File "%s" moved to "%s"',Array($theFile,$theDestFile));
return $theDestFile;
} else $this->writelog(3,2,109,'File "%s" WAS NOT moved to "%s"! Write-permission problem?',Array($theFile,$theDestFile));
......
clearstatcache();
if (@is_dir($theDestFile)) {
$this->writelog(3,0,2,'Directory "%s" moved to "%s"',Array($theFile,$theDestFile));
// Hook: Call post processing function to fire vents on dir move
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcMove_dir_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcMove_dir_PostProc'])) {
$_params = array(
'destFile' => &$theDestFile,
'theFile' => &$theFile,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcMove_dir_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return $theDestFile;
} else $this->writelog(3,2,119,'Directory "%s" WAS NOT moved to "%s"! Write-permission problem?',Array($theFile,$theDestFile));
} else $this->writelog(3,1,120,'Target or destination was not within your mountpoints! T="%s", D="%s"',Array($theFile,$theDestFile));
......
if ($this->checkIfAllowed($fI['fileext'], $fileInfo['path'], $fI['file'])) {
if (@rename($theTarget, $theRenameName)) {
$this->writelog(5,0,1,'File renamed from "%s" to "%s"',Array($fileInfo['file'],$theNewName));
// Hook: Call post processing function to fire vents on file rename
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcRename_file_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcRename_file_PostProc'])) {
$_params = array(
'theTarget' => &$theTarget,
'theRenameName' => &$theRenameName,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcRename_file_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return $theRenameName;
} else $this->writelog(5,1,100,'File "%s" was not renamed! Write-permission problem in "%s"?',Array($theTarget,$fileInfo['path']));
} else $this->writelog(5,1,101,'Fileextension "%s" was not allowed!',Array($fI['fileext']));
......
} elseif ($type=='dir') {
if ($this->actionPerms['renameFolder']) {
if (@rename($theTarget, $theRenameName)) {
// Hook: Call post processing function to fire vents on dir rename
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcRename_dir_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcRename_dir_PostProc'])) {
$_params = array(
'theTarget' => &$theTarget,
'theRenameName' => &$theRenameName,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcRename_file_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
$this->writelog(5,0,2,'Directory renamed from "%s" to "%s"',Array($fileInfo['file'],$theNewName));
return $theRenameName;
} else $this->writelog(5,1,110,'Directory "%s" was not renamed! Write-permission problem in "%s"?',Array($theTarget,$fileInfo['path']));
......
if (t3lib_div::writeFile($theNewFile,'')) {
clearstatcache();
$this->writelog(8,0,1,'File created: "%s"',Array($fI['file']));
// Hook: Call post processing function to fire vents on file create
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcNewFile_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcNewFile_PostProc'])) {
$_params = array(
'theNewFile' => &$theNewFile,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcNewFile_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return $theNewFile;
} else $this->writelog(8,1,100,'File "%s" was not created! Write-permission problem in "%s"?',Array($fI['file'], $theTarget));
} else $this->writelog(8,1,107,'Fileextension "%s" is not a textfile format! (%s)',Array($fI['fileext'], $extList));
......
if (@is_file($theNewFile)) {
$this->internalUploadMap[$id] = $theNewFile;
$this->writelog(1,0,1,'Uploading file "%s" to "%s"',Array($theName,$theNewFile, $id));
// Hook: Call post processing function to fire vents on file upload
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcUpload_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcUpload_PostProc'])) {
$_params = array(
'theNewFile' => &$theNewFile,
'theFile' => &$theFile,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcUpload_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return $theNewFile;
} else $this->writelog(1,1,100,'Uploaded file could not be moved! Write-permission problem in "%s"?',Array($theTarget.'/'));
} else $this->writelog(1,1,101,'No unique filename available in "%s"!',Array($theTarget.'/'));
......
$cmd = $this->unzipPath.'unzip -qq "'.$theFile.'" -d "'.$theDest.'"';
exec($cmd);
$this->writelog(7,0,1,'Unzipping file "%s" in "%s"',Array($theFile,$theDest));
// Hook: Call post processing function to fire vents on unzip
if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcUnzip_PostProc']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcUnzip_PostProc'])) {
$_params = array(
'theFile' => &$theFile,
'theDest' => &$theDest,
'cmds' => $cmds,
);
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.t3lib_extfilefunc.php']['funcUnzip_PostProc'] as $_funcRef) {
t3lib_div::callUserFunction($_funcRef, $_params, $this);
}
}
return TRUE;
} else $this->writelog(7,1,100,'File "%s" or destination "%s" was not within your mountpoints!',Array($theFile,$theDest));
} else $this->writelog(7,1,101,'You don\'t have full access to the destination directory "%s"!',Array($theDest));
    (1-1/1)