Exemplo n.º 1
0
    /**
     * Constructor function for class
     *
     * @return	void
     */
    function init()
    {
        global $LANG, $BACK_PATH, $TYPO3_CONF_VARS;
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new RuntimeException($title . ': ' . $message);
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_newfolder.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a)	{	//
				if (!changed || (changed && confirm(' . $LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . ')))	{
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8')) . '";
					window.location.href = "file_newfolder.php?"+params;
				}
			}
			function backToList()	{	//
				top.goToModule("file_list");
			}

			var changed = 0;
		');
    }
Exemplo n.º 2
0
    /**
     * Initialize script class
     *
     * @return	void
     */
    function init()
    {
        //TODO remove global
        global $BACK_PATH, $TYPO3_CONF_VARS;
        // Setting target, which must be a file reference to a file within the mounts.
        $this->target = $this->origTarget = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        // Creating file management object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        if (file_exists($this->target)) {
            $this->target = $this->basicff->cleanDirectoryName($this->target);
            // Cleaning and checking target (file or dir)
        } else {
            $this->target = '';
        }
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new RuntimeException($title . ': ' . $message);
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . $GLOBALS['FILEMOUNTS'][$key]['name'] . ': ' . $this->shortPath;
        // ***************************
        // Setting template object
        // ***************************
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_edit.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList()	{	//
				top.goToModule("file_list");
			}
		');
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform">';
    }
Exemplo n.º 3
0
    /**
     * Constructor function for class
     *
     * @return	void
     */
    function init()
    {
        //TODO remove global
        global $LANG, $BACK_PATH, $TYPO3_CONF_VARS;
        // Initialize GPvars:
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::_GP('returnUrl');
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        // Cleaning and checking target
        if (file_exists($this->target)) {
            $this->target = $this->basicff->cleanDirectoryName($this->target);
            // Cleaning and checking target (file or dir)
        } else {
            $this->target = '';
        }
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
            exit;
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_rename.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList()	{	//
				top.goToModule("file_list");
			}
		');
    }
Exemplo n.º 4
0
 /**
  * Initialize variables, file object
  * Incoming GET vars include id, pointer, table, imagemode
  *
  * @return	void
  */
 function init()
 {
     global $TYPO3_CONF_VARS, $FILEMOUNTS;
     // Setting GPvars:
     $this->id = t3lib_div::_GP('id');
     $this->pointer = t3lib_div::_GP('pointer');
     $this->table = t3lib_div::_GP('table');
     $this->imagemode = t3lib_div::_GP('imagemode');
     $this->cmd = t3lib_div::_GP('cmd');
     $this->overwriteExistingFiles = t3lib_div::_GP('overwriteExistingFiles');
     // Setting module name:
     $this->MCONF = $GLOBALS['MCONF'];
     // File operation object:
     $this->basicFF = t3lib_div::makeInstance('t3lib_basicFileFunctions');
     $this->basicFF->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']);
     // Configure the "menu" - which is used internally to save the values of sorting, displayThumbs etc.
     $this->menuConfig();
 }
