/**
  * Interface function. This will be called from the sprite manager to
  * refresh all caches.
  *
  * @return void
  */
 public function generate()
 {
     $this->generatorInstance = t3lib_div::makeInstance('t3lib_spritemanager_SpriteGenerator', 'GeneratorHandler');
     $this->generatorInstance->setOmmitSpriteNameInIconName(TRUE)->setIncludeTimestampInCSS(TRUE)->setSpriteFolder(t3lib_SpriteManager::$tempPath)->setCSSFolder(t3lib_SpriteManager::$tempPath);
     $iconsToProcess = array_merge((array) $GLOBALS['TBE_STYLES']['spritemanager']['singleIcons'], $this->collectTcaSpriteIcons());
     foreach ($iconsToProcess as $iconName => $iconFile) {
         $iconsToProcess[$iconName] = t3lib_div::resolveBackPath('typo3/' . $iconFile);
     }
     $generatorResponse = $this->generatorInstance->generateSpriteFromArray($iconsToProcess);
     if (!is_dir(PATH_site . t3lib_SpriteManager::$tempPath . 'ie6')) {
         t3lib_div::mkdir(PATH_site . t3lib_SpriteManager::$tempPath . 'ie6');
     }
     t3lib_div::upload_copy_move($generatorResponse['spriteGifImage'], t3lib_div::dirname($generatorResponse['spriteGifImage']) . '/ie6/' . basename($generatorResponse['spriteGifImage']));
     unlink($generatorResponse['spriteGifImage']);
     t3lib_div::upload_copy_move($generatorResponse['cssGif'], t3lib_div::dirname($generatorResponse['cssGif']) . '/ie6/' . basename($generatorResponse['cssGif']));
     unlink($generatorResponse['cssGif']);
     $this->iconNames = array_merge($this->iconNames, $generatorResponse['iconNames']);
     parent::generate();
 }
예제 #2
0
 /**
  * Mandatory autofix function
  * Will run auto-fix on the result array. Echos status during processing.
  *
  * @param	array		Result array from main() function
  * @return	void
  */
 function main_autoFix($resultArray)
 {
     $limitTo = $this->cli_args['--AUTOFIX'][0];
     if (is_array($resultArray['doubleFiles'])) {
         if (!$limitTo || $limitTo === 'doubleFiles') {
             echo 'FIXING double-usages of RTE files in uploads/: ' . LF;
             foreach ($resultArray['RTEmagicFilePairs'] as $fileName => $fileInfo) {
                 // Only fix something if there is a usage count of more than 1 plus if both original and copy exists:
                 if ($fileInfo['count'] > 1 && $fileInfo['exists'] && $fileInfo['original_exists']) {
                     // Traverse all records using the file:
                     $c = 0;
                     foreach ($fileInfo['usedIn'] as $hash => $recordID) {
                         if ($c == 0) {
                             echo '	Keeping file ' . $fileName . ' for record ' . $recordID . LF;
                         } else {
                             // CODE below is adapted from "class.tx_impexp.php" where there is support for duplication of RTE images:
                             echo '	Copying file ' . basename($fileName) . ' for record ' . $recordID . ' ';
                             // Initialize; Get directory prefix for file and set the original name:
                             $dirPrefix = dirname($fileName) . '/';
                             $rteOrigName = basename($fileInfo['original']);
                             // If filename looks like an RTE file, and the directory is in "uploads/", then process as a RTE file!
                             if ($rteOrigName && t3lib_div::isFirstPartOfStr($dirPrefix, 'uploads/') && @is_dir(PATH_site . $dirPrefix)) {
                                 // RTE:
                                 // From the "original" RTE filename, produce a new "original" destination filename which is unused.
                                 $fileProcObj = $this->getFileProcObj();
                                 $origDestName = $fileProcObj->getUniqueName($rteOrigName, PATH_site . $dirPrefix);
                                 // Create copy file name:
                                 $pI = pathinfo($fileName);
                                 $copyDestName = dirname($origDestName) . '/RTEmagicC_' . substr(basename($origDestName), 10) . '.' . $pI['extension'];
                                 if (!@is_file($copyDestName) && !@is_file($origDestName) && $origDestName === t3lib_div::getFileAbsFileName($origDestName) && $copyDestName === t3lib_div::getFileAbsFileName($copyDestName)) {
                                     echo ' to ' . basename($copyDestName);
                                     if ($bypass = $this->cli_noExecutionCheck($fileName)) {
                                         echo $bypass;
                                     } else {
                                         // Making copies:
                                         t3lib_div::upload_copy_move(PATH_site . $fileInfo['original'], $origDestName);
                                         t3lib_div::upload_copy_move(PATH_site . $fileName, $copyDestName);
                                         clearstatcache();
                                         if (@is_file($copyDestName)) {
                                             $sysRefObj = t3lib_div::makeInstance('t3lib_refindex');
                                             $error = $sysRefObj->setReferenceValue($hash, substr($copyDestName, strlen(PATH_site)));
                                             if ($error) {
                                                 echo '	- ERROR:	t3lib_refindex::setReferenceValue(): ' . $error . LF;
                                                 exit;
                                             } else {
                                                 echo " - DONE";
                                             }
                                         } else {
                                             echo '	- ERROR: File "' . $copyDestName . '" was not created!';
                                         }
                                     }
                                 } else {
                                     echo '	- ERROR: Could not construct new unique names for file!';
                                 }
                             } else {
                                 echo '	- ERROR: Maybe directory of file was not within "uploads/"?';
                             }
                             echo LF;
                         }
                         $c++;
                     }
                 }
             }
         } else {
             echo 'Bypassing fixing of double-usages since --AUTOFIX was not "doubleFiles"' . LF;
         }
     }
     if (is_array($resultArray['lostFiles'])) {
         if ($limitTo === 'lostFiles') {
             echo 'Removing lost RTEmagic files from folders inside uploads/: ' . LF;
             foreach ($resultArray['lostFiles'] as $key => $value) {
                 $absFileName = t3lib_div::getFileAbsFileName($value);
                 echo 'Deleting file: "' . $absFileName . '": ';
                 if ($bypass = $this->cli_noExecutionCheck($absFileName)) {
                     echo $bypass;
                 } else {
                     if ($absFileName && @is_file($absFileName)) {
                         unlink($absFileName);
                         echo 'DONE';
                     } else {
                         echo '	ERROR: File "' . $absFileName . '" was not found!';
                     }
                 }
                 echo LF;
             }
         }
     } else {
         echo 'Bypassing fixing of double-usages since --AUTOFIX was not "lostFiles"' . LF;
     }
 }
