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