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