예제 #3
0
 private function download()
 {
     /**/
     $erreur = '';
     if ($this->formValue['formname'] == 'contact_default_cv' && isset($_FILES['cv'])) {
         /* Vérification que le fichier est bien téléchargé */
         Zend_Debug::dump($_FILES['cv']);
         if ($_FILES['cv']['error'] > 0) {
             $erreur .= 'Erreur lors du tansfert/n';
         }
         /* Test sur les extensions */
         $extensions_valides = array('txt', 'doc', 'docx', 'pdf', 'odt');
         $extension_upload = strtolower(substr(strrchr($_FILES['cv']['name'], '.'), 1));
         $name_upload = strtolower(substr(strrchr($_FILES['cv']['name'], '.'), 0));
         if (!in_array($extension_upload, $extensions_valides)) {
             $erreur .= 'Extension non correcte /n';
         }
         Zend_Debug::dump($extension_upload, "extension");
         if ($_FILES['cv']['size'] > 500 * 1024) {
             $erreur .= 'Le fichier est trop gros./n';
         }
         Zend_Debug::dump($_FILES['cv']['size'], 'taille');
         if ($erreur == '') {
             /* Recherche d'un nom 
              * Vérification si le nom existe
              */
             $fichier_temp = $_FILES['cv']['tmp_name'];
             $fichier = $this->fileFunc->cleanFileName(basename($_FILES['cv']['name']));
             $chemin = PATH_site . $this->upload;
             if (!is_dir($chemin)) {
                 $erreur .= 'Répertoire n\'existe pas /n';
             }
             $file_path = $this->fileFunc->getUniqueName($fichier, $chemin);
             if (t3lib_div::upload_copy_move($fichier_temp, $file_path)) {
                 // si l'upload est completement réussi
                 $file = str_replace(PATH_site, $_SERVER["SERVER_NAME"] . '/', $file_path);
                 $this->formValue['cv'] = $file;
                 Zend_Debug::dump($this->formValue['cv']);
             } else {
                 $erreur .= 'Problème dans le téléchargement du fichier./n';
             }
         }
     }
     if ($erreur == '') {
         return true;
     } else {
         return $erreur;
     }
 }
 /**
  * Copies any "RTEmagic" image files found in record with table/id to new names.
  * Usage: After copying a record this function should be called to search for "RTEmagic"-images inside the record. If such are found they should be duplicated to new names so all records have a 1-1 relation to them.
  * Reason for copying RTEmagic files: a) if you remove an RTEmagic image from a record it will remove the file - any other record using it will have a lost reference! b) RTEmagic images keeps an original and a copy. The copy always is re-calculated to have the correct physical measures as the HTML tag inserting it defines. This is calculated from the original. Two records using the same image could have difference HTML-width/heights for the image and the copy could only comply with one of them. If you don't want a 1-1 relation you should NOT use RTEmagic files but just insert it as a normal file reference to a file inside fileadmin/ folder
  *
  * @param	string		Table name
  * @param	integer		Record UID
  * @return	void
  */
 function copyRecord_fixRTEmagicImages($table, $theNewSQLID)
 {
     global $TYPO3_DB;
     // Creating fileFunc object.
     if (!$this->fileFunc) {
         $this->fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
         $this->include_filefunctions = 1;
     }
     // Select all RTEmagic files in the reference table from the table/ID
     /* @var $TYPO3_DB t3lib_DB */
     $recs = $TYPO3_DB->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table=' . $TYPO3_DB->fullQuoteStr('_FILE', 'sys_refindex') . ' AND ref_string LIKE ' . $TYPO3_DB->fullQuoteStr('%/RTEmagic%', 'sys_refindex') . ' AND softref_key=' . $TYPO3_DB->fullQuoteStr('images', 'sys_refindex') . ' AND tablename=' . $TYPO3_DB->fullQuoteStr($table, 'sys_refindex') . ' AND recuid=' . intval($theNewSQLID), '', 'sorting DESC');
     // Traverse the files found and copy them:
     if (is_array($recs)) {
         foreach ($recs as $rec) {
             $filename = basename($rec['ref_string']);
             $fileInfo = array();
             if (t3lib_div::isFirstPartOfStr($filename, 'RTEmagicC_')) {
                 $fileInfo['exists'] = @is_file(PATH_site . $rec['ref_string']);
                 $fileInfo['original'] = substr($rec['ref_string'], 0, -strlen($filename)) . 'RTEmagicP_' . preg_replace('/\\.[[:alnum:]]+$/', '', substr($filename, 10));
                 $fileInfo['original_exists'] = @is_file(PATH_site . $fileInfo['original']);
                 // CODE from tx_impexp and class.rte_images.php adapted for use here:
                 if ($fileInfo['exists'] && $fileInfo['original_exists']) {
                     // Initialize; Get directory prefix for file and set the original name:
                     $dirPrefix = dirname($rec['ref_string']) . '/';
                     $rteOrigName = basename($fileInfo['original']);
                     // If filename looks like an RTE file, and the directory is in "uploads/", then process as a RTE file!
                     if ($rteOrigName && t3lib_div::isFirstPartOfStr($dirPrefix, 'uploads/') && @is_dir(PATH_site . $dirPrefix)) {
                         // RTE:
                         // From the "original" RTE filename, produce a new "original" destination filename which is unused.
                         $origDestName = $this->fileFunc->getUniqueName($rteOrigName, PATH_site . $dirPrefix);
                         // Create copy file name:
                         $pI = pathinfo($rec['ref_string']);
                         $copyDestName = dirname($origDestName) . '/RTEmagicC_' . substr(basename($origDestName), 10) . '.' . $pI['extension'];
                         if (!@is_file($copyDestName) && !@is_file($origDestName) && $origDestName === t3lib_div::getFileAbsFileName($origDestName) && $copyDestName === t3lib_div::getFileAbsFileName($copyDestName)) {
                             // Making copies:
                             t3lib_div::upload_copy_move(PATH_site . $fileInfo['original'], $origDestName);
                             t3lib_div::upload_copy_move(PATH_site . $rec['ref_string'], $copyDestName);
                             clearstatcache();
                             // Register this:
                             $this->RTEmagic_copyIndex[$rec['tablename']][$rec['recuid']][$rec['field']][$rec['ref_string']] = substr($copyDestName, strlen(PATH_site));
                             // Check and update the record using the t3lib_refindex class:
                             if (@is_file($copyDestName)) {
                                 $sysRefObj = t3lib_div::makeInstance('t3lib_refindex');
                                 $error = $sysRefObj->setReferenceValue($rec['hash'], substr($copyDestName, strlen(PATH_site)), FALSE, TRUE);
                                 if ($error) {
                                     echo $this->newlog('t3lib_refindex::setReferenceValue(): ' . $error, 1);
                                 }
                             } else {
                                 $this->newlog('File "' . $copyDestName . '" was not created!', 1);
                             }
                         } else {
                             $this->newlog('Could not construct new unique names for file!', 1);
                         }
                     } else {
                         $this->newlog('Maybe directory of file was not within "uploads/"?', 1);
                     }
                 } else {
                     $this->newlog('Trying to copy RTEmagic files (' . $rec['ref_string'] . ' / ' . $fileInfo['original'] . ') but one or both were missing', 1);
                 }
             }
         }
     }
 }
	/**
	 * Validation of given Params
	 *
	 * @param array $field
	 * @return bool
	 */
	public function isValid($field) {
		if (isset($_FILES['tx_powermail_pi1']['name']['field'])) {
			// session stuff
			$uploadSession = array();
			Tx_Powermail_Utility_Div::setSessionValue('upload', array(), true); // clean old session before

			foreach ($_FILES['tx_powermail_pi1']['name']['field'] as $uid => $filename) {

				// if no file given
				if (empty($filename)) {
					continue;
				}

				// Check extension
				if (!$this->checkExtension($filename, $uid)) {
					continue;
				}

				// Check filesize
				if (!$this->checkFilesize($uid)) {
					continue;
				}

				// create new filename with absolute path
				$newFile = $this->basicFileFunctions->getUniqueName($filename, t3lib_div::getFileAbsFileName($this->settings['misc.']['file.']['folder']));
				$uploadSession[] = $newFile; // create array for upload session
				if (!t3lib_div::upload_copy_move($_FILES['tx_powermail_pi1']['tmp_name']['field'][$uid], $newFile)) {
					$this->addError('upload_error', $uid);
					$this->isValid = false;
				}
			}

			// save uploaded filenames to session (to attach it later)
			Tx_Powermail_Utility_Div::setSessionValue('upload', $uploadSession, true);
		}

		return $this->isValid;
  	}
