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