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