예제 #6
0
 /**
  * Processes uploads
  *
  * @param mixed $file            
  * @return void
  */
 public function createAction(Tx_Feupload_Domain_Model_File $file)
 {
     $ffunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
     $path = $ffunc->getUniqueName($_FILES['tx_feupload_upload']['name']['file']['file'], t3lib_div::getFileAbsFileName('uploads/feupload/'));
     t3lib_div::upload_copy_move($_FILES['tx_feupload_upload']['tmp_name']['file']['file'], $path);
     $file->setFile(basename($path));
     if ($GLOBALS['TSFE']->fe_user->user) {
         // This is because $GLOBALS['TSFE']->fe_user is of type
         // tslib_feUserAuth
         // and $GLOBALS['TSFE']->fe_user->user is an array.
         $owner = $this->frontendUserRepository->findByUid($GLOBALS["TSFE"]->fe_user->user['uid']);
         $file->setOwner($owner);
     }
     $visibility = $_POST['tx_feupload_upload']['visibility'];
     $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['feupload']);
     $defaultVisibility = $extConf['defaultFileVisibility'];
     // globalVisibilty set? ignore user preference
     if (!empty($defaultVisibility) and in_array($defaultVisibility, array('public', 'login', 'groups'))) {
         $visibility = $defaultVisibility;
     }
     switch ($visibility) {
         case 'public':
             $file->setVisibility(0);
             break;
         case 'login':
             $file->setVisibility(-2);
             break;
         case 'groups':
             $file->setVisibility(1);
             foreach ($_POST['tx_feupload_upload']['groups'] as $groupId) {
                 $group = $this->frontendUserGroupRepository->findByUid($groupId);
                 if ($group) {
                     $file->addFrontendUserGroup($group);
                 }
             }
             break;
     }
     if ((bool) $this->userTS['appendGroups']) {
         $groupIds = explode(',', $this->userTS['appendGroups']);
         foreach ($groupIds as $groupId) {
             $group = $this->frontendUserGroupRepository->findByUid($groupId);
             if ($group) {
                 $file->addFrontendUserGroup($group);
             }
         }
     }
     /* @var $sessionHandler Tx_Feupload_Session_Folder */
     $sessionHandler = t3lib_div::makeInstance('Tx_Feupload_Session_Folder');
     $file->setFolder($sessionHandler->getCurrentFolder());
     $this->fileRepository->add($file);
     $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.file.uploaded.content'), Tx_Extbase_Utility_Localization::translate('LLL:EXT:feupload/Resources/Private/Language/locallang.xml:flash.ok.file.uploaded.title'), t3lib_FlashMessage::OK);
     $this->redirect('new');
 }
 function handleAjaxRequest($oRequest)
 {
     require_once PATH_t3lib . "class.t3lib_basicfilefunc.php";
     $oFile = t3lib_div::makeInstance("t3lib_basicFileFunctions");
     $aFile = $GLOBALS["_FILES"]["rdt_swfupload"];
     $sOriginalFileName = stripslashes($aFile["name"]);
     $sFileName = $sOriginalFileName;
     if ($this->defaultTrue("/usedenypattern") !== FALSE) {
         if (!t3lib_div::verifyFilenameAgainstDenyPattern($sFileName)) {
             die("FILE EXTENSION DENIED");
         }
     }
     if ($this->defaultFalse("/cleanfilename") !== FALSE) {
         $sFileName = strtolower($oFile->cleanFileName($sFileName));
     }
     $sTargetDir = $this->getTargetDir();
     $sTarget = $sTargetDir . $sFileName;
     if (!file_exists($sTargetDir)) {
         if ($this->defaultFalse("/data/targetdir/createifneeded") === TRUE) {
             // the target does not exist, we have to create it
             $this->oForm->div_mkdir_deep_abs($sTargetDir);
         }
     }
     if (!$this->defaultFalse("/overwrite")) {
         $sExt = strpos($sFileName, '.') === FALSE ? '' : '.' . substr(strrchr($sFileName, "."), 1);
         for ($i = 1; file_exists($sTarget); $i++) {
             $sTarget = $sTargetDir . substr($sFileName, 0, strlen($sFileName) - strlen($sExt)) . '[' . $i . ']' . $sExt;
         }
         $sFileName = basename($sTarget);
     }
     $this->sUploadedFileName = $sFileName;
     $this->aUploadedFileNameByOriginalFileName[$sOriginalFileName] = $sFileName;
     t3lib_div::upload_copy_move($aFile["tmp_name"], $sTarget);
     return array();
     // die("OK: " . $sTarget);
 }
 /**
  * Upload of files (action=1)
  *
  * @param	array		$cmds['data'] is the ID-number (points to the global var that holds the filename-ref  ($GLOBALS['HTTP_POST_FILES']['upload_'.$id]['name']). $cmds['target'] is the target directory
  * @param	string		$id: $_FILES['upload_'.$id]
  * @return	string		Returns the new filename upon success
  */
 function func_upload($cmds, $id = false)
 {
     if ($id === false) {
         $id = $cmds['data'];
     }
     if (!$this->isInit) {
         return FALSE;
     }
     if (!$_FILES['upload_' . $id]['name']) {
         return;
     }
     // filename of the uploaded file
     $theFile = $_FILES['upload_' . $id]['tmp_name'];
     // filesize of the uploaded file
     $theFileSize = $_FILES['upload_' . $id]['size'];
     // The original filename
     $theName = tx_dam::file_makeCleanName($_FILES['upload_' . $id]['name']);
     #		$theName = $this->cleanFileName($_FILES['upload_'.$id]['name']);
     // main log entry
     $this->log['cmd']['upload'][$id] = array('errors' => array(), 'orig_filename' => $theName, 'target_file' => '', 'target_path' => $this->fileCmdMap['upload'][$id]['target']);
     // Check if the file is uploaded
     if (!(is_uploaded_file($theFile) && $theName)) {
         $this->writelog(1, 2, 106, 'The uploaded file did not exist!', '', 'upload', $id);
         return;
     }
     // check upload permissions
     if (!$this->actionPerms['uploadFile']) {
         $this->writelog(1, 1, 105, 'You are not allowed to upload files!', '', 'upload', $id);
         return;
     }
     // check if the file size exceed permissions
     $maxBytes = $this->getMaxUploadSize();
     if (!($theFileSize < $maxBytes)) {
         $this->writelog(1, 1, 104, 'The uploaded file exceeds the size-limit of %s (%s Bytes).', array(t3lib_div::formatSize($maxBytes), $maxBytes), 'upload', $id);
         return;
     }
     // Check the target dir
     $theTarget = $this->is_directory($cmds['target']);
     // check if target is inside of a mount point
     if (!($theTarget && $this->checkPathAgainstMounts($theTarget . '/'))) {
         $this->writelog(1, 1, 103, 'Destination path "%s" was not within your mountpoints!', array($theTarget . '/'), 'upload', $id);
         return;
     }
     // check if the file extension is allowed
     $fI = t3lib_div::split_fileref($theName);
     if (!$this->checkIfAllowed($fI['fileext'], $theTarget, $fI['file'])) {
         $this->writelog(1, 1, 102, 'Fileextension "%s" is not allowed in "%s"!', array($fI['fileext'], $theTarget . '/'), 'upload', $id);
         return;
     }
     // Create unique file name
     $theNewFile = $this->getUniqueName($theName, $theTarget, $this->dontCheckForUnique);
     if (!$theNewFile) {
         $this->writelog(1, 1, 101, 'No unique filename available in "%s"!', array($theTarget . '/'), 'upload', $id);
         return;
     }
     // move uploaded file to target location
     t3lib_div::upload_copy_move($theFile, $theNewFile);
     clearstatcache();
     // moving file did not work
     if (!@is_file($theNewFile)) {
         $this->writelog(1, 1, 100, 'Uploaded file could not be moved! Write-permission problem in "%s"?', array($theTarget . '/'), 'upload', $id);
         return;
     }
     $this->internalUploadMap[$id] = $theNewFile;
     $this->writelog(1, 0, 1, 'Uploading file "%s" to "%s"', array($theName, $theNewFile, $id), 'upload', $id);
     // add file to log entry
     $this->log['cmd']['upload'][$id]['target_file'] = $theNewFile;
     return $theNewFile;
 }
 /**
  * wrapper for t3lib_div::writeFile
  * checks for overwrite settings
  *
  * @param string $targetFile the path and filename of the targetFile
  * @param string $fileContents
  */
 protected function upload_copy_move($sourceFile, $targetFile)
 {
     $overWriteMode = Tx_ExtensionBuilder_Service_RoundTrip::getOverWriteSettingForPath($targetFile, $this->extension);
     if ($overWriteMode === -1) {
         // skip creation
         return;
     }
     if (!file_exists($targetFile) || $this->roundTripEnabled && $overWriteMode < 2) {
         t3lib_div::upload_copy_move($sourceFile, $targetFile);
     }
 }
 /**
  * Processes uploaded files
  *
  * @param string $theTable: the name of the table being edited
  * @param string  $theField: the name of the field
  * @return array file names
  */
 public function processFiles($theTable, $theField, array $fieldDataArray, $cmdKey)
 {
     if (is_array($GLOBALS['TCA'][$theTable]['columns'][$theField])) {
         $uploadPath = $GLOBALS['TCA'][$theTable]['columns'][$theField]['config']['uploadfolder'];
     }
     $fileNameArray = array();
     if ($uploadPath) {
         if (count($fieldDataArray)) {
             foreach ($fieldDataArray as $file) {
                 if (is_array($file)) {
                     if ($this->checkFilename($file['name'])) {
                         if ($file['submit_delete']) {
                             if ($cmdKey !== 'edit') {
                                 if (@is_file(PATH_site . $uploadPath . '/' . $file['name'])) {
                                     @unlink(PATH_site . $uploadPath . '/' . $file['name']);
                                 }
                             }
                         } else {
                             $fileNameArray[] = $file['name'];
                         }
                     }
                 } else {
                     if ($this->checkFilename($file)) {
                         $fileNameArray[] = $file;
                     }
                 }
             }
         }
         if (is_array($_FILES['FE']['name'][$theTable][$theField])) {
             foreach ($_FILES['FE']['name'][$theTable][$theField] as $i => $filename) {
                 if ($filename && $this->checkFilename($filename) && $this->evalFileError($_FILES['FE']['error'][$theTable][$theField][$i])) {
                     $fI = pathinfo($filename);
                     if (t3lib_div::verifyFilenameAgainstDenyPattern($fI['name'])) {
                         $tmpFilename = basename($filename, '.' . $fI['extension']) . '_' . t3lib_div::shortmd5(uniqid($filename)) . '.' . $fI['extension'];
                         $cleanFilename = $this->fileFunc->cleanFileName($tmpFilename);
                         $theDestFile = $this->fileFunc->getUniqueName($cleanFilename, PATH_site . $uploadPath . '/');
                         $result = t3lib_div::upload_copy_move($_FILES['FE']['tmp_name'][$theTable][$theField][$i], $theDestFile);
                         $fI2 = pathinfo($theDestFile);
                         $fileNameArray[] = $fI2['basename'];
                     }
                 }
             }
         }
     }
     return $fileNameArray;
 }
 /**
  * The actual sprite generator, renders the command for Im/GM and executes
  *
  * @return void
  */
 protected function generateGraphic()
 {
     $iconParameters = array();
     $tempSprite = t3lib_div::tempnam($this->spriteName);
     $filePath = array('mainFile' => PATH_site . $this->spriteFolder . $this->spriteName . '.png', 'gifFile' => NULL);
     // create black true color image with given size
     $newSprite = imagecreatetruecolor($this->spriteWidth, $this->spriteHeight);
     imagesavealpha($newSprite, TRUE);
     // make it transparent
     imagefill($newSprite, 0, 0, imagecolorallocatealpha($newSprite, 0, 255, 255, 127));
     foreach ($this->iconsData as $icon) {
         $function = 'imagecreatefrom' . strtolower($icon['fileExtension']);
         if (function_exists($function)) {
             $currentIcon = $function($icon['fileName']);
             imagecopy($newSprite, $currentIcon, $icon['left'], $icon['top'], 0, 0, $icon['width'], $icon['height']);
         }
     }
     imagepng($newSprite, $tempSprite . '.png');
     if ($this->generateGIFCopy) {
         $filePath['gifFile'] = PATH_site . $this->spriteFolder . $this->spriteName . '.gif';
         $gifSprite = imagecreatetruecolor($this->spriteWidth, $this->spriteHeight);
         // make it transparent
         imagefill($gifSprite, 0, 0, imagecolorallocate($gifSprite, 127, 127, 127));
         foreach ($this->iconsData as $icon) {
             $function = 'imagecreatefrom' . strtolower($icon['fileExtension']);
             if (function_exists($function)) {
                 $currentIcon = $function($icon['fileName']);
                 imagecopy($gifSprite, $currentIcon, $icon['left'], $icon['top'], 0, 0, $icon['width'], $icon['height']);
             }
         }
         imagecolortransparent($gifSprite, imagecolorallocate($gifSprite, 127, 127, 127));
         imagegif($gifSprite, $tempSprite . '.gif');
     }
     t3lib_div::upload_copy_move($tempSprite . '.png', $filePath['mainFile']);
     t3lib_div::unlink_tempfile($tempSprite . '.png');
     if ($this->generateGIFCopy) {
         t3lib_div::upload_copy_move($tempSprite . '.gif', $filePath['gifFile']);
         t3lib_div::unlink_tempfile($tempSprite . '.gif');
     }
 }
