function tx_open_printlink($content, $conf)
{
    $GLOBALS['TT']->push('open_printlink');
    $conf['type'] = $conf['type'] ? $conf['type'] : 98;
    $params = add_vars($GLOBALS['HTTP_GET_VARS']);
    if ($conf['include_post_vars']) {
        $params .= add_vars($GLOBALS['HTTP_POST_VARS']);
    }
    $templ = new t3lib_TStemplate();
    $LD = $templ->linkData($GLOBALS['TSFE']->page, '' . '', '', '', '', $params, $conf['type']);
    $uri = $LD[totalURL];
    $GLOBALS['TT']->setTSLogMessage('link to URI: ' . $uri, 0);
    $target = $conf['target'] ? ' target="' . $conf['target'] . '"' : '';
    $atags = $conf['aTagParams'] ? ' ' . $conf['aTagParams'] . ' ' : '';
    $js = $conf['noBlur'] ? '' : ' onfocus="blurLink(this);"';
    if ($conf['popup']) {
        $conf['windowname'] = $conf['windowname'] ? $conf['windowname'] : 'print';
        $conf['windowparams'] = $conf['windowparams'] ? $conf['windowparams'] : 'resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,width=500,height=500';
        $js .= ' onclick="window.open(\'' . $uri . '\',\'' . $conf['windowname'] . '\',\'' . $conf['windowparams'] . '\');"';
        $target = '';
        $uri = '#';
    }
    $GLOBALS['TT']->pull();
    return '<a href="' . $uri . '" ' . $js . $target . $atags . '>' . $content;
}
 /**
  * @test
  */
 public function getImgResourceHookGetsCalled()
 {
     $this->template->expects($this->atLeastOnce())->method('getFileName')->with('typo3/clear.gif')->will($this->returnValue('typo3/clear.gif'));
     $className = uniqid('tx_coretest');
     $getImgResourceHookMock = $this->getMock('tslib_cObj_getImgResourceHook', array('getImgResourcePostProcess'), array(), $className);
     $getImgResourceHookMock->expects($this->once())->method('getImgResourcePostProcess')->will($this->returnCallback(array($this, 'isGetImgResourceHookCalledCallback')));
     $this->cObj->getImgResourceHookObjects = array($getImgResourceHookMock);
     $this->cObj->IMAGE($this->typoScriptImage);
 }
 /**
  * Generates a frameset based on input configuration in a TypoScript array.
  *
  * @param	array		The TypoScript properties of the PAGE object property "frameSet.". See link.
  * @return	string		A <frameset> tag.
  * @see TSpagegen::renderContentWithHeader()
  */
 function make($setup)
 {
     $content = '';
     if (is_array($setup)) {
         $sKeyArray = t3lib_TStemplate::sortedKeyList($setup);
         foreach ($sKeyArray as $theKey) {
             $theValue = $setup[$theKey];
             if (intval($theKey) && ($conf = $setup[$theKey . '.'])) {
                 switch ($theValue) {
                     case 'FRAME':
                         $typeNum = intval($GLOBALS['TSFE']->tmpl->setup[$conf['obj'] . '.']['typeNum']);
                         if (!$conf['src'] && !$typeNum) {
                             $typeNum = -1;
                         }
                         $content .= '<frame' . $this->frameParams($conf, $typeNum) . ' />' . LF;
                         break;
                     case 'FRAMESET':
                         $frameset = t3lib_div::makeInstance('tslib_frameset');
                         $content .= $frameset->make($conf) . LF;
                         break;
                 }
             }
         }
         return '<frameset' . $this->framesetParams($setup) . '>' . LF . $content . '</frameset>';
     }
 }
 /**
  * Splitting a string for ImageTTFBBox up into an array where each part has its own configuration options.
  *
  * @param	string		UTF-8 string
  * @param	array		Split-rendering configuration from GIFBUILDER TEXT object.
  * @param	integer		Current fontsize
  * @param	string		Current font file
  * @return	array		Array with input string splitted according to configuration
  */
 function splitString($string, $splitRendering, $fontSize, $fontFile)
 {
     // Initialize by setting the whole string and default configuration as the first entry.
     $result = array();
     $result[] = array('str' => $string, 'fontSize' => $fontSize, 'fontFile' => $fontFile);
     // Traverse the split-rendering configuration:
     // Splitting will create more entries in $result with individual configurations.
     if (is_array($splitRendering)) {
         $sKeyArray = t3lib_TStemplate::sortedKeyList($splitRendering);
         // Traverse configured options:
         foreach ($sKeyArray as $key) {
             $cfg = $splitRendering[$key . '.'];
             // Process each type of split rendering keyword:
             switch ((string) $splitRendering[$key]) {
                 case 'highlightWord':
                     if (strlen($cfg['value'])) {
                         $newResult = array();
                         // Traverse the current parts of the result array:
                         foreach ($result as $part) {
                             // Explode the string value by the word value to highlight:
                             $explodedParts = explode($cfg['value'], $part['str']);
                             foreach ($explodedParts as $c => $expValue) {
                                 if (strlen($expValue)) {
                                     $newResult[] = array_merge($part, array('str' => $expValue));
                                 }
                                 if ($c + 1 < count($explodedParts)) {
                                     $newResult[] = array('str' => $cfg['value'], 'fontSize' => $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'], 'fontFile' => $cfg['fontFile'] ? $cfg['fontFile'] : $part['fontFile'], 'color' => $cfg['color'], 'xSpaceBefore' => $cfg['xSpaceBefore'], 'xSpaceAfter' => $cfg['xSpaceAfter'], 'ySpaceBefore' => $cfg['ySpaceBefore'], 'ySpaceAfter' => $cfg['ySpaceAfter']);
                                 }
                             }
                         }
                         // Set the new result as result array:
                         if (count($newResult)) {
                             $result = $newResult;
                         }
                     }
                     break;
                 case 'charRange':
                     if (strlen($cfg['value'])) {
                         // Initialize range:
                         $ranges = t3lib_div::trimExplode(',', $cfg['value'], 1);
                         foreach ($ranges as $i => $rangeDef) {
                             $ranges[$i] = t3lib_div::intExplode('-', $ranges[$i]);
                             if (!isset($ranges[$i][1])) {
                                 $ranges[$i][1] = $ranges[$i][0];
                             }
                         }
                         $newResult = array();
                         // Traverse the current parts of the result array:
                         foreach ($result as $part) {
                             // Initialize:
                             $currentState = -1;
                             $bankAccum = '';
                             // Explode the string value by the word value to highlight:
                             $utf8Chars = $this->singleChars($part['str']);
                             foreach ($utf8Chars as $utfChar) {
                                 // Find number and evaluate position:
                                 $uNumber = $this->csConvObj->utf8CharToUnumber($utfChar);
                                 $inRange = 0;
                                 foreach ($ranges as $rangeDef) {
                                     if ($uNumber >= $rangeDef[0] && (!$rangeDef[1] || $uNumber <= $rangeDef[1])) {
                                         $inRange = 1;
                                         break;
                                     }
                                 }
                                 if ($currentState == -1) {
                                     $currentState = $inRange;
                                 }
                                 // Initialize first char
                                 // Switch bank:
                                 if ($inRange != $currentState && !t3lib_div::inList('32,10,13,9', $uNumber)) {
                                     // Set result:
                                     if (strlen($bankAccum)) {
                                         $newResult[] = array('str' => $bankAccum, 'fontSize' => $currentState && $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'], 'fontFile' => $currentState && $cfg['fontFile'] ? $cfg['fontFile'] : $part['fontFile'], 'color' => $currentState ? $cfg['color'] : '', 'xSpaceBefore' => $currentState ? $cfg['xSpaceBefore'] : '', 'xSpaceAfter' => $currentState ? $cfg['xSpaceAfter'] : '', 'ySpaceBefore' => $currentState ? $cfg['ySpaceBefore'] : '', 'ySpaceAfter' => $currentState ? $cfg['ySpaceAfter'] : '');
                                     }
                                     // Initialize new settings:
                                     $currentState = $inRange;
                                     $bankAccum = '';
                                 }
                                 // Add char to bank:
                                 $bankAccum .= $utfChar;
                             }
                             // Set result for FINAL part:
                             if (strlen($bankAccum)) {
                                 $newResult[] = array('str' => $bankAccum, 'fontSize' => $currentState && $cfg['fontSize'] ? $cfg['fontSize'] : $part['fontSize'], 'fontFile' => $currentState && $cfg['fontFile'] ? $cfg['fontFile'] : $part['fontFile'], 'color' => $currentState ? $cfg['color'] : '', 'xSpaceBefore' => $currentState ? $cfg['xSpaceBefore'] : '', 'xSpaceAfter' => $currentState ? $cfg['xSpaceAfter'] : '', 'ySpaceBefore' => $currentState ? $cfg['ySpaceBefore'] : '', 'ySpaceAfter' => $currentState ? $cfg['ySpaceAfter'] : '');
                             }
                         }
                         // Set the new result as result array:
                         if (count($newResult)) {
                             $result = $newResult;
                         }
                     }
                     break;
             }
         }
     }
     return $result;
 }
 /**
  * Will traverse input array with configuratoin per-item and create corresponding GIF files for the menu.
  * The data of the files are stored in $this->result
  *
  * @param	array		Array with configuration for each item.
  * @return	void
  * @access private
  * @see generate()
  */
 function makeImageMap($conf)
 {
     if (!is_array($conf)) {
         $conf = array();
     }
     if (is_array($this->mconf['main.'])) {
         $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
         $gifCreator->init();
         $itemsConf = $conf;
         $conf = $this->mconf['main.'];
         if (is_array($conf)) {
             $gifObjCount = 0;
             $sKeyArray = t3lib_TStemplate::sortedKeyList($conf);
             $gifObjCount = intval(end($sKeyArray));
             $lastOriginal = $gifObjCount;
             // Now we add graphical objects to the gifbuilder-setup
             $waArr = array();
             foreach ($itemsConf as $key => $val) {
                 if (is_array($val)) {
                     $gifObjCount++;
                     $waArr[$key]['free'] = $gifObjCount;
                     $sKeyArray = t3lib_TStemplate::sortedKeyList($val);
                     foreach ($sKeyArray as $theKey) {
                         $theValue = $val[$theKey];
                         if (intval($theKey) && ($theValArr = $val[$theKey . '.'])) {
                             $cObjData = $this->menuArr[$key] ? $this->menuArr[$key] : array();
                             $gifObjCount++;
                             if ($theValue == 'TEXT') {
                                 $waArr[$key]['textNum'] = $gifObjCount;
                                 $gifCreator->data = $cObjData;
                                 $theValArr = $gifCreator->checkTextObj($theValArr);
                                 unset($theValArr['text.']);
                                 // if this is not done it seems that imageMaps will be rendered wrong!!
                                 // check links
                                 $LD = $this->menuTypoLink($this->menuArr[$key], $this->mconf['target'], '', '', array(), '', $this->mconf['forceTypeValue']);
                                 // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
                                 $this->changeLinksForAccessRestrictedPages($LD, $this->menuArr[$key], $this->mconf['target'], $this->mconf['forceTypeValue']);
                                 // Overriding URL / Target if set to do so:
                                 if ($this->menuArr[$key]['_OVERRIDE_HREF']) {
                                     $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF'];
                                     if ($this->menuArr[$key]['_OVERRIDE_TARGET']) {
                                         $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
                                     }
                                 }
                                 // Setting target/url for Image Map:
                                 if ($theValArr['imgMap.']['url'] == '') {
                                     $theValArr['imgMap.']['url'] = $LD['totalURL'];
                                 }
                                 if ($theValArr['imgMap.']['target'] == '') {
                                     $theValArr['imgMap.']['target'] = $LD['target'];
                                 }
                                 if ($theValArr['imgMap.']['noBlur'] == '') {
                                     $theValArr['imgMap.']['noBlur'] = $this->mconf['noBlur'];
                                 }
                                 if (is_array($theValArr['imgMap.']['altText.'])) {
                                     $cObj = t3lib_div::makeInstance('tslib_cObj');
                                     $cObj->start($cObjData, 'pages');
                                     $theValArr['imgMap.']['altText'] = $cObj->stdWrap($theValArr['imgMap.']['altText'], $theValArr['imgMap.']['altText.']);
                                     unset($theValArr['imgMap.']['altText.']);
                                 }
                                 if (is_array($theValArr['imgMap.']['titleText.'])) {
                                     $cObj = t3lib_div::makeInstance('tslib_cObj');
                                     $cObj->start($cObjData, 'pages');
                                     $theValArr['imgMap.']['titleText'] = $cObj->stdWrap($theValArr['imgMap.']['titleText'], $theValArr['imgMap.']['titleText.']);
                                     unset($theValArr['imgMap.']['titleText.']);
                                 }
                             }
                             // This code goes one level in if the object is an image. If 'file' and/or 'mask' appears to be GIFBUILDER-objects, they are both searched for TEXT objects, and if a textobj is found, it's checked with the currently loaded record!!
                             if ($theValue == 'IMAGE') {
                                 if ($theValArr['file'] == 'GIFBUILDER') {
                                     $temp_sKeyArray = t3lib_TStemplate::sortedKeyList($theValArr['file.']);
                                     foreach ($temp_sKeyArray as $temp_theKey) {
                                         if ($theValArr['mask.'][$temp_theKey] == 'TEXT') {
                                             $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : array();
                                             $theValArr['mask.'][$temp_theKey . '.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey . '.']);
                                             unset($theValArr['mask.'][$temp_theKey . '.']['text.']);
                                             // if this is not done it seems that imageMaps will be rendered wrong!!
                                         }
                                     }
                                 }
                                 if ($theValArr['mask'] == 'GIFBUILDER') {
                                     $temp_sKeyArray = t3lib_TStemplate::sortedKeyList($theValArr['mask.']);
                                     foreach ($temp_sKeyArray as $temp_theKey) {
                                         if ($theValArr['mask.'][$temp_theKey] == 'TEXT') {
                                             $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : array();
                                             $theValArr['mask.'][$temp_theKey . '.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey . '.']);
                                             unset($theValArr['mask.'][$temp_theKey . '.']['text.']);
                                             // if this is not done it seems that imageMaps will be rendered wrong!!
                                         }
                                     }
                                 }
                             }
                             // Checks if disabled is set...
                             $setObjFlag = 1;
                             if ($theValArr['if.']) {
                                 $cObj = t3lib_div::makeInstance('tslib_cObj');
                                 $cObj->start($cObjData, 'pages');
                                 if (!$cObj->checkIf($theValArr['if.'])) {
                                     $setObjFlag = 0;
                                 }
                                 unset($theValArr['if.']);
                             }
                             // Set the object!
                             if ($setObjFlag) {
                                 $conf[$gifObjCount] = $theValue;
                                 $conf[$gifObjCount . '.'] = $theValArr;
                             }
                         }
                     }
                 }
             }
             $gifCreator->start($conf, $GLOBALS['TSFE']->page);
             // calculations
             $sum = array(0, 0, 0, 0);
             foreach ($waArr as $key => $val) {
                 if ($dConf[$key] = $itemsConf[$key]['distrib']) {
                     $textBB = $gifCreator->objBB[$val['textNum']];
                     $dConf[$key] = str_replace('textX', $textBB[0], $dConf[$key]);
                     $dConf[$key] = str_replace('textY', $textBB[1], $dConf[$key]);
                     $dConf[$key] = t3lib_div::intExplode(',', $gifCreator->calcOffset($dConf[$key]));
                 }
             }
             $workArea = t3lib_div::intExplode(',', $gifCreator->calcOffset($this->mconf['dWorkArea']));
             foreach ($waArr as $key => $val) {
                 $index = $val['free'];
                 $gifCreator->setup[$index] = 'WORKAREA';
                 $workArea[2] = $dConf[$key][2] ? $dConf[$key][2] : $dConf[$key][0];
                 $workArea[3] = $dConf[$key][3] ? $dConf[$key][3] : $dConf[$key][1];
                 $gifCreator->setup[$index . '.']['set'] = implode(',', $workArea);
                 $workArea[0] += $dConf[$key][0];
                 $workArea[1] += $dConf[$key][1];
             }
             if ($this->mconf['debugRenumberedObject']) {
                 echo '<h3>Renumbered GIFBUILDER object:</h3>';
                 debug($gifCreator->setup);
             }
             $gifCreator->createTempSubDir('menu/');
             $gifFileName = $gifCreator->fileName('menu/');
             // Gets the ImageMap from the cache...
             $imgHash = md5($gifFileName);
             $imgMap = $this->sys_page->getHash($imgHash);
             if ($imgMap && file_exists($gifFileName)) {
                 // File exists
                 $info = @getimagesize($gifFileName);
                 $w = $info[0];
                 $h = $info[1];
             } else {
                 // file is generated
                 $gifCreator->make();
                 $w = $gifCreator->w;
                 $h = $gifCreator->h;
                 $gifCreator->output($gifFileName);
                 $gifCreator->destroy();
                 $imgMap = $gifCreator->map;
                 $this->sys_page->storeHash($imgHash, $imgMap, 'MENUIMAGEMAP');
             }
             $imgMap .= $this->mconf['imgMapExtras'];
             $gifFileName = t3lib_div::png_to_gif_by_imagemagick($gifFileName);
             $this->result = array('output_file' => $gifFileName, 'output_w' => $w, 'output_h' => $h, 'imgMap' => $imgMap);
         }
     }
 }
 /**
  * Determines to include custom or pagegen.php script
  * returns script-filename if a TypoScript (config) script is defined and should be include instead of pagegen.php
  *
  * @return	string		The relative filepath of "config.pageGenScript" if found and allowed
  */
 function generatePage_whichScript()
 {
     if (!$this->TYPO3_CONF_VARS['FE']['noPHPscriptInclude'] && $this->config['config']['pageGenScript']) {
         return $this->tmpl->getFileName($this->config['config']['pageGenScript']);
     }
 }
 /**
  * Hook for creating a speaking URL when using the generic linkData function
  *
  * @param	array				holds all the information about the link that is about to be created
  * @param	t3lib_TStemplate	is a reference to the parent object that calls the hook
  * @return	void
  */
 public function hookLinkDataPostProc(array &$parameters, t3lib_TStemplate &$parentObject)
 {
     if (!$this->enabled) {
         return;
     }
     $LD =& $parameters['LD'];
     $page =& $parameters['args']['page'];
     $LD['type'] = '';
     // MD5/base64 method limitation
     $remainLinkVars = '';
     $flag_pEncoding = t3lib_div::inList('md5,base64', $this->conf['pEncoding']) && !$LD['no_cache'];
     if ($flag_pEncoding) {
         list($LD['linkVars'], $remainLinkVars) = $this->processEncodedQueryString($LD['linkVars']);
     }
     $url = $this->makeSimulatedFileName($page['title'], $page['alias'] ? $page['alias'] : $page['uid'], intval($parameters['typeNum']), $LD['linkVars'], $LD['no_cache'] ? true : false);
     if ($this->conf['mode'] == 'PATH_INFO') {
         $url = 'index.php/' . str_replace('.', '/', $url) . '/';
     } else {
         $url .= '.html';
     }
     $LD['url'] = $GLOBALS['TSFE']->absRefPrefix . $url . '?';
     if ($flag_pEncoding) {
         $LD['linkVars'] = $remainLinkVars;
     }
     // If the special key 'sectionIndex_uid' (added 'manually' in tslib/menu.php to the page-record) is set,
     // then the link jumps directly to a section on the page.
     $LD['sectionIndex'] = $page['sectionIndex_uid'] ? '#c' . $page['sectionIndex_uid'] : '';
     // Compile the normal total url
     $LD['totalURL'] = $parentObject->removeQueryString($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $GLOBALS['TSFE']->getMethodUrlIdToken) . $LD['sectionIndex'];
 }
 /**
  * Rendering the cObject, FORM
  *
  * Note on $formData:
  * In the optional $formData array each entry represents a line in the ordinary setup.
  * In those entries each entry (0,1,2...) represents a space normally divided by the '|' line.
  *
  * $formData [] = array('Name:', 'name=input, 25 ', 'Default value....');
  * $formData [] = array('Email:', 'email=input, 25 ', 'Default value for email....');
  *
  * - corresponds to the $conf['data'] value being :
  * Name:|name=input, 25 |Default value....||Email:|email=input, 25 |Default value for email....
  *
  * If $formData is an array the value of $conf['data'] is ignored.
  *
  * @param	array		Array of TypoScript properties
  * @param	array		Alternative formdata overriding whatever comes from TypoScript
  * @return	string		Output
  */
 public function render($conf = array(), $formData = '')
 {
     $content = '';
     if (is_array($formData)) {
         $dataArray = $formData;
     } else {
         $data = isset($conf['data.']) ? $this->cObj->stdWrap($conf['data'], $conf['data.']) : $conf['data'];
         // Clearing dataArr
         $dataArray = array();
         // Getting the original config
         if (trim($data)) {
             $data = str_replace(LF, '||', $data);
             $dataArray = explode('||', $data);
         }
         // Adding the new dataArray config form:
         if (is_array($conf['dataArray.'])) {
             // dataArray is supplied
             $sortedKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
             foreach ($sortedKeyArray as $theKey) {
                 $singleKeyArray = $conf['dataArray.'][$theKey . '.'];
                 if (is_array($singleKeyArray)) {
                     $temp = array();
                     $label = isset($singleKeyArray['label.']) ? $this->cObj->stdWrap($singleKeyArray['label'], $singleKeyArray['label.']) : $singleKeyArray['label'];
                     list($temp[0]) = explode('|', $label);
                     $type = isset($singleKeyArray['type.']) ? $this->cObj->stdWrap($singleKeyArray['type'], $singleKeyArray['type.']) : $singleKeyArray['type'];
                     list($temp[1]) = explode('|', $type);
                     $required = isset($singleKeyArray['required.']) ? $this->cObj->stdWrap($singleKeyArray['required'], $singleKeyArray['required.']) : $singleKeyArray['required'];
                     if ($required) {
                         $temp[1] = '*' . $temp[1];
                     }
                     $singleValue = isset($singleKeyArray['value.']) ? $this->cObj->stdWrap($singleKeyArray['value'], $singleKeyArray['value.']) : $singleKeyArray['value'];
                     list($temp[2]) = explode('|', $singleValue);
                     // If value array is set, then implode those values.
                     if (is_array($singleKeyArray['valueArray.'])) {
                         $temp_accumulated = array();
                         foreach ($singleKeyArray['valueArray.'] as $singleKey => $singleKey_valueArray) {
                             if (is_array($singleKey_valueArray) && !strcmp(intval($singleKey) . '.', $singleKey)) {
                                 $temp_valueArray = array();
                                 $valueArrayLabel = isset($singleKey_valueArray['label.']) ? $this->cObj->stdWrap($singleKey_valueArray['label'], $singleKey_valueArray['label.']) : $singleKey_valueArray['label'];
                                 list($temp_valueArray[0]) = explode('=', $valueArrayLabel);
                                 $selected = isset($singleKeyArray['selected.']) ? $this->cObj->stdWrap($singleKeyArray['selected'], $singleKeyArray['selected.']) : $singleKeyArray['selected'];
                                 if ($selected) {
                                     $temp_valueArray[0] = '*' . $temp_valueArray[0];
                                 }
                                 $singleKeyValue = isset($singleKey_valueArray['value.']) ? $this->cObj->stdWrap($singleKey_valueArray['value'], $singleKey_valueArray['value.']) : $singleKey_valueArray['value'];
                                 list($temp_valueArray[1]) = explode(',', $singleKeyValue);
                             }
                             $temp_accumulated[] = implode('=', $temp_valueArray);
                         }
                         $temp[2] = implode(',', $temp_accumulated);
                     }
                     $specialEval = isset($singleKeyArray['specialEval.']) ? $this->cObj->stdWrap($singleKeyArray['specialEval'], $singleKeyArray['specialEval.']) : $singleKeyArray['specialEval'];
                     list($temp[3]) = explode('|', $specialEval);
                     // adding the form entry to the dataArray
                     $dataArray[] = implode('|', $temp);
                 }
             }
         }
     }
     $attachmentCounter = '';
     $hiddenfields = '';
     $fieldlist = array();
     $propertyOverride = array();
     $fieldname_hashArray = array();
     $counter = 0;
     $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype);
     // Formname
     $formName = isset($conf['formName.']) ? $this->cObj->stdWrap($conf['formName'], $conf['formName.']) : $conf['formName'];
     if ($formName) {
         $formName = $this->cObj->cleanFormName($formName);
     } else {
         $formName = 'a' . $GLOBALS['TSFE']->uniqueHash();
         // form name has to start with a letter to reach XHTML compliance
     }
     $fieldPrefix = isset($conf['fieldPrefix.']) ? $this->cObj->stdWrap($conf['fieldPrefix'], $conf['fieldPrefix.']) : $conf['fieldPrefix'];
     if (isset($conf['fieldPrefix']) || isset($conf['fieldPrefix.'])) {
         if ($fieldPrefix) {
             $prefix = $this->cObj->cleanFormName($fieldPrefix);
         } else {
             $prefix = '';
         }
     } else {
         $prefix = $formName;
     }
     foreach ($dataArray as $dataValue) {
         $counter++;
         $confData = array();
         if (is_array($formData)) {
             $parts = $dataValue;
             $dataValue = 1;
             // TRUE...
         } else {
             $dataValue = trim($dataValue);
             $parts = explode('|', $dataValue);
         }
         if ($dataValue && strcspn($dataValue, '#/')) {
             // label:
             $confData['label'] = t3lib_div::removeXSS(trim($parts[0]));
             // field:
             $fParts = explode(',', $parts[1]);
             $fParts[0] = trim($fParts[0]);
             if (substr($fParts[0], 0, 1) == '*') {
                 $confData['required'] = 1;
                 $fParts[0] = substr($fParts[0], 1);
             }
             $typeParts = explode('=', $fParts[0]);
             $confData['type'] = trim(strtolower(end($typeParts)));
             if (count($typeParts) == 1) {
                 $confData['fieldname'] = $this->cObj->cleanFormName($parts[0]);
                 if (strtolower(preg_replace('/[^[:alnum:]]/', '', $confData['fieldname'])) == 'email') {
                     $confData['fieldname'] = 'email';
                 }
                 // Duplicate fieldnames resolved
                 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
                     $confData['fieldname'] .= '_' . $counter;
                 }
                 $fieldname_hashArray[md5($confData['fieldname'])] = $confData['fieldname'];
                 // Attachment names...
                 if ($confData['type'] == 'file') {
                     $confData['fieldname'] = 'attachment' . $attachmentCounter;
                     $attachmentCounter = intval($attachmentCounter) + 1;
                 }
             } else {
                 $confData['fieldname'] = str_replace(' ', '_', trim($typeParts[0]));
             }
             $confData['fieldname'] = htmlspecialchars($confData['fieldname']);
             $fieldCode = '';
             $wrapFieldName = isset($conf['wrapFieldName']) ? $this->cObj->stdWrap($conf['wrapFieldName'], $conf['wrapFieldName.']) : $conf['wrapFieldName'];
             if ($wrapFieldName) {
                 $confData['fieldname'] = $this->cObj->wrap($confData['fieldname'], $wrapFieldName);
             }
             // Set field name as current:
             $this->cObj->setCurrentVal($confData['fieldname']);
             // Additional parameters
             if (trim($confData['type'])) {
                 if (isset($conf['params.'][$confData['type']])) {
                     $addParams = isset($conf['params.'][$confData['type'] . '.']) ? trim($this->cObj->stdWrap($conf['params.'][$confData['type']], $conf['params.'][$confData['type'] . '.'])) : trim($conf['params.'][$confData['type']]);
                 } else {
                     $addParams = isset($conf['params.']) ? trim($this->cObj->stdWrap($conf['params'], $conf['params.'])) : trim($conf['params']);
                 }
                 if (strcmp('', $addParams)) {
                     $addParams = ' ' . $addParams;
                 }
             } else {
                 $addParams = '';
             }
             $dontMd5FieldNames = isset($conf['dontMd5FieldNames.']) ? $this->cObj->stdWrap($conf['dontMd5FieldNames'], $conf['dontMd5FieldNames.']) : $conf['dontMd5FieldNames'];
             if ($dontMd5FieldNames) {
                 $fName = $confData['fieldname'];
             } else {
                 $fName = md5($confData['fieldname']);
             }
             // Accessibility: Set id = fieldname attribute:
             $accessibility = isset($conf['accessibility.']) ? $this->cObj->stdWrap($conf['accessibility'], $conf['accessibility.']) : $conf['accessibility'];
             if ($accessibility || $xhtmlStrict) {
                 $elementIdAttribute = ' id="' . $prefix . $fName . '"';
             } else {
                 $elementIdAttribute = '';
             }
             // Create form field based on configuration/type:
             switch ($confData['type']) {
                 case 'textarea':
                     $cols = trim($fParts[1]) ? intval($fParts[1]) : 20;
                     $compensateFieldWidth = isset($conf['compensateFieldWidth.']) ? $this->cObj->stdWrap($conf['compensateFieldWidth'], $conf['compensateFieldWidth.']) : $conf['compensateFieldWidth'];
                     $compWidth = doubleval($compensateFieldWidth ? $compensateFieldWidth : $GLOBALS['TSFE']->compensateFieldWidth);
                     $compWidth = $compWidth ? $compWidth : 1;
                     $cols = t3lib_div::intInRange($cols * $compWidth, 1, 120);
                     $rows = trim($fParts[2]) ? t3lib_div::intInRange($fParts[2], 1, 30) : 5;
                     $wrap = trim($fParts[3]);
                     $noWrapAttr = isset($conf['noWrapAttr.']) ? $this->cObj->stdWrap($conf['noWrapAttr'], $conf['noWrapAttr.']) : $conf['noWrapAttr'];
                     if ($noWrapAttr || $wrap === 'disabled') {
                         $wrap = '';
                     } else {
                         $wrap = $wrap ? ' wrap="' . $wrap . '"' : ' wrap="virtual"';
                     }
                     $noValueInsert = isset($conf['noValueInsert.']) ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.']) : $conf['noValueInsert'];
                     $default = $this->cObj->getFieldDefaultValue($noValueInsert, $confData['fieldname'], str_replace('\\n', LF, trim($parts[2])));
                     $fieldCode = sprintf('<textarea name="%s"%s cols="%s" rows="%s"%s%s>%s</textarea>', $confData['fieldname'], $elementIdAttribute, $cols, $rows, $wrap, $addParams, t3lib_div::formatForTextarea($default));
                     break;
                 case 'input':
                 case 'password':
                     $size = trim($fParts[1]) ? intval($fParts[1]) : 20;
                     $compensateFieldWidth = isset($conf['compensateFieldWidth.']) ? $this->cObj->stdWrap($conf['compensateFieldWidth'], $conf['compensateFieldWidth.']) : $conf['compensateFieldWidth'];
                     $compWidth = doubleval($compensateFieldWidth ? $compensateFieldWidth : $GLOBALS['TSFE']->compensateFieldWidth);
                     $compWidth = $compWidth ? $compWidth : 1;
                     $size = t3lib_div::intInRange($size * $compWidth, 1, 120);
                     $noValueInsert = isset($conf['noValueInsert.']) ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.']) : $conf['noValueInsert'];
                     $default = $this->cObj->getFieldDefaultValue($noValueInsert, $confData['fieldname'], trim($parts[2]));
                     if ($confData['type'] == 'password') {
                         $default = '';
                     }
                     $max = trim($fParts[2]) ? ' maxlength="' . t3lib_div::intInRange($fParts[2], 1, 1000) . '"' : "";
                     $theType = $confData['type'] == 'input' ? 'text' : 'password';
                     $fieldCode = sprintf('<input type="%s" name="%s"%s size="%s"%s value="%s"%s />', $theType, $confData['fieldname'], $elementIdAttribute, $size, $max, htmlspecialchars($default), $addParams);
                     break;
                 case 'file':
                     $size = trim($fParts[1]) ? t3lib_div::intInRange($fParts[1], 1, 60) : 20;
                     $fieldCode = sprintf('<input type="file" name="%s"%s size="%s"%s />', $confData['fieldname'], $elementIdAttribute, $size, $addParams);
                     break;
                 case 'check':
                     // alternative default value:
                     $noValueInsert = isset($conf['noValueInsert.']) ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.']) : $conf['noValueInsert'];
                     $default = $this->cObj->getFieldDefaultValue($noValueInsert, $confData['fieldname'], trim($parts[2]));
                     $checked = $default ? ' checked="checked"' : '';
                     $fieldCode = sprintf('<input type="checkbox" value="%s" name="%s"%s%s%s />', 1, $confData['fieldname'], $elementIdAttribute, $checked, $addParams);
                     break;
                 case 'select':
                     $option = '';
                     $valueParts = explode(',', $parts[2]);
                     // size
                     if (strtolower(trim($fParts[1])) == 'auto') {
                         $fParts[1] = count($valueParts);
                     }
                     // Auto size set here. Max 20
                     $size = trim($fParts[1]) ? t3lib_div::intInRange($fParts[1], 1, 20) : 1;
                     // multiple
                     $multiple = strtolower(trim($fParts[2])) == 'm' ? ' multiple="multiple"' : '';
                     $items = array();
                     // Where the items will be
                     $defaults = array();
                     //RTF
                     $pCount = count($valueParts);
                     for ($a = 0; $a < $pCount; $a++) {
                         $valueParts[$a] = trim($valueParts[$a]);
                         if (substr($valueParts[$a], 0, 1) == '*') {
                             // Finding default value
                             $sel = 'selected';
                             $valueParts[$a] = substr($valueParts[$a], 1);
                         } else {
                             $sel = '';
                         }
                         // Get value/label
                         $subParts = explode('=', $valueParts[$a]);
                         $subParts[1] = isset($subParts[1]) ? trim($subParts[1]) : trim($subParts[0]);
                         // Sets the value
                         $items[] = $subParts;
                         // Adds the value/label pair to the items-array
                         if ($sel) {
                             $defaults[] = $subParts[1];
                         }
                         // Sets the default value if value/label pair is marked as default.
                     }
                     // alternative default value:
                     $noValueInsert = isset($conf['noValueInsert.']) ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.']) : $conf['noValueInsert'];
                     $default = $this->cObj->getFieldDefaultValue($noValueInsert, $confData['fieldname'], $defaults);
                     if (!is_array($default)) {
                         $defaults = array();
                         $defaults[] = $default;
                     } else {
                         $defaults = $default;
                     }
                     // Create the select-box:
                     $iCount = count($items);
                     for ($a = 0; $a < $iCount; $a++) {
                         $option .= '<option value="' . $items[$a][1] . '"' . (in_array($items[$a][1], $defaults) ? ' selected="selected"' : '') . '>' . trim($items[$a][0]) . '</option>';
                         //RTF
                     }
                     if ($multiple) {
                         // The fieldname must be prepended '[]' if multiple select. And the reason why it's prepended is, because the required-field list later must also have [] prepended.
                         $confData['fieldname'] .= '[]';
                     }
                     $fieldCode = sprintf('<select name="%s"%s size="%s"%s%s>%s</select>', $confData['fieldname'], $elementIdAttribute, $size, $multiple, $addParams, $option);
                     //RTF
                     break;
                 case 'radio':
                     $option = '';
                     $valueParts = explode(',', $parts[2]);
                     $items = array();
                     // Where the items will be
                     $default = '';
                     $pCount = count($valueParts);
                     for ($a = 0; $a < $pCount; $a++) {
                         $valueParts[$a] = trim($valueParts[$a]);
                         if (substr($valueParts[$a], 0, 1) == '*') {
                             $sel = 'checked';
                             $valueParts[$a] = substr($valueParts[$a], 1);
                         } else {
                             $sel = '';
                         }
                         // Get value/label
                         $subParts = explode('=', $valueParts[$a]);
                         $subParts[1] = isset($subParts[1]) ? trim($subParts[1]) : trim($subParts[0]);
                         // Sets the value
                         $items[] = $subParts;
                         // Adds the value/label pair to the items-array
                         if ($sel) {
                             $default = $subParts[1];
                         }
                         // Sets the default value if value/label pair is marked as default.
                     }
                     // alternative default value:
                     $noValueInsert = isset($conf['noValueInsert.']) ? $this->cObj->stdWrap($conf['noValueInsert'], $conf['noValueInsert.']) : $conf['noValueInsert'];
                     $default = $this->cObj->getFieldDefaultValue($noValueInsert, $confData['fieldname'], $default);
                     // Create the select-box:
                     $iCount = count($items);
                     for ($a = 0; $a < $iCount; $a++) {
                         $optionParts = '';
                         $radioId = $prefix . $fName . $this->cObj->cleanFormName($items[$a][0]);
                         if ($accessibility) {
                             $radioLabelIdAttribute = ' id="' . $radioId . '"';
                         } else {
                             $radioLabelIdAttribute = '';
                         }
                         $optionParts .= '<input type="radio" name="' . $confData['fieldname'] . '"' . $radioLabelIdAttribute . ' value="' . $items[$a][1] . '"' . (!strcmp($items[$a][1], $default) ? ' checked="checked"' : '') . $addParams . ' />';
                         if ($accessibility) {
                             $label = isset($conf['radioWrap.']) ? $this->cObj->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) : trim($items[$a][0]);
                             $optionParts .= '<label for="' . $radioId . '">' . $label . '</label>';
                         } else {
                             $optionParts .= isset($conf['radioWrap.']) ? $this->cObj->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) : trim($items[$a][0]);
                         }
                         $option .= isset($conf['radioInputWrap.']) ? $this->cObj->stdWrap($optionParts, $conf['radioInputWrap.']) : $optionParts;
                     }
                     if ($accessibility) {
                         $accessibilityWrap = isset($conf['radioWrap.']['accessibilityWrap.']) ? $this->cObj->stdWrap($conf['radioWrap.']['accessibilityWrap'], $conf['radioWrap.']['accessibilityWrap.']) : $conf['radioWrap.']['accessibilityWrap.'];
                         if ($accessibilityWrap) {
                             $search = array('###RADIO_FIELD_ID###', '###RADIO_GROUP_LABEL###');
                             $replace = array($elementIdAttribute, $confData['label']);
                             $accessibilityWrap = str_replace($search, $replace, $accessibilityWrap);
                             $option = $this->cObj->wrap($option, $accessibilityWrap);
                         }
                     }
                     $fieldCode = $option;
                     break;
                 case 'hidden':
                     $value = trim($parts[2]);
                     // If this form includes an auto responder message, include a HMAC checksum field
                     // in order to verify potential abuse of this feature.
                     if (strlen($value) && t3lib_div::inList($confData['fieldname'], 'auto_respond_msg')) {
                         $hmacChecksum = t3lib_div::hmac($value);
                         $hiddenfields .= sprintf('<input type="hidden" name="auto_respond_checksum" id="%sauto_respond_checksum" value="%s" />', $prefix, $hmacChecksum);
                     }
                     if (strlen($value) && t3lib_div::inList('recipient_copy,recipient', $confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
                         break;
                     }
                     if (strlen($value) && t3lib_div::inList('recipient_copy,recipient', $confData['fieldname'])) {
                         $value = $GLOBALS['TSFE']->codeString($value);
                     }
                     $hiddenfields .= sprintf('<input type="hidden" name="%s"%s value="%s" />', $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value));
                     break;
                 case 'property':
                     if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess', $confData['fieldname'])) {
                         $value = trim($parts[2]);
                         $propertyOverride[$confData['fieldname']] = $value;
                         $conf[$confData['fieldname']] = $value;
                     }
                     break;
                 case 'submit':
                     $value = trim($parts[2]);
                     if ($conf['image.']) {
                         $this->cObj->data[$this->cObj->currentValKey] = $value;
                         $image = $this->cObj->IMG_RESOURCE($conf['image.']);
                         $params = $conf['image.']['params'] ? ' ' . $conf['image.']['params'] : '';
                         $params .= $this->cObj->getAltParam($conf['image.'], FALSE);
                         $params .= $addParams;
                     } else {
                         $image = '';
                     }
                     if ($image) {
                         $fieldCode = sprintf('<input type="image" name="%s"%s src="%s"%s />', $confData['fieldname'], $elementIdAttribute, $image, $params);
                     } else {
                         $fieldCode = sprintf('<input type="submit" name="%s"%s value="%s"%s />', $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
                     }
                     break;
                 case 'reset':
                     $value = trim($parts[2]);
                     $fieldCode = sprintf('<input type="reset" name="%s"%s value="%s"%s />', $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
                     break;
                 case 'label':
                     $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));
                     break;
                 default:
                     $confData['type'] = 'comment';
                     $fieldCode = trim($parts[2]) . '&nbsp;';
                     break;
             }
             if ($fieldCode) {
                 // Checking for special evaluation modes:
                 if (t3lib_div::inList('textarea,input,password', $confData['type']) && strlen(trim($parts[3]))) {
                     $modeParameters = t3lib_div::trimExplode(':', $parts[3]);
                 } else {
                     $modeParameters = array();
                 }
                 // Adding evaluation based on settings:
                 switch ((string) $modeParameters[0]) {
                     case 'EREG':
                         $fieldlist[] = '_EREG';
                         $fieldlist[] = $modeParameters[1];
                         $fieldlist[] = $modeParameters[2];
                         $fieldlist[] = $confData['fieldname'];
                         $fieldlist[] = $confData['label'];
                         $confData['required'] = 1;
                         // Setting this so "required" layout is used.
                         break;
                     case 'EMAIL':
                         $fieldlist[] = '_EMAIL';
                         $fieldlist[] = $confData['fieldname'];
                         $fieldlist[] = $confData['label'];
                         $confData['required'] = 1;
                         // Setting this so "required" layout is used.
                         break;
                     default:
                         if ($confData['required']) {
                             $fieldlist[] = $confData['fieldname'];
                             $fieldlist[] = $confData['label'];
                         }
                         break;
                 }
                 // Field:
                 $fieldLabel = $confData['label'];
                 if ($accessibility && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/', $confData['type'])) {
                     $fieldLabel = '<label for="' . $prefix . $fName . '">' . $fieldLabel . '</label>';
                 }
                 // Getting template code:
                 if (isset($conf['fieldWrap.'])) {
                     $fieldCode = $this->cObj->stdWrap($fieldCode, $conf['fieldWrap.']);
                 }
                 $labelCode = isset($conf['labelWrap.']) ? $this->cObj->stdWrap($fieldLabel, $conf['labelWrap.']) : $fieldLabel;
                 $commentCode = isset($conf['commentWrap.']) ? $this->cObj->stdWrap($confData['label'], $conf['commentWrap.']) : $confData['label'];
                 $result = $conf['layout'];
                 $req = isset($conf['REQ.']) ? $this->cObj->stdWrap($conf['REQ'], $conf['REQ.']) : $conf['REQ'];
                 if ($req && $confData['required']) {
                     if (isset($conf['REQ.']['fieldWrap.'])) {
                         $fieldCode = $this->cObj->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
                     }
                     if (isset($conf['REQ.']['labelWrap.'])) {
                         $labelCode = $this->cObj->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
                     }
                     $reqLayout = isset($conf['REQ.']['layout.']) ? $this->cObj->stdWrap($conf['REQ.']['layout'], $conf['REQ.']['layout.']) : $conf['REQ.']['layout'];
                     if ($reqLayout) {
                         $result = $reqLayout;
                     }
                 }
                 if ($confData['type'] == 'comment') {
                     $commentLayout = isset($conf['COMMENT.']['layout.']) ? $this->cObj->stdWrap($conf['COMMENT.']['layout'], $conf['COMMENT.']['layout.']) : $conf['COMMENT.']['layout'];
                     if ($commentLayout) {
                         $result = $commentLayout;
                     }
                 }
                 if ($confData['type'] == 'check') {
                     $checkLayout = isset($conf['CHECK.']['layout.']) ? $this->cObj->stdWrap($conf['CHECK.']['layout'], $conf['CHECK.']['layout.']) : $conf['CHECK.']['layout'];
                     if ($checkLayout) {
                         $result = $checkLayout;
                     }
                 }
                 if ($confData['type'] == 'radio') {
                     $radioLayout = isset($conf['RADIO.']['layout.']) ? $this->cObj->stdWrap($conf['RADIO.']['layout'], $conf['RADIO.']['layout.']) : $conf['RADIO.']['layout'];
                     if ($radioLayout) {
                         $result = $radioLayout;
                     }
                 }
                 if ($confData['type'] == 'label') {
                     $labelLayout = isset($conf['LABEL.']['layout.']) ? $this->cObj->stdWrap($conf['LABEL.']['layout'], $conf['LABEL.']['layout.']) : $conf['CHECK.']['layout'];
                     if ($labelLayout) {
                         $result = $labelLayout;
                     }
                 }
                 $result = str_replace('###FIELD###', $fieldCode, $result);
                 $result = str_replace('###LABEL###', $labelCode, $result);
                 $result = str_replace('###COMMENT###', $commentCode, $result);
                 //RTF
                 $content .= $result;
             }
         }
     }
     if (isset($conf['stdWrap.'])) {
         $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
     }
     // redirect (external: where to go afterwards. internal: where to submit to)
     $theRedirect = isset($conf['redirect.']) ? $this->cObj->stdWrap($conf['redirect'], $conf['redirect.']) : $conf['redirect'];
     // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
     $target = isset($conf['target.']) ? $this->cObj->stdWrap($conf['target'], $conf['target.']) : $conf['target'];
     // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
     $noCache = isset($conf['no_cache.']) ? $this->cObj->stdWrap($conf['no_cache'], $conf['no_cache.']) : $conf['no_cache'];
     // redirect should be set to the page to redirect to after an external script has been used. If internal scripts is used, and if no 'type' is set that dictates otherwise, redirect is used as the url to jump to as long as it's an integer (page)
     $page = $GLOBALS['TSFE']->page;
     if (!$theRedirect) {
         // Internal: Just submit to current page
         $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, 'index.php', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
     } elseif (t3lib_div::testInt($theRedirect)) {
         // Internal: Submit to page with ID $theRedirect
         $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
         $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, 'index.php', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
     } else {
         // External URL, redirect-hidden field is rendered!
         $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, '', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
         $LD['totalURL'] = $theRedirect;
         $hiddenfields .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($LD['totalURL']) . '" />';
         // 18-09-00 added
     }
     // Formtype (where to submit to!):
     if ($propertyOverride['type']) {
         $formtype = $propertyOverride['type'];
     } else {
         $formtype = isset($conf['type.']) ? $this->cObj->stdWrap($conf['type'], $conf['type.']) : $conf['type'];
     }
     if (t3lib_div::testInt($formtype)) {
         // Submit to a specific page
         $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
         $LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $target, $noCache, '', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
         $action = $LD_A['totalURL'];
     } elseif ($formtype) {
         // Submit to external script
         $LD_A = $LD;
         $action = $formtype;
     } elseif (t3lib_div::testInt($theRedirect)) {
         $LD_A = $LD;
         $action = $LD_A['totalURL'];
     } else {
         // Submit to "nothing" - which is current page
         $LD_A = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, $target, $noCache, '', '', $this->cObj->getClosestMPvalueForPage($page['uid']));
         $action = $LD_A['totalURL'];
     }
     // Recipient:
     $theEmail = isset($conf['recipient.']) ? $this->cObj->stdWrap($conf['recipient'], $conf['recipient.']) : $conf['recipient'];
     if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
         $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
         $hiddenfields .= '<input type="hidden" name="recipient" value="' . htmlspecialchars($theEmail) . '" />';
     }
     // location data:
     $location = isset($conf['locationData.']) ? $this->cObj->stdWrap($conf['locationData'], $conf['locationData.']) : $conf['locationData'];
     if ($location) {
         if ($location == 'HTTP_POST_VARS' && isset($_POST['locationData'])) {
             $locationData = t3lib_div::_POST('locationData');
         } else {
             // locationData is [hte page id]:[tablename]:[uid of record]. Indicates on which page the record (from tablename with uid) is shown. Used to check access.
             $locationData = $GLOBALS['TSFE']->id . ':' . $this->cObj->currentRecord;
         }
         $hiddenfields .= '<input type="hidden" name="locationData" value="' . htmlspecialchars($locationData) . '" />';
     }
     // hidden fields:
     if (is_array($conf['hiddenFields.'])) {
         foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) {
             if (substr($hF_key, -1) != '.') {
                 $hF_value = $this->cObj->cObjGetSingle($hF_conf, $conf['hiddenFields.'][$hF_key . '.'], 'hiddenfields');
                 if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient', $hF_key)) {
                     if ($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
                         continue;
                     }
                     $hF_value = $GLOBALS['TSFE']->codeString($hF_value);
                 }
                 $hiddenfields .= '<input type="hidden" name="' . $hF_key . '" value="' . htmlspecialchars($hF_value) . '" />';
             }
         }
     }
     // Wrap all hidden fields in a div tag (see http://bugs.typo3.org/view.php?id=678)
     $hiddenfields = isset($conf['hiddenFields.']['stdWrap.']) ? $this->cObj->stdWrap($hiddenfields, $conf['hiddenFields.']['stdWrap.']) : '<div style="display:none;">' . $hiddenfields . '</div>';
     if ($conf['REQ']) {
         $goodMess = isset($conf['goodMess.']) ? $this->cObj->stdWrap($conf['goodMess'], $conf['goodMess.']) : $conf['goodMess'];
         $badMess = isset($conf['badMess.']) ? $this->cObj->stdWrap($conf['badMess'], $conf['badMess.']) : $conf['badMess'];
         $emailMess = isset($conf['emailMess.']) ? $this->cObj->stdWrap($conf['emailMess'], $conf['emailMess.']) : $conf['emailMess'];
         $validateForm = ' onsubmit="return validateForm(\'' . $formName . '\',\'' . implode(',', $fieldlist) . '\',' . t3lib_div::quoteJSvalue($goodMess) . ',' . t3lib_div::quoteJSvalue($badMess) . ',' . t3lib_div::quoteJSvalue($emailMess) . ')"';
         $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="' . t3lib_div::createVersionNumberedFilename($GLOBALS['TSFE']->absRefPrefix . 't3lib/jsfunc.validateform.js') . '"></script>';
     } else {
         $validateForm = '';
     }
     // Create form tag:
     $theTarget = $theRedirect ? $LD['target'] : $LD_A['target'];
     $method = isset($conf['method.']) ? $this->cObj->stdWrap($conf['method'], $conf['method.']) : $conf['method'];
     $content = array('<form' . ' action="' . htmlspecialchars($action) . '"' . ' id="' . $formName . '"' . ($xhtmlStrict ? '' : ' name="' . $formName . '"') . ' enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"' . ' method="' . ($method ? $method : 'post') . '"' . ($theTarget ? ' target="' . $theTarget . '"' : '') . $validateForm . '>', $hiddenfields . $content, '</form>');
     $arrayReturnMode = isset($conf['arrayReturnMode.']) ? $this->cObj->stdWrap($conf['arrayReturnMode'], $conf['arrayReturnMode.']) : $conf['arrayReturnMode'];
     if ($arrayReturnMode) {
         $content['validateForm'] = $validateForm;
         $content['formname'] = $formName;
         return $content;
     } else {
         return implode('', $content);
     }
 }
 /**
  * The actual rendering of the image file.
  * Basically sets the dimensions, the background color, the traverses the array of GIFBUILDER objects and finally setting the transparent color if defined.
  * Creates a GDlib resource in $this->im and works on that
  * Called by gifBuild()
  *
  * @return	void
  * @access private
  * @see gifBuild()
  */
 function make()
 {
     // Get trivial data
     $XY = $this->XY;
     // Gif-start
     $this->im = imagecreatetruecolor($XY[0], $XY[1]);
     $this->w = $XY[0];
     $this->h = $XY[1];
     // backColor is set
     $BGcols = $this->convertColor($this->setup['backColor']);
     $Bcolor = ImageColorAllocate($this->im, $BGcols[0], $BGcols[1], $BGcols[2]);
     ImageFilledRectangle($this->im, 0, 0, $XY[0], $XY[1], $Bcolor);
     // Traverse the GIFBUILDER objects an render each one:
     if (is_array($this->setup)) {
         $sKeyArray = t3lib_TStemplate::sortedKeyList($this->setup);
         foreach ($sKeyArray as $theKey) {
             $theValue = $this->setup[$theKey];
             if (intval($theKey) && ($conf = $this->setup[$theKey . '.'])) {
                 $isStdWrapped = array();
                 foreach ($conf as $key => $value) {
                     $parameter = rtrim($key, '.');
                     if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
                         $conf[$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
                         $isStdWrapped[$parameter] = 1;
                     }
                 }
                 switch ($theValue) {
                     // Images
                     case 'IMAGE':
                         if ($conf['mask']) {
                             $this->maskImageOntoImage($this->im, $conf, $this->workArea);
                         } else {
                             $this->copyImageOntoImage($this->im, $conf, $this->workArea);
                         }
                         break;
                         // Text
                     // Text
                     case 'TEXT':
                         if (!$conf['hide']) {
                             if (is_array($conf['shadow.'])) {
                                 $isStdWrapped = array();
                                 foreach ($conf['shadow.'] as $key => $value) {
                                     $parameter = rtrim($key, '.');
                                     if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
                                         $conf['shadow.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
                                         $isStdWrapped[$parameter] = 1;
                                     }
                                 }
                                 $this->makeShadow($this->im, $conf['shadow.'], $this->workArea, $conf);
                             }
                             if (is_array($conf['emboss.'])) {
                                 $isStdWrapped = array();
                                 foreach ($conf['emboss.'] as $key => $value) {
                                     $parameter = rtrim($key, '.');
                                     if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
                                         $conf['emboss.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
                                         $isStdWrapped[$parameter] = 1;
                                     }
                                 }
                                 $this->makeEmboss($this->im, $conf['emboss.'], $this->workArea, $conf);
                             }
                             if (is_array($conf['outline.'])) {
                                 $isStdWrapped = array();
                                 foreach ($conf['outline.'] as $key => $value) {
                                     $parameter = rtrim($key, '.');
                                     if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
                                         $conf['outline.'][$parameter] = $this->cObj->stdWrap($conf[$parameter], $conf[$parameter . '.']);
                                         $isStdWrapped[$parameter] = 1;
                                     }
                                 }
                                 $this->makeOutline($this->im, $conf['outline.'], $this->workArea, $conf);
                             }
                             $conf['imgMap'] = 1;
                             $this->makeText($this->im, $conf, $this->workArea);
                         }
                         break;
                         // Text effects:
                     // Text effects:
                     case 'OUTLINE':
                         if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
                             $this->makeOutline($this->im, $conf, $this->workArea, $txtConf);
                         }
                         break;
                     case 'EMBOSS':
                         if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
                             $this->makeEmboss($this->im, $conf, $this->workArea, $txtConf);
                         }
                         break;
                     case 'SHADOW':
                         if ($this->setup[$conf['textObjNum']] == 'TEXT' && ($txtConf = $this->checkTextObj($this->setup[$conf['textObjNum'] . '.']))) {
                             $this->makeShadow($this->im, $conf, $this->workArea, $txtConf);
                         }
                         break;
                         // Other
                     // Other
                     case 'BOX':
                         $this->makeBox($this->im, $conf, $this->workArea);
                         break;
                     case 'EFFECT':
                         $this->makeEffect($this->im, $conf);
                         break;
                     case 'ADJUST':
                         $this->adjust($this->im, $conf);
                         break;
                     case 'CROP':
                         $this->crop($this->im, $conf);
                         break;
                     case 'SCALE':
                         $this->scale($this->im, $conf);
                         break;
                     case 'WORKAREA':
                         if ($conf['set']) {
                             $this->setWorkArea($conf['set']);
                             // this sets the workArea
                         }
                         if (isset($conf['clear'])) {
                             $this->workArea = $this->defaultWorkArea;
                             // this sets the current to the default;
                         }
                         break;
                     case 'ELLIPSE':
                         $this->makeEllipse($this->im, $conf, $this->workArea);
                         break;
                 }
             }
         }
     }
     if ($this->setup['transparentBackground']) {
         // Auto transparent background is set
         $Bcolor = ImageColorClosest($this->im, $BGcols[0], $BGcols[1], $BGcols[2]);
         imagecolortransparent($this->im, $Bcolor);
     } elseif (is_array($this->setup['transparentColor_array'])) {
         // Multiple transparent colors are set. This is done via the trick that all transparent colors get converted to one color and then this one gets set as transparent as png/gif can just have one transparent color.
         $Tcolor = $this->unifyColors($this->im, $this->setup['transparentColor_array'], intval($this->setup['transparentColor.']['closest']));
         if ($Tcolor >= 0) {
             imagecolortransparent($this->im, $Tcolor);
         }
     }
 }