Fix case in the function name (getUserObjectType)
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / class.tslib_content.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains classes for Content Rendering based on TypoScript Template configuration
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
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)
38 *
39 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
40 */
41 /**
42 * [CLASS/FUNCTION INDEX of SCRIPT]
43 *
44 *
45 *
46 * 256: class tslib_cObj
47 * 353: function start($data,$table='')
48 * 387: function setParent($data,$currentRecord)
49 *
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='__')
55 *
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)
80 *
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)
93 *
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)
102 *
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)
131 *
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)
139 *
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)
150 *
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)
171 *
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)
189 *
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)
197 *
198 *
199 * 7351: class tslib_frameset
200 * 7361: function make($setup)
201 * 7398: function frameParams($setup, $typeNum)
202 * 7426: function framesetParams($setup)
203 *
204 *
205 * 7459: class tslib_tableOffset
206 * 7471: function start($content,$offset)
207 *
208 *
209 * 7549: class tslib_controlTable
210 * 7584: function start($offset,$cMargins)
211 *
212 * TOTAL FUNCTIONS: 135
213 * (This index is automatically created/updated by the extension "extdeveval")
214 *
215 */
216
217
218 // Includes this classes since it is used for parsing HTML
219 require_once(PATH_t3lib."class.t3lib_parsehtml.php");
220
221 // Object TypoScript library included:
222 if(t3lib_extMgm::isLoaded('obts')) {
223 require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php');
224 }
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242 /**
243 * This class contains all main TypoScript features.
244 * This includes the rendering of TypoScript content objects (cObjects).
245 * Is the backbone of TypoScript Template rendering.
246 *
247 * There are lots of functions you can use from your include-scripts.
248 * The class "tslib_cObj" is normally instantiated and referred to as "cObj".
249 * 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.
250 *
251 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
252 * @package TYPO3
253 * @subpackage tslib
254 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
255 */
256 class tslib_cObj {
257 var $align = Array ('center', 'right', 'left');
258
259 /**
260 * Holds ImageMagick parameters and extensions used for compression
261 *
262 * @see IMGTEXT()
263 *
264 * 0= Default
265 * 1= Dont change! (removes all parameters for the image_object!!)
266 * 1x = GIFs
267 * 2x = JPGs
268 */
269 var $image_compression = Array(
270 10 => Array('params'=>'', 'ext'=>'gif'),
271 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
272 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
273 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
274 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
275 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
276
277 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
278 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
279 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
280 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
281 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
282 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
283 39 => Array('params'=>'', 'ext'=>'png'),
284
285 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
286 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
287 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
288 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
289 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
290 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
291 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
292 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
293 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
294 );
295
296 /**
297 * ImageMagick parameters for image effects
298 *
299 * @see IMGTEXT()
300 */
301 var $image_effects = Array(
302 1 => '-rotate 90',
303 2 => '-rotate 270',
304 3 => '-rotate 180',
305 10 => '-colorspace GRAY',
306 11 => '-sharpen 70',
307 20 => '-normalize',
308 23 => '-contrast',
309 25 => '-gamma 1.3',
310 26 => '-gamma 0.8'
311 );
312
313 /**
314 * Loaded with the current data-record.
315 *
316 * If the instance of this class is used to render records from the database those records are found in this array.
317 * The function stdWrap has TypoScript properties that fetch field-data from this array.
318 * @see init()
319 */
320 var $data = Array();
321 var $oldData = Array(); // Used for backup...
322 var $alternativeData =''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap
323 var $parameters = Array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags.
324 var $currentValKey = 'currentValue_kidjls9dksoje';
325 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.
326 var $currentRecordTotal = 0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query.
327 var $currentRecordNumber = 0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering.
328 var $parentRecordNumber = 0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering.
329 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.
330 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.
331
332 // internal
333 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)
334 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.
335 var $checkPid_badDoktypeList = '255';
336 var $lastTypoLinkUrl=''; // This will be set by typoLink() to the url of the most recent link created.
337 var $lastTypoLinkTarget=''; // DO. link target.
338 var $lastTypoLinkLD = array();
339 var $substMarkerCache=array(); // Caching substituteMarkerArrayCached function
340 var $recordRegister=array(); // Array that registers rendered content elements (or any table) to make sure they are not rendered recursively!
341 var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects
342 protected $stdWrapHookObjects = array(); // Containig hook objects for stdWrap
343
344 /**
345 * Set to true by doConvertToUserIntObject() if USER object wants to become USER_INT
346 */
347 protected $doConvertToUserIntObject = false;
348
349 /**
350 * Indicates current object type. Can hold one of OBJECTTYPE_ constants or false.
351 * The value is set and reset inside USER() function. Any time outside of
352 * USER() it is false.
353 */
354 protected $userObjectType = false;
355
356 /**
357 * Indicates that object type is USER.
358 *
359 * @see tslib_cObjh::$userObjectType
360 */
361 const OBJECTTYPE_USER_INT = 1;
362
363 /**
364 * Indicates that object type is USER.
365 *
366 * @see tslib_cObjh::$userObjectType
367 */
368 const OBJECTTYPE_USER = 2;
369
370 /**
371 * Class constructor.
372 * Well, it has to be called manually since it is not a real constructor function.
373 * 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.
374 *
375 * @param array $data the record data that is rendered.
376 * @param string $table the table that the data record is from.
377 * @return void
378 */
379 function start($data,$table='') {
380 global $TYPO3_CONF_VARS;
381 $this->data = $data;
382 $this->currentRecord = $table ? $table.':'.$this->data['uid'] : '';
383 $this->parameters = Array();
384 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) {
385 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) {
386 $this->cObjHookObjectsArr[$classArr[0]] = &t3lib_div::getUserObj($classArr[1]);
387 }
388 }
389
390 if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'])) {
391 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) {
392 $hookObject = &t3lib_div::getUserObj($classData);
393
394 if(!($hookObject instanceof tslib_content_stdWrapHook)) {
395 throw new UnexpectedValueException('$hookObject must implement interface tslib_content_stdWrapHook', 1195043965);
396 }
397
398 $this->stdWrapHookObjects[] = $hookObject;
399 }
400 }
401
402 }
403
404 /**
405 * Sets the internal variable parentRecord with information about current record.
406 * 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.
407 *
408 * @param array $data: The record array
409 * @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.
410 * @return void
411 * @access private
412 */
413 function setParent($data,$currentRecord) {
414 $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord);
415 }
416
417
418
419
420
421
422
423
424 /***********************************************
425 *
426 * CONTENT_OBJ:
427 *
428 ***********************************************/
429
430 /**
431 * Returns the "current" value.
432 * 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.
433 * It's like "load accumulator" in the good old C64 days... basically a "register" you can use as you like.
434 * 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.
435 *
436 * @return mixed The "current" value
437 */
438 function getCurrentVal() {
439 return $this->data[$this->currentValKey];
440 }
441
442 /**
443 * Sets the "current" value.
444 *
445 * @param mixed The variable that you want to set as "current"
446 * @return void
447 * @see getCurrentVal()
448 */
449 function setCurrentVal($value) {
450 $this->data[$this->currentValKey] = $value;
451 }
452
453 /**
454 * Rendering of a "numerical array" of cObjects from TypoScript
455 * Will call ->cObjGetSingle() for each cObject found and accumulate the output.
456 *
457 * @param array $setup: Array with cObjects as values.
458 * @param string $addKey: A prefix for the debugging information
459 * @return string Rendered output from the cObjects in the array.
460 * @see cObjGetSingle()
461 */
462 function cObjGet($setup,$addKey='') {
463 if (is_array($setup)) {
464 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
465 $content ='';
466 foreach($sKeyArray as $theKey) {
467 $theValue=$setup[$theKey];
468 if (intval($theKey) && !strstr($theKey,'.')) {
469 $conf=$setup[$theKey.'.'];
470 $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey); // Get the contentObject
471 }
472 }
473 return $content;
474 }
475 }
476
477 /**
478 * Renders a content object
479 *
480 * @param string The content object name, eg. "TEXT" or "USER" or "IMAGE"
481 * @param array The array with TypoScript properties for the content object
482 * @param string A string label used for the internal debugging tracking.
483 * @return string cObject output
484 * @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331
485 */
486 function cObjGetSingle($name,$conf,$TSkey='__') {
487 global $TYPO3_CONF_VARS;
488
489 $content='';
490 // Checking that the function is not called eternally. This is done by interrupting at a depth of 100
491 $GLOBALS['TSFE']->cObjectDepthCounter--;
492 if ($GLOBALS['TSFE']->cObjectDepthCounter>0) {
493 $name = trim($name);
494 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name);
495
496 // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something')
497 if (substr($name,0,1)=='<') {
498 $key = trim(substr($name,1));
499 $cF = t3lib_div::makeInstance('t3lib_TSparser');
500 // $name and $conf is loaded with the referenced values.
501 $old_conf=$conf;
502 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
503 if (is_array($old_conf) && count($old_conf)) {
504 $conf = $this->joinTSarrays($conf,$old_conf);
505 // debug($conf);
506 }
507 // Getting the cObject
508 $GLOBALS['TT']->incStackPointer();
509 $content.=$this->cObjGetSingle($name,$conf,$key);
510 $GLOBALS['TT']->decStackPointer();
511 } else {
512
513 $hooked = false;
514 // Application defined cObjects
515 foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) {
516 if (($name===$cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) {
517 $content.= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
518 $hooked = true;
519 }
520 }
521 if (!$hooked && t3lib_extMgm::isLoaded('obts') && isset($GLOBALS['OBTS']['tso_list'][$name])) {
522 $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this);
523 } elseif (!$hooked) {
524 // Traditional Content Object branching:
525 switch($name) {
526 case 'COBJ_ARRAY':
527 case 'COA':
528 $content.=$this->COBJ_ARRAY($conf);
529 break;
530 case 'COA_INT':
531 $content.=$this->COBJ_ARRAY($conf,'INT');
532 break;
533 case 'HTML':
534 $content.=$this->HTML($conf);
535 break;
536 case 'TEXT':
537 $content.=$this->TEXT($conf);
538 break;
539 case 'CLEARGIF':
540 $content.=$this->CLEARGIF($conf);
541 break;
542 case 'FILE':
543 $content.=$this->FILE($conf);
544 break;
545 case 'IMAGE':
546 $content.=$this->IMAGE($conf);
547 break;
548 case 'IMG_RESOURCE':
549 $content.=$this->IMG_RESOURCE($conf);
550 break;
551 case 'IMGTEXT':
552 $content.=$this->IMGTEXT($conf);
553 break;
554 case 'CONTENT':
555 $content.=$this->CONTENT($conf);
556 break;
557 case 'RECORDS':
558 $content.=$this->RECORDS($conf);
559 break;
560 case 'HMENU':
561 $content.=$this->HMENU($conf);
562 break;
563 case 'CTABLE':
564 $content.=$this->CTABLE($conf);
565 break;
566 case 'OTABLE':
567 $content.=$this->OTABLE($conf);
568 break;
569 case 'COLUMNS':
570 $content.=$this->COLUMNS($conf);
571 break;
572 case 'HRULER':
573 $content.=$this->HRULER($conf);
574 break;
575 case 'CASE':
576 $content.=$this->CASEFUNC($conf);
577 break;
578 case 'LOAD_REGISTER':
579 case 'RESTORE_REGISTER':
580 $this->LOAD_REGISTER($conf,$name);
581 break;
582 case 'FORM':
583 $content.=$this->FORM($conf);
584 break;
585 case 'SEARCHRESULT':
586 $content.=$this->SEARCHRESULT($conf);
587 break;
588 case 'PHP_SCRIPT':
589 $content.=$this->PHP_SCRIPT($conf);
590 break;
591 case 'PHP_SCRIPT_EXT':
592 $content.=$this->PHP_SCRIPT($conf,'EXT');
593 break;
594 case 'PHP_SCRIPT_INT':
595 $content.=$this->PHP_SCRIPT($conf,'INT');
596 break;
597 case 'USER':
598 $content.=$this->USER($conf);
599 break;
600 case 'USER_INT':
601 $content.=$this->USER($conf,'INT');
602 break;
603 case 'TEMPLATE':
604 $content.=$this->TEMPLATE($conf);
605 break;
606 case 'EDITPANEL':
607 if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);}
608 break;
609 case 'MULTIMEDIA':
610 $content.=$this->MULTIMEDIA($conf);
611 break;
612 default:
613 // call hook functions for extra processing
614 if($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
615 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classData) {
616 $hookObject = &t3lib_div::getUserObj($classData);
617
618 if(!($hookObject instanceof tslib_content_cObjGetSingleHook)) {
619 throw new UnexpectedValueException('$hookObject must implement interface tslib_content_cObjGetSingleHook', 1195043731);
620 }
621 /* @var $hookObject tslib_content_cObjGetSingleHook */
622 $content .= $hookObject->getSingleContentObject($name, (array) $conf, $TSkey, $this);
623 }
624 }
625 break;
626 }
627 }
628 }
629 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content);
630 }
631 // Increasing on exit...
632 $GLOBALS['TSFE']->cObjectDepthCounter++;
633 return $content;
634 }
635
636
637
638
639
640
641
642 /********************************************
643 *
644 * Functions rendering content objects (cObjects)
645 *
646 ********************************************/
647
648 /**
649 * Rendering the cObject, HTML
650 *
651 * @param array Array of TypoScript properties
652 * @return string Output
653 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=349&cHash=d3fd0c70b4
654 */
655 function HTML($conf) {
656 return $this->stdWrap($conf['value'],$conf['value.']);
657 }
658
659 /**
660 * Rendering the cObject, TEXT
661 *
662 * @param array Array of TypoScript properties
663 * @return string Output
664 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=350&cHash=b49de28f83
665 */
666 function TEXT($conf) {
667 return $this->stdWrap($conf['value'],$conf);
668 }
669
670 /**
671 * Rendering the cObject, CLEARGIF
672 *
673 * @param array Array of TypoScript properties
674 * @return string Output
675 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=355&cHash=70c0f19915
676 */
677 function CLEARGIF($conf) {
678 $w = $this->stdWrap($conf['width'],$conf['width.']);
679 $h = $this->stdWrap($conf['height'],$conf['height.']);
680 $w = $w ? $w : 1;
681 $h = $h ? $h : 1;
682 $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />';
683 $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap);
684
685 return $this->stdWrap($theValue,$conf['stdWrap.']);
686 }
687
688 /**
689 * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT
690 *
691 * @param array Array of TypoScript properties
692 * @param string If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached)
693 * @return string Output
694 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=351&cHash=a09db0329c
695 */
696 function COBJ_ARRAY($conf,$ext='') {
697 $content='';
698 switch($ext) {
699 case 'INT':
700 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
701 $content.='<!--'.$substKey.'-->';
702 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
703 'file' => $conf['includeLibs'],
704 'conf'=>$conf,
705 'cObj'=>serialize($this),
706 'type'=>'COA'
707 );
708 break;
709 default:
710 if ($this->checkIf($conf['if.'])) {
711 $content=$this->cObjGet($conf);
712 if ($conf['wrap']) {
713 $content=$this->wrap($content, $conf['wrap']);
714 }
715 if ($conf['stdWrap.']) {
716 $content=$this->stdWrap($content, $conf['stdWrap.']);
717 }
718 }
719 break;
720 }
721 return $content;
722 }
723
724 /**
725 * Rendering the cObject, USER and USER_INT
726 *
727 * @param array Array of TypoScript properties
728 * @param string If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached)
729 * @return string Output
730 * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/8/22/
731 */
732 function USER($conf, $ext = '') {
733 $content = '';
734 switch ($ext) {
735 case 'INT':
736 $this->userObjectType = self::OBJECTTYPE_USER_INT;
737 $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash();
738 $content.='<!--' . $substKey . '-->';
739 $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array(
740 'file' => $conf['includeLibs'],
741 'conf' => $conf,
742 'cObj' => serialize($this),
743 'type' => 'FUNC'
744 );
745 break;
746 default:
747 if ($this->userObjectType === false) {
748 // Come here only if we are not called from $TSFE->INTincScript_process()!
749 $this->userObjectType = self::OBJECTTYPE_USER;
750 }
751 $tempContent = $this->callUserFunction($conf['userFunc'], $conf, '');
752 if ($this->doConvertToUserIntObject) {
753 $this->doConvertToUserIntObject = false;
754 $content = $this->USER($conf, 'INT');
755 } else {
756 $content .= $tempContent;
757 }
758 break;
759 }
760 $this->userObjectType = false;
761 return $content;
762 }
763
764 /**
765 * Retrieves a type of object called as USER or USER_INT. Object can detect their
766 * type by using this call. It returns OBJECTTYPE_USER_INT or OBJECTTYPE_USER depending on the
767 * current object execution. In all other cases it will return false to indicate
768 * a call out of context.
769 *
770 * @return mixed One of OBJECTTYPE_ class constants or false
771 */
772 public function getUserObjectType() {
773 return $this->userObjectType;
774 }
775
776 /**
777 * Requests the current USER object to be converted to USER_INT.
778 *
779 * @return void
780 */
781 public function convertToUserIntObject() {
782 if ($this->userObjectType !== self::OBJECTTYPE_USER) {
783 $GLOBALS['TT']->setTSlogMessage('tslib_cObj::convertToUserIntObject() ' .
784 'is called in the wrong context or for the wrong object type', 2);
785 }
786 else {
787 $this->doConvertToUserIntObject = true;
788 }
789 }
790
791 /**
792 * Rendering the cObject, FILE
793 *
794 * @param array Array of TypoScript properties
795 * @return string Output
796 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=352&cHash=379c60f8bc
797 */
798 function FILE($conf) {
799 $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf, false)));
800 if ($conf['linkWrap']) {
801 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
802 }
803 return $this->wrap($theValue,$conf['wrap']);
804 }
805
806 /**
807 * Rendering the cObject, IMAGE
808 *
809 * @param array Array of TypoScript properties
810 * @return string Output
811 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=353&cHash=440681ea56
812 * @see cImage()
813 */
814 function IMAGE($conf) {
815 $content='';
816 if ($this->checkIf($conf['if.'])) {
817 $theValue = $this->cImage($conf['file'],$conf);
818 if ($conf['stdWrap.']) {
819 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
820 }
821 return $theValue;
822 }
823 }
824
825 /**
826 * Rendering the cObject, IMG_RESOURCE
827 *
828 * @param array Array of TypoScript properties
829 * @return string Output
830 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=354&cHash=46f9299706
831 * @see getImgResource()
832 */
833 function IMG_RESOURCE($conf) {
834 $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'],$conf['file.']);
835 return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3],$conf['stdWrap.']);
836 }
837
838 /**
839 * Rendering the cObject, IMGTEXT
840 *
841 * @param array Array of TypoScript properties
842 * @return string Output
843 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1
844 */
845 function IMGTEXT($conf) {
846 $content='';
847 if (is_array($conf['text.'])) {
848 $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content
849 }
850 $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images
851 if ($imgList) {
852 $imgs = t3lib_div::trimExplode(',',$imgList);
853 $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
854
855 $imgCount= count($imgs)-$imgStart;
856
857 $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
858 if ($imgMax) {
859 $imgCount = t3lib_div::intInRange($imgCount,0,$imgMax); // reduces the number of images.
860 }
861
862 $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
863
864 // initialisation
865 $caption='';
866 $captionArray = array();
867 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
868 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); // global caption, no splitting
869 }
870 if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
871 $legacyCaptionSplit = 1;
872 $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
873 if (!$capSplit) {$capSplit=chr(10);}
874 $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
875 while (list($ca_key, $ca_val) = each($captionArray)) {
876 $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
877 }
878 }
879
880 $tablecode='';
881 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
882
883 $tmppos = $position&7;
884 $contentPosition = $position&24;
885 $align = $this->align[$tmppos];
886 $cap = ($caption)?1:0;
887 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
888 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
889 $txtMarg=0;
890 }
891
892 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
893 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
894 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
895 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
896
897 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
898 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
899 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
900
901 $borderColor=$borderColor?$borderColor:'black';
902 $borderThickness=$borderThickness?$borderThickness:1;
903
904 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
905 if (!$caption_align) {
906 $caption_align = $align;
907 }
908 // generate cols
909 $colCount = ($cols > 1) ? $cols : 1;
910 if ($colCount > $imgCount) {$colCount = $imgCount;}
911 $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
912 // generate rows
913 if ($rows>1) {
914 $rowCount = $rows;
915 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
916 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
917 }
918
919 // max Width
920 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
921 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
922
923 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
924 if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max...
925 $maxWInText = round($maxW/2);
926 }
927
928 if ($maxWInText && $contentPosition>=16) { // inText
929 $maxW = $maxWInText;
930 }
931
932 if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column
933 /* debug($border*$borderThickness*2);
934 debug($maxW);
935 debug($colspacing);
936 debug(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2));
937 */
938 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
939 }
940 // create the relation between rows
941 $colMaxW = Array();
942 if ($colRelations) {
943 $rel_parts = explode(':',$colRelations);
944 $rel_total = 0;
945 for ($a=0;$a<$colCount;$a++) {
946 $rel_parts[$a] = intval($rel_parts[$a]);
947 $rel_total+= $rel_parts[$a];
948 }
949 if ($rel_total) {
950 for ($a=0;$a<$colCount;$a++) {
951 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
952 }
953 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.
954 $colMaxW = Array();
955 }
956 }
957 }
958 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
959 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
960 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
961
962 // fetches pictures
963 $splitArr=array();
964 $splitArr['imgObjNum']=$conf['imgObjNum'];
965 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
966
967 // EqualHeight
968 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
969 if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's
970 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
971 $gifCreator->init();
972 $relations = Array();
973 $relations_cols = Array();
974 $totalMaxW = $maxW*$colCount;
975 for($a=0;$a<$imgCount;$a++) {
976 $imgKey = $a+$imgStart;
977 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
978 $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height
979 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.
980 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration.
981 }
982 }
983 }
984
985 $imageRowsFinalWidths = Array(); // contains the width of every image row
986 $imageRowsMaxHeights = Array();
987 $imgsTag=array();
988 $origImages=array();
989 for($a=0;$a<$imgCount;$a++) {
990 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
991 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
992
993 $imgKey = $a+$imgStart;
994 $totalImagePath = $imgPath.$imgs[$imgKey];
995 $this->data[$this->currentValKey] = $totalImagePath;
996 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
997 $imgConf = $conf[$imgObjNum.'.'];
998
999 if ($equalHeight) {
1000 $scale = 1;
1001 if ($totalMaxW) {
1002 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
1003 if ($rowTotalMaxW > $totalMaxW) {
1004 $scale = $rowTotalMaxW / $totalMaxW;
1005 }
1006 }
1007 // transfer info to the imageObject. Please note, that
1008 $imgConf['file.']['height'] = round($equalHeight/$scale);
1009
1010 unset($imgConf['file.']['width']);
1011 unset($imgConf['file.']['maxW']);
1012 unset($imgConf['file.']['maxH']);
1013 unset($imgConf['file.']['minW']);
1014 unset($imgConf['file.']['minH']);
1015 unset($imgConf['file.']['width.']);
1016 unset($imgConf['file.']['maxW.']);
1017 unset($imgConf['file.']['maxH.']);
1018 unset($imgConf['file.']['minW.']);
1019 unset($imgConf['file.']['minH.']);
1020 $maxW = 0; // setting this to zero, so that it doesn't disturb
1021 }
1022
1023 if ($maxW) {
1024 if (count($colMaxW)) {
1025 $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
1026 } else {
1027 $imgConf['file.']['maxW'] = $maxW;
1028 }
1029 }
1030
1031 // Image Object supplied:
1032 if (is_array($imgConf)) {
1033 if ($this->image_effects[$image_effects]) {
1034 $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
1035 }
1036 if ($image_frames) {
1037 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
1038 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
1039 }
1040 }
1041 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
1042 if ($image_compression==1) {
1043 $tempImport = $imgConf['file.']['import'];
1044 $tempImport_dot = $imgConf['file.']['import.'];
1045 unset($imgConf['file.']);
1046 $imgConf['file.']['import'] = $tempImport;
1047 $imgConf['file.']['import.'] = $tempImport_dot;
1048 } elseif (isset($this->image_compression[$image_compression])) {
1049 $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
1050 $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
1051 unset($imgConf['file.']['ext.']);
1052 }
1053 }
1054
1055 // "alt", "title" and "longdesc" attributes:
1056 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
1057 $imgConf['altText'] = $conf['altText'];
1058 $imgConf['altText.'] = $conf['altText.'];
1059 }
1060 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
1061 $imgConf['titleText'] = $conf['titleText'];
1062 $imgConf['titleText.'] = $conf['titleText.'];
1063 }
1064 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
1065 $imgConf['longdescURL'] = $conf['longdescURL'];
1066 $imgConf['longdescURL.'] = $conf['longdescURL.'];
1067 }
1068 } else {
1069 $imgConf = array(
1070 'altText' => $conf['altText'],
1071 'titleText' => $conf['titleText'],
1072 'longdescURL' => $conf['longdescURL'],
1073 'file' => $totalImagePath
1074 );
1075 }
1076
1077 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
1078
1079 // Store the original filepath
1080 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
1081
1082 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
1083 if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
1084 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
1085 }
1086 }
1087 // calculating the tableWidth:
1088 // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth.
1089 $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
1090
1091 // make table for pictures
1092 $index=$imgStart;
1093
1094 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
1095 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
1096 if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time.
1097 if ($equalHeight) {
1098 $noCols=1;
1099 $noRows=0;
1100 }
1101
1102 $rowCount_temp=1;
1103 $colCount_temp=$colCount;
1104 if ($noRows) {
1105 $rowCount_temp = $rowCount;
1106 $rowCount=1;
1107 }
1108 if ($noCols) {
1109 $colCount=1;
1110 }
1111 // col- and rowspans calculated
1112 $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
1113 $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
1114
1115
1116 // Edit icons:
1117 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
1118
1119 // strech out table:
1120 $tablecode='';
1121 $flag=0;
1122 if ($conf['noStretchAndMarginCells']!=1) {
1123 $tablecode.='<tr>';
1124 if ($txtMarg && $align=='right') { // If right aligned, the textborder is added on the right side
1125 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
1126 $editIconsHTML='';
1127 $flag=1;
1128 }
1129 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
1130 if ($txtMarg && $align=='left') { // If left aligned, the textborder is added on the left side
1131 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
1132 $editIconsHTML='';
1133 $flag=1;
1134 }
1135 if ($flag) $tableWidth+=$txtMarg+1;
1136 // $tableWidth=0;
1137 $tablecode.='</tr>';
1138 }
1139
1140 // draw table
1141 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!
1142 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.
1143 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
1144 }
1145 $tablecode.='<tr>'; // starting row
1146 for ($b=0; $b<$colCount_temp; $b++) { // Looping through the columns
1147 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.
1148 if (!$noCols) {
1149 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
1150 } else {
1151 $colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($border?$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+($border?$borderThickness*2:0)).'"'.$this->getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />';
1152 $colSpacer='<td valign="top">'.$colSpacer.'</td>'; // added 160301, needed for the new "noCols"-table...
1153 $tablecode.=$colSpacer;
1154 }
1155 }
1156 if (!$noCols || ($noCols && !$b)) {
1157 $tablecode.='<td valign="top">'; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image.
1158 if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';} // In case of "noCols" we must set the table-tag that surrounds the images in the row.
1159 }
1160 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.
1161 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex; // register previous imgIndex
1162 $imgIndex = $index+$a*$colCount_temp;
1163 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
1164 if ($imgsTag[$imgIndex]) {
1165 if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
1166 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
1167 }
1168 if ($legacyCaptionSplit) {
1169 $thisCaption = $captionArray[$imgIndex];
1170 } else if ($conf['captionSplit'] || $conf['imageTextSplit']) {
1171 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
1172 }
1173 $imageHTML = $imgsTag[$imgIndex].'<br />';
1174 $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.
1175 if ($border) {$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}
1176 $imageHTML.=$editIconsHTML;
1177 $editIconsHTML='';
1178 $imageHTML.=$thisCaption; // Adds caption.
1179 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';} // If noCols, put in table cell.
1180 $tablecode.=$imageHTML;
1181 }
1182 }
1183 $index++;
1184 if (!$noCols || ($noCols && $b+1==$colCount_temp)) {
1185 if ($noCols) {$tablecode.='</tr></table>';} // In case of "noCols" we must finish the table that surrounds the images in the row.
1186 $tablecode.='</td>'; // Ending the cell. In case of "noCols" the cell holds all pictures!
1187 }
1188 }
1189 $tablecode.='</tr>'; // ending row
1190 }
1191 if ($c) {
1192 switch ($contentPosition) {
1193 case '0': // above
1194 case '8': // below
1195 switch ($align) { // These settings are needed for Firefox
1196 case 'center':
1197 $table_align = 'margin-left: auto; margin-right: auto';
1198 break;
1199 case 'right':
1200 $table_align = 'margin-left: auto; margin-right: 0px';
1201 break;
1202 default: // Most of all: left
1203 $table_align = 'margin-left: 0px; margin-right: auto';
1204 }
1205 $table_align = 'style="'.$table_align.'"';
1206 break;
1207 case '16': // in text
1208 $table_align = 'align="'.$align.'"';
1209 break;
1210 default:
1211 $table_align = '';
1212 }
1213
1214 // Table-tag is inserted
1215 $tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
1216 if ($editIconsHTML) { // IF this value is not long since reset.
1217 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
1218 $editIconsHTML='';
1219 }
1220 if ($cap) {
1221 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
1222 }
1223 $tablecode.='</table>';
1224 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
1225 }
1226
1227 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
1228 switch ($contentPosition) {
1229 case '0': // above
1230 $output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
1231 break;
1232 case '8': // below
1233 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
1234 break;
1235 case '16': // in text
1236 $output= $tablecode.$content;
1237 break;
1238 case '24': // in text, no wrap
1239 $theResult = '';
1240 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
1241 if ($align=='right') {
1242 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
1243 } else {
1244 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
1245 }
1246 $theResult.= '</tr></table>';
1247 $output= $theResult;
1248 break;
1249 }
1250 } else {
1251 $output= $content;
1252 }
1253
1254 if ($conf['stdWrap.']) {
1255 $output = $this->stdWrap($output, $conf['stdWrap.']);
1256 }
1257
1258 return $output;
1259 }
1260
1261 /**
1262 * Rendering the cObject, CONTENT
1263 *
1264 * @param array Array of TypoScript properties
1265 * @return string Output
1266 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=356&cHash=9f3b5c6ba2
1267 */
1268 function CONTENT($conf) {
1269 $theValue='';
1270
1271 $originalRec = $GLOBALS['TSFE']->currentRecord;
1272 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!!
1273 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
1274 }
1275
1276 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_') {
1277
1278 $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];
1279 $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
1280 $renderObjConf = $conf['renderObj.'];
1281
1282 $slide = intval($conf['slide'])?intval($conf['slide']):0;
1283 $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;
1284 $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;
1285 $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;
1286 $again = false;
1287
1288 do {
1289 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
1290 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
1291 $GLOBALS['TT']->setTSlogMessage($error,3);
1292 } else {
1293 $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1294 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
1295 $cObj =t3lib_div::makeInstance('tslib_cObj');
1296 $cObj->setParent($this->data,$this->currentRecord);
1297 $this->currentRecordNumber=0;
1298 $cobjValue = '';
1299 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1300
1301 // Versioning preview:
1302 $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row,TRUE);
1303
1304 // Language Overlay:
1305 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
1306 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
1307 }
1308
1309 if (is_array($row)) { // Might be unset in the sys_language_contentOL
1310 if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {
1311 $this->currentRecordNumber++;
1312 $cObj->parentRecordNumber = $this->currentRecordNumber;
1313 $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
1314 $this->lastChanged($row['tstamp']);
1315 $cObj->start($row,$conf['table']);
1316 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
1317 $cobjValue .= $tmpValue;
1318 }
1319 }
1320 }
1321 $GLOBALS['TYPO3_DB']->sql_free_result($res);
1322 }
1323 if ($slideCollectReverse) {
1324 $theValue = $cobjValue.$theValue;
1325 } else {
1326 $theValue .= $cobjValue;
1327 }
1328 if ($slideCollect>0) {
1329 $slideCollect--;
1330 }
1331 if ($slide) {
1332 if ($slide>0) {
1333 $slide--;
1334 }
1335 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
1336 $again = strlen($conf['select.']['pidInList'])?true:false;
1337 }
1338 } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));
1339 }
1340
1341 $theValue = $this->wrap($theValue,$conf['wrap']);
1342 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
1343
1344 $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore
1345 return $theValue;
1346 }
1347
1348 /**
1349 * Rendering the cObject, RECORDS
1350 *
1351 * @param array Array of TypoScript properties
1352 * @return string Output
1353 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=357&cHash=303e959472
1354 */
1355 function RECORDS($conf) {
1356 $theValue='';
1357
1358 $originalRec = $GLOBALS['TSFE']->currentRecord;
1359 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!!
1360 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
1361 }
1362
1363 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
1364 if ($conf['tables'] && $conf['source']) {
1365 $allowedTables = $conf['tables'];
1366 if (is_array($conf['conf.'])) {
1367 reset($conf['conf.']);
1368 while(list($k)=each($conf['conf.'])) {
1369 if (substr($k,-1)!='.') $allowedTables.=','.$k;
1370 }
1371 }
1372
1373 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
1374 $loadDB->start($conf['source'], $allowedTables);
1375 reset($loadDB->tableArray);
1376 while(list($table,)=each($loadDB->tableArray)) {
1377 if (is_array($GLOBALS['TCA'][$table])) {
1378 $loadDB->additionalWhere[$table]=$this->enableFields($table);
1379 }
1380 }
1381 $loadDB->getFromDB();
1382
1383 reset($loadDB->itemArray);
1384 $data = $loadDB->results;
1385
1386 $cObj =t3lib_div::makeInstance('tslib_cObj');
1387 $cObj->setParent($this->data,$this->currentRecord);
1388 $this->currentRecordNumber=0;
1389 $this->currentRecordTotal = count($loadDB->itemArray);
1390 reset($loadDB->itemArray);
1391 while(list(,$val)=each($loadDB->itemArray)) {
1392 $row = $data[$val['table']][$val['id']];
1393
1394 // Versioning preview:
1395 $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
1396
1397 // Language Overlay:
1398 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
1399 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
1400 }
1401
1402 if (is_array($row)) { // Might be unset in the content overlay things...
1403 if (!$conf['dontCheckPid']) {
1404 $row = $this->checkPid($row['pid']) ? $row : '';
1405 }
1406 if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) {
1407 $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
1408 $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
1409 $renderObjConf = $conf['conf.'][$val['table'].'.'];
1410 $this->currentRecordNumber++;
1411 $cObj->parentRecordNumber=$this->currentRecordNumber;
1412 $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
1413 $this->lastChanged($row['tstamp']);
1414 $cObj->start($row,$val['table']);
1415 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
1416 $theValue .= $tmpValue;
1417 }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
1418 }
1419 }
1420 }
1421 if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']);
1422 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
1423
1424 $GLOBALS['TSFE']->currentRecord = $originalRec; // Restore
1425 return $theValue;
1426 }
1427
1428 /**
1429 * Rendering the cObject, HMENU
1430 *
1431 * @param array Array of TypoScript properties
1432 * @return string Output
1433 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=358&cHash=5400c1c06a
1434 */
1435 function HMENU($conf) {
1436 $content='';
1437 if ($this->checkIf($conf['if.'])) {
1438 $cls = strtolower($conf[1]);
1439 if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses,$cls)) {
1440 if ($conf['special.']['value.']) {
1441 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
1442 }
1443 $GLOBALS['TSFE']->register['count_HMENU']++;
1444 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']=0;
1445 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
1446 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']=array();
1447
1448 $menu = t3lib_div::makeInstance('tslib_'.$cls);
1449 $menu->parent_cObj = $this;
1450 $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1);
1451 $menu->makeMenu();
1452 $content.=$menu->writeMenu();
1453 }
1454 if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']);
1455 if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']);
1456 }
1457 return $content;
1458 }
1459
1460 /**
1461 * Rendering the cObject, CTABLE
1462 *
1463 * @param array Array of TypoScript properties
1464 * @return string Output
1465 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=359&cHash=2e0065b4e7
1466 */
1467 function CTABLE ($conf) {
1468 $controlTable = t3lib_div::makeInstance('tslib_controlTable');
1469 if ($conf['tableParams']) {
1470 $controlTable->tableParams = $conf['tableParams'];
1471 }
1472 // loads the pagecontent
1473 $controlTable->contentW = $conf['cWidth'];
1474 // loads the menues if any
1475 if (is_array($conf['c.'])) {
1476 $controlTable->content = $this->cObjGet($conf['c.'],'c.');
1477 $controlTable->contentTDparams = isset($conf['c.']['TDParams']) ? $conf['c.']['TDParams'] : 'valign="top"';
1478 }
1479 if (is_array($conf['lm.'])) {
1480 $controlTable->lm = $this->cObjGet($conf['lm.'],'lm.');
1481 $controlTable->lmTDparams = isset($conf['lm.']['TDParams']) ? $conf['lm.']['TDParams'] : 'valign="top"';
1482 }
1483 if (is_array($conf['tm.'])) {
1484 $controlTable->tm = $this->cObjGet($conf['tm.'],'tm.');
1485 $controlTable->tmTDparams = isset($conf['tm.']['TDParams']) ? $conf['tm.']['TDParams'] : 'valign="top"';
1486 }
1487 if (is_array($conf['rm.'])) {
1488 $controlTable->rm = $this->cObjGet($conf['rm.'],'rm.');
1489 $controlTable->rmTDparams = isset($conf['rm.']['TDParams']) ? $conf['rm.']['TDParams'] : 'valign="top"';
1490 }
1491 if (is_array($conf['bm.'])) {
1492 $controlTable->bm = $this->cObjGet($conf['bm.'],'bm.');
1493 $controlTable->bmTDparams = isset($conf['bm.']['TDParams']) ? $conf['bm.']['TDParams'] : 'valign="top"';
1494 }
1495 return $controlTable->start($conf['offset'],$conf['cMargins']);
1496 }
1497
1498 /**
1499 * Rendering the cObject, OTABLE
1500 *
1501 * @param array Array of TypoScript properties
1502 * @return string Output
1503 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=360&cHash=02c9552d38
1504 */
1505 function OTABLE ($conf) {
1506 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
1507 if ($conf['tableParams']) {
1508 $controlTable->tableParams = $conf['tableParams'];
1509 }
1510 return $controlTable->start($this->cObjGet($conf),$conf['offset']);
1511 }
1512
1513 /**
1514 * Rendering the cObject, COLUMNS
1515 *
1516 * @param array Array of TypoScript properties
1517 * @return string Output
1518 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=361&cHash=7e4e228cad
1519 */
1520 function COLUMNS ($conf) {
1521 $content='';
1522 if (is_array($conf) && $this->checkIf($conf['if.'])) {
1523 $tdRowCount=0;
1524 $tableParams = $conf['tableParams'] ? ' '.$conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"';
1525 $TDparams = $conf['TDparams'] ? ' '.$conf['TDparams']:' valign="top"';
1526 $rows = t3lib_div::intInRange($conf['rows'],2,20);
1527 $totalWidth = intval($conf['totalWidth']);
1528 $columnWidth=0;
1529
1530 $totalGapWidth=0;
1531 $gapData = Array(
1532 'gapWidth' => $this->stdWrap($conf['gapWidth'],$conf['gapWidth.']),
1533 'gapBgCol' => $this->stdWrap($conf['gapBgCol'],$conf['gapBgCol.']),
1534 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'],$conf['gapLineThickness.']),
1535 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.'])
1536 );
1537 $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1);
1538 reset($gapData);
1539 while(list(,$val)=each($gapData)) {
1540 $totalGapWidth+=intval($val['gapWidth']);
1541 }
1542
1543 if ($totalWidth) {
1544 $columnWidth = ceil(($totalWidth-$totalGapWidth)/$rows);
1545 $TDparams.=' width="'.$columnWidth.'"';
1546 $tableParams.=' width="'.$totalWidth.'"';
1547 } else {
1548 $TDparams.=' width="'.floor(100/$rows).'%"';
1549 $tableParams.=' width="100%"';
1550 }
1551
1552 for ($a=1;$a<=$rows;$a++) {
1553 $tdRowCount++;
1554 $content.='<td'.$TDparams.'>';
1555 $content.=$this->cObjGetSingle($conf[$a],$conf[$a.'.'], $a);
1556 $content.='</td>';
1557 if ($a < $rows) {
1558 $gapConf = $gapData[($a-1)];
1559 $gapWidth = intval($gapConf['gapWidth']);
1560 if ($gapWidth) {
1561 $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="'.$gapConf['gapBgCol'].'"' : '';
1562 $gapLine = intval($gapConf['gapLineThickness']);
1563 if ($gapLine) {
1564 $gapSurround = t3lib_div::intInRange(($gapWidth-$gapLine)/2, 1, 1000);
1565 // right gap
1566 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
1567 $tdRowCount++;
1568 // line:
1569 $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="'.$gapConf['gapLineCol'].'"' : ' bgcolor="black"';
1570 $content.='<td'.$GtdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapLine.'" height="1" alt="" title="" /></td>';
1571 $tdRowCount++;
1572 // left gap
1573 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
1574 $tdRowCount++;
1575 } else {
1576 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapWidth.'" height="1" alt="" title="" /></td>';
1577 $tdRowCount++;
1578 }
1579 }
1580 }
1581 }
1582 $content = '<tr>'.$content.'</tr>';
1583 $content = '<table'.$tableParams.'>'.$content.'</table>';
1584 $content.= $this->cObjGetSingle($conf['after'],$conf['after.'], 'after');
1585 if ($conf['stdWrap.']) {
1586 $content = $this->stdWrap($content,$conf['stdWrap.']);
1587 }
1588 }
1589 return $content;
1590 }
1591
1592 /**
1593 * Rendering the cObject, HRULER
1594 *
1595 * @param array Array of TypoScript properties
1596 * @return string Output
1597 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=362&cHash=2a462aa084
1598 */
1599 function HRULER ($conf) {
1600 $lineThickness = t3lib_div::intInRange($this->stdWrap($conf['lineThickness'],$conf['lineThickness.']),1,50);
1601 $lineColor = $conf['lineColor'] ? $conf['lineColor'] : 'black';
1602 $spaceBefore = intval($conf['spaceLeft']);
1603 $spaceAfter = intval($conf['spaceRight']);
1604 $tableWidth = $conf['tableWidth'] ? $conf['tableWidth'] : '99%';
1605 $content='';
1606
1607 $content.='<table border="0" cellspacing="0" cellpadding="0" width="'.htmlspecialchars($tableWidth).'" summary=""><tr>';
1608 if ($spaceBefore) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceBefore.'" height="1" alt="" title="" /></td>'; }
1609 $content.='<td bgcolor="'.$lineColor.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$lineThickness.'" alt="" title="" /></td>';
1610 if ($spaceAfter) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceAfter.'" height="1" alt="" title="" /></td>'; }
1611 $content.='</tr></table>';
1612
1613 $content = $this->stdWrap($content, $conf['stdWrap.']);
1614 return $content;
1615 }
1616
1617 /**
1618 * Rendering the cObject, CASE
1619 *
1620 * @param array Array of TypoScript properties
1621 * @return string Output
1622 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=364&cHash=cffedd09e3
1623 */
1624 function CASEFUNC ($conf){
1625 $content='';
1626 if ($this->checkIf($conf['if.'])) {
1627 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
1628 $key = $this->stdWrap($conf['key'],$conf['key.']);
1629 $key = strlen($conf[$key]) ? $key : 'default';
1630 $name = $conf[$key];
1631 $theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key);
1632 if ($conf['stdWrap.']) {
1633 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
1634 }
1635 return $theValue;
1636 }
1637 }
1638
1639 /**
1640 * Rendering the cObject, LOAD_REGISTER and RESTORE_REGISTER
1641 * NOTICE: This cObject does NOT return any content since it just sets internal data based on the TypoScript properties.
1642 *
1643 * @param array Array of TypoScript properties
1644 * @param string If "RESTORE_REGISTER" then the cObject rendered is "RESTORE_REGISTER", otherwise "LOAD_REGISTER"
1645 * @return string Empty string (the cObject only sets internal data!)
1646 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=365&cHash=4935524e2e
1647 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=366&cHash=4f9485e8cc
1648 */
1649 function LOAD_REGISTER($conf,$name) {
1650 if ($name=='RESTORE_REGISTER') {
1651 $GLOBALS['TSFE']->register = array_pop($GLOBALS['TSFE']->registerStack);
1652 } else {
1653 array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register);
1654 if (is_array($conf)) {
1655 reset($conf);
1656 while(list($theKey,$theValue)=each($conf)) {
1657 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
1658 if (strstr($theKey,'.')) {
1659 $theKey = substr($theKey,0,-1);
1660 }
1661 $GLOBALS['TSFE']->register[$theKey] = $this->stdWrap($conf[$theKey],$conf[$theKey.'.']);
1662 }
1663 }
1664 }
1665 }
1666 return '';
1667 }
1668
1669 /**
1670 * Rendering the cObject, FORM
1671 *
1672 * Note on $formData:
1673 * In the optional $formData array each entry represents a line in the ordinary setup.
1674 * In those entries each entry (0,1,2...) represents a space normally divided by the '|' line.
1675 *
1676 * $formData [] = array('Name:', 'name=input, 25 ', 'Default value....');
1677 * $formData [] = array('Email:', 'email=input, 25 ', 'Default value for email....');
1678 *
1679 * - corresponds to the $conf['data'] value being :
1680 * Name:|name=input, 25 |Default value....||Email:|email=input, 25 |Default value for email....
1681 *
1682 * If $formData is an array the value of $conf['data'] is ignored.
1683 *
1684 * @param array Array of TypoScript properties
1685 * @param array Alternative formdata overriding whatever comes from TypoScript
1686 * @return string Output
1687 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=367&cHash=bbc518d930
1688 */
1689 function FORM($conf,$formData='') {
1690 $content='';
1691 if (is_array($formData)) {
1692 $dataArr = $formData;
1693 } else {
1694 $data = $this->stdWrap($conf['data'],$conf['data.']);
1695 // Clearing dataArr
1696 $dataArr = array();
1697 // Getting the original config
1698 if (trim($data)) {
1699 $data = str_replace(chr(10),'||',$data);
1700 $dataArr = explode('||',$data);
1701 }
1702 // Adding the new dataArray config form:
1703 if (is_array($conf['dataArray.'])) { // dataArray is supplied
1704 $sKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
1705 foreach ($sKeyArray as $theKey) {
1706 $dAA = $conf['dataArray.'][$theKey.'.'];
1707 if (is_array($dAA)) {
1708 $temp = array();
1709 list($temp[0]) = explode('|',$dAA['label.'] ? $this->stdWrap($dAA['label'],$dAA['label.']) : $dAA['label']);
1710 list($temp[1]) = explode('|',$dAA['type']);
1711 if ($dAA['required']) {
1712 $temp[1] = '*'.$temp[1];
1713 }
1714 list($temp[2]) = explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']);
1715 // If value Array is set, then implode those values.
1716 if (is_array($dAA['valueArray.'])) {
1717 reset($dAA['valueArray.']);
1718 $temp_accum = array();
1719 while (list($dAKey_vA,$dAA_vA) = each($dAA['valueArray.'])) {
1720 if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) {
1721 $temp_vA=array();
1722 list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']);
1723 if ($dAA_vA['selected']) {$temp_vA[0]='*'.$temp_vA[0];}
1724 list($temp_vA[1])= explode(',',$dAA_vA['value']);
1725 }
1726 $temp_accum[] = implode('=',$temp_vA);
1727 }
1728 $temp[2] = implode(',',$temp_accum);
1729 }
1730 list($temp[3]) = explode('|',$dAA['specialEval.'] ? $this->stdWrap($dAA['specialEval'],$dAA['specialEval.']) : $dAA['specialEval']);
1731
1732 // adding the form entry to the dataArray
1733 $dataArr[] = implode('|',$temp);
1734 }
1735 }
1736 }
1737 }
1738
1739 $attachmentCounter = '';
1740 $hiddenfields = '';
1741 $fieldlist = Array();
1742 $propertyOverride = Array();
1743 $fieldname_hashArray = Array();
1744 $cc = 0;
1745
1746 $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype);
1747 // Formname
1748 if ($conf['formName']) {
1749 $formname = $this->cleanFormName($conf['formName']);
1750 } else {
1751 $formname = $GLOBALS['TSFE']->uniqueHash();
1752 $formname = 'a'.$formname; // form name has to start with a letter to reach XHTML compliance
1753 }
1754
1755 if (isset($conf['fieldPrefix'])) {
1756 if ($conf['fieldPrefix']) {
1757 $prefix = $this->cleanFormName($conf['fieldPrefix']);
1758 } else {
1759 $prefix = '';
1760 }
1761 } else {
1762 $prefix = $formname;
1763 }
1764
1765 foreach ($dataArr as $val) {
1766
1767 $cc++;
1768 $confData=Array();
1769 if (is_array($formData)) {
1770 $parts = $val;
1771 $val = 1; // true...
1772 } else {
1773 $val = trim($val);
1774 $parts = explode('|',$val);
1775 }
1776 if ($val && strcspn($val,'#/')) {
1777 // label:
1778 $confData['label'] = trim($parts[0]);
1779 // field:
1780 $fParts = explode(',',$parts[1]);
1781 $fParts[0]=trim($fParts[0]);
1782 if (substr($fParts[0],0,1)=='*') {
1783 $confData['required']=1;
1784 $fParts[0] = substr($fParts[0],1);
1785 }
1786 $typeParts = explode('=',$fParts[0]);
1787 $confData['type'] = trim(strtolower(end($typeParts)));
1788 if (count($typeParts)==1) {
1789 $confData['fieldname'] = $this->cleanFormName($parts[0]);
1790 if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email') {$confData['fieldname']='email';}
1791 // Duplicate fieldnames resolved
1792 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
1793 $confData['fieldname'].='_'.$cc;
1794 }
1795 $fieldname_hashArray[md5($confData['fieldname'])]=$confData['fieldname'];
1796 // Attachment names...
1797 if ($confData['type']=='file') {
1798 $confData['fieldname']='attachment'.$attachmentCounter;
1799 $attachmentCounter=intval($attachmentCounter)+1;
1800 }
1801 } else {
1802 $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0]));
1803 }
1804 $fieldCode='';
1805
1806 if ($conf['wrapFieldName']) {
1807 $confData['fieldname'] = $this->wrap($confData['fieldname'],$conf['wrapFieldName']);
1808 }
1809
1810 // Set field name as current:
1811 $this->setCurrentVal($confData['fieldname']);
1812
1813 // Additional parameters
1814 if (trim($confData['type'])) {
1815 $addParams=trim($conf['params']);
1816 if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
1817 $addParams=trim($conf['params.'][$confData['type']]);
1818 }
1819 if (strcmp('',$addParams)) { $addParams=' '.$addParams; }
1820 } else $addParams='';
1821
1822 if ($conf['dontMd5FieldNames']) {
1823 $fName = $confData['fieldname'];
1824 } else {
1825 $fName = md5($confData['fieldname']);
1826 }
1827
1828 // Accessibility: Set id = fieldname attribute:
1829 if ($conf['accessibility'] || $xhtmlStrict) {
1830 $elementIdAttribute = ' id="'.$prefix.$fName.'"';
1831 } else {
1832 $elementIdAttribute = '';
1833 }
1834
1835 // Create form field based on configuration/type:
1836 switch ($confData['type']) {
1837 case 'textarea':
1838 $cols=trim($fParts[1]) ? intval($fParts[1]) : 20;
1839 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
1840 $compWidth = $compWidth ? $compWidth : 1;
1841 $cols = t3lib_div::intInRange($cols*$compWidth, 1, 120);
1842
1843 $rows=trim($fParts[2]) ? t3lib_div::intInRange($fParts[2],1,30) : 5;
1844 $wrap=trim($fParts[3]);
1845 if ($conf['noWrapAttr'] || $wrap === 'disabled') {
1846 $wrap='';
1847 } else {
1848 $wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"';
1849 }
1850 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',chr(10),trim($parts[2])));
1851 $fieldCode=sprintf('<textarea name="%s"%s cols="%s" rows="%s"%s%s>%s</textarea>',
1852 $confData['fieldname'], $elementIdAttribute, $cols, $rows, $wrap, $addParams, t3lib_div::formatForTextarea($default));
1853 break;
1854 case 'input':
1855 case 'password':
1856 $size=trim($fParts[1]) ? intval($fParts[1]) : 20;
1857 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
1858 $compWidth = $compWidth ? $compWidth : 1;
1859 $size = t3lib_div::intInRange($size*$compWidth, 1, 120);
1860 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
1861
1862 if ($confData['type']=='password') {
1863 $default='';
1864 }
1865
1866 $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : "";
1867 $theType = $confData['type']=='input' ? 'text' : 'password';
1868
1869 $fieldCode=sprintf('<input type="%s" name="%s"%s size="%s"%s value="%s"%s />',
1870 $theType, $confData['fieldname'], $elementIdAttribute, $size, $max, htmlspecialchars($default), $addParams);
1871
1872 break;
1873 case 'file':
1874 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20;
1875 $fieldCode=sprintf('<input type="file" name="%s"%s size="%s"%s />',
1876 $confData['fieldname'], $elementIdAttribute, $size, $addParams);
1877 break;
1878 case 'check':
1879 // alternative default value:
1880 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
1881 $checked = $default ? ' checked="checked"' : '';
1882 $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"%s%s%s />',
1883 1, $confData['fieldname'], $elementIdAttribute, $checked, $addParams);
1884 break;
1885 case 'select':
1886 $option='';
1887 $valueParts = explode(',',$parts[2]);
1888 // size
1889 if (strtolower(trim($fParts[1]))=='auto') {$fParts[1]=count($valueParts);} // Auto size set here. Max 20
1890 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,20) : 1;
1891 // multiple
1892 $multiple = strtolower(trim($fParts[2]))=='m' ? ' multiple="multiple"' : '';
1893
1894 $items=array(); // Where the items will be
1895 $defaults=array(); //RTF
1896 $pCount = count($valueParts);
1897 for($a=0;$a<$pCount;$a++) {
1898 $valueParts[$a]=trim($valueParts[$a]);
1899 if (substr($valueParts[$a],0,1)=='*') { // Finding default value
1900 $sel='selected';
1901 $valueParts[$a] = substr($valueParts[$a],1);
1902 } else $sel='';
1903 // Get value/label
1904 $subParts=explode('=',$valueParts[$a]);
1905 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0])); // Sets the value
1906 $items[] = $subParts; // Adds the value/label pair to the items-array
1907 if ($sel) {$defaults[]=$subParts[1];} // Sets the default value if value/label pair is marked as default.
1908 }
1909 // alternative default value:
1910 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
1911 if (!is_array($default)) {
1912 $defaults=array();
1913 $defaults[] = $default;
1914 } else $defaults=$default;
1915 // Create the select-box:
1916 $iCount = count($items);
1917 for($a=0;$a<$iCount;$a++) {
1918 $option.='<option value="'.$items[$a][1].'"'.(in_array($items[$a][1],$defaults)?' selected="selected"':'').'>'.trim($items[$a][0]).'</option>'; //RTF
1919 }
1920
1921 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.
1922 $fieldCode=sprintf('<select name="%s"%s size="%s"%s%s>%s</select>',
1923 $confData['fieldname'], $elementIdAttribute, $size, $multiple, $addParams, $option); //RTF
1924 break;
1925 case 'radio':
1926 $option='';
1927
1928 $valueParts = explode(',',$parts[2]);
1929 $items=array(); // Where the items will be
1930 $default='';
1931 $pCount = count($valueParts);
1932 for($a=0;$a<$pCount;$a++) {
1933 $valueParts[$a]=trim($valueParts[$a]);
1934 if (substr($valueParts[$a],0,1)=='*') {
1935 $sel='checked';
1936 $valueParts[$a] = substr($valueParts[$a],1);
1937 } else $sel='';
1938 // Get value/label
1939 $subParts=explode('=',$valueParts[$a]);
1940 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0])); // Sets the value
1941 $items[] = $subParts; // Adds the value/label pair to the items-array
1942 if ($sel) {$default=$subParts[1];} // Sets the default value if value/label pair is marked as default.
1943 }
1944 // alternative default value:
1945 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
1946 // Create the select-box:
1947 $iCount = count($items);
1948 for($a=0;$a<$iCount;$a++) {
1949 $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]);
1950 if ($conf['accessibility']) {
1951 $radioLabelIdAttribute = ' id="'.$radioId.'"';
1952 } else {
1953 $radioLabelIdAttribute = '';
1954 }
1955 $option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').$addParams.' />';
1956 if ($conf['accessibility']) {
1957 $option .= '<label for="'.$radioId.'">' . $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) . '</label>';
1958 } else {
1959 $option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
1960 }
1961 }
1962
1963 if ($conf['accessibility']) {
1964 $accessibilityWrap = $conf['radioWrap.']['accessibilityWrap'];
1965
1966 $search = array(
1967 '###RADIO_FIELD_ID###',
1968 '###RADIO_GROUP_LABEL###'
1969 );
1970 $replace = array(
1971 $elementIdAttribute,
1972 $confData['label']
1973 );
1974 $accessibilityWrap = str_replace($search, $replace, $accessibilityWrap);
1975
1976 $option = $this->wrap($option, $accessibilityWrap);
1977 }
1978
1979 $fieldCode = $option;
1980 break;
1981 case 'hidden':
1982 $value = trim($parts[2]);
1983 if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
1984 break;
1985 }
1986 if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname'])) {
1987 $value = $GLOBALS['TSFE']->codeString($value);
1988 }
1989 $hiddenfields.= sprintf('<input type="hidden" name="%s"%s value="%s" />',
1990 $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value));
1991 break;
1992 case 'property':
1993 if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess',$confData['fieldname'])) {
1994 $value=trim($parts[2]);
1995 $propertyOverride[$confData['fieldname']] = $value;
1996 $conf[$confData['fieldname']] = $value;
1997 }
1998 break;
1999 case 'submit':
2000 $value=trim($parts[2]);
2001 if ($conf['image.']) {
2002 $this->data[$this->currentValKey] = $value;
2003 $image = $this->IMG_RESOURCE($conf['image.']);
2004 $params = $conf['image.']['params'] ? ' '.$conf['image.']['params'] : '';
2005 $params.= $this->getAltParam($conf['image.'], false);
2006 $params.= $addParams;
2007 } else {
2008 $image = '';
2009 }
2010 if ($image) {
2011 $fieldCode=sprintf('<input type="image" name="%s"%s src="%s"%s />',
2012 $confData['fieldname'], $elementIdAttribute, $image, $params);
2013 } else {
2014 $fieldCode=sprintf('<input type="submit" name="%s"%s value="%s"%s />',
2015 $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
2016 }
2017 break;
2018 case 'reset':
2019 $value=trim($parts[2]);
2020 $fieldCode=sprintf('<input type="reset" name="%s"%s value="%s"%s />',
2021 $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
2022 break;
2023 case 'label':
2024 $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));
2025 break;
2026 default:
2027 $confData['type'] = 'comment';
2028 $fieldCode = trim($parts[2]).'&nbsp;';
2029 break;
2030 }
2031 if ($fieldCode) {
2032
2033 // Checking for special evaluation modes:
2034 if (t3lib_div::inList('textarea,input,password',$confData['type']) && strlen(trim($parts[3]))) {
2035 $modeParameters = t3lib_div::trimExplode(':',$parts[3]);
2036 } else {
2037 $modeParameters = array();
2038 }
2039
2040 // Adding evaluation based on settings:
2041 switch ((string)$modeParameters[0]) {
2042 case 'EREG':
2043 $fieldlist[] = '_EREG';
2044 $fieldlist[] = rawurlencode($modeParameters[1]);
2045 $fieldlist[] = rawurlencode($modeParameters[2]);
2046 $fieldlist[] = rawurlencode($confData['fieldname']);
2047 $fieldlist[] = rawurlencode($confData['label']);
2048 $confData['required'] = 1; // Setting this so "required" layout is used.
2049 break;
2050 case 'EMAIL':
2051 $fieldlist[] = '_EMAIL';
2052 $fieldlist[] = rawurlencode($confData['fieldname']);
2053 $fieldlist[] = rawurlencode($confData['label']);
2054 $confData['required'] = 1; // Setting this so "required" layout is used.
2055 break;
2056 default:
2057 if ($confData['required']) {
2058 $fieldlist[] = rawurlencode($confData['fieldname']);
2059 $fieldlist[] = rawurlencode($confData['label']);
2060 }
2061 break;
2062 }
2063
2064 // Field:
2065 $fieldLabel = $confData['label'];
2066 if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/',$confData['type'])) {
2067 $fieldLabel = '<label for="'.$prefix.$fName.'">'.$fieldLabel.'</label>';
2068 }
2069
2070 // Getting template code:
2071 $fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
2072 $labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
2073 $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']); // RTF
2074 $result = $conf['layout'];
2075 if ($conf['REQ'] && $confData['required']) {
2076 if (is_array($conf['REQ.']['fieldWrap.']))
2077 $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
2078 if (is_array($conf['REQ.']['labelWrap.']))
2079 $labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
2080 if ($conf['REQ.']['layout']) {
2081 $result = $conf['REQ.']['layout'];
2082 }
2083 }
2084 if ($confData['type']=='comment' && $conf['COMMENT.']['layout']) {
2085 $result = $conf['COMMENT.']['layout'];
2086 }
2087 if ($confData['type']=='check' && $conf['CHECK.']['layout']) {
2088 $result = $conf['CHECK.']['layout'];
2089 }
2090 if ($confData['type']=='radio' && $conf['RADIO.']['layout']) {
2091 $result = $conf['RADIO.']['layout'];
2092 }
2093 if ($confData['type']=='label' && $conf['LABEL.']['layout']) {
2094 $result = $conf['LABEL.']['layout'];
2095 }
2096 $result = str_replace('###FIELD###',$fieldCode,$result);
2097 $result = str_replace('###LABEL###',$labelCode,$result);
2098 $result = str_replace('###COMMENT###',$commentCode,$result); //RTF
2099 $content.= $result;
2100 }
2101 }
2102 }
2103 if ($conf['stdWrap.']) { $content = $this->stdWrap($content, $conf['stdWrap.']); }
2104
2105
2106 // redirect (external: where to go afterwards. internal: where to submit to)
2107 $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)
2108 $page = $GLOBALS['TSFE']->page;
2109 if (!$theRedirect) { // Internal: Just submit to current page
2110 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
2111 } elseif (t3lib_div::testInt($theRedirect)) { // Internal: Submit to page with ID $theRedirect
2112 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
2113 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
2114 } else { // External URL, redirect-hidden field is rendered!
2115 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'', '', $this->getClosestMPvalueForPage($page['uid']));
2116 $LD['totalURL'] = $theRedirect;
2117 $hiddenfields.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($LD['totalURL']).'" />'; // 18-09-00 added
2118 }
2119
2120 // Formtype (where to submit to!):
2121 $formtype = $propertyOverride['type'] ? $propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']);
2122 if (t3lib_div::testInt($formtype)) { // Submit to a specific page
2123 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
2124 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
2125 $action = $LD_A['totalURL'];
2126 } elseif ($formtype) { // Submit to external script
2127 $LD_A = $LD;
2128 $action = $formtype;
2129 } elseif (t3lib_div::testInt($theRedirect)) {
2130 $LD_A = $LD;
2131 $action = $LD_A['totalURL'];
2132 } else { // Submit to "nothing" - which is current page
2133 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
2134 $action = $LD_A['totalURL'];
2135 }
2136
2137 // Recipient:
2138 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']);
2139 if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
2140 $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
2141 $hiddenfields.= '<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />';
2142 }
2143
2144 // location data:
2145 if ($conf['locationData']) {
2146 if ($conf['locationData']=='HTTP_POST_VARS' && isset($_POST['locationData'])) {
2147 $locationData = t3lib_div::_POST('locationData');
2148 } else {
2149 $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.
2150 }
2151 $hiddenfields.='<input type="hidden" name="locationData" value="'.htmlspecialchars($locationData).'" />';
2152 }
2153
2154 // hidden fields:
2155 if (is_array($conf['hiddenFields.'])) {
2156 reset($conf['hiddenFields.']);
2157 while (list($hF_key,$hF_conf) = each($conf['hiddenFields.'])) {
2158 if (substr($hF_key,-1)!='.') {
2159 $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields');
2160 if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient',$hF_key)) {
2161 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
2162 continue;
2163 }
2164 $hF_value = $GLOBALS['TSFE']->codeString($hF_value);
2165 }
2166 $hiddenfields.= '<input type="hidden" name="'.$hF_key.'" value="'.htmlspecialchars($hF_value).'" />';
2167 }
2168 }
2169 }
2170
2171 // Wrap all hidden fields in a div tag (see http://bugs.typo3.org/view.php?id=678)
2172 $hiddenfields = '<div style="display:none;">'.$hiddenfields.'</div>';
2173
2174 if ($conf['REQ']) {
2175 $validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\','.t3lib_div::quoteJSvalue($conf['goodMess']).','.t3lib_div::quoteJSvalue($conf['badMess']).','.t3lib_div::quoteJSvalue($conf['emailMess']).')"';
2176 $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
2177 } else $validateForm='';
2178
2179 // Create form tag:
2180 $theTarget = ($theRedirect?$LD['target']:$LD_A['target']);
2181 $content = array(
2182 '<form'.
2183 ' action="'.htmlspecialchars($action).'"'.
2184 ' id="'.$formname.'"'.($xhtmlStrict ? '' : ' name="'.$formname.'"').
2185 ' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
2186 ' method="'.($conf['method']?$conf['method']:'post').'"'.
2187 ($theTarget ? ' target="'.$theTarget.'"' : '').
2188 $validateForm.
2189 '>',
2190 $hiddenfields.$content,
2191 '</form>'
2192 );
2193
2194 if ($conf['arrayReturnMode']) {
2195 $content['validateForm']=$validateForm;
2196 $content['formname']=$formname;
2197 return $content;
2198 } else {
2199 return implode('',$content);
2200 }
2201 }
2202
2203 /**
2204 * Rendering the cObject, SEARCHRESULT
2205 *
2206 * @param array Array of TypoScript properties
2207 * @return string Output
2208 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=368&cHash=d00731cd7b
2209 */
2210 function SEARCHRESULT($conf) {
2211 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
2212 $search = t3lib_div::makeInstance('tslib_search');
2213 $search->register_and_explode_search_string(t3lib_div::_GP('sword'));
2214 $search->register_tables_and_columns(t3lib_div::_GP('scols'),$conf['allowedCols']);
2215 // depth
2216 $depth=100;
2217 // the startId is found
2218 $theStartId=0;
2219 if (t3lib_div::testInt(t3lib_div::_GP('stype'))) {
2220 $temp_theStartId=t3lib_div::_GP('stype');
2221 $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId);
2222 // The page MUST have a rootline with the Level0-page of the current site inside!!
2223 while(list(,$val)=each($rootLine)) {
2224 if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
2225 $theStartId=$temp_theStartId;
2226 }
2227 }
2228 } else if (t3lib_div::_GP('stype')) {
2229 if (substr(t3lib_div::_GP('stype'),0,1)=='L') {
2230 $pointer = intval(substr(t3lib_div::_GP('stype'),1));
2231 $theRootLine = $GLOBALS['TSFE']->tmpl->rootLine;
2232 // location Data:
2233 $locDat_arr = explode(':',t3lib_div::_POST('locationData'));
2234 $pId = intval($locDat_arr[0]);
2235 if ($pId) {
2236 $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId);
2237 ksort($altRootLine);
2238 if (count($altRootLine)) {
2239 // check if the rootline has the real Level0 in it!!
2240 reset($altRootLine);
2241 $hitRoot=0;
2242 $theNewRoot=array();
2243 while(list(,$val)=each($altRootLine)) {
2244 if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
2245 $hitRoot=1;
2246 $theNewRoot[]=$val;
2247 }
2248 }
2249 if ($hitRoot) {
2250 $theRootLine = $theNewRoot; // Override the real rootline if any thing
2251 }
2252 }
2253 }
2254 $key = $this->getKey($pointer,$theRootLine);
2255 $theStartId = $theRootLine[$key]['uid'];
2256 }
2257 }
2258 if (!$theStartId) {
2259 // If not set, we use current page
2260 $theStartId = $GLOBALS['TSFE']->id;
2261 }
2262 // generate page-tree
2263 $search->pageIdList.= $this->getTreeList(-1*$theStartId,$depth);
2264
2265 $endClause = 'pages.uid IN ('.$search->pageIdList.')
2266 AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?',3,4':'').')
2267 AND pages.no_search=0'.
2268 $this->enableFields($search->fTable).
2269 $this->enableFields('pages');
2270
2271 if ($conf['languageField.'][$search->fTable]) {
2272 $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!)
2273 }
2274
2275 // build query
2276 $search->build_search_query($endClause);
2277
2278 // count...
2279 if (t3lib_div::testInt(t3lib_div::_GP('scount'))) {
2280 $search->res_count = t3lib_div::_GP('scount');
2281 } else {
2282 $search->count_query();
2283 }
2284
2285 // range
2286 $spointer = intval(t3lib_div::_GP('spointer'));
2287 if (isset($conf['range'])) {
2288 $theRange = intval($conf['range']);
2289 } else {
2290 $theRange = 20;
2291 }
2292
2293 // Order By:
2294 if (!$conf['noOrderBy']) {
2295 $search->queryParts['ORDERBY'] = 'pages.lastUpdated, pages.tstamp';
2296 }
2297
2298 $search->queryParts['LIMIT'] = $spointer.','.$theRange;
2299
2300 // search...
2301 $search->execute_query();
2302 if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) {
2303 $GLOBALS['TSFE']->register['SWORD_PARAMS'] = $search->get_searchwords();
2304
2305 $total = $search->res_count;
2306 $rangeLow = t3lib_div::intInRange($spointer+1,1,$total);
2307 $rangeHigh = t3lib_div::intInRange($spointer+$theRange,1,$total);
2308 // prev/next url:
2309 $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,$conf['target'],1,'', '', $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']));
2310 $targetPart = $LD['target'] ? ' target="'.htmlspecialchars($LD['target']).'"' : '';
2311 $urlParams = $this->URLqMark($LD['totalURL'],
2312 '&sword='.rawurlencode(t3lib_div::_GP('sword')).
2313 '&scols='.rawurlencode(t3lib_div::_GP('scols')).
2314 '&stype='.rawurlencode(t3lib_div::_GP('stype')).
2315 '&scount='.$total);
2316 // substitution:
2317 $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout');
2318 $result = str_replace('###RANGELOW###',$rangeLow,$result);
2319 $result = str_replace('###RANGEHIGH###',$rangeHigh,$result);
2320 $result = str_replace('###TOTAL###',$total,$result);
2321
2322 if ($rangeHigh<$total) {
2323 $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next');
2324 $next = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer+$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$next.'</a>';
2325 } else $next='';
2326 $result = str_replace('###NEXT###',$next,$result);
2327
2328 if ($rangeLow>1) {
2329 $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev');
2330 $prev = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer-$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$prev.'</a>';
2331 } else $prev='';
2332 $result = str_replace('###PREV###',$prev,$result);
2333
2334 // searching result
2335 $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj');
2336 $cObj = t3lib_div::makeInstance('tslib_cObj');
2337 $cObj->setParent($this->data,$this->currentRecord);
2338 $renderCode='';
2339 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result)) {
2340 // versionOL() here? This is search result displays, is that possible to preview anyway? Or are records selected here already future versions?
2341 $cObj->start($row);
2342 $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj');
2343 }
2344 $theValue.=$this->wrap($renderCode,$conf['renderWrap']);
2345 $theValue = str_replace('###RESULT###',$theValue,$result);
2346 } else {
2347 $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj');
2348 }
2349
2350 $GLOBALS['TT']->setTSlogMessage('Search in fields: '.$search->listOfSearchFields);
2351
2352 // wrapping
2353 $content=$theValue;
2354 if ($conf['wrap']) {
2355 $content=$this->wrap($content, $conf['wrap']);
2356 }
2357 if ($conf['stdWrap.']) {
2358 $content=$this->stdWrap($content, $conf['stdWrap.']);
2359 }
2360 // returning
2361 $GLOBALS['TSFE']->set_no_cache();
2362 return $content;
2363 }
2364 }
2365
2366 /**
2367 * Rendering the cObject, PHP_SCRIPT, PHP_SCRIPT_INT and PHP_SCRIPT_EXT
2368 *
2369 * @param array Array of TypoScript properties
2370 * @param string If "INT", then rendering "PHP_SCRIPT_INT"; If "EXT", then rendering "PHP_SCRIPT_EXT"; Default is rendering "PHP_SCRIPT" (cached)
2371 * @return string Output
2372 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=370&cHash=aa107f2ad8
2373 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=371&cHash=53f71d025e
2374 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=372&cHash=91fe391e1c
2375 */
2376 function PHP_SCRIPT($conf,$ext='') {
2377 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
2378 $content='';
2379 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
2380 switch($ext) {
2381 case 'INT':
2382 case 'EXT':
2383 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
2384 $content.='<!--'.$substKey.'-->';
2385 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
2386 'file'=>$incFile,
2387 'conf'=>$conf,
2388 'type'=>'SCRIPT'
2389 );
2390 if ($ext=='INT') {
2391 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['cObj'] = serialize($this);
2392 } else {
2393 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['data'] = $this->data;
2394 }
2395 break;
2396 default:
2397 // Added 31-12-00: Make backup...
2398 $this->oldData = $this->data;
2399 // Include file..
2400 include('./'.$incFile);
2401 // Added 31-12-00: restore...
2402 if ($RESTORE_OLD_DATA) {
2403 $this->data = $this->oldData;
2404 }
2405 break;
2406 }
2407 }
2408 return $content;
2409 }
2410
2411 /**
2412 * Rendering the cObject, TEMPLATE
2413 *
2414 * @param array Array of TypoScript properties
2415 * @return string Output
2416 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=373&cHash=109a171b1e
2417 * @see substituteMarkerArrayCached()
2418 */
2419 function TEMPLATE($conf) {
2420 $subparts = Array();
2421 $marks = Array();
2422 $wraps = Array();
2423 $content='';
2424
2425 list($PRE,$POST) = explode('|',$conf['markerWrap'] ? $conf['markerWrap'] : '### | ###');
2426 $POST = trim($POST);
2427 $PRE = trim($PRE);
2428
2429 // Getting the content
2430 $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template');
2431 if ($conf['workOnSubpart']) {
2432 $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
2433 }
2434
2435 // Fixing all relative paths found:
2436 if ($conf['relPathPrefix']) {
2437 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
2438 $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
2439 }
2440
2441 if ($content) {
2442 if ($conf['nonCachedSubst']) { // NON-CACHED:
2443 // Getting marks
2444 if (is_array($conf['marks.'])) {
2445 reset($conf['marks.']);
2446 while(list($theKey,$theValue)=each($conf['marks.'])) {
2447 if (!strstr($theKey,'.')) {
2448 $content = str_replace(
2449 $PRE.$theKey.$POST,
2450 $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey),
2451 $content);
2452 }
2453 }
2454 }
2455
2456 // Getting subparts.
2457 if (is_array($conf['subparts.'])) {
2458 reset($conf['subparts.']);
2459 while(list($theKey,$theValue)=each($conf['subparts.'])) {
2460 if (!strstr($theKey,'.')) {
2461 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
2462 if ($subpart) {
2463 $this->setCurrentVal($subpart);
2464 $content = $this->substituteSubpart(
2465 $content,
2466 $PRE.$theKey.$POST,
2467 $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey),
2468 1
2469 );
2470 }
2471 }
2472 }
2473 }
2474 // Getting subpart wraps
2475 if (is_array($conf['wraps.'])) {
2476 reset($conf['wraps.']);
2477 while(list($theKey,$theValue)=each($conf['wraps.'])) {
2478 if (!strstr($theKey,'.')) {
2479 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
2480 if ($subpart) {
2481 $this->setCurrentVal($subpart);
2482 $content = $this->substituteSubpart(
2483 $content,
2484 $PRE.$theKey.$POST,
2485 explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)),
2486 1
2487 );
2488 }
2489 }
2490 }
2491 }
2492 } else { // CACHED
2493 // Getting subparts.
2494 if (is_array($conf['subparts.'])) {
2495 reset($conf['subparts.']);
2496 while(list($theKey,$theValue)=each($conf['subparts.'])) {
2497 if (!strstr($theKey,'.')) {
2498 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
2499 if ($subpart) {
2500 $GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart;
2501 $subparts[$theKey]['name'] = $theValue;
2502 $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
2503 }
2504 }
2505 }
2506 }
2507 // Getting marks
2508 if (is_array($conf['marks.'])) {
2509 reset($conf['marks.']);
2510 while(list($theKey,$theValue)=each($conf['marks.'])) {
2511 if (!strstr($theKey,'.')) {
2512 $marks[$theKey]['name'] = $theValue;
2513 $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
2514 }
2515 }
2516 }
2517 // Getting subpart wraps
2518 if (is_array($conf['wraps.'])) {
2519 reset($conf['wraps.']);
2520 while(list($theKey,$theValue)=each($conf['wraps.'])) {
2521 if (!strstr($theKey,'.')) {
2522 $wraps[$theKey]['name'] = $theValue;
2523 $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
2524 }
2525 }
2526 }
2527 // Getting subparts
2528 $subpartArray =array();
2529 reset($subparts);
2530 while(list($theKey,$theValue)=each($subparts)) {
2531 // Set current with the content of the subpart...
2532 $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey];
2533 // Get subpart cObject and substitute it!
2534 $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey);
2535 }
2536 $this->data[$this->currentValKey] = ''; // Reset current to empty
2537
2538 // Getting marks
2539 $markerArray =array();
2540 reset($marks);
2541 while(list($theKey,$theValue)=each($marks)) {
2542 $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
2543 }
2544 // Getting wraps
2545 $subpartWraps =array();
2546 reset($wraps);
2547 while(list($theKey,$theValue)=each($wraps)) {
2548 $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
2549 }
2550
2551 // Substitution
2552 if ($conf['substMarksSeparately']) {
2553 $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps);
2554 $content = $this->substituteMarkerArray($content, $markerArray);
2555 } else {
2556 $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps);
2557 }
2558 }
2559 }
2560 return $content;
2561 }
2562
2563 /**
2564 * Rendering the cObject, MULTIMEDIA
2565 *
2566 * @param array Array of TypoScript properties
2567 * @return string Output
2568 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=374&cHash=efd88ab4a9
2569 */
2570 function MULTIMEDIA($conf) {
2571 $content='';
2572 $filename=$this->stdWrap($conf['file'],$conf['file.']);
2573 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
2574 if ($incFile) {
2575 $fileinfo = t3lib_div::