예제 #12
0
 /**
  * Mandatory autofix function
  * Will run auto-fix on the result array. Echos status during processing.
  *
  * @param	array		Result array from main() function
  * @return	void
  */
 function main_autoFix($resultArray)
 {
     foreach ($resultArray['multipleReferencesList'] as $key => $value) {
         $absFileName = t3lib_div::getFileAbsFileName($key);
         if ($absFileName && @is_file($absFileName)) {
             echo 'Processing file: ' . $key . LF;
             $c = 0;
             foreach ($value as $hash => $recReference) {
                 if ($c == 0) {
                     echo '	Keeping ' . $key . ' for record "' . $recReference . '"' . LF;
                 } else {
                     // Create unique name for file:
                     $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                     $newName = $fileFunc->getUniqueName(basename($key), dirname($absFileName));
                     echo '	Copying ' . $key . ' to ' . substr($newName, strlen(PATH_site)) . ' for record "' . $recReference . '": ';
                     if ($bypass = $this->cli_noExecutionCheck($recReference)) {
                         echo $bypass;
                     } else {
                         t3lib_div::upload_copy_move($absFileName, $newName);
                         clearstatcache();
                         if (@is_file($newName)) {
                             $sysRefObj = t3lib_div::makeInstance('t3lib_refindex');
                             $error = $sysRefObj->setReferenceValue($hash, basename($newName));
                             if ($error) {
                                 echo '	ERROR:	t3lib_refindex::setReferenceValue(): ' . $error . LF;
                                 exit;
                             } else {
                                 echo "DONE";
                             }
                         } else {
                             echo '	ERROR: File "' . $newName . '" was not created!';
                         }
                     }
                     echo LF;
                 }
                 $c++;
             }
         } else {
             echo '	ERROR: File "' . $absFileName . '" was not found!';
         }
     }
 }
