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