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