예제 #13
0
 /**
  * add Image
  *
  * @param $name boolean
  * @return string
  */
 private function addImage($name = "event")
 {
     if ($_FILES['tx_nboevents_events']) {
         $basicFileFunctions = t3lib_div::makeInstance('t3lib_basicFileFunctions');
         $fileName = $basicFileFunctions->getUniqueName($_FILES['tx_nboevents_events']['name'][$name]['images'], t3lib_div::getFileAbsFileName('uploads/tx_nboevents/'));
         t3lib_div::upload_copy_move($_FILES['tx_nboevents_events']['tmp_name'][$name]['images'], $fileName);
         return basename($fileName);
     }
 }
 /**
  * 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, $cmds['charset'] is the the character set of the file name (utf-8 is needed for JS-interaction)
  * @return	string		Returns the new filename upon success
  */
 function func_upload($cmds)
 {
     if (!$this->isInit) {
         return FALSE;
     }
     $id = $cmds['data'];
     if ($_FILES['upload_' . $id]['name']) {
         $theFile = $_FILES['upload_' . $id]['tmp_name'];
         // filename of the uploaded file
         $theFileSize = $_FILES['upload_' . $id]['size'];
         // filesize of the uploaded file
         $theName = $this->cleanFileName(stripslashes($_FILES['upload_' . $id]['name']), isset($cmds['charset']) ? $cmds['charset'] : '');
         // The original filename
         if (is_uploaded_file($theFile) && $theName) {
             // Check the file
             if ($this->actionPerms['uploadFile']) {
                 if ($theFileSize < $this->maxUploadFileSize * 1024) {
                     $fI = t3lib_div::split_fileref($theName);
                     $theTarget = $this->is_directory($cmds['target']);
                     // Check the target dir
                     if ($theTarget && $this->checkPathAgainstMounts($theTarget . '/')) {
                         if ($this->checkIfAllowed($fI['fileext'], $theTarget, $fI['file'])) {
                             $theNewFile = $this->getUniqueName($theName, $theTarget, $this->dontCheckForUnique);
                             if ($theNewFile) {
                                 t3lib_div::upload_copy_move($theFile, $theNewFile);
                                 clearstatcache();
                                 if (@is_file($theNewFile)) {
                                     $this->internalUploadMap[$id] = $theNewFile;
                                     $this->writelog(1, 0, 1, 'Uploading file "%s" to "%s"', array($theName, $theNewFile, $id));
                                     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 . '/'));
                             }
                         } else {
                             $this->writelog(1, 1, 102, 'Extension of file name "%s" is not allowed in "%s"!', array($fI['file'], $theTarget . '/'));
                         }
                     } else {
                         $this->writelog(1, 1, 103, 'Destination path "%s" was not within your mountpoints!', array($theTarget . '/'));
                     }
                 } else {
                     $this->writelog(1, 1, 104, 'The uploaded file exceeds the size-limit of %s bytes', array($this->maxUploadFileSize * 1024));
                 }
             } else {
                 $this->writelog(1, 1, 105, 'You are not allowed to upload files!', '');
             }
         } else {
             $this->writelog(1, 2, 106, 'The upload has failed, no uploaded file found!', '');
         }
     } else {
         $this->writelog(1, 2, 108, 'No file was uploaded!', '');
     }
 }
 /**
  * The function to display the detailview of one job
  *
  * @param bool $applyOnly Show only the apply form?
  * @return string The content that is displayed on the website
  */
 function displayDetail($applyOnly = false)
 {
     if (isset($this->piVars['ref']) && $this->piVars['ref']) {
         // Find the job_uid by searching the reference number
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dmmjobcontrol_job', 'reference=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['ref'], 'tx_dmmjobcontrol_job') . ' AND ' . $this->whereAdd);
         if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $this->piVars['job_uid'] = $row['uid'];
         }
     }
     if (isset($this->piVars['job_uid']) && $this->piVars['job_uid']) {
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_dmmjobcontrol_job', 'uid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['job_uid'], 'tx_dmmjobcontrol_job') . ' AND ' . $this->whereAdd);
         if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             // This sets the jobtitle as the page title (also for use in indexed search results)
             if (isset($this->conf['substitutePageTitle']) && $this->conf['substitutePageTitle']) {
                 $GLOBALS['TSFE']->indexedDocTitle = $row['job_title'];
                 $GLOBALS['TSFE']->page['title'] = $row['job_title'];
                 $this->cObj->LOAD_REGISTER(array('JOBTITLE' => $row['job_title']), '');
                 $this->cObj->LOAD_REGISTER(array('JOBLOCATION' => $row['location']), '');
             }
             // Which fields are required?
             if (isset($this->conf['apply.']['required']) && $this->conf['apply.']['required']) {
                 $this->requiredFields = t3lib_div::trimExplode(',', $this->conf['apply.']['required']);
             }
             // Get all the labels and job data
             $labels = $this->getLabels();
             $jobData = $this->getJobData($row);
             if (isset($this->conf['hide_empty']) && $this->conf['hide_empty']) {
                 $markerArray = $this->hideEmpty($labels, $jobData, $row);
             } else {
                 $markerArray = $labels + $jobData;
             }
             // Process the apply form: send out email
             if (isset($this->piVars['apply_submit']) && ($applyOnly || $this->conf['apply.']['form'] != 0)) {
                 // Get the apply templates
                 $this->templateCode = $this->cObj->fileResource($this->conf['template.']['apply']);
                 if (is_null($this->templateCode)) {
                     return $this->pi_getLL('template_not_found');
                 }
                 // Spamblock?
                 if (isset($this->conf['apply.']['spamblock']) && $this->conf['apply.']['spamblock']) {
                     $session = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->prefixId);
                     if (!is_array($session['spamblock']) || !$this->piVars['sessioncheck'] || !in_array($this->piVars['sessioncheck'], $session['spamblock'])) {
                         $template['thanks'] = $this->cObj->getSubpart($this->templateCode, '###APPLY_THANKS_TEMPLATE###');
                         return $this->cObj->substituteMarkerArrayCached($template['thanks'], $markerArray);
                     }
                 }
                 // TODO: server-side check for $this->requiredFields
                 // Extend the markerArray with the posted values
                 $markerArray['###FULLNAME_VALUE###'] = $this->piVars['apply']['fullname'];
                 $markerArray['###EMAIL_VALUE###'] = $this->piVars['apply']['email'];
                 $markerArray['###MOTIVATION_VALUE###'] = $this->piVars['apply']['motivation'];
                 if (isset($this->conf['htmlmail']) && $this->conf['htmlmail']) {
                     $markerArray['###MOTIVATION_VALUE###'] = nl2br($this->piVars['apply']['motivation']);
                 }
                 // Extend the markerArray with user function?
                 if (isset($this->conf['applyArrayFunction']) && $this->conf['applyArrayFunction']) {
                     $funcConf = $this->conf['applyArrayFunction.'];
                     $funcConf['parent'] =& $this;
                     $markerArray = $this->cObj->callUserFunction($this->conf['applyArrayFunction'], $funcConf, $markerArray);
                 }
                 $subject = $this->pi_getLL('apply_email_subject') . $row['job_title'];
                 // HTML email body
                 $template['htmlEmail'] = $this->cObj->getSubpart($this->templateCode, '###HTML_EMAIL_TEMPLATE###');
                 $htmlBody = $this->cObj->substituteMarkerArrayCached($template['htmlEmail'], $markerArray);
                 // Plain text email boby
                 $template['textEmail'] = $this->cObj->getSubpart($this->templateCode, '###TEXT_EMAIL_TEMPLATE###');
                 $textBody = $this->cObj->substituteMarkerArrayCached($template['textEmail'], $markerArray);
                 // The uploaded files
                 $html_attachments = array();
                 $text_attachments = array();
                 if (isset($_FILES['tx_dmmjobcontrol_pi1']['name']['apply']['file']) && $_FILES['tx_dmmjobcontrol_pi1']['name']['apply']['file']) {
                     if (isset($this->conf['apply.']['allowed_file_extensions']) && $this->conf['apply.']['allowed_file_extensions']) {
                         $allowed_file_extensions = $this->conf['apply.']['allowed_file_extensions'];
                     } else {
                         $allowed_file_extensions = 'doc,docx,pdf,odt,sxw,rtf';
                     }
                     foreach ($_FILES['tx_dmmjobcontrol_pi1']['name']['apply']['file'] as $index => $name) {
                         if ($name) {
                             $fileInfo = pathinfo($_FILES['tx_dmmjobcontrol_pi1']['name']['apply']['file'][$index]);
                             if (t3lib_div::inList($allowed_file_extensions, strtolower($fileInfo['extension'])) && t3lib_div::verifyFilenameAgainstDenyPattern($name)) {
                                 $source = $_FILES['tx_dmmjobcontrol_pi1']['tmp_name']['apply']['file'][$index];
                                 $destination = PATH_site . 'typo3temp/' . $fileInfo['basename'];
                                 t3lib_div::upload_copy_move($source, $destination);
                                 $html_attachments[] = $destination;
                                 $text_attachments[] = $GLOBALS['TSFE']->baseUrlWrap('typo3temp/' . $fileInfo['basename']);
                             } else {
                                 $htmlBody .= '<p><i>The uploaded file "' . $fileInfo['basename'] . '" was not attached because it was not in a valid file format.</i></p>';
                                 $textBody .= "\n\nThe uploaded file " . $fileInfo['basename'] . " was not attached because it was not in a valid file format.";
                             }
                         }
                     }
                 }
                 // Is there a contact person added to the job?
                 if ($row['contact']) {
                     $contact_res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', ' tx_dmmjobcontrol_contact', 'uid=' . $row['contact']);
                     if ($contact_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($contact_res)) {
                         $this->conf['apply.']['to'] = $contact_row['email'];
                     }
                 }
                 if (isset($this->conf['htmlmail']) && $this->conf['htmlmail']) {
                     // Send HTML email with file attachment(s)
                     $htmlmailClass = t3lib_div::makeInstance('t3lib_mail_message');
                     $htmlmailClass->setFrom(array($this->conf['apply.']['to'] => $this->pi_getLL('mail_from_name')));
                     $htmlmailClass->setReplyTo(array($this->conf['apply.']['to'] => $this->pi_getLL('mail_from_name')));
                     $htmlmailClass->setTo($this->conf['apply.']['to']);
                     $htmlmailClass->setSubject($subject);
                     $htmlmailClass->setBody($body);
                     // Add CV as attachment
                     foreach ($html_attachments as $attachment) {
                         $htmlmailClass->attach(Swift_Attachment::fromPath($attachment));
                     }
                     $htmlmailClass->setBody($htmlBody, 'text/html');
                     $htmlmailClass->addPart($textBody, 'text/plain');
                     $htmlmailClass->send();
                     foreach ($html_attachments as $attachment) {
                         t3lib_div::unlink_tempfile($attachment);
                     }
                 } else {
                     // Send plain text email, CV and letter as download links
                     foreach ($text_attachments as $attachment) {
                         $textBody .= "\n\nUploaded file: " . $attachment;
                     }
                     $this->cObj->sendNotifyEmail($subject . "\n" . $textBody, $this->conf['apply.']['to'], '', $this->conf['apply.']['to'], 'JobControl job application');
                 }
                 if (isset($this->conf['apply.']['redirect']) && $this->conf['apply.']['redirect']) {
                     // redirect to given page
                     header('Location: /' . $this->cObj->getTypoLink_URL($this->conf['apply.']['redirect']));
                     exit;
                 }
                 // The thank-you page
                 $template['thanks'] = $this->cObj->getSubpart($this->templateCode, '###APPLY_THANKS_TEMPLATE###');
                 return $this->cObj->substituteMarkerArrayCached($template['thanks'], $markerArray);
             } else {
                 // Show the detail page / apply form
                 // Get the template
                 if ($applyOnly) {
                     $this->templateCode = $this->cObj->fileResource($this->conf['template.']['apply']);
                 } else {
                     $this->templateCode = $this->cObj->fileResource($this->conf['template.']['detail']);
                 }
                 if (is_null($this->templateCode)) {
                     return $this->pi_getLL('template_not_found');
                 }
                 // Get the main part out of the template
                 $template['total'] = $this->cObj->getSubpart($this->templateCode, '###TEMPLATE###');
                 if ($applyOnly) {
                     // If we only have to show the apply form, then we are already done now
                     return $this->getApplyFormData($template['total'], $markerArray);
                 }
                 // On the detail page we have to fill the APPLY part of the template
                 $wrappedMarkerArray['###APPLY###'] = '';
                 if (isset($this->conf['apply.']['form']) && $this->conf['apply.']['form']) {
                     $applyForm = '';
                     if ($this->conf['apply.']['form'] == 1) {
                         $applyForm = $this->cObj->fileResource($this->conf['template.']['apply']);
                         $applyForm = $this->cObj->getSubpart($applyForm, '###TEMPLATE###');
                     }
                     $template['apply'] = $this->cObj->getSubpart($template['total'], '###APPLY###');
                     $template['apply'] = $this->cObj->substituteMarkerArrayCached($template['apply'], array('###INCLUDE_APPLY_FORM###' => $applyForm));
                     $wrappedMarkerArray['###APPLY###'] = $this->getApplyFormData($template['apply'], $markerArray);
                 }
                 return $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray, $wrappedMarkerArray);
             }
         }
     }
     // Job not found or job_uid not set at all
     return $this->notFound();
 }
 /**
  *
  * Enter description here ...
  *
  * @param Tx_Typo3Agencies_Domain_Model_Reference $reference
  *
  * @return boolean True, if there were no errors
  */
 private function handleFiles(&$reference)
 {
     $ok = TRUE;
     if (is_array($_FILES['tx_typo3agencies_pi1'])) {
         $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
         $all_files = array();
         $all_files['webspace']['allow'] = '*';
         $all_files['webspace']['deny'] = '';
         $fileFunc->init('', $all_files);
         $galleryImages = array();
         $formName = array_shift(array_keys($_FILES['tx_typo3agencies_pi1']['error']));
         foreach ($_FILES['tx_typo3agencies_pi1']['error'][$formName] as $key => $error) {
             if (is_array($error)) {
                 // must be an image for the gallery
                 foreach ($error as $error_key => $error_error) {
                     if ($error_error == 0) {
                         if (strpos($_FILES['tx_typo3agencies_pi1']['type'][$formName][$key][$error_key], 'image/png') === 0 || strpos($_FILES['tx_typo3agencies_pi1']['type'][$formName][$key][$error_key], 'image/jpg') === 0 || strpos($_FILES['tx_typo3agencies_pi1']['type'][$formName][$key][$error_key], 'image/jpeg') === 0) {
                             if ($_FILES['tx_typo3agencies_pi1']['size'][$formName][$key][$error_key] < 500000) {
                                 $theFile = $_FILES['tx_typo3agencies_pi1']['tmp_name'][$formName][$key][$error_key];
                                 $theDestFile = $fileFunc->getUniqueName($fileFunc->cleanFileName($_FILES['tx_typo3agencies_pi1']['name'][$formName][$key][$error_key]), $this->settings['uploadPath']);
                                 t3lib_div::upload_copy_move($theFile, $theDestFile);
                                 $galleryImages[] = basename($theDestFile);
                             } else {
                                 $ok = FALSE;
                                 $this->flashMessages->add(str_replace('%FILE%', $_FILES['tx_typo3agencies_pi1']['name'][$formName][$key][$error_key], $this->localization->translate('wrongFileSize', $this->extensionName)), '', t3lib_message_AbstractMessage::ERROR);
                             }
                         } else {
                             $ok = FALSE;
                             $this->flashMessages->add(str_replace('%FILE%', $_FILES['tx_typo3agencies_pi1']['name'][$formName][$key][$error_key], $this->localization->translate('wrongFileType', $this->extensionName)), '', t3lib_message_AbstractMessage::ERROR);
                         }
                     }
                 }
             } else {
                 if ($error == 0) {
                     if ($key == 'screenshot') {
                         if (strpos($_FILES['tx_typo3agencies_pi1']['type'][$formName][$key], 'image/png') === 0 || strpos($_FILES['tx_typo3agencies_pi1']['type'][$formName][$key], 'image/jpg') === 0 || strpos($_FILES['tx_typo3agencies_pi1']['type'][$formName][$key], 'image/jpeg') === 0) {
                             if ($_FILES['tx_typo3agencies_pi1']['size'][$formName][$key] < 500000) {
                                 $theFile = $_FILES['tx_typo3agencies_pi1']['tmp_name'][$formName][$key];
                                 $theDestFile = $fileFunc->getUniqueName($fileFunc->cleanFileName($_FILES['tx_typo3agencies_pi1']['name'][$formName][$key]), $this->settings['uploadPath']);
                                 t3lib_div::upload_copy_move($theFile, $theDestFile);
                                 $reference->setScreenshot(basename($theDestFile));
                             } else {
                                 $ok = FALSE;
                                 $this->flashMessages->add(str_replace('%FILE%', $_FILES['tx_typo3agencies_pi1']['name'][$formName][$key], $this->localization->translate('wrongFileSize', $this->extensionName)), '', t3lib_message_AbstractMessage::ERROR);
                             }
                         } else {
                             $ok = FALSE;
                             $this->flashMessages->add(str_replace('%FILE%', $_FILES['tx_typo3agencies_pi1']['name'][$formName][$key], $this->localization->translate('wrongFileType', $this->extensionName)), '', t3lib_message_AbstractMessage::ERROR);
                         }
                     }
                 }
             }
         }
         $exisitingScreenshots = t3lib_div::trimExplode(',', $reference->getScreenshotGallery(), 1);
         $reference->setScreenshotGallery(implode(',', array_merge($galleryImages, $exisitingScreenshots)));
     }
     return $ok;
 }
