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