2 /***************************************************************
5 * (c) 1999-2010 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Contains classes for Content Rendering based on TypoScript Template configuration
31 * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
34 * class tslib_cObj : All main TypoScript features, rendering of content objects (cObjects). This class is the backbone of TypoScript Template rendering.
35 * class tslib_controlTable : Makes a table CTABLE (TS cObject)
36 * class tslib_tableOffset : Makes a table-offset (TS)
37 * class tslib_frameset : Generates framesets (TS)
39 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
42 * [CLASS/FUNCTION INDEX of SCRIPT]
46 * 256: class tslib_cObj
47 * 353: function start($data,$table='')
48 * 387: function setParent($data,$currentRecord)
50 * SECTION: CONTENT_OBJ:
51 * 412: function getCurrentVal()
52 * 423: function setCurrentVal($value)
53 * 436: function cObjGet($setup,$addKey='')
54 * 460: function cObjGetSingle($name,$conf,$TSkey='__')
56 * SECTION: Functions rendering content objects (cObjects)
57 * 629: function HTML($conf)
58 * 640: function TEXT($conf)
59 * 651: function CLEARGIF($conf)
60 * 670: function COBJ_ARRAY($conf,$ext='')
61 * 706: function USER($conf,$ext='')
62 * 733: function FILE($conf)
63 * 749: function IMAGE($conf)
64 * 768: function IMG_RESOURCE($conf)
65 * 780: function IMGTEXT($conf)
66 * 1203: function CONTENT($conf)
67 * 1290: function RECORDS($conf)
68 * 1370: function HMENU($conf)
69 * 1402: function CTABLE ($conf)
70 * 1440: function OTABLE ($conf)
71 * 1455: function COLUMNS ($conf)
72 * 1534: function HRULER ($conf)
73 * 1559: function CASEFUNC ($conf)
74 * 1584: function LOAD_REGISTER($conf,$name)
75 * 1624: function FORM($conf,$formData='')
76 * 2145: function SEARCHRESULT($conf)
77 * 2311: function PHP_SCRIPT($conf,$ext='')
78 * 2354: function TEMPLATE($conf)
79 * 2505: function MULTIMEDIA($conf)
81 * SECTION: Various helper functions for content objects:
82 * 2592: function getSlidePids($pidList, $pidConf)
83 * 2623: function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal)
84 * 2641: function cImage($file,$conf)
85 * 2669: function getBorderAttr($borderAttr)
86 * 2685: function imageLinkWrap($string,$imageFile,$conf)
87 * 2765: function fileResource($fName, $addParams='alt="" title=""')
88 * 2788: function lastChanged($tstamp)
89 * 2805: function linkWrap($content,$wrap)
90 * 2824: function getAltParam($conf, $longDesc=TRUE)
91 * 2859: function cleanFormName($name)
92 * 2875: function getATagParams($conf, $addGlobal=1)
94 * SECTION: HTML template processing functions
95 * 2922: function getSubpart($content, $marker)
96 * 2938: function substituteSubpart($content,$marker,$subpartContent,$recursive=1)
97 * 2951: function substituteMarker($content,$marker,$markContent)
98 * 2971: function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array())
99 * 3069: function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0)
100 * 3081: function substituteMarkerInObject(&$tree, $markContentArray)
101 * 3104: function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE)
103 * SECTION: "stdWrap" + sub functions
104 * 3167: function stdWrap($content,$conf)
105 * 3364: function numRows($conf)
106 * 3388: function listNum($content,$listNum,$char)
107 * 3408: function checkIf($conf)
108 * 3471: function filelist($data)
109 * 3553: function clean_directory($theDir)
110 * 3571: function HTMLparser_TSbridge($theValue, $conf)
111 * 3585: function dataWrap($content,$wrap)
112 * 3598: function insertData($str)
113 * 3628: function prefixComment($str,$conf,$content)
114 * 3652: function substring($content,$options)
115 * 3670: function crop($content,$options)
116 * 3702: function removeBadHTML($text, $conf)
117 * 3746: function textStyle($theValue, $conf)
118 * 3813: function tableStyle($theValue, $conf)
119 * 3854: function addParams($content,$conf)
120 * 3895: function filelink($theValue, $conf)
121 * 3966: function locDataJU($jumpUrl,$conf)
122 * 3997: function calc($val)
123 * 4026: function calcIntExplode($delim, $string)
124 * 4046: function splitObj($value, $conf)
125 * 4108: function parseFunc($theValue, $conf, $ref='')
126 * 4218: function _parseFunc ($theValue, $conf)
127 * 4424: function encaps_lineSplit($theValue, $conf)
128 * 4507: function http_makelinks($data,$conf)
129 * 4574: function mailto_makelinks($data,$conf)
130 * 4617: function getImgResource($file,$fileArray)
132 * SECTION: Data retrieval etc.
133 * 4810: function getFieldVal($field)
134 * 4830: function getData($string,$fieldArray)
135 * 4975: function rootLineValue($key,$field,$slideBack=0,$altRootLine='')
136 * 4997: function getGlobal($var, $source=NULL)
137 * 5033: function getKey($key,$arr)
138 * 5056: function TCAlookup($inputValue,$conf)
140 * SECTION: Link functions (typolink)
141 * 5116: function typoLink($linktxt, $conf)
142 * 5481: function typoLink_URL($conf)
143 * 5499: function getTypoLink($label,$params,$urlParameters=array(),$target='')
144 * 5526: function getTypoLink_URL($params,$urlParameters=array(),$target='')
145 * 5538: function typolinkWrap($conf)
146 * 5551: function currentPageUrl($urlParameters=array(),$id=0)
147 * 5564: function getClosestMPvalueForPage($pageId, $raw=FALSE)
148 * 5619: function getMailTo($mailAddress,$linktxt,$initP='?')
149 * 5658: function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE)
151 * SECTION: Miscellaneous functions, stand alone
152 * 5754: function wrap($content,$wrap,$char='|')
153 * 5770: function noTrimWrap($content,$wrap)
154 * 5784: function wrapSpace($content, $wrap)
155 * 5810: function callUserFunction($funcName,$conf,$content)
156 * 5851: function processParams($params)
157 * 5869: function keywords($content)
158 * 5886: function caseshift($theValue, $case)
159 * 5911: function HTMLcaseshift($theValue, $case)
160 * 5940: function bytes($sizeInBytes,$labels)
161 * 5951: function calcAge($seconds,$labels)
162 * 5983: function sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName='', $replyTo='')
163 * 6010: function URLqMark($url,$params)
164 * 6026: function checkEmail($email)
165 * 6038: function clearTSProperties($TSArr,$propList)
166 * 6057: function mergeTSRef($confArr,$prop)
167 * 6080: function joinTSarrays($conf,$old_conf)
168 * 6103: function gifBuilderTextBox($gifbuilderConf, $conf, $text)
169 * 6159: function linebreaks($string,$chars,$maxLines=0)
170 * 6190: function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList)
172 * SECTION: Database functions, making of queries
173 * 6260: function DBgetDelete($table, $uid, $doExec=FALSE)
174 * 6292: function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE)
175 * 6334: function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE)
176 * 6371: function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0)
177 * 6411: function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0)
178 * 6451: function enableFields($table,$show_hidden=0)
179 * 6475: function getTreeList($id,$depth,$begin=0,$dontCheckEnableFields=FALSE,$addSelectFields='',$moreWhereClauses='', $prevId_array=array(), $recursionLevel=0)
180 * 6583: function whereSelectFromList($field,$value)
181 * 6601: function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='')
182 * 6628: function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='')
183 * 6649: function searchWhere($sw,$searchFieldList,$searchTable='')
184 * 6685: function exec_getQuery($table, $conf)
185 * 6703: function getQuery($table, $conf, $returnQueryArray=FALSE)
186 * 6783: function getWhere($table,$conf, $returnQueryArray=FALSE)
187 * 6878: function checkPidArray($listArr)
188 * 6902: function checkPid($uid)
190 * SECTION: Frontend editing functions
191 * 6959: function editPanel($content, $conf, $currentRecord='', $dataArr=array())
192 * 7146: function editIcons($content,$params, $conf=array(), $currentRecord='', $dataArr=array(),$addUrlParamStr='')
193 * 7228: function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='',$nPid='')
194 * 7270: function editPanelLinkWrap_doWrap($string,$url,$currentRecord)
195 * 7298: function editPanelPreviewBorder($table,$row,$content,$thick,$conf=array())
196 * 7320: function isDisabled($table,$row)
199 * 7351: class tslib_frameset
200 * 7361: function make($setup)
201 * 7398: function frameParams($setup, $typeNum)
202 * 7426: function framesetParams($setup)
205 * 7459: class tslib_tableOffset
206 * 7471: function start($content,$offset)
209 * 7549: class tslib_controlTable
210 * 7584: function start($offset,$cMargins)
212 * TOTAL FUNCTIONS: 135
213 * (This index is automatically created/updated by the extension "extdeveval")
220 * This class contains all main TypoScript features.
221 * This includes the rendering of TypoScript content objects (cObjects).
222 * Is the backbone of TypoScript Template rendering.
224 * There are lots of functions you can use from your include-scripts.
225 * The class "tslib_cObj" is normally instantiated and referred to as "cObj".
226 * When you call your own PHP-code typically through a USER or USER_INT cObject then it is this class that instantiates the object and calls the main method. Before it does so it will set (if you are using classes) a reference to itself in the internal variable "cObj" of the object. Thus you can access all functions and data from this class by $this->cObj->... from within you classes written to be USER or USER_INT content objects.
228 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
231 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
235 'center', 'right', 'left'
239 * stdWrap functions in their correct order
243 var $stdWrapOrder = array(
244 'stdWrapPreProcess' => 1, // this is a placeholder for the first Hook
245 'setContentToCurrent' => 1,
246 'setContentToCurrent.' => 1,
265 'stdWrapOverride' => 1, // this is a placeholder for the second Hook
268 'preIfEmptyListNum' => 1,
269 'preIfEmptyListNum.' => 1,
280 'stdWrapProcess' => 1, // this is a placeholder for the third Hook
285 'fieldRequired' => 1,
286 'fieldRequired.' => 1,
302 'numberFormat.' => 1,
315 'removeBadHTML' => 1,
316 'removeBadHTML.' => 1,
324 'rawUrlEncode.' => 1,
325 'htmlSpecialChars' => 1,
326 'htmlSpecialChars.' => 1,
359 'TCAselectItem' => 1,
360 'TCAselectItem.' => 1,
388 'postUserFunc.' => 1,
389 'postUserFuncInt' => 1,
390 'postUserFuncInt.' => 1,
391 'prefixComment' => 1,
392 'prefixComment.' => 1,
397 'stdWrapPostProcess' => 1, // this is a placeholder for the last Hook
407 * Holds ImageMagick parameters and extensions used for compression
412 * 1= Dont change! (removes all parameters for the image_object!!)
416 var $image_compression = array(
418 'params' => '', 'ext' => 'gif'
421 'params' => '-colors 128', 'ext' => 'gif'
424 'params' => '-colors 64', 'ext' => 'gif'
427 'params' => '-colors 32', 'ext' => 'gif'
430 'params' => '-colors 16', 'ext' => 'gif'
433 'params' => '-colors 8', 'ext' => 'gif'
437 'params' => '-quality 100', 'ext' => 'jpg'
440 'params' => '-quality 90', 'ext' => 'jpg'
443 'params' => '-quality 80', 'ext' => 'jpg'
446 'params' => '-quality 70', 'ext' => 'jpg'
449 'params' => '-quality 60', 'ext' => 'jpg'
452 'params' => '-quality 50', 'ext' => 'jpg'
455 'params' => '-quality 40', 'ext' => 'jpg'
458 'params' => '-quality 30', 'ext' => 'jpg'
461 'params' => '-quality 20', 'ext' => 'jpg'
465 'params' => '-colors 256', 'ext' => 'png'
468 'params' => '-colors 128', 'ext' => 'png'
471 'params' => '-colors 64', 'ext' => 'png'
474 'params' => '-colors 32', 'ext' => 'png'
477 'params' => '-colors 16', 'ext' => 'png'
480 'params' => '-colors 8', 'ext' => 'png'
483 'params' => '', 'ext' => 'png'
488 * ImageMagick parameters for image effects
492 var $image_effects = array(
496 10 => '-colorspace GRAY',
505 * Loaded with the current data-record.
507 * If the instance of this class is used to render records from the database those records are found in this array.
508 * The function stdWrap has TypoScript properties that fetch field-data from this array.
512 protected $table = '';
513 var $oldData = array(); // Used for backup...
514 var $alternativeData = ''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap
515 var $parameters = array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags.
516 var $currentValKey = 'currentValue_kidjls9dksoje';
517 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.
518 var $currentRecordTotal = 0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query.
519 var $currentRecordNumber = 0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering.
520 var $parentRecordNumber = 0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering.
521 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.
522 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.
526 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)
527 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.
528 var $checkPid_badDoktypeList = '255';
529 var $lastTypoLinkUrl = ''; // This will be set by typoLink() to the url of the most recent link created.
530 var $lastTypoLinkTarget = ''; // DO. link target.
531 var $lastTypoLinkLD = array();
532 var $substMarkerCache = array(); // Caching substituteMarkerArrayCached function
533 var $recordRegister = array(); // array that registers rendered content elements (or any table) to make sure they are not rendered recursively!
534 var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects
535 protected $stdWrapHookObjects = array(); // Containing hook objects for stdWrap
536 protected $getImgResourceHookObjects; // Containing hook objects for getImgResource
540 * Set to TRUE by doConvertToUserIntObject() if USER object wants to become USER_INT
542 protected $doConvertToUserIntObject = FALSE;
545 * Indicates current object type. Can hold one of OBJECTTYPE_ constants or FALSE.
546 * The value is set and reset inside USER() function. Any time outside of
547 * USER() it is FALSE.
549 protected $userObjectType = FALSE;
552 * Indicates that object type is USER.
554 * @see tslib_cObjh::$userObjectType
556 const OBJECTTYPE_USER_INT
= 1;
559 * Indicates that object type is USER.
561 * @see tslib_cObjh::$userObjectType
563 const OBJECTTYPE_USER
= 2;
567 * Well, it has to be called manually since it is not a real constructor function.
568 * So after making an instance of the class, call this function and pass to it a database record and the tablename from where the record is from. That will then become the "current" record loaded into memory and accessed by the .fields property found in eg. stdWrap.
570 * @param array $data the record data that is rendered.
571 * @param string $table the table that the data record is from.
574 function start($data, $table = '') {
575 global $TYPO3_CONF_VARS;
577 $this->table
= $table;
578 $this->currentRecord
= $table ?
$table . ':' . $this->data
['uid'] : '';
579 $this->parameters
= array();
580 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) {
581 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) {
582 $this->cObjHookObjectsArr
[$classArr[0]] = t3lib_div
::getUserObj($classArr[1]);
586 $this->stdWrapHookObjects
= array();
587 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'])) {
588 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) {
589 $hookObject = t3lib_div
::getUserObj($classData);
591 if (!($hookObject instanceof tslib_content_stdWrapHook
)) {
592 throw new UnexpectedValueException(
593 '$hookObject must implement interface tslib_content_stdWrapHook',
598 $this->stdWrapHookObjects
[] = $hookObject;
602 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'])) {
603 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'] as $classData) {
604 $postInitializationProcessor = t3lib_div
::getUserObj($classData);
606 if (!($postInitializationProcessor instanceof tslib_content_PostInitHook
)) {
607 throw new UnexpectedValueException(
608 '$postInitializationProcessor must implement interface tslib_content_PostInitHook',
613 $postInitializationProcessor->postProcessContentObjectInitialization($this);
619 * Gets the 'getImgResource' hook objects.
620 * The first call initializes the accordant objects.
622 * @return array The 'getImgResource' hook objects (if any)
624 protected function getGetImgResourceHookObjects() {
625 if (!isset($this->getImgResourceHookObjects
)) {
626 $this->getImgResourceHookObjects
= array();
628 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'])) {
629 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'] as $classData) {
630 $hookObject = t3lib_div
::getUserObj($classData);
632 if (!($hookObject instanceof tslib_cObj_getImgResourceHook
)) {
633 throw new UnexpectedValueException(
634 '$hookObject must implement interface tslib_cObj_getImgResourceHook',
639 $this->getImgResourceHookObjects
[] = $hookObject;
644 return $this->getImgResourceHookObjects
;
648 * Sets the internal variable parentRecord with information about current record.
649 * 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.
651 * @param array $data: The record array
652 * @param string $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.
656 function setParent($data, $currentRecord) {
657 $this->parentRecord
= array(
659 'currentRecord' => $currentRecord
665 /***********************************************
669 ***********************************************/
672 * Returns the "current" value.
673 * The "current" value is just an internal variable that can be used by functions to pass a single value on to another function later in the TypoScript processing.
674 * It's like "load accumulator" in the good old C64 days... basically a "register" you can use as you like.
675 * The TSref will tell if functions are setting this value before calling some other object so that you know if it holds any special information.
677 * @return mixed The "current" value
679 function getCurrentVal() {
680 return $this->data
[$this->currentValKey
];
684 * Sets the "current" value.
686 * @param mixed The variable that you want to set as "current"
688 * @see getCurrentVal()
690 function setCurrentVal($value) {
691 $this->data
[$this->currentValKey
] = $value;
695 * Rendering of a "numerical array" of cObjects from TypoScript
696 * Will call ->cObjGetSingle() for each cObject found and accumulate the output.
698 * @param array $setup: array with cObjects as values.
699 * @param string $addKey: A prefix for the debugging information
700 * @return string Rendered output from the cObjects in the array.
701 * @see cObjGetSingle()
703 function cObjGet($setup, $addKey = '') {
704 if (is_array($setup)) {
705 $sKeyArray = t3lib_TStemplate
::sortedKeyList($setup);
707 foreach ($sKeyArray as $theKey) {
708 $theValue = $setup[$theKey];
709 if (intval($theKey) && !strstr($theKey, '.')) {
710 $conf = $setup[$theKey . '.'];
711 $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey); // Get the contentObject
719 * Renders a content object
721 * @param string The content object name, eg. "TEXT" or "USER" or "IMAGE"
722 * @param array The array with TypoScript properties for the content object
723 * @param string A string label used for the internal debugging tracking.
724 * @return string cObject output
725 * @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331
727 function cObjGetSingle($name, $conf, $TSkey = '__') {
728 global $TYPO3_CONF_VARS;
731 // Checking that the function is not called eternally. This is done by interrupting at a depth of 100
732 $GLOBALS['TSFE']->cObjectDepthCounter
--;
733 if ($GLOBALS['TSFE']->cObjectDepthCounter
> 0) {
735 if ($GLOBALS['TT']->LR
)
736 $GLOBALS['TT']->push($TSkey, $name);
738 // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something')
739 if (substr($name, 0, 1) == '<') {
740 $key = trim(substr($name, 1));
741 $cF = t3lib_div
::makeInstance('t3lib_TSparser');
742 // $name and $conf is loaded with the referenced values.
744 list ($name, $conf) = $cF->getVal($key, $GLOBALS['TSFE']->tmpl
->setup
);
745 if (is_array($old_conf) && count($old_conf)) {
746 $conf = $this->joinTSarrays($conf, $old_conf);
748 // Getting the cObject
749 $GLOBALS['TT']->incStackPointer();
750 $content .= $this->cObjGetSingle($name, $conf, $key);
751 $GLOBALS['TT']->decStackPointer();
755 // Application defined cObjects
756 foreach ($this->cObjHookObjectsArr
as $cObjName => $hookObj) {
757 if (($name === $cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) {
758 $content .= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
763 // Traditional Content Object branching:
767 $content .= $this->COBJ_ARRAY($conf);
770 $content .= $this->COBJ_ARRAY($conf, 'INT');
773 $content .= $this->HTML($conf);
776 $content .= $this->TEXT($conf);
779 $content .= $this->CLEARGIF($conf);
782 $content .= $this->FILE($conf);
785 $content .= $this->IMAGE($conf);
787 case 'IMG_RESOURCE' :
788 $content .= $this->IMG_RESOURCE($conf);
791 $content .= $this->IMGTEXT($conf);
794 $content .= $this->CONTENT($conf);
797 $content .= $this->RECORDS($conf);
800 $content .= $this->HMENU($conf);
803 $content .= $this->CTABLE($conf);
806 $content .= $this->OTABLE($conf);
809 $content .= $this->COLUMNS($conf);
812 $content .= $this->HRULER($conf);
815 $content .= $this->CASEFUNC($conf);
817 case 'LOAD_REGISTER' :
818 case 'RESTORE_REGISTER' :
819 $this->LOAD_REGISTER($conf, $name);
822 $content .= $this->FORM($conf);
824 case 'SEARCHRESULT' :
825 $content .= $this->SEARCHRESULT($conf);
828 $content .= $this->PHP_SCRIPT($conf);
830 case 'PHP_SCRIPT_EXT' :
831 $content .= $this->PHP_SCRIPT($conf, 'EXT');
833 case 'PHP_SCRIPT_INT' :
834 $content .= $this->PHP_SCRIPT($conf, 'INT');
837 $content .= $this->USER($conf);
840 $content .= $this->USER($conf, 'INT');
843 $content .= $this->TEMPLATE($conf);
845 case 'FLUIDTEMPLATE':
846 $content .= $this->FLUIDTEMPLATE($conf);
849 if ($GLOBALS['TSFE']->beUserLogin
) {
850 $content .= $this->editPanel($content, $conf);
854 $content .= $this->MULTIMEDIA($conf);
857 $content .= $this->MEDIA($conf);
860 $content .= $this->SWFOBJECT($conf);
863 $content .= $this->QTOBJECT($conf);
866 $content .= $this->SVG($conf);
869 // call hook functions for extra processing
870 if ($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
871 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classData) {
872 $hookObject = t3lib_div
::getUserObj($classData);
874 if (!($hookObject instanceof tslib_content_cObjGetSingleHook
)) {
875 throw new UnexpectedValueException(
876 '$hookObject must implement interface tslib_content_cObjGetSingleHook',
880 /* @var $hookObject tslib_content_cObjGetSingleHook */
881 $content .= $hookObject->getSingleContentObject($name, (array) $conf, $TSkey, $this);
888 if ($GLOBALS['TT']->LR
)
889 $GLOBALS['TT']->pull($content);
891 // Increasing on exit...
892 $GLOBALS['TSFE']->cObjectDepthCounter++
;
898 /********************************************
900 * Functions rendering content objects (cObjects)
902 ********************************************/
905 * Rendering the cObject, HTML
907 * @param array array of TypoScript properties
908 * @return string Output
909 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=349&cHash=d3fd0c70b4
911 function HTML($conf) {
912 return $this->stdWrap($conf['value'], $conf['value.']);
916 * Rendering the cObject, TEXT
918 * @param array array of TypoScript properties
919 * @return string Output
920 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=350&cHash=b49de28f83
922 function TEXT($conf) {
923 return $this->stdWrap($conf['value'], $conf);
927 * Rendering the cObject, CLEARGIF
929 * @param array array of TypoScript properties
930 * @return string Output
931 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=355&cHash=70c0f19915
933 function CLEARGIF($conf) {
934 $w = $this->stdWrap($conf['width'], $conf['width.']);
935 $h = $this->stdWrap($conf['height'], $conf['height.']);
938 $wrap = $conf['wrap'] ?
$conf['wrap'] : '|<br />';
939 $theValue = $this->wrap(
940 '<img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' . $w . '" height="' . $h . '"' .
941 $this->getBorderAttr(' border="0"') . ' alt="" title="" />',
945 return $this->stdWrap($theValue, $conf['stdWrap.']);
949 * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT
951 * @param array array of TypoScript properties
952 * @param string If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached)
953 * @return string Output
954 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=351&cHash=a09db0329c
956 function COBJ_ARRAY($conf, $ext = '') {
958 if (is_array($conf)) {
962 $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash();
963 $content .= '<!--' . $substKey . '-->';
964 $GLOBALS['TSFE']->config
[$ext . 'incScript'][$substKey] = array(
965 'file' => $conf['includeLibs'],
967 'cObj' => serialize($this),
972 if ($this->checkIf($conf['if.'])) {
973 $this->includeLibs($conf);
974 $content = $this->cObjGet($conf);
976 $content = $this->wrap($content, $conf['wrap']);
978 if ($conf['stdWrap.']) {
979 $content = $this->stdWrap($content, $conf['stdWrap.']);
986 $GLOBALS['TT']->setTSlogMessage('No elements in this content object array(COBJ_ARRAY, COA, COA_INT).', 2);
991 * Rendering the cObject, USER and USER_INT
993 * @param array array of TypoScript properties
994 * @param string If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached)
995 * @return string Output
996 * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/8/22/
998 function USER($conf, $ext = '') {
1002 $this->userObjectType
= self
::OBJECTTYPE_USER_INT
;
1003 $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash();
1004 $content .= '<!--' . $substKey . '-->';
1005 $GLOBALS['TSFE']->config
[$ext . 'incScript'][$substKey] = array(
1006 'file' => $conf['includeLibs'],
1008 'cObj' => serialize($this),
1013 if ($this->userObjectType
=== FALSE) {
1014 // Come here only if we are not called from $TSFE->INTincScript_process()!
1015 $this->userObjectType
= self
::OBJECTTYPE_USER
;
1017 $this->includeLibs($conf);
1018 $tempContent = $this->callUserFunction($conf['userFunc'], $conf, '');
1019 if ($this->doConvertToUserIntObject
) {
1020 $this->doConvertToUserIntObject
= FALSE;
1021 $content = $this->USER($conf, 'INT');
1023 $content .= $tempContent;
1027 $this->userObjectType
= FALSE;
1032 * Retrieves a type of object called as USER or USER_INT. Object can detect their
1033 * type by using this call. It returns OBJECTTYPE_USER_INT or OBJECTTYPE_USER depending on the
1034 * current object execution. In all other cases it will return FALSE to indicate
1035 * a call out of context.
1037 * @return mixed One of OBJECTTYPE_ class constants or FALSE
1039 public function getUserObjectType() {
1040 return $this->userObjectType
;
1044 * Requests the current USER object to be converted to USER_INT.
1048 public function convertToUserIntObject() {
1049 if ($this->userObjectType
!== self
::OBJECTTYPE_USER
) {
1050 $GLOBALS['TT']->setTSlogMessage('tslib_cObj::convertToUserIntObject() ' . 'is called in the wrong context or for the wrong object type', 2);
1052 $this->doConvertToUserIntObject
= TRUE;
1057 * Rendering the cObject, FILE
1059 * @param array array of TypoScript properties
1060 * @return string Output
1061 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=352&cHash=379c60f8bc
1063 function FILE($conf) {
1064 $theValue = $this->fileResource($this->stdWrap($conf['file'], $conf['file.']), trim($this->getAltParam($conf, FALSE)));
1065 if ($conf['linkWrap']) {
1066 $theValue = $this->linkWrap($theValue, $conf['linkWrap']);
1068 return $this->wrap($theValue, $conf['wrap']);
1072 * Rendering the cObject, IMAGE
1074 * @param array array of TypoScript properties
1075 * @return string Output
1076 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=353&cHash=440681ea56
1079 function IMAGE($conf) {
1081 if ($this->checkIf($conf['if.'])) {
1082 $theValue = $this->cImage($conf['file'], $conf);
1083 if ($conf['stdWrap.']) {
1084 $theValue = $this->stdWrap($theValue, $conf['stdWrap.']);
1091 * Rendering the cObject, IMG_RESOURCE
1093 * @param array array of TypoScript properties
1094 * @return string Output
1095 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=354&cHash=46f9299706
1096 * @see getImgResource()
1098 function IMG_RESOURCE($conf) {
1099 $GLOBALS['TSFE']->lastImgResourceInfo
= $this->getImgResource($conf['file'], $conf['file.']);
1100 return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo
[3], $conf['stdWrap.']);
1104 * Rendering the cObject, IMGTEXT
1106 * @param array array of TypoScript properties
1107 * @return string Output
1108 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1
1110 function IMGTEXT($conf) {
1112 if (is_array($conf['text.'])) {
1113 $content .= $this->stdWrap($this->cObjGet($conf['text.'], 'text.'), $conf['text.']); // this gets the surrounding content
1115 $imgList = trim($this->stdWrap($conf['imgList'], $conf['imgList.'])); // gets images
1117 $imgs = t3lib_div
::trimExplode(',', $imgList);
1118 $imgStart = intval($this->stdWrap($conf['imgStart'], $conf['imgStart.']));
1120 $imgCount = count($imgs) - $imgStart;
1122 $imgMax = intval($this->stdWrap($conf['imgMax'], $conf['imgMax.']));
1124 $imgCount = t3lib_div
::intInRange($imgCount, 0, $imgMax); // reduces the number of images.
1127 $imgPath = $this->stdWrap($conf['imgPath'], $conf['imgPath.']);
1131 $captionArray = array();
1132 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
1133 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']); // global caption, no splitting
1135 if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
1136 $legacyCaptionSplit = 1;
1137 $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
1141 $captionArray = explode($capSplit, $this->cObjGetSingle(
1142 $conf['captionSplit.']['cObject'],
1143 $conf['captionSplit.']['cObject.'],
1144 'captionSplit.cObject')
1146 foreach ($captionArray as $ca_key => $ca_val) {
1147 $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
1152 $position = $this->stdWrap($conf['textPos'], $conf['textPos.']);
1154 $tmppos = $position & 7;
1155 $contentPosition = $position & 24;
1156 $align = $this->align
[$tmppos];
1157 $cap = ($caption) ?
1 : 0;
1158 $txtMarg = intval($this->stdWrap($conf['textMargin'], $conf['textMargin.']));
1159 if (!$conf['textMargin_outOfText'] && $contentPosition < 16) {
1163 $cols = intval($this->stdWrap($conf['cols'], $conf['cols.']));
1164 $rows = intval($this->stdWrap($conf['rows'], $conf['rows.']));
1165 $colspacing = intval($this->stdWrap($conf['colSpace'], $conf['colSpace.']));
1166 $rowspacing = intval($this->stdWrap($conf['rowSpace'], $conf['rowSpace.']));
1168 $border = intval($this->stdWrap($conf['border'], $conf['border.'])) ?
1 : 0;
1169 $borderColor = $this->stdWrap($conf['borderCol'], $conf['borderCol.']);
1170 $borderThickness = intval($this->stdWrap($conf['borderThick'], $conf['borderThick.']));
1172 $borderColor = $borderColor ?
$borderColor : 'black';
1173 $borderThickness = $borderThickness ?
$borderThickness : 1;
1175 $caption_align = $this->stdWrap($conf['captionAlign'], $conf['captionAlign.']);
1176 if (!$caption_align) {
1177 $caption_align = $align;
1180 $colCount = ($cols > 1) ?
$cols : 1;
1181 if ($colCount > $imgCount) {
1182 $colCount = $imgCount;
1184 $rowCount = ($colCount > 1) ?
ceil($imgCount / $colCount) : $imgCount;
1188 if ($rowCount > $imgCount) {
1189 $rowCount = $imgCount;
1191 $colCount = ($rowCount > 1) ?
ceil($imgCount / $rowCount) : $imgCount;
1195 $colRelations = trim($this->stdWrap($conf['colRelations'], $conf['colRelations.']));
1196 $maxW = intval($this->stdWrap($conf['maxW'], $conf['maxW.']));
1198 $maxWInText = intval($this->stdWrap($conf['maxWInText'], $conf['maxWInText.']));
1199 if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max...
1200 $maxWInText = round($maxW / 2);
1203 if ($maxWInText && $contentPosition >= 16) { // inText
1204 $maxW = $maxWInText;
1207 if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column
1208 $maxW = ceil(($maxW - $colspacing * ($colCount - 1) - $colCount * $border * $borderThickness * 2) / $colCount);
1210 // create the relation between rows
1212 if ($colRelations) {
1213 $rel_parts = explode(':', $colRelations);
1215 for ($a = 0; $a < $colCount; $a++
) {
1216 $rel_parts[$a] = intval($rel_parts[$a]);
1217 $rel_total +
= $rel_parts[$a];
1220 for ($a = 0; $a < $colCount; $a++
) {
1221 $colMaxW[$a] = round(($maxW * $colCount) / $rel_total * $rel_parts[$a]);
1223 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.
1228 $image_compression = intval($this->stdWrap($conf['image_compression'], $conf['image_compression.']));
1229 $image_effects = intval($this->stdWrap($conf['image_effects'], $conf['image_effects.']));
1230 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'], $conf['image_frames.']['key.']));
1233 $splitArr = array();
1234 $splitArr['imgObjNum'] = $conf['imgObjNum'];
1235 $splitArr = $GLOBALS['TSFE']->tmpl
->splitConfArray($splitArr, $imgCount);
1238 $equalHeight = intval($this->stdWrap($conf['equalH'], $conf['equalH.']));
1239 if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's
1240 $gifCreator = t3lib_div
::makeInstance('tslib_gifbuilder');
1241 $gifCreator->init();
1242 $relations = array();
1243 $relations_cols = array();
1244 $totalMaxW = $maxW * $colCount;
1245 for ($a = 0; $a < $imgCount; $a++
) {
1246 $imgKey = $a +
$imgStart;
1247 $imgInfo = $gifCreator->getImageDimensions($imgPath . $imgs[$imgKey]);
1248 $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height
1249 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.
1250 $relations_cols[floor($a / $colCount)] +
= $imgInfo[0] / $relations[$a]; // counts the total width of the row with the new height taken into consideration.
1255 $imageRowsFinalWidths = array(); // contains the width of every image row
1256 $imageRowsMaxHeights = array();
1258 $origImages = array();
1259 for ($a = 0; $a < $imgCount; $a++
) {
1260 $GLOBALS['TSFE']->register
['IMAGE_NUM'] = $a;
1261 $GLOBALS['TSFE']->register
['IMAGE_NUM_CURRENT'] = $a;
1263 $imgKey = $a +
$imgStart;
1264 $totalImagePath = $imgPath . $imgs[$imgKey];
1265 $this->data
[$this->currentValKey
] = $totalImagePath;
1266 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
1267 $imgConf = $conf[$imgObjNum . '.'];
1272 $rowTotalMaxW = $relations_cols[floor($a / $colCount)];
1273 if ($rowTotalMaxW > $totalMaxW) {
1274 $scale = $rowTotalMaxW / $totalMaxW;
1277 // transfer info to the imageObject. Please note, that
1278 $imgConf['file.']['height'] = round($equalHeight / $scale);
1281 $imgConf['file.']['width'],
1282 $imgConf['file.']['maxW'],
1283 $imgConf['file.']['maxH'],
1284 $imgConf['file.']['minW'],
1285 $imgConf['file.']['minH'],
1286 $imgConf['file.']['width.'],
1287 $imgConf['file.']['maxW.'],
1288 $imgConf['file.']['maxH.'],
1289 $imgConf['file.']['minW.'],
1290 $imgConf['file.']['minH.']
1292 $maxW = 0; // setting this to zero, so that it doesn't disturb
1296 if (count($colMaxW)) {
1297 $imgConf['file.']['maxW'] = $colMaxW[($a %
$colCount)];
1299 $imgConf['file.']['maxW'] = $maxW;
1303 // Image Object supplied:
1304 if (is_array($imgConf)) {
1305 if ($this->image_effects
[$image_effects]) {
1306 $imgConf['file.']['params'] .= ' ' . $this->image_effects
[$image_effects];
1308 if ($image_frames) {
1309 if (is_array($conf['image_frames.'][$image_frames . '.'])) {
1310 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames . '.'];
1313 if ($image_compression && $imgConf['file'] != 'GIFBUILDER') {
1314 if ($image_compression == 1) {
1315 $tempImport = $imgConf['file.']['import'];
1316 $tempImport_dot = $imgConf['file.']['import.'];
1317 unset($imgConf['file.']);
1318 $imgConf['file.']['import'] = $tempImport;
1319 $imgConf['file.']['import.'] = $tempImport_dot;
1320 } elseif (isset($this->image_compression
[$image_compression])) {
1321 $imgConf['file.']['params'] .= ' ' . $this->image_compression
[$image_compression]['params'];
1322 $imgConf['file.']['ext'] = $this->image_compression
[$image_compression]['ext'];
1323 unset($imgConf['file.']['ext.']);
1327 // "alt", "title" and "longdesc" attributes:
1328 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
1329 $imgConf['altText'] = $conf['altText'];
1330 $imgConf['altText.'] = $conf['altText.'];
1332 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
1333 $imgConf['titleText'] = $conf['titleText'];
1334 $imgConf['titleText.'] = $conf['titleText.'];
1336 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
1337 $imgConf['longdescURL'] = $conf['longdescURL'];
1338 $imgConf['longdescURL.'] = $conf['longdescURL.'];
1342 'altText' => $conf['altText'],
1343 'titleText' => $conf['titleText'],
1344 'longdescURL' => $conf['longdescURL'],
1345 'file' => $totalImagePath
1349 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
1351 // Store the original filepath
1352 $origImages[$imgKey] = $GLOBALS['TSFE']->lastImageInfo
;
1354 $imageRowsFinalWidths[floor($a / $colCount)] +
= $GLOBALS['TSFE']->lastImageInfo
[0];
1355 if ($GLOBALS['TSFE']->lastImageInfo
[1] > $imageRowsMaxHeights[floor($a / $colCount)]) {
1356 $imageRowsMaxHeights[floor($a / $colCount)] = $GLOBALS['TSFE']->lastImageInfo
[1];
1359 // calculating the tableWidth:
1360 // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth.
1361 $tableWidth = max($imageRowsFinalWidths) +
$colspacing * ($colCount - 1) +
$colCount * $border * $borderThickness * 2;
1363 // make table for pictures
1364 $index = $imgIndex = $imgStart;
1366 $noRows = $this->stdWrap($conf['noRows'], $conf['noRows.']);
1367 $noCols = $this->stdWrap($conf['noCols'], $conf['noCols.']);
1370 } // noRows overrides noCols. They cannot exist at the same time.
1377 $colCount_temp = $colCount;
1379 $rowCount_temp = $rowCount;
1385 // col- and rowspans calculated
1386 $colspan = (($colspacing) ?
$colCount * 2 - 1 : $colCount);
1387 $rowspan = (($rowspacing) ?
$rowCount * 2 - 1 : $rowCount) +
$cap;
1391 $editIconsHTML = $conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin
1392 ?
$this->editIcons('', $conf['editIcons'], $conf['editIcons.'])
1395 // strech out table:
1398 if ($conf['noStretchAndMarginCells'] != 1) {
1399 $tablecode .= '<tr>';
1400 if ($txtMarg && $align == 'right') { // If right aligned, the textborder is added on the right side
1401 $tablecode .= '<td rowspan="' . ($rowspan +
1) . '" valign="top"><img src="' .
1402 $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' . $txtMarg . '" height="1" alt="" title="" />' .
1403 ($editIconsHTML ?
'<br />' . $editIconsHTML : '') . '</td>';
1404 $editIconsHTML = '';
1407 $tablecode .= '<td colspan="' . $colspan . '"><img src="' .
1408 $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' . $tableWidth . '" height="1" alt="" /></td>';
1409 if ($txtMarg && $align == 'left') { // If left aligned, the textborder is added on the left side
1410 $tablecode .= '<td rowspan="' . ($rowspan +
1) . '" valign="top"><img src="' .
1411 $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' . $txtMarg . '" height="1" alt="" title="" />' .
1412 ($editIconsHTML ?
'<br />' . $editIconsHTML : '') . '</td>';
1413 $editIconsHTML = '';
1417 $tableWidth +
= $txtMarg +
1;
1419 $tablecode .= '</tr>';
1423 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!
1424 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.
1425 $tablecode .= '<tr><td colspan="' . $colspan . '"><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="1" height="' . $rowspacing . '"' . $this->getBorderAttr(' border="0"') . ' alt="" title="" /></td></tr>';
1427 $tablecode .= '<tr>'; // starting row
1428 for ($b = 0; $b < $colCount_temp; $b++
) { // Looping through the columns
1429 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.
1431 $tablecode .= '<td><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1432 $colspacing . '" height="1"' . $this->getBorderAttr(' border="0"') . ' alt="" title="" /></td>';
1434 $colSpacer = '<img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1435 ($border ?
$colspacing - 6 : $colspacing) . '" height="' .
1436 ($imageRowsMaxHeights[$c] +
($border ?
$borderThickness * 2 : 0)) . '"' .
1437 $this->getBorderAttr(' border="0"') . ' align="' .
1438 ($border ?
'left' : 'top') . '" alt="" title="" />';
1439 $colSpacer = '<td valign="top">' . $colSpacer . '</td>'; // added 160301, needed for the new "noCols"-table...
1440 $tablecode .= $colSpacer;
1443 if (!$noCols ||
($noCols && !$b)) {
1444 $tablecode .= '<td valign="top">'; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image.
1446 $tablecode .= '<table width="' . $imageRowsFinalWidths[$c] . '" border="0" cellpadding="0" cellspacing="0"><tr>';
1447 } // In case of "noCols" we must set the table-tag that surrounds the images in the row.
1449 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.
1450 $GLOBALS['TSFE']->register
['IMAGE_NUM'] = $imgIndex; // register previous imgIndex
1451 $imgIndex = $index +
$a * $colCount_temp;
1452 $GLOBALS['TSFE']->register
['IMAGE_NUM_CURRENT'] = $imgIndex;
1453 if ($imgsTag[$imgIndex]) {
1454 if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
1455 $tablecode .= '<img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="1" height="' .
1456 $rowspacing . '" alt="" title="" /><br />';
1458 if ($legacyCaptionSplit) {
1459 $thisCaption = $captionArray[$imgIndex];
1460 } else if ($conf['captionSplit'] ||
$conf['imageTextSplit']) {
1461 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
1463 $imageHTML = $imgsTag[$imgIndex] . '<br />';
1464 $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.
1466 $imageHTML = '<table border="0" cellpadding="' . $borderThickness . '" cellspacing="0" bgcolor="' .
1467 $borderColor . '"' . $Talign . '><tr><td>' . $imageHTML . '</td></tr></table>';
1469 $imageHTML .= $editIconsHTML;
1470 $editIconsHTML = '';
1471 $imageHTML .= $thisCaption; // Adds caption.
1473 $imageHTML = '<td valign="top">' . $imageHTML . '</td>';
1474 } // If noCols, put in table cell.
1475 $tablecode .= $imageHTML;
1479 if (!$noCols ||
($noCols && $b +
1 == $colCount_temp)) {
1481 $tablecode .= '</tr></table>';
1482 } // In case of "noCols" we must finish the table that surrounds the images in the row.
1483 $tablecode .= '</td>'; // Ending the cell. In case of "noCols" the cell holds all pictures!
1486 $tablecode .= '</tr>'; // ending row
1489 switch ($contentPosition) {
1492 switch ($align) { // These settings are needed for Firefox
1494 $table_align = 'margin-left: auto; margin-right: auto';
1497 $table_align = 'margin-left: auto; margin-right: 0px';
1499 default : // Most of all: left
1500 $table_align = 'margin-left: 0px; margin-right: auto';
1502 $table_align = 'style="' . $table_align . '"';
1504 case '16' : // in text
1505 $table_align = 'align="' . $align . '"';
1511 // Table-tag is inserted
1512 $tablecode = '<table' . ($tableWidth ?
' width="' . $tableWidth . '"' : '') . ' border="0" cellspacing="0" cellpadding="0" ' . $table_align . ' class="imgtext-table">' . $tablecode;
1513 if ($editIconsHTML) { // IF this value is not long since reset.
1514 $tablecode .= '<tr><td colspan="' . $colspan . '">' . $editIconsHTML . '</td></tr>';
1515 $editIconsHTML = '';
1518 $tablecode .= '<tr><td colspan="' . $colspan . '" align="' . $caption_align . '">' . $caption . '</td></tr>';
1520 $tablecode .= '</table>';
1521 if ($conf['tableStdWrap.']) {
1522 $tablecode = $this->stdWrap($tablecode, $conf['tableStdWrap.']);
1526 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'], $conf['spaceBelowAbove.']));
1527 switch ($contentPosition) {
1529 $output = '<div style="text-align:' . $align . ';">' . $tablecode . '</div>' .
1530 $this->wrapSpace($content, $spaceBelowAbove . '|0');
1533 $output = $this->wrapSpace($content, '0|' . $spaceBelowAbove) .
1534 '<div style="text-align:' . $align . ';">' . $tablecode . '</div>';
1536 case '16' : // in text
1537 $output = $tablecode . $content;
1539 case '24' : // in text, no wrap
1541 $theResult .= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
1542 if ($align == 'right') {
1543 $theResult .= '<td valign="top">' . $content . '</td><td valign="top">' . $tablecode . '</td>';
1545 $theResult .= '<td valign="top">' . $tablecode . '</td><td valign="top">' . $content . '</td>';
1547 $theResult .= '</tr></table>';
1548 $output = $theResult;
1555 if ($conf['stdWrap.']) {
1556 $output = $this->stdWrap($output, $conf['stdWrap.']);
1563 * Rendering the cObject, CONTENT
1565 * @param array array of TypoScript properties
1566 * @return string Output
1567 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=356&cHash=9f3b5c6ba2
1569 function CONTENT($conf) {
1572 $originalRec = $GLOBALS['TSFE']->currentRecord
;
1573 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!!
1574 $GLOBALS['TSFE']->recordRegister
[$originalRec]++
;
1577 $conf['table'] = trim($this->stdWrap($conf['table'], $conf['table.']));
1578 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_') {
1580 $renderObjName = $conf['renderObj'] ?
$conf['renderObj'] : '<' . $conf['table'];
1581 $renderObjKey = $conf['renderObj'] ?
'renderObj' : '';
1582 $renderObjConf = $conf['renderObj.'];
1584 $slide = intval($conf['slide']) ?
intval($conf['slide']) : 0;
1585 $slideCollect = intval($conf['slide.']['collect']) ?
intval($conf['slide.']['collect']) : 0;
1586 $slideCollectReverse = intval($conf['slide.']['collectReverse']) ?
TRUE : FALSE;
1587 $slideCollectFuzzy = $slideCollect ?
(intval($conf['slide.']['collectFuzzy']) ?
TRUE : FALSE) : TRUE;
1591 $res = $this->exec_getQuery($conf['table'], $conf['select.']);
1592 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
1593 $GLOBALS['TT']->setTSlogMessage($error, 3);
1595 $this->currentRecordTotal
= $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1596 $GLOBALS['TT']->setTSlogMessage('NUMROWS: ' . $GLOBALS['TYPO3_DB']->sql_num_rows($res));
1597 $cObj = t3lib_div
::makeInstance('tslib_cObj');
1598 $cObj->setParent($this->data
, $this->currentRecord
);
1599 $this->currentRecordNumber
= 0;
1601 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1603 // Versioning preview:
1604 $GLOBALS['TSFE']->sys_page
->versionOL($conf['table'], $row, TRUE);
1606 // Language overlay:
1607 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL
) {
1608 $row = $GLOBALS['TSFE']->sys_page
->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content
, $GLOBALS['TSFE']->sys_language_contentOL
);
1611 if (is_array($row)) { // Might be unset in the sys_language_contentOL
1612 if (!$GLOBALS['TSFE']->recordRegister
[$conf['table'] . ':' . $row['uid']]) {
1613 $this->currentRecordNumber++
;
1614 $cObj->parentRecordNumber
= $this->currentRecordNumber
;
1615 $GLOBALS['TSFE']->currentRecord
= $conf['table'] . ':' . $row['uid'];
1616 $this->lastChanged($row['tstamp']);
1617 $cObj->start($row, $conf['table']);
1618 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
1619 $cobjValue .= $tmpValue;
1623 $GLOBALS['TYPO3_DB']->sql_free_result($res);
1625 if ($slideCollectReverse) {
1626 $theValue = $cobjValue . $theValue;
1628 $theValue .= $cobjValue;
1630 if ($slideCollect > 0) {
1637 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
1638 $again = strlen($conf['select.']['pidInList']) ?
TRUE : FALSE;
1640 } while ($again && (($slide && !strlen($tmpValue) && $slideCollectFuzzy) ||
($slide && $slideCollect)));
1643 $theValue = $this->wrap($theValue, $conf['wrap']);
1644 if ($conf['stdWrap.'])
1645 $theValue = $this->stdWrap($theValue, $conf['stdWrap.']);
1647 $GLOBALS['TSFE']->currentRecord
= $originalRec; // Restore
1652 * Rendering the cObject, RECORDS
1654 * @param array array of TypoScript properties
1655 * @return string Output
1656 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=357&cHash=303e959472
1658 function RECORDS($conf) {
1661 $originalRec = $GLOBALS['TSFE']->currentRecord
;
1662 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!!
1663 $GLOBALS['TSFE']->recordRegister
[$originalRec]++
;
1666 $conf['source'] = $this->stdWrap($conf['source'], $conf['source.']);
1667 if ($conf['tables'] && $conf['source']) {
1668 $allowedTables = $conf['tables'];
1669 if (is_array($conf['conf.'])) {
1670 foreach ($conf['conf.'] as $k => $v) {
1671 if (substr($k, -1) != '.')
1672 $allowedTables .= ',' . $k;
1676 $loadDB = t3lib_div
::makeInstance('FE_loadDBGroup');
1677 $loadDB->start($conf['source'], $allowedTables);
1678 foreach ($loadDB->tableArray
as $table => $v) {
1679 if (is_array($GLOBALS['TCA'][$table])) {
1680 $loadDB->additionalWhere
[$table] = $this->enableFields($table);
1683 $loadDB->getFromDB();
1685 reset($loadDB->itemArray
);
1686 $data = $loadDB->results
;
1688 $cObj = t3lib_div
::makeInstance('tslib_cObj');
1689 $cObj->setParent($this->data
, $this->currentRecord
);
1690 $this->currentRecordNumber
= 0;
1691 $this->currentRecordTotal
= count($loadDB->itemArray
);
1692 foreach ($loadDB->itemArray
as $val) {
1693 $row = $data[$val['table']][$val['id']];
1695 // Versioning preview:
1696 $GLOBALS['TSFE']->sys_page
->versionOL($val['table'], $row);
1698 // Language overlay:
1699 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL
) {
1700 $row = $GLOBALS['TSFE']->sys_page
->getRecordOverlay(
1703 $GLOBALS['TSFE']->sys_language_content
,
1704 $GLOBALS['TSFE']->sys_language_contentOL
1708 if (is_array($row)) { // Might be unset in the content overlay things...
1709 if (!$conf['dontCheckPid']) {
1710 $row = $this->checkPid($row['pid']) ?
$row : '';
1712 if ($row && !$GLOBALS['TSFE']->recordRegister
[$val['table'] . ':' . $val['id']]) {
1713 $renderObjName = $conf['conf.'][$val['table']] ?
$conf['conf.'][$val['table']] : '<' . $val['table'];
1714 $renderObjKey = $conf['conf.'][$val['table']] ?
'conf.' . $val['table'] : '';
1715 $renderObjConf = $conf['conf.'][$val['table'] . '.'];
1716 $this->currentRecordNumber++
;
1717 $cObj->parentRecordNumber
= $this->currentRecordNumber
;
1718 $GLOBALS['TSFE']->currentRecord
= $val['table'] . ':' . $val['id'];
1719 $this->lastChanged($row['tstamp']);
1720 $cObj->start($row, $val['table']);
1721 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
1722 $theValue .= $tmpValue;
1728 $theValue = $this->wrap($theValue, $conf['wrap']);
1729 if ($conf['stdWrap.'])
1730 $theValue = $this->stdWrap($theValue, $conf['stdWrap.']);
1732 $GLOBALS['TSFE']->currentRecord
= $originalRec; // Restore
1737 * Rendering the cObject, HMENU
1739 * @param array array of TypoScript properties
1740 * @return string Output
1741 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=358&cHash=5400c1c06a
1743 function HMENU($conf) {
1745 if ($this->checkIf($conf['if.'])) {
1746 $cls = strtolower($conf[1]);
1747 if (t3lib_div
::inList($GLOBALS['TSFE']->tmpl
->menuclasses
, $cls)) {
1748 if ($conf['special.']['value.']) {
1749 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
1751 $GLOBALS['TSFE']->register
['count_HMENU']++
;
1752 $GLOBALS['TSFE']->register
['count_HMENU_MENUOBJ'] = 0;
1753 $GLOBALS['TSFE']->applicationData
['GMENU_LAYERS']['WMid'] = array();
1754 $GLOBALS['TSFE']->applicationData
['GMENU_LAYERS']['WMparentId'] = array();
1756 $menu = t3lib_div
::makeInstance('tslib_' . $cls);
1757 $menu->parent_cObj
= $this;
1758 $menu->start($GLOBALS['TSFE']->tmpl
, $GLOBALS['TSFE']->sys_page
, '', $conf, 1);
1760 $content .= $menu->writeMenu();
1763 $content = $this->wrap($content, $conf['wrap']);
1764 if ($conf['stdWrap.'])
1765 $content = $this->stdWrap($content, $conf['stdWrap.']);
1771 * Rendering the cObject, CTABLE
1773 * @param array array of TypoScript properties
1774 * @return string Output
1775 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=359&cHash=2e0065b4e7
1777 function CTABLE($conf) {
1778 $controlTable = t3lib_div
::makeInstance('tslib_controlTable');
1779 if ($conf['tableParams']) {
1780 $controlTable->tableParams
= $conf['tableParams'];
1782 // loads the pagecontent
1783 $controlTable->contentW
= $conf['cWidth'];
1784 // loads the menues if any
1785 if (is_array($conf['c.'])) {
1786 $controlTable->content
= $this->cObjGet($conf['c.'], 'c.');
1787 $controlTable->contentTDparams
= isset($conf['c.']['TDParams']) ?
$conf['c.']['TDParams'] : 'valign="top"';
1789 if (is_array($conf['lm.'])) {
1790 $controlTable->lm
= $this->cObjGet($conf['lm.'], 'lm.');
1791 $controlTable->lmTDparams
= isset($conf['lm.']['TDParams']) ?
$conf['lm.']['TDParams'] : 'valign="top"';
1793 if (is_array($conf['tm.'])) {
1794 $controlTable->tm
= $this->cObjGet($conf['tm.'], 'tm.');
1795 $controlTable->tmTDparams
= isset($conf['tm.']['TDParams']) ?
$conf['tm.']['TDParams'] : 'valign="top"';
1797 if (is_array($conf['rm.'])) {
1798 $controlTable->rm
= $this->cObjGet($conf['rm.'], 'rm.');
1799 $controlTable->rmTDparams
= isset($conf['rm.']['TDParams']) ?
$conf['rm.']['TDParams'] : 'valign="top"';
1801 if (is_array($conf['bm.'])) {
1802 $controlTable->bm
= $this->cObjGet($conf['bm.'], 'bm.');
1803 $controlTable->bmTDparams
= isset($conf['bm.']['TDParams']) ?
$conf['bm.']['TDParams'] : 'valign="top"';
1805 return $controlTable->start($conf['offset'], $conf['cMargins']);
1809 * Rendering the cObject, OTABLE
1811 * @param array array of TypoScript properties
1812 * @return string Output
1813 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=360&cHash=02c9552d38
1815 function OTABLE($conf) {
1816 $controlTable = t3lib_div
::makeInstance('tslib_tableOffset');
1817 if ($conf['tableParams']) {
1818 $controlTable->tableParams
= $conf['tableParams'];
1820 return $controlTable->start($this->cObjGet($conf), $conf['offset']);
1824 * Rendering the cObject, COLUMNS
1826 * @param array array of TypoScript properties
1827 * @return string Output
1828 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=361&cHash=7e4e228cad
1830 function COLUMNS($conf) {
1832 if (is_array($conf) && $this->checkIf($conf['if.'])) {
1834 $tableParams = $conf['tableParams'] ?
' ' . $conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"';
1835 $TDparams = $conf['TDparams'] ?
' ' . $conf['TDparams'] : ' valign="top"';
1836 $rows = t3lib_div
::intInRange($conf['rows'], 2, 20);
1837 $totalWidth = intval($conf['totalWidth']);
1842 'gapWidth' => $this->stdWrap($conf['gapWidth'], $conf['gapWidth.']),
1843 'gapBgCol' => $this->stdWrap($conf['gapBgCol'], $conf['gapBgCol.']),
1844 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'], $conf['gapLineThickness.']),
1845 'gapLineCol' => $this->stdWrap($conf['gapLineCol'], $conf['gapLineCol.']),
1847 $gapData = $GLOBALS['TSFE']->tmpl
->splitConfArray($gapData, $rows - 1);
1848 foreach ($gapData as $val) {
1849 $totalGapWidth +
= intval($val['gapWidth']);
1853 $columnWidth = ceil(($totalWidth - $totalGapWidth) / $rows);
1854 $TDparams .= ' width="' . $columnWidth . '"';
1855 $tableParams .= ' width="' . $totalWidth . '"';
1857 $TDparams .= ' width="' . floor(100 / $rows) . '%"';
1858 $tableParams .= ' width="100%"';
1861 for ($a = 1; $a <= $rows; $a++
) {
1863 $content .= '<td' . $TDparams . '>';
1864 $content .= $this->cObjGetSingle($conf[$a], $conf[$a . '.'], $a);
1865 $content .= '</td>';
1867 $gapConf = $gapData[($a - 1)];
1868 $gapWidth = intval($gapConf['gapWidth']);
1870 $tdPar = $gapConf['gapBgCol'] ?
' bgcolor="' . $gapConf['gapBgCol'] . '"' : '';
1871 $gapLine = intval($gapConf['gapLineThickness']);
1873 $gapSurround = t3lib_div
::intInRange(($gapWidth - $gapLine) / 2, 1, 1000);
1875 $content .= '<td' . $tdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1876 $gapSurround . '" height="1" alt="" title="" /></td>';
1879 $GtdPar = $gapConf['gapLineCol'] ?
' bgcolor="' . $gapConf['gapLineCol'] . '"' : ' bgcolor="black"';
1880 $content .= '<td' . $GtdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1881 $gapLine . '" height="1" alt="" title="" /></td>';
1884 $content .= '<td' . $tdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1885 $gapSurround . '" height="1" alt="" title="" /></td>';
1888 $content .= '<td' . $tdPar . '><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1889 $gapWidth . '" height="1" alt="" title="" /></td>';
1895 $content = '<tr>' . $content . '</tr>';
1896 $content = '<table' . $tableParams . '>' . $content . '</table>';
1897 $content .= $this->cObjGetSingle($conf['after'], $conf['after.'], 'after');
1898 if ($conf['stdWrap.']) {
1899 $content = $this->stdWrap($content, $conf['stdWrap.']);
1906 * Rendering the cObject, HRULER
1908 * @param array array of TypoScript properties
1909 * @return string Output
1910 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=362&cHash=2a462aa084
1912 function HRULER($conf) {
1913 $lineThickness = t3lib_div
::intInRange($this->stdWrap($conf['lineThickness'], $conf['lineThickness.']), 1, 50);
1914 $lineColor = $conf['lineColor'] ?
$conf['lineColor'] : 'black';
1915 $spaceBefore = intval($conf['spaceLeft']);
1916 $spaceAfter = intval($conf['spaceRight']);
1917 $tableWidth = $conf['tableWidth'] ?
$conf['tableWidth'] : '99%';
1920 $content .= '<table border="0" cellspacing="0" cellpadding="0" width="' . htmlspecialchars($tableWidth) . '" summary=""><tr>';
1922 $content .= '<td width="1"><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1923 $spaceBefore . '" height="1" alt="" title="" /></td>';
1925 $content .= '<td bgcolor="' . $lineColor . '"><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="1" height="' .
1926 $lineThickness . '" alt="" title="" /></td>';
1928 $content .= '<td width="1"><img src="' . $GLOBALS['TSFE']->absRefPrefix
. 'clear.gif" width="' .
1929 $spaceAfter . '" height="1" alt="" title="" /></td>';
1931 $content .= '</tr></table>';
1933 $content = $this->stdWrap($content, $conf['stdWrap.']);
1938 * Rendering the cObject, CASE
1940 * @param array array of TypoScript properties
1941 * @return string Output
1942 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=364&cHash=cffedd09e3
1944 function CASEFUNC($conf) {
1946 if ($this->checkIf($conf['if.'])) {
1947 if ($conf['setCurrent'] ||
$conf['setCurrent.']) {
1948 $this->data
[$this->currentValKey
] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);
1950 $key = $this->stdWrap($conf['key'], $conf['key.']);
1951 $key = strlen($conf[$key]) ?
$key : 'default';
1952 $name = $conf[$key];
1953 $theValue = $this->cObjGetSingle($name, $conf[$key . '.'], $key);
1954 if ($conf['stdWrap.']) {
1955 $theValue = $this->stdWrap($theValue, $conf['stdWrap.']);
1962 * Rendering the cObject, LOAD_REGISTER and RESTORE_REGISTER
1963 * NOTICE: This cObject does NOT return any content since it just sets internal data based on the TypoScript properties.
1965 * @param array array of TypoScript properties
1966 * @param string If "RESTORE_REGISTER" then the cObject rendered is "RESTORE_REGISTER", otherwise "LOAD_REGISTER"
1967 * @return string Empty string (the cObject only sets internal data!)
1968 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=365&cHash=4935524e2e
1969 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=366&cHash=4f9485e8cc
1971 function LOAD_REGISTER($conf, $name) {
1972 if ($name == 'RESTORE_REGISTER') {
1973 $GLOBALS['TSFE']->register
= array_pop($GLOBALS['TSFE']->registerStack
);
1975 array_push($GLOBALS['TSFE']->registerStack
, $GLOBALS['TSFE']->register
);
1976 if (is_array($conf)) {
1977 foreach ($conf as $theKey => $theValue) {
1978 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
1979 if (strstr($theKey, '.')) {
1980 $theKey = substr($theKey, 0, -1);
1982 $GLOBALS['TSFE']->register
[$theKey] = $this->stdWrap($conf[$theKey], $conf[$theKey . '.']);
1991 * Rendering the cObject, FORM
1993 * Note on $formData:
1994 * In the optional $formData array each entry represents a line in the ordinary setup.
1995 * In those entries each entry (0,1,2...) represents a space normally divided by the '|' line.
1997 * $formData [] = array('Name:', 'name=input, 25 ', 'Default value....');
1998 * $formData [] = array('Email:', 'email=input, 25 ', 'Default value for email....');
2000 * - corresponds to the $conf['data'] value being :
2001 * Name:|name=input, 25 |Default value....||Email:|email=input, 25 |Default value for email....
2003 * If $formData is an array the value of $conf['data'] is ignored.
2005 * @param array array of TypoScript properties
2006 * @param array Alternative formdata overriding whatever comes from TypoScript
2007 * @return string Output
2008 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=367&cHash=bbc518d930
2010 function FORM($conf, $formData = '') {
2012 if (is_array($formData)) {
2013 $dataArr = $formData;
2015 $data = $this->stdWrap($conf['data'], $conf['data.']);
2018 // Getting the original config
2020 $data = str_replace(LF
, '||', $data);
2021 $dataArr = explode('||', $data);
2023 // Adding the new dataArray config form:
2024 if (is_array($conf['dataArray.'])) { // dataArray is supplied
2025 $sKeyArray = t3lib_TStemplate
::sortedKeyList($conf['dataArray.'], TRUE);
2026 foreach ($sKeyArray as $theKey) {
2027 $dAA = $conf['dataArray.'][$theKey . '.'];
2028 if (is_array($dAA)) {
2030 list ($temp[0]) = explode('|', $dAA['label.'] ?
$this->stdWrap($dAA['label'], $dAA['label.']) : $dAA['label']);
2031 list ($temp[1]) = explode('|', $dAA['type']);
2032 if ($dAA['required']) {
2033 $temp[1] = '*' . $temp[1];
2035 list ($temp[2]) = explode('|', $dAA['value.'] ?
$this->stdWrap($dAA['value'], $dAA['value.']) : $dAA['value']);
2036 // If value array is set, then implode those values.
2037 if (is_array($dAA['valueArray.'])) {
2038 $temp_accum = array();
2039 foreach ($dAA['valueArray.'] as $dAKey_vA => $dAA_vA) {
2040 if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA) . '.', $dAKey_vA)) {
2042 list ($temp_vA[0]) = explode('=', $dAA_vA['label.'] ?
$this->stdWrap($dAA_vA['label'], $dAA_vA['label.']) : $dAA_vA['label']);
2043 if ($dAA_vA['selected']) {
2044 $temp_vA[0] = '*' . $temp_vA[0];
2046 list ($temp_vA[1]) = explode(',', $dAA_vA['value']);
2048 $temp_accum[] = implode('=', $temp_vA);
2050 $temp[2] = implode(',', $temp_accum);
2052 list ($temp[3]) = explode('|', $dAA['specialEval.'] ?
$this->stdWrap($dAA['specialEval'], $dAA['specialEval.']) : $dAA['specialEval']);
2054 // adding the form entry to the dataArray
2055 $dataArr[] = implode('|', $temp);
2061 $attachmentCounter = '';
2063 $fieldlist = array();
2064 $propertyOverride = array();
2065 $fieldname_hashArray = array();
2068 $xhtmlStrict = t3lib_div
::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype
);
2070 if ($conf['formName']) {
2071 $formname = $this->cleanFormName($conf['formName']);
2073 $formname = $GLOBALS['TSFE']->uniqueHash();
2074 $formname = 'a' . $formname; // form name has to start with a letter to reach XHTML compliance
2077 if (isset($conf['fieldPrefix'])) {
2078 if ($conf['fieldPrefix']) {
2079 $prefix = $this->cleanFormName($conf['fieldPrefix']);
2084 $prefix = $formname;
2087 foreach ($dataArr as $val) {
2090 $confData = array();
2091 if (is_array($formData)) {
2093 $val = 1; // TRUE...
2096 $parts = explode('|', $val);
2098 if ($val && strcspn($val, '#/')) {
2100 $confData['label'] = trim($parts[0]);
2102 $fParts = explode(',', $parts[1]);
2103 $fParts[0] = trim($fParts[0]);
2104 if (substr($fParts[0], 0, 1) == '*') {
2105 $confData['required'] = 1;
2106 $fParts[0] = substr($fParts[0], 1);
2108 $typeParts = explode('=', $fParts[0]);
2109 $confData['type'] = trim(strtolower(end($typeParts)));
2110 if (count($typeParts) == 1) {
2111 $confData['fieldname'] = $this->cleanFormName($parts[0]);
2112 if (strtolower(preg_replace('/[^[:alnum:]]/', '', $confData['fieldname'])) == 'email') {
2113 $confData['fieldname'] = 'email';
2115 // Duplicate fieldnames resolved
2116 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
2117 $confData['fieldname'] .= '_' . $cc;
2119 $fieldname_hashArray[md5($confData['fieldname'])] = $confData['fieldname'];
2120 // Attachment names...
2121 if ($confData['type'] == 'file') {
2122 $confData['fieldname'] = 'attachment' . $attachmentCounter;
2123 $attachmentCounter = intval($attachmentCounter) +
1;
2126 $confData['fieldname'] = str_replace(' ', '_', trim($typeParts[0]));
2130 if ($conf['wrapFieldName']) {
2131 $confData['fieldname'] = $this->wrap($confData['fieldname'], $conf['wrapFieldName']);
2134 // Set field name as current:
2135 $this->setCurrentVal($confData['fieldname']);
2137 // Additional parameters
2138 if (trim($confData['type'])) {
2139 $addParams = trim($conf['params']);
2140 if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
2141 $addParams = trim($conf['params.'][$confData['type']]);
2143 if (strcmp('', $addParams)) {
2144 $addParams = ' ' . $addParams;
2149 if ($conf['dontMd5FieldNames']) {
2150 $fName = $confData['fieldname'];
2152 $fName = md5($confData['fieldname']);
2155 // Accessibility: Set id = fieldname attribute:
2156 if ($conf['accessibility'] ||
$xhtmlStrict) {
2157 $elementIdAttribute = ' id="' . $prefix . $fName . '"';
2159 $elementIdAttribute = '';
2162 // Create form field based on configuration/type:
2163 switch ($confData['type']) {
2165 $cols = trim($fParts[1]) ?
intval($fParts[1]) : 20;
2166 $compWidth = doubleval($conf['compensateFieldWidth']
2167 ?
$conf['compensateFieldWidth']
2168 : $GLOBALS['TSFE']->compensateFieldWidth
2170 $compWidth = $compWidth ?
$compWidth : 1;
2171 $cols = t3lib_div
::intInRange($cols * $compWidth, 1, 120);
2173 $rows = trim($fParts[2]) ? t3lib_div
::intInRange($fParts[2], 1, 30) : 5;
2174 $wrap = trim($fParts[3]);
2175 if ($conf['noWrapAttr'] ||
$wrap === 'disabled') {
2178 $wrap = $wrap ?
' wrap="' . $wrap . '"' : ' wrap="virtual"';
2180 $default = $this->getFieldDefaultValue(
2181 $conf['noValueInsert'],
2182 $confData['fieldname'],
2183 str_replace('\n', LF
, trim($parts[2]))
2185 $fieldCode = sprintf(
2186 '<textarea name="%s"%s cols="%s" rows="%s"%s%s>%s</textarea>',
2187 $confData['fieldname'],
2188 $elementIdAttribute,
2193 t3lib_div
::formatForTextarea($default)
2198 $size = trim($fParts[1]) ?
intval($fParts[1]) : 20;
2199 $compWidth = doubleval($conf['compensateFieldWidth']
2200 ?
$conf['compensateFieldWidth']
2201 : $GLOBALS['TSFE']->compensateFieldWidth
2203 $compWidth = $compWidth ?
$compWidth : 1;
2204 $size = t3lib_div
::intInRange($size * $compWidth, 1, 120);
2205 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
2207 if ($confData['type'] == 'password') {
2211 $max = trim($fParts[2]) ?
' maxlength="' . t3lib_div
::intInRange($fParts[2], 1, 1000) . '"' : "";
2212 $theType = $confData['type'] == 'input' ?
'text' : 'password';
2214 $fieldCode = sprintf(
2215 '<input type="%s" name="%s"%s size="%s"%s value="%s"%s />',
2217 $confData['fieldname'],
2218 $elementIdAttribute,
2221 htmlspecialchars($default),
2227 $size = trim($fParts[1]) ? t3lib_div
::intInRange($fParts[1], 1, 60) : 20;
2228 $fieldCode = sprintf(
2229 '<input type="file" name="%s"%s size="%s"%s />',
2230 $confData['fieldname'],
2231 $elementIdAttribute,
2237 // alternative default value:
2238 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
2239 $checked = $default ?
' checked="checked"' : '';
2240 $fieldCode = sprintf(
2241 '<input type="checkbox" value="%s" name="%s"%s%s%s />',
2243 $confData['fieldname'],
2244 $elementIdAttribute,
2251 $valueParts = explode(',', $parts[2]);
2253 if (strtolower(trim($fParts[1])) == 'auto') {
2254 $fParts[1] = count($valueParts);
2255 } // Auto size set here. Max 20
2256 $size = trim($fParts[1]) ? t3lib_div
::intInRange($fParts[1], 1, 20) : 1;
2258 $multiple = strtolower(trim($fParts[2])) == 'm' ?
' multiple="multiple"' : '';
2260 $items = array(); // Where the items will be
2261 $defaults = array(); //RTF
2262 $pCount = count($valueParts);
2263 for ($a = 0; $a < $pCount; $a++
) {
2264 $valueParts[$a] = trim($valueParts[$a]);
2265 if (substr($valueParts[$a], 0, 1) == '*') { // Finding default value
2267 $valueParts[$a] = substr($valueParts[$a], 1);
2271 $subParts = explode('=', $valueParts[$a]);
2272 $subParts[1] = (isset($subParts[1]) ?
trim($subParts[1]) : trim($subParts[0])); // Sets the value
2273 $items[] = $subParts; // Adds the value/label pair to the items-array
2275 $defaults[] = $subParts[1];
2276 } // Sets the default value if value/label pair is marked as default.
2278 // alternative default value:
2279 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
2280 if (!is_array($default)) {
2281 $defaults = array();
2282 $defaults[] = $default;
2284 $defaults = $default;
2286 // Create the select-box:
2287 $iCount = count($items);
2288 for ($a = 0; $a < $iCount; $a++
) {
2289 $option .= '<option value="' . $items[$a][1] . '"' . (in_array($items[$a][1], $defaults) ?
' selected="selected"' : '') . '>' . trim($items[$a][0]) . '</option>'; //RTF
2293 // 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.
2294 $confData['fieldname'] .= '[]';
2296 $fieldCode = sprintf(
2297 '<select name="%s"%s size="%s"%s%s>%s</select>',
2298 $confData['fieldname'],
2299 $elementIdAttribute,
2309 $valueParts = explode(',', $parts[2]);
2310 $items = array(); // Where the items will be
2312 $pCount = count($valueParts);
2313 for ($a = 0; $a < $pCount; $a++
) {
2314 $valueParts[$a] = trim($valueParts[$a]);
2315 if (substr($valueParts[$a], 0, 1) == '*') {
2317 $valueParts[$a] = substr($valueParts[$a], 1);
2321 $subParts = explode('=', $valueParts[$a]);
2322 $subParts[1] = (isset($subParts[1]) ?
trim($subParts[1]) : trim($subParts[0])); // Sets the value
2323 $items[] = $subParts; // Adds the value/label pair to the items-array
2325 $default = $subParts[1];
2326 } // Sets the default value if value/label pair is marked as default.
2328 // alternative default value:
2329 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
2330 // Create the select-box:
2331 $iCount = count($items);
2332 for ($a = 0; $a < $iCount; $a++
) {
2333 $radioId = $prefix . $fName . $this->cleanFormName($items[$a][0]);
2334 if ($conf['accessibility']) {
2335 $radioLabelIdAttribute = ' id="' . $radioId . '"';
2337 $radioLabelIdAttribute = '';
2339 $option .= '<input type="radio" name="' . $confData['fieldname'] . '"' .
2340 $radioLabelIdAttribute . ' value="' . $items[$a][1] . '"' .
2341 (!strcmp($items[$a][1], $default) ?
' checked="checked"' : '') .
2343 if ($conf['accessibility']) {
2344 $option .= '<label for="' . $radioId . '">' .
2345 $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) .
2348 $option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
2352 if ($conf['accessibility']) {
2353 $accessibilityWrap = $conf['radioWrap.']['accessibilityWrap'];
2356 '###RADIO_FIELD_ID###', '###RADIO_GROUP_LABEL###'
2359 $elementIdAttribute, $confData['label']
2361 $accessibilityWrap = str_replace($search, $replace, $accessibilityWrap);
2363 $option = $this->wrap($option, $accessibilityWrap);
2366 $fieldCode = $option;
2369 $value = trim($parts[2]);
2371 // If this form includes an auto responder message, include a HMAC checksum field
2372 // in order to verify potential abuse of this feature.
2373 if (strlen($value) && t3lib_div
::inList($confData['fieldname'], 'auto_respond_msg')) {
2374 $hmacChecksum = t3lib_div
::hmac($value);
2375 $hiddenfields .= sprintf(
2376 '<input type="hidden" name="auto_respond_checksum" id="%sauto_respond_checksum" value="%s" />',
2382 if (strlen($value) && t3lib_div
::inList('recipient_copy,recipient',
2383 $confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
2386 if (strlen($value) && t3lib_div
::inList('recipient_copy,recipient', $confData['fieldname'])) {
2387 $value = $GLOBALS['TSFE']->codeString($value);
2389 $hiddenfields .= sprintf(
2390 '<input type="hidden" name="%s"%s value="%s" />',
2391 $confData['fieldname'],
2392 $elementIdAttribute,
2393 htmlspecialchars($value)
2397 if (t3lib_div
::inList('type,locationData,goodMess,badMess,emailMess', $confData['fieldname'])) {
2398 $value = trim($parts[2]);
2399 $propertyOverride[$confData['fieldname']] = $value;
2400 $conf[$confData['fieldname']] = $value;
2404 $value = trim($parts[2]);
2405 if ($conf['image.']) {
2406 $this->data
[$this->currentValKey
] = $value;
2407 $image = $this->IMG_RESOURCE($conf['image.']);
2408 $params = $conf['image.']['params'] ?
' ' . $conf['image.']['params'] : '';
2409 $params .= $this->getAltParam($conf['image.'], FALSE);
2410 $params .= $addParams;
2415 $fieldCode = sprintf(
2416 '<input type="image" name="%s"%s src="%s"%s />',
2417 $confData['fieldname'],
2418 $elementIdAttribute,
2423 $fieldCode = sprintf(
2424 '<input type="submit" name="%s"%s value="%s"%s />',
2425 $confData['fieldname'],
2426 $elementIdAttribute,
2427 t3lib_div
::deHSCentities(htmlspecialchars($value)),
2433 $value = trim($parts[2]);
2434 $fieldCode = sprintf(
2435 '<input type="reset" name="%s"%s value="%s"%s />',
2436 $confData['fieldname'],
2437 $elementIdAttribute,
2438 t3lib_div
::deHSCentities(htmlspecialchars($value)),
2443 $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));
2446 $confData['type'] = 'comment';
2447 $fieldCode = trim($parts[2]) . ' ';
2452 // Checking for special evaluation modes:
2453 if (t3lib_div
::inList('textarea,input,password', $confData['type']) && strlen(trim($parts[3]))) {
2454 $modeParameters = t3lib_div
::trimExplode(':', $parts[3]);
2456 $modeParameters = array();
2459 // Adding evaluation based on settings:
2460 switch ((string) $modeParameters[0]) {
2462 $fieldlist[] = '_EREG';
2463 $fieldlist[] = $modeParameters[1];
2464 $fieldlist[] = $modeParameters[2];
2465 $fieldlist[] = $confData['fieldname'];
2466 $fieldlist[] = $confData['label'];
2467 $confData['required'] = 1; // Setting this so "required" layout is used.
2470 $fieldlist[] = '_EMAIL';
2471 $fieldlist[] = $confData['fieldname'];
2472 $fieldlist[] = $confData['label'];
2473 $confData['required'] = 1; // Setting this so "required" layout is used.
2476 if ($confData['required']) {
2477 $fieldlist[] = $confData['fieldname'];
2478 $fieldlist[] = $confData['label'];
2484 $fieldLabel = $confData['label'];
2485 if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/', $confData['type'])) {
2486 $fieldLabel = '<label for="' . $prefix . $fName . '">' . $fieldLabel . '</label>';
2489 // Getting template code:
2490 $fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
2491 $labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
2492 $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']); // RTF
2493 $result = $conf['layout'];
2494 if ($conf['REQ'] && $confData['required']) {
2495 if (is_array($conf['REQ.']['fieldWrap.']))
2496 $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
2497 if (is_array($conf['REQ.']['labelWrap.']))
2498 $labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
2499 if ($conf['REQ.']['layout']) {
2500 $result = $conf['REQ.']['layout'];
2503 if ($confData['type'] == 'comment' && $conf['COMMENT.']['layout']) {
2504 $result = $conf['COMMENT.']['layout'];
2506 if ($confData['type'] == 'check' && $conf['CHECK.']['layout']) {
2507 $result = $conf['CHECK.']['layout'];
2509 if ($confData['type'] == 'radio' && $conf['RADIO.']['layout']) {
2510 $result = $conf['RADIO.']['layout'];
2512 if ($confData['type'] == 'label' && $conf['LABEL.']['layout']) {
2513 $result = $conf['LABEL.']['layout'];
2515 $result = str_replace('###FIELD###', $fieldCode, $result);
2516 $result = str_replace('###LABEL###', $labelCode, $result);
2517 $result = str_replace('###COMMENT###', $commentCode, $result); //RTF
2518 $content .= $result;
2522 if ($conf['stdWrap.']) {
2523 $content = $this->stdWrap($content, $conf['stdWrap.']);
2527 // redirect (external: where to go afterwards. internal: where to submit to)
2528 $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)
2529 $page = $GLOBALS['TSFE']->page
;
2530 if (!$theRedirect) { // Internal: Just submit to current page
2531 $LD = $GLOBALS['TSFE']->tmpl
->linkData(
2537 $this->getClosestMPvalueForPage($page['uid'])
2539 } elseif (t3lib_div
::testInt($theRedirect)) { // Internal: Submit to page with ID $theRedirect
2540 $page = $GLOBALS['TSFE']->sys_page
->getPage_noCheck($theRedirect);
2541 $LD = $GLOBALS['TSFE']->tmpl
->linkData(
2547 $this->getClosestMPvalueForPage($page['uid'])
2549 } else { // External URL, redirect-hidden field is rendered!
2550 $LD = $GLOBALS['TSFE']->tmpl
->linkData(
2556 $this->getClosestMPvalueForPage($page['uid'])
2558 $LD['totalURL'] = $theRedirect;
2559 $hiddenfields .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($LD['totalURL']) . '" />'; // 18-09-00 added
2562 // Formtype (where to submit to!):
2563 $formtype = $propertyOverride['type'] ?
$propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']);
2564 if (t3lib_div
::testInt($formtype)) { // Submit to a specific page
2565 $page = $GLOBALS['TSFE']->sys_page
->getPage_noCheck($formtype);
2566 $LD_A = $GLOBALS['TSFE']->tmpl
->linkData(
2572 $this->getClosestMPvalueForPage($page['uid'])
2574 $action = $LD_A['totalURL'];
2575 } elseif ($formtype) { // Submit to external script
2577 $action = $formtype;
2578 } elseif (t3lib_div
::testInt($theRedirect)) {
2580 $action = $LD_A['totalURL'];
2581 } else { // Submit to "nothing" - which is current page
2582 $LD_A = $GLOBALS['TSFE']->tmpl
->linkData(
2583 $GLOBALS['TSFE']->page
,
2588 $this->getClosestMPvalueForPage($page['uid'])
2590 $action = $LD_A['totalURL'];
2594 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']);
2595 if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
2596 $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
2597 $hiddenfields .= '<input type="hidden" name="recipient" value="' . htmlspecialchars($theEmail) . '" />';
2601 if ($conf['locationData']) {
2602 if ($conf['locationData'] == 'HTTP_POST_VARS' && isset($_POST['locationData'])) {
2603 $locationData = t3lib_div
::_POST('locationData');
2605 // 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.
2606 $locationData = $GLOBALS['TSFE']->id
. ':' . $this->currentRecord
;
2608 $hiddenfields .= '<input type="hidden" name="locationData" value="' . htmlspecialchars($locationData) . '" />';
2612 if (is_array($conf['hiddenFields.'])) {
2613 foreach ($conf['hiddenFields.'] as $hF_key => $hF_conf) {
2614 if (substr($hF_key, -1) != '.') {
2615 $hF_value = $this->cObjGetSingle($hF_conf, $conf['hiddenFields.'][$hF_key . '.'], 'hiddenfields');
2616 if (strlen($hF_value) && t3lib_div
::inList('recipient_copy,recipient', $hF_key)) {
2617 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
2620 $hF_value = $GLOBALS['TSFE']->codeString($hF_value);
2622 $hiddenfields .= '<input type="hidden" name="' . $hF_key . '" value="' . htmlspecialchars($hF_value) . '" />';
2627 // Wrap all hidden fields in a div tag (see http://bugs.typo3.org/view.php?id=678)
2628 $hiddenfields = '<div style="display:none;">' . $hiddenfields . '</div>';
2631 $validateForm = ' onsubmit="return validateForm(\'' . $formname . '\',\'' . implode(',', $fieldlist)
2632 . '\',' . t3lib_div
::quoteJSvalue($conf['goodMess']) . ',' .
2633 t3lib_div
::quoteJSvalue($conf['badMess']) . ',' .
2634 t3lib_div
::quoteJSvalue($conf['emailMess']) . ')"';
2635 $GLOBALS['TSFE']->additionalHeaderData
['JSFormValidate'] = '<script type="text/javascript" src="' .
2636 t3lib_div
::createVersionNumberedFilename($GLOBALS['TSFE']->absRefPrefix
.
2637 't3lib/jsfunc.validateform.js') . '"></script>';
2643 $theTarget = ($theRedirect ?
$LD['target'] : $LD_A['target']);
2645 '<form' . ' action="' . htmlspecialchars($action) . '"' . ' id="' .
2646 $formname . '"' . ($xhtmlStrict ?
'' : ' name="' . $formname . '"') .
2647 ' enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"' .
2648 ' method="' . ($conf['method'] ?
$conf['method'] : 'post') . '"' .
2649 ($theTarget ?
' target="' . $theTarget . '"' : '') .
2650 $validateForm . '>', $hiddenfields . $content,
2654 if ($conf['arrayReturnMode']) {
2655 $content['validateForm'] = $validateForm;
2656 $content['formname'] = $formname;
2659 return implode('', $content);
2664 * Rendering the cObject, SEARCHRESULT
2666 * @param array array of TypoScript properties
2667 * @return string Output
2668 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=368&cHash=d00731cd7b
2670 function SEARCHRESULT($conf) {
2671 if (t3lib_div
::_GP('sword') && t3lib_div
::_GP('scols')) {
2672 $search = t3lib_div
::makeInstance('tslib_search');
2673 $search->register_and_explode_search_string(t3lib_div
::_GP('sword'));
2674 $search->register_tables_and_columns(t3lib_div
::_GP('scols'), $conf['allowedCols']);
2677 // the startId is found