00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00218
00219 require_once(PATH_t3lib."class.t3lib_parsehtml.php");
00220
00221
00222 if(t3lib_extMgm::isLoaded('obts')) {
00223 require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php');
00224 }
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00256 class tslib_cObj {
00257 var $align = Array ('center', 'right', 'left');
00258
00269 var $image_compression = Array(
00270 10 => Array('params'=>'', 'ext'=>'gif'),
00271 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
00272 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
00273 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
00274 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
00275 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
00276
00277 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
00278 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
00279 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
00280 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
00281 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
00282 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
00283 39 => Array('params'=>'', 'ext'=>'png'),
00284
00285 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
00286 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
00287 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
00288 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
00289 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
00290 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
00291 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
00292 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
00293 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
00294 );
00295
00301 var $image_effects = Array(
00302 1 => '-rotate 90',
00303 2 => '-rotate 270',
00304 3 => '-rotate 180',
00305 10 => '-colorspace GRAY',
00306 11 => '-sharpen 70',
00307 20 => '-normalize',
00308 23 => '-contrast',
00309 25 => '-gamma 1.3',
00310 26 => '-gamma 0.8'
00311 );
00312
00320 var $data = Array();
00321 var $oldData = Array();
00322 var $alternativeData ='';
00323 var $parameters = Array();
00324 var $currentValKey = 'currentValue_kidjls9dksoje';
00325 var $currentRecord = '';
00326 var $currentRecordTotal = 0;
00327 var $currentRecordNumber = 0;
00328 var $parentRecordNumber = 0;
00329 var $parentRecord = array();
00330 var $regObj;
00331
00332
00333 var $INT_include=0;
00334 var $checkPid_cache = Array();
00335 var $checkPid_badDoktypeList = '255';
00336 var $lastTypoLinkUrl='';
00337 var $lastTypoLinkTarget='';
00338 var $substMarkerCache=array();
00339 var $recordRegister=array();
00340 var $cObjHookObjectsArr = array();
00341
00351 function start($data,$table='') {
00352 global $TYPO3_CONF_VARS;
00353 $this->data = $data;
00354 $this->currentRecord = $table ? $table.':'.$this->data['uid'] : '';
00355 $this->parameters = Array();
00356 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) {
00357 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) {
00358 $this->cObjHookObjectsArr[$classArr[0]] = &t3lib_div::getUserObj($classArr[1]);
00359 }
00360 }
00361 }
00362
00372 function setParent($data,$currentRecord) {
00373 $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord);
00374 }
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00397 function getCurrentVal() {
00398 return $this->data[$this->currentValKey];
00399 }
00400
00408 function setCurrentVal($value) {
00409 $this->data[$this->currentValKey] = $value;
00410 }
00411
00421 function cObjGet($setup,$addKey='') {
00422 if (is_array($setup)) {
00423 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
00424 $content ='';
00425 foreach($sKeyArray as $theKey) {
00426 $theValue=$setup[$theKey];
00427 if (intval($theKey) && !strstr($theKey,'.')) {
00428 $conf=$setup[$theKey.'.'];
00429 $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey);
00430 }
00431 }
00432 return $content;
00433 }
00434 }
00435
00445 function cObjGetSingle($name,$conf,$TSkey='__') {
00446 $content='';
00447
00448 $GLOBALS['TSFE']->cObjectDepthCounter--;
00449 if ($GLOBALS['TSFE']->cObjectDepthCounter>0) {
00450 $name = trim($name);
00451 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name);
00452
00453
00454 if (substr($name,0,1)=='<') {
00455 $key = trim(substr($name,1));
00456 $cF = t3lib_div::makeInstance('t3lib_TSparser');
00457
00458 $old_conf=$conf;
00459 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
00460 if (is_array($old_conf) && count($old_conf)) {
00461 $conf = $this->joinTSarrays($conf,$old_conf);
00462
00463 }
00464
00465 $GLOBALS['TT']->incStackPointer();
00466 $content.=$this->cObjGetSingle($name,$conf,$key);
00467 $GLOBALS['TT']->decStackPointer();
00468 } else {
00469
00470 $hooked = false;
00471
00472 foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) {
00473 if (($name===$cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) {
00474 $content.= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
00475 $hooked = true;
00476 }
00477 }
00478 if (!$hooked && t3lib_extMgm::isLoaded('obts') && isset($GLOBALS['OBTS']['tso_list'][$name])) {
00479 $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this);
00480 } elseif (!$hooked) {
00481
00482 switch($name) {
00483 case 'COBJ_ARRAY':
00484 case 'COA':
00485 $content.=$this->COBJ_ARRAY($conf);
00486 break;
00487 case 'COA_INT':
00488 $content.=$this->COBJ_ARRAY($conf,'INT');
00489 break;
00490 case 'HTML':
00491 $content.=$this->HTML($conf);
00492 break;
00493 case 'TEXT':
00494 $content.=$this->TEXT($conf);
00495 break;
00496 case 'CLEARGIF':
00497 $content.=$this->CLEARGIF($conf);
00498 break;
00499 case 'FILE':
00500 $content.=$this->FILE($conf);
00501 break;
00502 case 'IMAGE':
00503 $content.=$this->IMAGE($conf);
00504 break;
00505 case 'IMG_RESOURCE':
00506 $content.=$this->IMG_RESOURCE($conf);
00507 break;
00508 case 'IMGTEXT':
00509 $content.=$this->IMGTEXT($conf);
00510 break;
00511 case 'CONTENT':
00512 $content.=$this->CONTENT($conf);
00513 break;
00514 case 'RECORDS':
00515 $content.=$this->RECORDS($conf);
00516 break;
00517 case 'HMENU':
00518 $content.=$this->HMENU($conf);
00519 break;
00520 case 'CTABLE':
00521 $content.=$this->CTABLE($conf);
00522 break;
00523 case 'OTABLE':
00524 $content.=$this->OTABLE($conf);
00525 break;
00526 case 'COLUMNS':
00527 $content.=$this->COLUMNS($conf);
00528 break;
00529 case 'HRULER':
00530 $content.=$this->HRULER($conf);
00531 break;
00532 case 'CASE':
00533 $content.=$this->CASEFUNC($conf);
00534 break;
00535 case 'LOAD_REGISTER':
00536 case 'RESTORE_REGISTER':
00537 $this->LOAD_REGISTER($conf,$name);
00538 break;
00539 case 'FORM':
00540 $content.=$this->FORM($conf);
00541 break;
00542 case 'SEARCHRESULT':
00543 $content.=$this->SEARCHRESULT($conf);
00544 break;
00545 case 'PHP_SCRIPT':
00546 $content.=$this->PHP_SCRIPT($conf);
00547 break;
00548 case 'PHP_SCRIPT_EXT':
00549 $content.=$this->PHP_SCRIPT($conf,'EXT');
00550 break;
00551 case 'PHP_SCRIPT_INT':
00552 $content.=$this->PHP_SCRIPT($conf,'INT');
00553 break;
00554 case 'USER':
00555 $content.=$this->USER($conf);
00556 break;
00557 case 'USER_INT':
00558 $content.=$this->USER($conf,'INT');
00559 break;
00560 case 'TEMPLATE':
00561 $content.=$this->TEMPLATE($conf);
00562 break;
00563 case 'EDITPANEL':
00564 if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);}
00565 break;
00566 case 'MULTIMEDIA':
00567 $content.=$this->MULTIMEDIA($conf);
00568 break;
00569 }
00570 }
00571 }
00572 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content);
00573 }
00574
00575 $GLOBALS['TSFE']->cObjectDepthCounter++;
00576 return $content;
00577 }
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00598 function HTML($conf) {
00599 return $this->stdWrap($conf['value'],$conf['value.']);
00600 }
00601
00609 function TEXT($conf) {
00610 return $this->stdWrap($conf['value'],$conf);
00611 }
00612
00620 function CLEARGIF($conf) {
00621 $w = $this->stdWrap($conf['width'],$conf['width.']);
00622 $h = $this->stdWrap($conf['height'],$conf['height.']);
00623 $w = $w ? $w : 1;
00624 $h = $h ? $h : 1;
00625 $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />';
00626 $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap);
00627
00628 return $this->stdWrap($theValue,$conf['stdWrap.']);
00629 }
00630
00639 function COBJ_ARRAY($conf,$ext='') {
00640 $content='';
00641 switch($ext) {
00642 case 'INT':
00643 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00644 $content.='<!--'.$substKey.'-->';
00645 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00646 'file'=>$incFile,
00647 'conf'=>$conf,
00648 'cObj'=>serialize($this),
00649 'type'=>'COA'
00650 );
00651 break;
00652 default:
00653 if ($this->checkIf($conf['if.'])) {
00654 $content=$this->cObjGet($conf);
00655 if ($conf['wrap']) {
00656 $content=$this->wrap($content, $conf['wrap']);
00657 }
00658 if ($conf['stdWrap.']) {
00659 $content=$this->stdWrap($content, $conf['stdWrap.']);
00660 }
00661 }
00662 break;
00663 }
00664 return $content;
00665 }
00666
00675 function USER($conf,$ext='') {
00676 $content='';
00677 switch($ext) {
00678 case 'INT':
00679 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00680 $content.='<!--'.$substKey.'-->';
00681 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00682 'file' => $incFile,
00683 'conf' => $conf,
00684 'cObj' => serialize($this),
00685 'type' => 'FUNC'
00686 );
00687 break;
00688 default:
00689 $content.=$this->callUserFunction($conf['userFunc'],$conf,'');
00690 break;
00691 }
00692 return $content;
00693 }
00694
00702 function FILE($conf) {
00703 $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf, false)));
00704 if ($conf['linkWrap']) {
00705 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
00706 }
00707 return $this->wrap($theValue,$conf['wrap']);
00708 }
00709
00718 function IMAGE($conf) {
00719 $content='';
00720 if ($this->checkIf($conf['if.'])) {
00721 $theValue = $this->cImage($conf['file'],$conf);
00722 if ($conf['stdWrap.']) {
00723 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
00724 }
00725 return $theValue;
00726 }
00727 }
00728
00737 function IMG_RESOURCE($conf) {
00738 $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'],$conf['file.']);
00739 return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3],$conf['stdWrap.']);
00740 }
00741
00749 function IMGTEXT($conf) {
00750 $content='';
00751 if (is_array($conf['text.'])) {
00752 $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']);
00753 }
00754 $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.']));
00755 if ($imgList) {
00756 $imgs = t3lib_div::trimExplode(',',$imgList);
00757 $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
00758
00759 $imgCount= count($imgs)-$imgStart;
00760
00761 $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
00762 if ($imgMax) {
00763 $imgCount = t3lib_div::intInRange($imgCount,0,$conf['imgMax']);
00764 }
00765
00766 $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
00767
00768
00769 $caption='';
00770 $captionArray = array();
00771 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
00772 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);
00773 }
00774 if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
00775 $legacyCaptionSplit = 1;
00776 $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
00777 if (!$capSplit) {$capSplit=chr(10);}
00778 $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
00779 while (list($ca_key, $ca_val) = each($captionArray)) {
00780 $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
00781 }
00782 }
00783
00784 $tablecode='';
00785 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
00786
00787 $tmppos = $position&7;
00788 $contentPosition = $position&24;
00789 $align = $this->align[$tmppos];
00790 $cap = ($caption)?1:0;
00791 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
00792 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
00793 $txtMarg=0;
00794 }
00795
00796 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
00797 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
00798 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
00799 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
00800
00801 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
00802 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
00803 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
00804
00805 $borderColor=$borderColor?$borderColor:'black';
00806 $borderThickness=$borderThickness?$borderThickness:1;
00807
00808 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
00809 if (!$caption_align) {
00810 $caption_align = $align;
00811 }
00812
00813 $colCount = ($cols > 1) ? $cols : 1;
00814 if ($colCount > $imgCount) {$colCount = $imgCount;}
00815 $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
00816
00817 if ($rows>1) {
00818 $rowCount = $rows;
00819 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
00820 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00821 }
00822
00823
00824 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
00825 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
00826
00827 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00828 if (!$maxWInText) {
00829 $maxWInText = round($maxW/2);
00830 }
00831
00832 if ($maxWInText && $contentPosition>=16) {
00833 $maxW = $maxWInText;
00834 }
00835
00836 if ($maxW && $colCount > 0) {
00837
00838
00839
00840
00841
00842 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
00843 }
00844
00845 $colMaxW = Array();
00846 if ($colRelations) {
00847 $rel_parts = explode(':',$colRelations);
00848 $rel_total = 0;
00849 for ($a=0;$a<$colCount;$a++) {
00850 $rel_parts[$a] = intval($rel_parts[$a]);
00851 $rel_total+= $rel_parts[$a];
00852 }
00853 if ($rel_total) {
00854 for ($a=0;$a<$colCount;$a++) {
00855 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
00856 }
00857 if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) {
00858 $colMaxW = Array();
00859 }
00860 }
00861 }
00862 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
00863 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
00864 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00865
00866
00867 $splitArr=array();
00868 $splitArr['imgObjNum']=$conf['imgObjNum'];
00869 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
00870
00871
00872 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
00873 if ($equalHeight) {
00874 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00875 $gifCreator->init();
00876 $relations = Array();
00877 $relations_cols = Array();
00878 $totalMaxW = $maxW*$colCount;
00879 for($a=0;$a<$imgCount;$a++) {
00880 $imgKey = $a+$imgStart;
00881 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00882 $relations[$a] = $imgInfo[1] / $equalHeight;
00883 if ($relations[$a]) {
00884 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a];
00885 }
00886 }
00887 }
00888
00889 $imageRowsFinalWidths = Array();
00890 $imageRowsMaxHeights = Array();
00891 $imgsTag=array();
00892 $origImages=array();
00893 for($a=0;$a<$imgCount;$a++) {
00894 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
00895 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
00896
00897 $imgKey = $a+$imgStart;
00898 $totalImagePath = $imgPath.$imgs[$imgKey];
00899 $this->data[$this->currentValKey] = $totalImagePath;
00900 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00901 $imgConf = $conf[$imgObjNum.'.'];
00902
00903 if ($equalHeight) {
00904 $scale = 1;
00905 if ($totalMaxW) {
00906 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
00907 if ($rowTotalMaxW > $totalMaxW) {
00908 $scale = $rowTotalMaxW / $totalMaxW;
00909 }
00910 }
00911
00912 $imgConf['file.']['height'] = round($equalHeight/$scale);
00913
00914 unset($imgConf['file.']['width']);
00915 unset($imgConf['file.']['maxW']);
00916 unset($imgConf['file.']['maxH']);
00917 unset($imgConf['file.']['minW']);
00918 unset($imgConf['file.']['minH']);
00919 unset($imgConf['file.']['width.']);
00920 unset($imgConf['file.']['maxW.']);
00921 unset($imgConf['file.']['maxH.']);
00922 unset($imgConf['file.']['minW.']);
00923 unset($imgConf['file.']['minH.']);
00924 $maxW = 0;
00925 }
00926
00927 if ($maxW) {
00928 if (count($colMaxW)) {
00929 $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
00930 } else {
00931 $imgConf['file.']['maxW'] = $maxW;
00932 }
00933 }
00934
00935
00936 if (is_array($imgConf)) {
00937 if ($this->image_effects[$image_effects]) {
00938 $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
00939 }
00940 if ($image_frames) {
00941 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
00942 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00943 }
00944 }
00945 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
00946 if ($image_compression==1) {
00947 $tempImport = $imgConf['file.']['import'];
00948 $tempImport_dot = $imgConf['file.']['import.'];
00949 unset($imgConf['file.']);
00950 $imgConf['file.']['import'] = $tempImport;
00951 $imgConf['file.']['import.'] = $tempImport_dot;
00952 } elseif (isset($this->image_compression[$image_compression])) {
00953 $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
00954 $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
00955 unset($imgConf['file.']['ext.']);
00956 }
00957 }
00958
00959
00960 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
00961 $imgConf['altText'] = $conf['altText'];
00962 $imgConf['altText.'] = $conf['altText.'];
00963 }
00964 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
00965 $imgConf['titleText'] = $conf['titleText'];
00966 $imgConf['titleText.'] = $conf['titleText.'];
00967 }
00968 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
00969 $imgConf['longdescURL'] = $conf['longdescURL'];
00970 $imgConf['longdescURL.'] = $conf['longdescURL.'];
00971 }
00972 } else {
00973 $imgConf = array(
00974 'altText' => $conf['altText'],
00975 'titleText' => $conf['titleText'],
00976 'longdescURL' => $conf['longdescURL'],
00977 'file' => $totalImagePath
00978 );
00979 }
00980
00981 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
00982
00983
00984 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
00985
00986 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00987 if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
00988 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
00989 }
00990 }
00991
00992
00993 $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
00994
00995
00996 $index=$imgStart;
00997
00998 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
00999 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
01000 if ($noRows) {$noCols=0;}
01001 if ($equalHeight) {
01002 $noCols=1;
01003 $noRows=0;
01004 }
01005
01006 $rowCount_temp=1;
01007 $colCount_temp=$colCount;
01008 if ($noRows) {
01009 $rowCount_temp = $rowCount;
01010 $rowCount=1;
01011 }
01012 if ($noCols) {
01013 $colCount=1;
01014 }
01015
01016 $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
01017 $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
01018
01019
01020
01021 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
01022
01023
01024 $tablecode='';
01025 $flag=0;
01026 if ($conf['noStretchAndMarginCells']!=1) {
01027 $tablecode.='<tr>';
01028 if ($txtMarg && $align=='right') {
01029 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01030 $editIconsHTML='';
01031 $flag=1;
01032 }
01033 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
01034 if ($txtMarg && $align=='left') {
01035 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01036 $editIconsHTML='';
01037 $flag=1;
01038 }
01039 if ($flag) $tableWidth+=$txtMarg+1;
01040
01041 $tablecode.='</tr>';
01042 }
01043
01044
01045 for ($c=0;$c<$rowCount;$c++) {
01046 if ($c && $rowspacing) {
01047 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
01048 }
01049 $tablecode.='<tr>';
01050 for ($b=0; $b<$colCount_temp; $b++) {
01051 if ($b && $colspacing) {
01052 if (!$noCols) {
01053 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
01054 } else {
01055 $colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($border?$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+($border?$borderThickness*2:0)).'"'.$this->getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />';
01056 $colSpacer='<td valign="top">'.$colSpacer.'</td>';
01057 $tablecode.=$colSpacer;
01058 }
01059 }
01060 if (!$noCols || ($noCols && !$b)) {
01061 $tablecode.='<td valign="top">';
01062 if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}
01063 }
01064 for ($a=0;$a<$rowCount_temp;$a++) {
01065 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;
01066 $imgIndex = $index+$a*$colCount_temp;
01067 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
01068 if ($imgsTag[$imgIndex]) {
01069 if ($rowspacing && $noRows && $a) {
01070 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
01071 }
01072 if ($legacyCaptionSplit) {
01073 $thisCaption = $captionArray[$imgIndex];
01074 } else if ($conf['captionSplit'] || $conf['imageTextSplit']) {
01075 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
01076 }
01077 $imageHTML = $imgsTag[$imgIndex].'<br />';
01078 $Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : '';
01079 if ($border) {$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}
01080 $imageHTML.=$editIconsHTML;
01081 $editIconsHTML='';
01082 $imageHTML.=$thisCaption;
01083 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';}
01084 $tablecode.=$imageHTML;
01085 }
01086 }
01087 $index++;
01088 if (!$noCols || ($noCols && $b+1==$colCount_temp)) {
01089 if ($noCols) {$tablecode.='</tr></table>';}
01090 $tablecode.='</td>';
01091 }
01092 }
01093 $tablecode.='</tr>';
01094 }
01095 if ($c) {
01096 switch ($contentPosition) {
01097 case '0':
01098 case '8':
01099 switch ($align) {
01100 case 'center':
01101 $table_align = 'margin-left: auto; margin-right: auto';
01102 break;
01103 case 'right':
01104 $table_align = 'margin-left: auto; margin-right: 0px';
01105 break;
01106 default:
01107 $table_align = 'margin-left: 0px; margin-right: auto';
01108 }
01109 $table_align = 'style="'.$table_align.'"';
01110 break;
01111 case '16':
01112 $table_align = 'align="'.$align.'"';
01113 break;
01114 default:
01115 $table_align = '';
01116 }
01117
01118
01119 $tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
01120 if ($editIconsHTML) {
01121 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
01122 $editIconsHTML='';
01123 }
01124 if ($cap) {
01125 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
01126 }
01127 $tablecode.='</table>';
01128 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
01129 }
01130
01131 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
01132 switch ($contentPosition) {
01133 case '0':
01134 $output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
01135 break;
01136 case '8':
01137 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
01138 break;
01139 case '16':
01140 $output= $tablecode.$content;
01141 break;
01142 case '24':
01143 $theResult = '';
01144 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
01145 if ($align=='right') {
01146 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
01147 } else {
01148 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
01149 }
01150 $theResult.= '</tr></table>';
01151 $output= $theResult;
01152 break;
01153 }
01154 } else {
01155 $output= $content;
01156 }
01157
01158 if ($conf['stdWrap.']) {
01159 $output = $this->stdWrap($output, $conf['stdWrap.']);
01160 }
01161
01162 return $output;
01163 }
01164
01172 function CONTENT($conf) {
01173 $theValue='';
01174
01175 $originalRec = $GLOBALS['TSFE']->currentRecord;
01176 if ($originalRec) {
01177 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01178 }
01179
01180 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_') {
01181
01182 $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];
01183 $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
01184 $renderObjConf = $conf['renderObj.'];
01185
01186 $slide = intval($conf['slide'])?intval($conf['slide']):0;
01187 $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;
01188 $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;
01189 $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;
01190 $again = false;
01191
01192 do {
01193 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
01194 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
01195 $GLOBALS['TT']->setTSlogMessage($error,3);
01196 } else {
01197 $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01198 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
01199 $cObj =t3lib_div::makeInstance('tslib_cObj');
01200 $cObj->setParent($this->data,$this->currentRecord);
01201 $this->currentRecordNumber=0;
01202 $cobjValue = '';
01203 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01204
01205
01206 $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);
01207
01208
01209 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01210 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01211 }
01212
01213 if (is_array($row)) {
01214 if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {
01215 $this->currentRecordNumber++;
01216 $cObj->parentRecordNumber = $this->currentRecordNumber;
01217 $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
01218 $this->lastChanged($row['tstamp']);
01219 $cObj->start($row,$conf['table']);
01220 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01221 $cobjValue .= $tmpValue;
01222 }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
01223 }
01224 }
01225 }
01226 if ($slideCollectReverse) {
01227 $theValue = $cobjValue.$theValue;
01228 } else {
01229 $theValue .= $cobjValue;
01230 }
01231 if ($slideCollect>0) {
01232 $slideCollect--;
01233 }
01234 if ($slide) {
01235 if ($slide>0) {
01236 $slide--;
01237 }
01238 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
01239 $again = strlen($conf['select.']['pidInList'])?true:false;
01240 }
01241 } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));
01242 }
01243
01244 $theValue = $this->wrap($theValue,$conf['wrap']);
01245 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01246
01247 $GLOBALS['TSFE']->currentRecord = $originalRec;
01248 return $theValue;
01249 }
01250
01258 function RECORDS($conf) {
01259 $theValue='';
01260
01261 $originalRec = $GLOBALS['TSFE']->currentRecord;
01262 if ($originalRec) {
01263 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01264 }
01265
01266 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
01267 if ($conf['tables'] && $conf['source']) {
01268 $allowedTables = $conf['tables'];
01269 if (is_array($conf['conf.'])) {
01270 reset($conf['conf.']);
01271 while(list($k)=each($conf['conf.'])) {
01272 if (substr($k,-1)!='.') $allowedTables.=','.$k;
01273 }
01274 }
01275
01276 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
01277 $loadDB->start($conf['source'], $allowedTables);
01278 reset($loadDB->tableArray);
01279 while(list($table,)=each($loadDB->tableArray)) {
01280 if (is_array($GLOBALS['TCA'][$table])) {
01281 $loadDB->additionalWhere[$table]=$this->enableFields($table);
01282 }
01283 }
01284 $loadDB->getFromDB();
01285
01286 reset($loadDB->itemArray);
01287 $data = $loadDB->results;
01288
01289 $cObj =t3lib_div::makeInstance('tslib_cObj');
01290 $cObj->setParent($this->data,$this->currentRecord);
01291 $this->currentRecordNumber=0;
01292 $this->currentRecordTotal = count($loadDB->itemArray);
01293 reset($loadDB->itemArray);
01294 while(list(,$val)=each($loadDB->itemArray)) {
01295 $row = $data[$val['table']][$val['id']];
01296
01297
01298 $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
01299
01300
01301 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01302 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01303 }
01304
01305 if (is_array($row)) {
01306 if (!$conf['dontCheckPid']) {
01307 $row = $this->checkPid($row['pid']) ? $row : '';
01308 }
01309 if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) {
01310 $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
01311 $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
01312 $renderObjConf = $conf['conf.'][$val['table'].'.'];
01313 $this->currentRecordNumber++;
01314 $cObj->parentRecordNumber=$this->currentRecordNumber;
01315 $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
01316 $this->lastChanged($row['tstamp']);
01317 $cObj->start($row,$val['table']);
01318 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01319 $theValue .= $tmpValue;
01320 }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
01321 }
01322 }
01323 }
01324 if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']);
01325 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01326
01327 $GLOBALS['TSFE']->currentRecord = $originalRec;
01328 return $theValue;
01329 }
01330
01338 function HMENU($conf) {
01339 $content='';
01340 if ($this->checkIf($conf['if.'])) {
01341 $cls = strtolower($conf[1]);
01342 if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses,$cls)) {
01343 if ($conf['special.']['value.']) {
01344 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
01345 }
01346 $GLOBALS['TSFE']->register['count_HMENU']++;
01347 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']=0;
01348 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
01349 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']=array();
01350
01351 $menu = t3lib_div::makeInstance('tslib_'.$cls);
01352 $menu->parent_cObj = $this;
01353 $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1);
01354 $menu->makeMenu();
01355 $content.=$menu->writeMenu();
01356 }
01357 if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']);
01358 if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']);
01359 }
01360 return $content;
01361 }
01362
01370 function CTABLE ($conf) {
01371 $controlTable = t3lib_div::makeInstance('tslib_controlTable');
01372 if ($conf['tableParams']) {
01373 $controlTable->tableParams = $conf['tableParams'];
01374 }
01375
01376 $controlTable->contentW = $conf['cWidth'];
01377
01378 if (is_array($conf['c.'])) {
01379 $controlTable->content = $this->cObjGet($conf['c.'],'c.');
01380 $controlTable->contentTDparams = isset($conf['c.']['TDParams']) ? $conf['c.']['TDParams'] : 'valign="top"';
01381 }
01382 if (is_array($conf['lm.'])) {
01383 $controlTable->lm = $this->cObjGet($conf['lm.'],'lm.');
01384 $controlTable->lmTDparams = isset($conf['lm.']['TDParams']) ? $conf['lm.']['TDParams'] : 'valign="top"';
01385 }
01386 if (is_array($conf['tm.'])) {
01387 $controlTable->tm = $this->cObjGet($conf['tm.'],'tm.');
01388 $controlTable->tmTDparams = isset($conf['tm.']['TDParams']) ? $conf['tm.']['TDParams'] : 'valign="top"';
01389 }
01390 if (is_array($conf['rm.'])) {
01391 $controlTable->rm = $this->cObjGet($conf['rm.'],'rm.');
01392 $controlTable->rmTDparams = isset($conf['rm.']['TDParams']) ? $conf['rm.']['TDParams'] : 'valign="top"';
01393 }
01394 if (is_array($conf['bm.'])) {
01395 $controlTable->bm = $this->cObjGet($conf['bm.'],'bm.');
01396 $controlTable->bmTDparams = isset($conf['bm.']['TDParams']) ? $conf['bm.']['TDParams'] : 'valign="top"';
01397 }
01398 return $controlTable->start($conf['offset'],$conf['cMargins']);
01399 }
01400
01408 function OTABLE ($conf) {
01409 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
01410 if ($conf['tableParams']) {
01411 $controlTable->tableParams = $conf['tableParams'];
01412 }
01413 return $controlTable->start($this->cObjGet($conf),$conf['offset']);
01414 }
01415
01423 function COLUMNS ($conf) {
01424 $content='';
01425 if (is_array($conf) && $this->checkIf($conf['if.'])) {
01426 $tdRowCount=0;
01427 $tableParams = $conf['tableParams'] ? ' '.$conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"';
01428 $TDparams = $conf['TDparams'] ? ' '.$conf['TDparams']:' valign="top"';
01429 $rows = t3lib_div::intInRange($conf['rows'],2,20);
01430 $totalWidth = intval($conf['totalWidth']);
01431 $columnWidth=0;
01432
01433 $totalGapWidth=0;
01434 $gapData = Array(
01435 'gapWidth' => $this->stdWrap($conf['gapWidth'],$conf['gapWidth.']),
01436 'gapBgCol' => $this->stdWrap($conf['gapBgCol'],$conf['gapBgCol.']),
01437 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'],$conf['gapLineThickness.']),
01438 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.'])
01439 );
01440 $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1);
01441 reset($gapData);
01442 while(list(,$val)=each($gapData)) {
01443 $totalGapWidth+=intval($val['gapWidth']);
01444 }
01445
01446 if ($totalWidth) {
01447 $columnWidth = ceil(($totalWidth-$totalGapWidth)/$rows);
01448 $TDparams.=' width="'.$columnWidth.'"';
01449 $tableParams.=' width="'.$totalWidth.'"';
01450 } else {
01451 $TDparams.=' width="'.floor(100/$rows).'%"';
01452 $tableParams.=' width="100%"';
01453 }
01454
01455 for ($a=1;$a<=$rows;$a++) {
01456 $tdRowCount++;
01457 $content.='<td'.$TDparams.'>';
01458 $content.=$this->cObjGetSingle($conf[$a],$conf[$a.'.'], $a);
01459 $content.='</td>';
01460 if ($a < $rows) {
01461 $gapConf = $gapData[($a-1)];
01462 $gapWidth = intval($gapConf['gapWidth']);
01463 if ($gapWidth) {
01464 $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="'.$gapConf['gapBgCol'].'"' : '';
01465 $gapLine = intval($gapConf['gapLineThickness']);
01466 if ($gapLine) {
01467 $gapSurround = t3lib_div::intInRange(($gapWidth-$gapLine)/2, 1, 1000);
01468
01469 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
01470 $tdRowCount++;
01471
01472 $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="'.$gapConf['gapLineCol'].'"' : ' bgcolor="black"';
01473 $content.='<td'.$GtdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapLine.'" height="1" alt="" title="" /></td>';
01474 $tdRowCount++;
01475
01476 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
01477 $tdRowCount++;
01478 } else {
01479 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapWidth.'" height="1" alt="" title="" /></td>';
01480 $tdRowCount++;
01481 }
01482 }
01483 }
01484 }
01485 $content = '<tr>'.$content.'</tr>';
01486 $content = '<table'.$tableParams.'>'.$content.'</table>';
01487 $content.= $this->cObjGetSingle($conf['after'],$conf['after.'], 'after');
01488 if ($conf['stdWrap.']) {
01489 $content = $this->stdWrap($content,$conf['stdWrap.']);
01490 }
01491 }
01492 return $content;
01493 }
01494
01502 function HRULER ($conf) {
01503 $lineThickness = t3lib_div::intInRange($this->stdWrap($conf['lineThickness'],$conf['lineThickness.']),1,50);
01504 $lineColor = $conf['lineColor'] ? $conf['lineColor'] : 'black';
01505 $spaceBefore = intval($conf['spaceLeft']);
01506 $spaceAfter = intval($conf['spaceRight']);
01507 $tableWidth = $conf['tableWidth'] ? $conf['tableWidth'] : '99%';
01508 $content='';
01509
01510 $content.='<table border="0" cellspacing="0" cellpadding="0" width="'.htmlspecialchars($tableWidth).'"><tr>';
01511 if ($spaceBefore) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceBefore.'" height="1" alt="" title="" /></td>'; }
01512 $content.='<td bgcolor="'.$lineColor.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$lineThickness.'" alt="" title="" /></td>';
01513 if ($spaceAfter) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceAfter.'" height="1" alt="" title="" /></td>'; }
01514 $content.='</tr></table>';
01515
01516 $content = $this->stdWrap($content, $conf['stdWrap.']);
01517 return $content;
01518 }
01519
01527 function CASEFUNC ($conf){
01528 $content='';
01529 if ($this->checkIf($conf['if.'])) {
01530 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
01531 $key = $this->stdWrap($conf['key'],$conf['key.']);
01532 $key = strlen($conf[$key]) ? $key : 'default';
01533 $name = $conf[$key];
01534 $theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key);
01535 if ($conf['stdWrap.']) {
01536 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01537 }
01538 return $theValue;
01539 }
01540 }
01541
01552 function LOAD_REGISTER($conf,$name) {
01553 if ($name=='RESTORE_REGISTER') {
01554 $GLOBALS['TSFE']->register = array_pop($GLOBALS['TSFE']->registerStack);
01555 } else {
01556 array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register);
01557 if (is_array($conf)) {
01558 reset($conf);
01559 while(list($theKey,$theValue)=each($conf)) {
01560 if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)])) {
01561 if (strstr($theKey,'.')) {
01562 $theKey = substr($theKey,0,-1);
01563 }
01564 $GLOBALS['TSFE']->register[$theKey] = $this->stdWrap($conf[$theKey],$conf[$theKey.'.']);
01565 }
01566 }
01567 }
01568 }
01569 return '';
01570 }
01571
01592 function FORM($conf,$formData='') {
01593 $content='';
01594 if (is_array($formData)) {
01595 $dataArr = $formData;
01596 } else {
01597 $data=$this->stdWrap($conf['data'],$conf['data.']);
01598
01599 $dataArr=array();
01600
01601 if (trim($data)) {
01602 $data = ereg_replace(chr(10),'||',$data);
01603 $dataArr = explode('||',$data);
01604 }
01605
01606 if (is_array($conf['dataArray.'])) {
01607 $sKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
01608 foreach ($sKeyArray as $theKey) {
01609 $dAA = $conf['dataArray.'][$theKey.'.'];
01610 if (is_array($dAA)) {
01611 $temp=array();
01612 list($temp[0])= explode('|',$dAA['label.'] ? $this->stdWrap($dAA['label'],$dAA['label.']) : $dAA['label']);
01613 list($temp[1])= explode('|',$dAA['type']);
01614 if ($dAA['required']) {$temp[1]='*'.$temp[1];}
01615 list($temp[2])= explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']);
01616
01617 if (is_array($dAA['valueArray.'])) {
01618 reset($dAA['valueArray.']);
01619 $temp_accum = array();
01620 while(list($dAKey_vA,$dAA_vA)=each($dAA['valueArray.'])) {
01621 if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) {
01622 $temp_vA=array();
01623 list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']);
01624 if ($dAA_vA['selected']) {$temp_vA[0]='*'.$temp_vA[0];}
01625 list($temp_vA[1])= explode(',',$dAA_vA['value']);
01626 }
01627 $temp_accum[] = implode('=',$temp_vA);
01628 }
01629 $temp[2] = implode(',',$temp_accum);
01630 }
01631 list($temp[3])= explode('|',$dAA['specialEval.'] ? $this->stdWrap($dAA['specialEval'],$dAA['specialEval.']) : $dAA['specialEval']);
01632
01633
01634 $dataArr[] = implode('|',$temp);
01635 }
01636 }
01637 }
01638 }
01639
01640 $attachmentCounter = '';
01641 $hiddenfields = '';
01642 $fieldlist = Array();
01643 $propertyOverride = Array();
01644 $fieldname_hashArray = Array();
01645 $cc = 0;
01646
01647 $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype);
01648
01649 if ($conf['formName']) {
01650 $formname = $this->cleanFormName($conf['formName']);
01651 } else {
01652 $formname = $GLOBALS['TSFE']->uniqueHash();
01653 $formname = 'a'.$formname;
01654 }
01655
01656 if (isset($conf['fieldPrefix'])) {
01657 if ($conf['fieldPrefix']) {
01658 $prefix = $this->cleanFormName($conf['fieldPrefix']);
01659 } else {
01660 $prefix = '';
01661 }
01662 } else {
01663 $prefix = $formname;
01664 }
01665
01666 foreach ($dataArr as $val) {
01667
01668 $cc++;
01669 $confData=Array();
01670 if (is_array($formData)) {
01671 $parts = $val;
01672 $val = 1;
01673 } else {
01674 $val = trim($val);
01675 $parts = explode('|',$val);
01676 }
01677 if ($val && strcspn($val,'#/')) {
01678
01679 $confData['label'] = trim($parts[0]);
01680
01681 $fParts = explode(',',$parts[1]);
01682 $fParts[0]=trim($fParts[0]);
01683 if (substr($fParts[0],0,1)=='*') {
01684 $confData['required']=1;
01685 $fParts[0] = substr($fParts[0],1);
01686 }
01687 $typeParts = explode('=',$fParts[0]);
01688 $confData['type'] = trim(strtolower(end($typeParts)));
01689 if (count($typeParts)==1) {
01690 $confData['fieldname'] = $this->cleanFormName($parts[0]);
01691 if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email') {$confData['fieldname']='email';}
01692
01693 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
01694 $confData['fieldname'].='_'.$cc;
01695 }
01696 $fieldname_hashArray[md5($confData['fieldname'])]=$confData['fieldname'];
01697
01698 if ($confData['type']=='file') {
01699 $confData['fieldname']='attachment'.$attachmentCounter;
01700 $attachmentCounter=intval($attachmentCounter)+1;
01701 }
01702 } else {
01703 $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0]));
01704 }
01705 $fieldCode='';
01706
01707 if ($conf['wrapFieldName']) {
01708 $confData['fieldname'] = $this->wrap($confData['fieldname'],$conf['wrapFieldName']);
01709 }
01710
01711
01712 $this->setCurrentVal($confData['fieldname']);
01713
01714
01715 if (trim($confData['type'])) {
01716 $addParams=trim($conf['params']);
01717 if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
01718 $addParams=trim($conf['params.'][$confData['type']]);
01719 }
01720 if (strcmp('',$addParams)) { $addParams=' '.$addParams; }
01721 } else $addParams='';
01722
01723 if ($conf['dontMd5FieldNames']) {
01724 $fName = $confData['fieldname'];
01725 } else {
01726 $fName = md5($confData['fieldname']);
01727 }
01728
01729
01730 if ($conf['accessibility'] || $xhtmlStrict) {
01731 $elementIdAttribute = ' id="'.$prefix.$fName.'"';
01732 } else {
01733 $elementIdAttribute = '';
01734 }
01735
01736
01737 switch ($confData['type']) {
01738 case 'textarea':
01739 $cols=trim($fParts[1]) ? intval($fParts[1]) : 20;
01740 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
01741 $compWidth = $compWidth ? $compWidth : 1;
01742 $cols = t3lib_div::intInRange($cols*$compWidth, 1, 120);
01743
01744 $rows=trim($fParts[2]) ? t3lib_div::intInRange($fParts[2],1,30) : 5;
01745 $wrap=trim($fParts[3]);
01746 if ($conf['noWrapAttr'] || $wrap === 'disabled') {
01747 $wrap='';
01748 } else {
01749 $wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"';
01750 }
01751 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',chr(10),trim($parts[2])));
01752 $fieldCode=sprintf('<textarea name="%s"%s cols="%s" rows="%s"%s%s>%s</textarea>',
01753 $confData['fieldname'], $elementIdAttribute, $cols, $rows, $wrap, $addParams, t3lib_div::formatForTextarea($default));
01754 break;
01755 case 'input':
01756 case 'password':
01757 $size=trim($fParts[1]) ? intval($fParts[1]) : 20;
01758 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
01759 $compWidth = $compWidth ? $compWidth : 1;
01760 $size = t3lib_div::intInRange($size*$compWidth, 1, 120);
01761 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
01762
01763 if ($confData['type']=='password') {
01764 $default='';
01765 }
01766
01767 $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : "";
01768 $theType = $confData['type']=='input' ? 'text' : 'password';
01769
01770 $fieldCode=sprintf('<input type="%s" name="%s"%s size="%s"%s value="%s"%s />',
01771 $theType, $confData['fieldname'], $elementIdAttribute, $size, $max, htmlspecialchars($default), $addParams);
01772
01773 break;
01774 case 'file':
01775 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20;
01776 $fieldCode=sprintf('<input type="file" name="%s"%s size="%s"%s />',
01777 $confData['fieldname'], $elementIdAttribute, $size, $addParams);
01778 break;
01779 case 'check':
01780
01781 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
01782 $checked = $default ? ' checked="checked"' : '';
01783 $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"%s%s%s />',
01784 1, $confData['fieldname'], $elementIdAttribute, $checked, $addParams);
01785 break;
01786 case 'select':
01787 $option='';
01788 $valueParts = explode(',',$parts[2]);
01789
01790 if (strtolower(trim($fParts[1]))=='auto') {$fParts[1]=count($valueParts);}
01791 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,20) : 1;
01792
01793 $multiple = strtolower(trim($fParts[2]))=='m' ? ' multiple="multiple"' : '';
01794
01795 $items=array();
01796 $defaults=array();
01797 $pCount = count($valueParts);
01798 for($a=0;$a<$pCount;$a++) {
01799 $valueParts[$a]=trim($valueParts[$a]);
01800 if (substr($valueParts[$a],0,1)=='*') {
01801 $sel='selected';
01802 $valueParts[$a] = substr($valueParts[$a],1);
01803 } else $sel='';
01804
01805 $subParts=explode('=',$valueParts[$a]);
01806 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0]));
01807 $items[] = $subParts;
01808 if ($sel) {$defaults[]=$subParts[1];}
01809 }
01810
01811 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
01812 if (!is_array($default)) {
01813 $defaults=array();
01814 $defaults[] = $default;
01815 } else $defaults=$default;
01816
01817 $iCount = count($items);
01818 for($a=0;$a<$iCount;$a++) {
01819 $option.='<option value="'.$items[$a][1].'"'.(in_array($items[$a][1],$defaults)?' selected="selected"':'').'>'.trim($items[$a][0]).'</option>';
01820 }
01821
01822 if ($multiple) $confData['fieldname'].='[]';
01823 $fieldCode=sprintf('<select name="%s"%s size="%s"%s%s>%s</select>',
01824 $confData['fieldname'], $elementIdAttribute, $size, $multiple, $addParams, $option);
01825 break;
01826 case 'radio':
01827 $option='';
01828 if ($conf['accessibility']) {
01829 $option.='<fieldset'.$elementIdAttribute.'><legend>'.$confData['label'].'</legend>';
01830 }
01831 $valueParts = explode(',',$parts[2]);
01832 $items=array();
01833 $default='';
01834 $pCount = count($valueParts);
01835 for($a=0;$a<$pCount;$a++) {
01836 $valueParts[$a]=trim($valueParts[$a]);
01837 if (substr($valueParts[$a],0,1)=='*') {
01838 $sel='checked';
01839 $valueParts[$a] = substr($valueParts[$a],1);
01840 } else $sel='';
01841
01842 $subParts=explode('=',$valueParts[$a]);
01843 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0]));
01844 $items[] = $subParts;
01845 if ($sel) {$default=$subParts[1];}
01846 }
01847
01848 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
01849
01850 $iCount = count($items);
01851 for($a=0;$a<$iCount;$a++) {
01852 $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]);
01853 if ($conf['accessibility']) {
01854 $radioLabelIdAttribute = ' id="'.$radioId.'"';
01855 } else {
01856 $radioLabelIdAttribute = '';
01857 }
01858 $option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').$addParams.' />';
01859 if ($conf['accessibility']) {
01860 $option .= '<label for="'.$radioId.'">' . $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) . '</label>';
01861 } else {
01862 $option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
01863 }
01864 }
01865 if ($conf['accessibility']) {
01866 $option.='</fieldset>';
01867 }
01868 $fieldCode = $option;
01869 break;
01870 case 'hidden':
01871 $value = trim($parts[2]);
01872 if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
01873 break;
01874 }
01875 if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname'])) {
01876 $value = $GLOBALS['TSFE']->codeString($value);
01877 }
01878 $hiddenfields.= sprintf('<input type="hidden" name="%s"%s value="%s" />',
01879 $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value));
01880 break;
01881 case 'property':
01882 if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess',$confData['fieldname'])) {
01883 $value=trim($parts[2]);
01884 $propertyOverride[$confData['fieldname']] = $value;
01885 $conf[$confData['fieldname']] = $value;
01886 }
01887 break;
01888 case 'submit':
01889 $value=trim($parts[2]);
01890 if ($conf['image.']) {
01891 $this->data[$this->currentValKey] = $value;
01892 $image = $this->IMG_RESOURCE($conf['image.']);
01893 $params = $conf['image.']['params'] ? ' '.$conf['image.']['params'] : '';
01894 $params.= $this->getAltParam($conf['image.'], false);
01895 $params.= $addParams;
01896 } else {
01897 $image = '';
01898 }
01899 if ($image) {
01900 $fieldCode=sprintf('<input type="image" name="%s"%s src="%s"%s />',
01901 $confData['fieldname'], $elementIdAttribute, $image, $params);
01902 } else {
01903 $fieldCode=sprintf('<input type="submit" name="%s"%s value="%s"%s />',
01904 $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
01905 }
01906 break;
01907 case 'reset':
01908 $value=trim($parts[2]);
01909 $fieldCode=sprintf('<input type="reset" name="%s"%s value="%s"%s />',
01910 $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
01911 break;
01912 case 'label':
01913 $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));
01914 break;
01915 default:
01916 $confData['type'] = 'comment';
01917 $fieldCode = trim($parts[2]).' ';
01918 break;
01919 }
01920 if ($fieldCode) {
01921
01922
01923 if (t3lib_div::inList('textarea,input,password',$confData['type']) && strlen(trim($parts[3]))) {
01924 $modeParameters = t3lib_div::trimExplode(':',$parts[3]);
01925 } else {
01926 $modeParameters = array();
01927 }
01928
01929
01930 switch ((string)$modeParameters[0]) {
01931 case 'EREG':
01932 $fieldlist[] = '_EREG';
01933 $fieldlist[] = rawurlencode($modeParameters[1]);
01934 $fieldlist[] = rawurlencode($modeParameters[2]);
01935 $fieldlist[] = rawurlencode($confData['fieldname']);
01936 $fieldlist[] = rawurlencode($confData['label']);
01937 $confData['required'] = 1;
01938 break;
01939 case 'EMAIL':
01940 $fieldlist[] = '_EMAIL';
01941 $fieldlist[] = rawurlencode($confData['fieldname']);
01942 $fieldlist[] = rawurlencode($confData['label']);
01943 $confData['required'] = 1;
01944 break;
01945 default:
01946 if ($confData['required'] && $confData['type']!='check') {
01947 $fieldlist[] = rawurlencode($confData['fieldname']);
01948 $fieldlist[] = rawurlencode($confData['label']);
01949 }
01950 break;
01951 }
01952
01953
01954 $fieldLabel = $confData['label'];
01955 if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/',$confData['type'])) {
01956 $fieldLabel = '<label for="'.$prefix.$fName.'">'.$fieldLabel.'</label>';
01957 }
01958
01959
01960 $fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
01961 $labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
01962 $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']);
01963 $result = $conf['layout'];
01964 if ($conf['REQ'] && $confData['required']) {
01965 if (is_array($conf['REQ.']['fieldWrap.']))
01966 $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
01967 if (is_array($conf['REQ.']['labelWrap.']))
01968 $labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
01969 if ($conf['REQ.']['layout']) {
01970 $result = $conf['REQ.']['layout'];
01971 }
01972 }
01973 if ($confData['type']=='comment' && $conf['COMMENT.']['layout']) {
01974 $result = $conf['COMMENT.']['layout'];
01975 }
01976 if ($confData['type']=='check' && $conf['CHECK.']['layout']) {
01977 $result = $conf['CHECK.']['layout'];
01978 }
01979 if ($confData['type']=='radio' && $conf['RADIO.']['layout']) {
01980 $result = $conf['RADIO.']['layout'];
01981 }
01982 if ($confData['type']=='label' && $conf['LABEL.']['layout']) {
01983 $result = $conf['LABEL.']['layout'];
01984 }
01985 $result = str_replace('###FIELD###',$fieldCode,$result);
01986 $result = str_replace('###LABEL###',$labelCode,$result);
01987 $result = str_replace('###COMMENT###',$commentCode,$result);
01988 $content.= $result;
01989 }
01990 }
01991 }
01992 if ($conf['stdWrap.']) { $content = $this->stdWrap($content, $conf['stdWrap.']); }
01993
01994
01995
01996 $theRedirect = $this->stdWrap($conf['redirect'], $conf['redirect.']);
01997 $page = $GLOBALS['TSFE']->page;
01998 if (!$theRedirect) {
01999 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
02000 } elseif (t3lib_div::testInt($theRedirect)) {
02001 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
02002 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
02003 } else {
02004 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'', '', $this->getClosestMPvalueForPage($page['uid']));
02005 $LD['totalURL'] = $theRedirect;
02006 $hiddenfields.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($LD['totalURL']).'" />';
02007 }
02008
02009
02010 $formtype = $propertyOverride['type'] ? $propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']);
02011 if (t3lib_div::testInt($formtype)) {
02012 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
02013 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
02014 $action = $LD_A['totalURL'];
02015 } elseif ($formtype) {
02016 $LD_A = $LD;
02017 $action = $formtype;
02018 } elseif (t3lib_div::testInt($theRedirect)) {
02019 $LD_A = $LD;
02020 $action = $LD_A['totalURL'];
02021 } else {
02022 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
02023 $action = $LD_A['totalURL'];
02024 }
02025
02026
02027 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']);
02028 if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
02029 $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
02030 $hiddenfields.= '<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />';
02031 }
02032
02033
02034 if ($conf['locationData']) {
02035 if ($conf['locationData']=='HTTP_POST_VARS' && isset($_POST['locationData'])) {
02036 $locationData = t3lib_div::_POST('locationData');
02037 } else {
02038 $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord;
02039 }
02040 $hiddenfields.='<input type="hidden" name="locationData" value="'.htmlspecialchars($locationData).'" />';
02041 }
02042
02043
02044 if (is_array($conf['hiddenFields.'])) {
02045 reset($conf['hiddenFields.']);
02046 while (list($hF_key,$hF_conf) = each($conf['hiddenFields.'])) {
02047 if (substr($hF_key,-1)!='.') {
02048 $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields');
02049 if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient',$hF_key)) {
02050 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
02051 continue;
02052 }
02053 $hF_value = $GLOBALS['TSFE']->codeString($hF_value);
02054 }
02055 $hiddenfields.= '<input type="hidden" name="'.$hF_key.'" value="'.htmlspecialchars($hF_value).'" />';
02056 }
02057 }
02058 }
02059
02060
02061 $hiddenfields = '<div style="display:none;">'.$hiddenfields.'</div>';
02062
02063 if ($conf['REQ']) {
02064 $validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\','.t3lib_div::quoteJSvalue($conf['goodMess']).','.t3lib_div::quoteJSvalue($conf['badMess']).','.t3lib_div::quoteJSvalue($conf['emailMess']).')"';
02065 $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
02066 } else $validateForm='';
02067
02068
02069 $theTarget = ($theRedirect?$LD['target']:$LD_A['target']);
02070 $content = array(
02071 '<form'.
02072 ' action="'.htmlspecialchars($action).'"'.
02073 ' id="'.$formname.'"'.($xhtmlStrict ? '' : ' name="'.$formname.'"').
02074 ' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
02075 ' method="'.($conf['method']?$conf['method']:'post').'"'.
02076 ($theTarget ? ' target="'.$theTarget.'"' : '').
02077 $validateForm.
02078 '>',
02079 $hiddenfields.$content,
02080 '</form>'
02081 );
02082
02083 if ($conf['arrayReturnMode']) {
02084 $content['validateForm']=$validateForm;
02085 $content['formname']=$formname;
02086 return $content;
02087 } else {
02088 return implode('',$content);
02089 }
02090 }
02091
02099 function SEARCHRESULT($conf) {
02100 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
02101 $search = t3lib_div::makeInstance('tslib_search');
02102 $search->register_and_explode_search_string(t3lib_div::_GP('sword'));
02103 $search->register_tables_and_columns(t3lib_div::_GP('scols'),$conf['allowedCols']);
02104
02105 $depth=100;
02106
02107 $theStartId=0;
02108 if (t3lib_div::testInt(t3lib_div::_GP('stype'))) {
02109 $temp_theStartId=t3lib_div::_GP('stype');
02110 $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId);
02111
02112 while(list(,$val)=each($rootLine)) {
02113 if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
02114 $theStartId=$temp_theStartId;
02115 }
02116 }
02117 } else if (t3lib_div::_GP('stype')) {
02118 if (substr(t3lib_div::_GP('stype'),0,1)=='L') {
02119 $pointer = intval(substr(t3lib_div::_GP('stype'),1));
02120 $theRootLine = $GLOBALS['TSFE']->tmpl->rootLine;
02121
02122 $locDat_arr = explode(':',t3lib_div::_POST('locationData'));
02123 $pId = intval($locDat_arr[0]);
02124 if ($pId) {
02125 $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId);
02126 ksort($altRootLine);
02127 if (count($altRootLine)) {
02128
02129 reset($altRootLine);
02130 $hitRoot=0;
02131 $theNewRoot=array();
02132 while(list(,$val)=each($altRootLine)) {
02133 if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
02134 $hitRoot=1;
02135 $theNewRoot[]=$val;
02136 }
02137 }
02138 if ($hitRoot) {
02139 $theRootLine = $theNewRoot;
02140 }
02141 }
02142 }
02143 $key = $this->getKey($pointer,$theRootLine);
02144 $theStartId = $theRootLine[$key]['uid'];
02145 }
02146 }
02147 if (!$theStartId) {
02148
02149 $theStartId = $GLOBALS['TSFE']->id;
02150 }
02151
02152 $search->pageIdList.= $this->getTreeList(-1*$theStartId,$depth);
02153
02154 $endClause = 'pages.uid IN ('.$search->pageIdList.')
02155 AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?',3,4':'').')
02156 AND pages.no_search=0'.
02157 $this->enableFields($search->fTable).
02158 $this->enableFields('pages');
02159
02160 if ($conf['languageField.'][$search->fTable]) {
02161 $endClause.= ' AND '.$search->fTable.'.'.$conf['languageField.'][$search->fTable].' = '.intval($GLOBALS['TSFE']->sys_language_uid);
02162 }
02163
02164
02165 $search->build_search_query($endClause);
02166
02167
02168 if (t3lib_div::testInt(t3lib_div::_GP('scount'))) {
02169 $search->res_count = t3lib_div::_GP('scount');
02170 } else {
02171 $search->count_query();
02172 }
02173
02174
02175 $spointer = intval(t3lib_div::_GP('spointer'));
02176 if (isset($conf['range'])) {
02177 $theRange = intval($conf['range']);
02178 } else {
02179 $theRange = 20;
02180 }
02181
02182
02183 if (!$conf['noOrderBy']) {
02184 $search->queryParts['ORDERBY'] = 'pages.lastUpdated, pages.tstamp';
02185 }
02186
02187 $search->queryParts['LIMIT'] = $spointer.','.$theRange;
02188
02189
02190 $search->execute_query();
02191 if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) {
02192 $GLOBALS['TSFE']->register['SWORD_PARAMS'] = $search->get_searchwords();
02193
02194 $total = $search->res_count;
02195 $rangeLow = t3lib_div::intInRange($spointer+1,1,$total);
02196 $rangeHigh = t3lib_div::intInRange($spointer+$theRange,1,$total);
02197
02198 $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,$conf['target'],1,'', '', $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']));
02199 $targetPart = $LD['target'] ? ' target="'.htmlspecialchars($LD['target']).'"' : '';
02200 $urlParams = $this->URLqMark($LD['totalURL'],
02201 '&sword='.rawurlencode(t3lib_div::_GP('sword')).
02202 '&scols='.rawurlencode(t3lib_div::_GP('scols')).
02203 '&stype='.rawurlencode(t3lib_div::_GP('stype')).
02204 '&scount='.$total);
02205
02206 $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout');
02207 $result = str_replace('###RANGELOW###',$rangeLow,$result);
02208 $result = str_replace('###RANGEHIGH###',$rangeHigh,$result);
02209 $result = str_replace('###TOTAL###',$total,$result);
02210
02211 if ($rangeHigh<$total) {
02212 $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next');
02213 $next = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer+$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$next.'</a>';
02214 } else $next='';
02215 $result = str_replace('###NEXT###',$next,$result);
02216
02217 if ($rangeLow>1) {
02218 $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev');
02219 $prev = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer-$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$prev.'</a>';
02220 } else $prev='';
02221 $result = str_replace('###PREV###',$prev,$result);
02222
02223
02224 $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj');
02225 $cObj = t3lib_div::makeInstance('tslib_cObj');
02226 $cObj->setParent($this->data,$this->currentRecord);
02227 $renderCode='';
02228 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result)) {
02229
02230 $cObj->start($row);
02231 $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj');
02232 }
02233 $theValue.=$this->wrap($renderCode,$conf['renderWrap']);
02234 $theValue = str_replace('###RESULT###',$theValue,$result);
02235 } else {
02236 $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj');
02237 }
02238
02239 $GLOBALS['TT']->setTSlogMessage('Search in fields: '.$search->listOfSearchFields);
02240
02241
02242 $content=$theValue;
02243 if ($conf['wrap']) {
02244 $content=$this->wrap($content, $conf['wrap']);
02245 }
02246 if ($conf['stdWrap.']) {
02247 $content=$this->stdWrap($content, $conf['stdWrap.']);
02248 }
02249
02250 $GLOBALS['TSFE']->set_no_cache();
02251 return $content;
02252 }
02253 }
02254
02265 function PHP_SCRIPT($conf,$ext='') {
02266 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
02267 $content='';
02268 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
02269 switch($ext) {
02270 case 'INT':
02271 case 'EXT':
02272 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
02273 $content.='<!--'.$substKey.'-->';
02274 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
02275 'file'=>$incFile,
02276 'conf'=>$conf,
02277 'type'=>'SCRIPT'
02278 );
02279 if ($ext=='INT') {
02280 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['cObj'] = serialize($this);
02281 } else {
02282 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['data'] = $this->data;
02283 }
02284 break;
02285 default:
02286
02287 $this->oldData = $this->data;
02288
02289 include('./'.$incFile);
02290
02291 if ($RESTORE_OLD_DATA) {
02292 $this->data = $this->oldData;
02293 }
02294 break;
02295 }
02296 }
02297 return $content;
02298 }
02299
02308 function TEMPLATE($conf) {
02309 $subparts = Array();
02310 $marks = Array();
02311 $wraps = Array();
02312 $content='';
02313
02314 list($PRE,$POST) = explode('|',$conf['markerWrap'] ? $conf['markerWrap'] : '### | ###');
02315 $POST = trim($POST);
02316 $PRE = trim($PRE);
02317
02318
02319 $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template');
02320 if ($conf['workOnSubpart']) {
02321 $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
02322 }
02323
02324
02325 if ($conf['relPathPrefix']) {
02326 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
02327 $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
02328 }
02329
02330 if ($content) {
02331 if ($conf['nonCachedSubst']) {
02332
02333 if (is_array($conf['marks.'])) {
02334 reset($conf['marks.']);
02335 while(list($theKey,$theValue)=each($conf['marks.'])) {
02336 if (!strstr($theKey,'.')) {
02337 $content = str_replace(
02338 $PRE.$theKey.$POST,
02339 $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey),
02340 $content);
02341 }
02342 }
02343 }
02344
02345
02346 if (is_array($conf['subparts.'])) {
02347 reset($conf['subparts.']);
02348 while(list($theKey,$theValue)=each($conf['subparts.'])) {
02349 if (!strstr($theKey,'.')) {
02350 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02351 if ($subpart) {
02352 $this->setCurrentVal($subpart);
02353 $content = $this->substituteSubpart(
02354 $content,
02355 $PRE.$theKey.$POST,
02356 $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey),
02357 1
02358 );
02359 }
02360 }
02361 }
02362 }
02363
02364 if (is_array($conf['wraps.'])) {
02365 reset($conf['wraps.']);
02366 while(list($theKey,$theValue)=each($conf['wraps.'])) {
02367 if (!strstr($theKey,'.')) {
02368 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02369 if ($subpart) {
02370 $this->setCurrentVal($subpart);
02371 $content = $this->substituteSubpart(
02372 $content,
02373 $PRE.$theKey.$POST,
02374 explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)),
02375 1
02376 );
02377 }
02378 }
02379 }
02380 }
02381 } else {
02382
02383 if (is_array($conf['subparts.'])) {
02384 reset($conf['subparts.']);
02385 while(list($theKey,$theValue)=each($conf['subparts.'])) {
02386 if (!strstr($theKey,'.')) {
02387 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02388 if ($subpart) {
02389 $GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart;
02390 $subparts[$theKey]['name'] = $theValue;
02391 $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
02392 }
02393 }
02394 }
02395 }
02396
02397 if (is_array($conf['marks.'])) {
02398 reset($conf['marks.']);
02399 while(list($theKey,$theValue)=each($conf['marks.'])) {
02400 if (!strstr($theKey,'.')) {
02401 $marks[$theKey]['name'] = $theValue;
02402 $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
02403 }
02404 }
02405 }
02406
02407 if (is_array($conf['wraps.'])) {
02408 reset($conf['wraps.']);
02409 while(list($theKey,$theValue)=each($conf['wraps.'])) {
02410 if (!strstr($theKey,'.')) {
02411 $wraps[$theKey]['name'] = $theValue;
02412 $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
02413 }
02414 }
02415 }
02416
02417 $subpartArray =array();
02418 reset($subparts);
02419 while(list($theKey,$theValue)=each($subparts)) {
02420
02421 $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey];
02422
02423 $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey);
02424 }
02425 $this->data[$this->currentValKey] = '';
02426
02427
02428 $markerArray =array();
02429 reset($marks);
02430 while(list($theKey,$theValue)=each($marks)) {
02431 $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
02432 }
02433
02434 $subpartWraps =array();
02435 reset($wraps);
02436 while(list($theKey,$theValue)=each($wraps)) {
02437 $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
02438 }
02439
02440
02441 if ($conf['substMarksSeparately']) {
02442 $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps);
02443 $content = $this->substituteMarkerArray($content, $markerArray);
02444 } else {
02445 $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps);
02446 }
02447 }
02448 }
02449 return $content;
02450 }
02451
02459 function MULTIMEDIA($conf) {
02460 $content='';
02461 $filename=$this->stdWrap($conf['file'],$conf['file.']);
02462 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
02463 if ($incFile) {
02464 $fileinfo = t3lib_div::split_fileref($incFile);
02465 if (t3lib_div::inList('txt,html,htm',$fileinfo['fileext'])) {
02466 $content = $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02467 } else {
02468
02469 $parArray=array();
02470
02471 $parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix.$incFile.'"';
02472 if (t3lib_div::inList('au,wav,mp3',$fileinfo['fileext'])) {
02473 }
02474 if (t3lib_div::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext'])) {
02475 $parArray['width'] = 'width="200"';
02476 $parArray['height'] = 'height="200"';
02477 }
02478 if (t3lib_div::inList('swf,swa,dcr',$fileinfo['fileext'])) {
02479 $parArray['quality'] = 'quality="high"';
02480 }
02481 if (t3lib_div::inList('class',$fileinfo['fileext'])) {
02482 $parArray['width'] = 'width="200"';
02483 $parArray['height'] = 'height="200"';
02484 }
02485
02486
02487 $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.']));
02488 while(list(,$l)=each($lines)) {
02489 $parts = explode('=', $l);
02490 $parameter = strtolower(trim($parts[0]));
02491 $value = trim($parts[1]);
02492 if ((string)$value!='') {
02493 $parArray[$parameter] = $parameter.'="'.htmlspecialchars($value).'"';
02494 } else {
02495 unset($parArray[$parameter]);
02496 }
02497 }
02498 if ($fileinfo['fileext']=='class') {
02499 unset($parArray['src']);
02500 $parArray['code'] = 'code="'.htmlspecialchars($fileinfo['file']).'"';
02501 $parArray['codebase'] = 'codebase="'.htmlspecialchars($fileinfo['path']).'"';
02502 $content='<applet '.implode(' ',$parArray).'></applet>';
02503 } else {
02504 $content='<embed '.implode(' ',$parArray).'></embed>';
02505 }
02506 }
02507 }
02508
02509 if ($conf['stdWrap.']) {
02510 $content=$this->stdWrap($content, $conf['stdWrap.']);
02511 }
02512
02513 return $content;
02514 }
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537
02546 function getSlidePids($pidList, $pidConf) {
02547 $pidList = trim($this->stdWrap($pidList,$pidConf));
02548 if (!strcmp($pidList,'')) {
02549 $pidList = 'this';
02550 }
02551 if (trim($pidList)) {
02552 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$pidList));
02553 $listArr = $this->checkPidArray($listArr);
02554 }
02555 $pidList = array();
02556 if (is_array($listArr)&&count($listArr)) {
02557 foreach ($listArr as $uid) {
02558 $page = $GLOBALS['TSFE']->sys_page->getPage($uid);
02559 if (!$page['is_siteroot']) {
02560 $pidList[] = $page['pid'];
02561 }
02562 }
02563 }
02564 return implode(',', $pidList);
02565 }
02566
02577 function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal) {
02578 if (!$GLOBALS['TSFE']->no_cache || (!isset($_POST[$fieldName]) && !isset($_GET[$fieldName])) || $noValueInsert) {
02579 return $defaultVal;
02580 } else {
02581 return t3lib_div::_GP($fieldName);
02582 }
02583 }
02584
02595 function cImage($file,$conf) {
02596 $info = $this->getImgResource($file,$conf['file.']);
02597 $GLOBALS['TSFE']->lastImageInfo=$info;
02598 if (is_array($info)) {
02599 $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
02600 $GLOBALS['TSFE']->imagesOnPage[]=$info[3];
02601
02602 if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {
02603 $conf['altText'] = $conf['alttext'];
02604 $conf['altText.'] = $conf['alttext.'];
02605 }
02606 $altParam = $this->getAltParam($conf);
02607
02608 $theValue = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.t3lib_div::rawUrlEncodeFP($info[3])).'" width="'.$info[0].'" height="'.$info[1].'"'.$this->getBorderAttr(' border="'.intval($conf['border']).'"').($conf['params']?' '.$conf['params']:'').($altParam).' />';
02609 if ($conf['linkWrap']) {
02610 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
02611 } elseif ($conf['imageLinkWrap']) {
02612 $theValue = $this->imageLinkWrap($theValue,$info['origFile'],$conf['imageLinkWrap.']);
02613 }
02614 return $this->wrap($theValue,$conf['wrap']);
02615 }
02616 }
02617
02624 function getBorderAttr($borderAttr) {
02625 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype) && !$GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) {
02626 return $borderAttr;
02627 }
02628 }
02629
02640 function imageLinkWrap($string,$imageFile,$conf) {
02641 $a1='';
02642 $a2='';
02643 $content=$string;
02644 if ($this->stdWrap($conf['enable'],$conf['enable.'])) {
02645 $content=$this->typolink($string, $conf['typolink.']);
02646
02647 if ($content==$string && @is_file($imageFile)) {
02648 $params = '';
02649 if ($conf['width']) {$params.='&width='.rawurlencode($conf['width']);}
02650 if ($conf['height']) {$params.='&height='.rawurlencode($conf['height']);}
02651 if ($conf['effects']) {$params.='&effects='.rawurlencode($conf['effects']);}
02652 if ($conf['sample']) {$params.='&sample=1';}
02653 if ($conf['alternativeTempPath']) {$params.='&alternativeTempPath='.rawurlencode($conf['alternativeTempPath']);}
02654
02655 if ($conf['bodyTag']) {$params.='&bodyTag='.rawurlencode($conf['bodyTag']);}
02656 if ($conf['title']) {$params.='&title='.rawurlencode($conf['title']);}
02657 if ($conf['wrap']) {$params.='&wrap='.rawurlencode($conf['wrap']);}
02658
02659 $md5_value = md5(
02660 $imageFile.'|'.
02661 $conf['width'].'|'.
02662 $conf['height'].'|'.
02663 $conf['effects'].'|'.
02664 $conf['bodyTag'].'|'.
02665 $conf['title'].'|'.
02666 $conf['wrap'].'|'.
02667 $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].'|');
02668
02669 $params.= '&md5='.$md5_value;
02670 $url = $GLOBALS['TSFE']->absRefPrefix.'index.php?eID=tx_cms_showpic&file='.rawurlencode($imageFile).$params;
02671 if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.']) {
02672 $altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
02673 if ($altUrl) {
02674 $url = $altUrl . ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file='.rawurlencode($imageFile).$params);
02675 }
02676 }
02677
02678
02679 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
02680 if (isset($conf['target'])) {
02681 $target = sprintf(' target="%s"', $conf['target']);
02682 } else {
02683 $target = ' target="thePicture"';
02684 }
02685 } else {
02686 $target = '';
02687 }
02688
02689 if ($conf['JSwindow']) {
02690 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02691 $gifCreator->init();
02692 $gifCreator->mayScaleUp = 0;
02693 $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile),$conf['width'],$conf['height'],'');
02694 $offset = t3lib_div::intExplode(',',$conf['JSwindow.']['expand'].',');
02695
02696 $a1='<a href="'. htmlspecialchars($url) .'" onclick="'.
02697 htmlspecialchars('openPic(\''.$GLOBALS['TSFE']->baseUrlWrap($url).'\',\''.($conf['JSwindow.']['newWindow']?md5($url):'thePicture').'\',\'width='.($dims[0]+$offset[0]).',height='.($dims[1]+$offset[1]).',status=0,menubar=0\'); return false;').
02698 '"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02699 $a2='</a>';
02700 $GLOBALS['TSFE']->setJS('openPic');
02701 } else {
02702 $a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02703 $a2='</a>';
02704 }
02705 $content=$a1.$string.$a2;
02706 }
02707 }
02708
02709 return $content;
02710 }
02711
02720 function fileResource($fName, $addParams='alt="" title=""') {
02721 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($fName);
02722 if ($incFile) {
02723 $fileinfo = t3lib_div::split_fileref($incFile);
02724 if (t3lib_div::inList('jpg,gif,jpeg,png',$fileinfo['fileext'])) {
02725 $imgFile = $incFile;
02726 $imgInfo = @getImageSize($imgFile);
02727 return '<img src="'.$GLOBALS['TSFE']->absRefPrefix.$imgFile.'" width="'.$imgInfo[0].'" height="'.$imgInfo[1].'"'.$this->getBorderAttr(' border="0"').' '.$addParams.' />';
02728 } elseif (filesize($incFile)<1024*1024) {
02729 return $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02730 }
02731 }
02732 }
02733
02743 function lastChanged($tstamp) {
02744 $tstamp = intval($tstamp);
02745 if ($tstamp>intval($GLOBALS['TSFE']->register['SYS_LASTCHANGED'])) {
02746 $GLOBALS['TSFE']->register['SYS_LASTCHANGED'] = $tstamp;
02747 }
02748 }
02749
02760 function linkWrap($content,$wrap) {
02761 $wrapArr = explode('|', $wrap);
02762 if (ereg("\{([0-9]*)\}",$wrapArr[0],$reg)) {
02763 if ($uid = $GLOBALS['TSFE']->tmpl->rootLine[$reg[1]]['uid']) {
02764 $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]);
02765 }
02766 }
02767 return trim($wrapArr[0]).$content.trim($wrapArr[1]);
02768 }
02769
02779 function getAltParam($conf, $longDesc=true) {
02780 $altText = trim($this->stdWrap($conf['altText'], $conf['altText.']));
02781 $titleText = trim($this->stdWrap($conf['titleText'],$conf['titleText.']));
02782 $longDesc = trim($this->stdWrap($conf['longdescURL'],$conf['longdescURL.']));
02783
02784
02785 $altParam = ' alt="'.htmlspecialchars(strip_tags($altText)).'"';
02786
02787
02788 $emptyTitleHandling = 'useAlt';
02789 if ($conf['emptyTitleHandling']) {
02790
02791 $emptyTitleHandling = $conf['emptyTitleHandling'];
02792 }
02793 if ($titleText || $emptyTitleHandling == 'keepEmpty') {
02794 $altParam.= ' title="'.htmlspecialchars(strip_tags($titleText)).'"';
02795 } elseif (!$titleText && $emptyTitleHandling == 'useAlt') {
02796 $altParam.= ' title="'.htmlspecialchars(strip_tags($altText)).'"';
02797 }
02798
02799
02800 if ($longDesc) {
02801 $altParam.= ' longdesc="'.htmlspecialchars(strip_tags($longDesc)).'"';
02802 }
02803
02804 return $altParam;
02805 }
02806
02814 function cleanFormName($name) {
02815
02816 $name = preg_replace('/\[|\]\[?/',':',trim($name));
02817
02818 return preg_replace('#[^:a-zA-Z0-9]#','',$name);
02819 }
02820
02830 function getATagParams($conf, $addGlobal=1) {
02831 $aTagParams = '';
02832 if ($conf['ATagParams.']) {
02833 $aTagParams = ' '.$this->stdWrap($conf['ATagParams'], $conf['ATagParams.']);
02834 } elseif ($conf['ATagParams']) {
02835 $aTagParams = ' '.$conf['ATagParams'];
02836 }
02837 if ($addGlobal) {
02838 $aTagParams = ' '.trim($GLOBALS['TSFE']->ATagParams.$aTagParams);
02839 }
02840 return $aTagParams;
02841 }
02842
02843
02844
02845
02846
02847
02848
02849
02850
02851
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861
02862
02863
02864
02865
02877 function getSubpart($content, $marker) {
02878 return t3lib_parsehtml::getSubpart($content, $marker);
02879 }
02880
02893 function substituteSubpart($content,$marker,$subpartContent,$recursive=1) {
02894 return t3lib_parsehtml::substituteSubpart($content, $marker, $subpartContent, $recursive);
02895 }
02896
02906 function substituteMarker($content,$marker,$markContent) {
02907 return str_replace($marker,$markContent,$content);
02908 }
02909
02926 function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array()) {
02927 $GLOBALS['TT']->push('substituteMarkerArray');
02928
02929
02930 if (!is_array($markContentArray)) $markContentArray=array();
02931 if (!is_array($subpartContentArray)) $subpartContentArray=array();
02932 if (!is_array($wrappedSubpartContentArray)) $wrappedSubpartContentArray=array();
02933
02934 $sPkeys = array_keys($subpartContentArray);
02935 $wPkeys = array_keys($wrappedSubpartContentArray);
02936 $aKeys = array_merge(array_keys($markContentArray),$sPkeys,$wPkeys);
02937 if (!count($aKeys)) {
02938 $GLOBALS['TT']->pull();
02939 return $content;
02940 }
02941 asort($aKeys);
02942 $storeKey = md5('substituteMarkerArrayCached_storeKey:'.serialize(array($content,$aKeys)));
02943 if ($this->substMarkerCache[$storeKey]) {
02944 $storeArr = $this->substMarkerCache[$storeKey];
02945 $GLOBALS['TT']->setTSlogMessage('Cached',0);
02946 } else {
02947 $storeArrDat = $GLOBALS['TSFE']->sys_page->getHash($storeKey,0);
02948 if (!isset($storeArrDat)) {
02949
02950 $storeArr=array();
02951
02952
02953 reset($sPkeys);
02954 while(list(,$sPK)=each($sPkeys)) {
02955 $content =$this->substituteSubpart($content,$sPK,$sPK);
02956 }
02957
02958
02959 reset($wPkeys);
02960 while(list(,$wPK)=each($wPkeys)) {
02961 $content =$this->substituteSubpart($content,$wPK,array($wPK,$wPK));
02962 }
02963
02964
02965 reset($aKeys);
02966 while(list($tK,$tV)=each($aKeys)) {
02967 $aKeys[$tK]=quotemeta($tV);
02968 }
02969 $regex = implode('|',$aKeys);
02970
02971 $storeArr['c'] = split($regex,$content);
02972 preg_match_all('/'.$regex.'/',$content,$keyList);
02973 $storeArr['k']=$keyList[0];
02974
02975 $this->substMarkerCache[$storeKey] = $storeArr;
02976
02977
02978 $GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
02979
02980 $GLOBALS['TT']->setTSlogMessage('Parsing',0);
02981 } else {
02982
02983 $storeArr = unserialize($storeArrDat);
02984
02985 $this->substMarkerCache[$storeKey] = $storeArr;
02986 $GLOBALS['TT']->setTSlogMessage('Cached from DB',0);
02987 }
02988 }
02989
02990
02991
02992 $valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
02993
02994 $wSCA_reg=array();
02995 reset($storeArr['k']);
02996 $content = '';
02997
02998 while(list($n,$keyN)=each($storeArr['k'])) {
02999 $content.=$storeArr['c'][$n];
03000 if (!is_array($valueArr[$keyN])) {
03001 $content.=$valueArr[$keyN];
03002 } else {
03003 $content.=$valueArr[$keyN][(intval($wSCA_reg[$keyN])%2)];
03004 $wSCA_reg[$keyN]++;
03005 }
03006 }
03007 $content.=$storeArr['c'][count($storeArr['k'])];
03008
03009 $GLOBALS['TT']->pull();
03010 return $content;
03011 }
03012
03024 function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0) {
03025 if (is_array($markContentArray)) {
03026 reset($markContentArray);
03027 $wrapArr=t3lib_div::trimExplode('|',$wrap);
03028 while(list($marker,$markContent)=each($markContentArray)) {
03029 if($uppercase) $marker=strtoupper($marker);
03030 if(strcmp($wrap,'')) $marker=$wrapArr[0].$marker.$wrapArr[1];
03031 $content=str_replace($marker,$markContent,$content);
03032 }
03033 }
03034 return $content;
03035 }
03036
03045 function substituteMarkerInObject(&$tree, $markContentArray) {
03046 if (is_array ($tree)) {
03047 reset($tree);
03048 while(list($key,$value)=each($tree)) {
03049 $this->substituteMarkerInObject ($tree[$key], $markContentArray);
03050 }
03051 } else {
03052 $tree = $this->substituteMarkerArray($tree,$markContentArray);
03053 }
03054 return $tree;
03055 }
03056
03068 function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE) {
03069 if ($fieldList) {
03070 $fArr = t3lib_div::trimExplode(',',$fieldList,1);
03071 foreach($fArr as $field) {
03072 $markContentArray['###'.$prefix.$field.'###'] = $nl2br?nl2br($row[$field]):$row[$field];
03073 }
03074 } else {
03075 if (is_array($row)) {
03076 foreach($row as $field => $value) {
03077 if (!t3lib_div::testInt($field)) {
03078 if ($HSC) $value = htmlspecialchars($value);
03079 $markContentArray['###'.$prefix.$field.'###'] = $nl2br ? nl2br($value) : $value;
03080 }
03081 }
03082 }
03083 }
03084
03085 return $markContentArray;
03086 }
03087
03088
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109
03110
03111
03112
03113
03114
03115
03116
03117
03118
03131 function stdWrap($content,$conf) {
03132 if (is_array($conf)) {
03133
03134
03135 if ($conf['setContentToCurrent']){$this->data[$this->currentValKey]=$content;}
03136 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
03137
03138
03139 if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) {
03140 $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']];
03141 }
03142 if ($conf['data']){$content=$this->getData($conf['data'], is_array($this->alternativeData)?$this->alternativeData:$this->data);}
03143 $this->alternativeData='';
03144 if ($conf['field']) {$content=$this->getFieldVal($conf['field']);}
03145 if ($conf['current']) {$content=$this->data[$this->currentValKey];}
03146 if ($conf['cObject']) {$content=$this->cObjGetSingle($conf['cObject'],$conf['cObject.'],'/stdWrap/.cObject');}
03147 if ($conf['numRows.']) {$content=$this->numRows($conf['numRows.']);}
03148 if ($conf['filelist'] || $conf['filelist.']) {$content=$this->filelist($this->stdWrap($conf['filelist'], $conf['filelist.']));}
03149 if ($conf['preUserFunc']) {$content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);}
03150
03151
03152 if ($conf['override'] || $conf['override.']){
03153 $override = $this->stdWrap($conf['override'], $conf['override.']);
03154 if (trim($override)) {$content=$override;}
03155 }
03156 if (isset($conf['preIfEmptyListNum']) || isset($conf['preIfEmptyListNum.']['stdWrap.'])) {
03157 $preIfEmptyListNumber = isset($conf['preIfEmptyListNum.']['stdWrap.']) ? $this->stdWrap($conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['stdWrap.']) : $conf['preIfEmptyListNum'];
03158 $content=$this->listNum($content,$preIfEmptyListNumber,$conf['preIfEmptyListNum.']['splitChar']);
03159 }
03160 if (!trim($content) && ($conf['ifEmpty'] || $conf['ifEmpty.'])) {
03161 $content = $this->stdWrap($conf['ifEmpty'], $conf['ifEmpty.']);
03162 }
03163 if (!strlen(trim($content)) && ($conf['ifBlank'] || $conf['ifBlank.'])) {
03164 $content = $this->stdWrap($conf['ifBlank'], $conf['ifBlank.']);
03165 }
03166
03167
03168 if (isset($conf['listNum']) || isset($conf['listNum.']['stdWrap.'])) {
03169 $listNumber = isset($conf['listNum.']['stdWrap.']) ? $this->stdWrap($conf['listNum'], $conf['listNum.']['stdWrap.']) : $conf['listNum'];
03170 $content=$this->listNum($content,$listNumber,$conf['listNum.']['splitChar']);
03171 }
03172
03173 if ($conf['trim']) { $content=trim($content); }
03174
03175
03176 if ($conf['stdWrap.']) { $content=$this->stdWrap($content,$conf['stdWrap.']); }
03177
03178 if ( ($conf['required'] && (string)$content=='') || ($conf['if.'] && !$this->checkIf($conf['if.'])) || ($conf['fieldRequired'] && !trim($this->data[$conf['fieldRequired']])) ){
03179 $content = '';
03180 } else {
03181
03182 if ($conf['csConv']) { $content=$GLOBALS['TSFE']->csConv($content,$conf['csConv']); }
03183 if ($conf['parseFunc.'] || $conf['parseFunc']) {$content=$this->parseFunc($content,$conf['parseFunc.'],$conf['parseFunc']);}
03184 if ($conf['HTMLparser'] && is_array($conf['HTMLparser.'])) {$content=$this->HTMLparser_TSbridge($content,$conf['HTMLparser.']);}
03185 if ($conf['split.']){$content=$this->splitObj($content,$conf['split.']);}
03186 if ($conf['prioriCalc']){$content=t3lib_div::calcParenthesis($content); if ($conf['prioriCalc']=='intval') $content=intval($content);}
03187 if ((string)$conf['char']!=''){$content=chr(intval($conf['char']));}
03188 if ($conf['intval']){$content=intval($content);}
03189 if ($conf['date']){$content=date($conf['date'], $content);}
03190 if ($conf['strftime']){
03191 $content = strftime($conf['strftime'], $content);
03192 $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
03193 if ($tmp_charset) {
03194 $content = $GLOBALS['TSFE']->csConv($content,$tmp_charset);
03195 }
03196 }
03197 if ($conf['age']){$content=$this->calcAge(time()-$content,$conf['age']);}
03198
03199 if ($conf['case']){$content=$this->HTMLcaseshift($content, $conf['case']);}
03200 if ($conf['bytes']){$content=$this->bytes($content,$conf['bytes.']['labels']);}
03201 if ($conf['substring']){$content=$this->substring($content,$conf['substring']);}
03202 if ($conf['removeBadHTML']) {$content = $this->removeBadHTML($content, $conf['removeBadHTML.']);}
03203 if ($conf['stripHtml']){$content = strip_tags($content);}
03204 if ($conf['crop']){$content=$this->crop($content, $conf['crop']);}
03205 if ($conf['rawUrlEncode']){$content = rawurlencode($content);}
03206 if ($conf['htmlSpecialChars']){
03207 $content=htmlSpecialChars($content);
03208 if ($conf['htmlSpecialChars.']['preserveEntities']) $content = t3lib_div::deHSCentities($content);
03209 }
03210
03211 if ($conf['doubleBrTag']) {
03212 $content=ereg_replace("\r?\n[\t ]*\r?\n",$conf['doubleBrTag'],$content);
03213 }
03214 if ($conf['br']) {$content=nl2br($content);}
03215 if ($conf['brTag']) {$content= ereg_replace(chr(10),$conf['brTag'],$content);}
03216 if ($conf['encapsLines.']) {$content=$this->encaps_lineSplit($content,$conf['encapsLines.']);}
03217 if ($conf['keywords']) {$content= $this->keywords($content);}
03218 if ($conf['innerWrap'] || $conf['innerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap'], $conf['innerWrap.']));}
03219 if ($conf['innerWrap2'] || $conf['innerWrap2.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap2'], $conf['innerWrap2.']));}
03220 if ($conf['fontTag']){$content=$this->wrap($content, $conf['fontTag']);}
03221 if ($conf['addParams.']) {$content=$this->addParams($content,$conf['addParams.']);}
03222 if ($conf['textStyle.']) {$content=$this->textStyle($content,$conf['textStyle.']);}
03223 if ($conf['tableStyle.']) {$content=$this->tableStyle($content,$conf['tableStyle.']);}
03224 if ($conf['filelink.']) {$content=$this->filelink($content,$conf['filelink.']);}
03225 if ($conf['preCObject']) {$content=$this->cObjGetSingle($conf['preCObject'],$conf['preCObject.'],'/stdWrap/.preCObject').$content;}
03226 if ($conf['postCObject']) {$content.=$this->cObjGetSingle($conf['postCObject'],$conf['postCObject.'],'/stdWrap/.postCObject');}
03227
03228 if ($conf['wrapAlign'] || $conf['wrapAlign.']){
03229 $wrapAlign = trim($this->stdWrap($conf['wrapAlign'], $conf['wrapAlign.']));
03230 if ($wrapAlign) {$content=$this->wrap($content, '<div style="text-align:'.$wrapAlign.';">|</div>');}
03231 }
03232 if ($conf['typolink.']){$content=$this->typolink($content, $conf['typolink.']);}
03233 if (is_array($conf['TCAselectItem.'])) {$content=$this->TCAlookup($content,$conf['TCAselectItem.']);}
03234
03235
03236 if ($conf['space']){$content=$this->wrapSpace($content, $conf['space']);}
03237 $spaceBefore = '';
03238 if ($conf['spaceBefore'] || $conf['spaceBefore.']) {$spaceBefore = trim($this->stdWrap($conf['spaceBefore'], $conf['spaceBefore.']));}
03239 $spaceAfter = '';
03240 if ($conf['spaceAfter'] || $conf['spaceAfter.']) {$spaceAfter = trim($this->stdWrap($conf['spaceAfter'], $conf['spaceAfter.']));}
03241 if ($spaceBefore || $spaceAfter) {$content=$this->wrapSpace($content, $spaceBefore.'|'.$spaceAfter);}
03242
03243
03244 if ($conf['wrap']){$content=$this->wrap($content, $conf['wrap'], ($conf['wrap.']['splitChar']?$conf['wrap.']['splitChar']:'|'));}
03245 if ($conf['noTrimWrap']){$content=$this->noTrimWrap($content, $conf['noTrimWrap']);}
03246 if ($conf['wrap2']){$content=$this->wrap($content, $conf['wrap2'], ($conf['wrap2.']['splitChar']?$conf['wrap2.']['splitChar']:'|'));}
03247 if ($conf['dataWrap']){$content=$this->dataWrap($content, $conf['dataWrap']);}
03248 if ($conf['prepend']){$content=$this->cObjGetSingle($conf['prepend'],$conf['prepend.'],'/stdWrap/.prepend').$content;}
03249 if ($conf['append']){$content.=$this->cObjGetSingle($conf['append'],$conf['append.'],'/stdWrap/.append');}
03250 if ($conf['wrap3']){$content=$this->wrap($content, $conf['wrap3'], ($conf['wrap3.']['splitChar']?$conf['wrap3.']['splitChar']:'|'));}
03251 if ($conf['outerWrap'] || $conf['outerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['outerWrap'], $conf['outerWrap.']));}
03252 if ($conf['insertData']) {$content = $this->insertData($content);}
03253 if ($conf['offsetWrap']){
03254 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
03255 if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {$controlTable->tableParams = $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.']);}
03256 if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {$controlTable->tdParams = ' '.$this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.']);}
03257 $content=$controlTable->start($content,$conf['offsetWrap']);
03258 if ($conf['offsetWrap.']['stdWrap.']) { $content=$this->stdWrap($content,$conf['offsetWrap.']['stdWrap.']); }
03259 }
03260 if ($conf['postUserFunc']) {$content = $this->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $content);}
03261 if ($conf['postUserFuncInt']) {
03262 $substKey = 'INT_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
03263 $GLOBALS['TSFE']->config['INTincScript'][$substKey] = array(
03264 'content' => $content,
03265 'postUserFunc' => $conf['postUserFuncInt'],
03266 'conf' => $conf['postUserFuncInt.'],
03267 'type' => 'POSTUSERFUNC',
03268 'cObj' => serialize($this),
03269 );
03270 $content ='<!--'.$substKey.'-->';
03271 }
03272
03273 if ($conf['prefixComment'] && !$GLOBALS['TSFE']->config['config']['disablePrefixComment']) {$content = $this->prefixComment($conf['prefixComment'], $conf['prefixComment.'], $content);}
03274
03275 if ($conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editIcons($content,$conf['editIcons'],$conf['editIcons.']);}
03276 if ($conf['editPanel'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editPanel($content, $conf['editPanel.']);}
03277 }
03278
03279
03280 if ($conf['debug']) {$content = '<pre>'.htmlspecialchars($content).'</pre>';}
03281 if ($conf['debugFunc']) {debug($conf['debugFunc']==2?array($content):$content);}
03282 if ($conf['debugData']) {
03283 echo '<b>$cObj->data:</b>';
03284 debug($this->data,'$cObj->data:');
03285 if (is_array($this->alternativeData)) {
03286 echo '<b>$cObj->alternativeData:</b>';
03287 debug($this->alternativeData,'$this->alternativeData');
03288 }
03289 }
03290 }
03291 return $content;
03292 }
03293
03305 function numRows($conf) {
03306 $conf['select.']['selectFields'] = 'count(*)';
03307
03308 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
03309
03310 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
03311 $GLOBALS['TT']->setTSlogMessage($error,3);
03312 } else {
03313 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
03314 return intval($row[0]);
03315 }
03316 }
03317
03326 function listNum($content,$listNum,$char) {
03327 $char = $char ? $char : ',';
03328 if (t3lib_div::testInt($char)) {
03329 $char = chr($char);
03330 }
03331 $temp = explode($char,$content);
03332 $last = ''.(count($temp)-1);
03333 $index=$this->calc(eregi_replace('last',$last,$listNum));
03334 return $temp[$index];
03335 }
03336
03346 function checkIf($conf) {
03347 if (!is_array($conf)) {return true;}
03348 if (isset($conf['directReturn'])) {return $conf['directReturn'] ? 1 : 0;}
03349 $flag = true;
03350 if (isset($conf['isTrue']) || isset($conf['isTrue.'])) {
03351 $isTrue = trim($this->stdWrap($conf['isTrue'],$conf['isTrue.']));
03352 if (!$isTrue) {
03353 $flag=0;
03354 }
03355 }
03356 if (isset($conf['isFalse']) || isset($conf['isFalse.'])) {
03357 $isFalse = trim($this->stdWrap($conf['isFalse'],$conf['isFalse.']));
03358 if ($isFalse) {
03359 $flag=0;
03360 }
03361 }
03362 if (isset($conf['isPositive']) || isset($conf['isPositive.'])) {
03363 $number = $this->calc($this->stdWrap($conf['isPositive'],$conf['isPositive.']));
03364 if ($number<1) {
03365 $flag=0;
03366 }
03367 }
03368 if ($flag) {
03369 $value = trim($this->stdWrap($conf['value'],$conf['value.']));
03370
03371 if (isset($conf['isGreaterThan']) || isset($conf['isGreaterThan.'])) {
03372 $number = trim($this->stdWrap($conf['isGreaterThan'],$conf['isGreaterThan.']));
03373 if ($number<=$value) {
03374 $flag=0;
03375 }
03376 }
03377 if (isset($conf['isLessThan']) || isset($conf['isLessThan.'])) {
03378 $number = trim($this->stdWrap($conf['isLessThan'],$conf['isLessThan.']));
03379 if ($number>=$value) {
03380 $flag=0;
03381 }
03382 }
03383 if (isset($conf['equals']) || isset($conf['equals.'])) {
03384 $number = trim($this->stdWrap($conf['equals'],$conf['equals.']));
03385 if ($number!=$value) {
03386 $flag=0;
03387 }
03388 }
03389 if (isset($conf['isInList']) || isset($conf['isInList.'])) {
03390 $number = trim($this->stdWrap($conf['isInList'],$conf['isInList.']));
03391 if (!t3lib_div::inList($value,$number)) {
03392 $flag=0;
03393 }
03394 }
03395 }
03396 if ($conf['negate']) {$flag = $flag ? 0 : 1;}
03397 return $flag;
03398 }
03399
03409 function filelist($data) {
03410 $data = trim($data);
03411 if ($data) {
03412 $data_arr = explode('|',$data);
03413
03414 if ($GLOBALS['TSFE']->lockFilePath) {
03415 $path = $this->clean_directory($data_arr[0]);
03416 $path = substr($path,0,strlen($GLOBALS['TSFE']->lockFilePath))==$GLOBALS['TSFE']->lockFilePath ? $path : '';
03417 }
03418 if ($path) {
03419 $items = Array('files'=>array(), 'sorting'=>array());
03420 $ext_list = strtolower(t3lib_div::uniqueList($data_arr[1]));
03421 $sorting = trim($data_arr[2]);
03422
03423 $d = @dir($path);
03424 $tempArray=Array();
03425 if (is_object($d)) {
03426 $count=0;
03427 while($entry=$d->read()) {
03428 if ($entry!='.' && $entry!='..') {
03429 $wholePath = $path.'/'.$entry;
03430 if (@file_exists($wholePath) && filetype($wholePath)=='file') {
03431 $info = t3lib_div::split_fileref($wholePath);
03432 if (!$ext_list || t3lib_div::inList($ext_list,$info['fileext'])) {
03433 $items['files'][] = $info['file'];
03434 switch($sorting) {
03435 case 'name':
03436 $items['sorting'][] = strtolower($info['file']);
03437 break;
03438 case 'size':
03439 $items['sorting'][] = filesize($wholePath);
03440 break;
03441 case 'ext':
03442 $items['sorting'][] = $info['fileext'];
03443 break;
03444 case 'date':
03445 $items['sorting'][] = filectime($wholePath);
03446 break;
03447 case 'mdate':
03448 $items['sorting'][] = filemtime($wholePath);
03449 break;
03450 default:
03451 $items['sorting'][] = $count;
03452 break;
03453 }
03454 $count++;
03455 }
03456 }
03457 }
03458 }
03459 $d->close();
03460 }
03461
03462 if (count($items['sorting'])) {
03463 if (strtolower(trim($data_arr[3]))!='r') {
03464 asort($items['sorting']);
03465 } else {
03466 arsort($items['sorting']);
03467 }
03468 }
03469 if (count($items['files'])) {
03470
03471 reset($items['sorting']);
03472 $fullPath = trim($data_arr[4]);
03473 $list_arr=Array();
03474 while(list($key,)=each($items['sorting'])) {
03475 $list_arr[]= $fullPath ? $path.'/'.$items['files'][$key] : $items['files'][$key];
03476 }
03477 return implode(',',$list_arr);
03478 }
03479 }
03480 }
03481 }
03482
03491 function clean_directory($theDir) {
03492 if (t3lib_div::validPathStr($theDir)) {
03493 $theDir = ereg_replace("[\/\. ]*$",'',$theDir);
03494 if (!t3lib_div::isAbsPath($theDir) && @is_dir($theDir)) {
03495 return $theDir;
03496 }
03497 }
03498 }
03499
03509 function HTMLparser_TSbridge($theValue, $conf) {
03510 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
03511 $htmlParserCfg = $htmlParser->HTMLparserConfig($conf);
03512 return $htmlParser->HTMLcleaner($theValue,$htmlParserCfg[0],$htmlParserCfg[1],$htmlParserCfg[2],$htmlParserCfg[3]);
03513 }
03514
03523 function dataWrap($content,$wrap) {
03524 return $this->wrap($content,$this->insertData($wrap));
03525 }
03526
03536 function insertData($str) {
03537 $inside=0;
03538 $newVal='';
03539 $pointer=0;
03540 $totalLen = strlen($str);
03541 do {
03542 if (!$inside) {
03543 $len = strcspn(substr($str,$pointer),'{');
03544 $newVal.= substr($str,$pointer,$len);
03545 $inside = 1;
03546 } else {
03547 $len = strcspn(substr($str,$pointer),'}')+1;
03548 $newVal.= $this->getData(substr($str,$pointer+1,$len-2),$this->data);
03549 $inside = 0;
03550 }
03551 $pointer+=$len;
03552 } while($pointer<$totalLen);
03553 return $newVal;
03554 }
03555
03566 function prefixComment($str,$conf,$content) {
03567 $parts = explode('|',$str);
03568
03569 $output =
03570 chr(10).str_pad('',$parts[0],chr(9)).
03571 '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [begin] -->'.
03572 chr(10).str_pad('',$parts[0]+1,chr(9)).
03573 $content.
03574 chr(10).str_pad('',$parts[0],chr(9)).
03575 '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [end] -->'.
03576 chr(10).str_pad('',$parts[0]+1,chr(9));
03577
03578 return $output;
03579 }
03580
03590 function substring($content,$options) {
03591 $options = t3lib_div::intExplode(',',$options.',');
03592 if ($options[1]) {
03593 return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0],$options[1]);
03594 } else {
03595 return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0]);
03596 }
03597 }
03598
03608 function crop($content,$options) {
03609 $options = explode('|',$options);
03610 $chars = intval($options[0]);
03611 $afterstring = trim($options[1]);
03612 $crop2space = trim($options[2]);
03613 if ($chars) {
03614 if (strlen($content)>abs($chars)) {
03615 if ($chars<0) {
03616 $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$chars);
03617 $trunc_at = strpos($content, ' ');
03618 $content = ($trunc_at&&$crop2space) ? $afterstring.substr($content,$trunc_at) : $afterstring.$content;
03619 } else {
03620 $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,0,$chars);
03621 $trunc_at = strrpos($content, ' ');
03622 $content = ($trunc_at&&$crop2space) ? substr($content, 0, $trunc_at).$afterstring : $content.$afterstring;
03623 }
03624 }
03625 }
03626 return $content;
03627 }
03628
03640 function removeBadHTML($text, $conf) {
03641
03642
03643 $text = preg_replace(
03644 array(
03645 "'<script[^>]*?>.*?</script[^>]*?>'si",
03646 "'<applet[^>]*?>.*?</applet[^>]*?>'si",
03647 "'<object[^>]*?>.*?</object[^>]*?>'si",
03648 "'<iframe[^>]*?>.*?</iframe[^>]*?>'si",
03649 "'<frameset[^>]*?>.*?</frameset[^>]*?>'si",
03650 "'<style[^>]*?>.*?</style[^>]*?>'si",
03651 "'<marquee[^>]*?>.*?</marquee[^>]*?>'si",
03652 "'<script[^>]*?>'si",
03653 "'<meta[^>]*?>'si",
03654 "'<base[^>]*?>'si",
03655 "'<applet[^>]*?>'si",
03656 "'<object[^>]*?>'si",
03657 "'<link[^>]*?>'si",
03658 "'<iframe[^>]*?>'si",
03659 "'<frame[^>]*?>'si",
03660 "'<frameset[^>]*?>'si",
03661 "'<input[^>]*?>'si",
03662 "'<form[^>]*?>'si",
03663 "'<embed[^>]*?>'si",
03664 "'background-image:url'si",
03665 "'<\w+.*?(onabort|onbeforeunload|onblur|onchange|onclick|ondblclick|ondragdrop|onerror|onfilterchange|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onmove|onreadystatechange|onreset|onresize|onscroll|onselect|onselectstart|onsubmit|onunload).*?>'si",
03666 ), '', $text);
03667
03668 $text = eregi_replace('<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*','',$text);
03669
03670 // Return clean content
03671 return $text;
03672 }
03673
03684 function textStyle($theValue, $conf) {
03685 $conf['face.'][1] = 'Times New Roman';
03686 $conf['face.'][2] = 'Verdana,Arial,Helvetica,Sans serif';
03687 $conf['face.'][3] = 'Arial,Helvetica,Sans serif';
03688
03689 $conf['size.'][1] = 1;
03690 $conf['size.'][2] = 2;
03691 $conf['size.'][3] = 3;
03692 $conf['size.'][4] = 4;
03693 $conf['size.'][5] = 5;
03694 $conf['size.'][10] = '+1';
03695 $conf['size.'][11] = '-1';
03696
03697 $conf['color.'][240] = 'black';
03698 $conf['color.'][241] = 'white';
03699 $conf['color.'][242] = '#333333';
03700 $conf['color.'][243] = 'gray';
03701 $conf['color.'][244] = 'silver';
03702 $conf['color.'][245] = 'red';
03703 $conf['color.'][246] = 'navy';
03704 $conf['color.'][247] = 'yellow';
03705 $conf['color.'][248] = 'green';
03706 $conf['color.'][249] = 'olive';
03707 $conf['color.'][250] = 'maroon';
03708
03709 $face = $this->data[$conf['face.']['field']];
03710 $size = $this->data[$conf['size.']['field']];
03711 $color = $this->data[$conf['color.']['field']];
03712 $align = $this->data[$conf['align.']['field']];
03713 $properties = $this->data[$conf['properties.']['field']];
03714 if (!$properties) {
03715 $properties=$this->stdWrap($conf['properties.']['default'],$conf['properties.']['default.']);
03716 }
03717
03718 // properties
03719 if (($properties&8)) {$theValue=$this->HTMLcaseshift($theValue, 'upper');}
03720 if (($properties&1)) {$theValue='<b>'.$theValue.'</b>';}
03721 if (($properties&2)) {$theValue='<i>'.$theValue.'</i>';}
03722 if (($properties&4)) {$theValue='<u>'.$theValue.'</u>';}
03723
03724 // Fonttag
03725 $theFace = $conf['face.'][$face] ? $conf['face.'][$face] : $this->stdWrap($conf['face.']['default'],$conf['face.']['default.']);
03726 $theSize = $conf['size.'][$size] ? $conf['size.'][$size] : $this->stdWrap($conf['size.']['default'],$conf['size.']['default.']);
03727 $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $this->stdWrap($conf['color.']['default'],$conf['color.']['default.']);
03728
03729 if ($conf['altWrap']) {
03730 $theValue=$this->wrap($theValue, $conf['altWrap']);
03731 } elseif ($theFace || $theSize || $theColor) {
03732 $fontWrap = '<font'.($theFace?' face="'.$theFace.'"':'').($theSize?' size="'.$theSize.'"':'').($theColor?' color="'.$theColor.'"':'').'>|</font>';
03733 $theValue=$this->wrap($theValue, $fontWrap);
03734 }
03735
03736 if ($align) {$theValue=$this->wrap($theValue, '<div style="text-align:'.$align.';">|</div>');}
03737
03738 return $theValue;
03739 }
03740
03751 function tableStyle($theValue, $conf) {
03752 $conf['color.'][240] = 'black';
03753 $conf['color.'][241] = 'white';
03754 $conf['color.'][242] = '#333333';
03755 $conf['color.'][243] = 'gray';
03756 $conf['color.'][244] = 'silver';
03757
03758 $align = $this->stdWrap($conf['align'],$conf['align.']);
03759 $border = intval($this->stdWrap($conf['border'],$conf['border.']));
03760 $cellspacing = intval($this->stdWrap($conf['cellspacing'],$conf['cellspacing.']));
03761 $cellpadding = intval($this->stdWrap($conf['cellpadding'],$conf['cellpadding.']));
03762
03763 $color = $this->data[$conf['color.']['field']];
03764 $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $conf['color.']['default'];
03765
03766 $tableTagArray = Array('<table');
03767 $tableTagArray[]='border="'.$border.'"';
03768 $tableTagArray[]='cellspacing="'.$cellspacing.'"';
03769 $tableTagArray[]='cellpadding="'.$cellpadding.'"';
03770 if ($align) {$tableTagArray[]='align="'.$align.'"';}
03771 if ($theColor) {$tableTagArray[]='bgcolor="'.$theColor.'"';}
03772
03773 if ($conf['params']) {
03774 $tableTagArray[] = $conf['params'];
03775 }
03776
03777 $tableWrap = implode(' ',$tableTagArray).'> | </table>';
03778 $theValue=$this->wrap($theValue, $tableWrap);
03779
03780 return $theValue;
03781 }
03782
03792 function addParams($content,$conf) {
03793 $lowerCaseAttributes = TRUE;
03794
03795 if (!is_array($conf)) { return $content; }
03796
03797 $key = 1;
03798 $parts = explode('<',$content);
03799 if (intval($conf['_offset'])) $key = intval($conf['_offset'])<0 ? count($parts)+intval($conf['_offset']) : intval($conf['_offset']);
03800 $subparts=explode('>',$parts[$key]);
03801 if (trim($subparts[0])) {
03802
03803 $attribs = t3lib_div::get_tag_attributes('<'.$subparts[0].'>');
03804 if (!is_array($attribs)) {$attribs=array();}
03805 list($tagName) = explode(' ',$subparts[0],2);
03806
03807 reset($conf);
03808 while(list($pkey,$val)=each($conf)) {
03809 if (substr($pkey,-1)!='.' && substr($pkey,0,1)!='_') {
03810 $tmpVal=$this->stdWrap($conf[$pkey],$conf[$pkey.'.']);
03811 if ($lowerCaseAttributes) { $pkey = strtolower($pkey); }
03812 if (strcmp($tmpVal,'')) {$attribs[$pkey]=$tmpVal;}
03813 }
03814 }
03815
03816
03817 $subparts[0]=trim($tagName.' '.t3lib_div::implodeAttributes($attribs));
03818 $parts[$key] = implode('>',$subparts);
03819 $content = implode('<',$parts);
03820 }
03821 return $content;
03822 }
03823
03835 function filelink($theValue, $conf) {
03836 $output = '';
03837 $aTagParams = $this->getATagParams($conf);
03838 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
03839 $conf['path'] = $this->stdWrap($conf['path'],$conf['path.']);
03840 $theFile = trim($conf['path']).$theValue;
03841 if (@is_file($theFile)) {
03842 $theFileEnc = str_replace('%2F', '/', rawurlencode($theFile));
03843 $locDataAdd = $conf['jumpurl.']['secure'] ? $this->locDataJU($theFileEnc,$conf['jumpurl.']['secure.']) : '';
03844 $url = ($conf['jumpurl']) ? $GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($theFileEnc).$locDataAdd.$GLOBALS['TSFE']->getMethodUrlIdToken : $theFileEnc;
03845 $theLinkWrap = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$url).'"'.($conf['target']?' target="'.$conf['target'].'"':'').$aTagParams.'>|</a>';
03846
03847 $theSize = filesize($theFile);
03848 $fI = t3lib_div::split_fileref($theFile);
03849 if ($conf['icon']) {
03850
03851 $iconP = t3lib_extMgm::siteRelPath('cms').'tslib/media/fileicons/';
03852 $icon = @is_file($iconP.$fI['fileext'].'.gif') ? $iconP.$fI['fileext'].'.gif' : $iconP.'default.gif';
03853
03854 $IEList = $this->stdWrap($conf['icon_image_ext_list'],$conf['icon_image_ext_list.']);
03855 $image_ext_list = str_replace(' ','',strtolower($IEList));
03856 if ($fI['fileext'] && t3lib_div::inList($image_ext_list, $fI['fileext'])) {
03857 if ($conf['iconCObject']) {
03858 $icon = $this->cObjGetSingle($conf['iconCObject'],$conf['iconCObject.'],'iconCObject');
03859 } else {
03860 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
03861 $thumbSize = '';
03862 if ($conf['icon_thumbSize'] || $conf['icon_thumbSize.']) { $thumbSize = '&size='.$this->stdWrap($conf['icon_thumbSize'], $conf['icon_thumbSize.']); }
03863 $check = basename($theFile).':'.filemtime($theFile).':'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
03864 $md5sum = '&md5sum='.t3lib_div::shortMD5($check);
03865 $icon = 't3lib/thumbs.php?dummy='.$GLOBALS['EXEC_TIME'].'&file='.rawurlencode('../'.$theFile).$thumbSize.$md5sum;
03866 } else {
03867 $icon = t3lib_extMgm::siteRelPath('cms').'tslib/media/miscicons/notfound_thumb.gif';
03868 }
03869 $icon = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$icon).'"'.$this->getBorderAttr(' border="0"').''.$this->getAltParam($conf).' />';
03870 }
03871 } else {
03872 $icon = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$icon).'" width="18" height="16"'.$this->getBorderAttr(' border="0"').''.$this->getAltParam($conf).' />';
03873 }
03874 if ($conf['icon_link']) {$icon = $this->wrap($icon, $theLinkWrap);}
03875 $icon = $this->stdWrap($icon,$conf['icon.']);
03876 }
03877 if ($conf['size']) {
03878 $size = $this->stdWrap($theSize,$conf['size.']);
03879 }
03880
03881
03882 if ($conf['removePrependedNumbers']) $theValue=ereg_replace('_[0-9][0-9](\.[[:alnum:]]*)$','\1',$theValue);
03883 $theValue = $this->stdWrap($theValue,$conf['labelStdWrap.']);
03884
03885
03886 if ($conf['ATagBeforeWrap']) {
03887 $theValue = $this->wrap($this->wrap($theValue, $conf['wrap']), $theLinkWrap);
03888 } else {
03889 $theValue = $this->wrap($this->wrap($theValue, $theLinkWrap), $conf['wrap']);
03890 }
03891 $file = $this->stdWrap($theValue,$conf['file.']);
03892
03893 return $this->stdWrap($icon.$file.$size, $conf['stdWrap.']);
03894 }
03895 }
03896
03907 function locDataJU($jumpUrl,$conf) {
03908 $fI = pathinfo($jumpUrl);
03909 $mimetype='';
03910 if ($fI['extension']) {
03911 $mimeTypes = t3lib_div::trimExplode(',',$conf['mimeTypes'],1);
03912 reset($mimeTypes);
03913 while(list(,$v)=each($mimeTypes)) {
03914 $parts = explode('=',$v,2);
03915 if (strtolower($fI['extension']) == strtolower(trim($parts[0]))) {
03916 $mimetype = '&mimeType='.rawurlencode(trim($parts[1]));
03917 }
03918 }
03919 }
03920 $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord;
03921 $rec='&locationData='.rawurlencode($locationData);
03922 $hArr = array(
03923 $jumpUrl,
03924 $locationData,
03925 $GLOBALS['TSFE']->TYPO3_CONF_VARS['SYS']['encryptionKey']
03926 );
03927 $juHash='&juHash='.t3lib_div::shortMD5(serialize($hArr));
03928 return '&juSecure=1'.$mimetype.$rec.$juHash;
03929 }
03930
03938 function calc($val) {
03939 $parts= t3lib_div::splitCalc($val,'+-*/');
03940 $value=0;
03941 reset($parts);
03942 while(list(,$part)=each($parts)) {
03943 $theVal = $part[1];
03944 $sign = $part[0];
03945 if ((string)intval($theVal)==(string)$theVal) {
03946 $theVal = intval($theVal);
03947 } else {
03948 $theVal =0;
03949 }
03950 if ($sign=='-') {$value-=$theVal;}
03951 if ($sign=='+') {$value+=$theVal;}
03952 if ($sign=='/') {if (intval($theVal)) $value/=intval($theVal);}
03953 if ($sign=='*') {$value*=$theVal;}
03954 }
03955 return $value;
03956 }
03957
03967 function calcIntExplode($delim, $string) {
03968 $temp = explode($delim,$string);
03969 while(list($key,$val)=each($temp)) {
03970 $temp[$key]=intval(tslib_cObj::calc($val));
03971 }
03972 return $temp;
03973 }
03974
03987 function splitObj($value, $conf) {
03988 $conf['token']=$this->stdWrap($conf['token'],$conf['token.']);
03989 if (!$conf['token']) {
03990 return $value;
03991 }
03992 $conf['max']=intval($this->stdWrap($conf['max'],$conf['max.']));
03993 $conf['min']=intval($this->stdWrap($conf['min'],$conf['min.']));
03994
03995 $valArr=explode($conf['token'],$value);
03996
03997 if (count($valArr) && ($conf['returnKey'] || $conf['returnKey.'])) {
03998 $key = intval($this->stdWrap($conf['returnKey'],$conf['returnKey.']));
03999 $content = isset($valArr[$key]) ? $valArr[$key] : '';
04000 } else {
04001
04002 $splitCount = count($valArr);
04003 if ($conf['max'] && $splitCount>$conf['max']) {
04004 $splitCount=$conf['max'];
04005 }
04006 if ($conf['min'] && $splitCount<$conf['min']) {
04007 $splitCount=$conf['min'];
04008 }
04009
04010 if ($conf['wrap'] || $conf['cObjNum']) {
04011 $splitArr=array();
04012 $splitArr['wrap']=$conf['wrap'];
04013 $splitArr['cObjNum']=$conf['cObjNum'];
04014 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$splitCount);
04015 }
04016
04017 $content='';
04018 for($a=0;$a<$splitCount;$a++) {
04019 $GLOBALS['TSFE']->register['SPLIT_COUNT']=$a;
04020 $value = ''.$valArr[$a];
04021 $this->data[$this->currentValKey] = $value;
04022 if ($splitArr[$a]['cObjNum']) {
04023 $objName=intval($splitArr[$a]['cObjNum']);
04024 $value = $this->stdWrap($this->cObjGet($conf[$objName.'.'],$objName.'.'),$conf[$objName.'.']);
04025 }
04026 if ($splitArr[$a]['wrap']) {
04027 $value=$this->wrap($value,$splitArr[$a]['wrap']);
04028 }
04029 $content.=$value;
04030 }
04031 }
04032 return $content;
04033 }
04034
04049 function parseFunc($theValue, $conf, $ref='') {
04050
04051
04052 if ($ref) {
04053 $temp_conf = array(
04054 'parseFunc' => $ref,
04055 'parseFunc.' => $conf
04056 );
04057 $temp_conf = $this->mergeTSRef($temp_conf, 'parseFunc');
04058 $conf = $temp_conf['parseFunc.'];
04059 }
04060
04061
04062 if (strcmp($conf['externalBlocks'],'')) {
04063 $tags = strtolower(implode(',',t3lib_div::trimExplode(',',$conf['externalBlocks'])));
04064 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
04065 $parts = $htmlParser->splitIntoBlock($tags,$theValue);
04066
04067 reset($parts);
04068 while(list($k,$v)=each($parts)) {
04069 if ($k%2) {
04070 $tagName=strtolower($htmlParser->getFirstTagName($v));
04071 $cfg=$conf['externalBlocks.'][$tagName.'.'];
04072 if ($cfg['stripNLprev'] || $cfg['stripNL']) {
04073 $parts[$k-1]=ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $parts[$k-1]);
04074 }
04075 if ($cfg['stripNLnext'] || $cfg['stripNL']) {
04076 $parts[$k+1]=ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $parts[$k+1]);
04077 }
04078 }
04079 }
04080
04081 reset($parts);
04082 while(list($k,$v)=each($parts)) {
04083 if ($k%2) {
04084 $tag=$htmlParser->getFirstTag($v);
04085 $tagName=strtolower($htmlParser->getFirstTagName($v));
04086 $cfg=$conf['externalBlocks.'][$tagName.'.'];
04087 if ($cfg['callRecursive']) {
04088 $parts[$k]=$this->parseFunc($htmlParser->removeFirstAndLastTag($v), $conf);
04089 if (!$cfg['callRecursive.']['dontWrapSelf']) {
04090 if ($cfg['callRecursive.']['alternativeWrap']) {
04091 $parts[$k] = $this->wrap($parts[$k], $cfg['callRecursive.']['alternativeWrap']);
04092 } else {
04093 if (is_array($cfg['callRecursive.']['tagStdWrap.'])) {
04094 $tag = $this->stdWrap($tag,$cfg['callRecursive.']['tagStdWrap.']);
04095 }
04096 $parts[$k]=$tag.$parts[$k].'</'.$tagName.'>';
04097 }
04098 }
04099 } elseif($cfg['HTMLtableCells']) {
04100 $rowParts = $htmlParser->splitIntoBlock('tr',$parts[$k]);
04101 reset($rowParts);
04102 while(list($kk,$vv)=each($rowParts)) {
04103 if ($kk%2) {
04104 $colParts = $htmlParser->splitIntoBlock('td',$vv);
04105 reset($colParts);
04106 $cc=0;
04107 while(list($kkk,$vvv)=each($colParts)) {
04108 if ($kkk%2) {
04109 $cc++;
04110 $tag=$htmlParser->getFirstTag($vvv);
04111 $tagName=strtolower($htmlParser->getFirstTagName($vvv));
04112 $colParts[$kkk] = $htmlParser->removeFirstAndLastTag($vvv);
04113
04114 if ($cfg['HTMLtableCells.'][$cc.'.']['callRecursive'] || (!isset($cfg['HTMLtableCells.'][$cc.'.']['callRecursive']) && $cfg['HTMLtableCells.']['default.']['callRecursive'])) {
04115 if ($cfg['HTMLtableCells.']['addChr10BetweenParagraphs']) $colParts[$kkk]=str_replace('</p><p>','</p>'.chr(10).'<p>',$colParts[$kkk]);
04116 $colParts[$kkk] = $this->parseFunc($colParts[$kkk], $conf);
04117 }
04118
04119 $tagStdWrap = is_array($cfg['HTMLtableCells.'][$cc.'.']['tagStdWrap.'])?$cfg['HTMLtableCells.'][$cc.'.']['tagStdWrap.']:$cfg['HTMLtableCells.']['default.']['tagStdWrap.'];
04120 if (is_array($tagStdWrap)) {
04121 $tag = $this->stdWrap($tag,$tagStdWrap);
04122 }
04123
04124 $stdWrap = is_array($cfg['HTMLtableCells.'][$cc.'.']['stdWrap.'])?$cfg['HTMLtableCells.'][$cc.'.']['stdWrap.']:$cfg['HTMLtableCells.']['default.']['stdWrap.'];
04125 if (is_array($stdWrap)) {
04126 $colParts[$kkk] = $this->stdWrap($colParts[$kkk],$stdWrap);
04127 }
04128
04129 $colParts[$kkk]=$tag.$colParts[$kkk].'</'.$tagName.'>';
04130 }
04131 }
04132 $rowParts[$kk] = implode('',$colParts);
04133 }
04134 }
04135 $parts[$k] = implode('',$rowParts);
04136 }
04137
04138 if (is_array($cfg['stdWrap.'])) {
04139 $parts[$k] = $this->stdWrap($parts[$k],$cfg['stdWrap.']);
04140 }
04141 } else {
04142 $parts[$k]=$this->_parseFunc($parts[$k], $conf);
04143 }
04144 }
04145
04146 return implode('',$parts);
04147 } else return $this->_parseFunc($theValue, $conf);
04148 }
04149
04159 function _parseFunc ($theValue, $conf) {
04160 if (!$this->checkIf($conf['if.'])) {
04161 return $theValue;
04162 }
04163 $inside=0;
04164 $pointer=0;
04165 $currentTag='';
04166 $stripNL=0;
04167 $contentAccum=array();
04168 $contentAccumP=0;
04169
04170 $allowTags=strtolower(str_replace(' ','',$conf['allowTags']));
04171 $denyTags=strtolower(str_replace(' ','',$conf['denyTags']));
04172
04173 $totalLen = strlen($theValue);
04174 do {
04175 if (!$inside) {
04176 if (!is_array($currentTag)) {
04177
04178 $len_p=0;
04179 $c=100;
04180 do {
04181 $len = strcspn(substr($theValue,$pointer+$len_p),'<');
04182 $len_p+=$len+1;
04183 $endChar = ord(strtolower(substr($theValue,$pointer+$len_p,1)));
04184 $c--;
04185 } while ($c>0 && $endChar && ($endChar<97 || $endChar>122) && $endChar!=47);
04186 $len = $len_p-1;
04187 } else {
04188
04189 $tempContent = strtolower(substr($theValue,$pointer));
04190 $len = strpos ($tempContent, '</'.$currentTag[0]);
04191 if (is_string ($len) && !$len) {
04192 $len = strlen($tempContent);
04193 }
04194 }
04195
04196 $data = substr($theValue,$pointer,$len);
04197 if ($data!='') {
04198 if ($stripNL) {
04199 $data = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $data);
04200 }
04201
04202 if (!is_array($currentTag)) {
04203
04204 if ($conf['constants'] && is_array($GLOBALS['TSFE']->tmpl->setup['constants.'])) {
04205 reset($GLOBALS['TSFE']->tmpl->setup['constants.']);
04206 while(list($key,$val)=each($GLOBALS['TSFE']->tmpl->setup['constants.'])) {
04207 if (is_string($val)) {
04208 $data = str_replace('###'.$key.'###', $val, $data);
04209 }
04210 }
04211 }
04212
04213 if (is_array($conf['short.'])) {
04214 $shortWords = $conf['short.'];
04215 krsort($shortWords);
04216 reset($shortWords);
04217 while(list($key,$val)=each($shortWords)) {
04218 if (is_string($val)) {
04219 $data = str_replace($key, $val, $data);
04220 }
04221 }
04222 }
04223
04224
04225 if (is_array($conf['plainTextStdWrap.'])) {$data = $this->stdWrap($data,$conf['plainTextStdWrap.']);}
04226
04227 if ($conf['userFunc']) {$data = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'], $data);}
04228
04229
04230 if ($conf['makelinks']) {
04231 $data = $this->http_makelinks($data,$conf['makelinks.']['http.']);
04232 $data = $this->mailto_makelinks($data,$conf['makelinks.']['mailto.']);
04233 }
04234
04235
04236 if ($GLOBALS['TSFE']->no_cache && $conf['sword'] && is_array($GLOBALS['TSFE']->sWordList) && $GLOBALS['TSFE']->sWordRegEx) {
04237 $newstring = '';
04238 do {
04239 $pieces = split($GLOBALS['TSFE']->sWordRegEx,$data,2);
04240 $newstring.=$pieces[0];
04241 $match_len = strlen($data)-(strlen($pieces[0])+strlen($pieces[1]));
04242 if (strstr($pieces[0],'<') || strstr($pieces[0],'>')) {
04243 $inTag = strrpos($pieces[0],'<') > strrpos($pieces[0],'>');
04244 }
04245
04246 $match = substr($data,strlen($pieces[0]),$match_len);
04247
04248 if (trim($match) && strlen($match)>1 && !$inTag) {
04249 $match = $this->wrap($match, $conf['sword']);
04250 }
04251
04252 $newstring.= $match;
04253 $data=$pieces[1];
04254 } while ($pieces[1]);
04255 $data = $newstring;
04256 }
04257 }
04258 $contentAccum[$contentAccumP].=$data;
04259 }
04260 $inside = 1;
04261 } else {
04262
04263 $len = strcspn(substr($theValue,$pointer),'>')+1;
04264 $data = substr($theValue,$pointer,$len);
04265
04266 $tag = explode(' ',trim(substr($data,1,-1)),2);
04267 $tag[0]=strtolower($tag[0]);
04268 if (substr($tag[0],0,1)=='/') {
04269 $tag[0]=substr($tag[0],1);
04270 $tag['out']=1;
04271 }
04272 if($conf['tags.'][$tag[0]]) {
04273 $treated=0;
04274 $stripNL = 0;
04275
04276 if (!$currentTag && !$tag['out']) {
04277 $currentTag = $tag;
04278 $contentAccumP++;
04279 $treated=1;
04280 }
04281
04282 if ($currentTag[0]==$tag[0] && $tag['out']) {
04283 $theName = $conf['tags.'][$tag[0]];
04284 $theConf = $conf['tags.'][$tag[0].'.'];
04285 $stripNL = ($theConf['stripNL'] ? 1 : 0);
04286 $breakOut = ($theConf['breakoutTypoTagContent'] ? 1 : 0);
04287
04288 $this->parameters=Array();
04289 if ($currentTag[1]) {
04290 $params=t3lib_div::get_tag_attributes($currentTag[1]);
04291 if (is_array($params)) {
04292 reset($params);
04293 while(list($option,$val)=each($params)) {
04294 $this->parameters[strtolower($option)]=$val;
04295 }
04296 }
04297 }
04298 $this->parameters['allParams']=trim($currentTag[1]);
04299 if ($stripNL) {
04300 $contentAccum[$contentAccumP-1] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP-1]);
04301 $contentAccum[$contentAccumP] = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $contentAccum[$contentAccumP]);
04302 $contentAccum[$contentAccumP] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP]);
04303 }
04304 $this->data[$this->currentValKey] = $contentAccum[$contentAccumP];
04305 $newInput=$this->cObjGetSingle($theName,$theConf,'/parseFunc/.tags.'.$tag[0]);
04306
04307 $contentAccum[$contentAccumP]=$newInput;
04308 $contentAccumP++;
04309
04310
04311 if (!$breakOut) {
04312 $contentAccum[$contentAccumP-2].=$contentAccum[$contentAccumP-1].$contentAccum[$contentAccumP];
04313 unset($contentAccum[$contentAccumP]);
04314 unset($contentAccum[$contentAccumP-1]);
04315 $contentAccumP-=2;
04316 }
04317
04318 unset($currentTag);
04319 $treated=1;
04320 }
04321
04322 if (!$treated) {
04323 $contentAccum[$contentAccumP].=$data;
04324 }
04325 } else {
04326
04327 $stripNL = 0;
04328 if (t3lib_div::inList($allowTags,$tag[0]) || ($denyTags!='*' && !t3lib_div::inList($denyTags,$tag[0]))) {
04329 $contentAccum[$contentAccumP].=$data;
04330 } else {
04331 $contentAccum[$contentAccumP].=HTMLSpecialChars($data);
04332 }
04333 }
04334 $inside = 0;
04335 }
04336 $pointer+=$len;
04337 } while($pointer<$totalLen);
04338
04339
04340 reset($contentAccum);
04341 for ($a=0;$a<count($contentAccum);$a++) {
04342 if ($a%2 != 1) {
04343
04344 if (is_array($conf['nonTypoTagStdWrap.'])) {$contentAccum[$a] = $this->stdWrap($contentAccum[$a],$conf['nonTypoTagStdWrap.']);}
04345
04346 if ($conf['nonTypoTagUserFunc']) {$contentAccum[$a] = $this->callUserFunction($conf['nonTypoTagUserFunc'], $conf['nonTypoTagUserFunc.'], $contentAccum[$a]);}
04347 }
04348 }
04349 return implode('',$contentAccum);
04350 }
04351
04361 function encaps_lineSplit($theValue, $conf) {
04362 $lParts = explode(chr(10),$theValue);
04363
04364 $encapTags = t3lib_div::trimExplode(',',strtolower($conf['encapsTagList']),1);
04365 $nonWrappedTag = $conf['nonWrappedTag'];
04366 $defaultAlign=trim($this->stdWrap($conf['defaultAlign'],$conf['defaultAlign.']));
04367
04368 if (!strcmp('',$theValue)) return '';
04369
04370 while(list($k,$l)=each($lParts)) {
04371 $sameBeginEnd=0;
04372 $l=trim($l);
04373 $attrib=array();
04374 $nWrapped=0;
04375 $byPass=0;
04376 if (substr($l,0,1)=='<' && substr($l,-1)=='>') {
04377 $fwParts = explode('>',substr($l,1),2);
04378 $backParts = t3lib_div::revExplode('<', substr($fwParts[1],0,-1), 2);
04379 $attrib = t3lib_div::get_tag_attributes('<'.$fwParts[0].'>');
04380 list($tagName) = explode(' ',$fwParts[0]);
04381 $str_content = $backParts[0];
04382 $sameBeginEnd = (substr(strtolower($backParts[1]),1,strlen($tagName))==strtolower($tagName));
04383 }
04384
04385 if ($sameBeginEnd && in_array(strtolower($tagName),$encapTags)) {
04386 $uTagName = strtoupper($tagName);
04387 $uTagName = strtoupper($conf['remapTag.'][$uTagName]?$conf['remapTag.'][$uTagName]:$uTagName);
04388 } else {
04389 $uTagName = strtoupper($nonWrappedTag);
04390 $str_content = $lParts[$k];
04391 $nWrapped=1;
04392 $attrib=array();
04393 }
04394
04395
04396 if (is_array($conf['innerStdWrap_all.'])) {$str_content = $this->stdWrap($str_content,$conf['innerStdWrap_all.']);}
04397
04398 if ($uTagName) {
04399
04400 if (is_array($conf['addAttributes.'][$uTagName.'.'])) {
04401 reset($conf['addAttributes.'][$uTagName.'.']);
04402 while(list($kk,$vv)=each($conf['addAttributes.'][$uTagName.'.'])) {
04403 if (!is_array($vv)) {
04404 if ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='blank') {
04405 if (!strcmp($attrib[$kk],'')) $attrib[$kk]=$vv;
04406 } elseif ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='exists') {
04407 if (!isset($attrib[$kk])) $attrib[$kk]=$vv;
04408 } else {
04409 $attrib[$kk]=$vv;
04410 }
04411 }
04412 }
04413 }
04414
04415 if (is_array($conf['encapsLinesStdWrap.'][$uTagName.'.'])) {$str_content = $this->stdWrap($str_content,$conf['encapsLinesStdWrap.'][$uTagName.'.']);}
04416
04417 if (!$attrib['align'] && $defaultAlign) $attrib['align']=$defaultAlign;
04418
04419 $params = t3lib_div::implodeAttributes($attrib,1);
04420 if ($conf['removeWrapping']) {
04421 $str_content=$str_content;
04422 } else {
04423 $str_content='<'.strtolower($uTagName).(trim($params)?' '.trim($params):'').'>'.$str_content.'</'.strtolower($uTagName).'>';
04424 }
04425 }
04426
04427 if ($nWrapped && $conf['wrapNonWrappedLines']) {$str_content = $this->wrap($str_content,$conf['wrapNonWrappedLines']);}
04428 $lParts[$k] = $str_content;
04429 }
04430
04431 return implode(chr(10),$lParts);
04432 }
04433
04444 function http_makelinks($data,$conf) {
04445 $aTagParams = $this->getATagParams($conf);
04446 $textpieces = explode('http:
04447 $pieces = count($textpieces);
04448 $textstr = $textpieces[0];
04449 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
04450 for($i=1; $i<$pieces; $i++) {
04451 $len=strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
04452 if (trim(substr($textstr,-1))=='' && $len) {
04453
04454 $lastChar=substr($textpieces[$i],$len-1,1);
04455 if (!ereg('[A-Za-z0-9\/#_-]',$lastChar)) {$len--;}
04456
04457 $parts[0]=substr($textpieces[$i],0,$len);
04458 $parts[1]=substr($textpieces[$i],$len);
04459
04460 $keep=$conf['keep'];
04461 $linkParts=parse_url('http:
04462 $linktxt='';
04463 if (strstr($keep,'scheme')) {
04464 $linktxt='http:
04465 }
04466 $linktxt.= $linkParts['host'];
04467 if (strstr($keep,'path')) {
04468 $linktxt.= $linkParts['path'];
04469 if (strstr($keep,'query') && $linkParts['query']) {
04470 $linktxt.= '?'.$linkParts['query'];
04471 } elseif ($linkParts['path']=='/') {
04472 $linktxt=substr($linktxt,0,-1);
04473 }
04474 }
04475 $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
04476 if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
04477 $res = '<a'.
04478 ' href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('http://'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.
04479 ($target ? ' target="'.$target.'"' : '').
04480 $aTagParams.
04481 '>';
04482 } else {
04483 $res = '<a'.
04484 ' href="http://'.htmlspecialchars($parts[0]).'"'.
04485 ($target ? ' target="'.$target.'"' : '').
04486 $aTagParams.
04487 '>';
04488 }
04489 if ($conf['ATagBeforeWrap']) {
04490 $res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
04491 } else {
04492 $res= $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
04493 }
04494 $textstr.=$res.$parts[1];
04495 } else {
04496 $textstr.='http:
04497 }
04498 }
04499 return $textstr;
04500 }
04501
04511 function mailto_makelinks($data,$conf) {
04512
04513 $aTagParams = $this->getATagParams($conf);
04514 $textpieces = explode('mailto:', $data);
04515 $pieces = count($textpieces);
04516 $textstr = $textpieces[0];
04517 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
04518 for($i=1; $i<$pieces; $i++) {
04519 $len = strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
04520 if (trim(substr($textstr,-1))=='' && $len) {
04521 $lastChar = substr($textpieces[$i],$len-1,1);
04522 if (!ereg('[A-Za-z0-9]',$lastChar)) {$len--;}
04523
04524 $parts[0] = substr($textpieces[$i],0,$len);
04525 $parts[1] = substr($textpieces[$i],$len);
04526 $linktxt = ereg_replace('\?.*','',$parts[0]);
04527 list($mailToUrl,$linktxt) = $this->getMailTo($parts[0],$linktxt,$initP);
04528 $mailToUrl = $GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii'?$mailToUrl:htmlspecialchars($mailToUrl);
04529 $res = '<a href="'.$mailToUrl.'"'.$aTagParams.'>';
04530 if ($conf['ATagBeforeWrap']) {
04531 $res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
04532 } else {
04533 $res= $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
04534 }
04535 $textstr.=$res.$parts[1];
04536 } else {
04537 $textstr.='mailto:'.$textpieces[$i];
04538 }
04539 }
04540 return $textstr;
04541 }
04542
04554 function getImgResource($file,$fileArray) {
04555 if (is_array($fileArray)) {
04556 switch($file) {
04557 case 'GIFBUILDER':
04558 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04559 $gifCreator->init();
04560 $theImage='';
04561 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
04562 $gifCreator->start($fileArray,$this->data);
04563 $theImage = $gifCreator->gifBuild();
04564 }
04565 return $gifCreator->getImageDimensions($theImage);
04566 break;
04567 default:
04568 if ($fileArray['import.']) {
04569 $ifile = $this->stdWrap('',$fileArray['import.']);
04570 if ($ifile) {$file = $fileArray['import'].$ifile;}
04571 }
04572 $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
04573 if ($theImage) {
04574 $fileArray['width']= $this->stdWrap($fileArray['width'],$fileArray['width.']);
04575 $fileArray['height']= $this->stdWrap($fileArray['height'],$fileArray['height.']);
04576 $fileArray['ext']= $this->stdWrap($fileArray['ext'],$fileArray['ext.']);
04577 $fileArray['maxW']= intval($this->stdWrap($fileArray['maxW'],$fileArray['maxW.']));
04578 $fileArray['maxH']= intval($this->stdWrap($fileArray['maxH'],$fileArray['maxH.']));
04579 $fileArray['minW']= intval($fileArray['minW']);
04580 $fileArray['minH']= intval($fileArray['minH']);
04581 $maskArray= $fileArray['m.'];
04582 $maskImages=array();
04583 if (is_array($fileArray['m.'])) {
04584 $maskImages['m_mask'] = $this->getImgResource($maskArray['mask'],$maskArray['mask.']);
04585 $maskImages['m_bgImg'] = $this->getImgResource($maskArray['bgImg'],$maskArray['bgImg.']);
04586 $maskImages['m_bottomImg'] = $this->getImgResource($maskArray['bottomImg'],$maskArray['bottomImg.']);
04587 $maskImages['m_bottomImg_mask'] = $this->getImgResource($maskArray['bottomImg_mask'],$maskArray['bottomImg_mask.']);
04588 }
04589 $hash = t3lib_div::shortMD5($theImage.serialize($fileArray).serialize($maskImages));
04590 if (!isset($GLOBALS['TSFE']->tmpl->fileCache[$hash])) {
04591 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04592 $gifCreator->init();
04593
04594 if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']) {
04595 $gifCreator->filenamePrefix = $GLOBALS['TSFE']->fileNameASCIIPrefix(ereg_replace('\.[[:alnum:]]+$','',basename($theImage)),intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']),'_');
04596 }
04597
04598 if ($fileArray['sample']) {
04599 $gifCreator->scalecmd = '-sample';
04600 $GLOBALS['TT']->setTSlogMessage('Sample option: Images are scaled with -sample.');
04601 }
04602 if ($fileArray['alternativeTempPath'] && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['allowedTempPaths'],$fileArray['alternativeTempPath'])) {
04603 $gifCreator->tempPath = $fileArray['alternativeTempPath'];
04604 $GLOBALS['TT']->setTSlogMessage('Set alternativeTempPath: '.$fileArray['alternativeTempPath']);
04605 }
04606
04607 if (!trim($fileArray['ext'])){$fileArray['ext']='web';}
04608 $options = Array();
04609 if ($fileArray['maxW']) {$options['maxW']=$fileArray['maxW'];}
04610 if ($fileArray['maxH']) {$options['maxH']=$fileArray['maxH'];}
04611 if ($fileArray['minW']) {$options['minW']=$fileArray['minW'];}
04612 if ($fileArray['minH']) {$options['minH']=$fileArray['minH'];}
04613
04614
04615 if (is_array($maskArray) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) {
04616
04617 $fI = t3lib_div::split_fileref($theImage);
04618 $imgExt = (strtolower($fI['fileext'])==$gifCreator->gifExtension ? $gifCreator->gifExtension : 'jpg');
04619 $dest = $gifCreator->tempPath.$hash.'.'.$imgExt;
04620 if (!@file_exists($dest)) {
04621 $m_mask= $maskImages['m_mask'];
04622 $m_bgImg = $maskImages['m_bgImg'];
04623 if ($m_mask && $m_bgImg) {
04624 $negate = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] ? ' -negate' : '';
04625
04626 $temp_ext='png';
04627 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_gif']) {
04628 $temp_ext=$gifCreator->gifExtension;
04629 }
04630
04631 $tempFileInfo = $gifCreator->imageMagickConvert($theImage,$temp_ext,$fileArray['width'],$fileArray['height'],$fileArray['params'],$fileArray['frame'],$options);
04632 if (is_array($tempFileInfo)) {
04633 $m_bottomImg = $maskImages['m_bottomImg'];
04634 if ($m_bottomImg) {
04635 $m_bottomImg_mask = $maskImages['m_bottomImg_mask'];
04636 }
04637
04638 $tempScale=array();
04639 $command = '-geometry '.$tempFileInfo[0].'x'.$tempFileInfo[1].'!';
04640 $tmpStr = $gifCreator->randomName();
04641
04642
04643 $tempScale['m_mask']=$tmpStr.'_mask.'.$temp_ext;
04644 $gifCreator->imageMagickExec($m_mask[3],$tempScale['m_mask'],$command.$negate);
04645
04646 $tempScale['m_bgImg']=$tmpStr.'_bgImg.'.trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
04647 $gifCreator->imageMagickExec($m_bgImg[3],$tempScale['m_bgImg'],$command);
04648
04649
04650 if ($m_bottomImg && $m_bottomImg_mask) {
04651 $tempScale['m_bottomImg']=$tmpStr.'_bottomImg.'.$temp_ext;
04652 $gifCreator->imageMagickExec($m_bottomImg[3],$tempScale['m_bottomImg'],$command);
04653 $tempScale['m_bottomImg_mask']=$tmpStr.'_bottomImg_mask.'.$temp_ext;
04654 $gifCreator->imageMagickExec($m_bottomImg_mask[3],$tempScale['m_bottomImg_mask'],$command.$negate);
04655
04656
04657
04658 $gifCreator->combineExec($tempScale['m_bgImg'],$tempScale['m_bottomImg'],$tempScale['m_bottomImg_mask'],$tempScale['m_bgImg']);
04659 }
04660
04661 $gifCreator->combineExec($tempScale['m_bgImg'],$tempFileInfo[3],$tempScale['m_mask'],$dest);
04662
04663 reset($tempScale);
04664 while(list(,$file)=each($tempScale)) {
04665 if (@is_file($file)) {
04666 unlink($file);
04667 }
04668 }
04669
04670 }
04671 }
04672 }
04673
04674 if (($fileArray['reduceColors'] || ($imgExt=='png' && !$gifCreateor->png_truecolor)) && is_file($dest)) {
04675 $reduced = $gifCreator->IMreduceColors($dest, t3lib_div::intInRange($fileArray['reduceColors'], 256, $gifCreator->truecolorColors, 256));
04676 if (is_file($reduced)) {
04677 unlink($dest);
04678 rename($reduced, $dest);
04679 }
04680 }
04681 $GLOBALS['TSFE']->tmpl->fileCache[$hash]= $gifCreator->getImageDimensions($dest);
04682 } else {
04683 $GLOBALS['TSFE']->tmpl->fileCache[$hash]= $gifCreator->imageMagickConvert($theImage,$fileArray['ext'],$fileArray['width'],$fileArray['height'],$fileArray['params'],$fileArray['frame'],$options);
04684 if (($fileArray['reduceColors'] || ($imgExt=='png' && !$gifCreateor->png_truecolor)) && is_file($GLOBALS['TSFE']->tmpl->fileCache[$hash][3])) {
04685 $reduced = $gifCreator->IMreduceColors($GLOBALS['TSFE']->tmpl->fileCache[$hash][3], t3lib_div::intInRange($fileArray['reduceColors'], 256, $gifCreator->truecolorColors, 256));
04686 if (is_file($reduced)) {
04687 unlink($GLOBALS['TSFE']->tmpl->fileCache[$hash][3]);
04688 rename($reduced, $GLOBALS['TSFE']->tmpl->fileCache[$hash][3]);
04689 }
04690 }
04691 }
04692 $GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile'] = $theImage;
04693 $GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile_mtime'] = @filemtime($theImage);
04694 }
04695 return $GLOBALS['TSFE']->tmpl->fileCache[$hash];
04696 }
04697
04698 break;
04699 }
04700 }
04701 $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
04702 if ($theImage) {
04703 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04704 $gifCreator->init();
04705 $info= $gifCreator->imageMagickConvert($theImage,'WEB','','','','','');
04706 $info['origFile'] = $theImage;
04707 $info['origFile_mtime'] = @filemtime($theImage);
04708 return $info;
04709 }
04710 }
04711
04712
04713
04714
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725
04726
04727
04728
04729
04730
04731
04732
04733
04734
04735
04736
04737
04738
04739
04746 function getFieldVal($field) {
04747 if (!strstr($field,'
04748 return $this->data[trim($field)];
04749 } else {
04750 $sections = t3lib_div::trimExplode('
04751 while (list(,$k)=each($sections)) {
04752 if (strcmp($this->data[$k],'')) return $this->data[$k];
04753 }
04754 }
04755 }
04756
04766 function getData($string,$fieldArray) {
04767 if (!is_array($fieldArray)) {
04768 $fieldArray=$GLOBALS['TSFE']->page;
04769 }
04770 $retVal = '';
04771 $sections = explode('
04772
04773 while (!$retVal AND list($secKey, $secVal)=each($sections)) {
04774 $parts = explode(':',$secVal,2);
04775 $key = trim($parts[1]);
04776 if ((string)$key!='') {
04777 switch(strtolower(trim($parts[0]))) {
04778 case 'gpvar':
04779 list($firstKey, $rest) = explode('|', $key, 2);
04780 if (strlen(trim($firstKey))) {
04781 $retVal = t3lib_div::_GP(trim($firstKey));
04782
04783 if (strlen(trim($rest))) {
04784 $retVal = is_array($retVal) ? $this->getGlobal($rest, $retVal) : '';
04785 }
04786
04787 if (is_array($retVal)) $retVal = '';
04788 }
04789 break;
04790 case 'tsfe':
04791 $retVal = $this->getGlobal ('TSFE|'.$key);
04792 break;
04793 case 'getenv':
04794 $retVal = getenv($key);
04795 break;
04796 case 'getindpenv':
04797 $retVal = t3lib_div::getIndpEnv($key);
04798 break;
04799 case 'field':
04800 $retVal = $fieldArray[$key];
04801 break;
04802 case 'parameters':
04803 $retVal = $this->parameters[$key];
04804 break;
04805 case 'register':
04806 $retVal = $GLOBALS['TSFE']->register[$key];
04807 break;
04808 case 'global':
04809 $retVal = $this->getGlobal($key);
04810 break;
04811 case 'leveltitle':
04812 $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04813 $retVal = $this->rootLineValue($nkey,'title',stristr($key,'slide'));
04814 break;
04815 case 'levelmedia':
04816 $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04817 $retVal = $this->rootLineValue($nkey,'media',stristr($key,'slide'));
04818 break;
04819 case 'leveluid':
04820 $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04821 $retVal = $this->rootLineValue($nkey,'uid',stristr($key,'slide'));
04822 break;
04823 case 'levelfield':
04824 $keyP = t3lib_div::trimExplode(',',$key);
04825 $nkey = $this->getKey($keyP[0],$GLOBALS['TSFE']->tmpl->rootLine);
04826 $retVal = $this->rootLineValue($nkey,$keyP[1],strtolower($keyP[2])=='slide');
04827 break;
04828 case 'fullrootline':
04829 $keyP = t3lib_div::trimExplode(',',$key);
04830 $fullKey = intval($keyP[0])-count($GLOBALS['TSFE']->tmpl->rootLine)+count($GLOBALS['TSFE']->rootLine);
04831 if ($fullKey>=0) {
04832 $retVal = $this->rootLineValue($fullKey,$keyP[1],stristr($keyP[2],'slide'),$GLOBALS['TSFE']->rootLine);
04833 }
04834 break;
04835 case 'date':
04836 if (!$key) {$key = 'd/m Y';}
04837 $retVal = date($key, time());
04838 break;
04839 case 'page':
04840 $retVal = $GLOBALS['TSFE']->page[$key];
04841 break;
04842 case 'current':
04843 $retVal = $this->data[$this->currentValKey];
04844 break;
04845 case 'level':
04846 $retVal = count($GLOBALS['TSFE']->tmpl->rootLine)-1;
04847 break;
04848 case 'db':
04849 $selectParts = t3lib_div::trimExplode(':',$key);
04850 $db_rec = $GLOBALS['TSFE']->sys_page->getRawRecord($selectParts[0],$selectParts[1]);
04851 if (is_array($db_rec) && $selectParts[2]) {$retVal = $db_rec[$selectParts[2]];}
04852 break;
04853 case 'lll':
04854 $retVal = $GLOBALS['TSFE']->sL('LLL:'.$key);
04855 break;
04856 case 'path':
04857 $retVal = $GLOBALS['TSFE']->tmpl->getFileName($key);
04858 break;
04859 case 'cobj':
04860 switch((string)$key) {
04861 case 'parentRecordNumber':
04862 $retVal = $this->parentRecordNumber;
04863 break;
04864 }
04865 break;
04866 case 'debug':
04867 switch((string)$key) {
04868 case 'rootLine':
04869 $retVal = t3lib_div::view_array($GLOBALS['TSFE']->tmpl->rootLine);
04870 break;
04871 case 'fullRootLine':
04872 $retVal = t3lib_div::view_array($GLOBALS['TSFE']->rootLine);
04873 break;
04874 case 'data':
04875 $retVal = t3lib_div::view_array($this->data);
04876 break;
04877 }
04878 break;
04879 }
04880 }
04881 }
04882 return $retVal;
04883 }
04884
04896 function rootLineValue($key,$field,$slideBack=0,$altRootLine='') {
04897 $rootLine = is_array($altRootLine) ? $altRootLine : $GLOBALS['TSFE']->tmpl->rootLine;
04898 if (!$slideBack) {
04899 return $rootLine[$key][$field];
04900 } else {
04901 for ($a=$key;$a>=0;$a--) {
04902 $val = $rootLine[$a][$field];
04903 if ($val) {return $val;}
04904 }
04905 }
04906 }
04907
04918 function getGlobal($var, $source=NULL) {
04919 $vars = explode('|', $var);
04920 $c = count($vars);
04921 $k = trim($vars[0]);
04922 $theVar = isset($source) ? $source[$k] : $GLOBALS[$k];
04923
04924 for ($a=1;$a<$c;$a++) {
04925 if (!isset($theVar)) { break; }
04926
04927 $key = trim($vars[$a]);
04928 if (is_object($theVar)) {
04929 $theVar = $theVar->$key;
04930 } elseif (is_array($theVar)) {
04931 $theVar = $theVar[$key];
04932 } else {
04933 return '';
04934 }
04935 }
04936
04937 if (!is_array($theVar) && !is_object($theVar)) {
04938 return $theVar;
04939 } else {
04940 return '';
04941 }
04942 }
04943
04954 function getKey($key,$arr) {
04955 $key = intval($key);
04956 if (is_array($arr)) {
04957 if ($key < 0) {
04958 $key = count($arr)+$key;
04959 }
04960 if ($key < 0) {
04961 $key=0;
04962 }
04963 }
04964 return $key;
04965 }
04966
04967
04977 function TCAlookup($inputValue,$conf) {
04978 global $TCA;
04979
04980 $table = $conf['table'];
04981 $field = $conf['field'];
04982 $delimiter = $conf['delimiter']?$conf['delimiter']:' ,';
04983
04984 $GLOBALS['TSFE']->includeTCA();
04985
04986 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field]) && is_array($TCA[$table]['columns'][$field]['config']['items'])) {
04987 $values = t3lib_div::trimExplode(',',$inputValue);
04988 foreach ($values as $value) {
04989
04990 reset($TCA[$table]['columns'][$field]['config']['items']);
04991 while(list($key,$item)=each($TCA[$table]['columns'][$field]['config']['items'])) {
04992
04993 if (!strcmp($item[1],trim($value))) $output[] = $GLOBALS['TSFE']->sL($item[0]);
04994 }
04995 }
04996 $returnValue = implode($delimiter,$output);
04997 } else {
04998 $returnValue = $inputValue;
04999 }
05000 return $returnValue;
05001 }
05002
05003
05004
05005
05006
05007
05008
05009
05010
05011
05012
05013
05014
05015
05016
05017
05018
05019
05020
05021
05022
05023
05037 function typoLink($linktxt, $conf) {
05038 $finalTagParts = array();
05039 $finalTagParts['aTagParams'] = $this->getATagParams($conf);
05040
05041 $link_param = trim($this->stdWrap($conf['parameter'],$conf['parameter.']));
05042
05043 $sectionMark = trim($this->stdWrap($conf['section'],$conf['section.']));
05044 $sectionMark = $sectionMark ? (t3lib_div::testInt($sectionMark)?'#c':'#').$sectionMark : '';
05045 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
05046 $this->lastTypoLinkUrl = '';
05047 $this->lastTypoLinkTarget = '';
05048 if ($link_param) {
05049 $link_paramA = t3lib_div::unQuoteFilenames($link_param,true);
05050
05051
05052 list($linkHandlerKeyword,$linkHandlerValue) = explode(':',trim($link_paramA[0]),2);
05053 if ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][$linkHandlerKeyword] && strcmp($linkHandlerValue,"")) {
05054 $linkHandlerObj = &t3lib_div::getUserObj($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][$linkHandlerKeyword]);
05055 return $linkHandlerObj->main($linktxt, $conf, $linkHandlerKeyword, $linkHandlerValue, $link_param, $this);
05056 }
05057
05058 $link_param = trim($link_paramA[0]);
05059 $linkClass = trim($link_paramA[2]);
05060 if ($linkClass=='-') $linkClass = '';
05061 $forceTarget = trim($link_paramA[1]);
05062 $forceTitle = trim($link_paramA[3]);
05063 if ($forceTarget=='-') $forceTarget = '';
05064
05065 $JSwindowParts = array();
05066 $JSwindowParams = '';
05067 $onClick = '';
05068 if ($forceTarget && ereg('^([0-9]+)x([0-9]+)(:(.*)|.*)$',$forceTarget,$JSwindowParts)) {
05069
05070 $JSwindow_tempParamsArr = t3lib_div::trimExplode(',',strtolower($conf['JSwindow_params'].','.$JSwindowParts[4]),1);
05071 $JSwindow_paramsArr=array();
05072 foreach($JSwindow_tempParamsArr as $