0162b299b529fd4aafd5f6c0598a6149b2495792
2 /***************************************************************
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
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.
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.
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.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Contains classes for Content Rendering based on TypoScript Template configuration
31 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
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)
39 * @author Kasper Skaarhoj <kasper@typo3.com>
42 * [CLASS/FUNCTION INDEX of SCRIPT]
46 * 243: class tslib_cObj
47 * 340: function start($data,$table='')
48 * 355: function setParent($data,$currentRecord)
50 * SECTION: CONTENT_OBJ:
51 * 380: function getCurrentVal()
52 * 391: function setCurrentVal($value)
53 * 404: function cObjGet($setup,$addKey='')
54 * 428: function cObjGetSingle($name,$conf,$TSkey='__')
56 * SECTION: Functions rendering content objects (cObjects)
57 * 567: function HTML($conf)
58 * 578: function TEXT($conf)
59 * 589: function CLEARGIF($conf)
60 * 608: function COBJ_ARRAY($conf,$ext='')
61 * 644: function USER($conf,$ext='')
62 * 671: function FILE($conf)
63 * 687: function IMAGE($conf)
64 * 706: function IMG_RESOURCE($conf)
65 * 718: function IMGTEXT($conf)
66 * 1097: function CONTENT($conf)
67 * 1148: function RECORDS($conf)
68 * 1215: function HMENU($conf)
69 * 1247: function CTABLE ($conf)
70 * 1285: function OTABLE ($conf)
71 * 1300: function COLUMNS ($conf)
72 * 1379: function HRULER ($conf)
73 * 1403: function CASEFUNC ($conf)
74 * 1428: function LOAD_REGISTER($conf,$name)
75 * 1468: function FORM($conf,$formData='')
76 * 1843: function SEARCHRESULT($conf)
77 * 2002: function PHP_SCRIPT($conf,$ext='')
78 * 2045: function TEMPLATE($conf)
79 * 2189: function MULTIMEDIA($conf)
81 * SECTION: Various helper functions for content objects:
82 * 2278: function netprintApplication_offsiteLinkWrap($str,$imgConf,$conf)
83 * 2319: function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal)
84 * 2337: function cImage($file,$conf)
85 * 2364: function imageLinkWrap($string,$imageFile,$conf)
86 * 2428: function fileResource($fName)
87 * 2451: function lastChanged($tstamp)
88 * 2468: function linkWrap($content,$wrap)
90 * SECTION: HTML template processing functions
91 * 2513: function getSubpart($content, $marker)
92 * 2542: function substituteSubpart($content,$marker,$subpartContent,$recursive=1)
93 * 2584: function substituteMarker($content,$marker,$markContent)
94 * 2604: function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array())
95 * 2702: function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0)
96 * 2723: function substituteMarkerInObject(&$tree, $markContentArray)
97 * 2746: function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE)
99 * SECTION: "stdWrap" + sub functions
100 * 2809: function stdWrap($content,$conf)
101 * 2956: function numRows($conf)
102 * 2977: function listNum($content,$listNum,$char)
103 * 2997: function checkIf($conf)
104 * 3060: function filelist($data)
105 * 3139: function clean_directory($theDir)
106 * 3157: function HTMLparser_TSbridge($theValue, $conf)
107 * 3171: function dataWrap($content,$wrap)
108 * 3184: function insertData($str)
109 * 3214: function prefixComment($str,$conf,$content)
110 * 3238: function substring($content,$options)
111 * 3256: function crop($content,$options)
112 * 3282: function textStyle($theValue, $conf)
113 * 3349: function tableStyle($theValue, $conf)
114 * 3390: function addParams($content,$conf)
115 * 3433: function filelink($theValue, $conf)
116 * 3500: function locDataJU($jumpUrl,$conf)
117 * 3531: function calc($val)
118 * 3560: function calcIntExplode($delim, $string)
119 * 3580: function splitObj($value, $conf)
120 * 3636: function parseFunc($theValue, $conf, $ref='')
121 * 3742: function _parseFunc ($theValue, $conf)
122 * 3944: function encaps_lineSplit($theValue, $conf)
123 * 4027: function http_makelinks($data,$conf)
124 * 4094: function mailto_makelinks($data,$conf)
125 * 4139: function getImgResource($file,$fileArray)
127 * SECTION: Data retrieval etc.
128 * 4311: function getFieldVal($field)
129 * 4331: function getData($string,$fieldArray)
130 * 4446: function rootLineValue($key,$field,$slideBack=0,$altRootLine='')
131 * 4467: function getGlobal($var)
132 * 4492: function getKey($key,$arr)
134 * SECTION: Link functions (typolink)
135 * 4544: function typoLink($linktxt, $conf)
136 * 4787: function typoLink_URL($conf)
137 * 4805: function getTypoLink($label,$params,$urlParameters=array(),$target='')
138 * 4835: function getTypoLink_URL($params,$urlParameters=array(),$target='')
139 * 4847: function typolinkWrap($conf)
140 * 4860: function currentPageUrl($urlParameters=array(),$id=0)
142 * SECTION: Miscellaneous functions, stand alone
143 * 4904: function wrap($content,$wrap,$char='|')
144 * 4920: function noTrimWrap($content,$wrap)
145 * 4934: function wrapSpace($content, $wrap)
146 * 4960: function callUserFunction($funcName,$conf,$content)
147 * 5001: function processParams($params)
148 * 5019: function keywords($content)
149 * 5036: function caseshift($theValue, $case)
150 * 5059: function HTMLcaseshift($theValue, $case)
151 * 5088: function bytes($sizeInBytes,$labels)
152 * 5099: function calcAge($seconds,$labels)
153 * 5130: function sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName='', $replyTo='')
154 * 5157: function URLqMark($url,$params)
155 * 5173: function checkEmail($email)
156 * 5185: function clearTSProperties($TSArr,$propList)
157 * 5204: function mergeTSRef($confArr,$prop)
158 * 5227: function joinTSarrays($conf,$old_conf)
159 * 5250: function gifBuilderTextBox($gifbuilderConf, $conf, $text)
160 * 5306: function linebreaks($string,$chars,$maxLines=0)
161 * 5337: function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList)
163 * SECTION: Database functions, making of queries
164 * 5406: function DBgetDelete($table, $uid, $doExec=FALSE)
165 * 5438: function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE)
166 * 5480: function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE)
167 * 5517: function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0)
168 * 5557: function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0)
169 * 5597: function enableFields($table,$show_hidden=0)
170 * 5620: function getTreeList($id,$depth,$begin=0,$dontCheckEnableFields=0,$addSelectFields='',$moreWhereClauses='')
171 * 5653: function whereSelectFromList($field,$value)
172 * 5671: function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='')
173 * 5698: function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='')
174 * 5719: function searchWhere($sw,$searchFieldList,$searchTable='')
175 * 5752: function exec_getQuery($table, $conf)
176 * 5770: function getQuery($table, $conf, $returnQueryArray=FALSE)
177 * 5849: function getWhere($table,$conf, $returnQueryArray=FALSE)
178 * 5935: function checkPidArray($listArr)
179 * 5958: function checkPid($uid)
181 * SECTION: Frontend editing functions
182 * 6014: function editPanel($content, $conf, $currentRecord='', $dataArr=array())
183 * 6179: function editIcons($content,$params, $conf=array(), $currentRecord='', $dataArr=array(),$addUrlParamStr='')
184 * 6243: function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='')
185 * 6281: function editPanelLinkWrap_doWrap($string,$url,$currentRecord)
186 * 6308: function editPanelPreviewBorder($table,$row,$content,$thick)
187 * 6325: function isDisabled($table,$row)
190 * 6356: class tslib_frameset
191 * 6366: function make($setup)
192 * 6403: function frameParams($setup, $typeNum)
193 * 6446: function framesetParams($setup)
196 * 6479: class tslib_tableOffset
197 * 6491: function start($content,$offset)
200 * 6569: class tslib_controlTable
201 * 6604: function start($offset,$cMargins)
203 * TOTAL FUNCTIONS: 126
204 * (This index is automatically created/updated by the extension "extdeveval")
209 // Includes this class since it is used for parsing HTML
210 require_once (PATH_t3lib
."class.t3lib_parsehtml.php");
230 * This class contains all main TypoScript features.
231 * This includes the rendering of TypoScript content objects (cObjects).
232 * Is the backbone of TypoScript Template rendering.
234 * There are lots of functions you can use from your include-scripts.
235 * The class "tslib_cObj" is normally instantiated and referred to as "cObj".
236 * 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.
238 * @author Kasper Skaarhoj <kasper@typo3.com>
241 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
244 var $align = Array ('center', 'right', 'left');
245 var $caseConvStrings = array(
251 * Holds ImageMagick parameters and extensions used for compression
256 * 1= Dont change! (removes all parameters for the image_object!!)
260 var $image_compression = Array(
261 10 => Array('params'=>'', 'ext'=>'gif'),
262 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
263 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
264 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
265 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
266 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
268 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
269 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
270 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
271 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
272 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
273 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
274 39 => Array('params'=>'', 'ext'=>'png'),
276 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
277 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
278 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
279 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
280 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
281 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
282 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
283 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
284 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
288 * ImageMagick parameters for image effects
292 var $image_effects = Array(
296 10 => '-colorspace GRAY',
305 * Loaded with the current data-record.
307 * If the instance of this class is used to render records from the database those records are found in this array.
308 * The function stdWrap has TypoScript properties that fetch field-data from this array.
312 var $oldData = Array(); // Used for backup...
313 var $alternativeData =''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap
314 var $parameters = Array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags.
315 var $currentValKey = 'currentValue_kidjls9dksoje';
316 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.
317 var $currentRecordTotal=0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query.
318 var $currentRecordNumber=0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering.
319 var $parentRecordNumber=0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering.
320 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.
321 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.
324 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)
325 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.
326 var $checkPid_badDoktypeList = '255';
327 var $lastTypoLinkUrl=''; // This will be set by typoLink() to the url of the most recent link created.
328 var $lastTypoLinkTarget=''; // DO. link target.
329 var $substMarkerCache=array(); // Caching substituteMarkerArrayCached function
333 * Well, it has to be called manually since it is not a real constructor function.
334 * 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.
336 * @param array $data the record data that is rendered.
337 * @param string $table the table that the data record is from.
340 function start($data,$table='') {
342 $this->currentRecord
= $table ?
$table.':'.$this->data
['uid'] : '';
343 $this->parameters
= Array();
347 * Sets the internal variable parentRecord with information about current record.
348 * 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.
350 * @param array $data: The record array
351 * @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.
355 function setParent($data,$currentRecord) {
356 $this->parentRecord
=array('data'=>$data, 'currentRecord'=>$currentRecord);
366 /***********************************************
370 ***********************************************/
373 * Returns the "current" value.
374 * 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.
375 * It's like "load accumulator" in the good old C64 days... basically a "register" you can use as you like.
376 * 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.
378 * @return mixed The "current" value
380 function getCurrentVal() {
381 return $this->data
[$this->currentValKey
];
385 * Sets the "current" value.
387 * @param mixed The variable that you want to set as "current"
389 * @see getCurrentVal()
391 function setCurrentVal($value) {
392 $this->data
[$this->currentValKey
] = $value;
396 * Rendering of a "numerical array" of cObjects from TypoScript
397 * Will call ->cObjGetSingle() for each cObject found and accumulate the output.
399 * @param array $setup: Array with cObjects as values.
400 * @param string $addKey: A prefix for the debugging information
401 * @return string Rendered output from the cObjects in the array.
402 * @see cObjGetSingle()
404 function cObjGet($setup,$addKey='') {
405 if (is_array($setup)) {
406 $sKeyArray=t3lib_TStemplate
::sortedKeyList($setup);
408 foreach($sKeyArray as $theKey) {
409 $theValue=$setup[$theKey];
410 if (intval($theKey) && !strstr($theKey,'.')) {
411 $conf=$setup[$theKey.'.'];
412 $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey); // Get the contentObject
420 * Renders a content object
422 * @param string The content object name, eg. "TEXT" or "USER" or "IMAGE"
423 * @param array The array with TypoScript properties for the content object
424 * @param string A string label used for the internal debugging tracking.
425 * @return string cObject output
426 * @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331
428 function cObjGetSingle($name,$conf,$TSkey='__') {
430 // Checking that the function is not called eternally. This is done by interrupting at a depth of 100
431 $GLOBALS['TSFE']->cObjectDepthCounter
--;
432 if ($GLOBALS['TSFE']->cObjectDepthCounter
>0) {
434 if ($GLOBALS['TT']->LR
) $GLOBALS['TT']->push($TSkey, $name);
436 // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something')
437 if (substr($name,0,1)=='<') {
438 $key = trim(substr($name,1));
439 $cF = t3lib_div
::makeInstance('t3lib_TSparser');
440 // $name and $conf is loaded with the referenced values.
442 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl
->setup
);
443 if (is_array($old_conf) && count($old_conf)) {
444 $conf = $this->joinTSarrays($conf,$old_conf);
447 // Getting the cObject
448 $GLOBALS['TT']->incStackPointer();
449 $content.=$this->cObjGetSingle($name,$conf,$key);
450 $GLOBALS['TT']->decStackPointer();
455 $content.=$this->COBJ_ARRAY($conf);
458 $content.=$this->COBJ_ARRAY($conf,'INT');
461 $content.=$this->HTML($conf);
464 $content.=$this->TEXT($conf);
467 $content.=$this->CLEARGIF($conf);
470 $content.=$this->FILE($conf);
473 $content.=$this->IMAGE($conf);
476 $content.=$this->IMG_RESOURCE($conf);
479 $content.=$this->IMGTEXT($conf);
482 $content.=$this->CONTENT($conf);
485 $content.=$this->RECORDS($conf);
488 $content.=$this->HMENU($conf);
491 $content.=$this->CTABLE($conf);
494 $content.=$this->OTABLE($conf);
497 $content.=$this->COLUMNS($conf);
500 $content.=$this->HRULER($conf);
503 $content.=$this->CASEFUNC($conf);
505 case 'LOAD_REGISTER':
506 case 'RESTORE_REGISTER':
507 $this->LOAD_REGISTER($conf,$name);
510 $content.=$this->FORM($conf);
513 $content.=$this->SEARCHRESULT($conf);
516 $content.=$this->PHP_SCRIPT($conf);
518 case 'PHP_SCRIPT_EXT':
519 $content.=$this->PHP_SCRIPT($conf,'EXT');
521 case 'PHP_SCRIPT_INT':
522 $content.=$this->PHP_SCRIPT($conf,'INT');
525 $content.=$this->USER($conf);
528 $content.=$this->USER($conf,'INT');
531 $content.=$this->TEMPLATE($conf);
534 if ($GLOBALS['TSFE']->beUserLogin
) {$content.=$this->editPanel($content, $conf);}
537 $content.=$this->MULTIMEDIA($conf);
541 if ($GLOBALS['TT']->LR
) $GLOBALS['TT']->pull($content);
543 // Increasing on exit...
544 $GLOBALS['TSFE']->cObjectDepthCounter++
;
554 /********************************************
556 * Functions rendering content objects (cObjects)
558 ********************************************/
561 * Rendering the cObject, HTML
563 * @param array Array of TypoScript properties
564 * @return string Output
565 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=349&cHash=d3fd0c70b4
567 function HTML($conf) {
568 return $this->stdWrap($conf['value'],$conf['value.']);
572 * Rendering the cObject, TEXT
574 * @param array Array of TypoScript properties
575 * @return string Output
576 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=350&cHash=b49de28f83
578 function TEXT($conf) {
579 return $this->stdWrap($conf['value'],$conf);
583 * Rendering the cObject, CLEARGIF
585 * @param array Array of TypoScript properties
586 * @return string Output
587 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=355&cHash=70c0f19915
589 function CLEARGIF($conf) {
590 $w = $this->stdWrap($conf['width'],$conf['width.']);
591 $h = $this->stdWrap($conf['height'],$conf['height.']);
594 $wrap = $conf['wrap'] ?
$conf['wrap'] : '|<br />';
595 $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$w.'" height="'.$h.'" border="0" alt="" title="" />', $wrap);
597 return $this->stdWrap($theValue,$conf['stdWrap.']);
601 * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT
603 * @param array Array of TypoScript properties
604 * @param string If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached)
605 * @return string Output
606 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=351&cHash=a09db0329c
608 function COBJ_ARRAY($conf,$ext='') {
612 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
613 $content.='<!--'.$substKey.'-->';
614 $GLOBALS['TSFE']->config
[$ext.'incScript'][$substKey] = array(
617 'cObj'=>serialize($this),
622 if ($this->checkIf($conf['if.'])) {
623 $content=$this->cObjGet($conf);
625 $content=$this->wrap($content, $conf['wrap']);
627 if ($conf['stdWrap.']) {
628 $content=$this->stdWrap($content, $conf['stdWrap.']);
637 * Rendering the cObject, USER and USER_INT
639 * @param array Array of TypoScript properties
640 * @param string If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached)
641 * @return string Output
642 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=369&cHash=b623aca0a9
644 function USER($conf,$ext='') {
648 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
649 $content.='<!--'.$substKey.'-->';
650 $GLOBALS['TSFE']->config
[$ext.'incScript'][$substKey] = array(
653 'cObj'=>serialize($this),
658 $content.=$this->callUserFunction($conf['userFunc'],$conf,'');
665 * Rendering the cObject, FILE
667 * @param array Array of TypoScript properties
668 * @return string Output
669 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=352&cHash=379c60f8bc
671 function FILE($conf) {
672 $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']));
673 if ($conf['linkWrap']) {
674 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
676 return $this->wrap($theValue,$conf['wrap']);
680 * Rendering the cObject, IMAGE
682 * @param array Array of TypoScript properties
683 * @return string Output
684 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=353&cHash=440681ea56
687 function IMAGE($conf) {
689 if ($this->checkIf($conf['if.'])) {
690 $theValue = $this->cImage($conf['file'],$conf);
691 if ($conf['stdWrap.']) {
692 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
699 * Rendering the cObject, IMG_RESOURCE
701 * @param array Array of TypoScript properties
702 * @return string Output
703 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=354&cHash=46f9299706
704 * @see getImgResource()
706 function IMG_RESOURCE($conf) {
707 $imgArray = $this->getImgResource($conf['file'],$conf['file.']);
708 return $this->stdWrap($imgArray[3],$conf['stdWrap.']);
712 * Rendering the cObject, IMGTEXT
714 * @param array Array of TypoScript properties
715 * @return string Output
716 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1
718 function IMGTEXT($conf) {
720 if (is_array($conf['text.'])) {
721 $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content
723 $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images
725 $imgs = explode(',',$imgList);
726 $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
728 $imgCount= count($imgs)-$imgStart;
730 $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
732 $imgCount = t3lib_div
::intInRange($imgCount,0,$conf['imgMax']); // reduces the number of images.
735 $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
739 if (is_array($conf['caption.'])) {
740 $caption= $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);
742 $captionArray=array();
743 if ($conf['captionSplit']) {
744 $capSplit = $this->stdWrap($conf['captionSplit.']['token'],$conf['captionSplit.']['token.']);
745 if (!$capSplit) {$capSplit=chr(10);}
746 $caption2= $this->cObjGetSingle($conf['captionSplit.']['cObject'],$conf['captionSplit.']['cObject.'],'captionSplit.cObject');
747 $captionArray=explode($capSplit,$caption2);
748 while(list($ca_key,$ca_val)=each($captionArray)) {
749 $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
754 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
756 $tmppos = $position&7;
757 $contentPosition = $position&24;
758 $align = $this->align
[$tmppos];
759 $cap = ($caption)?
1:0;
760 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
761 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
765 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
766 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
767 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
768 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
770 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ?
1:0;
771 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
772 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
774 $borderColor=$borderColor?
$borderColor:'black';
775 $borderThickness=$borderThickness?
$borderThickness:1;
777 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
778 if (!$caption_align) {
779 $caption_align = $align;
782 $colCount = ($cols > 1) ?
$cols : 1;
783 if ($colCount > $imgCount) {$colCount = $imgCount;}
784 $rowCount = ($colCount > 1) ?
ceil($imgCount / $colCount) : $imgCount;
788 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
789 $colCount = ($rowCount>1) ?
ceil($imgCount / $rowCount) : $imgCount;
793 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
794 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
796 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
797 if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 70 % of the max...
798 $maxWInText = round($maxW/100*50);
801 if ($maxWInText && $contentPosition>=16) { // inText
805 if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column
806 /* debug($border*$borderThickness*2);
809 debug(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2));
811 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
813 // create the relation between rows
816 $rel_parts = explode(':',$colRelations);
818 for ($a=0;$a<$colCount;$a++
) {
819 $rel_parts[$a] = intval($rel_parts[$a]);
820 $rel_total+
= $rel_parts[$a];
823 for ($a=0;$a<$colCount;$a++
) {
824 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
826 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.
831 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
832 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
833 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
837 $splitArr['imgObjNum']=$conf['imgObjNum'];
838 $splitArr = $GLOBALS['TSFE']->tmpl
->splitConfArray($splitArr,$imgCount);
840 $altP = $this->getAltParam($conf);
843 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
844 if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's
845 $gifCreator = t3lib_div
::makeInstance('tslib_gifbuilder');
847 $relations = Array();
848 $relations_cols = Array();
849 $totalMaxW = $maxW*$colCount;
850 for($a=0;$a<$imgCount;$a++
) {
851 $imgKey = $a+
$imgStart;
852 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
853 $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height
854 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.
855 $relations_cols[floor($a/$colCount)] +
= $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration.
860 $imageRowsFinalWidths = Array(); // contains the width of every image row
861 $imageRowsMaxHeights = Array();
864 for($a=0;$a<$imgCount;$a++
) {
865 $GLOBALS['TSFE']->register
['IMAGE_NUM'] = $a;
867 $imgKey = $a+
$imgStart;
868 $totalImagePath = $imgPath.$imgs[$imgKey];
869 $this->data
[$this->currentValKey
] = $totalImagePath;
870 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
871 $imgConf = $conf[$imgObjNum.'.'];
876 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
877 if ($rowTotalMaxW > $totalMaxW) {
878 $scale = $rowTotalMaxW / $totalMaxW;
881 // transfer info to the imageObject. Please note, that
882 $imgConf['file.']['height'] = round($equalHeight/$scale);
884 unset($imgConf['file.']['width']);
885 unset($imgConf['file.']['maxW']);
886 unset($imgConf['file.']['maxH']);
887 unset($imgConf['file.']['minW']);
888 unset($imgConf['file.']['minH']);
889 unset($imgConf['file.']['width.']);
890 unset($imgConf['file.']['maxW.']);
891 unset($imgConf['file.']['maxH.']);
892 unset($imgConf['file.']['minW.']);
893 unset($imgConf['file.']['minH.']);
894 $maxW = 0; // setting this to zero, so that it doesn't disturb
898 if (count($colMaxW)) {
899 $imgConf['file.']['maxW'] = $colMaxW[($a%
$colCount)];
901 $imgConf['file.']['maxW'] = $maxW;
905 if ($imgConf ||
$imgConf['file']) {
906 $imgConf['params'].=$altP;
907 if ($this->image_effects
[$image_effects]) {
908 $imgConf['file.']['params'].= ' '.$this->image_effects
[$image_effects];
911 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
912 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
915 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
916 if ($image_compression==1) {
917 $tempImport = $imgConf['file.']['import'];
918 $tempImport_dot = $imgConf['file.']['import.'];
919 unset($imgConf['file.']);
920 $imgConf['file.']['import'] = $tempImport;
921 $imgConf['file.']['import.'] = $tempImport_dot;
922 } elseif (isset($this->image_compression
[$image_compression])) {
923 $imgConf['file.']['params'].= ' '.$this->image_compression
[$image_compression]['params'];
924 $imgConf['file.']['ext'] = $this->image_compression
[$image_compression]['ext'];
925 unset($imgConf['file.']['ext.']);
928 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
930 $imgsTag[$imgKey] = $this->IMAGE(Array('params'=>$altP, 'file'=>$totalImagePath)); // currentValKey !!!
932 // Store the original filepath
933 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo
;
935 $imageRowsFinalWidths[floor($a/$colCount)] +
= $GLOBALS['TSFE']->lastImageInfo
[0];
936 if ($GLOBALS['TSFE']->lastImageInfo
[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
937 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo
[1];
940 // calculating the tableWidth:
941 // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth.
942 $tableWidth = max($imageRowsFinalWidths)+
$colspacing*($colCount-1) +
$colCount*$border*$borderThickness*2;
944 // make table for pictures
947 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
948 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
949 if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time.
956 $colCount_temp=$colCount;
958 $rowCount_temp = $rowCount;
964 // col- and rowspans calculated
965 $colspan = (($colspacing) ?
$colCount*2-1 : $colCount);
966 $rowspan = (($rowspacing) ?
$rowCount*2-1 : $rowCount) +
$cap;
970 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ?
$this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
975 if ($conf['noStretchAndMarginCells']!=1) {
977 if ($txtMarg && $align=='right') { // If right aligned, the textborder is added on the right side
978 $tablecode.='<td rowspan="'.($rowspan+
1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?
'<br />'.$editIconsHTML:'').'</td>';
982 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
983 if ($txtMarg && $align=='left') { // If left aligned, the textborder is added on the left side
984 $tablecode.='<td rowspan="'.($rowspan+
1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?
'<br />'.$editIconsHTML:'').'</td>';
988 if ($flag) $tableWidth+
=$txtMarg+
1;
994 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!
995 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.
996 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="1" height="'.$rowspacing.'" border="0" alt="" title="" /></td></tr>';
998 $tablecode.='<tr>'; // starting row
999 for ($b=0; $b<$colCount_temp; $b++
) { // Looping through the columns
1000 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.
1002 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$colspacing.'" height="1" border="0" alt="" title="" /></td>';
1004 $colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.($border?
$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+
($border?
$borderThickness*2:0)).'" border="0" align="'.($border?
'left':'top').'" alt="" title="" />';
1005 $colSpacer='<td valign="top">'.$colSpacer.'</td>'; // added 160301, needed for the new "noCols"-table...
1006 $tablecode.=$colSpacer;
1009 if (!$noCols ||
($noCols && !$b)) {
1010 $tablecode.='<td valign="top">'; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image.
1011 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.
1013 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.
1014 $imgIndex = $index+
$a*$colCount_temp;
1015 if ($imgsTag[$imgIndex]) {
1016 if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
1017 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
1020 $imageHTML = $imgsTag[$imgIndex].'<br />';
1021 $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.
1022 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...)
1023 $imageHTML.=$editIconsHTML; $editIconsHTML='';
1024 if ($conf['netprintApplicationLink']) {$imageHTML = $this->netprintApplication_offsiteLinkWrap($imageHTML,$origImages[$imgIndex],$conf['netprintApplicationLink.']);}
1025 $imageHTML.=$captionArray[$imgIndex]; // Adds caption.
1026 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';} // If noCols, put in table cell.
1027 $tablecode.=$imageHTML;
1031 if (!$noCols ||
($noCols && $b+
1==$colCount_temp)) {
1032 if ($noCols) {$tablecode.='</tr></table>';} // In case of "noCols" we must finish the table that surrounds the images in the row.
1033 $tablecode.='</td>'; // Ending the cell. In case of "noCols" the cell holds all pictures!
1036 $tablecode.='</tr>'; // ending row
1039 // Table-tag is inserted
1040 $i=$contentPosition;
1041 $table_align = (($i==16) ?
'align="'.$align.'"' : '');
1042 $tablecode = '<table'.($tableWidth?
' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
1043 if ($editIconsHTML) { // IF this value is not long since reset.
1044 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
1048 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
1050 $tablecode.='</table>';
1051 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
1054 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
1055 switch ($contentPosition) {
1057 $output= '<div align="'.$align.'">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
1060 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div align="'.$align.'">'.$tablecode.'</div>';
1062 case '16': // in text
1063 $output= $tablecode.$content;
1065 case '24': // in text, no wrap
1067 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
1068 if ($align=='right') {
1069 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
1071 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
1073 $theResult.= '</tr></table>';
1074 $output= $theResult;
1081 if ($conf['stdWrap.']) {
1082 $output = $this->stdWrap($output, $conf['stdWrap.']);
1089 * Rendering the cObject, CONTENT
1091 * @param array Array of TypoScript properties
1092 * @return string Output
1093 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=356&cHash=9f3b5c6ba2
1095 function CONTENT($conf) {
1098 $originalRec=$GLOBALS['TSFE']->currentRecord
;
1099 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!!
1100 $GLOBALS['TSFE']->recordRegister
[md5($originalRec)]++
;
1103 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_') {
1105 $renderObjName = $conf['renderObj'] ?
$conf['renderObj'] : '<'.$conf['table'];
1106 $renderObjKey = $conf['renderObj'] ?
'renderObj' : '';
1107 $renderObjConf = $conf['renderObj.'];
1109 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
1110 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
1111 $GLOBALS['TT']->setTSlogMessage($error,3);
1113 $this->currentRecordTotal
= $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1114 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
1115 $cObj =t3lib_div
::makeInstance('tslib_cObj');
1116 $cObj->setParent($this->data
,$this->currentRecord
);
1117 $this->currentRecordNumber
=0;
1118 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1119 if (!$GLOBALS['TSFE']->recordRegister
[md5($val['table'].':'.$val['id'])]) {
1120 $this->currentRecordNumber++
;
1121 $cObj->parentRecordNumber
=$this->currentRecordNumber
;
1122 $GLOBALS['TSFE']->currentRecord
=$conf['table'].':'.$row['uid'];
1123 $this->lastChanged($row['tstamp']);
1124 $cObj->start($row,$conf['table']);
1125 if ($GLOBALS['TSFE']->config
['config']['insertDmailerBoundaries']) {$theValue.='<!--DMAILER_SECTION_BOUNDARY_'.intval($row['module_sys_dmail_category']).'-->';}
1126 $theValue.=$cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
1127 } else {debug($val['table'].':'.$val['id']);}
1129 if ($GLOBALS['TSFE']->config
['config']['insertDmailerBoundaries']) {$theValue.='<!--DMAILER_SECTION_BOUNDARY_END-->';}
1133 $theValue = $this->wrap($theValue,$conf['wrap']);
1134 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
1135 $GLOBALS['TSFE']->currentRecord
=$originalRec;
1140 * Rendering the cObject, RECORDS
1142 * @param array Array of TypoScript properties
1143 * @return string Output
1144 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=357&cHash=303e959472
1146 function RECORDS($conf) {
1149 $originalRec=$GLOBALS['TSFE']->currentRecord
;
1150 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!!
1151 $GLOBALS['TSFE']->recordRegister
[md5($originalRec)]++
;
1154 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
1155 if ($conf['tables'] && $conf['source']) {
1156 $allowedTables = $conf['tables'];
1157 if (is_array($conf['conf.'])) {
1158 reset($conf['conf.']);
1159 while(list($k)=each($conf['conf.'])) {
1160 if (substr($k,-1)!='.') $allowedTables.=','.$k;
1164 $loadDB = t3lib_div
::makeInstance('FE_loadDBGroup');
1165 $loadDB->start($conf['source'], $allowedTables);
1166 reset($loadDB->tableArray
);
1167 while(list($table,)=each($loadDB->tableArray
)) {
1168 if (is_array($GLOBALS['TCA'][$table])) {
1169 $loadDB->additionalWhere
[$table]=$this->enableFields($table);
1172 $loadDB->getFromDB();
1174 reset($loadDB->itemArray
);
1175 $data = $loadDB->results
;
1177 $cObj =t3lib_div
::makeInstance('tslib_cObj');
1178 $cObj->setParent($this->data
,$this->currentRecord
);
1179 $this->currentRecordNumber
=0;
1180 $this->currentRecordTotal
= count($loadDB->itemArray
);
1181 reset($loadDB->itemArray
);
1182 while(list(,$val)=each($loadDB->itemArray
)) {
1183 $row = $data[$val['table']][$val['id']];
1184 if (!$conf['dontCheckPid']) {
1185 $row = $this->checkPid($row['pid']) ?
$row : '';
1187 if ($row && !$GLOBALS['TSFE']->recordRegister
[md5($val['table'].':'.$val['id'])]) {
1188 $renderObjName = $conf['conf.'][$val['table']] ?
$conf['conf.'][$val['table']] : '<'.$val['table'];
1189 $renderObjKey = $conf['conf.'][$val['table']] ?
'conf.'.$val['table'] : '';
1190 $renderObjConf = $conf['conf.'][$val['table'].'.'];
1191 $this->currentRecordNumber++
;
1192 $cObj->parentRecordNumber
=$this->currentRecordNumber
;
1193 $GLOBALS['TSFE']->currentRecord
=$val['table'].':'.$val['id'];
1194 $this->lastChanged($row['tstamp']);
1195 $cObj->start($row,$val['table']);
1196 if ($GLOBALS['TSFE']->config
['config']['insertDmailerBoundaries']) {$theValue.='<!--DMAILER_SECTION_BOUNDARY_'.intval($row['module_sys_dmail_category']).'-->';}
1197 $theValue.=$cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
1198 if ($GLOBALS['TSFE']->config
['config']['insertDmailerBoundaries']) {$theValue.='<!--DMAILER_SECTION_BOUNDARY_END-->';}
1202 $GLOBALS['TSFE']->currentRecord
=$originalRec;
1203 return $this->wrap($theValue,$conf['wrap']);
1207 * Rendering the cObject, HMENU
1209 * @param array Array of TypoScript properties
1210 * @return string Output
1211 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=358&cHash=5400c1c06a
1213 function HMENU($conf) {
1215 if ($this->checkIf($conf['if.'])) {
1216 $cls=strtolower($conf[1]);
1217 if (t3lib_div
::inList($GLOBALS['TSFE']->tmpl
->menuclasses
,$cls)) {
1218 if ($conf['special.']['value.']) {
1219 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'],$conf['special.']['value.']);
1221 $GLOBALS['TSFE']->register
['count_HMENU']++
;
1222 $GLOBALS['TSFE']->register
['count_HMENU_MENUOBJ']=0;
1223 $GLOBALS['TSFE']->applicationData
['GMENU_LAYERS']['WMid']=array();
1224 $GLOBALS['TSFE']->applicationData
['GMENU_LAYERS']['WMparentId']=array();
1226 $menu = t3lib_div
::makeInstance('tslib_'.$cls);
1227 $menu->parent_cObj
= $this;
1228 $menu->start($GLOBALS['TSFE']->tmpl
,$GLOBALS['TSFE']->sys_page
,'',$conf,1);
1230 $content.=$menu->writeMenu();
1232 if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']);
1233 if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']);
1239 * Rendering the cObject, CTABLE
1241 * @param array Array of TypoScript properties
1242 * @return string Output
1243 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=359&cHash=2e0065b4e7
1245 function CTABLE ($conf) {
1246 $controlTable = t3lib_div
::makeInstance('tslib_controlTable');
1247 if ($conf['tableParams']) {
1248 $controlTable->tableParams
= $conf['tableParams'];
1250 // loads the pagecontent
1251 $controlTable->contentW
= $conf['cWidth'];
1252 // loads the menues if any
1253 if (is_array($conf['c.'])) {
1254 $controlTable->content
= $this->cObjGet($conf['c.'],'c.');
1255 $controlTable->contentTDparams
= isset($conf['c.']['TDParams']) ?
$conf['c.']['TDParams'] : 'valign="top"';
1257 if (is_array($conf['lm.'])) {
1258 $controlTable->lm
= $this->cObjGet($conf['lm.'],'lm.');
1259 $controlTable->lmTDparams
= isset($conf['lm.']['TDParams']) ?
$conf['lm.']['TDParams'] : 'valign="top"';
1261 if (is_array($conf['tm.'])) {
1262 $controlTable->tm
= $this->cObjGet($conf['tm.'],'tm.');
1263 $controlTable->tmTDparams
= isset($conf['tm.']['TDParams']) ?
$conf['tm.']['TDParams'] : 'valign="top"';
1265 if (is_array($conf['rm.'])) {
1266 $controlTable->rm
= $this->cObjGet($conf['rm.'],'rm.');
1267 $controlTable->rmTDparams
= isset($conf['rm.']['TDParams']) ?
$conf['rm.']['TDParams'] : 'valign="top"';
1269 if (is_array($conf['bm.'])) {
1270 $controlTable->bm
= $this->cObjGet($conf['bm.'],'bm.');
1271 $controlTable->bmTDparams
= isset($conf['bm.']['TDParams']) ?
$conf['bm.']['TDParams'] : 'valign="top"';
1273 return $controlTable->start($conf['offset'],$conf['cMargins']);
1277 * Rendering the cObject, OTABLE
1279 * @param array Array of TypoScript properties
1280 * @return string Output
1281 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=360&cHash=02c9552d38
1283 function OTABLE ($conf) {
1284 $controlTable = t3lib_div
::makeInstance('tslib_tableOffset');
1285 if ($conf['tableParams']) {
1286 $controlTable->tableParams
= $conf['tableParams'];
1288 return $controlTable->start($this->cObjGet($conf),$conf['offset']);
1292 * Rendering the cObject, COLUMNS
1294 * @param array Array of TypoScript properties
1295 * @return string Output
1296 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=361&cHash=7e4e228cad
1298 function COLUMNS ($conf) {
1300 if (is_array($conf) && $this->checkIf($conf['if.'])) {
1302 $tableParams = $conf['tableParams'] ?
' '.$conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"';
1303 $TDparams = $conf['TDparams'] ?
' '.$conf['TDparams']:' valign="top"';
1304 $rows = t3lib_div
::intInRange($conf['rows'],2,20);
1305 $totalWidth = intval($conf['totalWidth']);
1310 'gapWidth' => $this->stdWrap($conf['gapWidth'],$conf['gapWidth.']),
1311 'gapBgCol' => $this->stdWrap($conf['gapBgCol'],$conf['gapBgCol.']),
1312 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'],$conf['gapLineThickness.']),
1313 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.'])
1315 $gapData = $GLOBALS['TSFE']->tmpl
->splitConfArray($gapData,$rows-1);
1317 while(list(,$val)=each($gapData)) {
1318 $totalGapWidth+
=intval($val['gapWidth']);
1322 $columnWidth = ceil(($totalWidth-$totalGapWidth)/$rows);
1323 $TDparams.=' width="'.$columnWidth.'"';
1324 $tableParams.=' width="'.$totalWidth.'"';
1326 $TDparams.=' width="'.floor(100/$rows).'%"';
1327 $tableParams.=' width="100%"';
1330 for ($a=1;$a<=$rows;$a++
) {
1332 $content.='<td'.$TDparams.'>';
1333 $content.=$this->cObjGetSingle($conf[$a],$conf[$a.'.'], $a);
1336 $gapConf = $gapData[($a-1)];
1337 $gapWidth = intval($gapConf['gapWidth']);
1339 $tdPar = $gapConf['gapBgCol'] ?
' bgcolor="'.$gapConf['gapBgCol'].'"' : '';
1340 $gapLine = intval($gapConf['gapLineThickness']);
1342 $gapSurround = t3lib_div
::intInRange(($gapWidth-$gapLine)/2, 1, 1000);
1344 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
1347 $GtdPar = $gapConf['gapLineCol'] ?
' bgcolor="'.$gapConf['gapLineCol'].'"' : ' bgcolor="black"';
1348 $content.='<td'.$GtdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$gapLine.'" height="1" alt="" title="" /></td>';
1351 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
1354 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$gapWidth.'" height="1" alt="" title="" /></td>';
1360 $content='<tr>'.$content.'</tr>';
1361 $content='<table'.$tableParams.'>'.$content.'</table>';
1362 $content.=$this->cObjGetSingle($conf['after'],$conf['after.'], 'after');
1363 if ($conf['stdWrap.']) {
1364 $content = $this->stdWrap($content,$conf['stdWrap.']);
1371 * Rendering the cObject, HRULER
1373 * @param array Array of TypoScript properties
1374 * @return string Output
1375 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=362&cHash=2a462aa084
1377 function HRULER ($conf) {
1378 $lineThickness = t3lib_div
::intInRange($this->stdWrap($conf['lineThickness'],$conf['lineThickness.']),1,50);
1379 $lineColor = $conf['lineColor'] ?
$conf['lineColor'] : 'black';
1380 $spaceBefore = intval($conf['spaceLeft']);
1381 $spaceAfter = intval($conf['spaceRight']);
1384 $content.='<table border="0" cellspacing="0" cellpadding="0" width="99%"><tr>';
1385 if ($spaceBefore) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$spaceBefore.'" height="1" alt="" title="" /></td>'; }
1386 $content.='<td bgcolor="'.$lineColor.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="1" height="'.$lineThickness.'" alt="" title="" /></td>';
1387 if ($spaceAfter) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix
.'clear.gif" width="'.$spaceAfter.'" height="1" alt="" title="" /></td>'; }
1388 $content.='</tr></table>';
1390 $content = $this->stdWrap($content, $conf['stdWrap.']);
1395 * Rendering the cObject, CASE
1397 * @param array Array of TypoScript properties
1398 * @return string Output
1399 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=364&cHash=cffedd09e3
1401 function CASEFUNC ($conf){
1403 if ($this->checkIf($conf['if.'])) {
1404 if ($conf['setCurrent'] ||
$conf['setCurrent.']){$this->data
[$this->currentValKey
] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
1405 $key = $this->stdWrap($conf['key'],$conf['key.']);
1406 $key = $conf[$key] ?
$key : 'default';
1407 $name = $conf[$key];
1408 $theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key);
1409 if ($conf['stdWrap.']) {
1410 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
1417 * Rendering the cObject, LOAD_REGISTER and RESTORE_REGISTER
1418 * NOTICE: This cObject does NOT return any content since it just sets internal data based on the TypoScript properties.
1420 * @param array Array of TypoScript properties
1421 * @param string If "RESTORE_REGISTER" then the cObject rendered is "RESTORE_REGISTER", otherwise "LOAD_REGISTER"
1422 * @return string Empty string (the cObject only sets internal data!)
1423 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=365&cHash=4935524e2e
1424 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=366&cHash=4f9485e8cc
1426 function LOAD_REGISTER($conf,$name) {
1427 if ($name=='RESTORE_REGISTER') {
1428 $GLOBALS['TSFE']->register
= array_pop($GLOBALS['TSFE']->registerStack
);
1430 array_push($GLOBALS['TSFE']->registerStack
,$GLOBALS['TSFE']->register
);
1431 if (is_array($conf)) {
1433 while(list($theKey,$theValue)=each($conf)) {
1434 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
1435 if (strstr($theKey,'.')) {
1436 $theKey = substr($theKey,0,-1);
1438 $GLOBALS['TSFE']->register
[$theKey] = $this->stdWrap($conf[$theKey],$conf[$theKey.'.']);
1447 * Rendering the cObject, FORM
1449 * Note on $formData:
1450 * In the optional $formData array each entry represents a line in the ordinary setup.
1451 * In those entries each entry (0,1,2...) represents a space normally divided by the '|' line.
1453 * $formData [] = array('Name:', 'name=input, 25 ', 'Default value....');
1454 * $formData [] = array('Email:', 'email=input, 25 ', 'Default value for email....');
1456 * - corresponds to the $conf['data'] value being :
1457 * Name:|name=input, 25 |Default value....||Email:|email=input, 25 |Default value for email....
1459 * If $formData is an array the value of $conf['data'] is ignored.
1461 * @param array Array of TypoScript properties
1462 * @param array Alternative formdata overriding whatever comes from TypoScript
1463 * @return string Output
1464 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=367&cHash=bbc518d930
1466 function FORM($conf,$formData='') {
1468 if (is_array($formData)) {
1469 $dataArr = $formData;
1471 $data=$this->stdWrap($conf['data'],$conf['data.']);
1474 // Getting the original config
1476 $data = ereg_replace(chr(10),'||',$data);
1477 $dataArr = explode('||',$data);
1479 // Adding the new dataArray config form:
1480 if (is_array($conf['dataArray.'])) { // dataArray is supplied
1481 reset($conf['dataArray.']);
1482 while(list($dAKey,$dAA)=each($conf['dataArray.'])) {
1483 if (is_array($dAA) && !strcmp(intval($dAKey).'.',$dAKey)) {
1485 list($temp[0])= explode('|',$dAA['label.'] ?
$this->stdWrap($dAA['label'],$dAA['label.']) : $dAA['label']);
1486 list($temp[1])= explode('|',$dAA['type']);
1487 if ($dAA['required']) {$temp[1]='*'.$temp[1];}
1488 list($temp[2])= explode('|',$dAA['value.'] ?
$this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']);
1489 // If value Array is set, then implode those values.
1490 if (is_array($dAA['valueArray.'])) {
1491 reset($dAA['valueArray.']);
1492 $temp_accum = array();
1493 while(list($dAKey_vA,$dAA_vA)=each($dAA['valueArray.'])) {
1494 if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) {
1496 list($temp_vA[0])= explode('=',$dAA_vA['label.'] ?
$this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']);
1497 if ($dAA_vA['selected']) {$temp_vA[0]='*'.$temp_vA[0];}
1498 list($temp_vA[1])= explode(',',$dAA_vA['value']);
1500 $temp_accum[] = implode('=',$temp_vA);
1502 $temp[2] = implode(',',$temp_accum);
1504 // adding the form entry to the dataArray
1505 $dataArr[] = implode('|',$temp);
1510 $attachmentCounter='';
1513 $propertyOverride = Array();
1514 $fieldname_hashArray = Array();
1517 while(list(,$val)=each($dataArr)) {
1520 if (is_array($formData)) {
1525 $parts = explode('|',$val);
1527 if ($val && strcspn($val,'#/')) {
1529 $confData['label'] = trim($parts[0]);
1531 $fParts = explode(',',$parts[1]);
1532 $fParts[0]=trim($fParts[0]);
1533 if (substr($fParts[0],0,1)=='*') {
1534 $confData['required']=1;
1535 $fParts[0] = substr($fParts[0],1);
1537 $typeParts = explode('=',$fParts[0]);
1538 $confData['type'] = trim(strtolower(end($typeParts)));
1539 if (count($typeParts)==1) {
1540 $confData['fieldname'] = substr(ereg_replace('[^a-zA-Z0-9_]','',str_replace(' ','_',trim($parts[0]))),0,30);
1541 if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email') {$confData['fieldname']='email';}
1542 // Duplicate fieldnames resolved
1543 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
1544 $confData['fieldname'].='_'.$cc;
1546 $fieldname_hashArray[md5($confData['fieldname'])]=$confData['fieldname'];
1547 // Attachment names...
1548 if ($confData['type']=='file') {
1549 $confData['fieldname']='attachment'.$attachmentCounter;
1550 $attachmentCounter=intval($attachmentCounter)+
1;
1553 $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0]));
1558 if ($conf['wrapFieldName']) {
1559 $confData['fieldname'] = $this->wrap($confData['fieldname'],$conf['wrapFieldName']);
1562 // Additional parameters
1563 if (trim($confData['type'])) {
1564 $addParams=trim($conf['params']);
1565 if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
1566 $addParams=trim($conf['params.'][$confData['type']]);
1568 if (strcmp('',$addParams)) $addParams=' '.$addParams;
1569 } else $addParams='';
1571 switch($confData['type']) {
1573 $cols=trim($fParts[1]) ?
intval($fParts[1]) : 20;
1574 $compWidth = doubleval($conf['compensateFieldWidth'] ?
$conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth
);
1575 $compWidth = $compWidth ?
$compWidth : 1;
1576 $cols = t3lib_div
::intInRange($cols*$compWidth, 1, 120);
1578 $rows=trim($fParts[2]) ? t3lib_div
::intInRange($fParts[2],1,30) : 5;
1579 $wrap=trim($fParts[3]) ?
' wrap="'.trim($fParts[3]).'"' : ' wrap="virtual"';
1580 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
1581 $fieldCode=sprintf('<textarea name="%s" cols="%s" rows="%s"%s'.$addParams.'>%s</textarea>',
1582 $confData['fieldname'], $cols, $rows, $wrap, t3lib_div
::formatForTextarea($default));
1586 $size=trim($fParts[1]) ?
intval($fParts[1]) : 20;
1587 $compWidth = doubleval($conf['compensateFieldWidth'] ?
$conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth
);
1588 $compWidth = $compWidth ?
$compWidth : 1;
1589 $size = t3lib_div
::intInRange($size*$compWidth, 1, 120);
1590 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
1591 if ($confData['type']=='password') {
1595 $max=trim($fParts[2]) ?
' maxlength="'.t3lib_div
::intInRange($fParts[2],1,1000).'"' : "";
1596 $theType = $confData['type']=='input' ?
'text' : 'password';
1598 $fieldCode=sprintf('<input type="'.$theType.'" name="%s" size="%s"%s value="%s"'.$addParams.' />',
1599 $confData['fieldname'], $size, $max, htmlspecialchars($default));
1602 $size=trim($fParts[1]) ? t3lib_div
::intInRange($fParts[1],1,60) : 20;
1603 $fieldCode=sprintf('<input type="file" name="%s" size="%s"'.$addParams.' />',
1604 $confData['fieldname'], $size);
1607 // alternative default value:
1608 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
1609 $checked = $default ?
' checked="checked"' : '';
1610 $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"%s'.$addParams.' />',
1611 1, $confData['fieldname'], $checked);
1615 $valueParts = explode(',',$parts[2]);
1617 if (strtolower(trim($fParts[1]))=='auto') {$fParts[1]=count($valueParts);} // Auto size set here. Max 20
1618 $size=trim($fParts[1]) ? t3lib_div
::intInRange($fParts[1],1,20) : 1;
1620 $multiple = strtolower(trim($fParts[2]))=='m' ?
' multiple="multiple"' : '';
1622 $items=array(); // Where the items will be
1623 $defaults=array(); //RTF
1624 for($a=0;$a<count($valueParts);$a++
) {
1625 $valueParts[$a]=trim($valueParts[$a]);
1626 if (substr($valueParts[$a],0,1)=='*') { // Finding default value
1628 $valueParts[$a] = substr($valueParts[$a],1);
1631 $subParts=explode('=',$valueParts[$a]);
1632 $subParts[1] = (isset($subParts[1])?
trim($subParts[1]):trim($subParts[0])); // Sets the value
1633 $items[] = $subParts; // Adds the value/label pair to the items-array
1634 if ($sel) {$defaults[]=$subParts[1];} // Sets the default value if value/label pair is marked as default.
1636 // alternative default value:
1637 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
1638 if (!is_array($default)) {
1640 $defaults[] = $default;
1641 } else $defaults=$default;
1642 // Create the select-box:
1643 for($a=0;$a<count($items);$a++
) {
1644 $option.='<option value="'.$items[$a][1].'"'.(in_array($items[$a][1],$defaults)?
' selected="selected"':'').'>'.trim($items[$a][0]).'</option>'; //RTF
1647 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.
1648 $fieldCode=sprintf('<select name="%s" size="%s"%s'.$addParams.'>%s</select>',
1649 $confData['fieldname'], $size, $multiple, $option); //RTF
1653 $valueParts = explode(',',$parts[2]);
1654 $items=array(); // Where the items will be
1656 for($a=0;$a<count($valueParts);$a++
) {
1657 $valueParts[$a]=trim($valueParts[$a]);
1658 if (substr($valueParts[$a],0,1)=='*') {
1660 $valueParts[$a] = substr($valueParts[$a],1);
1663 $subParts=explode('=',$valueParts[$a]);
1664 $subParts[1] = (isset($subParts[1])?
trim($subParts[1]):trim($subParts[0])); // Sets the value
1665 $items[] = $subParts; // Adds the value/label pair to the items-array
1666 if ($sel) {$default=$subParts[1];} // Sets the default value if value/label pair is marked as default.
1668 // alternative default value:
1669 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
1670 // Create the select-box:
1671 for($a=0;$a<count($items);$a++
) {
1672 $option.= '<input type="radio" name="'.$confData['fieldname'].'" value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?
' checked="checked"':'').''.$addParams.' />';
1673 $option.= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
1679 $value=trim($parts[2]);
1680 $hiddenfields.=sprintf('<input type="hidden" name="%s" value="%s" />',
1681 $confData['fieldname'], $value);
1684 if (t3lib_div
::inList('type,locationData,goodMess,badMess',$confData['fieldname'])) {
1685 $value=trim($parts[2]);
1686 $propertyOverride[$confData['fieldname']] = $value;
1687 $conf[$confData['fieldname']] = $value;
1691 $value=trim($parts[2]);
1692 if ($conf['image.']) {
1693 $this->data
[$this->currentValKey
]=$value;
1694 $image=$this->IMAGE($conf['image.']);
1697 $fieldCode = str_replace('<img','<input type="image"'.$addParams.' name="'.$confData['fieldname'].'"' ,$image);
1699 $fieldCode=sprintf('<input type="submit" name="%s" value="%s"'.$addParams.' />',
1700 $confData['fieldname'], t3lib_div
::deHSCentities(htmlspecialchars($value)));
1704 $confData['type']='comment';
1705 $fieldCode=trim($parts[2]).' ';
1709 $fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
1710 $labelCode = $this->stdWrap($confData['label'], $conf['labelWrap.']);
1711 $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']); // RTF
1712 $result = $conf['layout'];
1713 if ($conf['REQ'] && $confData['required']) {
1714 if (is_array($conf['REQ.']['fieldWrap.']))
1715 $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
1716 if (is_array($conf['REQ.']['labelWrap.']))
1717 $labelCode = $this->stdWrap($confData['label'], $conf['REQ.']['labelWrap.']);
1718 if ($conf['REQ.']['layout']) {
1719 $result = $conf['REQ.']['layout'];
1722 if ($confData['type']=='comment' && $conf['COMMENT.']['layout']) {
1723 $result = $conf['COMMENT.']['layout'];
1725 if ($confData['type']=='check' && $conf['CHECK.']['layout']) {
1726 $result = $conf['CHECK.']['layout'];
1728 if ($confData['type']=='radio' && $conf['RADIO.']['layout']) {
1729 $result = $conf['RADIO.']['layout'];
1731 $result = str_replace('###FIELD###',$fieldCode,$result);
1732 $result = str_replace('###LABEL###',$labelCode,$result);
1733 $result = str_replace('###COMMENT###',$commentCode,$result); //RTF
1736 if ($confData['required'] && $confData['type']!='check') {
1737 $fieldlist[]=rawurlencode($confData['fieldname']);
1738 $fieldlist[]=rawurlencode($confData['label']);
1743 if ($conf['stdWrap.']) $content=$this->stdWrap($content, $conf['stdWrap.']);
1746 // redirect (external: where to go afterwards. internal: where to submit to)
1747 $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)
1748 $page=$GLOBALS['TSFE']->page
;
1749 if (!$theRedirect) { // Internal: Just submit to current page
1750 $LD=$GLOBALS['TSFE']->tmpl
->linkData($page, $conf['target'], $conf['no_cache'],'index.php');
1751 } elseif (t3lib_div
::testInt($theRedirect)) { // Internal: Submit to page with id $theRedirect
1752 $page = $GLOBALS['TSFE']->sys_page
->getPage_noCheck($theRedirect);
1753 $LD=$GLOBALS['TSFE']->tmpl
->linkData($page, $conf['target'], $conf['no_cache'],'index.php');
1754 } else { // External url, redirect-hidden field is rendered!
1755 $LD=$GLOBALS['TSFE']->tmpl
->linkData($page, $conf['target'], $conf['no_cache'],'');
1756 $LD['totalURL']=$theRedirect;
1757 $hiddenfields.='<input type="hidden" name="redirect" value="'.htmlspecialchars($LD['totalURL']).'" />'; // 18-09-00 added
1760 // Formtype (where to submit to!):
1761 $formtype = $propertyOverride['type'] ?
$propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']);
1762 if (t3lib_div
::testInt($formtype)) { // Submit to a specific page
1763 $page = $GLOBALS['TSFE']->sys_page
->getPage_noCheck($formtype);
1764 $LD_A=$GLOBALS['TSFE']->tmpl
->linkData($page,$conf['target'],$conf['no_cache'],'');
1765 $action=$LD_A['totalURL'];
1766 } elseif ($formtype){ // Submit to external script
1768 $action = $formtype;
1769 } elseif (t3lib_div
::testInt($theRedirect)) {
1771 $action=$LD_A['totalURL'];
1772 } else { // Submit to 'nothing' - which is current page
1773 $LD_A=$GLOBALS['TSFE']->tmpl
->linkData($GLOBALS['TSFE']->page
,$conf['target'],$conf['no_cache'],'');
1774 $action=$LD_A['totalURL'];
1778 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']);
1780 $hiddenfields.='<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />';
1784 if ($conf['locationData']) {
1785 if ($conf['locationData']=='HTTP_POST_VARS' && isset($GLOBALS['HTTP_POST_VARS']['locationData'])) {
1786 $locationData = t3lib_div
::_POST('locationData');
1788 $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.
1790 $hiddenfields.='<input type="hidden" name="locationData" value="'.htmlspecialchars($locationData).'" />';
1794 if (is_array($conf['hiddenFields.'])) {
1795 reset($conf['hiddenFields.']);
1796 while(list($hF_key,$hF_conf)=each($conf['hiddenFields.'])) {
1797 if (substr($hF_key,-1)!='.') {
1798 $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields');
1799 $hiddenfields.='<input type="hidden" name="'.$hF_key.'" value="'.htmlspecialchars($hF_value).'" />';
1805 $formname = $GLOBALS['TSFE']->uniqueHash();
1807 $validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode($fieldlist,',').'\',\''.rawurlencode($conf['goodMess']).'\',\''.rawurlencode($conf['badMess']).'\')"';
1808 $GLOBALS['TSFE']->additionalHeaderData
['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix
.'t3lib/jsfunc.validateform.js"></script>';
1809 } else $validateForm='';
1812 $theTarget = ($theRedirect?
$LD['target']:$LD_A['target']);
1815 ' action="'.htmlspecialchars($action).'"'.
1816 ' name="'.$formname.'"'.
1817 ' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
1818 ' method="'.($conf['method']?
$conf['method']:'post').'"'.
1819 ($theTarget ?
' target="'.$theTarget.'"' : '').
1822 $hiddenfields.$content,
1825 if ($conf['arrayReturnMode']) {
1826 $content['validateForm']=$validateForm;
1827 $content['formname']=$formname;
1830 return implode('',$content);
1835 * Rendering the cObject, SEARCHRESULT
1837 * @param array Array of TypoScript properties
1838 * @return string Output
1839 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=368&cHash=d00731cd7b
1841 function SEARCHRESULT($conf) {
1842 if (t3lib_div
::_GP('sword') && t3lib_div
::_GP('scols')) {
1843 $search = t3lib_div
::makeInstance('tslib_search');
1844 $search->register_and_explode_search_string(t3lib_div
::_GP('sword'));
1845 $search->register_tables_and_columns(t3lib_div
::_GP('scols'),$conf['allowedCols']);
1848 // the startId is found
1850 if (t3lib_div
::testInt(t3lib_div
::_GP('stype'))) {
1851 $temp_theStartId=t3lib_div
::_GP('stype');
1852 $rootLine = $GLOBALS['TSFE']->sys_page
->getRootLine($temp_theStartId);
1853 // The page MUST have a rootline with the Level0-page of the current site inside!!
1854 while(list(,$val)=each($rootLine)) {
1855 if($val['uid']==$GLOBALS['TSFE']->tmpl
->rootLine
[0]['uid']) {
1856 $theStartId=$temp_theStartId;
1859 } else if (t3lib_div
::_GP('stype')) {
1860 if (substr(t3lib_div
::_GP('stype'),0,1)=='L') {
1861 $pointer = intval(substr(t3lib_div
::_GP('stype'),1));
1862 $theRootLine = $GLOBALS['TSFE']->tmpl
->rootLine
;
1864 $locDat_arr = explode(':',t3lib_div
::_POST('locationData'));
1865 $pId = intval($locDat_arr[0]);
1867 $altRootLine = $GLOBALS['TSFE']->sys_page
->getRootLine($pId);
1868 ksort($altRootLine);
1869 if (count($altRootLine)) {
1870 // check if the rootline has the real Level0 in it!!
1871 reset($altRootLine);
1873 $theNewRoot=array();
1874 while(list(,$val)=each($altRootLine)) {
1875 if($hitRoot ||
$val['uid']==$GLOBALS['TSFE']->tmpl
->rootLine
[0]['uid']) {
1881 $theRootLine = $theNewRoot; // Override the real rootline if any thing
1885 $key = $this->getKey($pointer,$theRootLine);
1886 $theStartId = $theRootLine[$key]['uid'];
1890 // If not set, we use current page
1891 $theStartId=$GLOBALS['TSFE']->id
;
1893 // generate page-tree
1894 $search->pageIdList
.=$this->getTreeList($theStartId,$depth);
1896 $endClause = 'pages.uid IN ('.$search->pageIdList
.$theStartId.') AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?
',3,4':'').') AND pages.no_search=0';
1897 $endClause.=$this->enableFields($search->fTable
).$this->enableFields('pages');
1900 $search->build_search_query($endClause);
1901 #debug($search->queryParts);
1904 if (t3lib_div
::testInt(t3lib_div
::_GP('scount'))) {
1905 $search->res_count
= t3lib_div
::_GP('scount');
1907 $search->count_query();
1911 $spointer = intval(t3lib_div
::_GP('spointer'));
1912 if (isset($conf['range'])) {
1913 $theRange = intval($conf['range']);
1919 if (!$conf['noOrderBy']) {
1920 $search->queryParts
['ORDERBY'] = 'pages.lastUpdated, pages.tstamp';
1923 $search->queryParts
['LIMIT'] = $spointer.','.$theRange;
1926 $search->execute_query();
1927 if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result
)) {
1928 $GLOBALS['TSFE']->register
['SWORD_PARAMS'] = $search->get_searchwords();
1930 $total = $search->res_count
;
1931 $rangeLow = t3lib_div
::intInRange($spointer+
1,1,$total);
1932 $rangeHigh = t3lib_div
::intInRange($spointer+
$theRange,1,$total);
1934 $LD = $GLOBALS['TSFE']->tmpl
->linkData($GLOBALS['TSFE']->page
,$conf['target'],1,'');
1935 $targetPart = $LD['target'] ?
' target="'.htmlspecialchars($LD['target']).'"' : '';
1936 $urlParams = $this->URLqMark($LD['totalURL'],
1937 '&sword='.rawurlencode(t3lib_div
::_GP('sword')).
1938 '&scols='.rawurlencode(t3lib_div
::_GP('scols')).
1939 '&stype='.rawurlencode(t3lib_div
::_GP('stype')).
1942 $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout');
1943 $result = str_replace('###RANGELOW###',$rangeLow,$result);
1944 $result = str_replace('###RANGEHIGH###',$rangeHigh,$result);
1945 $result = str_replace('###TOTAL###',$total,$result);
1947 if ($rangeHigh<$total) {
1948 $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next');
1949 $next = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer+
$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams
.'>'.$next.'</a>';
1951 $result = str_replace('###NEXT###',$next,$result);
1954 $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev');
1955 $prev = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer-$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams
.'>'.$prev.'</a>';
1957 $result = str_replace('###PREV###',$prev,$result);
1960 $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj');
1961 $cObj =t3lib_div
::makeInstance('tslib_cObj');
1962 $cObj->setParent($this->data
,$this->currentRecord
);
1964 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result
)) {
1966 $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj');
1968 $theValue.=$this->wrap($renderCode,$conf['renderWrap']);
1969 $theValue = str_replace('###RESULT###',$theValue,$result);
1971 $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj');
1974 $GLOBALS['TT']->setTSlogMessage('Search in fields: '.$search->listOfSearchFields
);
1978 if ($conf['wrap']) {
1979 $content=$this->wrap($content, $conf['wrap']);
1981 if ($conf['stdWrap.']) {
1982 $content=$this->stdWrap($content, $conf['stdWrap.']);
1985 $GLOBALS['TSFE']->set_no_cache();
1991 * Rendering the cObject, PHP_SCRIPT, PHP_SCRIPT_INT and PHP_SCRIPT_EXT
1993 * @param array Array of TypoScript properties
1994 * @param string If "INT", then rendering "PHP_SCRIPT_INT"; If "EXT", then rendering "PHP_SCRIPT_EXT"; Default is rendering "PHP_SCRIPT" (cached)
1995 * @return string Output
1996 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=370&cHash=aa107f2ad8
1997 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=371&cHash=53f71d025e
1998 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=372&cHash=91fe391e1c
2000 function PHP_SCRIPT($conf,$ext='') {
2001 $incFile = $GLOBALS['TSFE']->tmpl
->getFileName($conf['file']);
2003 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
2007 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
2008 $content.='<!--'.$substKey.'-->';
2009 $GLOBALS['TSFE']->config
[$ext.'incScript'][$substKey] = array(
2015 $GLOBALS['TSFE']->config
[$ext.'incScript'][$substKey]['cObj'] = serialize($this);
2017 $GLOBALS['TSFE']->config
[$ext.'incScript'][$substKey]['data'] = $this->data
;
2021 // Added 31-12-00: Make backup...
2022 $this->oldData
= $this->data
;
2024 include('./'.$incFile);
2025 // Added 31-12-00: restore...
2026 if ($RESTORE_OLD_DATA) {
2027 $this->data
= $this->oldData
;
2036 * Rendering the cObject, TEMPLATE
2038 * @param array Array of TypoScript properties
2039 * @return string Output
2040 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=373&cHash=109a171b1e
2041 * @see substituteMarkerArrayCached()
2043 function TEMPLATE($conf) {
2044 $subparts = Array();
2049 list($PRE,$POST) = explode('|',$conf['markerWrap'] ?
$conf['markerWrap'] : '### | ###');
2050 $POST = trim($POST);
2053 // Getting the content
2054 $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template');
2055 if ($conf['workOnSubpart']) {
2056 $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
2059 if ($conf['nonCachedSubst']) { // NON-CACHED:
2061 if (is_array($conf['marks.'])) {
2062 reset($conf['marks.']);
2063 while(list($theKey,$theValue)=each($conf['marks.'])) {
2064 if (!strstr($theKey,'.')) {
2065 $content = str_replace(
2067 $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey),
2073 // Getting subparts.
2074 if (is_array($conf['subparts.'])) {
2075 reset($conf['subparts.']);
2076 while(list($theKey,$theValue)=each($conf['subparts.'])) {
2077 if (!strstr($theKey,'.')) {
2078 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
2080 $this->setCurrentVal($subpart);
2081 $content = $this->substituteSubpart(
2084 $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey),
2091 // Getting subpart wraps
2092 if (is_array($conf['wraps.'])) {
2093 reset($conf['wraps.']);
2094 while(list($theKey,$theValue)=each($conf['wraps.'])) {
2095 if (!strstr($theKey,'.')) {
2096 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
2098 $this->setCurrentVal($subpart);
2099 $content = $this->substituteSubpart(
2102 explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)),
2110 // Getting subparts.
2111 if (is_array($conf['subparts.'])) {
2112 reset($conf['subparts.']);
2113 while(list($theKey,$theValue)=each($conf['subparts.'])) {
2114 if (!strstr($theKey,'.')) {
2115 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
2117 $GLOBALS['TSFE']->register
['SUBPART_'.$theKey] = $subpart;
2118 $subparts[$theKey]['name'] = $theValue;
2119 $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
2125 if (is_array($conf['marks.'])) {
2126 reset($conf['marks.']);
2127 while(list($theKey,$theValue)=each($conf['marks.'])) {
2128 if (!strstr($theKey,'.')) {
2129 $marks[$theKey]['name'] = $theValue;
2130 $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
2134 // Getting subpart wraps
2135 if (is_array($conf['wraps.'])) {
2136 reset($conf['wraps.']);
2137 while(list($theKey,$theValue)=each($conf['wraps.'])) {
2138 if (!strstr($theKey,'.')) {
2139 $wraps[$theKey]['name'] = $theValue;
2140 $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
2145 $subpartArray =array();
2147 while(list($theKey,$theValue)=each($subparts)) {
2148 // Set current with the content of the subpart...
2149 $this->data
[$this->currentValKey
] = $GLOBALS['TSFE']->register
['SUBPART_'.$theKey];
2150 // Get subpart cObject and substitute it!
2151 $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey);
2153 $this->data
[$this->currentValKey
] = ''; // Reset current to empty
2156 $markerArray =array();
2158 while(list($theKey,$theValue)=each($marks)) {
2159 $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
2162 $subpartWraps =array();
2164 while(list($theKey,$theValue)=each($wraps)) {
2165 $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
2169 if ($conf['substMarksSeparately']) {
2170 $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps);
2171 $content = $this->substituteMarkerArray($content, $markerArray);
2173 $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps);
2181 * Rendering the cObject, MULTIMEDIA
2183 * @param array Array of TypoScript properties
2184 * @return string Output
2185 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=374&cHash=efd88ab4a9
2187 function MULTIMEDIA($conf) {
2189 $filename=$this->stdWrap($conf['file'],$conf['file.']);
2190 $incFile = $GLOBALS['TSFE']->tmpl
->getFileName($filename);
2192 $fileinfo = t3lib_div
::split_fileref($incFile);
2193 if (t3lib_div
::inList('txt,html,htm',$fileinfo['fileext'])) {
2194 $content = $GLOBALS['TSFE']->tmpl
->fileContent($incFile);
2196 // default params...
2199 $parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix
.$incFile.'"';
2200 if (t3lib_div
::inList('au,wav,mp3',$fileinfo['fileext'])) {
2202 if (t3lib_div
::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext'])) {
2203 $parArray['width'] = 'width="200"';
2204 $parArray['height'] = 'height="200"';
2206 if (t3lib_div
::inList('swf,swa,dcr',$fileinfo['fileext'])) {
2207 $parArray['quality'] = 'quality="high"';
2209 if (t3lib_div
::inList('class',$fileinfo['fileext'])) {
2210 $parArray['width'] = 'width="200"';
2211 $parArray['height'] = 'height="200"';
2215 $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.']));
2216 while(list(,$l)=each($lines)) {
2217 $parts = explode('=', $l);
2218 $parameter = strtolower(trim($parts[0]));
2219 $value = trim($parts[1]);
2220 if ((string)$value!='') {
2221 $parArray[$parameter] = $parameter.'="'.htmlspecialchars($value).'"';
2223 unset($parArray[$parameter]);
2226 if ($fileinfo['fileext']=='class') {
2227 unset($parArray['src']);
2228 $parArray['code'] = 'code="'.htmlspecialchars($fileinfo['file']).'"';
2229 $parArray['codebase'] = 'codebase="'.htmlspecialchars($fileinfo['path']).'"';
2230 $content='<applet '.implode($parArray,' ').'></applet>';
2232 $content='<embed '.implode($parArray,' ').'></embed>';
2237 if ($conf['stdWrap.']) {
2238 $content=$this->stdWrap($content, $conf['stdWrap.']);
2260 /************************************
2262 * Various helper functions for content objects:
2264 ************************************/
2267 * Creates a link to a netprint application on another website (where the "netprint" extension is running")
2268 * Related to the extension "netprint"
2270 * @param string The input string to add the link to.
2271 * @param array Array with information about the image.
2272 * @param array TypoScript properties for the netprint application.
2273 * @return string The input string possibly with the netprint link before/after
2276 function netprintApplication_offsiteLinkWrap($str,$imgConf,$conf) {
2277 if ($conf['url'] && @is_file
($imgConf['origFile'])) {
2278 $thisUrl = $conf['thisUrl'] ?
$conf['thisUrl'] : t3lib_div
::getIndpEnv('TYPO3_REQUEST_DIR');
2279 $origFile=$thisUrl.$imgConf['origFile'];
2280 // Original file dimensions:
2281 $gifCreator = t3lib_div
::makeInstance('tslib_gifbuilder');
2282 $gifCreator->init();
2283 $origDim = $gifCreator->getImageDimensions($imgConf['origFile']);
2284 if (!$conf['linkOnlyPixelsAbove'] ||
$origDim[0]*$origDim[1]>$conf['linkOnlyPixelsAbove']) {
2286 $thumbFile=$thisUrl.$imgConf['3'].'|'.$imgConf[0].'x'.$imgConf[1].'|'.$origDim[0].'x'.$origDim[1].'|'.filesize($imgConf['origFile']).'|'.filemtime($imgConf['origFile']);
2289 .'&NP[offsite][1]='.rawurlencode($origFile)
2290 .'&NP[offsite_thumb][1]='.rawurlencode($thumbFile);
2291 $linkCObject = $this->cObjGetSingle($conf['cObject'],$conf['cObject.']);
2293 $ATagParams = trim($conf['ATagParams']) ?
' '.trim($conf['ATagParams']) : '';
2294 $linkCObject='<a href="'.htmlspecialchars($url).'"'.$ATagParams.'>'.$linkCObject.'</a>';
2295 $linkCObject=$this->stdWrap($linkCObject,$conf['outerStdWrap.']);
2296 if ($conf['before']) {
2297 $str=$linkCObject.$str;
2299 $str=$str.$linkCObject;
2308 * Returns a default value for a form field in the FORM cObject.
2309 * Page CANNOT be cached because that would include the inserted value for the current user.
2311 * @param boolean If noValueInsert OR if the no_cache flag for this page is NOT set, the original default value is returned.
2312 * @param string $fieldName: The POST var name to get default value for
2313 * @param string $defaultVal: The current default value
2314 * @return string The default value, either from INPUT var or the current default, based on whether caching is enabled or not.
2317 function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal) {
2318 if (!$GLOBALS['TSFE']->no_cache ||
(!isset($GLOBALS['HTTP_POST_VARS'][$fieldName]) && !isset($GLOBALS['HTTP_GET_VARS'][$fieldName])) ||
$noValueInsert) {
2321 return t3lib_div
::_GP($fieldName);
2326 * Returns a <img> tag with the image file defined by $file and processed according to the properties in the TypoScript array.
2327 * 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().
2329 * @param string File TypoScript resource
2330 * @param array TypoScript configuration properties
2331 * @return string <img> tag, (possibly wrapped in links and other HTML) if any image found.
2335 function cImage($file,$conf) {
2336 $info = $this->getImgResource($file,$conf['file.']);
2337 $GLOBALS['TSFE']->lastImageInfo
=$info;
2338 if (is_array($info)) {
2339 $info[3] = t3lib_div
::png_to_gif_by_imagemagick($info[3]);
2340 $GLOBALS['TSFE']->imagesOnPage
[]=$info[3]; // This array is used to collect the image-refs on the page...
2341 $altParam = $this->getAltParam($conf);
2342 $theValue = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix
.t3lib_div
::rawUrlEncodeFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'" border="'.intval($conf['border']).'"'.($conf['params']?
' '.$conf['params']:'').($altParam).' />';
2343 if ($conf['linkWrap']) {
2344 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
2345 } elseif ($conf['imageLinkWrap']) {
2346 $theValue = $this->imageLinkWrap($theValue,$info['origFile'],$conf['imageLinkWrap.']);
2348 return $this->wrap($theValue,$conf['wrap']);
2353 * Wraps the input string in link-tags that opens the image in a new window.
2355 * @param string String to wrap, probably an <img> tag
2356 * @param string The original image file
2357 * @param array TypoScript properties for the "imageLinkWrap" function
2358 * @return string The input string, $string, wrapped as configured.
2360 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=316&cHash=2848266da6
2362 function imageLinkWrap($string,$imageFile,$conf) {
2366 if ($this->stdWrap($conf['enable'],$conf['enable.'])) {
2367 $content=$this->typolink($string, $conf['typolink.']);
2369 if ($content==$string && @is_file
($imageFile)) {
2371 if ($conf['width']) {$params.='&width='.rawurlencode($conf['width']);}
2372 if ($conf['height']) {$params.='&height='.rawurlencode($conf['height']);}
2373 if ($conf['effects']) {$params.='&effects='.rawurlencode($conf['effects']);}
2374 if ($conf['sample']) {$params.='&sample=1';}
2375 if ($conf['alternativeTempPath']) {$params.='&alternativeTempPath='.rawurlencode($conf['alternativeTempPath']);}
2377 if ($conf['bodyTag']) {$params.='&bodyTag='.rawurlencode($conf['bodyTag']);}
2378 if ($conf['title']) {$params.='&title='.rawurlencode($conf['title']);}
2379 if ($conf['wrap']) {$params.='&wrap='.rawurlencode($conf['wrap']);}
2381 $md5_value = md5($imageFile.'|'.$conf['width'].'|'.$conf['height'].'|'.$conf['effects'].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].'|');
2383 $params.= '&md5='.$md5_value;
2384 $url = $GLOBALS['TSFE']->absRefPrefix
.'showpic.php?file='.rawurlencode($imageFile).$params;
2385 if ($conf['JSwindow.']['altUrl'] ||
$conf['JSwindow.']['altUrl.']) {
2386 $altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
2392 if ($conf['JSwindow']) {
2393 $gifCreator = t3lib_div
::makeInstance('tslib_gifbuilder');
2394 $gifCreator->init();
2395 $gifCreator->mayScaleUp
= 0;
2396 $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile),$conf['width'],$conf['height'],'');
2397 $offset = t3lib_div
::intExplode(',',$conf['JSwindow.']['expand'].',');
2399 $a1='<a href="#" onclick="'.
2400 htmlspecialchars('openPic(\''.$url.'\',\''.($conf['JSwindow.']['newWindow']?
md5($url):'thePicture').'\',\'width='.($dims[0]+
$offset[0]).',height='.($dims[1]+
$offset[1]).',status=0,menubar=0\'); return false;').
2401 '"'.$GLOBALS['TSFE']->ATagParams
.'>';
2403 $GLOBALS['TSFE']->setJS('openPic');
2405 $target = ' target="thePicture"';
2406 if (isset($conf['target'])) {
2407 $target= $conf['target'] ?
' target="'.$conf['target'].'"' : '';
2409 $a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams
.'>';
2412 $content=$a1.$string.$a2;
2420 * Returns content of a file. If its an image the content of the file is not returned but rather an image tag is.
2422 * @param string The filename, being a TypoScript resource data type
2423 * @return string If jpg,gif,jpeg,png: returns image_tag with picture in. If html,txt: returns content string
2426 function fileResource($fName) {
2427 $incFile = $GLOBALS['TSFE']->tmpl
->getFileName($fName);
2429 $fileinfo = t3lib_div
::split_fileref($incFile);
2430 if (t3lib_div
::inList('jpg,gif,jpeg,png',$fileinfo['fileext'])) {
2431 $imgFile = $incFile;
2432 $imgInfo = @getImageSize
($imgFile);
2433 return '<img src="'.$GLOBALS['TSFE']->absRefPrefix
.$imgFile.'" width="'.$imgInfo[0].'" height="'.$imgInfo[1].'" border="0" alt="" title="" />';
2434 } elseif (filesize($incFile)<1024*1024) {
2435 return $GLOBALS['TSFE']->tmpl
->fileContent($incFile);
2441 * Sets the SYS_LASTCHANGED timestamp if input timestamp is larger than current value.
2442 * The SYS_LASTCHANGED timestamp can be used by various caching/indexing applications to determine if the page has new content.
2443 * Therefore you should call this function with the last-changed timestamp of any element you display.
2445 * @param integer Unix timestamp (number of seconds since 1970)
2447 * @see tslib_fe::setSysLastChanged()
2449 function lastChanged($tstamp) {
2450 $tstamp = intval($tstamp);
2451 if ($tstamp>intval($GLOBALS['TSFE']->register
['SYS_LASTCHANGED'])) {
2452 $GLOBALS['TSFE']->register
['SYS_LASTCHANGED'] = $tstamp;
2457 * Wraps the input string by the $wrap value and implements the "linkWrap" data type as well.
2458 * The "linkWrap" data type means that this function will find any integer encapsulated in {} (curly braces) in the first wrap part and substitute it with the corresponding page uid from the rootline where the found integer is pointing to the key in the rootline. See link below.
2460 * @param string Input string
2461 * @param string A string where the first two parts separated by "|" (vertical line) will be wrapped around the input string
2462 * @return string Wrapped output string
2463 * @see wrap(), cImage(), FILE()
2464 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=282&cHash=831a95115d
2466 function linkWrap($content,$wrap) {
2467 $wrapArr = explode('|', $wrap);
2468 if (ereg("\{([0-9]*)\}",$wrapArr[0],$reg)) {
2469 if ($uid = $GLOBALS['TSFE']->tmpl
->rootLine
[$reg[1]]['uid']) {
2470 $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]);
2473 return trim($wrapArr[0]).$content.trim($wrapArr[1]);
2477 * An abstraction method which creates an alt or title parameter for an HTML img tag.
2479 * @param array TypoScript configuration properties
2480 * @return string Parameter string containing alt and title parameters (if any)
2481 * @see IMGTEXT(), cImage()
2483 function getAltParam($conf) {
2484 $altText = $this->stdWrap($conf['altText'],$conf['altText.']);
2485 $altParam = ' alt="'.htmlspecialchars(strip_tags($altText)).'"';
2487 $titleText = $this->stdWrap($conf['titleText'],$conf['titleText.']);
2489 $altParam .= ' title="'.htmlspecialchars(strip_tags($titleText)).'"';
2491 $altParam .= ' title="'.htmlspecialchars(strip_tags($altText)).'"';
2514 /***********************************************
2516 * HTML template processing functions
2518 ***********************************************/
2521 * Returns a subpart from the input content stream.
2522 * A subpart is a part of the input stream which is encapsulated in a string matching the input string, $marker. If this string is found inside of HTML comment tags the start/end points of the content block returned will be that right outside that comment block.
2523 * Example: The contennt string is "Hello <!--###sub1### begin--> World. How are <!--###sub1### end--> you?" If $marker is "###sub1###" then the content returned is " World. How are ". The input content string could just as well have been "Hello ###sub1### World. How are ###sub1### you?" and the result would be the same
2525 * @param string The content stream, typically HTML template content.
2526 * @param string The marker string, typically on the form "###[the marker string]###"
2527 * @return string The subpart found, if found.
2528 * @see substituteSubpart(), t3lib_parsehtml::getSubpart()
2530 function getSubpart($content, $marker) {
2531 if ($marker && strstr($conte