Index: typo3/sysext/cms/tslib/class.tslib_content.php =================================================================== --- typo3/sysext/cms/tslib/class.tslib_content.php (revision 8782) +++ typo3/sysext/cms/tslib/class.tslib_content.php (working copy) @@ -1,29 +1,29 @@ Array('params'=>'', 'ext'=>'gif'), - 11 => Array('params'=>'-colors 128', 'ext'=>'gif'), - 12 => Array('params'=>'-colors 64', 'ext'=>'gif'), - 13 => Array('params'=>'-colors 32', 'ext'=>'gif'), - 14 => Array('params'=>'-colors 16', 'ext'=>'gif'), - 15 => Array('params'=>'-colors 8', 'ext'=>'gif'), + var $image_compression = array( + 10 => array( + 'params' => '', 'ext' => 'gif' + ), + 11 => array( + 'params' => '-colors 128', 'ext' => 'gif' + ), + 12 => array( + 'params' => '-colors 64', 'ext' => 'gif' + ), + 13 => array( + 'params' => '-colors 32', 'ext' => 'gif' + ), + 14 => array( + 'params' => '-colors 16', 'ext' => 'gif' + ), + 15 => array( + 'params' => '-colors 8', 'ext' => 'gif' + ), - 30 => Array('params'=>'-colors 256', 'ext'=>'png'), - 31 => Array('params'=>'-colors 128', 'ext'=>'png'), - 32 => Array('params'=>'-colors 64', 'ext'=>'png'), - 33 => Array('params'=>'-colors 32', 'ext'=>'png'), - 34 => Array('params'=>'-colors 16', 'ext'=>'png'), - 35 => Array('params'=>'-colors 8', 'ext'=>'png'), - 39 => Array('params'=>'', 'ext'=>'png'), + 20 => array( + 'params' => '-quality 100', 'ext' => 'jpg' + ), + 21 => array( + 'params' => '-quality 90', 'ext' => 'jpg' + ), + 22 => array( + 'params' => '-quality 80', 'ext' => 'jpg' + ), + 23 => array( + 'params' => '-quality 70', 'ext' => 'jpg' + ), + 24 => array( + 'params' => '-quality 60', 'ext' => 'jpg' + ), + 25 => array( + 'params' => '-quality 50', 'ext' => 'jpg' + ), + 26 => array( + 'params' => '-quality 40', 'ext' => 'jpg' + ), + 27 => array( + 'params' => '-quality 30', 'ext' => 'jpg' + ), + 28 => array( + 'params' => '-quality 20', 'ext' => 'jpg' + ), - 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'), - 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'), - 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'), - 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'), - 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'), - 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'), - 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'), - 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'), - 28 => Array('params'=>'-quality 20', 'ext'=>'jpg') + 30 => array( + 'params' => '-colors 256', 'ext' => 'png' + ), + 31 => array( + 'params' => '-colors 128', 'ext' => 'png' + ), + 32 => array( + 'params' => '-colors 64', 'ext' => 'png' + ), + 33 => array( + 'params' => '-colors 32', 'ext' => 'png' + ), + 34 => array( + 'params' => '-colors 16', 'ext' => 'png' + ), + 35 => array( + 'params' => '-colors 8', 'ext' => 'png' + ), + 39 => array( + 'params' => '', 'ext' => 'png' + ), ); /** @@ -294,7 +321,7 @@ * * @see IMGTEXT() */ - var $image_effects = Array( + var $image_effects = array( 1 => '-rotate 90', 2 => '-rotate 270', 3 => '-rotate 180', @@ -313,43 +340,45 @@ * The function stdWrap has TypoScript properties that fetch field-data from this array. * @see init() */ - var $data = Array(); + var $data = array(); protected $table = ''; - var $oldData = Array(); // Used for backup... - var $alternativeData =''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap - var $parameters = Array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags. + var $oldData = array(); // Used for backup... + var $alternativeData = ''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap + var $parameters = array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags. var $currentValKey = 'currentValue_kidjls9dksoje'; - var $currentRecord = ''; // This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered. - var $currentRecordTotal = 0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query. - var $currentRecordNumber = 0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering. - var $parentRecordNumber = 0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering. - var $parentRecord = array(); // If the tslib_cObj was started from CONTENT, RECORD or SEARCHRESULT cObject's this array has two keys, 'data' and 'currentRecord' which indicates the record and data for the parent cObj. - var $regObj; // This may be set as a reference to the calling object of eg. cObjGetSingle. Anyway, just use it as you like. It's used in productsLib.inc for example. + var $currentRecord = ''; // This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered. + var $currentRecordTotal = 0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query. + var $currentRecordNumber = 0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering. + var $parentRecordNumber = 0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering. + var $parentRecord = array(); // If the tslib_cObj was started from CONTENT, RECORD or SEARCHRESULT cObject's this array has two keys, 'data' and 'currentRecord' which indicates the record and data for the parent cObj. + var $regObj; // This may be set as a reference to the calling object of eg. cObjGetSingle. Anyway, just use it as you like. It's used in productsLib.inc for example. - // internal - var $INT_include=0; // Is set to 1 if the instance of this cObj is executed from a PHP_SCRIPT_INT -include script (see pagegen, bottom of document) - var $checkPid_cache = Array(); // This is used by checkPid, that checks if pages are accessible. The $checkPid_cache['page_uid'] is set true or false upon this check featuring a caching function for the next request. + + // internal + var $INT_include = 0; // Is set to 1 if the instance of this cObj is executed from a PHP_SCRIPT_INT -include script (see pagegen, bottom of document) + var $checkPid_cache = array(); // This is used by checkPid, that checks if pages are accessible. The $checkPid_cache['page_uid'] is set TRUE or FALSE upon this check featuring a caching function for the next request. var $checkPid_badDoktypeList = '255'; - var $lastTypoLinkUrl=''; // This will be set by typoLink() to the url of the most recent link created. - var $lastTypoLinkTarget=''; // DO. link target. + var $lastTypoLinkUrl = ''; // This will be set by typoLink() to the url of the most recent link created. + var $lastTypoLinkTarget = ''; // DO. link target. var $lastTypoLinkLD = array(); - var $substMarkerCache=array(); // Caching substituteMarkerArrayCached function - var $recordRegister=array(); // Array that registers rendered content elements (or any table) to make sure they are not rendered recursively! - var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects - protected $stdWrapHookObjects = array(); // Containing hook objects for stdWrap - protected $getImgResourceHookObjects; // Containing hook objects for getImgResource + var $substMarkerCache = array(); // Caching substituteMarkerArrayCached function + var $recordRegister = array(); // array that registers rendered content elements (or any table) to make sure they are not rendered recursively! + var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects + protected $stdWrapHookObjects = array(); // Containing hook objects for stdWrap + protected $getImgResourceHookObjects; // Containing hook objects for getImgResource + /** - * Set to true by doConvertToUserIntObject() if USER object wants to become USER_INT + * Set to TRUE by doConvertToUserIntObject() if USER object wants to become USER_INT */ - protected $doConvertToUserIntObject = false; + protected $doConvertToUserIntObject = FALSE; /** - * Indicates current object type. Can hold one of OBJECTTYPE_ constants or false. + * Indicates current object type. Can hold one of OBJECTTYPE_ constants or FALSE. * The value is set and reset inside USER() function. Any time outside of - * USER() it is false. + * USER() it is FALSE. */ - protected $userObjectType = false; + protected $userObjectType = FALSE; /** * Indicates that object type is USER. @@ -374,25 +403,28 @@ * @param string $table the table that the data record is from. * @return void */ - function start($data,$table='') { + function start($data, $table = '') { global $TYPO3_CONF_VARS; $this->data = $data; $this->table = $table; - $this->currentRecord = $table ? $table.':'.$this->data['uid'] : ''; - $this->parameters = Array(); - if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) { + $this->currentRecord = $table ? $table . ':' . $this->data['uid'] : ''; + $this->parameters = array(); + if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) { foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) { $this->cObjHookObjectsArr[$classArr[0]] = t3lib_div::getUserObj($classArr[1]); } } $this->stdWrapHookObjects = array(); - if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'])) { - foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) { + if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'])) { + foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); - if(!($hookObject instanceof tslib_content_stdWrapHook)) { - throw new UnexpectedValueException('$hookObject must implement interface tslib_content_stdWrapHook', 1195043965); + if (!($hookObject instanceof tslib_content_stdWrapHook)) { + throw new UnexpectedValueException( + '$hookObject must implement interface tslib_content_stdWrapHook', + 1195043965 + ); } $this->stdWrapHookObjects[] = $hookObject; @@ -403,8 +435,11 @@ foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'] as $classData) { $postInitializationProcessor = t3lib_div::getUserObj($classData); - if(!($postInitializationProcessor instanceof tslib_content_PostInitHook)) { - throw new UnexpectedValueException('$postInitializationProcessor must implement interface tslib_content_PostInitHook', 1274563549); + if (!($postInitializationProcessor instanceof tslib_content_PostInitHook)) { + throw new UnexpectedValueException( + '$postInitializationProcessor must implement interface tslib_content_PostInitHook', + 1274563549 + ); } $postInitializationProcessor->postProcessContentObjectInitialization($this); @@ -422,12 +457,15 @@ if (!isset($this->getImgResourceHookObjects)) { $this->getImgResourceHookObjects = array(); - if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'])) { - foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'] as $classData) { + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'])) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); - if(!($hookObject instanceof tslib_cObj_getImgResourceHook)) { - throw new UnexpectedValueException('$hookObject must implement interface tslib_cObj_getImgResourceHook', 1218636383); + if (!($hookObject instanceof tslib_cObj_getImgResourceHook)) { + throw new UnexpectedValueException( + '$hookObject must implement interface tslib_cObj_getImgResourceHook', + 1218636383 + ); } $this->getImgResourceHookObjects[] = $hookObject; @@ -447,17 +485,15 @@ * @return void * @access private */ - function setParent($data,$currentRecord) { - $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord); + function setParent($data, $currentRecord) { + $this->parentRecord = array( + 'data' => $data, + 'currentRecord' => $currentRecord + ); } - - - - - /*********************************************** * * CONTENT_OBJ: @@ -472,7 +508,7 @@ * * @return mixed The "current" value */ - function getCurrentVal() { + function getCurrentVal() { return $this->data[$this->currentValKey]; } @@ -483,7 +519,7 @@ * @return void * @see getCurrentVal() */ - function setCurrentVal($value) { + function setCurrentVal($value) { $this->data[$this->currentValKey] = $value; } @@ -491,20 +527,20 @@ * Rendering of a "numerical array" of cObjects from TypoScript * Will call ->cObjGetSingle() for each cObject found and accumulate the output. * - * @param array $setup: Array with cObjects as values. + * @param array $setup: array with cObjects as values. * @param string $addKey: A prefix for the debugging information * @return string Rendered output from the cObjects in the array. * @see cObjGetSingle() */ - function cObjGet($setup,$addKey='') { - if (is_array($setup)) { - $sKeyArray=t3lib_TStemplate::sortedKeyList($setup); - $content =''; - foreach($sKeyArray as $theKey) { - $theValue=$setup[$theKey]; - if (intval($theKey) && !strstr($theKey,'.')) { - $conf=$setup[$theKey.'.']; - $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey); // Get the contentObject + function cObjGet($setup, $addKey = '') { + if (is_array($setup)) { + $sKeyArray = t3lib_TStemplate::sortedKeyList($setup); + $content = ''; + foreach ($sKeyArray as $theKey) { + $theValue = $setup[$theKey]; + if (intval($theKey) && !strstr($theKey, '.')) { + $conf = $setup[$theKey . '.']; + $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey); // Get the contentObject } } return $content; @@ -520,148 +556,152 @@ * @return string cObject output * @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331 */ - function cObjGetSingle($name,$conf,$TSkey='__') { + function cObjGetSingle($name, $conf, $TSkey = '__') { global $TYPO3_CONF_VARS; - $content=''; + $content = ''; // Checking that the function is not called eternally. This is done by interrupting at a depth of 100 $GLOBALS['TSFE']->cObjectDepthCounter--; - if ($GLOBALS['TSFE']->cObjectDepthCounter>0) { + if ($GLOBALS['TSFE']->cObjectDepthCounter > 0) { $name = trim($name); - if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name); + if ($GLOBALS['TT']->LR) + $GLOBALS['TT']->push($TSkey, $name); // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something') - if (substr($name,0,1)=='<') { - $key = trim(substr($name,1)); + if (substr($name, 0, 1) == '<') { + $key = trim(substr($name, 1)); $cF = t3lib_div::makeInstance('t3lib_TSparser'); // $name and $conf is loaded with the referenced values. - $old_conf=$conf; - list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup); - if (is_array($old_conf) && count($old_conf)) { - $conf = $this->joinTSarrays($conf,$old_conf); + $old_conf = $conf; + list ($name, $conf) = $cF->getVal($key, $GLOBALS['TSFE']->tmpl->setup); + if (is_array($old_conf) && count($old_conf)) { + $conf = $this->joinTSarrays($conf, $old_conf); } // Getting the cObject $GLOBALS['TT']->incStackPointer(); - $content.=$this->cObjGetSingle($name,$conf,$key); + $content .= $this->cObjGetSingle($name, $conf, $key); $GLOBALS['TT']->decStackPointer(); } else { - $hooked = false; + $hooked = FALSE; // Application defined cObjects - foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) { - if (($name===$cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) { - $content.= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this); - $hooked = true; + foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) { + if (($name === $cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) { + $content .= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this); + $hooked = TRUE; } } - if (!$hooked && isset($GLOBALS['OBTS']['tso_list'][$name]) && t3lib_extMgm::isLoaded('obts')) { - $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this); - } elseif (!$hooked) { + if (!$hooked) { // Traditional Content Object branching: - switch($name) { - case 'COBJ_ARRAY': - case 'COA': - $content.=$this->COBJ_ARRAY($conf); + switch ($name) { + case 'COBJ_ARRAY' : + case 'COA' : + $content .= $this->COBJ_ARRAY($conf); break; - case 'COA_INT': - $content.=$this->COBJ_ARRAY($conf,'INT'); + case 'COA_INT' : + $content .= $this->COBJ_ARRAY($conf, 'INT'); break; - case 'HTML': - $content.=$this->HTML($conf); + case 'HTML' : + $content .= $this->HTML($conf); break; - case 'TEXT': - $content.=$this->TEXT($conf); + case 'TEXT' : + $content .= $this->TEXT($conf); break; - case 'CLEARGIF': - $content.=$this->CLEARGIF($conf); + case 'CLEARGIF' : + $content .= $this->CLEARGIF($conf); break; - case 'FILE': - $content.=$this->FILE($conf); + case 'FILE' : + $content .= $this->FILE($conf); break; - case 'IMAGE': - $content.=$this->IMAGE($conf); + case 'IMAGE' : + $content .= $this->IMAGE($conf); break; - case 'IMG_RESOURCE': - $content.=$this->IMG_RESOURCE($conf); + case 'IMG_RESOURCE' : + $content .= $this->IMG_RESOURCE($conf); break; - case 'IMGTEXT': - $content.=$this->IMGTEXT($conf); + case 'IMGTEXT' : + $content .= $this->IMGTEXT($conf); break; - case 'CONTENT': - $content.=$this->CONTENT($conf); + case 'CONTENT' : + $content .= $this->CONTENT($conf); break; - case 'RECORDS': - $content.=$this->RECORDS($conf); + case 'RECORDS' : + $content .= $this->RECORDS($conf); break; - case 'HMENU': - $content.=$this->HMENU($conf); + case 'HMENU' : + $content .= $this->HMENU($conf); break; - case 'CTABLE': - $content.=$this->CTABLE($conf); + case 'CTABLE' : + $content .= $this->CTABLE($conf); break; - case 'OTABLE': - $content.=$this->OTABLE($conf); + case 'OTABLE' : + $content .= $this->OTABLE($conf); break; - case 'COLUMNS': - $content.=$this->COLUMNS($conf); + case 'COLUMNS' : + $content .= $this->COLUMNS($conf); break; - case 'HRULER': - $content.=$this->HRULER($conf); + case 'HRULER' : + $content .= $this->HRULER($conf); break; - case 'CASE': - $content.=$this->CASEFUNC($conf); + case 'CASE' : + $content .= $this->CASEFUNC($conf); break; - case 'LOAD_REGISTER': - case 'RESTORE_REGISTER': - $this->LOAD_REGISTER($conf,$name); + case 'LOAD_REGISTER' : + case 'RESTORE_REGISTER' : + $this->LOAD_REGISTER($conf, $name); break; - case 'FORM': - $content.=$this->FORM($conf); + case 'FORM' : + $content .= $this->FORM($conf); break; - case 'SEARCHRESULT': - $content.=$this->SEARCHRESULT($conf); + case 'SEARCHRESULT' : + $content .= $this->SEARCHRESULT($conf); break; - case 'PHP_SCRIPT': - $content.=$this->PHP_SCRIPT($conf); + case 'PHP_SCRIPT' : + $content .= $this->PHP_SCRIPT($conf); break; - case 'PHP_SCRIPT_EXT': - $content.=$this->PHP_SCRIPT($conf,'EXT'); + case 'PHP_SCRIPT_EXT' : + $content .= $this->PHP_SCRIPT($conf, 'EXT'); break; - case 'PHP_SCRIPT_INT': - $content.=$this->PHP_SCRIPT($conf,'INT'); + case 'PHP_SCRIPT_INT' : + $content .= $this->PHP_SCRIPT($conf, 'INT'); break; - case 'USER': - $content.=$this->USER($conf); + case 'USER' : + $content .= $this->USER($conf); break; - case 'USER_INT': - $content.=$this->USER($conf,'INT'); + case 'USER_INT' : + $content .= $this->USER($conf, 'INT'); break; - case 'TEMPLATE': - $content.=$this->TEMPLATE($conf); + case 'TEMPLATE' : + $content .= $this->TEMPLATE($conf); break; - case 'EDITPANEL': - if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);} + case 'EDITPANEL' : + if ($GLOBALS['TSFE']->beUserLogin) { + $content .= $this->editPanel($content, $conf); + } break; - case 'MULTIMEDIA': - $content.=$this->MULTIMEDIA($conf); + case 'MULTIMEDIA' : + $content .= $this->MULTIMEDIA($conf); break; - case 'MEDIA': - $content.=$this->MEDIA($conf); + case 'MEDIA' : + $content .= $this->MEDIA($conf); break; - case 'SWFOBJECT': - $content.=$this->SWFOBJECT($conf); + case 'SWFOBJECT' : + $content .= $this->SWFOBJECT($conf); break; - case 'QTOBJECT': - $content.=$this->QTOBJECT($conf); + case 'QTOBJECT' : + $content .= $this->QTOBJECT($conf); break; - default: + default : // call hook functions for extra processing - if($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) { - foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classData) { + if ($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) { + foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); - if(!($hookObject instanceof tslib_content_cObjGetSingleHook)) { - throw new UnexpectedValueException('$hookObject must implement interface tslib_content_cObjGetSingleHook', 1195043731); + if (!($hookObject instanceof tslib_content_cObjGetSingleHook)) { + throw new UnexpectedValueException( + '$hookObject must implement interface tslib_content_cObjGetSingleHook', + 1195043731 + ); } /* @var $hookObject tslib_content_cObjGetSingleHook */ $content .= $hookObject->getSingleContentObject($name, (array) $conf, $TSkey, $this); @@ -671,7 +711,8 @@ } } } - if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content); + if ($GLOBALS['TT']->LR) + $GLOBALS['TT']->pull($content); } // Increasing on exit... $GLOBALS['TSFE']->cObjectDepthCounter++; @@ -680,10 +721,6 @@ - - - - /******************************************** * * Functions rendering content objects (cObjects) @@ -693,67 +730,71 @@ /** * Rendering the cObject, HTML * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=349&cHash=d3fd0c70b4 */ - function HTML($conf) { - return $this->stdWrap($conf['value'],$conf['value.']); + function HTML($conf) { + return $this->stdWrap($conf['value'], $conf['value.']); } /** * Rendering the cObject, TEXT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=350&cHash=b49de28f83 */ - function TEXT($conf) { - return $this->stdWrap($conf['value'],$conf); + function TEXT($conf) { + return $this->stdWrap($conf['value'], $conf); } /** * Rendering the cObject, CLEARGIF * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=355&cHash=70c0f19915 */ - function CLEARGIF($conf) { - $w = $this->stdWrap($conf['width'],$conf['width.']); - $h = $this->stdWrap($conf['height'],$conf['height.']); + function CLEARGIF($conf) { + $w = $this->stdWrap($conf['width'], $conf['width.']); + $h = $this->stdWrap($conf['height'], $conf['height.']); $w = $w ? $w : 1; $h = $h ? $h : 1; $wrap = $conf['wrap'] ? $conf['wrap'] : '|
'; - $theValue = $this->wrap('getBorderAttr(' border="0"').' alt="" title="" />', $wrap); + $theValue = $this->wrap( + 'getBorderAttr(' border="0"') . ' alt="" title="" />', + $wrap + ); - return $this->stdWrap($theValue,$conf['stdWrap.']); + return $this->stdWrap($theValue, $conf['stdWrap.']); } /** * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @param string If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached) * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=351&cHash=a09db0329c */ - function COBJ_ARRAY($conf,$ext='') { + function COBJ_ARRAY($conf, $ext = '') { if (is_array($conf)) { $content = ''; - switch($ext) { - case 'INT': + switch ($ext) { + case 'INT' : $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash(); - $content .= ''; - $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array ( + $content .= ''; + $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array( 'file' => $conf['includeLibs'], 'conf' => $conf, 'cObj' => serialize($this), 'type' => 'COA' ); break; - default: + default : if ($this->checkIf($conf['if.'])) { $this->includeLibs($conf); $content = $this->cObjGet($conf); @@ -768,14 +809,14 @@ } return $content; } else { - $GLOBALS['TT']->setTSlogMessage('No elements in this content object array (COBJ_ARRAY, COA, COA_INT).', 2); + $GLOBALS['TT']->setTSlogMessage('No elements in this content object array(COBJ_ARRAY, COA, COA_INT).', 2); } } /** * Rendering the cObject, USER and USER_INT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @param string If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached) * @return string Output * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/8/22/ @@ -783,43 +824,43 @@ function USER($conf, $ext = '') { $content = ''; switch ($ext) { - case 'INT': + case 'INT' : $this->userObjectType = self::OBJECTTYPE_USER_INT; $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash(); - $content.=''; + $content .= ''; $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array( 'file' => $conf['includeLibs'], 'conf' => $conf, 'cObj' => serialize($this), 'type' => 'FUNC' ); - break; - default: - if ($this->userObjectType === false) { + break; + default : + if ($this->userObjectType === FALSE) { // Come here only if we are not called from $TSFE->INTincScript_process()! $this->userObjectType = self::OBJECTTYPE_USER; } $this->includeLibs($conf); $tempContent = $this->callUserFunction($conf['userFunc'], $conf, ''); if ($this->doConvertToUserIntObject) { - $this->doConvertToUserIntObject = false; + $this->doConvertToUserIntObject = FALSE; $content = $this->USER($conf, 'INT'); } else { $content .= $tempContent; } - break; + break; } - $this->userObjectType = false; + $this->userObjectType = FALSE; return $content; } /** * Retrieves a type of object called as USER or USER_INT. Object can detect their * type by using this call. It returns OBJECTTYPE_USER_INT or OBJECTTYPE_USER depending on the - * current object execution. In all other cases it will return false to indicate + * current object execution. In all other cases it will return FALSE to indicate * a call out of context. * - * @return mixed One of OBJECTTYPE_ class constants or false + * @return mixed One of OBJECTTYPE_ class constants or FALSE */ public function getUserObjectType() { return $this->userObjectType; @@ -832,43 +873,41 @@ */ public function convertToUserIntObject() { if ($this->userObjectType !== self::OBJECTTYPE_USER) { - $GLOBALS['TT']->setTSlogMessage('tslib_cObj::convertToUserIntObject() ' . - 'is called in the wrong context or for the wrong object type', 2); + $GLOBALS['TT']->setTSlogMessage('tslib_cObj::convertToUserIntObject() ' . 'is called in the wrong context or for the wrong object type', 2); + } else { + $this->doConvertToUserIntObject = TRUE; } - else { - $this->doConvertToUserIntObject = true; - } } /** * Rendering the cObject, FILE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=352&cHash=379c60f8bc */ - function FILE($conf) { - $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf, false))); - if ($conf['linkWrap']) { - $theValue = $this->linkWrap($theValue,$conf['linkWrap']); + function FILE($conf) { + $theValue = $this->fileResource($this->stdWrap($conf['file'], $conf['file.']), trim($this->getAltParam($conf, FALSE))); + if ($conf['linkWrap']) { + $theValue = $this->linkWrap($theValue, $conf['linkWrap']); } - return $this->wrap($theValue,$conf['wrap']); + return $this->wrap($theValue, $conf['wrap']); } /** * Rendering the cObject, IMAGE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=353&cHash=440681ea56 * @see cImage() */ - function IMAGE($conf) { - $content=''; - if ($this->checkIf($conf['if.'])) { - $theValue = $this->cImage($conf['file'],$conf); - if ($conf['stdWrap.']) { - $theValue = $this->stdWrap($theValue,$conf['stdWrap.']); + function IMAGE($conf) { + $content = ''; + if ($this->checkIf($conf['if.'])) { + $theValue = $this->cImage($conf['file'], $conf); + if ($conf['stdWrap.']) { + $theValue = $this->stdWrap($theValue, $conf['stdWrap.']); } return $theValue; } @@ -877,204 +916,211 @@ /** * Rendering the cObject, IMG_RESOURCE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=354&cHash=46f9299706 * @see getImgResource() */ - function IMG_RESOURCE($conf) { - $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'],$conf['file.']); - return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3],$conf['stdWrap.']); + function IMG_RESOURCE($conf) { + $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'], $conf['file.']); + return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3], $conf['stdWrap.']); } /** * Rendering the cObject, IMGTEXT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1 */ function IMGTEXT($conf) { - $content=''; - if (is_array($conf['text.'])) { - $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content + $content = ''; + if (is_array($conf['text.'])) { + $content .= $this->stdWrap($this->cObjGet($conf['text.'], 'text.'), $conf['text.']); // this gets the surrounding content } - $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images - if ($imgList) { - $imgs = t3lib_div::trimExplode(',',$imgList); - $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.'])); + $imgList = trim($this->stdWrap($conf['imgList'], $conf['imgList.'])); // gets images + if ($imgList) { + $imgs = t3lib_div::trimExplode(',', $imgList); + $imgStart = intval($this->stdWrap($conf['imgStart'], $conf['imgStart.'])); - $imgCount= count($imgs)-$imgStart; + $imgCount = count($imgs) - $imgStart; - $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.'])); - if ($imgMax) { - $imgCount = t3lib_div::intInRange($imgCount,0,$imgMax); // reduces the number of images. + $imgMax = intval($this->stdWrap($conf['imgMax'], $conf['imgMax.'])); + if ($imgMax) { + $imgCount = t3lib_div::intInRange($imgCount, 0, $imgMax); // reduces the number of images. } - $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']); + $imgPath = $this->stdWrap($conf['imgPath'], $conf['imgPath.']); // initialisation - $caption=''; + $caption = ''; $captionArray = array(); - if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) { - $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); // global caption, no splitting + if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) { + $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']); // global caption, no splitting } - if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) { + if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) { $legacyCaptionSplit = 1; $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']); - if (!$capSplit) {$capSplit=LF;} - $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject')); + if (!$capSplit) { + $capSplit = LF; + } + $captionArray = explode($capSplit, $this->cObjGetSingle( + $conf['captionSplit.']['cObject'], + $conf['captionSplit.']['cObject.'], + 'captionSplit.cObject') + ); foreach ($captionArray as $ca_key => $ca_val) { $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']); } } - $tablecode=''; - $position=$this->stdWrap($conf['textPos'],$conf['textPos.']); + $tablecode = ''; + $position = $this->stdWrap($conf['textPos'], $conf['textPos.']); - $tmppos = $position&7; - $contentPosition = $position&24; + $tmppos = $position & 7; + $contentPosition = $position & 24; $align = $this->align[$tmppos]; - $cap = ($caption)?1:0; - $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.'])); - if (!$conf['textMargin_outOfText'] && $contentPosition<16) { - $txtMarg=0; + $cap = ($caption) ? 1 : 0; + $txtMarg = intval($this->stdWrap($conf['textMargin'], $conf['textMargin.'])); + if (!$conf['textMargin_outOfText'] && $contentPosition < 16) { + $txtMarg = 0; } - $cols = intval($this->stdWrap($conf['cols'],$conf['cols.'])); - $rows = intval($this->stdWrap($conf['rows'],$conf['rows.'])); - $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.'])); - $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.'])); + $cols = intval($this->stdWrap($conf['cols'], $conf['cols.'])); + $rows = intval($this->stdWrap($conf['rows'], $conf['rows.'])); + $colspacing = intval($this->stdWrap($conf['colSpace'], $conf['colSpace.'])); + $rowspacing = intval($this->stdWrap($conf['rowSpace'], $conf['rowSpace.'])); - $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0; - $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']); - $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.'])); + $border = intval($this->stdWrap($conf['border'], $conf['border.'])) ? 1 : 0; + $borderColor = $this->stdWrap($conf['borderCol'], $conf['borderCol.']); + $borderThickness = intval($this->stdWrap($conf['borderThick'], $conf['borderThick.'])); - $borderColor=$borderColor?$borderColor:'black'; - $borderThickness=$borderThickness?$borderThickness:1; + $borderColor = $borderColor ? $borderColor : 'black'; + $borderThickness = $borderThickness ? $borderThickness : 1; - $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']); + $caption_align = $this->stdWrap($conf['captionAlign'], $conf['captionAlign.']); if (!$caption_align) { $caption_align = $align; } // generate cols $colCount = ($cols > 1) ? $cols : 1; - if ($colCount > $imgCount) {$colCount = $imgCount;} + if ($colCount > $imgCount) { + $colCount = $imgCount; + } $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount; // generate rows - if ($rows>1) { + if ($rows > 1) { $rowCount = $rows; - if ($rowCount > $imgCount) {$rowCount = $imgCount;} - $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount; + if ($rowCount > $imgCount) { + $rowCount = $imgCount; + } + $colCount = ($rowCount > 1) ? ceil($imgCount / $rowCount) : $imgCount; } // max Width - $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.'])); - $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.'])); + $colRelations = trim($this->stdWrap($conf['colRelations'], $conf['colRelations.'])); + $maxW = intval($this->stdWrap($conf['maxW'], $conf['maxW.'])); - $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.'])); - if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max... - $maxWInText = round($maxW/2); + $maxWInText = intval($this->stdWrap($conf['maxWInText'], $conf['maxWInText.'])); + if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max... + $maxWInText = round($maxW / 2); } - if ($maxWInText && $contentPosition>=16) { // inText + if ($maxWInText && $contentPosition >= 16) { // inText $maxW = $maxWInText; } - if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column -/* debug($border*$borderThickness*2); - debug($maxW); - debug($colspacing); - debug(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)); - */ - $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount); + if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column + $maxW = ceil(($maxW - $colspacing * ($colCount - 1) - $colCount * $border * $borderThickness * 2) / $colCount); } // create the relation between rows - $colMaxW = Array(); - if ($colRelations) { - $rel_parts = explode(':',$colRelations); + $colMaxW = array(); + if ($colRelations) { + $rel_parts = explode(':', $colRelations); $rel_total = 0; - for ($a=0;$a<$colCount;$a++) { + for ($a = 0; $a < $colCount; $a++) { $rel_parts[$a] = intval($rel_parts[$a]); - $rel_total+= $rel_parts[$a]; + $rel_total += $rel_parts[$a]; } - if ($rel_total) { - for ($a=0;$a<$colCount;$a++) { - $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]); + if ($rel_total) { + for ($a = 0; $a < $colCount; $a++) { + $colMaxW[$a] = round(($maxW * $colCount) / $rel_total * $rel_parts[$a]); } - if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) { // The difference in size between the largest and smalles must be within a factor of ten. - $colMaxW = Array(); + if (min($colMaxW) <= 0 || max($rel_parts) / min($rel_parts) > 10) { // The difference in size between the largest and smalles must be within a factor of ten. + $colMaxW = array(); } } } - $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.'])); - $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.'])); - $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.'])); + $image_compression = intval($this->stdWrap($conf['image_compression'], $conf['image_compression.'])); + $image_effects = intval($this->stdWrap($conf['image_effects'], $conf['image_effects.'])); + $image_frames = intval($this->stdWrap($conf['image_frames.']['key'], $conf['image_frames.']['key.'])); // fetches pictures - $splitArr=array(); - $splitArr['imgObjNum']=$conf['imgObjNum']; - $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount); + $splitArr = array(); + $splitArr['imgObjNum'] = $conf['imgObjNum']; + $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr, $imgCount); // EqualHeight - $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.'])); - if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's + $equalHeight = intval($this->stdWrap($conf['equalH'], $conf['equalH.'])); + if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder'); $gifCreator->init(); - $relations = Array(); - $relations_cols = Array(); - $totalMaxW = $maxW*$colCount; - for($a=0;$a<$imgCount;$a++) { - $imgKey = $a+$imgStart; - $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]); - $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height - if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error. - $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration. + $relations = array(); + $relations_cols = array(); + $totalMaxW = $maxW * $colCount; + for ($a = 0; $a < $imgCount; $a++) { + $imgKey = $a + $imgStart; + $imgInfo = $gifCreator->getImageDimensions($imgPath . $imgs[$imgKey]); + $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height + if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error. + $relations_cols[floor($a / $colCount)] += $imgInfo[0] / $relations[$a]; // counts the total width of the row with the new height taken into consideration. } } } - $imageRowsFinalWidths = Array(); // contains the width of every image row - $imageRowsMaxHeights = Array(); - $imgsTag=array(); - $origImages=array(); - for($a=0;$a<$imgCount;$a++) { + $imageRowsFinalWidths = array(); // contains the width of every image row + $imageRowsMaxHeights = array(); + $imgsTag = array(); + $origImages = array(); + for ($a = 0; $a < $imgCount; $a++) { $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a; $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a; - $imgKey = $a+$imgStart; - $totalImagePath = $imgPath.$imgs[$imgKey]; + $imgKey = $a + $imgStart; + $totalImagePath = $imgPath . $imgs[$imgKey]; $this->data[$this->currentValKey] = $totalImagePath; $imgObjNum = intval($splitArr[$a]['imgObjNum']); - $imgConf = $conf[$imgObjNum.'.']; + $imgConf = $conf[$imgObjNum . '.']; - if ($equalHeight) { + if ($equalHeight) { $scale = 1; - if ($totalMaxW) { - $rowTotalMaxW = $relations_cols[floor($a/$colCount)]; - if ($rowTotalMaxW > $totalMaxW) { + if ($totalMaxW) { + $rowTotalMaxW = $relations_cols[floor($a / $colCount)]; + if ($rowTotalMaxW > $totalMaxW) { $scale = $rowTotalMaxW / $totalMaxW; } } // transfer info to the imageObject. Please note, that - $imgConf['file.']['height'] = round($equalHeight/$scale); + $imgConf['file.']['height'] = round($equalHeight / $scale); - unset($imgConf['file.']['width']); - unset($imgConf['file.']['maxW']); - unset($imgConf['file.']['maxH']); - unset($imgConf['file.']['minW']); - unset($imgConf['file.']['minH']); - unset($imgConf['file.']['width.']); - unset($imgConf['file.']['maxW.']); - unset($imgConf['file.']['maxH.']); - unset($imgConf['file.']['minW.']); - unset($imgConf['file.']['minH.']); - $maxW = 0; // setting this to zero, so that it doesn't disturb + unset( + $imgConf['file.']['width'], + $imgConf['file.']['maxW'], + $imgConf['file.']['maxH'], + $imgConf['file.']['minW'], + $imgConf['file.']['minH'], + $imgConf['file.']['width.'], + $imgConf['file.']['maxW.'], + $imgConf['file.']['maxH.'], + $imgConf['file.']['minW.'], + $imgConf['file.']['minH.'] + ); + $maxW = 0; // setting this to zero, so that it doesn't disturb } if ($maxW) { - if (count($colMaxW)) { - $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)]; + if (count($colMaxW)) { + $imgConf['file.']['maxW'] = $colMaxW[($a % $colCount)]; } else { $imgConf['file.']['maxW'] = $maxW; } @@ -1082,23 +1128,23 @@ // Image Object supplied: if (is_array($imgConf)) { - if ($this->image_effects[$image_effects]) { - $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects]; + if ($this->image_effects[$image_effects]) { + $imgConf['file.']['params'] .= ' ' . $this->image_effects[$image_effects]; } - if ($image_frames) { - if (is_array($conf['image_frames.'][$image_frames.'.'])) { - $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.']; + if ($image_frames) { + if (is_array($conf['image_frames.'][$image_frames . '.'])) { + $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames . '.']; } } - if ($image_compression && $imgConf['file']!='GIFBUILDER') { - if ($image_compression==1) { + if ($image_compression && $imgConf['file'] != 'GIFBUILDER') { + if ($image_compression == 1) { $tempImport = $imgConf['file.']['import']; $tempImport_dot = $imgConf['file.']['import.']; unset($imgConf['file.']); $imgConf['file.']['import'] = $tempImport; $imgConf['file.']['import.'] = $tempImport_dot; } elseif (isset($this->image_compression[$image_compression])) { - $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params']; + $imgConf['file.']['params'] .= ' ' . $this->image_compression[$image_compression]['params']; $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext']; unset($imgConf['file.']['ext.']); } @@ -1129,178 +1175,207 @@ $imgsTag[$imgKey] = $this->IMAGE($imgConf); // Store the original filepath - $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo; + $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo; - $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0]; - if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) { - $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1]; + $imageRowsFinalWidths[floor($a / $colCount)] += $GLOBALS['TSFE']->lastImageInfo[0]; + if ($GLOBALS['TSFE']->lastImageInfo[1] > $imageRowsMaxHeights[floor($a / $colCount)]) { + $imageRowsMaxHeights[floor($a / $colCount)] = $GLOBALS['TSFE']->lastImageInfo[1]; } } // calculating the tableWidth: // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth. - $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2; + $tableWidth = max($imageRowsFinalWidths) + $colspacing * ($colCount - 1) + $colCount * $border * $borderThickness * 2; // make table for pictures - $index=$imgStart; + $index = $imgStart; - $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']); - $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']); - if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time. + $noRows = $this->stdWrap($conf['noRows'], $conf['noRows.']); + $noCols = $this->stdWrap($conf['noCols'], $conf['noCols.']); + if ($noRows) { + $noCols = 0; + } // noRows overrides noCols. They cannot exist at the same time. if ($equalHeight) { - $noCols=1; - $noRows=0; + $noCols = 1; + $noRows = 0; } - $rowCount_temp=1; - $colCount_temp=$colCount; - if ($noRows) { + $rowCount_temp = 1; + $colCount_temp = $colCount; + if ($noRows) { $rowCount_temp = $rowCount; - $rowCount=1; + $rowCount = 1; } - if ($noCols) { - $colCount=1; + if ($noCols) { + $colCount = 1; } // col- and rowspans calculated - $colspan = (($colspacing) ? $colCount*2-1 : $colCount); - $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap; + $colspan = (($colspacing) ? $colCount * 2 - 1 : $colCount); + $rowspan = (($rowspacing) ? $rowCount * 2 - 1 : $rowCount) + $cap; // Edit icons: - $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : ''; + $editIconsHTML = $conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin + ? $this->editIcons('', $conf['editIcons'], $conf['editIcons.']) + : ''; // strech out table: - $tablecode=''; - $flag=0; - if ($conf['noStretchAndMarginCells']!=1) { - $tablecode.=''; - if ($txtMarg && $align=='right') { // If right aligned, the textborder is added on the right side - $tablecode.=''.($editIconsHTML?'
'.$editIconsHTML:'').''; - $editIconsHTML=''; - $flag=1; + $tablecode = ''; + $flag = 0; + if ($conf['noStretchAndMarginCells'] != 1) { + $tablecode .= ''; + if ($txtMarg && $align == 'right') { // If right aligned, the textborder is added on the right side + $tablecode .= '' . + ($editIconsHTML ? '
' . $editIconsHTML : '') . ''; + $editIconsHTML = ''; + $flag = 1; } - $tablecode.=''; - if ($txtMarg && $align=='left') { // If left aligned, the textborder is added on the left side - $tablecode.=''.($editIconsHTML?'
'.$editIconsHTML:'').''; - $editIconsHTML=''; - $flag=1; + $tablecode .= ''; + if ($txtMarg && $align == 'left') { // If left aligned, the textborder is added on the left side + $tablecode .= '' . + ($editIconsHTML ? '
' . $editIconsHTML : '') . ''; + $editIconsHTML = ''; + $flag = 1; } - if ($flag) $tableWidth+=$txtMarg+1; - // $tableWidth=0; - $tablecode.=''; + if ($flag) { + $tableWidth += $txtMarg + 1; + } + $tablecode .= ''; } // draw table - for ($c=0;$c<$rowCount;$c++) { // Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows! - if ($c && $rowspacing) { // If this is NOT the first time in the loop AND if space is required, a row-spacer is added. In case of "noRows" rowspacing is done further down. - $tablecode.='getBorderAttr(' border="0"').' alt="" title="" />'; + for ($c = 0; $c < $rowCount; $c++) { // Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows! + if ($c && $rowspacing) { // If this is NOT the first time in the loop AND if space is required, a row-spacer is added. In case of "noRows" rowspacing is done further down. + $tablecode .= 'getBorderAttr(' border="0"') . ' alt="" title="" />'; } - $tablecode.=''; // starting row - for ($b=0; $b<$colCount_temp; $b++) { // Looping through the columns - if ($b && $colspacing) { // If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell. - if (!$noCols) { - $tablecode.='getBorderAttr(' border="0"').' alt="" title="" />'; + $tablecode .= ''; // starting row + for ($b = 0; $b < $colCount_temp; $b++) { // Looping through the columns + if ($b && $colspacing) { // If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell. + if (!$noCols) { + $tablecode .= 'getBorderAttr(' border="0"') . ' alt="" title="" />'; } else { - $colSpacer='getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />'; - $colSpacer=''.$colSpacer.''; // added 160301, needed for the new "noCols"-table... - $tablecode.=$colSpacer; + $colSpacer = 'getBorderAttr(' border="0"') . ' align="' . + ($border ? 'left' : 'top') . '" alt="" title="" />'; + $colSpacer = '' . $colSpacer . ''; // added 160301, needed for the new "noCols"-table... + $tablecode .= $colSpacer; } } - if (!$noCols || ($noCols && !$b)) { - $tablecode.=''; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image. - if ($noCols) {$tablecode.='';} // In case of "noCols" we must set the table-tag that surrounds the images in the row. + if (!$noCols || ($noCols && !$b)) { + $tablecode .= '';} // If noCols, put in table cell. - $tablecode.=$imageHTML; + $imageHTML = $imgsTag[$imgIndex] . '
'; + $Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : ''; // this is necessary if the tablerows are supposed to space properly together! "noRows" is excluded because else the images "layer" together. + if ($border) { + $imageHTML = '
'; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image. + if ($noCols) { + $tablecode .= ''; + } // In case of "noCols" we must set the table-tag that surrounds the images in the row. } - for ($a=0;$a<$rowCount_temp;$a++) { // Looping through the rows IF "noRows" is set. "noRows" means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set. - $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex; // register previous imgIndex - $imgIndex = $index+$a*$colCount_temp; + for ($a = 0; $a < $rowCount_temp; $a++) { // Looping through the rows IF "noRows" is set. "noRows" means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set. + $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex; // register previous imgIndex + $imgIndex = $index + $a * $colCount_temp; $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex; - if ($imgsTag[$imgIndex]) { - if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop - $tablecode.= '
'; + if ($imgsTag[$imgIndex]) { + if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop + $tablecode .= '
'; } - if ($legacyCaptionSplit) { + if ($legacyCaptionSplit) { $thisCaption = $captionArray[$imgIndex]; - } else if ($conf['captionSplit'] || $conf['imageTextSplit']) { + } else if ($conf['captionSplit'] || $conf['imageTextSplit']) { $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']); } - $imageHTML = $imgsTag[$imgIndex].'
'; - $Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : ''; // this is necessary if the tablerows are supposed to space properly together! "noRows" is excluded because else the images "layer" together. - if ($border) {$imageHTML='
'.$imageHTML.'
';} - $imageHTML.=$editIconsHTML; - $editIconsHTML=''; - $imageHTML.=$thisCaption; // Adds caption. - if ($noCols) {$imageHTML='
'.$imageHTML.'
' . $imageHTML . '
'; + } + $imageHTML .= $editIconsHTML; + $editIconsHTML = ''; + $imageHTML .= $thisCaption; // Adds caption. + if ($noCols) { + $imageHTML = '' . $imageHTML . ''; + } // If noCols, put in table cell. + $tablecode .= $imageHTML; } } $index++; - if (!$noCols || ($noCols && $b+1==$colCount_temp)) { - if ($noCols) {$tablecode.='';} // In case of "noCols" we must finish the table that surrounds the images in the row. - $tablecode.=''; // Ending the cell. In case of "noCols" the cell holds all pictures! + if (!$noCols || ($noCols && $b + 1 == $colCount_temp)) { + if ($noCols) { + $tablecode .= ''; + } // In case of "noCols" we must finish the table that surrounds the images in the row. + $tablecode .= ''; // Ending the cell. In case of "noCols" the cell holds all pictures! } } - $tablecode.=''; // ending row + $tablecode .= ''; // ending row } - if ($c) { - switch ($contentPosition) { - case '0': // above - case '8': // below - switch ($align) { // These settings are needed for Firefox - case 'center': + if ($c) { + switch ($contentPosition) { + case '0' : // above + case '8' : // below + switch ($align) { // These settings are needed for Firefox + case 'center' : $table_align = 'margin-left: auto; margin-right: auto'; break; - case 'right': + case 'right' : $table_align = 'margin-left: auto; margin-right: 0px'; break; - default: // Most of all: left + default : // Most of all: left $table_align = 'margin-left: 0px; margin-right: auto'; } - $table_align = 'style="'.$table_align.'"'; + $table_align = 'style="' . $table_align . '"'; break; - case '16': // in text - $table_align = 'align="'.$align.'"'; + case '16' : // in text + $table_align = 'align="' . $align . '"'; break; - default: + default : $table_align = ''; } // Table-tag is inserted - $tablecode = ''.$tablecode; - if ($editIconsHTML) { // IF this value is not long since reset. - $tablecode.=''.$editIconsHTML.''; - $editIconsHTML=''; + $tablecode = '' . $tablecode; + if ($editIconsHTML) { // IF this value is not long since reset. + $tablecode .= '' . $editIconsHTML . ''; + $editIconsHTML = ''; } - if ($cap) { - $tablecode.=''.$caption.''; + if ($cap) { + $tablecode .= '' . $caption . ''; } - $tablecode.=''; - if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);} + $tablecode .= ''; + if ($conf['tableStdWrap.']) { + $tablecode = $this->stdWrap($tablecode, $conf['tableStdWrap.']); + } } - $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.'])); - switch ($contentPosition) { - case '0': // above - $output= '
'.$tablecode.'
'.$this->wrapSpace($content, $spaceBelowAbove.'|0'); + $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'], $conf['spaceBelowAbove.'])); + switch ($contentPosition) { + case '0' : // above + $output = '
' . $tablecode . '
' . + $this->wrapSpace($content, $spaceBelowAbove . '|0'); break; - case '8': // below - $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'
'.$tablecode.'
'; + case '8' : // below + $output = $this->wrapSpace($content, '0|' . $spaceBelowAbove) . + '
' . $tablecode . '
'; break; - case '16': // in text - $output= $tablecode.$content; + case '16' : // in text + $output = $tablecode . $content; break; - case '24': // in text, no wrap + case '24' : // in text, no wrap $theResult = ''; - $theResult.= ''; - if ($align=='right') { - $theResult.= ''; + $theResult .= '
'.$content.''.$tablecode.'
'; + if ($align == 'right') { + $theResult .= ''; } else { - $theResult.= ''; + $theResult .= ''; } - $theResult.= '
' . $content . '' . $tablecode . ''.$tablecode.''.$content.'' . $tablecode . '' . $content . '
'; - $output= $theResult; + $theResult .= ''; + $output = $theResult; break; } } else { - $output= $content; + $output = $content; } if ($conf['stdWrap.']) { @@ -1313,59 +1388,59 @@ /** * Rendering the cObject, CONTENT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=356&cHash=9f3b5c6ba2 */ - function CONTENT($conf) { - $theValue=''; + function CONTENT($conf) { + $theValue = ''; $originalRec = $GLOBALS['TSFE']->currentRecord; - if ($originalRec) { // If the currentRecord is set, we register, that this record has invoked this function. It's should not be allowed to do this again then!! + if ($originalRec) { // If the currentRecord is set, we register, that this record has invoked this function. It's should not be allowed to do this again then!! $GLOBALS['TSFE']->recordRegister[$originalRec]++; } $conf['table'] = trim($this->stdWrap($conf['table'], $conf['table.'])); - if ($conf['table']=='pages' || substr($conf['table'],0,3)=='tt_' || substr($conf['table'],0,3)=='fe_' || substr($conf['table'],0,3)=='tx_' || substr($conf['table'],0,4)=='ttx_' || substr($conf['table'],0,5)=='user_' || substr($conf['table'],0,7)=='static_') { + if ($conf['table'] == 'pages' || substr($conf['table'], 0, 3) == 'tt_' || substr($conf['table'], 0, 3) == 'fe_' || substr($conf['table'], 0, 3) == 'tx_' || substr($conf['table'], 0, 4) == 'ttx_' || substr($conf['table'], 0, 5) == 'user_' || substr($conf['table'], 0, 7) == 'static_') { - $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table']; + $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<' . $conf['table']; $renderObjKey = $conf['renderObj'] ? 'renderObj' : ''; $renderObjConf = $conf['renderObj.']; - $slide = intval($conf['slide'])?intval($conf['slide']):0; - $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0; - $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false; - $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true; - $again = false; + $slide = intval($conf['slide']) ? intval($conf['slide']) : 0; + $slideCollect = intval($conf['slide.']['collect']) ? intval($conf['slide.']['collect']) : 0; + $slideCollectReverse = intval($conf['slide.']['collectReverse']) ? TRUE : FALSE; + $slideCollectFuzzy = $slideCollect ? (intval($conf['slide.']['collectFuzzy']) ? TRUE : FALSE) : TRUE; + $again = FALSE; do { - $res = $this->exec_getQuery($conf['table'],$conf['select.']); + $res = $this->exec_getQuery($conf['table'], $conf['select.']); if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { - $GLOBALS['TT']->setTSlogMessage($error,3); + $GLOBALS['TT']->setTSlogMessage($error, 3); } else { $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res); - $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res)); - $cObj =t3lib_div::makeInstance('tslib_cObj'); - $cObj->setParent($this->data,$this->currentRecord); - $this->currentRecordNumber=0; + $GLOBALS['TT']->setTSlogMessage('NUMROWS: ' . $GLOBALS['TYPO3_DB']->sql_num_rows($res)); + $cObj = t3lib_div::makeInstance('tslib_cObj'); + $cObj->setParent($this->data, $this->currentRecord); + $this->currentRecordNumber = 0; $cobjValue = ''; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { // Versioning preview: - $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row,TRUE); + $GLOBALS['TSFE']->sys_page->versionOL($conf['table'], $row, TRUE); // Language overlay: if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) { - $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL); + $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); } if (is_array($row)) { // Might be unset in the sys_language_contentOL - if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) { + if (!$GLOBALS['TSFE']->recordRegister[$conf['table'] . ':' . $row['uid']]) { $this->currentRecordNumber++; $cObj->parentRecordNumber = $this->currentRecordNumber; - $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid']; + $GLOBALS['TSFE']->currentRecord = $conf['table'] . ':' . $row['uid']; $this->lastChanged($row['tstamp']); - $cObj->start($row,$conf['table']); + $cObj->start($row, $conf['table']); $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey); $cobjValue .= $tmpValue; } @@ -1374,59 +1449,61 @@ $GLOBALS['TYPO3_DB']->sql_free_result($res); } if ($slideCollectReverse) { - $theValue = $cobjValue.$theValue; + $theValue = $cobjValue . $theValue; } else { $theValue .= $cobjValue; } - if ($slideCollect>0) { + if ($slideCollect > 0) { $slideCollect--; } if ($slide) { - if ($slide>0) { + if ($slide > 0) { $slide--; } $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']); - $again = strlen($conf['select.']['pidInList'])?true:false; + $again = strlen($conf['select.']['pidInList']) ? TRUE : FALSE; } - } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect))); + } while ($again && (($slide && !strlen($tmpValue) && $slideCollectFuzzy) || ($slide && $slideCollect))); } - $theValue = $this->wrap($theValue,$conf['wrap']); - if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']); + $theValue = $this->wrap($theValue, $conf['wrap']); + if ($conf['stdWrap.']) + $theValue = $this->stdWrap($theValue, $conf['stdWrap.']); - $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore + $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore return $theValue; } /** * Rendering the cObject, RECORDS * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=357&cHash=303e959472 */ - function RECORDS($conf) { - $theValue=''; + function RECORDS($conf) { + $theValue = ''; $originalRec = $GLOBALS['TSFE']->currentRecord; - if ($originalRec) { // If the currentRecord is set, we register, that this record has invoked this function. It's should not be allowed to do this again then!! + if ($originalRec) { // If the currentRecord is set, we register, that this record has invoked this function. It's should not be allowed to do this again then!! $GLOBALS['TSFE']->recordRegister[$originalRec]++; } - $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']); + $conf['source'] = $this->stdWrap($conf['source'], $conf['source.']); if ($conf['tables'] && $conf['source']) { $allowedTables = $conf['tables']; - if (is_array($conf['conf.'])) { + if (is_array($conf['conf.'])) { foreach ($conf['conf.'] as $k => $v) { - if (substr($k,-1)!='.') $allowedTables.=','.$k; + if (substr($k, -1) != '.') + $allowedTables .= ',' . $k; } } $loadDB = t3lib_div::makeInstance('FE_loadDBGroup'); $loadDB->start($conf['source'], $allowedTables); foreach ($loadDB->tableArray as $table => $v) { - if (is_array($GLOBALS['TCA'][$table])) { - $loadDB->additionalWhere[$table]=$this->enableFields($table); + if (is_array($GLOBALS['TCA'][$table])) { + $loadDB->additionalWhere[$table] = $this->enableFields($table); } } $loadDB->getFromDB(); @@ -1434,75 +1511,84 @@ reset($loadDB->itemArray); $data = $loadDB->results; - $cObj =t3lib_div::makeInstance('tslib_cObj'); - $cObj->setParent($this->data,$this->currentRecord); - $this->currentRecordNumber=0; + $cObj = t3lib_div::makeInstance('tslib_cObj'); + $cObj->setParent($this->data, $this->currentRecord); + $this->currentRecordNumber = 0; $this->currentRecordTotal = count($loadDB->itemArray); foreach ($loadDB->itemArray as $val) { $row = $data[$val['table']][$val['id']]; // Versioning preview: - $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row); + $GLOBALS['TSFE']->sys_page->versionOL($val['table'], $row); // Language overlay: - if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) { - $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL); + if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) { + $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay( + $val['table'], + $row, + $GLOBALS['TSFE']->sys_language_content, + $GLOBALS['TSFE']->sys_language_contentOL + ); } - if (is_array($row)) { // Might be unset in the content overlay things... - if (!$conf['dontCheckPid']) { + if (is_array($row)) { // Might be unset in the content overlay things... + if (!$conf['dontCheckPid']) { $row = $this->checkPid($row['pid']) ? $row : ''; } - if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) { - $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table']; - $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : ''; - $renderObjConf = $conf['conf.'][$val['table'].'.']; + if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'] . ':' . $val['id']]) { + $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<' . $val['table']; + $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.' . $val['table'] : ''; + $renderObjConf = $conf['conf.'][$val['table'] . '.']; $this->currentRecordNumber++; - $cObj->parentRecordNumber=$this->currentRecordNumber; - $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id']; + $cObj->parentRecordNumber = $this->currentRecordNumber; + $GLOBALS['TSFE']->currentRecord = $val['table'] . ':' . $val['id']; $this->lastChanged($row['tstamp']); - $cObj->start($row,$val['table']); + $cObj->start($row, $val['table']); $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey); $theValue .= $tmpValue; - }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS'); + } } } } - if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']); - if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']); + if ($conf['wrap']) + $theValue = $this->wrap($theValue, $conf['wrap']); + if ($conf['stdWrap.']) + $theValue = $this->stdWrap($theValue, $conf['stdWrap.']); - $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore + $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore return $theValue; } /** * Rendering the cObject, HMENU * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=358&cHash=5400c1c06a */ - function HMENU($conf) { - $content=''; - if ($this->checkIf($conf['if.'])) { + function HMENU($conf) { + $content = ''; + if ($this->checkIf($conf['if.'])) { $cls = strtolower($conf[1]); - if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses,$cls)) { - if ($conf['special.']['value.']) { - $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']); + if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses, $cls)) { + if ($conf['special.']['value.']) { + $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']); } $GLOBALS['TSFE']->register['count_HMENU']++; - $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']=0; - $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array(); - $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']=array(); + $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = 0; + $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] = array(); + $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId'] = array(); - $menu = t3lib_div::makeInstance('tslib_'.$cls); + $menu = t3lib_div::makeInstance('tslib_' . $cls); $menu->parent_cObj = $this; $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1); $menu->makeMenu(); - $content.=$menu->writeMenu(); + $content .= $menu->writeMenu(); } - if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']); - if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']); + if ($conf['wrap']) + $content = $this->wrap($content, $conf['wrap']); + if ($conf['stdWrap.']) + $content = $this->stdWrap($content, $conf['stdWrap.']); } return $content; } @@ -1510,129 +1596,133 @@ /** * Rendering the cObject, CTABLE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=359&cHash=2e0065b4e7 */ - function CTABLE ($conf) { + function CTABLE($conf) { $controlTable = t3lib_div::makeInstance('tslib_controlTable'); - if ($conf['tableParams']) { + if ($conf['tableParams']) { $controlTable->tableParams = $conf['tableParams']; } // loads the pagecontent $controlTable->contentW = $conf['cWidth']; - // loads the menues if any - if (is_array($conf['c.'])) { - $controlTable->content = $this->cObjGet($conf['c.'],'c.'); + // loads the menues if any + if (is_array($conf['c.'])) { + $controlTable->content = $this->cObjGet($conf['c.'], 'c.'); $controlTable->contentTDparams = isset($conf['c.']['TDParams']) ? $conf['c.']['TDParams'] : 'valign="top"'; } - if (is_array($conf['lm.'])) { - $controlTable->lm = $this->cObjGet($conf['lm.'],'lm.'); + if (is_array($conf['lm.'])) { + $controlTable->lm = $this->cObjGet($conf['lm.'], 'lm.'); $controlTable->lmTDparams = isset($conf['lm.']['TDParams']) ? $conf['lm.']['TDParams'] : 'valign="top"'; } - if (is_array($conf['tm.'])) { - $controlTable->tm = $this->cObjGet($conf['tm.'],'tm.'); + if (is_array($conf['tm.'])) { + $controlTable->tm = $this->cObjGet($conf['tm.'], 'tm.'); $controlTable->tmTDparams = isset($conf['tm.']['TDParams']) ? $conf['tm.']['TDParams'] : 'valign="top"'; } - if (is_array($conf['rm.'])) { - $controlTable->rm = $this->cObjGet($conf['rm.'],'rm.'); + if (is_array($conf['rm.'])) { + $controlTable->rm = $this->cObjGet($conf['rm.'], 'rm.'); $controlTable->rmTDparams = isset($conf['rm.']['TDParams']) ? $conf['rm.']['TDParams'] : 'valign="top"'; } - if (is_array($conf['bm.'])) { - $controlTable->bm = $this->cObjGet($conf['bm.'],'bm.'); + if (is_array($conf['bm.'])) { + $controlTable->bm = $this->cObjGet($conf['bm.'], 'bm.'); $controlTable->bmTDparams = isset($conf['bm.']['TDParams']) ? $conf['bm.']['TDParams'] : 'valign="top"'; } - return $controlTable->start($conf['offset'],$conf['cMargins']); + return $controlTable->start($conf['offset'], $conf['cMargins']); } /** * Rendering the cObject, OTABLE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=360&cHash=02c9552d38 */ - function OTABLE ($conf) { + function OTABLE($conf) { $controlTable = t3lib_div::makeInstance('tslib_tableOffset'); - if ($conf['tableParams']) { + if ($conf['tableParams']) { $controlTable->tableParams = $conf['tableParams']; } - return $controlTable->start($this->cObjGet($conf),$conf['offset']); + return $controlTable->start($this->cObjGet($conf), $conf['offset']); } /** * Rendering the cObject, COLUMNS * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=361&cHash=7e4e228cad */ - function COLUMNS ($conf) { - $content=''; - if (is_array($conf) && $this->checkIf($conf['if.'])) { - $tdRowCount=0; - $tableParams = $conf['tableParams'] ? ' '.$conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"'; - $TDparams = $conf['TDparams'] ? ' '.$conf['TDparams']:' valign="top"'; - $rows = t3lib_div::intInRange($conf['rows'],2,20); + function COLUMNS($conf) { + $content = ''; + if (is_array($conf) && $this->checkIf($conf['if.'])) { + $tdRowCount = 0; + $tableParams = $conf['tableParams'] ? ' ' . $conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"'; + $TDparams = $conf['TDparams'] ? ' ' . $conf['TDparams'] : ' valign="top"'; + $rows = t3lib_div::intInRange($conf['rows'], 2, 20); $totalWidth = intval($conf['totalWidth']); - $columnWidth=0; + $columnWidth = 0; - $totalGapWidth=0; - $gapData = Array( - 'gapWidth' => $this->stdWrap($conf['gapWidth'],$conf['gapWidth.']), - 'gapBgCol' => $this->stdWrap($conf['gapBgCol'],$conf['gapBgCol.']), - 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'],$conf['gapLineThickness.']), - 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.']) + $totalGapWidth = 0; + $gapData = array( + 'gapWidth' => $this->stdWrap($conf['gapWidth'], $conf['gapWidth.']), + 'gapBgCol' => $this->stdWrap($conf['gapBgCol'], $conf['gapBgCol.']), + 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'], $conf['gapLineThickness.']), + 'gapLineCol' => $this->stdWrap($conf['gapLineCol'], $conf['gapLineCol.']), ); - $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1); + $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData, $rows - 1); foreach ($gapData as $val) { - $totalGapWidth+=intval($val['gapWidth']); + $totalGapWidth += intval($val['gapWidth']); } - if ($totalWidth) { - $columnWidth = ceil(($totalWidth-$totalGapWidth)/$rows); - $TDparams.=' width="'.$columnWidth.'"'; - $tableParams.=' width="'.$totalWidth.'"'; + if ($totalWidth) { + $columnWidth = ceil(($totalWidth - $totalGapWidth) / $rows); + $TDparams .= ' width="' . $columnWidth . '"'; + $tableParams .= ' width="' . $totalWidth . '"'; } else { - $TDparams.=' width="'.floor(100/$rows).'%"'; - $tableParams.=' width="100%"'; + $TDparams .= ' width="' . floor(100 / $rows) . '%"'; + $tableParams .= ' width="100%"'; } - for ($a=1;$a<=$rows;$a++) { + for ($a = 1; $a <= $rows; $a++) { $tdRowCount++; - $content.=''; - $content.=$this->cObjGetSingle($conf[$a],$conf[$a.'.'], $a); - $content.=''; - if ($a < $rows) { - $gapConf = $gapData[($a-1)]; + $content .= ''; + $content .= $this->cObjGetSingle($conf[$a], $conf[$a . '.'], $a); + $content .= ''; + if ($a < $rows) { + $gapConf = $gapData[($a - 1)]; $gapWidth = intval($gapConf['gapWidth']); - if ($gapWidth) { - $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="'.$gapConf['gapBgCol'].'"' : ''; + if ($gapWidth) { + $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="' . $gapConf['gapBgCol'] . '"' : ''; $gapLine = intval($gapConf['gapLineThickness']); - if ($gapLine) { - $gapSurround = t3lib_div::intInRange(($gapWidth-$gapLine)/2, 1, 1000); - // right gap - $content.=''; + if ($gapLine) { + $gapSurround = t3lib_div::intInRange(($gapWidth - $gapLine) / 2, 1, 1000); + // right gap + $content .= ''; $tdRowCount++; - // line: - $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="'.$gapConf['gapLineCol'].'"' : ' bgcolor="black"'; - $content.=''; + // line: + $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="' . $gapConf['gapLineCol'] . '"' : ' bgcolor="black"'; + $content .= ''; $tdRowCount++; - // left gap - $content.=''; + // left gap + $content .= ''; $tdRowCount++; } else { - $content.=''; + $content .= ''; $tdRowCount++; } } } } - $content = ''.$content.''; - $content = ''.$content.''; - $content.= $this->cObjGetSingle($conf['after'],$conf['after.'], 'after'); - if ($conf['stdWrap.']) { - $content = $this->stdWrap($content,$conf['stdWrap.']); + $content = '' . $content . ''; + $content = '' . $content . ''; + $content .= $this->cObjGetSingle($conf['after'], $conf['after.'], 'after'); + if ($conf['stdWrap.']) { + $content = $this->stdWrap($content, $conf['stdWrap.']); } } return $content; @@ -1641,23 +1731,30 @@ /** * Rendering the cObject, HRULER * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=362&cHash=2a462aa084 */ - function HRULER ($conf) { - $lineThickness = t3lib_div::intInRange($this->stdWrap($conf['lineThickness'],$conf['lineThickness.']),1,50); + function HRULER($conf) { + $lineThickness = t3lib_div::intInRange($this->stdWrap($conf['lineThickness'], $conf['lineThickness.']), 1, 50); $lineColor = $conf['lineColor'] ? $conf['lineColor'] : 'black'; $spaceBefore = intval($conf['spaceLeft']); $spaceAfter = intval($conf['spaceRight']); $tableWidth = $conf['tableWidth'] ? $conf['tableWidth'] : '99%'; - $content=''; + $content = ''; - $content.=''; - if ($spaceBefore) {$content.=''; } - $content.=''; - if ($spaceAfter) {$content.=''; } - $content.='
'; + $content .= ''; + if ($spaceBefore) { + $content .= ''; + } + $content .= ''; + if ($spaceAfter) { + $content .= ''; + } + $content .= '
'; $content = $this->stdWrap($content, $conf['stdWrap.']); return $content; @@ -1666,22 +1763,24 @@ /** * Rendering the cObject, CASE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=364&cHash=cffedd09e3 */ - function CASEFUNC ($conf){ - $content=''; - if ($this->checkIf($conf['if.'])) { - if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);} - $key = $this->stdWrap($conf['key'],$conf['key.']); - $key = strlen($conf[$key]) ? $key : 'default'; - $name = $conf[$key]; - $theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key); - if ($conf['stdWrap.']) { - $theValue = $this->stdWrap($theValue,$conf['stdWrap.']); - } - return $theValue; + function CASEFUNC($conf) { + $content = ''; + if ($this->checkIf($conf['if.'])) { + if ($conf['setCurrent'] || $conf['setCurrent.']) { + $this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']); + } + $key = $this->stdWrap($conf['key'], $conf['key.']); + $key = strlen($conf[$key]) ? $key : 'default'; + $name = $conf[$key]; + $theValue = $this->cObjGetSingle($name, $conf[$key . '.'], $key); + if ($conf['stdWrap.']) { + $theValue = $this->stdWrap($theValue, $conf['stdWrap.']); + } + return $theValue; } } @@ -1689,24 +1788,24 @@ * Rendering the cObject, LOAD_REGISTER and RESTORE_REGISTER * NOTICE: This cObject does NOT return any content since it just sets internal data based on the TypoScript properties. * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @param string If "RESTORE_REGISTER" then the cObject rendered is "RESTORE_REGISTER", otherwise "LOAD_REGISTER" * @return string Empty string (the cObject only sets internal data!) * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=365&cHash=4935524e2e * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=366&cHash=4f9485e8cc */ - function LOAD_REGISTER($conf,$name) { - if ($name=='RESTORE_REGISTER') { + function LOAD_REGISTER($conf, $name) { + if ($name == 'RESTORE_REGISTER') { $GLOBALS['TSFE']->register = array_pop($GLOBALS['TSFE']->registerStack); } else { - array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register); - if (is_array($conf)) { + array_push($GLOBALS['TSFE']->registerStack, $GLOBALS['TSFE']->register); + if (is_array($conf)) { foreach ($conf as $theKey => $theValue) { - if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)])) { // Only if 1) the property is set but not the value itself, 2) the value and/or any property - if (strstr($theKey,'.')) { - $theKey = substr($theKey,0,-1); + if (!strstr($theKey, '.') || !isset($conf[substr($theKey, 0, -1)])) { // Only if 1) the property is set but not the value itself, 2) the value and/or any property + if (strstr($theKey, '.')) { + $theKey = substr($theKey, 0, -1); } - $GLOBALS['TSFE']->register[$theKey] = $this->stdWrap($conf[$theKey],$conf[$theKey.'.']); + $GLOBALS['TSFE']->register[$theKey] = $this->stdWrap($conf[$theKey], $conf[$theKey . '.']); } } } @@ -1729,55 +1828,57 @@ * * If $formData is an array the value of $conf['data'] is ignored. * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @param array Alternative formdata overriding whatever comes from TypoScript * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=367&cHash=bbc518d930 */ - function FORM($conf,$formData='') { - $content=''; + function FORM($conf, $formData = '') { + $content = ''; if (is_array($formData)) { $dataArr = $formData; } else { - $data = $this->stdWrap($conf['data'],$conf['data.']); + $data = $this->stdWrap($conf['data'], $conf['data.']); // Clearing dataArr $dataArr = array(); // Getting the original config - if (trim($data)) { - $data = str_replace(LF,'||',$data); - $dataArr = explode('||',$data); + if (trim($data)) { + $data = str_replace(LF, '||', $data); + $dataArr = explode('||', $data); } // Adding the new dataArray config form: - if (is_array($conf['dataArray.'])) { // dataArray is supplied + if (is_array($conf['dataArray.'])) { // dataArray is supplied $sKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE); - foreach ($sKeyArray as $theKey) { - $dAA = $conf['dataArray.'][$theKey.'.']; - if (is_array($dAA)) { + foreach ($sKeyArray as $theKey) { + $dAA = $conf['dataArray.'][$theKey . '.']; + if (is_array($dAA)) { $temp = array(); - list($temp[0]) = explode('|',$dAA['label.'] ? $this->stdWrap($dAA['label'],$dAA['label.']) : $dAA['label']); - list($temp[1]) = explode('|',$dAA['type']); + list ($temp[0]) = explode('|', $dAA['label.'] ? $this->stdWrap($dAA['label'], $dAA['label.']) : $dAA['label']); + list ($temp[1]) = explode('|', $dAA['type']); if ($dAA['required']) { - $temp[1] = '*'.$temp[1]; + $temp[1] = '*' . $temp[1]; } - list($temp[2]) = explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']); - // If value Array is set, then implode those values. + list ($temp[2]) = explode('|', $dAA['value.'] ? $this->stdWrap($dAA['value'], $dAA['value.']) : $dAA['value']); + // If value array is set, then implode those values. if (is_array($dAA['valueArray.'])) { $temp_accum = array(); foreach ($dAA['valueArray.'] as $dAKey_vA => $dAA_vA) { - if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) { - $temp_vA=array(); - list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']); - if ($dAA_vA['selected']) {$temp_vA[0]='*'.$temp_vA[0];} - list($temp_vA[1])= explode(',',$dAA_vA['value']); + if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA) . '.', $dAKey_vA)) { + $temp_vA = array(); + list ($temp_vA[0]) = explode('=', $dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'], $dAA_vA['label.']) : $dAA_vA['label']); + if ($dAA_vA['selected']) { + $temp_vA[0] = '*' . $temp_vA[0]; + } + list ($temp_vA[1]) = explode(',', $dAA_vA['value']); } - $temp_accum[] = implode('=',$temp_vA); + $temp_accum[] = implode('=', $temp_vA); } - $temp[2] = implode(',',$temp_accum); + $temp[2] = implode(',', $temp_accum); } - list($temp[3]) = explode('|',$dAA['specialEval.'] ? $this->stdWrap($dAA['specialEval'],$dAA['specialEval.']) : $dAA['specialEval']); + list ($temp[3]) = explode('|', $dAA['specialEval.'] ? $this->stdWrap($dAA['specialEval'], $dAA['specialEval.']) : $dAA['specialEval']); // adding the form entry to the dataArray - $dataArr[] = implode('|',$temp); + $dataArr[] = implode('|', $temp); } } } @@ -1785,18 +1886,18 @@ $attachmentCounter = ''; $hiddenfields = ''; - $fieldlist = Array(); - $propertyOverride = Array(); - $fieldname_hashArray = Array(); + $fieldlist = array(); + $propertyOverride = array(); + $fieldname_hashArray = array(); $cc = 0; - $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype); + $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype); // Formname if ($conf['formName']) { $formname = $this->cleanFormName($conf['formName']); } else { $formname = $GLOBALS['TSFE']->uniqueHash(); - $formname = 'a'.$formname; // form name has to start with a letter to reach XHTML compliance + $formname = 'a' . $formname; // form name has to start with a letter to reach XHTML compliance } if (isset($conf['fieldPrefix'])) { @@ -1809,62 +1910,67 @@ $prefix = $formname; } - foreach ($dataArr as $val) { + foreach ($dataArr as $val) { $cc++; - $confData=Array(); + $confData = array(); if (is_array($formData)) { $parts = $val; - $val = 1; // true... + $val = 1; // TRUE... } else { $val = trim($val); - $parts = explode('|',$val); + $parts = explode('|', $val); } - if ($val && strcspn($val,'#/')) { + if ($val && strcspn($val, '#/')) { // label: $confData['label'] = 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); + $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]); + $typeParts = explode('=', $fParts[0]); $confData['type'] = trim(strtolower(end($typeParts))); - if (count($typeParts)==1) { + if (count($typeParts) == 1) { $confData['fieldname'] = $this->cleanFormName($parts[0]); - if (strtolower(preg_replace('/[^[:alnum:]]/','',$confData['fieldname']))=='email') {$confData['fieldname']='email';} + if (strtolower(preg_replace('/[^[:alnum:]]/', '', $confData['fieldname'])) == 'email') { + $confData['fieldname'] = 'email'; + } // Duplicate fieldnames resolved - if (isset($fieldname_hashArray[md5($confData['fieldname'])])) { - $confData['fieldname'].='_'.$cc; + if (isset($fieldname_hashArray[md5($confData['fieldname'])])) { + $confData['fieldname'] .= '_' . $cc; } - $fieldname_hashArray[md5($confData['fieldname'])]=$confData['fieldname']; + $fieldname_hashArray[md5($confData['fieldname'])] = $confData['fieldname']; // Attachment names... - if ($confData['type']=='file') { - $confData['fieldname']='attachment'.$attachmentCounter; - $attachmentCounter=intval($attachmentCounter)+1; + if ($confData['type'] == 'file') { + $confData['fieldname'] = 'attachment' . $attachmentCounter; + $attachmentCounter = intval($attachmentCounter) + 1; } } else { - $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0])); + $confData['fieldname'] = str_replace(' ', '_', trim($typeParts[0])); } - $fieldCode=''; + $fieldCode = ''; - if ($conf['wrapFieldName']) { - $confData['fieldname'] = $this->wrap($confData['fieldname'],$conf['wrapFieldName']); + if ($conf['wrapFieldName']) { + $confData['fieldname'] = $this->wrap($confData['fieldname'], $conf['wrapFieldName']); } // Set field name as current: $this->setCurrentVal($confData['fieldname']); // Additional parameters - if (trim($confData['type'])) { - $addParams=trim($conf['params']); - if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) { - $addParams=trim($conf['params.'][$confData['type']]); + if (trim($confData['type'])) { + $addParams = trim($conf['params']); + if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) { + $addParams = trim($conf['params.'][$confData['type']]); } - if (strcmp('',$addParams)) { $addParams=' '.$addParams; } - } else $addParams=''; + if (strcmp('', $addParams)) { + $addParams = ' ' . $addParams; + } + } else + $addParams = ''; if ($conf['dontMd5FieldNames']) { $fName = $confData['fieldname']; @@ -1873,150 +1979,210 @@ } // Accessibility: Set id = fieldname attribute: - if ($conf['accessibility'] || $xhtmlStrict) { - $elementIdAttribute = ' id="'.$prefix.$fName.'"'; + if ($conf['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; - $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth); + switch ($confData['type']) { + case 'textarea' : + $cols = trim($fParts[1]) ? intval($fParts[1]) : 20; + $compWidth = doubleval($conf['compensateFieldWidth'] + ? $conf['compensateFieldWidth'] + : $GLOBALS['TSFE']->compensateFieldWidth + ); $compWidth = $compWidth ? $compWidth : 1; - $cols = t3lib_div::intInRange($cols*$compWidth, 1, 120); + $cols = t3lib_div::intInRange($cols * $compWidth, 1, 120); - $rows=trim($fParts[2]) ? t3lib_div::intInRange($fParts[2],1,30) : 5; - $wrap=trim($fParts[3]); - if ($conf['noWrapAttr'] || $wrap === 'disabled') { - $wrap=''; + $rows = trim($fParts[2]) ? t3lib_div::intInRange($fParts[2], 1, 30) : 5; + $wrap = trim($fParts[3]); + if ($conf['noWrapAttr'] || $wrap === 'disabled') { + $wrap = ''; } else { - $wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"'; + $wrap = $wrap ? ' wrap="' . $wrap . '"' : ' wrap="virtual"'; } - $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',LF,trim($parts[2]))); - $fieldCode=sprintf('', - $confData['fieldname'], $elementIdAttribute, $cols, $rows, $wrap, $addParams, t3lib_div::formatForTextarea($default)); + $default = $this->getFieldDefaultValue( + $conf['noValueInsert'], + $confData['fieldname'], + str_replace('\n', LF, trim($parts[2])) + ); + $fieldCode = sprintf( + '', + $confData['fieldname'], + $elementIdAttribute, + $cols, + $rows, + $wrap, + $addParams, + t3lib_div::formatForTextarea($default) + ); break; - case 'input': - case 'password': - $size=trim($fParts[1]) ? intval($fParts[1]) : 20; - $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth); + case 'input' : + case 'password' : + $size = trim($fParts[1]) ? intval($fParts[1]) : 20; + $compWidth = doubleval($conf['compensateFieldWidth'] + ? $conf['compensateFieldWidth'] + : $GLOBALS['TSFE']->compensateFieldWidth + ); $compWidth = $compWidth ? $compWidth : 1; - $size = t3lib_div::intInRange($size*$compWidth, 1, 120); + $size = t3lib_div::intInRange($size * $compWidth, 1, 120); $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2])); - if ($confData['type']=='password') { - $default=''; + if ($confData['type'] == 'password') { + $default = ''; } - $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : ""; - $theType = $confData['type']=='input' ? 'text' : 'password'; + $max = trim($fParts[2]) ? ' maxlength="' . t3lib_div::intInRange($fParts[2], 1, 1000) . '"' : ""; + $theType = $confData['type'] == 'input' ? 'text' : 'password'; - $fieldCode=sprintf('', - $theType, $confData['fieldname'], $elementIdAttribute, $size, $max, htmlspecialchars($default), $addParams); + $fieldCode = sprintf( + '', + $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('', - $confData['fieldname'], $elementIdAttribute, $size, $addParams); + case 'file' : + $size = trim($fParts[1]) ? t3lib_div::intInRange($fParts[1], 1, 60) : 20; + $fieldCode = sprintf( + '', + $confData['fieldname'], + $elementIdAttribute, + $size, + $addParams + ); break; - case 'check': + case 'check' : // alternative default value: $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2])); $checked = $default ? ' checked="checked"' : ''; - $fieldCode=sprintf('', - 1, $confData['fieldname'], $elementIdAttribute, $checked, $addParams); + $fieldCode = sprintf( + '', + 1, + $confData['fieldname'], + $elementIdAttribute, + $checked, + $addParams + ); break; - case 'select': - $option=''; - $valueParts = explode(',',$parts[2]); + 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; + 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"' : ''; + $multiple = strtolower(trim($fParts[2])) == 'm' ? ' multiple="multiple"' : ''; - $items=array(); // Where the items will be - $defaults=array(); //RTF + $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=''; + 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. + $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: $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults); if (!is_array($default)) { - $defaults=array(); + $defaults = array(); $defaults[] = $default; - } else $defaults=$default; + } else { + $defaults = $default; + } // Create the select-box: $iCount = count($items); - for($a=0;$a<$iCount;$a++) { - $option.=''; //RTF + for ($a = 0; $a < $iCount; $a++) { + $option .= ''; //RTF } - if ($multiple) $confData['fieldname'].='[]'; // 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. - $fieldCode=sprintf('', - $confData['fieldname'], $elementIdAttribute, $size, $multiple, $addParams, $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( + '', + $confData['fieldname'], + $elementIdAttribute, + $size, + $multiple, + $addParams, + $option + ); //RTF break; - case 'radio': - $option=''; + case 'radio' : + $option = ''; - $valueParts = explode(',',$parts[2]); - $items=array(); // Where the items will be - $default=''; + $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=''; + 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. + $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: $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default); // Create the select-box: $iCount = count($items); - for($a=0;$a<$iCount;$a++) { - $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]); - if ($conf['accessibility']) { - $radioLabelIdAttribute = ' id="'.$radioId.'"'; + for ($a = 0; $a < $iCount; $a++) { + $radioId = $prefix . $fName . $this->cleanFormName($items[$a][0]); + if ($conf['accessibility']) { + $radioLabelIdAttribute = ' id="' . $radioId . '"'; } else { $radioLabelIdAttribute = ''; } - $option .= ''; - if ($conf['accessibility']) { - $option .= ''; + $option .= ''; + if ($conf['accessibility']) { + $option .= ''; } else { $option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']); } - } + } - if ($conf['accessibility']) { + if ($conf['accessibility']) { $accessibilityWrap = $conf['radioWrap.']['accessibilityWrap']; $search = array( - '###RADIO_FIELD_ID###', - '###RADIO_GROUP_LABEL###' + '###RADIO_FIELD_ID###', '###RADIO_GROUP_LABEL###' ); $replace = array( - $elementIdAttribute, - $confData['label'] + $elementIdAttribute, $confData['label'] ); $accessibilityWrap = str_replace($search, $replace, $accessibilityWrap); @@ -2025,92 +2191,115 @@ $fieldCode = $option; break; - case 'hidden': + 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('', - $prefix, $hmacChecksum); + $hiddenfields .= sprintf( + '', + $prefix, + $hmacChecksum + ); } - if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) { + 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'])) { + if (strlen($value) && t3lib_div::inList('recipient_copy,recipient', $confData['fieldname'])) { $value = $GLOBALS['TSFE']->codeString($value); } - $hiddenfields.= sprintf('', - $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value)); + $hiddenfields .= sprintf( + '', + $confData['fieldname'], + $elementIdAttribute, + htmlspecialchars($value) + ); break; - case 'property': - if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess',$confData['fieldname'])) { - $value=trim($parts[2]); + 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.']) { + case 'submit' : + $value = trim($parts[2]); + if ($conf['image.']) { $this->data[$this->currentValKey] = $value; $image = $this->IMG_RESOURCE($conf['image.']); - $params = $conf['image.']['params'] ? ' '.$conf['image.']['params'] : ''; - $params.= $this->getAltParam($conf['image.'], false); - $params.= $addParams; + $params = $conf['image.']['params'] ? ' ' . $conf['image.']['params'] : ''; + $params .= $this->getAltParam($conf['image.'], FALSE); + $params .= $addParams; } else { $image = ''; } - if ($image) { - $fieldCode=sprintf('', - $confData['fieldname'], $elementIdAttribute, $image, $params); - } else { - $fieldCode=sprintf('', - $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams); + if ($image) { + $fieldCode = sprintf( + '', + $confData['fieldname'], + $elementIdAttribute, + $image, + $params + ); + } else { + $fieldCode = sprintf( + '', + $confData['fieldname'], + $elementIdAttribute, + t3lib_div::deHSCentities(htmlspecialchars($value)), + $addParams + ); } break; - case 'reset': - $value=trim($parts[2]); - $fieldCode=sprintf('', - $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams); + case 'reset' : + $value = trim($parts[2]); + $fieldCode = sprintf( + '', + $confData['fieldname'], + $elementIdAttribute, + t3lib_div::deHSCentities(htmlspecialchars($value)), + $addParams + ); break; - case 'label': + case 'label' : $fieldCode = nl2br(htmlspecialchars(trim($parts[2]))); break; - default: + default : $confData['type'] = 'comment'; - $fieldCode = trim($parts[2]).' '; + $fieldCode = trim($parts[2]) . ' '; break; } - if ($fieldCode) { + 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]); + 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': + // 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. + $confData['required'] = 1; // Setting this so "required" layout is used. break; - case 'EMAIL': + case 'EMAIL' : $fieldlist[] = '_EMAIL'; $fieldlist[] = $confData['fieldname']; $fieldlist[] = $confData['label']; - $confData['required'] = 1; // Setting this so "required" layout is used. + $confData['required'] = 1; // Setting this so "required" layout is used. break; - default: - if ($confData['required']) { + default : + if ($confData['required']) { $fieldlist[] = $confData['fieldname']; $fieldlist[] = $confData['label']; } @@ -2119,8 +2308,8 @@ // Field: $fieldLabel = $confData['label']; - if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/',$confData['type'])) { - $fieldLabel = ''; + if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/', $confData['type'])) { + $fieldLabel = ''; } // Getting template code: @@ -2128,219 +2317,255 @@ $labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']); $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']); // RTF $result = $conf['layout']; - if ($conf['REQ'] && $confData['required']) { + if ($conf['REQ'] && $confData['required']) { if (is_array($conf['REQ.']['fieldWrap.'])) $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']); if (is_array($conf['REQ.']['labelWrap.'])) $labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']); - if ($conf['REQ.']['layout']) { + if ($conf['REQ.']['layout']) { $result = $conf['REQ.']['layout']; } } - if ($confData['type']=='comment' && $conf['COMMENT.']['layout']) { + if ($confData['type'] == 'comment' && $conf['COMMENT.']['layout']) { $result = $conf['COMMENT.']['layout']; } - if ($confData['type']=='check' && $conf['CHECK.']['layout']) { + if ($confData['type'] == 'check' && $conf['CHECK.']['layout']) { $result = $conf['CHECK.']['layout']; } - if ($confData['type']=='radio' && $conf['RADIO.']['layout']) { + if ($confData['type'] == 'radio' && $conf['RADIO.']['layout']) { $result = $conf['RADIO.']['layout']; } - if ($confData['type']=='label' && $conf['LABEL.']['layout']) { + if ($confData['type'] == 'label' && $conf['LABEL.']['layout']) { $result = $conf['LABEL.']['layout']; } - $result = str_replace('###FIELD###',$fieldCode,$result); - $result = str_replace('###LABEL###',$labelCode,$result); - $result = str_replace('###COMMENT###',$commentCode,$result); //RTF - $content.= $result; + $result = str_replace('###FIELD###', $fieldCode, $result); + $result = str_replace('###LABEL###', $labelCode, $result); + $result = str_replace('###COMMENT###', $commentCode, $result); //RTF + $content .= $result; } } } - if ($conf['stdWrap.']) { $content = $this->stdWrap($content, $conf['stdWrap.']); } + if ($conf['stdWrap.']) { + $content = $this->stdWrap($content, $conf['stdWrap.']); + } // redirect (external: where to go afterwards. internal: where to submit to) - $theRedirect = $this->stdWrap($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) + $theRedirect = $this->stdWrap($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) $page = $GLOBALS['TSFE']->page; - if (!$theRedirect) { // Internal: Just submit to current page - $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid'])); - } elseif (t3lib_div::testInt($theRedirect)) { // Internal: Submit to page with ID $theRedirect + if (!$theRedirect) { // Internal: Just submit to current page + $LD = $GLOBALS['TSFE']->tmpl->linkData( + $page, + $conf['target'], + $conf['no_cache'], + 'index.php', + '', + $this->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, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid'])); - } else { // External URL, redirect-hidden field is rendered! - $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'', '', $this->getClosestMPvalueForPage($page['uid'])); + $LD = $GLOBALS['TSFE']->tmpl->linkData( + $page, + $conf['target'], + $conf['no_cache'], + 'index.php', + '', + $this->getClosestMPvalueForPage($page['uid']) + ); + } else { // External URL, redirect-hidden field is rendered! + $LD = $GLOBALS['TSFE']->tmpl->linkData( + $page, + $conf['target'], + $conf['no_cache'], + '', + '', + $this->getClosestMPvalueForPage($page['uid']) + ); $LD['totalURL'] = $theRedirect; - $hiddenfields.= ''; // 18-09-00 added + $hiddenfields .= ''; // 18-09-00 added } // Formtype (where to submit to!): $formtype = $propertyOverride['type'] ? $propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']); - if (t3lib_div::testInt($formtype)) { // Submit to a specific page + 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, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid'])); + $LD_A = $GLOBALS['TSFE']->tmpl->linkData( + $page, + $conf['target'], + $conf['no_cache'], + '', + '', + $this->getClosestMPvalueForPage($page['uid']) + ); $action = $LD_A['totalURL']; - } elseif ($formtype) { // Submit to external script + } elseif ($formtype) { // Submit to external script $LD_A = $LD; $action = $formtype; - } elseif (t3lib_div::testInt($theRedirect)) { + } 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, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid'])); + } else { // Submit to "nothing" - which is current page + $LD_A = $GLOBALS['TSFE']->tmpl->linkData( + $GLOBALS['TSFE']->page, + $conf['target'], + $conf['no_cache'], + '', + '', + $this->getClosestMPvalueForPage($page['uid']) + ); $action = $LD_A['totalURL']; } // Recipient: $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']); - if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) { + if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) { $theEmail = $GLOBALS['TSFE']->codeString($theEmail); - $hiddenfields.= ''; + $hiddenfields .= ''; } // location data: - if ($conf['locationData']) { - if ($conf['locationData']=='HTTP_POST_VARS' && isset($_POST['locationData'])) { + if ($conf['locationData']) { + if ($conf['locationData'] == 'HTTP_POST_VARS' && isset($_POST['locationData'])) { $locationData = t3lib_div::_POST('locationData'); } else { - $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord; // 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 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->currentRecord; } - $hiddenfields.=''; + $hiddenfields .= ''; } // hidden fields: - if (is_array($conf['hiddenFields.'])) { + if (is_array($conf['hiddenFields.'])) { foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) { - if (substr($hF_key,-1)!='.') { - $hF_value = $this->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']) { + if (substr($hF_key, -1) != '.') { + $hF_value = $this->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.= ''; + $hiddenfields .= ''; } } } // Wrap all hidden fields in a div tag (see http://bugs.typo3.org/view.php?id=678) - $hiddenfields = '
'.$hiddenfields.'
'; + $hiddenfields = '
' . $hiddenfields . '
'; - if ($conf['REQ']) { - $validateForm = ' onsubmit="return validateForm(\'' . - $formname . '\',\'' . implode(',',$fieldlist) . '\',' . - t3lib_div::quoteJSvalue($conf['goodMess']) . ',' . + if ($conf['REQ']) { + $validateForm = ' onsubmit="return validateForm(\'' . $formname . '\',\'' . implode(',', $fieldlist) + . '\',' . t3lib_div::quoteJSvalue($conf['goodMess']) . ',' . t3lib_div::quoteJSvalue($conf['badMess']) . ',' . t3lib_div::quoteJSvalue($conf['emailMess']) . ')"'; - $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = - ''; + 't3lib/jsfunc.validateform.js') . '">'; } else { $validateForm = ''; } // Create form tag: - $theTarget = ($theRedirect?$LD['target']:$LD_A['target']); + $theTarget = ($theRedirect ? $LD['target'] : $LD_A['target']); $content = array( - '', - $hiddenfields.$content, + '', $hiddenfields . $content, '' ); - if ($conf['arrayReturnMode']) { - $content['validateForm']=$validateForm; - $content['formname']=$formname; + if ($conf['arrayReturnMode']) { + $content['validateForm'] = $validateForm; + $content['formname'] = $formname; return $content; } else { - return implode('',$content); + return implode('', $content); } } /** * Rendering the cObject, SEARCHRESULT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=368&cHash=d00731cd7b */ - function SEARCHRESULT($conf) { - if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) { + function SEARCHRESULT($conf) { + if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) { $search = t3lib_div::makeInstance('tslib_search'); $search->register_and_explode_search_string(t3lib_div::_GP('sword')); - $search->register_tables_and_columns(t3lib_div::_GP('scols'),$conf['allowedCols']); + $search->register_tables_and_columns(t3lib_div::_GP('scols'), $conf['allowedCols']); // depth - $depth=100; + $depth = 100; // the startId is found - $theStartId=0; - if (t3lib_div::testInt(t3lib_div::_GP('stype'))) { - $temp_theStartId=t3lib_div::_GP('stype'); + $theStartId = 0; + if (t3lib_div::testInt(t3lib_div::_GP('stype'))) { + $temp_theStartId = t3lib_div::_GP('stype'); $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId); // The page MUST have a rootline with the Level0-page of the current site inside!! foreach ($rootLine as $val) { - if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) { + if ($val['uid'] == $GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) { $theStartId = $temp_theStartId; } } - } else if (t3lib_div::_GP('stype')) { - if (substr(t3lib_div::_GP('stype'),0,1)=='L') { - $pointer = intval(substr(t3lib_div::_GP('stype'),1)); + } else if (t3lib_div::_GP('stype')) { + if (substr(t3lib_div::_GP('stype'), 0, 1) == 'L') { + $pointer = intval(substr(t3lib_div::_GP('stype'), 1)); $theRootLine = $GLOBALS['TSFE']->tmpl->rootLine; // location Data: - $locDat_arr = explode(':',t3lib_div::_POST('locationData')); + $locDat_arr = explode(':', t3lib_div::_POST('locationData')); $pId = intval($locDat_arr[0]); - if ($pId) { + if ($pId) { $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId); ksort($altRootLine); - if (count($altRootLine)) { + if (count($altRootLine)) { // check if the rootline has the real Level0 in it!! - $hitRoot=0; - $theNewRoot=array(); + $hitRoot = 0; + $theNewRoot = array(); foreach ($altRootLine as $val) { - if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) { - $hitRoot=1; - $theNewRoot[]=$val; + if ($hitRoot || $val['uid'] == $GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) { + $hitRoot = 1; + $theNewRoot[] = $val; } } - if ($hitRoot) { - $theRootLine = $theNewRoot; // Override the real rootline if any thing + if ($hitRoot) { + $theRootLine = $theNewRoot; // Override the real rootline if any thing } } } - $key = $this->getKey($pointer,$theRootLine); + $key = $this->getKey($pointer, $theRootLine); $theStartId = $theRootLine[$key]['uid']; } } - if (!$theStartId) { + if (!$theStartId) { // If not set, we use current page $theStartId = $GLOBALS['TSFE']->id; } // generate page-tree - $search->pageIdList.= $this->getTreeList(-1*$theStartId,$depth); + $search->pageIdList .= $this->getTreeList(-1 * $theStartId, $depth); - $endClause = 'pages.uid IN ('.$search->pageIdList.') - AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?',3,4':'').') - AND pages.no_search=0'. - $this->enableFields($search->fTable). - $this->enableFields('pages'); + $endClause = 'pages.uid IN (' . $search->pageIdList . ') + AND pages.doktype in (' . + $GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'] . ($conf['addExtUrlsAndShortCuts'] ? ',3,4' : '') . + ') + AND pages.no_search=0' . $this->enableFields($search->fTable) . $this->enableFields('pages'); - if ($conf['languageField.'][$search->fTable]) { - $endClause.= ' AND '.$search->fTable.'.'.$conf['languageField.'][$search->fTable].' = '.intval($GLOBALS['TSFE']->sys_language_uid); // (using sys_language_uid which is the ACTUAL language of the page. sys_language_content is only for selecting DISPLAY content!) + if ($conf['languageField.'][$search->fTable]) { + // (using sys_language_uid which is the ACTUAL language of the page. + // sys_language_content is only for selecting DISPLAY content!) + $endClause .= ' AND ' . $search->fTable . '.' . $conf['languageField.'][$search->fTable] . + ' = ' . + intval($GLOBALS['TSFE']->sys_language_uid); } // build query $search->build_search_query($endClause); // count... - if (t3lib_div::testInt(t3lib_div::_GP('scount'))) { + if (t3lib_div::testInt(t3lib_div::_GP('scount'))) { $search->res_count = t3lib_div::_GP('scount'); } else { $search->count_query(); @@ -2348,78 +2573,94 @@ // range $spointer = intval(t3lib_div::_GP('spointer')); - if (isset($conf['range'])) { + if (isset($conf['range'])) { $theRange = intval($conf['range']); } else { $theRange = 20; } // Order By: - if (!$conf['noOrderBy']) { + if (!$conf['noOrderBy']) { $search->queryParts['ORDERBY'] = 'pages.lastUpdated, pages.tstamp'; } - $search->queryParts['LIMIT'] = $spointer.','.$theRange; + $search->queryParts['LIMIT'] = $spointer . ',' . $theRange; // search... $search->execute_query(); - if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) { + if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) { $GLOBALS['TSFE']->register['SWORD_PARAMS'] = $search->get_searchwords(); $total = $search->res_count; - $rangeLow = t3lib_div::intInRange($spointer+1,1,$total); - $rangeHigh = t3lib_div::intInRange($spointer+$theRange,1,$total); + $rangeLow = t3lib_div::intInRange($spointer + 1, 1, $total); + $rangeHigh = t3lib_div::intInRange($spointer + $theRange, 1, $total); // prev/next url: - $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,$conf['target'],1,'', '', $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid'])); - $targetPart = $LD['target'] ? ' target="'.htmlspecialchars($LD['target']).'"' : ''; - $urlParams = $this->URLqMark($LD['totalURL'], - '&sword='.rawurlencode(t3lib_div::_GP('sword')). - '&scols='.rawurlencode(t3lib_div::_GP('scols')). - '&stype='.rawurlencode(t3lib_div::_GP('stype')). - '&scount='.$total); + $LD = $GLOBALS['TSFE']->tmpl->linkData( + $GLOBALS['TSFE']->page, + $conf['target'], + 1, + '', + '', + $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']) + ); + $targetPart = $LD['target'] ? ' target="' . htmlspecialchars($LD['target']) . '"' : ''; + $urlParams = $this->URLqMark( + $LD['totalURL'], + '&sword=' . rawurlencode(t3lib_div::_GP('sword')) . + '&scols=' . rawurlencode(t3lib_div::_GP('scols')) . + '&stype=' . rawurlencode(t3lib_div::_GP('stype')) . + '&scount=' . $total + ); // substitution: - $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout'); - $result = str_replace('###RANGELOW###',$rangeLow,$result); - $result = str_replace('###RANGEHIGH###',$rangeHigh,$result); - $result = str_replace('###TOTAL###',$total,$result); + $result = $this->cObjGetSingle($conf['layout'], $conf['layout.'], 'layout'); + $result = str_replace('###RANGELOW###', $rangeLow, $result); + $result = str_replace('###RANGEHIGH###', $rangeHigh, $result); + $result = str_replace('###TOTAL###', $total, $result); - if ($rangeHigh<$total) { + if ($rangeHigh < $total) { $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next'); - $next = 'ATagParams.'>'.$next.''; - } else $next=''; - $result = str_replace('###NEXT###',$next,$result); + $next = 'ATagParams . '>' . $next . ''; + } else + $next = ''; + $result = str_replace('###NEXT###', $next, $result); - if ($rangeLow>1) { + if ($rangeLow > 1) { $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev'); - $prev = 'ATagParams.'>'.$prev.''; - } else $prev=''; - $result = str_replace('###PREV###',$prev,$result); + $prev = 'ATagParams . '>' . $prev . ''; + } else + $prev = ''; + $result = str_replace('###PREV###', $prev, $result); // searching result - $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj'); + $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'], 'resultObj'); $cObj = t3lib_div::makeInstance('tslib_cObj'); - $cObj->setParent($this->data,$this->currentRecord); - $renderCode=''; - while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result)) { - // versionOL() here? This is search result displays, is that possible to preview anyway? Or are records selected here already future versions? + $cObj->setParent($this->data, $this->currentRecord); + $renderCode = ''; + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result)) { + // versionOL() here? This is search result displays, is that possible to preview anyway? + // Or are records selected here already future versions? $cObj->start($row); - $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj'); + $renderCode .= $cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'], 'renderObj'); } - $theValue.=$this->wrap($renderCode,$conf['renderWrap']); - $theValue = str_replace('###RESULT###',$theValue,$result); + $theValue .= $this->wrap($renderCode, $conf['renderWrap']); + $theValue = str_replace('###RESULT###', $theValue, $result); } else { - $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj'); + $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'], 'noResultObj'); } - $GLOBALS['TT']->setTSlogMessage('Search in fields: '.$search->listOfSearchFields); + $GLOBALS['TT']->setTSlogMessage('Search in fields: ' . $search->listOfSearchFields); // wrapping - $content=$theValue; + $content = $theValue; if ($conf['wrap']) { - $content=$this->wrap($content, $conf['wrap']); + $content = $this->wrap($content, $conf['wrap']); } if ($conf['stdWrap.']) { - $content=$this->stdWrap($content, $conf['stdWrap.']); + $content = $this->stdWrap($content, $conf['stdWrap.']); } // returning $GLOBALS['TSFE']->set_no_cache(); @@ -2430,40 +2671,39 @@ /** * Rendering the cObject, PHP_SCRIPT, PHP_SCRIPT_INT and PHP_SCRIPT_EXT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @param string If "INT", then rendering "PHP_SCRIPT_INT"; If "EXT", then rendering "PHP_SCRIPT_EXT"; Default is rendering "PHP_SCRIPT" (cached) * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=370&cHash=aa107f2ad8 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=371&cHash=53f71d025e * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=372&cHash=91fe391e1c */ - function PHP_SCRIPT($conf,$ext='') { + function PHP_SCRIPT($conf, $ext = '') { $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']); - $content=''; - if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) { - switch($ext) { - case 'INT': - case 'EXT': - $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash(); - $content.=''; - $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array( - 'file'=>$incFile, - 'conf'=>$conf, - 'type'=>'SCRIPT' + $content = ''; + if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) { + switch ($ext) { + case 'INT' : + case 'EXT' : + $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash(); + $content .= ''; + $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array( + 'file' => $incFile, 'conf' => $conf, 'type' => 'SCRIPT' ); - if ($ext=='INT') { - $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['cObj'] = serialize($this); + if ($ext == 'INT') { + $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey]['cObj'] = serialize($this); } else { - $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['data'] = $this->data; + $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey]['data'] = $this->data; } break; - default: + default : // Added 31-12-00: Make backup... $this->oldData = $this->data; + $RESTORE_OLD_DATA = FALSE; // Include file.. - include('./'.$incFile); + include ('./' . $incFile); // Added 31-12-00: restore... - if ($RESTORE_OLD_DATA) { + if ($RESTORE_OLD_DATA) { $this->data = $this->oldData; } break; @@ -2475,140 +2715,165 @@ /** * Rendering the cObject, TEMPLATE * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=373&cHash=109a171b1e * @see substituteMarkerArrayCached() */ - function TEMPLATE($conf) { - $subparts = Array(); - $marks = Array(); - $wraps = Array(); - $content=''; + function TEMPLATE($conf) { + $subparts = array(); + $marks = array(); + $wraps = array(); + $content = ''; - list($PRE,$POST) = explode('|',$conf['markerWrap'] ? $conf['markerWrap'] : '### | ###'); + list ($PRE, $POST) = explode('|', $conf['markerWrap'] ? $conf['markerWrap'] : '### | ###'); $POST = trim($POST); - $PRE = trim($PRE); + $PRE = trim($PRE); // Getting the content - $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template'); - if ($conf['workOnSubpart']) { - $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST); + $content = $this->cObjGetSingle($conf['template'], $conf['template.'], 'template'); + if ($conf['workOnSubpart']) { + $content = $this->getSubpart($content, $PRE . $conf['workOnSubpart'] . $POST); } // Fixing all relative paths found: - if ($conf['relPathPrefix']) { + if ($conf['relPathPrefix']) { $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml'); - $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']); + $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'], $content, $conf['relPathPrefix.']); } - if ($content) { - if ($conf['nonCachedSubst']) { // NON-CACHED: + if ($content) { + if ($conf['nonCachedSubst']) { // NON-CACHED: // Getting marks - if (is_array($conf['marks.'])) { + if (is_array($conf['marks.'])) { foreach ($conf['marks.'] as $theKey => $theValue) { - if (!strstr($theKey,'.')) { + if (!strstr($theKey, '.')) { $content = str_replace( - $PRE.$theKey.$POST, - $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey), + $PRE . $theKey . $POST, + $this->cObjGetSingle( + $theValue, $conf['marks.'][$theKey . '.'], + 'marks.' . $theKey + ), $content); } } } // Getting subparts. - if (is_array($conf['subparts.'])) { + if (is_array($conf['subparts.'])) { foreach ($conf['subparts.'] as $theKey => $theValue) { - if (!strstr($theKey,'.')) { - $subpart = $this->getSubpart($content, $PRE.$theKey.$POST); - if ($subpart) { + if (!strstr($theKey, '.')) { + $subpart = $this->getSubpart($content, $PRE . $theKey . $POST); + if ($subpart) { $this->setCurrentVal($subpart); $content = $this->substituteSubpart( $content, - $PRE.$theKey.$POST, - $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey), - 1 - ); + $PRE . $theKey . $POST, + $this->cObjGetSingle( + $theValue, + $conf['subparts.'][$theKey . '.'], + 'subparts.' . $theKey), + TRUE + ); } } } } // Getting subpart wraps - if (is_array($conf['wraps.'])) { + if (is_array($conf['wraps.'])) { foreach ($conf['wraps.'] as $theKey => $theValue) { - if (!strstr($theKey,'.')) { - $subpart = $this->getSubpart($content, $PRE.$theKey.$POST); - if ($subpart) { + if (!strstr($theKey, '.')) { + $subpart = $this->getSubpart($content, $PRE . $theKey . $POST); + if ($subpart) { $this->setCurrentVal($subpart); $content = $this->substituteSubpart( $content, - $PRE.$theKey.$POST, - explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)), - 1 + $PRE . $theKey . $POST, + explode('|', $this->cObjGetSingle( + $theValue, $conf['wraps.'][$theKey . '.'], + 'wraps.' . $theKey) + ), + TRUE ); } } } } - } else { // CACHED + } else { // CACHED // Getting subparts. - if (is_array($conf['subparts.'])) { + if (is_array($conf['subparts.'])) { foreach ($conf['subparts.'] as $theKey => $theValue) { - if (!strstr($theKey,'.')) { - $subpart = $this->getSubpart($content, $PRE.$theKey.$POST); - if ($subpart) { - $GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart; + if (!strstr($theKey, '.')) { + $subpart = $this->getSubpart($content, $PRE . $theKey . $POST); + if ($subpart) { + $GLOBALS['TSFE']->register['SUBPART_' . $theKey] = $subpart; $subparts[$theKey]['name'] = $theValue; - $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.']; + $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey . '.']; } } } } - // Getting marks - if (is_array($conf['marks.'])) { + // Getting marks + if (is_array($conf['marks.'])) { foreach ($conf['marks.'] as $theKey => $theValue) { - if (!strstr($theKey,'.')) { + if (!strstr($theKey, '.')) { $marks[$theKey]['name'] = $theValue; - $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.']; + $marks[$theKey]['conf'] = $conf['marks.'][$theKey . '.']; } } } // Getting subpart wraps - if (is_array($conf['wraps.'])) { + if (is_array($conf['wraps.'])) { foreach ($conf['wraps.'] as $theKey => $theValue) { - if (!strstr($theKey,'.')) { + if (!strstr($theKey, '.')) { $wraps[$theKey]['name'] = $theValue; - $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.']; + $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey . '.']; } } } // Getting subparts - $subpartArray =array(); + $subpartArray = array(); foreach ($subparts as $theKey => $theValue) { - // Set current with the content of the subpart... - $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey]; - // Get subpart cObject and substitute it! - $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey); + // Set current with the content of the subpart... + $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_' . $theKey]; + // Get subpart cObject and substitute it! + $subpartArray[$PRE . $theKey . $POST] = $this->cObjGetSingle( + $theValue['name'], + $theValue['conf'], + 'subparts.' . $theKey + ); } - $this->data[$this->currentValKey] = ''; // Reset current to empty + $this->data[$this->currentValKey] = ''; // Reset current to empty + // Getting marks - $markerArray =array(); + $markerArray = array(); foreach ($marks as $theKey => $theValue) { - $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey); + $markerArray[$PRE . $theKey . $POST] = $this->cObjGetSingle( + $theValue['name'], + $theValue['conf'], + 'marks.' . $theKey + ); } // Getting wraps - $subpartWraps =array(); + $subpartWraps = array(); foreach ($wraps as $theKey => $theValue) { - $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey)); + $subpartWraps[$PRE . $theKey . $POST] = explode( + '|', + $this->cObjGetSingle( + $theValue['name'], + $theValue['conf'], + 'wraps.' . $theKey + ) + ); } // Substitution - if ($conf['substMarksSeparately']) { - $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps); + if ($conf['substMarksSeparately']) { + $content = $this->substituteMarkerArrayCached($content, array(), $subpartArray, $subpartWraps); $content = $this->substituteMarkerArray($content, $markerArray); } else { - $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps); + $content = $this->substituteMarkerArrayCached($content, $markerArray, $subpartArray, $subpartWraps); } } } @@ -2618,62 +2883,62 @@ /** * Rendering the cObject, MULTIMEDIA * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=374&cHash=efd88ab4a9 */ - function MULTIMEDIA($conf) { - $content=''; - $filename=$this->stdWrap($conf['file'],$conf['file.']); + function MULTIMEDIA($conf) { + $content = ''; + $filename = $this->stdWrap($conf['file'], $conf['file.']); $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename); - if ($incFile) { + if ($incFile) { $fileinfo = t3lib_div::split_fileref($incFile); - if (t3lib_div::inList('txt,html,htm',$fileinfo['fileext'])) { + if (t3lib_div::inList('txt,html,htm', $fileinfo['fileext'])) { $content = $GLOBALS['TSFE']->tmpl->fileContent($incFile); } else { // default params... - $parArray=array(); + $parArray = array(); // src is added - $parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix.$incFile.'"'; - if (t3lib_div::inList('au,wav,mp3',$fileinfo['fileext'])) { + $parArray['src'] = 'src="' . $GLOBALS['TSFE']->absRefPrefix . $incFile . '"'; + if (t3lib_div::inList('au,wav,mp3', $fileinfo['fileext'])) { } - if (t3lib_div::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext'])) { + if (t3lib_div::inList('avi,mov,mpg,asf,wmv', $fileinfo['fileext'])) { $parArray['width'] = 'width="' . ($conf['width'] ? $conf['width'] : 200) . '"'; $parArray['height'] = 'height="' . ($conf['height'] ? $conf['height'] : 200) . '"'; } - if (t3lib_div::inList('swf,swa,dcr',$fileinfo['fileext'])) { + if (t3lib_div::inList('swf,swa,dcr', $fileinfo['fileext'])) { $parArray['quality'] = 'quality="high"'; } - if (t3lib_div::inList('class',$fileinfo['fileext'])) { + if (t3lib_div::inList('class', $fileinfo['fileext'])) { $parArray['width'] = 'width="' . ($conf['width'] ? $conf['width'] : 200) . '"'; $parArray['height'] = 'height="' . ($conf['height'] ? $conf['height'] : 200) . '"'; } // fetching params - $lines = explode(LF, $this->stdWrap($conf['params'],$conf['params.'])); + $lines = explode(LF, $this->stdWrap($conf['params'], $conf['params.'])); foreach ($lines as $l) { $parts = explode('=', $l); $parameter = strtolower(trim($parts[0])); $value = trim($parts[1]); - if ((string)$value!='') { - $parArray[$parameter] = $parameter.'="'.htmlspecialchars($value).'"'; + if ((string) $value != '') { + $parArray[$parameter] = $parameter . '="' . htmlspecialchars($value) . '"'; } else { unset($parArray[$parameter]); } } - if ($fileinfo['fileext']=='class') { + if ($fileinfo['fileext'] == 'class') { unset($parArray['src']); - $parArray['code'] = 'code="'.htmlspecialchars($fileinfo['file']).'"'; - $parArray['codebase'] = 'codebase="'.htmlspecialchars($fileinfo['path']).'"'; - $content=''; + $parArray['code'] = 'code="' . htmlspecialchars($fileinfo['file']) . '"'; + $parArray['codebase'] = 'codebase="' . htmlspecialchars($fileinfo['path']) . '"'; + $content = ''; } else { - $content=''; + $content = ''; } } } if ($conf['stdWrap.']) { - $content=$this->stdWrap($content, $conf['stdWrap.']); + $content = $this->stdWrap($content, $conf['stdWrap.']); } return $content; @@ -2682,19 +2947,19 @@ /** * Rendering the cObject, SWFOBJECT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output */ public function MEDIA($conf) { $content = ''; $flexParams = $this->stdWrap($conf['flexParams'], $conf['flexParams.']); if (substr($flexParams, 0, 1) === '<') { - // it is a content element + // it is a content element $this->readFlexformIntoConf($flexParams, $conf['parameter.']); $url = $conf['parameter.']['mmFile']; $url = $this->stdWrap($url, $conf['file.']); } else { - // it is a TS object + // it is a TS object $url = $this->stdWrap($conf['file'], $conf['file.']); } @@ -2704,7 +2969,9 @@ $fileinfo = t3lib_div::split_fileref($filename); $conf['file'] = $filename; } else { - $conf['file'] = $this->typoLink_URL(array('parameter' => $url)); + $conf['file'] = $this->typoLink_URL(array( + 'parameter' => $url + )); } $renderType = $conf['renderType']; @@ -2720,7 +2987,7 @@ } } - $forcePlayer = isset($conf['parameter.']['mmFile']) ? intval($conf['parameter.']['mmforcePlayer']) : $conf['forcePlayer']; + $forcePlayer = isset($conf['parameter.']['mmFile']) ? intval($conf['parameter.']['mmforcePlayer']) : $conf['forcePlayer']; $conf['forcePlayer'] = $forcePlayer; $conf['type'] = isset($conf['parameter.']['mmType']) ? $conf['parameter.']['mmType'] : $conf['type']; @@ -2746,25 +3013,25 @@ foreach ($conf['parameter.']['mmMediaOptions'] as $key => $value) { if ($key == 'mmMediaCustomParameterContainer') { foreach ($value as $val) { - //custom parameter entry + //custom parameter entry $rawTS = $val['mmParamCustomEntry']; - //read and merge + //read and merge $tmp = t3lib_div::trimExplode(LF, $rawTS); if (count($tmp)) { foreach ($tmp as $tsLine) { if (substr($tsLine, 0, 1) != '#' && $pos = strpos($tsLine, '.')) { $parts[0] = substr($tsLine, 0, $pos); $parts[1] = substr($tsLine, $pos + 1); - $valueParts = t3lib_div::trimExplode('=', $parts[1], true); + $valueParts = t3lib_div::trimExplode('=', $parts[1], TRUE); switch (strtolower($parts[0])) { - case 'flashvars': + case 'flashvars' : $conf['flashvars.'][$valueParts[0]] = $valueParts[1]; break; - case 'params': + case 'params' : $conf['params.'][$valueParts[0]] = $valueParts[1]; break; - case 'attributes': + case 'attributes' : $conf['attributes.'][$valueParts[0]] = $valueParts[1]; break; } @@ -2777,7 +3044,7 @@ if (isset($val['mmParamSet'])) { $pName = $val['mmParamName']; $pSet = $val['mmParamSet']; - $pValue = $pSet == 2 ? $val['mmParamValue'] : ($pSet == 0 ? 'false' : 'true'); + $pValue = $pSet == 2 ? $val['mmParamValue'] : ($pSet == 0 ? 'FALSE' : 'TRUE'); $conf['predefined'][$pName] = $pValue; } } @@ -2787,41 +3054,41 @@ // render MEDIA if ($mode == 'url' && !$forcePlayer) { - // url is called direct, not with player + // url is called direct, not with player if ($url == '' && !$conf['allowEmptyUrl']) { - return '

' . $GLOBALS['TSFE']->sL('LLL:EXT:cms/locallang_ttc.xml:media.noFile', true) . '

'; + return '

' . $GLOBALS['TSFE']->sL('LLL:EXT:cms/locallang_ttc.xml:media.noFile', TRUE) . '

'; } $conf = array_merge($conf['mimeConf.']['swfobject.'], $conf); - $conf[$conf['type'] . '.']['player'] = strpos($url, '://') === false ? 'http://' . $url : $url; + $conf[$conf['type'] . '.']['player'] = strpos($url, '://') === FALSE ? 'http://' . $url : $url; $conf['installUrl'] = 'null'; $conf['flashvars'] = array_merge((array) $conf['flashvars'], $conf['predefined']); } switch ($renderType) { - case 'swf': + case 'swf' : $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf); $conf = array_merge($conf['mimeConf.']['swfobject.'], $conf); unset($conf['mimeConf.']); $conf['flashvars.'] = array_merge((array) $conf['flashvars.'], $conf['predefined']); $content = $this->SWFOBJECT($conf); break; - case 'qt': + case 'qt' : $conf[$conf['type'] . '.'] = array_merge($conf['mimeConf.']['swfobject.'][$conf['type'] . '.'], $typeConf); $conf = array_merge($conf['mimeConf.']['qtobject.'], $conf); unset($conf['mimeConf.']); $conf['params.'] = array_merge((array) $conf['params.'], $conf['predefined']); $content = $this->QTOBJECT($conf); break; - case 'embed': + case 'embed' : $paramsArray = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.'], $conf['predefined']); - $conf['params']= ''; + $conf['params'] = ''; foreach ($paramsArray as $key => $value) { $conf['params'] .= $key . '=' . $value . LF; } $content = $this->MULTIMEDIA($conf); break; - default: - if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'])) { + default : + if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaRender'] as $classRef) { $hookObj = t3lib_div::getUserObj($classRef); $conf['file'] = $url; @@ -2842,7 +3109,7 @@ /** * Rendering the cObject, SWFOBJECT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output */ public function SWFOBJECT($conf) { @@ -2854,7 +3121,8 @@ } if ($GLOBALS['TSFE']->absRefPrefix) { $prefix = $GLOBALS['TSFE']->absRefPrefix; - }; + } + ; $typeConf = $conf[$conf['type'] . '.']; @@ -2892,7 +3160,7 @@ // Hook for manipulating the conf array, it's needed for some players like flowplayer if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['swfParamTransform'])) { - foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['swfParamTransform'] as $classRef) { + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['swfParamTransform'] as $classRef) { t3lib_div::callUserFunction($classRef, $conf, $this); } } @@ -2913,7 +3181,7 @@ $flashVersion = $this->stdWrap($conf['flashVersion'], $conf['flashVersion.']); if (!$flashVersion) { - $flashVersion = '9'; + $flashVersion = '9'; } $replaceElementIdString = uniqid('mmswf'); @@ -2949,7 +3217,7 @@ /** * Rendering the cObject, QTOBJECT * - * @param array Array of TypoScript properties + * @param array array of TypoScript properties * @return string Output */ public function QTOBJECT($conf) { @@ -2963,7 +3231,7 @@ $prefix = $GLOBALS['TSFE']->absRefPrefix; } - $filename = $this->stdWrap($conf['file'],$conf['file.']); + $filename = $this->stdWrap($conf['file'], $conf['file.']); $typeConf = $conf[$conf['type'] . '.']; @@ -2973,13 +3241,13 @@ $GLOBALS['TSFE']->register['MMQTID'] = $replaceElementIdString; $qtObject = 'QTObject' . $replaceElementIdString; - // merge with default parameters + // merge with default parameters $conf['params.'] = array_merge((array) $typeConf['default.']['params.'], (array) $conf['params.']); if (is_array($conf['params.'])) { t3lib_div::remapArrayKeys($conf['params.'], $typeConf['mapping.']['params.']); foreach ($conf['params.'] as $key => $value) { - $params .= $qtObject . '.addParam("' .$key . '", "' . $value . '");' . LF; + $params .= $qtObject . '.addParam("' . $key . '", "' . $value . '");' . LF; } } $params = ($params ? substr($params, 0, -2) : '') . LF . $qtObject . '.write("' . $replaceElementIdString . '");'; @@ -2994,7 +3262,8 @@ $width = $width ? $width : $conf[$conf['type'] . '.']['defaultWidth']; $height = $height ? $height : $conf[$conf['type'] . '.']['defaultHeight']; - $embed = 'var ' . $qtObject . ' = new QTObject("' . $prefix . $filename . '", "' . $replaceElementIdString . '", "' . $width . '", "' . $height . '");'; + $embed = 'var ' . $qtObject . ' = new QTObject("' . $prefix . $filename . '", "' . + $replaceElementIdString . '", "' . $width . '", "' . $height . '");'; $content = $layout . ' '; - $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'] = - ''; + $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'] = ''; return $JSPart; } @@ -7152,12 +7644,12 @@ * @return boolean Whether a configuration for including libs was found and processed */ protected function includeLibs(array $config) { - $librariesIncluded = false; + $librariesIncluded = FALSE; if (isset($config['includeLibs']) && $config['includeLibs']) { - $libraries = t3lib_div::trimExplode(',', $config['includeLibs'], true); + $libraries = t3lib_div::trimExplode(',', $config['includeLibs'], TRUE); $GLOBALS['TSFE']->includeLibraries($libraries); - $librariesIncluded = true; + $librariesIncluded = TRUE; } return $librariesIncluded; @@ -7184,44 +7676,19 @@ */ protected function isClassAvailable($className, array $config = NULL) { if (class_exists($className)) { - return true; + return TRUE; } elseif ($config) { - $pluginConfiguration =& $GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.']; + $pluginConfiguration = & $GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.']; if (isset($pluginConfiguration['includeLibs']) && $pluginConfiguration['includeLibs']) { $config['includeLibs'] = $pluginConfiguration['includeLibs']; return $this->includeLibs($config); } } - return false; + return FALSE; } - - - - - - - - - - - - - - - - - - - - - - - - - /*********************************************** * * Database functions, making of queries @@ -7235,22 +7702,26 @@ * @param string The table name, should be in $TCA * @param integer The UID of the record from $table which we are going to delete * @param boolean If set, the query is executed. IT'S HIGHLY RECOMMENDED TO USE THIS FLAG to execute the query directly!!! - * @return string The query, ready to execute unless $doExec was true in which case the return value is false. + * @return string The query, ready to execute unless $doExec was TRUE in which case the return value is FALSE. * @see DBgetUpdate(), DBgetInsert(), user_feAdmin */ - function DBgetDelete($table, $uid, $doExec=FALSE) { - if (intval($uid)) { - if ($GLOBALS['TCA'][$table]['ctrl']['delete']) { - if ($doExec) { - return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), array($GLOBALS['TCA'][$table]['ctrl']['delete'] => 1)); + function DBgetDelete($table, $uid, $doExec = FALSE) { + if (intval($uid)) { + if ($GLOBALS['TCA'][$table]['ctrl']['delete']) { + if ($doExec) { + return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), array( + $GLOBALS['TCA'][$table]['ctrl']['delete'] => 1 + )); } else { - return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid='.intval($uid), array($GLOBALS['TCA'][$table]['ctrl']['delete'] => 1)); + return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . intval($uid), array( + $GLOBALS['TCA'][$table]['ctrl']['delete'] => 1 + )); } } else { - if ($doExec) { - return $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid='.intval($uid)); + if ($doExec) { + return $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid=' . intval($uid)); } else { - return $GLOBALS['TYPO3_DB']->DELETEquery($table, 'uid='.intval($uid)); + return $GLOBALS['TYPO3_DB']->DELETEquery($table, 'uid=' . intval($uid)); } } } @@ -7267,32 +7738,32 @@ * @param array The data array where key/value pairs are fieldnames/values for the record to update. * @param string Comma list of fieldnames which are allowed to be updated. Only values from the data record for fields in this list will be updated!! * @param boolean If set, the query is executed. IT'S HIGHLY RECOMMENDED TO USE THIS FLAG to execute the query directly!!! - * @return string The query, ready to execute unless $doExec was true in which case the return value is false. + * @return string The query, ready to execute unless $doExec was TRUE in which case the return value is FALSE. * @see DBgetInsert(), DBgetDelete(), user_feAdmin */ - function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE) { - unset($dataArr['uid']); // uid can never be set - $uid=intval($uid); + function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec = FALSE) { + unset($dataArr['uid']); // uid can never be set + $uid = intval($uid); - if ($uid) { - $fieldList = implode(',',t3lib_div::trimExplode(',',$fieldList,1)); - $updateFields=array(); + if ($uid) { + $fieldList = implode(',', t3lib_div::trimExplode(',', $fieldList, 1)); + $updateFields = array(); - foreach($dataArr as $f => $v) { - if (t3lib_div::inList($fieldList,$f)) { + foreach ($dataArr as $f => $v) { + if (t3lib_div::inList($fieldList, $f)) { $updateFields[$f] = $v; } } - if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) { + if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) { $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME']; } - if (count($updateFields)) { - if ($doExec) { - return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields); + if (count($updateFields)) { + if ($doExec) { + return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $updateFields); } else { - return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid='.intval($uid), $updateFields); + return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . intval($uid), $updateFields); } } } @@ -7309,37 +7780,52 @@ * @param array The data array where key/value pairs are fieldnames/values for the record to insert * @param string Comma list of fieldnames which are allowed to be inserted. Only values from the data record for fields in this list will be inserted!! * @param boolean If set, the query is executed. IT'S HIGHLY RECOMMENDED TO USE THIS FLAG to execute the query directly!!! - * @return string The query, ready to execute unless $doExec was true in which case the return value is false. + * @return string The query, ready to execute unless $doExec was TRUE in which case the return value is FALSE. * @see DBgetUpdate(), DBgetDelete(), user_feAdmin */ - function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE) { - $extraList='pid'; + function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec = FALSE) { + $extraList = 'pid'; if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) { $field = $GLOBALS['TCA'][$table]['ctrl']['tstamp']; $dataArr[$field] = $GLOBALS['EXEC_TIME']; $extraList .= ',' . $field; } if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) { - $field=$GLOBALS['TCA'][$table]['ctrl']['crdate']; + $field = $GLOBALS['TCA'][$table]['ctrl']['crdate']; $dataArr[$field] = $GLOBALS['EXEC_TIME']; $extraList .= ',' . $field; } - if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['cruser_id']; $dataArr[$field]=0; $extraList.=','.$field;} - if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']; $dataArr[$field]=intval($GLOBALS['TSFE']->fe_user->user['uid']); $extraList.=','.$field;} - if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']; list($dataArr[$field])=explode(',',$GLOBALS['TSFE']->fe_user->user['usergroup']); $dataArr[$field]=intval($dataArr[$field]); $extraList.=','.$field;} + if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) { + $field = $GLOBALS['TCA'][$table]['ctrl']['cruser_id']; + $dataArr[$field] = 0; + $extraList .= ',' . $field; + } + if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { + $field = $GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']; + $dataArr[$field] = intval($GLOBALS['TSFE']->fe_user->user['uid']); + $extraList .= ',' . $field; + } + if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { + $field = $GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']; + list ($dataArr[$field]) = explode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']); + $dataArr[$field] = intval($dataArr[$field]); + $extraList .= ',' . $field; + } - unset($dataArr['uid']); // uid can never be set - if ($pid>=0) { $dataArr['pid'] = $pid; } // Set pid < 0 and the dataarr-pid will be used! - $fieldList = implode(',',t3lib_div::trimExplode(',',$fieldList.','.$extraList,1)); + unset($dataArr['uid']); // uid can never be set + if ($pid >= 0) { + $dataArr['pid'] = $pid; + } // Set pid < 0 and the dataarr-pid will be used! + $fieldList = implode(',', t3lib_div::trimExplode(',', $fieldList . ',' . $extraList, 1)); $insertFields = array(); - foreach($dataArr as $f => $v) { - if (t3lib_div::inList($fieldList,$f)) { + foreach ($dataArr as $f => $v) { + if (t3lib_div::inList($fieldList, $f)) { $insertFields[$f] = $v; } } - if ($doExec) { + if ($doExec) { return $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields); } else { return $GLOBALS['TYPO3_DB']->INSERTquery($table, $insertFields); @@ -7357,28 +7843,33 @@ * @return boolean * @see user_feAdmin */ - function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0) { - $groupList = $allowedGroups ? implode(',',array_intersect(t3lib_div::trimExplode(',',$feUserRow['usergroup'],1),t3lib_div::trimExplode(',',$allowedGroups,1))) : $feUserRow['usergroup']; - $ok=0; + function DBmayFEUserEdit($table, $row, $feUserRow, $allowedGroups = '', $feEditSelf = 0) { + $groupList = $allowedGroups + ? implode(',', array_intersect( + t3lib_div::trimExplode(',', $feUserRow['usergroup'], 1), + t3lib_div::trimExplode(',', $allowedGroups, 1) + )) + : $feUserRow['usergroup']; + $ok = 0; // points to the field that allows further editing from frontend if not set. If set the record is locked. - if (!$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] || !$row[$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']]) { + if (!$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] || !$row[$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']]) { // points to the field (integer) that holds the fe_users-id of the creator fe_user - if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { + if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']]); - if ($rowFEUser && $rowFEUser==$feUserRow['uid']) { - $ok=1; + if ($rowFEUser && $rowFEUser == $feUserRow['uid']) { + $ok = 1; } } // If $feEditSelf is set, fe_users may always edit them selves... - if ($feEditSelf && $table=='fe_users' && !strcmp($feUserRow['uid'],$row['uid'])) { - $ok=1; + if ($feEditSelf && $table == 'fe_users' && !strcmp($feUserRow['uid'], $row['uid'])) { + $ok = 1; } // points to the field (integer) that holds the fe_group-id of the creator fe_user's first group - if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { + if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']]); - if ($rowFEUser) { - if (t3lib_div::inList($groupList, $rowFEUser)) { - $ok=1; + if ($rowFEUser) { + if (t3lib_div::inList($groupList, $rowFEUser)) { + $ok = 1; } } } @@ -7388,7 +7879,8 @@ /** * Returns part of a where clause for selecting records from the input table name which the user may edit. - * Conceptually close to the function DBmayFEUserEdit(); It does the same thing but not for a single record, rather for a select query selecting all records which the user HAS access to. + * Conceptually close to the function DBmayFEUserEdit(); It does the same thing but not for a single record, + * rather for a select query selecting all records which the user HAS access to. * * @param string The table name * @param array The array of the fe_user which is evaluated, typ. $GLOBALS['TSFE']->fe_user->user @@ -7397,58 +7889,68 @@ * @return string The where clause part. ALWAYS returns a string. If no access at all, then " AND 1=0" * @see DBmayFEUserEdit(), user_feAdmin::displayEditScreen() */ - function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0) { + function DBmayFEUserEditSelect($table, $feUserRow, $allowedGroups = '', $feEditSelf = 0) { // Returns where-definition that selects user-editable records. - $groupList = $allowedGroups ? implode(',',array_intersect(t3lib_div::trimExplode(',',$feUserRow['usergroup'],1),t3lib_div::trimExplode(',',$allowedGroups,1))) : $feUserRow['usergroup']; - $OR_arr=array(); + $groupList = $allowedGroups ? implode(',', array_intersect(t3lib_div::trimExplode(',', $feUserRow['usergroup'], 1), t3lib_div::trimExplode(',', $allowedGroups, 1))) : $feUserRow['usergroup']; + $OR_arr = array(); // points to the field (integer) that holds the fe_users-id of the creator fe_user - if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { - $OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id'].'='.$feUserRow['uid']; + if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { + $OR_arr[] = $GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id'] . '=' . $feUserRow['uid']; } // points to the field (integer) that holds the fe_group-id of the creator fe_user's first group - if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { - $values = t3lib_div::intExplode(',',$groupList); + if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { + $values = t3lib_div::intExplode(',', $groupList); foreach ($values as $theGroupUid) { - if ($theGroupUid) {$OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'].'='.$theGroupUid;} + if ($theGroupUid) { + $OR_arr[] = $GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'] . '=' . $theGroupUid; + } } } // If $feEditSelf is set, fe_users may always edit them selves... - if ($feEditSelf && $table=='fe_users') { - $OR_arr[]='uid='.intval($feUserRow['uid']); + if ($feEditSelf && $table == 'fe_users') { + $OR_arr[] = 'uid=' . intval($feUserRow['uid']); } - $whereDef=' AND 1=0'; - if (count($OR_arr)) { - $whereDef=' AND ('.implode(' OR ',$OR_arr).')'; - if ($GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']) { - $whereDef.=' AND '.$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'].'=0'; + $whereDef = ' AND 1=0'; + if (count($OR_arr)) { + $whereDef = ' AND (' . implode(' OR ', $OR_arr) . ')'; + if ($GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']) { + $whereDef .= ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] . '=0'; } } return $whereDef; } /** - * Returns a part of a WHERE clause which will filter out records with start/end times or hidden/fe_groups fields set to values that should de-select them according to the current time, preview settings or user login. Definitely a frontend function. - * THIS IS A VERY IMPORTANT FUNCTION: Basically you must add the output from this function for EVERY select query you create for selecting records of tables in your own applications - thus they will always be filtered according to the "enablefields" configured in TCA - * Simply calls t3lib_pageSelect::enableFields() BUT will send the show_hidden flag along! This means this function will work in conjunction with the preview facilities of the frontend engine/Admin Panel. + * Returns a part of a WHERE clause which will filter out records with start/end times or hidden/fe_groups fields + * set to values that should de-select them according to the current time, preview settings or user login. + * Definitely a frontend function. + * THIS IS A VERY IMPORTANT FUNCTION: Basically you must add the output from this function for EVERY select query you create + * for selecting records of tables in your own applications - thus they will always be filtered according to the "enablefields" + * configured in TCA + * Simply calls t3lib_pageSelect::enableFields() BUT will send the show_hidden flag along! + * This means this function will work in conjunction with the preview facilities of the frontend engine/Admin Panel. * * @param string The table for which to get the where clause * @param boolean If set, then you want NOT to filter out hidden records. Otherwise hidden record are filtered based on the current preview settings. * @return string The part of the where clause on the form " AND [fieldname]=0 AND ...". Eg. " AND hidden=0 AND starttime < 123345567" * @see t3lib_pageSelect::enableFields() */ - function enableFields($table,$show_hidden=0) { - return $GLOBALS['TSFE']->sys_page->enableFields($table,$show_hidden?$show_hidden:($table=='pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords)); + function enableFields($table, $show_hidden = 0) { + return $GLOBALS['TSFE']->sys_page->enableFields( + $table, + $show_hidden ? $show_hidden : ($table == 'pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords) + ); } /** * Generates a list of Page-uid's from $id. List does not include $id itself * (unless the id specified is negative in which case it does!) * The only pages WHICH PREVENTS DECENDING in a branch are - * - deleted pages, - * - pages in a recycler (doktype = 255) or of the Backend User Section (doktpe = 6) type - * - pages that has the extendToSubpages set, WHERE start/endtime, hidden - * and fe_users would hide the records. + * - deleted pages, + * - pages in a recycler (doktype = 255) or of the Backend User Section (doktpe = 6) type + * - pages that has the extendToSubpages set, WHERE start/endtime, hidden + * and fe_users would hide the records. * Apart from that, pages with enable-fields excluding them, will also be * removed. HOWEVER $dontCheckEnableFields set will allow * enableFields-excluded pages to be included anyway - including @@ -7462,20 +7964,21 @@ * @param boolean See function description * @param string Additional fields to select. Syntax: ",[fieldname],[fieldname],..." * @param string Additional where clauses. Syntax: " AND [fieldname]=[value] AND ..." - * @param array Array of IDs from previous recursions. In order to prevent infinite loops with mount pages. + * @param array array of IDs from previous recursions. In order to prevent infinite loops with mount pages. * @param integer Internal: Zero for the first recursion, incremented for each recursive call. * @return string Returns the list with a comma in the end (if any pages selected and not if $id is negative and $id is added itself) - which means the input page id can comfortably be appended to the output string if you need it to. * @see tslib_fe::checkEnableFields(), tslib_fe::checkPagerecordForIncludeSection() */ - public function getTreeList($id, $depth, $begin = 0, $dontCheckEnableFields = false, $addSelectFields = '', $moreWhereClauses = '', array $prevId_array = array(), $recursionLevel = 0) { + public function getTreeList($id, $depth, $begin = 0, $dontCheckEnableFields = FALSE, $addSelectFields = '', $moreWhereClauses = '', array $prevId_array = array(), $recursionLevel = 0) { // Init vars: - $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state'.$addSelectFields; - $depth = intval($depth); - $begin = intval($begin); - $id = intval($id); - $theList = ''; - $addId = 0; + $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state' . + $addSelectFields; + $depth = intval($depth); + $begin = intval($begin); + $id = intval($id); + $theList = ''; + $addId = 0; $requestHash = ''; if ($id) { @@ -7498,10 +8001,11 @@ ); $requestHash = md5(serialize($parameters)); - list($cacheEntry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( + list ($cacheEntry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 'treelist', 'cache_treelist', - 'md5hash = \'' . $requestHash . '\' AND ( expires > ' . $GLOBALS['EXEC_TIME'] . ' OR expires = 0 )' + 'md5hash = \'' . $requestHash . '\' AND ( expires > ' . $GLOBALS['EXEC_TIME'] . + ' OR expires = 0 )' ); if (is_array($cacheEntry)) { @@ -7526,7 +8030,7 @@ } } } else { - return ''; // Return blank if the start page was NOT found at all! + return ''; // Return blank if the start page was NOT found at all! } } @@ -7540,9 +8044,7 @@ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $allFields, 'pages', - 'pid = '.intval($id).' AND deleted = 0 '.$moreWhereClauses, - '', - 'sorting' + 'pid = ' . intval($id) . ' AND deleted = 0 ' . $moreWhereClauses, '', 'sorting' ); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { @@ -7557,7 +8059,7 @@ } // Find mount point if any: - $next_id = $row['uid']; + $next_id = $row['uid']; $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($next_id, $row); // Overlay mode: @@ -7567,8 +8069,8 @@ $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery( $allFields, 'pages', - 'uid = '.intval($next_id).' AND deleted = 0 '.$moreWhereClauses, - '' , + 'uid = ' . intval($next_id) . ' AND deleted = 0 ' . $moreWhereClauses, + '', 'sorting' ); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2); @@ -7589,7 +8091,7 @@ // Add ID to list: if ($begin <= 0) { if ($dontCheckEnableFields || $GLOBALS['TSFE']->checkEnableFields($row)) { - $theList.= $next_id.','; + $theList .= $next_id . ','; } } // Next level: @@ -7600,7 +8102,16 @@ } // Call recursively, if the id is not in prevID_array: if (!in_array($next_id, $prevId_array)) { - $theList.= tslib_cObj::getTreeList($next_id, $depth-1, $begin-1, $dontCheckEnableFields, $addSelectFields, $moreWhereClauses, $prevId_array, $recursionLevel+1); + $theList .= tslib_cObj::getTreeList( + $next_id, + $depth - 1, + $begin - 1, + $dontCheckEnableFields, + $addSelectFields, + $moreWhereClauses, + $prevId_array, + $recursionLevel + 1 + ); } } } @@ -7612,19 +8123,19 @@ if (!$recursionLevel) { if ($addId) { if ($begin > 0) { - $theList.= 0; + $theList .= 0; } else { - $theList.= $addId; + $theList .= $addId; } } $GLOBALS['TYPO3_DB']->exec_INSERTquery( 'cache_treelist', array( - 'md5hash' => $requestHash, - 'pid' => $id, + 'md5hash' => $requestHash, + 'pid' => $id, 'treelist' => $theList, - 'tstamp' => $GLOBALS['EXEC_TIME'], + 'tstamp' => $GLOBALS['EXEC_TIME'] ) ); } @@ -7642,8 +8153,8 @@ * @return string * @deprecated since TYPO3 3.6 - Use $GLOBALS['TYPO3_DB']->listQuery() directly! */ - function whereSelectFromList($field,$value) { - return $GLOBALS['TYPO3_DB']->listQuery($field,$value,''); + function whereSelectFromList($field, $value) { + return $GLOBALS['TYPO3_DB']->listQuery($field, $value, ''); } /** @@ -7660,16 +8171,17 @@ * @return pointer SQL result pointer * @see mm_query_uidList() */ - function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') { + function exec_mm_query($select, $local_table, $mm_table, $foreign_table, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') { return $GLOBALS['TYPO3_DB']->exec_SELECTquery( - $select, - $local_table.','.$mm_table.($foreign_table?','.$foreign_table:''), - $local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':''). - $whereClause, // whereClauseMightContainGroupOrderBy - $groupBy, - $orderBy, - $limit - ); + $select, + $local_table . ',' . $mm_table . ($foreign_table ? ',' . $foreign_table : ''), + $local_table . '.uid=' . $mm_table . '.uid_local' . + ($foreign_table ? ' AND ' . $foreign_table . '.uid=' . $mm_table . '.uid_foreign' : '') . + $whereClause, // whereClauseMightContainGroupOrderBy + $groupBy, + $orderBy, + $limit + ); } /** @@ -7687,16 +8199,17 @@ * @return pointer SQL result pointer * @see mm_query() */ - function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='') { + function exec_mm_query_uidList($select, $local_table_uidlist, $mm_table, $foreign_table = '', $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') { return $GLOBALS['TYPO3_DB']->exec_SELECTquery( - $select, - $mm_table.($foreign_table?','.$foreign_table:''), - $mm_table.'.uid_local IN ('.$local_table_uidlist.')'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':''). - $whereClause, // whereClauseMightContainGroupOrderBy - $groupBy, - $orderBy, - $limit - ); + $select, + $mm_table . ($foreign_table ? ',' . $foreign_table : ''), + $mm_table . '.uid_local IN (' . $local_table_uidlist . ')' . + ($foreign_table ? ' AND ' . $foreign_table . '.uid=' . $mm_table . '.uid_foreign' : '') . + $whereClause, // whereClauseMightContainGroupOrderBy + $groupBy, + $orderBy, + $limit + ); } /** @@ -7708,26 +8221,26 @@ * @param string The table name you search in (recommended for DBAL compliance. Will be prepended field names as well) * @return string The WHERE clause. */ - function searchWhere($sw,$searchFieldList,$searchTable='') { + function searchWhere($sw, $searchFieldList, $searchTable = '') { global $TYPO3_DB; - $prefixTableName = $searchTable ? $searchTable.'.' : ''; + $prefixTableName = $searchTable ? $searchTable . '.' : ''; $where = ''; - if ($sw) { - $searchFields = explode(',',$searchFieldList); + if ($sw) { + $searchFields = explode(',', $searchFieldList); $kw = preg_split('/[ ,]/', $sw); foreach ($kw as $val) { $val = trim($val); $where_p = array(); - if (strlen($val)>=2) { - $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val,$searchTable),$searchTable); + if (strlen($val) >= 2) { + $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val, $searchTable), $searchTable); foreach ($searchFields as $field) { - $where_p[] = $prefixTableName.$field.' LIKE \'%'.$val.'%\''; + $where_p[] = $prefixTableName . $field . ' LIKE \'%' . $val . '%\''; } } - if (count($where_p)) { - $where.=' AND ('.implode(' OR ',$where_p).')'; + if (count($where_p)) { + $where .= ' AND (' . implode(' OR ', $where_p) . ')'; } } } @@ -7743,7 +8256,7 @@ * @return mixed A SQL result pointer * @see getQuery() */ - function exec_getQuery($table, $conf) { + function exec_getQuery($table, $conf) { $queryParts = $this->getQuery($table, $conf, TRUE); return $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); @@ -7756,33 +8269,32 @@ * @param string See ->exec_getQuery() * @param array See ->exec_getQuery() * @param boolean If set, the function will return the query not as a string but array with the various parts. RECOMMENDED! - * @return mixed A SELECT query if $returnQueryArray is false, otherwise the SELECT query in an array as parts. + * @return mixed A SELECT query if $returnQueryArray is FALSE, otherwise the SELECT query in an array as parts. * @access private * @see CONTENT(), numRows() * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=318&cHash=a98cb4e7e6 */ - function getQuery($table, $conf, $returnQueryArray=FALSE) { + function getQuery($table, $conf, $returnQueryArray = FALSE) { // Handle PDO-style named parameter markers first $queryMarkers = $this->getQueryMarkers($table, $conf); // replace the markers in the non-stdWrap properties foreach ($queryMarkers as $marker => $markerValue) { - $properties = array('uidInList', 'selectFields', 'where', 'max', - 'begin', 'groupBy', 'orderBy', 'join', 'leftjoin', 'rightjoin'); + $properties = array( + 'uidInList', 'selectFields', 'where', 'max', 'begin', 'groupBy', 'orderBy', 'join', 'leftjoin', 'rightjoin' + ); foreach ($properties as $property) { if ($conf[$property]) { - $conf[$property] = str_replace('###' . $marker . '###', - $markerValue, - $conf[$property]); + $conf[$property] = str_replace('###' . $marker . '###', $markerValue, $conf[$property]); } } } // Construct WHERE clause: - $conf['pidInList'] = trim($this->stdWrap($conf['pidInList'],$conf['pidInList.'])); + $conf['pidInList'] = trim($this->stdWrap($conf['pidInList'], $conf['pidInList.'])); - // Handle recursive function for the pidInList + // Handle recursive function for the pidInList if (isset($conf['recursive'])) { $conf['recursive'] = intval($conf['recursive']); if ($conf['recursive'] > 0) { @@ -7796,22 +8308,22 @@ } } - if (!strcmp($conf['pidInList'],'')) { + if (!strcmp($conf['pidInList'], '')) { $conf['pidInList'] = 'this'; } - $queryParts = $this->getWhere($table,$conf,TRUE); + $queryParts = $this->getWhere($table, $conf, TRUE); // Fields: $queryParts['SELECT'] = $conf['selectFields'] ? $conf['selectFields'] : '*'; // Setting LIMIT: if ($conf['max'] || $conf['begin']) { - $error=0; + $error = 0; - // Finding the total number of records, if used: - if (strstr(strtolower($conf['begin'].$conf['max']),'total')) { + // Finding the total number of records, if used: + if (strstr(strtolower($conf['begin'] . $conf['max']), 'total')) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, $queryParts['WHERE'], $queryParts['GROUPBY']); - if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { + if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { $GLOBALS['TT']->setTSlogMessage($error); } else { $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); @@ -7820,54 +8332,52 @@ } $GLOBALS['TYPO3_DB']->sql_free_result($res); } - if (!$error) { - $conf['begin'] = t3lib_div::intInRange(ceil($this->calc($conf['begin'])),0); - $conf['max'] = t3lib_div::intInRange(ceil($this->calc($conf['max'])),0); - if ($conf['begin'] && !$conf['max']) { + if (!$error) { + $conf['begin'] = t3lib_div::intInRange(ceil($this->calc($conf['begin'])), 0); + $conf['max'] = t3lib_div::intInRange(ceil($this->calc($conf['max'])), 0); + if ($conf['begin'] && !$conf['max']) { $conf['max'] = 100000; } - if ($conf['begin'] && $conf['max']) { - $queryParts['LIMIT'] = $conf['begin'].','.$conf['max']; - } elseif (!$conf['begin'] && $conf['max']) { + if ($conf['begin'] && $conf['max']) { + $queryParts['LIMIT'] = $conf['begin'] . ',' . $conf['max']; + } elseif (!$conf['begin'] && $conf['max']) { $queryParts['LIMIT'] = $conf['max']; } } } - if (!$error) { + if (!$error) { // Setting up tablejoins: - $joinPart=''; - if ($conf['join']) { - $joinPart = 'JOIN ' .trim($conf['join']); - } elseif ($conf['leftjoin']) { - $joinPart = 'LEFT OUTER JOIN ' .trim($conf['leftjoin']); - } elseif ($conf['rightjoin']) { - $joinPart = 'RIGHT OUTER JOIN ' .trim($conf['rightjoin']); + $joinPart = ''; + if ($conf['join']) { + $joinPart = 'JOIN ' . trim($conf['join']); + } elseif ($conf['leftjoin']) { + $joinPart = 'LEFT OUTER JOIN ' . trim($conf['leftjoin']); + } elseif ($conf['rightjoin']) { + $joinPart = 'RIGHT OUTER JOIN ' . trim($conf['rightjoin']); } // Compile and return query: - $queryParts['FROM'] = trim($table.' '.$joinPart); + $queryParts['FROM'] = trim($table . ' ' . $joinPart); // replace the markers in the queryParts to handle stdWrap // enabled properties foreach ($queryMarkers as $marker => $markerValue) { foreach ($queryParts as $queryPartKey => &$queryPartValue) { - $queryPartValue = str_replace('###' . $marker . '###', - $markerValue, - $queryPartValue); + $queryPartValue = str_replace('###' . $marker . '###', $markerValue, $queryPartValue); } } $query = $GLOBALS['TYPO3_DB']->SELECTquery( - $queryParts['SELECT'], - $queryParts['FROM'], - $queryParts['WHERE'], - $queryParts['GROUPBY'], - $queryParts['ORDERBY'], - $queryParts['LIMIT'] - ); + $queryParts['SELECT'], + $queryParts['FROM'], + $queryParts['WHERE'], + $queryParts['GROUPBY'], + $queryParts['ORDERBY'], + $queryParts['LIMIT'] + ); return $returnQueryArray ? $queryParts : $query; } @@ -7879,17 +8389,17 @@ * @param string The table name * @param array The TypoScript configuration properties * @param boolean If set, the function will return the query not as a string but array with the various parts. RECOMMENDED! - * @return mixed A WHERE clause based on the relevant parts of the TypoScript properties for a "select" function in TypoScript, see link. If $returnQueryArray is false the where clause is returned as a string with WHERE, GROUP BY and ORDER BY parts, otherwise as an array with these parts. + * @return mixed A WHERE clause based on the relevant parts of the TypoScript properties for a "select" function in TypoScript, see link. If $returnQueryArray is FALSE the where clause is returned as a string with WHERE, GROUP BY and ORDER BY parts, otherwise as an array with these parts. * @access private * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=318&cHash=a98cb4e7e6 * @see getQuery() */ - function getWhere($table,$conf, $returnQueryArray=FALSE) { + function getWhere($table, $conf, $returnQueryArray = FALSE) { global $TCA; - // Init: + // Init: $query = ''; - $pid_uid_flag=0; + $pid_uid_flag = 0; $queryParts = array( 'SELECT' => '', 'FROM' => '', @@ -7899,76 +8409,77 @@ 'LIMIT' => '' ); - if (trim($conf['uidInList'])) { - $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['uidInList'])); - if (count($listArr)==1) { - $query.=' AND '.$table.'.uid='.intval($listArr[0]); + if (trim($conf['uidInList'])) { + $listArr = t3lib_div::intExplode(',', str_replace('this', $GLOBALS['TSFE']->contentPid, $conf['uidInList'])); + if (count($listArr) == 1) { + $query .= ' AND ' . $table . '.uid=' . intval($listArr[0]); } else { - $query.=' AND '.$table.'.uid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($listArr)).')'; + $query .= ' AND ' . $table . '.uid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($listArr)) . ')'; } $pid_uid_flag++; } - // static_* tables are allowed to be fetched from root page - if (substr($table,0,7)=='static_') { + // static_* tables are allowed to be fetched from root page + if (substr($table, 0, 7) == 'static_') { $pid_uid_flag++; } if (trim($conf['pidInList'])) { - $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['pidInList'])); + $listArr = t3lib_div::intExplode(',', str_replace('this', $GLOBALS['TSFE']->contentPid, $conf['pidInList'])); // removes all pages which are not visible for the user! $listArr = $this->checkPidArray($listArr); - if (count($listArr)) { - $query.=' AND '.$table.'.pid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($listArr)).')'; + if (count($listArr)) { + $query .= ' AND ' . $table . '.pid IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($listArr)) . ')'; $pid_uid_flag++; } else { - $pid_uid_flag=0; // If not uid and not pid then uid is set to 0 - which results in nothing!! + $pid_uid_flag = 0; // If not uid and not pid then uid is set to 0 - which results in nothing!! } } - if (!$pid_uid_flag) { // If not uid and not pid then uid is set to 0 - which results in nothing!! - $query.=' AND '.$table.'.uid=0'; + if (!$pid_uid_flag) { // If not uid and not pid then uid is set to 0 - which results in nothing!! + $query .= ' AND ' . $table . '.uid=0'; } - if ($where = trim($conf['where'])) { - $query.=' AND '.$where; + if ($where = trim($conf['where'])) { + $query .= ' AND ' . $where; } - if ($conf['languageField']) { - if ($GLOBALS['TSFE']->sys_language_contentOL && $TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) { - // Sys language content is set to zero/-1 - and it is expected that whatever routine processes the output will OVERLAY the records with localized versions! + if ($conf['languageField']) { + if ($GLOBALS['TSFE']->sys_language_contentOL && $TCA[$table] && $TCA[$table]['ctrl']['languageField'] + && $TCA[$table]['ctrl']['transOrigPointerField']) { + // Sys language content is set to zero/-1 - and it is expected that whatever routine processes the output will + // OVERLAY the records with localized versions! $sys_language_content = '0,-1'; } else { $sys_language_content = intval($GLOBALS['TSFE']->sys_language_content); } - $query.=' AND '.$conf['languageField'].' IN ('.$sys_language_content.')'; + $query .= ' AND ' . $conf['languageField'] . ' IN (' . $sys_language_content . ')'; } - $andWhere = trim($this->stdWrap($conf['andWhere'],$conf['andWhere.'])); - if ($andWhere) { - $query.=' AND '.$andWhere; + $andWhere = trim($this->stdWrap($conf['andWhere'], $conf['andWhere.'])); + if ($andWhere) { + $query .= ' AND ' . $andWhere; } // enablefields - if ($table=='pages') { - $query.=' '.$GLOBALS['TSFE']->sys_page->where_hid_del. - $GLOBALS['TSFE']->sys_page->where_groupAccess; + if ($table == 'pages') { + $query .= ' ' . $GLOBALS['TSFE']->sys_page->where_hid_del . $GLOBALS['TSFE']->sys_page->where_groupAccess; } else { - $query.=$this->enableFields($table); + $query .= $this->enableFields($table); } // MAKE WHERE: - if ($query) { - $queryParts['WHERE'] = trim(substr($query,4)); // Stripping of " AND"... - $query = 'WHERE '.$queryParts['WHERE']; + if ($query) { + $queryParts['WHERE'] = trim(substr($query, 4)); // Stripping of " AND"... + $query = 'WHERE ' . $queryParts['WHERE']; } // GROUP BY - if (trim($conf['groupBy'])) { + if (trim($conf['groupBy'])) { $queryParts['GROUPBY'] = trim($conf['groupBy']); - $query.=' GROUP BY '.$queryParts['GROUPBY']; + $query .= ' GROUP BY ' . $queryParts['GROUPBY']; } // ORDER BY - if (trim($conf['orderBy'])) { + if (trim($conf['orderBy'])) { $queryParts['ORDERBY'] = trim($conf['orderBy']); - $query.=' ORDER BY '.$queryParts['ORDERBY']; + $query .= ' ORDER BY ' . $queryParts['ORDERBY']; } // Return result: @@ -7978,19 +8489,24 @@ /** * Removes Page UID numbers from the input array which are not available due to enableFields() or the list of bad doktype numbers ($this->checkPid_badDoktypeList) * - * @param array Array of Page UID numbers for select and for which pages with enablefields and bad doktypes should be removed. + * @param array array of Page UID numbers for select and for which pages with enablefields and bad doktypes should be removed. * @return array Returns the array of remaining page UID numbers * @access private * @see getWhere(),checkPid() */ - function checkPidArray($listArr) { - $outArr = Array(); - if (is_array($listArr) && count($listArr)) { - $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid IN ('.implode(',',$listArr).')'.$this->enableFields('pages').' AND doktype NOT IN ('.$this->checkPid_badDoktypeList.')'); - if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { - $GLOBALS['TT']->setTSlogMessage($error.': '.$query,3); + function checkPidArray($listArr) { + $outArr = array(); + if (is_array($listArr) && count($listArr)) { + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( + 'uid', + 'pages', + 'uid IN (' . implode(',', $listArr) . ')' . $this->enableFields('pages') . + ' AND doktype NOT IN (' . $this->checkPid_badDoktypeList . ')' + ); + if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { + $GLOBALS['TT']->setTSlogMessage($error . ': ' . $query, 3); } else { - while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $outArr[] = $row['uid']; } } @@ -8007,17 +8523,16 @@ * @access private * @see getWhere(), checkPidArray() */ - function checkPid($uid) { + function checkPid($uid) { $uid = intval($uid); - if (!isset($this->checkPid_cache[$uid])) { + if (!isset($this->checkPid_cache[$uid])) { $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows( 'uid', 'pages', - 'uid=' . intval($uid) . - $this->enableFields('pages') . + 'uid=' . intval($uid) . $this->enableFields('pages') . ' AND doktype NOT IN (' . $this->checkPid_badDoktypeList . ')' ); - $this->checkPid_cache[$uid] = (bool)$count; + $this->checkPid_cache[$uid] = (bool) $count; } return $this->checkPid_cache[$uid]; } @@ -8037,17 +8552,14 @@ // parse markers and prepare their values $markerValues = array(); if (is_array($conf['markers.'])) { - foreach($conf['markers.'] as $dottedMarker => $dummy) { + foreach ($conf['markers.'] as $dottedMarker => $dummy) { $marker = rtrim($dottedMarker, '.'); if ($dottedMarker == $marker . '.') { // parse definition - $tempValue = $this->stdWrap( - $conf['markers.'][$dottedMarker]['value'], - $conf['markers.'][$dottedMarker] - ); + $tempValue = $this->stdWrap($conf['markers.'][$dottedMarker]['value'], $conf['markers.'][$dottedMarker]); // quote/escape if needed if (is_numeric($tempValue)) { - if ((int)$tempValue == $tempValue) { + if ((int) $tempValue == $tempValue) { // handle integer $markerValues[$marker] = intval($tempValue); } else { @@ -8065,7 +8577,7 @@ $tempArray = array(); foreach ($explodeValues as $listValue) { if (is_numeric($listValue)) { - if ((int)$listValue == $listValue) { + if ((int) $listValue == $listValue) { $tempArray[] = intval($listValue); } else { $tempArray[] = floatval($listValue); @@ -8073,13 +8585,9 @@ } else { // if quoted, remove quotes before // escaping. - if (preg_match('/^\'([^\']*)\'$/', - $listValue, - $matches)) { + if (preg_match('/^\'([^\']*)\'$/', $listValue, $matches)) { $listValue = $matches[1]; - } elseif (preg_match('/^\"([^\"]*)\"$/', - $listValue, - $matches)) { + } elseif (preg_match('/^\"([^\"]*)\"$/', $listValue, $matches)) { $listValue = $matches[1]; } $tempArray[] = $GLOBALS['TYPO3_DB']->fullQuoteStr($listValue, $table); @@ -8102,29 +8610,6 @@ - - - - - - - - - - - - - - - - - - - - - - - /*********************************************** * * Frontend editing functions @@ -8143,10 +8628,10 @@ * @return string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned. * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=375&cHash=7d8915d508 */ - function editPanel($content, $conf, $currentRecord='', $dataArr=array()) { + function editPanel($content, $conf, $currentRecord = '', $dataArr = array()) { - if($GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit)) { - if(!$currentRecord) { + if ($GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit)) { + if (!$currentRecord) { $currentRecord = $this->currentRecord; } @@ -8154,7 +8639,7 @@ $dataArr = $this->data; } - // Delegate rendering of the edit panel to the t3lib_frontendedit class. + // Delegate rendering of the edit panel to the t3lib_frontendedit class. $content = $GLOBALS['BE_USER']->frontendEdit->displayEditPanel($content, $conf, $currentRecord, $dataArr); } @@ -8173,9 +8658,9 @@ * @param string Additional URL parameters for the link pointing to alt_doc.php * @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content. */ - function editIcons($content, $params, $conf=array(), $currentRecord='', $dataArr=array(), $addUrlParamStr='') { - if($GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit)) { - if(!$currentRecord) { + function editIcons($content, $params, $conf = array(), $currentRecord = '', $dataArr = array(), $addUrlParamStr = '') { + if ($GLOBALS['TSFE']->beUserLogin && ($GLOBALS['BE_USER']->frontendEdit instanceof t3lib_frontendedit)) { + if (!$currentRecord) { $currentRecord = $this->currentRecord; } @@ -8184,7 +8669,14 @@ } // Delegate rendering of the edit panel to the t3lib_frontendedit class. - $content = $GLOBALS['BE_USER']->frontendEdit->displayEditIcons($content, $params, $conf, $currentRecord, $dataArr, $addURLParamStr); + $content = $GLOBALS['BE_USER']->frontendEdit->displayEditIcons( + $content, + $params, + $conf, + $currentRecord, + $dataArr, + $addUrlParamStr + ); } return $content; @@ -8192,7 +8684,7 @@ /** - * Returns true if the input table/row would be hidden in the frontend (according nto the current time and simulate user group) + * Returns TRUE if the input table/row would be hidden in the frontend (according nto the current time and simulate user group) * * @param string The table name * @param array The data record @@ -8200,30 +8692,25 @@ * @access private * @see editPanelPreviewBorder() */ - function isDisabled($table,$row) { + function isDisabled($table, $row) { global $TCA; - if ( - ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) || - ($TCA[$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup && $row[$TCA[$table]['ctrl']['enablecolumns']['fe_group']]==$GLOBALS['TSFE']->simUserGroup) || - ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME']) || - ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME']) - ) return true; + if (($TCA[$table]['ctrl']['enablecolumns']['disabled'] + && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) + || ($TCA[$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup + && $row[$TCA[$table]['ctrl']['enablecolumns']['fe_group']] == $GLOBALS['TSFE']->simUserGroup) + || ($TCA[$table]['ctrl']['enablecolumns']['starttime'] + && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME']) + || ($TCA[$table]['ctrl']['enablecolumns']['endtime'] + && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] + && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME'])) { + + return TRUE; + } } } - - - - - - - - - - - /** * Rendering of framesets * @@ -8241,29 +8728,29 @@ * @see TSpagegen::renderContentWithHeader() * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=343&cHash=41ca925386 */ - function make($setup) { + function make($setup) { $content = ''; - if (is_array($setup)) { - $sKeyArray=t3lib_TStemplate::sortedKeyList($setup); + 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) { + $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.='frameParams($conf,$typeNum).' />'.LF; + $content .= 'frameParams($conf, $typeNum) . ' />' . LF; break; - case 'FRAMESET': + case 'FRAMESET' : $frameset = t3lib_div::makeInstance('tslib_frameset'); - $content.=$frameset->make($conf).LF; + $content .= $frameset->make($conf) . LF; break; } } } - return 'framesetParams($setup).'>'.LF.$content.''; + return 'framesetParams($setup) . '>' . LF . $content . ''; } } @@ -8277,7 +8764,7 @@ * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/7/9/ * @see make(), t3lib_TStemplate::linkData() */ - function frameParams($setup, $typeNum) { + function frameParams($setup, $typeNum) { $paramStr = ''; $name = $setup['obj']; @@ -8286,50 +8773,56 @@ if (is_array($setup['src.'])) { $src = $GLOBALS['TSFE']->cObj->stdWrap($src, $setup['src.']); } - $paramStr.=' src="'.htmlspecialchars($src).'"'; + $paramStr .= ' src="' . htmlspecialchars($src) . '"'; } else { - $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'',$GLOBALS['TSFE']->no_cache,'','',($setup['options']?'&'.$setup['options']:'').$GLOBALS['TSFE']->cObj->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']), intval($typeNum)); + $LD = $GLOBALS['TSFE']->tmpl->linkData( + $GLOBALS['TSFE']->page, + '', + $GLOBALS['TSFE']->no_cache, + '', + '', + ($setup['options'] ? '&' . $setup['options'] : '') . + $GLOBALS['TSFE']->cObj->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']), intval($typeNum) + ); $finalURL = $LD['totalURL']; - $paramStr.=' src="'.htmlspecialchars($finalURL).'"'; + $paramStr .= ' src="' . htmlspecialchars($finalURL) . '"'; } - if ($setup['name']) {$paramStr.=' name="'.$setup['name'].'"';} else {$paramStr.=' name="'.$name.'"';} - if ($setup['params']) {$paramStr.=' '.$setup['params'];} + if ($setup['name']) { + $paramStr .= ' name="' . $setup['name'] . '"'; + } else { + $paramStr .= ' name="' . $name . '"'; + } + if ($setup['params']) { + $paramStr .= ' ' . $setup['params']; + } return $paramStr; } /** - * Creates the attributes for a tag based on a conf array ($setup) + * Creates the attributes for a tag based on a conf array($setup) * - * @param array The setup array (TypoScript properties) + * @param array The setup array(TypoScript properties) * @return string Attributes with preceeding space. * @access private * @see make() */ - function framesetParams($setup) { + function framesetParams($setup) { $paramStr = ''; - if ($setup['cols']) { $paramStr.=' cols="'.$setup['cols'].'"'; } - if ($setup['rows']) { $paramStr.=' rows="'.$setup['rows'].'"'; } - if ($setup['params']) { $paramStr.=' '.$setup['params']; } + if ($setup['cols']) { + $paramStr .= ' cols="' . $setup['cols'] . '"'; + } + if ($setup['rows']) { + $paramStr .= ' rows="' . $setup['rows'] . '"'; + } + if ($setup['params']) { + $paramStr .= ' ' . $setup['params']; + } return $paramStr; } } - - - - - - - - - - - - - - /** * Rendering of tables for offset * @@ -8338,7 +8831,7 @@ * @package TYPO3 * @subpackage tslib */ -class tslib_tableOffset { +class tslib_tableOffset { var $tableParams = 'border="0" cellspacing="0" cellpadding="0"'; var $default_tableParams = 'border="0" cellspacing="0" cellpadding="0"'; var $tdParams = ' width="99%" valign="top"'; @@ -8350,76 +8843,80 @@ * @param string List of offset parameters; x,y,r,b,w,h * @return string The HTML content string being wrapped in a offsetting the content as the $offset parameters defined */ - function start($content,$offset) { - $valPairs = t3lib_div::intExplode(',',$offset.',,,,,'); + function start($content, $offset) { + $valPairs = t3lib_div::intExplode(',', $offset . ',,,,,'); - if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) { + if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) { // If width is defined AND there has been no change to the default table params, then extend them to a tablewidth of 1 - if ($valPairs[4] && $this->default_tableParams==$this->tableParams) {$this->tableParams.=' width="1"';} + if ($valPairs[4] && $this->default_tableParams == $this->tableParams) { + $this->tableParams .= ' width="1"'; + } // Init: - $this->begin = LF.'
tableParams.'>'; + $this->begin = LF . '
tableParams . '>'; $this->end = '
'; - $rows=array(); + $rows = array(); $widthImg = ''; $heightImg = ''; // If width is required, set so bottom column will display for sure - if ($valPairs[4]) { - if (!$valPairs[3]) $valPairs[3]=1; - $widthImg=''; + if ($valPairs[4]) { + if (!$valPairs[3]) + $valPairs[3] = 1; + $widthImg = ''; } // If height is required, set so right column will display for sure - if ($valPairs[5]) { - if (!$valPairs[2]) $valPairs[2]=1; - $valPairs[2]=1; $heightImg=''; + if ($valPairs[5]) { + if (!$valPairs[2]) + $valPairs[2] = 1; + $valPairs[2] = 1; + $heightImg = ''; } // First row: - if ($valPairs[1]) { // top - $rows[1].= ''; - $rows[1].= ''; - if ($valPairs[0]) $rows[1].= ''; - if ($valPairs[2]) $rows[1].= ''; - $rows[1].= ''; + if ($valPairs[1]) { // top + $rows[1] .= ''; + $rows[1] .= ''; + if ($valPairs[0]) + $rows[1] .= ''; + if ($valPairs[2]) + $rows[1] .= ''; + $rows[1] .= ''; } // Middle row: - $rows[2].= ''; - if ($valPairs[0]) {$rows[2].= $valPairs[1] ? '' : '';} - $rows[2].= 'tdParams.'>'.$content.''; - if ($valPairs[2]) {$rows[2].= $valPairs[3] ? ''.$heightImg.'' : '';} - $rows[2].= ''; + $rows[2] .= ''; + if ($valPairs[0]) { + $rows[2] .= $valPairs[1] ? '' : ''; + } + $rows[2] .= 'tdParams . '>' . $content . ''; + if ($valPairs[2]) { + $rows[2] .= $valPairs[3] ? '' . $heightImg . '' : ''; + } + $rows[2] .= ''; // Bottom row: - if ($valPairs[3]) { // bottom - $rows[3].= ''; - if ($valPairs[0]) $rows[3].= ''; - if ($valPairs[2]) $rows[3].= ''.$widthImg.''; - $rows[3].= ''; - $rows[3].= ''; + if ($valPairs[3]) { // bottom + $rows[3] .= ''; + if ($valPairs[0]) + $rows[3] .= ''; + if ($valPairs[2]) + $rows[3] .= '' . $widthImg . ''; + $rows[3] .= ''; + $rows[3] .= ''; } - return $this->begin.implode('',$rows).$this->end; - } else return $content; + return $this->begin . implode('', $rows) . $this->end; + } else + return $content; } } - - - - - - - - - - - - - - - - - - /** * Rendering of tables for content positioning * @@ -8428,29 +8925,34 @@ * @package TYPO3 * @subpackage tslib */ -class tslib_controlTable { - var $offX = 0; // offset, x - var $offY = 0; // offset, y +class tslib_controlTable { + var $offX = 0; // offset, x + var $offY = 0; // offset, y - var $tm = ''; // top menu - var $lm = ''; // left menu - var $rm = ''; // right menu - var $bm = ''; // bottom menu - var $content = ''; // content - var $tmTDparams = 'valign="top"'; // top menu TDparams - var $lmTDparams = 'valign="top"'; // left menu TDparams - var $rmTDparams = 'valign="top"'; // right menu TDparams - var $bmTDparams = 'valign="top"'; // bottom menu TDparams - var $contentTDparams = 'valign="top"'; // content TDparams + var $tm = ''; // top menu + var $lm = ''; // left menu + var $rm = ''; // right menu + var $bm = ''; // bottom menu + var $content = ''; // content - var $cMl = 1; // content margin, left - var $cMr = 1; // content margin, right - var $cMt = 0; // content margin, top - var $cMb = 1; // content margin, bottom - var $contentW = 0; // Places a little gif-spacer in the bottom of the content frame + var $tmTDparams = 'valign="top"'; // top menu TDparams + var $lmTDparams = 'valign="top"'; // left menu TDparams + var $rmTDparams = 'valign="top"'; // right menu TDparams + var $bmTDparams = 'valign="top"'; // bottom menu TDparams + var $contentTDparams = 'valign="top"'; // content TDparams + + var $cMl = 1; // content margin, left + var $cMr = 1; // content margin, right + var $cMt = 0; // content margin, top + var $cMb = 1; // content margin, bottom + + + var $contentW = 0; // Places a little gif-spacer in the bottom of the content frame + + var $tableParams = 'border="0" cellspacing="0" cellpadding="0"'; /** @@ -8463,71 +8965,120 @@ * @see tslib_cObj::CTABLE() * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=359&cHash=2e0065b4e7 */ - function start($offset,$cMargins) { - $offArr = t3lib_div::intExplode(',',$offset); - $cMargArr = t3lib_div::intExplode(',',$cMargins); + function start($offset, $cMargins) { + $offArr = t3lib_div::intExplode(',', $offset); + $cMargArr = t3lib_div::intExplode(',', $cMargins); $cols = 0; $rows = 0; - if ($this->lm) $cols++; - if ($this->rm) $cols++; - if ($cMargArr[0]) $cols++; - if ($cMargArr[2]) $cols++; - if ($cMargArr[1]||$cMargArr[3]||$this->tm||$this->bm||$this->content||$this->contentW) $cols++; + if ($this->lm) + $cols++; + if ($this->rm) + $cols++; + if ($cMargArr[0]) + $cols++; + if ($cMargArr[2]) + $cols++; + if ($cMargArr[1] || $cMargArr[3] || $this->tm || $this->bm || $this->content || $this->contentW) + $cols++; - if ($cMargArr[1]) $rows++; - if ($cMargArr[3]) $rows++; - if ($this->tm) $rows++; - if ($this->bm) $rows++; - if ($this->content) $rows++; - if ($this->contentW) $rows++; - if (!$rows && $cols) $rows=1; // If there are no rows in the middle but still som columns... + if ($cMargArr[1]) + $rows++; + if ($cMargArr[3]) + $rows++; + if ($this->tm) + $rows++; + if ($this->bm) + $rows++; + if ($this->content) + $rows++; + if ($this->contentW) + $rows++; + if (!$rows && $cols) + $rows = 1; // If there are no rows in the middle but still som columns... - if ($rows&&$cols) { - $res = LF.'tableParams.'>'; + + if ($rows && $cols) { + $res = LF . '
tableParams . '>'; // top offset: - if ($offArr[1]) { + if ($offArr[1]) { $xoff = $offArr[0] ? 1 : 0; - if ($cols+$xoff > 1) {$colspan =' colspan="'.($cols+$xoff).'"';} - $res.= ''; + if ($cols + $xoff > 1) { + $colspan = ' colspan="' . ($cols + $xoff) . '"'; + } + $res .= ''; } // The rows: - if ($rows>1) {$rowspan =' rowspan="'.($rows).'"';} - $res.= ''; - if ($offArr[0]) { $res.=''; } - if ($this->lm) { $res.='lmTDparams.'>'.$this->lm.''; } - if ($cMargArr[0]) { $res.=''; } + if ($rows > 1) { + $rowspan = ' rowspan="' . ($rows) . '"'; + } + $res .= ''; + if ($offArr[0]) { + $res .= ''; + } + if ($this->lm) { + $res .= 'lmTDparams . '>' . $this->lm . ''; + } + if ($cMargArr[0]) { + $res .= ''; + } // content... - $middle=Array(); - if ($this->tm) { $middle[]='';} - if ($cMargArr[1]) { $middle[]='';} - if ($this->content) { $middle[]='';} - if ($cMargArr[3]) { $middle[]='';} - if ($this->bm) { $middle[]='';} - if ($this->contentW) { $middle[]='';} - if (isset($middle[0])) {$res.=$middle[0];} + $middle = array(); + if ($this->tm) { + $middle[] = ''; + } + if ($cMargArr[1]) { + $middle[] = ''; + } + if ($this->content) { + $middle[] = ''; + } + if ($cMargArr[3]) { + $middle[] = ''; + } + if ($this->bm) { + $middle[] = ''; + } + if ($this->contentW) { + $middle[] = ''; + } + if (isset($middle[0])) { + $res .= $middle[0]; + } + // Left of content - if ($cMargArr[2]) { $res.=''; } - if ($this->rm) { $res.='rmTDparams.'>'.$this->rm.''; } - $res.= ''; + if ($cMargArr[2]) { + $res .= ''; + } + if ($this->rm) { + $res .= 'rmTDparams . '>' . $this->rm . ''; + } + $res .= ''; // More than the two rows $mCount = count($middle); - for($a=1;$a<$mCount;$a++) { - $res.=''.$middle[$a].''; + for ($a = 1; $a < $mCount; $a++) { + $res .= '' . $middle[$a] . ''; } - $res.='
tmTDparams.'>'.$this->tm.'contentTDparams.'>'.$this->content.'bmTDparams.'>'.$this->bm.'tmTDparams . '>' . $this->tm . 'contentTDparams . '>' . $this->content . 'bmTDparams . '>' . $this->bm . '
'; + $res .= ''; return $res; } } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']) { - include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']); +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']) { + include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']); } ?> \ No newline at end of file