예제 #17
0
    /**
     * action sendmail
     *
     * @return void
     */
    public function sendmailAction()
    {
        $status = FALSE;
        $errorMessage = '';
        switch ($this->request->getArgument('supportFormTopic')) {
            case 'sapSupportAnfrage':
                $attachment = array();
                $fileNames = array();
                if ($_FILES['hardcopy']['name'][0] != '') {
                    $basicFileFunctions = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                    foreach ($_FILES['hardcopy']['name'] as $id => $value) {
                        $fileName = $basicFileFunctions->getUniqueName($_FILES['hardcopy']['name'][$id], t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/'));
                        t3lib_div::upload_copy_move($_FILES['hardcopy']['tmp_name'][$id], $fileName);
                        $attachment[] = t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/') . basename($fileName);
                        $fileNames[] = $fileName;
                    }
                }
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Allgemeine SAP-Supportanfrage';
                $message = '
Anfragedetails
================

Betreff:  ' . $this->request->getArgument('subject') . '
Nachricht:
' . $this->request->getArgument('message') . '

Debitor:             ' . $this->request->getArgument('debitor') . '
Ggfs. Vetragsnummer: ' . $this->request->getArgument('contractno') . '
Kundenauftrag:       ' . $this->request->getArgument('customerOrder') . '
CS-Auftrag:          ' . $this->request->getArgument('csOrder') . '
Proband:             ' . $this->request->getArgument('proband') . '
Med. Service:        ' . $this->request->getArgument('medicalService') . '

Mitarbeiterdaten
================

Titel:          ' . $this->request->getArgument('title') . '
Name:           ' . $this->request->getArgument('name') . '
Personalnummer: ' . $this->request->getArgument('persno') . '
OrgEinheit:     ' . $this->request->getArgument('orgunit') . '
Telefon:        ' . $this->request->getArgument('phone') . '
Mail-Adresse:   ' . $this->request->getArgument('mail') . '				
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, $attachment, $fileNames, NULL, NULL);
                break;
            case 'sapNeuesStartkennwort':
                $message = '
SAP-Nutzer-Startkennwort beantragt
==================================

Organisationseinheit: ' . $this->request->getArgument('orgunit') . '
Ort:                  ' . $this->request->getArgument('city') . '
Name, Vorname:        ' . $this->request->getArgument('lastname') . ', ' . $this->request->getArgument('firstname') . '
Personalnummer:       ' . $this->request->getArgument('persno') . '
E-Mail-Adresse:       ' . $this->request->getArgument('mail') . '

				';
                $sapSystemUserForMails = 'mail';
                $affectedSAPSystems = '';
                $affectedHRSystems = '';
                $addressSystemHR = array();
                $addressSystemSAP = array();
                foreach ($this->request->getArgument('sap_system') as $sapSystemInfo) {
                    $sapSystemInfoArr = explode(',', $sapSystemInfo);
                    switch ($sapSystemInfoArr[2]) {
                        case 'HR':
                            $affectedHRSystems .= $sapSystemInfoArr[1] . ';';
                            $addressSystemHR[] = $sapSystemInfoArr[0];
                            break;
                        case 'SAP':
                            $affectedSAPSystems .= $sapSystemInfoArr[1] . ';';
                            $addressSystemSAP[] = $sapSystemInfoArr[0];
                            break;
                        default:
                            break;
                    }
                }
                $addressSystemHR = array_unique($addressSystemHR);
                $addressSystemSAP = array_unique($addressSystemSAP);
                if ($affectedHRSystems) {
                    $subject = $this->request->getArgument('persno') . ';P;' . substr($affectedHRSystems, 0, -1);
                    $recipient = $this->assembleMailAddressesForSAPSystems($sapSystemUserForMails, $addressSystemHR[0]);
                    $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('firstname') . ' ' . $this->request->getArgument('lastname'), $recipient, NULL, NULL, NULL, '*****@*****.**', NULL);
                }
                if ($affectedSAPSystems) {
                    $subject = $this->request->getArgument('persno') . ';P;' . substr($affectedSAPSystems, 0, -1);
                    $recipient = $this->assembleMailAddressesForSAPSystems($sapSystemUserForMails, $addressSystemSAP[0]);
                    $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('firstname') . ' ' . $this->request->getArgument('lastname'), $recipient, NULL, NULL, NULL, '*****@*****.**', NULL);
                }
                break;
            case 'sapBenutzerentsperren':
                $message = '
SAP-Nutzer-Entsperrung beantragt
================================

Organisationseinheit: ' . $this->request->getArgument('orgunit') . '
Ort:                  ' . $this->request->getArgument('city') . '
Name, Vorname:        ' . $this->request->getArgument('lastname') . ', ' . $this->request->getArgument('firstname') . '
Personalnummer:       ' . $this->request->getArgument('persno') . '
E-Mail-Adresse:       ' . $this->request->getArgument('mail') . '

				';
                $sapSystemUserForMails = 'mail';
                $affectedSAPSystems = '';
                $affectedHRSystems = '';
                $addressSystemHR = array();
                $addressSystemSAP = array();
                foreach ($this->request->getArgument('sap_system') as $sapSystemInfo) {
                    $sapSystemInfoArr = explode(',', $sapSystemInfo);
                    switch ($sapSystemInfoArr[2]) {
                        case 'HR':
                            $affectedHRSystems .= $sapSystemInfoArr[1] . ';';
                            $addressSystemHR[] = $sapSystemInfoArr[0];
                            break;
                        case 'SAP':
                            $affectedSAPSystems .= $sapSystemInfoArr[1] . ';';
                            $addressSystemSAP[] = $sapSystemInfoArr[0];
                            break;
                        default:
                            break;
                    }
                }
                $addressSystemHR = array_unique($addressSystemHR);
                $addressSystemSAP = array_unique($addressSystemSAP);
                if ($affectedHRSystems) {
                    $subject = $this->request->getArgument('persno') . ';E;' . substr($affectedHRSystems, 0, -1);
                    $recipient = $this->assembleMailAddressesForSAPSystems($sapSystemUserForMails, $addressSystemHR[0]);
                    $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('firstname') . ' ' . $this->request->getArgument('lastname'), $recipient, NULL, NULL, NULL, '*****@*****.**', NULL);
                }
                if ($affectedSAPSystems) {
                    $subject = $this->request->getArgument('persno') . ';E;' . substr($affectedSAPSystems, 0, -1);
                    $recipient = $this->assembleMailAddressesForSAPSystems($sapSystemUserForMails, $addressSystemSAP[0]);
                    $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('firstname') . ' ' . $this->request->getArgument('lastname'), $recipient, NULL, NULL, NULL, '*****@*****.**', NULL);
                }
                break;
            case 'sapBenutzerAnlegen':
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: SAP-Benutzer anlegen';
                $message = '
