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