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