Organisationseinheit
====================

Bezeichnung:        ' . $this->request->getArgument('orgunitNewCoworker') . '
SAP-Zentrumsnummer: ' . $this->request->getArgument('centernoNewCoworker') . '

Anzulegender SAP-Benutzer
=========================

Personalnummer:         ' . $this->request->getArgument('persnoNewCoworker') . '
Vorname/Nachname:       ' . $this->request->getArgument('nameNewCoworker') . '
Mail-Adresse:           ' . $this->request->getArgument('mailNewCoworker') . '
Funktion:               ' . $this->request->getArgument('functionNewCoworker') . '
Externer Mitarbeiter:   ' . $this->request->getArgument('externalCoworker') . '
Aushilfe von:           ' . $this->request->getArgument('temporaryJobberFrom') . '
Aushilfe bis:           ' . $this->request->getArgument('temporaryJobberTo') . '
SAP-Drucker (Standort): ' . $this->request->getArgument('sapPrinterNewCoworker') . '
Bemerkung:
' . $this->request->getArgument('message') . '

Mitarbeiterdaten
================

Titel:          ' . $this->request->getArgument('title') . '
Name:           ' . $this->request->getArgument('name') . '
Funktion:       ' . $this->request->getArgument('function') . '
Personalnummer: ' . $this->request->getArgument('persno') . '
OrgEinheit:     ' . $this->request->getArgument('orgunit') . '
Telefon:        ' . $this->request->getArgument('phone') . '
Mail-Adresse:   ' . $this->request->getArgument('mail') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'sapBenutzerloeschen':
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: SAP-Benutzer löschen';
                $message = '
Organisationseinheit
====================

Bezeichnung:        ' . $this->request->getArgument('orgunitDelCoworker') . '
SAP-Zentrumsnummer: ' . $this->request->getArgument('centernoDelCoworker') . '

Zu löschender SAP-Benutzer
==========================

Personalnummer:     ' . $this->request->getArgument('persnoDelCoworker') . '
Vorname/Nachname:   ' . $this->request->getArgument('nameDelCoworker') . '
Mail-Adresse:       ' . $this->request->getArgument('mailDelCoworker') . '
Bemerkung:
' . $this->request->getArgument('message') . '

Mitarbeiterdaten
================