Exemplo n.º 5
0
    /**
     * Constructor for initializing the class
     *
     * @return	void
     */
    function init()
    {
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::_GP('returnUrl');
        $this->returnUrl = $this->returnUrl ? $this->returnUrl : t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'file_list.php?id=' . rawurlencode($this->target);
        // set the number of input fields
        if (empty($this->number)) {
            $this->number = $GLOBALS['BE_USER']->getTSConfigVal('options.defaultFileUploads');
        }
        $this->number = t3lib_div::intInRange($this->number, 1, $this->uploadNumber);
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
            exit;
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_upload.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
            $confirm = ' && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . ')';
        } else {
            $confirm = '';
        }
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a) {	//
				if (!changed || (changed ' . $confirm . ')) {
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8')) . '";
					window.location.href = "file_upload.php?"+params;
				}
			}
			function backToList() {	//
				top.goToModule("file_list");
			}
			var changed = 0;
		');
    }
 /**
  * Handling files for group/select function
  *
  * @param	array		Array of incoming file references. Keys are numeric, values are files (basically, this is the exploded list of incoming files)
  * @param	array		Configuration array from TCA of the field
  * @param	string		Current value of the field
  * @param	array		Array of uploaded files, if any
  * @param	string		Status ("update" or ?)
  * @param	string		tablename of record
  * @param	integer		UID of record
  * @param	string		Field identifier ([table:uid:field:....more for flexforms?]
  * @return	array		Modified value array
  * @see checkValue_group_select()
  */
 function checkValue_group_select_file($valueArray, $tcaFieldConf, $curValue, $uploadedFileArray, $status, $table, $id, $recFID)
 {
     if (!$this->bypassFileHandling) {
         // If filehandling should NOT be bypassed, do processing:
         // If any files are uploaded, add them to value array
         if (is_array($uploadedFileArray) && $uploadedFileArray['name'] && strcmp($uploadedFileArray['tmp_name'], 'none')) {
             $valueArray[] = $uploadedFileArray['tmp_name'];
             $this->alternativeFileName[$uploadedFileArray['tmp_name']] = $uploadedFileArray['name'];
         }
         // Creating fileFunc object.
         if (!$this->fileFunc) {
             $this->fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
             $this->include_filefunctions = 1;
         }
         // Setting permitted extensions.
         $all_files = array();
         $all_files['webspace']['allow'] = $tcaFieldConf['allowed'];
         $all_files['webspace']['deny'] = $tcaFieldConf['disallowed'] ? $tcaFieldConf['disallowed'] : '*';
         $all_files['ftpspace'] = $all_files['webspace'];
         $this->fileFunc->init('', $all_files);
     }
     // If there is an upload folder defined:
     if ($tcaFieldConf['uploadfolder'] && $tcaFieldConf['internal_type'] == 'file') {
         if (!$this->bypassFileHandling) {
             // If filehandling should NOT be bypassed, do processing:
             // For logging..
             $propArr = $this->getRecordProperties($table, $id);
             // Get destrination path:
             $dest = $this->destPathFromUploadFolder($tcaFieldConf['uploadfolder']);
             // If we are updating:
             if ($status == 'update') {
                 // Traverse the input values and convert to absolute filenames in case the update happens to an autoVersionized record.
                 // Background: This is a horrible workaround! The problem is that when a record is auto-versionized the files of the record get copied and therefore get new names which is overridden with the names from the original record in the incoming data meaning both lost files and double-references!
                 // The only solution I could come up with (except removing support for managing files when autoversioning) was to convert all relative files to absolute names so they are copied again (and existing files deleted). This should keep references intact but means that some files are copied, then deleted after being copied _again_.
                 // Actually, the same problem applies to database references in case auto-versioning would include sub-records since in such a case references are remapped - and they would be overridden due to the same principle then.
                 // Illustration of the problem comes here:
                 // We have a record 123 with a file logo.gif. We open and edit the files header in a workspace. So a new version is automatically made.
                 // The versions uid is 456 and the file is copied to "logo_01.gif". But the form data that we sent was based on uid 123 and hence contains the filename "logo.gif" from the original.
                 // The file management code below will do two things: First it will blindly accept "logo.gif" as a file attached to the record (thus creating a double reference) and secondly it will find that "logo_01.gif" was not in the incoming filelist and therefore should be deleted.
                 // If we prefix the incoming file "logo.gif" with its absolute path it will be seen as a new file added. Thus it will be copied to "logo_02.gif". "logo_01.gif" will still be deleted but since the files are the same the difference is zero - only more processing and file copying for no reason. But it will work.
                 if ($this->autoVersioningUpdate === TRUE) {
                     foreach ($valueArray as $key => $theFile) {
                         if ($theFile === basename($theFile)) {
                             // If it is an already attached file...
                             $valueArray[$key] = PATH_site . $tcaFieldConf['uploadfolder'] . '/' . $theFile;
                         }
                     }
                 }
                 // Finding the CURRENT files listed, either from MM or from the current record.
                 $theFileValues = array();
                 if ($tcaFieldConf['MM']) {
                     // If MM relations for the files also!
                     $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
                     /* @var $dbAnalysis t3lib_loadDBGroup */
                     $dbAnalysis->start('', 'files', $tcaFieldConf['MM'], $id);
                     foreach ($dbAnalysis->itemArray as $item) {
                         if ($item['id']) {
                             $theFileValues[] = $item['id'];
                         }
                     }
                 } else {
                     $theFileValues = t3lib_div::trimExplode(',', $curValue, 1);
                 }
                 $currentFilesForHistory = implode(',', $theFileValues);
                 // DELETE files: If existing files were found, traverse those and register files for deletion which has been removed:
                 if (count($theFileValues)) {
                     // Traverse the input values and for all input values which match an EXISTING value, remove the existing from $theFileValues array (this will result in an array of all the existing files which should be deleted!)
                     foreach ($valueArray as $key => $theFile) {
                         if ($theFile && !strstr(t3lib_div::fixWindowsFilePath($theFile), '/')) {
                             $theFileValues = t3lib_div::removeArrayEntryByValue($theFileValues, $theFile);
                         }
                     }
                     // This array contains the filenames in the uploadfolder that should be deleted:
                     foreach ($theFileValues as $key => $theFile) {
                         $theFile = trim($theFile);
                         if (@is_file($dest . '/' . $theFile)) {
                             $this->removeFilesStore[] = $dest . '/' . $theFile;
                         } elseif ($theFile) {
                             $this->log($table, $id, 5, 0, 1, "Could not delete file '%s' (does not exist). (%s)", 10, array($dest . '/' . $theFile, $recFID), $propArr['event_pid']);
                         }
                     }
                 }
             }
             // Traverse the submitted values:
             foreach ($valueArray as $key => $theFile) {
                 // NEW FILES? If the value contains '/' it indicates, that the file is new and should be added to the uploadsdir (whether its absolute or relative does not matter here)
                 if (strstr(t3lib_div::fixWindowsFilePath($theFile), '/')) {
                     // Init:
                     $maxSize = intval($tcaFieldConf['max_size']);
                     $cmd = '';
                     $theDestFile = '';
                     // Must be cleared. Else a faulty fileref may be inserted if the below code returns an error!
                     // Check various things before copying file:
                     if (@is_dir($dest) && (@is_file($theFile) || @is_uploaded_file($theFile))) {
                         // File and destination must exist
                         // Finding size. For safe_mode we have to rely on the size in the upload array if the file is uploaded.
                         if (is_uploaded_file($theFile) && $theFile == $uploadedFileArray['tmp_name']) {
                             $fileSize = $uploadedFileArray['size'];
                         } else {
                             $fileSize = filesize($theFile);
                         }
                         if (!$maxSize || $fileSize <= $maxSize * 1024) {
                             // Check file size:
                             // Prepare filename:
                             $theEndFileName = isset($this->alternativeFileName[$theFile]) ? $this->alternativeFileName[$theFile] : $theFile;
                             $fI = t3lib_div::split_fileref($theEndFileName);
                             // Check for allowed extension:
                             if ($this->fileFunc->checkIfAllowed($fI['fileext'], $dest, $theEndFileName)) {
                                 $theDestFile = $this->fileFunc->getUniqueName($this->fileFunc->cleanFileName($fI['file']), $dest);
                                 // If we have a unique destination filename, then write the file:
                                 if ($theDestFile) {
                                     t3lib_div::upload_copy_move($theFile, $theDestFile);
                                     // Hook for post-processing the upload action
                                     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'])) {
                                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processUpload'] as $classRef) {
                                             $hookObject = t3lib_div::getUserObj($classRef);
                                             if (!$hookObject instanceof t3lib_TCEmain_processUploadHook) {
                                                 throw new UnexpectedValueException('$hookObject must implement interface t3lib_TCEmain_processUploadHook', 1279962349);
                                             }
                                             $hookObject->processUpload_postProcessAction($theDestFile, $this);
                                         }
                                     }
                                     $this->copiedFileMap[$theFile] = $theDestFile;
                                     clearstatcache();
                                     if (!@is_file($theDestFile)) {
                                         $this->log($table, $id, 5, 0, 1, "Copying file '%s' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)", 16, array($theFile, dirname($theDestFile), $recFID), $propArr['event_pid']);
                                     }
                                 } else {
                                     $this->log($table, $id, 5, 0, 1, "Copying file '%s' failed!: No destination file (%s) possible!. (%s)", 11, array($theFile, $theDestFile, $recFID), $propArr['event_pid']);
                                 }
                             } else {
                                 $this->log($table, $id, 5, 0, 1, "File extension '%s' not allowed. (%s)", 12, array($fI['fileext'], $recFID), $propArr['event_pid']);
                             }
                         } else {
                             $this->log($table, $id, 5, 0, 1, "Filesize (%s) of file '%s' exceeds limit (%s). (%s)", 13, array(t3lib_div::formatSize($fileSize), $theFile, t3lib_div::formatSize($maxSize * 1024), $recFID), $propArr['event_pid']);
                         }
                     } else {
                         $this->log($table, $id, 5, 0, 1, 'The destination (%s) or the source file (%s) does not exist. (%s)', 14, array($dest, $theFile, $recFID), $propArr['event_pid']);
                     }
                     // If the destination file was created, we will set the new filename in the value array, otherwise unset the entry in the value array!
                     if (@is_file($theDestFile)) {
                         $info = t3lib_div::split_fileref($theDestFile);
                         $valueArray[$key] = $info['file'];
                         // The value is set to the new filename
                     } else {
                         unset($valueArray[$key]);
                         // The value is set to the new filename
                     }
                 }
             }
         }
         // If MM relations for the files, we will set the relations as MM records and change the valuearray to contain a single entry with a count of the number of files!
         if ($tcaFieldConf['MM']) {
             $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
             /* @var $dbAnalysis t3lib_loadDBGroup */
             $dbAnalysis->tableArray['files'] = array();
             // dummy
             foreach ($valueArray as $key => $theFile) {
                 // explode files
                 $dbAnalysis->itemArray[]['id'] = $theFile;
             }
             if ($status == 'update') {
                 $dbAnalysis->writeMM($tcaFieldConf['MM'], $id, 0);
                 $newFiles = implode(',', $dbAnalysis->getValueArray());
                 list(, , $recFieldName) = explode(':', $recFID);
                 if ($currentFilesForHistory != $newFiles) {
                     $this->mmHistoryRecords[$table . ':' . $id]['oldRecord'][$recFieldName] = $currentFilesForHistory;
                     $this->mmHistoryRecords[$table . ':' . $id]['newRecord'][$recFieldName] = $newFiles;
                 } else {
                     $this->mmHistoryRecords[$table . ':' . $id]['oldRecord'][$recFieldName] = '';
                     $this->mmHistoryRecords[$table . ':' . $id]['newRecord'][$recFieldName] = '';
                 }
             } else {
                 $this->dbAnalysisStore[] = array($dbAnalysis, $tcaFieldConf['MM'], $id, 0);
                 // This will be traversed later to execute the actions
             }
             $valueArray = $dbAnalysis->countItems();
         }
         //store path relative to site root (if uploadfolder is not set or internal_type is file_reference)
     } else {
         if (count($valueArray)) {
             if (!$this->bypassFileHandling) {
                 // If filehandling should NOT be bypassed, do processing:
                 $propArr = $this->getRecordProperties($table, $id);
                 // For logging..
                 foreach ($valueArray as &$theFile) {
                     // if alernative File Path is set for the file, then it was an import
                     if ($this->alternativeFilePath[$theFile]) {
                         // don't import the file if it already exists
                         if (@is_file(PATH_site . $this->alternativeFilePath[$theFile])) {
                             $theFile = PATH_site . $this->alternativeFilePath[$theFile];
                             // import the file
                         } elseif (@is_file($theFile)) {
                             $dest = dirname(PATH_site . $this->alternativeFilePath[$theFile]);
                             if (!@is_dir($dest)) {
                                 t3lib_div::mkdir_deep(PATH_site, dirname($this->alternativeFilePath[$theFile]) . '/');
                             }
                             // Init:
                             $maxSize = intval($tcaFieldConf['max_size']);
                             $cmd = '';
                             $theDestFile = '';
                             // Must be cleared. Else a faulty fileref may be inserted if the below code returns an error!
                             $fileSize = filesize($theFile);
                             if (!$maxSize || $fileSize <= $maxSize * 1024) {
                                 // Check file size:
                                 // Prepare filename:
                                 $theEndFileName = isset($this->alternativeFileName[$theFile]) ? $this->alternativeFileName[$theFile] : $theFile;
                                 $fI = t3lib_div::split_fileref($theEndFileName);
                                 // Check for allowed extension:
                                 if ($this->fileFunc->checkIfAllowed($fI['fileext'], $dest, $theEndFileName)) {
                                     $theDestFile = PATH_site . $this->alternativeFilePath[$theFile];
                                     // Write the file:
                                     if ($theDestFile) {
                                         t3lib_div::upload_copy_move($theFile, $theDestFile);
                                         $this->copiedFileMap[$theFile] = $theDestFile;
                                         clearstatcache();
                                         if (!@is_file($theDestFile)) {
                                             $this->log($table, $id, 5, 0, 1, "Copying file '%s' failed!: The destination path (%s) may be write protected. Please make it write enabled!. (%s)", 16, array($theFile, dirname($theDestFile), $recFID), $propArr['event_pid']);
                                         }
                                     } else {
                                         $this->log($table, $id, 5, 0, 1, "Copying file '%s' failed!: No destination file (%s) possible!. (%s)", 11, array($theFile, $theDestFile, $recFID), $propArr['event_pid']);
                                     }
                                 } else {
                                     $this->log($table, $id, 5, 0, 1, "File extension '%s' not allowed. (%s)", 12, array($fI['fileext'], $recFID), $propArr['event_pid']);
                                 }
                             } else {
                                 $this->log($table, $id, 5, 0, 1, "Filesize (%s) of file '%s' exceeds limit (%s). (%s)", 13, array(t3lib_div::formatSize($fileSize), $theFile, t3lib_div::formatSize($maxSize * 1024), $recFID), $propArr['event_pid']);
                             }
                             // If the destination file was created, we will set the new filename in the value array, otherwise unset the entry in the value array!
                             if (@is_file($theDestFile)) {
                                 $theFile = $theDestFile;
                                 // The value is set to the new filename
                             } else {
                                 unset($theFile);
                                 // The value is set to the new filename
                             }
                         }
                     }
                     $theFile = t3lib_div::fixWindowsFilePath($theFile);
                     if (t3lib_div::isFirstPartOfStr($theFile, PATH_site)) {
                         $theFile = substr($theFile, strlen(PATH_site));
                     }
                 }
             }
         }
     }
     return $valueArray;
 }