Titel:          ' . $this->request->getArgument('title') . '
Name:           ' . $this->request->getArgument('name') . '
Funktion:       ' . $this->request->getArgument('function') . '
Personalnummer: ' . $this->request->getArgument('persno') . '
OrgEinheit:     ' . $this->request->getArgument('orgunit') . '
Telefon:        ' . $this->request->getArgument('phone') . '
Mail-Adresse:   ' . $this->request->getArgument('mail') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'itSupportAnfrage':
                $attachment = array();
                $fileNames = array();
                if ($_FILES['hardcopy']['name'][0] != '') {
                    $basicFileFunctions = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                    foreach ($_FILES['hardcopy']['name'] as $id => $value) {
                        $fileName = $basicFileFunctions->getUniqueName($_FILES['hardcopy']['name'][$id], t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/'));
                        t3lib_div::upload_copy_move($_FILES['hardcopy']['tmp_name'][$id], $fileName);
                        $attachment[] = t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/') . basename($fileName);
                        $fileNames[] = $fileName;
                    }
                }
                $recipient = '*****@*****.**';
                $subject = 'TPO :: ' . $this->request->getArgument('subject');
                $message = '
Anfragedetails
================

' . $this->request->getArgument('message') . '

Seit wann besteht die Störung/das Problem? ' . $this->request->getArgument('timeOfDefect') . '
Ihr terminliche Erreichbarkeit:            ' . $this->request->getArgument('accessibility') . '
Telefonnummer:                             ' . $this->request->getArgument('phone2') . '
Produkt:                                   ' . $this->request->getArgument('product') . '
Hostname:                                  ' . $this->request->getArgument('hostname') . '
Es liegt ein Hardwarefehler vor:           ' . $this->request->getArgument('hardwareDefect') . '
Hersteller:                                ' . $this->request->getArgument('manufacturer') . '
Modell:                                    ' . $this->request->getArgument('model') . '
Seriennummer:                              ' . $this->request->getArgument('serialno') . '

Mitarbeiterdaten
================

Titel:          ' . $this->request->getArgument('title') . '
Name:           ' . $this->request->getArgument('name') . '
Personalnummer: ' . $this->request->getArgument('persno') . '
OrgEinheit:     ' . $this->request->getArgument('orgunit') . '
Telefon:        ' . $this->request->getArgument('phone') . '
Mail-Adresse:   ' . $this->request->getArgument('mail') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, $attachment, $fileNames, NULL, NULL);
                break;
            case 'isisSupportAnfrage':
                $attachment = array();
                $fileNames = array();
                if ($_FILES['hardcopy']['name'][0] != '') {
                    $basicFileFunctions = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                    foreach ($_FILES['hardcopy']['name'] as $id => $value) {
                        $fileName = $basicFileFunctions->getUniqueName($_FILES['hardcopy']['name'][$id], t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/'));
                        t3lib_div::upload_copy_move($_FILES['hardcopy']['tmp_name'][$id], $fileName);
                        $attachment[] = t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/') . basename($fileName);
                        $fileNames[] = $fileName;
                    }
                }
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Allgemeine I·S·I·S-Supportanfrage';
                $message = '
Anfragedetails
================

Betreff:  ' . $this->request->getArgument('subject') . '
Nachricht:
' . $this->request->getArgument('message') . '

Proband / Debitor:                      ' . $this->request->getArgument('proband_debitor') . '
Offline / Online im AD oder ID/Zentrum: ' . $this->request->getArgument('offline_online') . '
Hostname Rechner:                       ' . $this->request->getArgument('hostname') . '
Med. Gerätebezeichnung:                 ' . $this->request->getArgument('device') . '
Erreichbarkeit:                         ' . $this->request->getArgument('accessibility') . '
Telefonnummer:                          ' . $this->request->getArgument('phone2') . '
Arbeitsmed. Zentrum:                    ' . $this->request->getArgument('center') . '

Mitarbeiterdaten
================

Titel:          ' . $this->request->getArgument('title') . '
Name:           ' . $this->request->getArgument('name') . '
Personalnummer: ' . $this->request->getArgument('persno') . '
OrgEinheit:     ' . $this->request->getArgument('orgunit') . '
Telefon:        ' . $this->request->getArgument('phone') . '
Mail-Adresse:   ' . $this->request->getArgument('mail') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, $attachment, $fileNames, NULL, NULL);
                break;
            case 'isisStartkennwort':
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Anforderung neues I·S·I·S-Passwort';
                $prod = 'nein';
                $dev = 'nein';
                $training = 'nein';
                if (in_array('prod', $this->request->getArgument('sap_system'))) {
                    $prod = 'ja';
                }
                if (in_array('dev', $this->request->getArgument('sap_system'))) {
                    $dev = 'ja';
                }
                if (in_array('training', $this->request->getArgument('sap_system'))) {
                    $training = 'ja';
                }
                $message = '
Mitarbeiterdaten
================

OrgEinheit:               ' . $this->request->getArgument('orgunit') . '
Stadt:                    ' . $this->request->getArgument('city') . '

Name:                     ' . $this->request->getArgument('lastname') . '
Vorname:                  ' . $this->request->getArgument('firstname') . '
Personalnummer:           ' . $this->request->getArgument('persno') . '
I·S·I·S/SAP-Benutzername: ' . $this->request->getArgument('sapUserName') . '
Mail-Adresse:             ' . $this->request->getArgument('mail') . '


Angefragte Systeme
==================

   Produktivsystem:    ' . $prod . '
   Entwicklungssystem: ' . $dev . '
   Schulungssystem:    ' . $training . '			
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('firstname') . ' ' . $this->request->getArgument('lastname'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'preysSupportAnfrage':
                $attachment = array();
                $fileNames = array();
                if ($_FILES['hardcopy']['name'][0] != '') {
                    $basicFileFunctions = t3lib_div::makeInstance('t3lib_basicFileFunctions');
                    foreach ($_FILES['hardcopy']['name'] as $id => $value) {
                        $fileName = $basicFileFunctions->getUniqueName($_FILES['hardcopy']['name'][$id], t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/'));
                        t3lib_div::upload_copy_move($_FILES['hardcopy']['tmp_name'][$id], $fileName);
                        $attachment[] = t3lib_div::getFileAbsFileName('uploads/tx_jhesupportform/') . basename($fileName);
                        $fileNames[] = $fileName;
                    }
                }
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Allgemeine SharePoint/PreSys-Supportanfrage';
                $message = '
Betreff:       ' . $this->request->getArgument('subject') . '

Nachricht:
' . $this->request->getArgument('message') . '

Mitarbeiterdaten
================

Mitarbeiter:   ' . $this->request->getArgument('nameCoworker') . '
OrgEinheit:    ' . $this->request->getArgument('orgunitCoworker') . '     
Mail-Adressse: ' . $this->request->getArgument('mailCoworker') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mailCoworker'), $this->request->getArgument('nameCoworker'), $recipient, NULL, $attachment, $fileNames, NULL, NULL);
                break;
            case 'presysDebitorAktivieren':
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Debitoren in PreSys aktivieren';
                $message = '
Zu aktivierende Debitoren
=========================

' . $this->request->getArgument('debtorList') . '

Mitarbeiterdaten
================

Mitarbeiter:   ' . $this->request->getArgument('nameCoworker') . '
OrgEinheit:    ' . $this->request->getArgument('orgunitCoworker') . '     
Mail-Adressse: ' . $this->request->getArgument('mailCoworker') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mailCoworker'), $this->request->getArgument('nameCoworker'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'presysPasswort':
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Anforderung neues PreSys-Passwort';
                $presys = 'nein';
                $unterweisungen = 'nein';
                if (in_array('PreSys', $this->request->getArgument('presys_system'))) {
                    $presys = 'ja';
                }
                if (in_array('Unterweisungen', $this->request->getArgument('presys_system'))) {
                    $unterweisungen = 'ja';
                }
                $message = '
Mitarbeiterdaten
================

Mitarbeiter:   ' . $this->request->getArgument('nameCoworker') . '
OrgEinheit:    ' . $this->request->getArgument('orgunitCoworker') . '     
Mail-Adressse: ' . $this->request->getArgument('mailCoworker') . '
				
				
Passwörter für folgende Systeme erneuern
========================================

PreSys:         ' . $presys . '
Unterweisungen: ' . $unterweisungen . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mailCoworker'), $this->request->getArgument('nameCoworker'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'presysTestzugang':
                $recipient = '*****@*****.**';
                $subject = 'TeamPoint Onlineformular :: Antrag PreSys-Testzugang';
                $selectedLicences = $this->request->getArgument('licence');
                if (in_array('gb', $selectedLicences)) {
                    $gb = 'ja';
                } else {
                    $gb = '';
                }
                if (in_array('audit', $selectedLicences)) {
                    $audit = 'ja';
                } else {
                    $audit = '';
                }
                if (in_array('pom', $selectedLicences)) {
                    $pom = 'ja';
                } else {
                    $pom = '';
                }
                if (in_array('esv', $selectedLicences)) {
                    $esv = 'ja';
                } else {
                    $esv = '';
                }
                if (in_array('elearning', $selectedLicences)) {
                    $elearning = 'ja';
                } else {
                    $elearning = '';
                }
                if (in_array('sharepoint', $selectedLicences)) {
                    $sharepoint = 'ja';
                } else {
                    $sharepoint = '';
                }
                $message = '
Mitarbeiterdaten
================

Mitarbeiter:   ' . $this->request->getArgument('nameCoworker') . '
OrgEinheit:    ' . $this->request->getArgument('orgunitCoworker') . '     
Mail-Adressse: ' . $this->request->getArgument('mailCoworker') . '

Interessent
===========

Vorname:       ' . $this->request->getArgument('firstnameInterestedPerson') . '
Nachname:      ' . $this->request->getArgument('lastnameInterestedPerson') . '
Mail-Adresse:  ' . $this->request->getArgument('mailInterestedPerson') . '

Gewünschte Lizenzen:
====================

   GB:                               ' . $gb . '
   Audit:                            ' . $audit . '
   POM:                              ' . $pom . '
   Nachschlagewerke:                 ' . $esv . '                                      
   E-Learning:                       ' . $elearning . '                          
   Dokumentenmanagement-SharePoint:  ' . $sharepoint . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mailCoworker'), $this->request->getArgument('nameCoworker'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'teampointSupportAnfrage':
                $recipient = '*****@*****.**';
                $subject = 'Neue Anfrage vom TeamPoint-Support-Formular';
                $message = '
Mitarbeiter:   ' . $this->request->getArgument('name') . '
Mail-Adressse: ' . $this->request->getArgument('mail') . '
Telefonnummer: ' . $this->request->getArgument('phone') . '

Betreff:       ' . $this->request->getArgument('subject') . '

Nachricht:
' . $this->request->getArgument('message') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            case 'itVpnZugang':
                $recipient = '*****@*****.**';
                $subject = 'TPO :: Beantragung BAD VPN-Zugang';
                $message = '
Gewünschter VPN-Token
=====================

Art des Tokens:          ' . $this->request->getArgument('token') . '


Mitarbeiterdaten
================

Titel:          ' . $this->request->getArgument('title') . '
Name:           ' . $this->request->getArgument('name') . '
Personalnummer: ' . $this->request->getArgument('persno') . '
OrgEinheit:     ' . $this->request->getArgument('orgunit') . '
Telefon:        ' . $this->request->getArgument('phone') . '
Mail-Adresse:   ' . $this->request->getArgument('mail') . '
				';
                $status = $this->sendMailsToRecipients($subject, $message, $this->request->getArgument('mail'), $this->request->getArgument('name'), $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
            default:
                $recipient = '*****@*****.**';
                $subject = 'Fehler mit dem Online-Supportformular';
                $message = '
Es ist ein allgemeines Problem mit dem Online-Supportformular aufgetreten.

Bitte überprüfen!';
                $status = $this->sendMailsToRecipients($subject, $message, '*****@*****.**', 'B·A·D TeamPoint Web-Server', $recipient, NULL, NULL, NULL, NULL, NULL);
                break;
        }
        $this->view->assign('status', $status);
        if ($status == FALSE) {
            $errorMessage = '<p>Ihre Daten konnten aus technischen Gründen nicht an den entsprechenden Adressaten versendet werden.</p><p>Bitte wenden Sie sich an <a href="mailto:technik@teampoint.info">technik@teampoint.info</a>.</p>';
            $this->view->assign('error', $errorMessage);
        }
    }
 /**
  *
  * Enter description here ...
  * @param unknown_type $agency
  */
 private function handleFiles(&$agency)
 {
     $ok = true;
     $namespace = $this->getNamespace();
     if (is_array($_FILES[$namespace])) {
         $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
         $all_files = array();
         $all_files['webspace']['allow'] = '*';
         $all_files['webspace']['deny'] = '';
         $fileFunc->init('', $all_files);
         $formName = array_shift(array_keys($_FILES[$namespace]['error']));
         foreach ($_FILES[$namespace]['error'][$formName] as $key => $error) {
             if ($error == 0) {
                 if ($key == 'logo') {
                     if (strpos($_FILES[$namespace]['type'][$formName][$key], 'image/png') === 0 || strpos($_FILES[$namespace]['type'][$formName][$key], 'image/jpg') === 0) {
                         if ($_FILES[$namespace]['size'][$formName][$key] < 5 * 1024 * 1024) {
                             $theFile = $_FILES[$namespace]['tmp_name'][$formName][$key];
                             $theDestFile = $fileFunc->getUniqueName($fileFunc->cleanFileName($_FILES[$namespace]['name'][$formName][$key]), $this->settings['uploadPath']);
                             t3lib_div::upload_copy_move($theFile, $theDestFile);
                             $agency->setLogo(basename($theDestFile));
                         } else {
                             $ok = false;
                             $this->flashMessages->add(str_replace('%FILE%', $_FILES[$namespace]['name'][$formName][$key], $this->localization->translate('wrongFileSize', $this->extensionName)), '', t3lib_message_AbstractMessage::ERROR);
                         }
                     } else {
                         $ok = false;
                         $this->flashMessages->add(str_replace('%FILE%', $_FILES[$namespace]['name'][$formName][$key], $this->localization->translate('wrongFileType', $this->extensionName)), '', t3lib_message_AbstractMessage::ERROR);
                     }
                 }
             }
         }
     }
     return $ok;
 }
 function setImageForCType($CType, $fileTemp, $fileName, $LLFile, $fileNameOutput, $imageWidth)
 {
     require_once PATH_t3lib . 'class.t3lib_stdgraphic.php';
     $graphicsStd = t3lib_div::makeInstance('t3lib_stdGraphic');
     $uploadDirname = str_replace('EXT:', '', dirname($LLFile));
     $source = $fileTemp;
     $destinationUploaded = PATH_site . 'typo3temp/' . $fileName;
     t3lib_div::upload_copy_move($source, $destinationUploaded);
     $destination = t3lib_extMgm::extPath($uploadDirname) . str_replace($uploadDirname . '_', '', $CType) . '/' . $fileNameOutput . '.png';
     $graphicsStd->init();
     $graphicsStd->tempPath = PATH_site . 'typo3temp/';
     $viewArray = $graphicsStd->imageMagickConvert($destinationUploaded, 'png', $imageWidth);
     rename($viewArray[3], $destination);
 }