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
00219
00220 require_once(PATH_t3lib."class.t3lib_parsehtml.php");
00221
00222
00223 if(t3lib_extMgm::isLoaded('obts')) {
00224 require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php');
00225 }
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00257 class tslib_cObj {
00258 var $align = Array ('center', 'right', 'left');
00259
00270 var $image_compression = Array(
00271 10 => Array('params'=>'', 'ext'=>'gif'),
00272 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
00273 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
00274 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
00275 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
00276 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
00277
00278 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
00279 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
00280 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
00281 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
00282 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
00283 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
00284 39 => Array('params'=>'', 'ext'=>'png'),
00285
00286 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
00287 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
00288 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
00289 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
00290 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
00291 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
00292 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
00293 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
00294 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
00295 );
00296
00302 var $image_effects = Array(
00303 1 => '-rotate 90',
00304 2 => '-rotate 270',
00305 3 => '-rotate 180',
00306 10 => '-colorspace GRAY',
00307 11 => '-sharpen 70',
00308 20 => '-normalize',
00309 23 => '-contrast',
00310 25 => '-gamma 1.3',
00311 26 => '-gamma 0.8'
00312 );
00313
00321 var $data = Array();
00322 var $oldData = Array();
00323 var $alternativeData ='';
00324 var $parameters = Array();
00325 var $currentValKey = 'currentValue_kidjls9dksoje';
00326 var $currentRecord = '';
00327 var $currentRecordTotal = 0;
00328 var $currentRecordNumber = 0;
00329 var $parentRecordNumber = 0;
00330 var $parentRecord = array();
00331 var $regObj;
00332
00333
00334 var $INT_include=0;
00335 var $checkPid_cache = Array();
00336 var $checkPid_badDoktypeList = '255';
00337 var $lastTypoLinkUrl='';
00338 var $lastTypoLinkTarget='';
00339 var $substMarkerCache=array();
00340 var $recordRegister=array();
00341
00351 function start($data,$table='') {
00352 $this->data = $data;
00353 $this->currentRecord = $table ? $table.':'.$this->data['uid'] : '';
00354 $this->parameters = Array();
00355 }
00356
00366 function setParent($data,$currentRecord) {
00367 $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord);
00368 }
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00391 function getCurrentVal() {
00392 return $this->data[$this->currentValKey];
00393 }
00394
00402 function setCurrentVal($value) {
00403 $this->data[$this->currentValKey] = $value;
00404 }
00405
00415 function cObjGet($setup,$addKey='') {
00416 if (is_array($setup)) {
00417 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
00418 $content ='';
00419 foreach($sKeyArray as $theKey) {
00420 $theValue=$setup[$theKey];
00421 if (intval($theKey) && !strstr($theKey,'.')) {
00422 $conf=$setup[$theKey.'.'];
00423 $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey);
00424 }
00425 }
00426 return $content;
00427 }
00428 }
00429
00439 function cObjGetSingle($name,$conf,$TSkey='__') {
00440 $content='';
00441
00442 $GLOBALS['TSFE']->cObjectDepthCounter--;
00443 if ($GLOBALS['TSFE']->cObjectDepthCounter>0) {
00444 $name = trim($name);
00445 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name);
00446
00447
00448 if (substr($name,0,1)=='<') {
00449 $key = trim(substr($name,1));
00450 $cF = t3lib_div::makeInstance('t3lib_TSparser');
00451
00452 $old_conf=$conf;
00453 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
00454 if (is_array($old_conf) && count($old_conf)) {
00455 $conf = $this->joinTSarrays($conf,$old_conf);
00456
00457 }
00458
00459 $GLOBALS['TT']->incStackPointer();
00460 $content.=$this->cObjGetSingle($name,$conf,$key);
00461 $GLOBALS['TT']->decStackPointer();
00462 } else {
00463
00464
00465 if(t3lib_extMgm::isLoaded('obts') && isset($GLOBALS['OBTS']['tso_list'][$name])) {
00466 $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this);
00467 } else {
00468
00469 switch($name) {
00470 case 'COBJ_ARRAY':
00471 case 'COA':
00472 $content.=$this->COBJ_ARRAY($conf);
00473 break;
00474 case 'COA_INT':
00475 $content.=$this->COBJ_ARRAY($conf,'INT');
00476 break;
00477 case 'HTML':
00478 $content.=$this->HTML($conf);
00479 break;
00480 case 'TEXT':
00481 $content.=$this->TEXT($conf);
00482 break;
00483 case 'CLEARGIF':
00484 $content.=$this->CLEARGIF($conf);
00485 break;
00486 case 'FILE':
00487 $content.=$this->FILE($conf);
00488 break;
00489 case 'IMAGE':
00490 $content.=$this->IMAGE($conf);
00491 break;
00492 case 'IMG_RESOURCE':
00493 $content.=$this->IMG_RESOURCE($conf);
00494 break;
00495 case 'IMGTEXT':
00496 $content.=$this->IMGTEXT($conf);
00497 break;
00498 case 'CONTENT':
00499 $content.=$this->CONTENT($conf);
00500 break;
00501 case 'RECORDS':
00502 $content.=$this->RECORDS($conf);
00503 break;
00504 case 'HMENU':
00505 $content.=$this->HMENU($conf);
00506 break;
00507 case 'CTABLE':
00508 $content.=$this->CTABLE($conf);
00509 break;
00510 case 'OTABLE':
00511 $content.=$this->OTABLE($conf);
00512 break;
00513 case 'COLUMNS':
00514 $content.=$this->COLUMNS($conf);
00515 break;
00516 case 'HRULER':
00517 $content.=$this->HRULER($conf);
00518 break;
00519 case 'CASE':
00520 $content.=$this->CASEFUNC($conf);
00521 break;
00522 case 'LOAD_REGISTER':
00523 case 'RESTORE_REGISTER':
00524 $this->LOAD_REGISTER($conf,$name);
00525 break;
00526 case 'FORM':
00527 $content.=$this->FORM($conf);
00528 break;
00529 case 'SEARCHRESULT':
00530 $content.=$this->SEARCHRESULT($conf);
00531 break;
00532 case 'PHP_SCRIPT':
00533 $content.=$this->PHP_SCRIPT($conf);
00534 break;
00535 case 'PHP_SCRIPT_EXT':
00536 $content.=$this->PHP_SCRIPT($conf,'EXT');
00537 break;
00538 case 'PHP_SCRIPT_INT':
00539 $content.=$this->PHP_SCRIPT($conf,'INT');
00540 break;
00541 case 'USER':
00542 $content.=$this->USER($conf);
00543 break;
00544 case 'USER_INT':
00545 $content.=$this->USER($conf,'INT');
00546 break;
00547 case 'TEMPLATE':
00548 $content.=$this->TEMPLATE($conf);
00549 break;
00550 case 'EDITPANEL':
00551 if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);}
00552 break;
00553 case 'MULTIMEDIA':
00554 $content.=$this->MULTIMEDIA($conf);
00555 break;
00556 }
00557 }
00558 }
00559 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content);
00560 }
00561
00562 $GLOBALS['TSFE']->cObjectDepthCounter++;
00563 return $content;
00564 }
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00585 function HTML($conf) {
00586 return $this->stdWrap($conf['value'],$conf['value.']);
00587 }
00588
00596 function TEXT($conf) {
00597 return $this->stdWrap($conf['value'],$conf);
00598 }
00599
00607 function CLEARGIF($conf) {
00608 $w = $this->stdWrap($conf['width'],$conf['width.']);
00609 $h = $this->stdWrap($conf['height'],$conf['height.']);
00610 $w = $w ? $w : 1;
00611 $h = $h ? $h : 1;
00612 $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />';
00613 $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap);
00614
00615 return $this->stdWrap($theValue,$conf['stdWrap.']);
00616 }
00617
00626 function COBJ_ARRAY($conf,$ext='') {
00627 $content='';
00628 switch($ext) {
00629 case 'INT':
00630 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00631 $content.='<!--'.$substKey.'-->';
00632 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00633 'file'=>$incFile,
00634 'conf'=>$conf,
00635 'cObj'=>serialize($this),
00636 'type'=>'COA'
00637 );
00638 break;
00639 default:
00640 if ($this->checkIf($conf['if.'])) {
00641 $content=$this->cObjGet($conf);
00642 if ($conf['wrap']) {
00643 $content=$this->wrap($content, $conf['wrap']);
00644 }
00645 if ($conf['stdWrap.']) {
00646 $content=$this->stdWrap($content, $conf['stdWrap.']);
00647 }
00648 }
00649 break;
00650 }
00651 return $content;
00652 }
00653
00662 function USER($conf,$ext='') {
00663 $content='';
00664 switch($ext) {
00665 case 'INT':
00666 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00667 $content.='<!--'.$substKey.'-->';
00668 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00669 'file' => $incFile,
00670 'conf' => $conf,
00671 'cObj' => serialize($this),
00672 'type' => 'FUNC'
00673 );
00674 break;
00675 default:
00676 $content.=$this->callUserFunction($conf['userFunc'],$conf,'');
00677 break;
00678 }
00679 return $content;
00680 }
00681
00689 function FILE($conf) {
00690 $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf)));
00691 if ($conf['linkWrap']) {
00692 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
00693 }
00694 return $this->wrap($theValue,$conf['wrap']);
00695 }
00696
00705 function IMAGE($conf) {
00706 $content='';
00707 if ($this->checkIf($conf['if.'])) {
00708 $theValue = $this->cImage($conf['file'],$conf);
00709 if ($conf['stdWrap.']) {
00710 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
00711 }
00712 return $theValue;
00713 }
00714 }
00715
00724 function IMG_RESOURCE($conf) {
00725 $imgArray = $this->getImgResource($conf['file'],$conf['file.']);
00726 return $this->stdWrap($imgArray[3],$conf['stdWrap.']);
00727 }
00728
00736 function IMGTEXT($conf) {
00737 $content='';
00738 if (is_array($conf['text.'])) {
00739 $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']);
00740 }
00741 $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.']));
00742 if ($imgList) {
00743 $imgs = t3lib_div::trimExplode(',',$imgList);
00744 $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
00745
00746 $imgCount= count($imgs)-$imgStart;
00747
00748 $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
00749 if ($imgMax) {
00750 $imgCount = t3lib_div::intInRange($imgCount,0,$conf['imgMax']);
00751 }
00752
00753 $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
00754
00755
00756 $caption='';
00757 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
00758 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);
00759 }
00760
00761 $tablecode='';
00762 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
00763
00764 $tmppos = $position&7;
00765 $contentPosition = $position&24;
00766 $align = $this->align[$tmppos];
00767 $cap = ($caption)?1:0;
00768 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
00769 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
00770 $txtMarg=0;
00771 }
00772
00773 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
00774 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
00775 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
00776 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
00777
00778 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
00779 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
00780 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
00781
00782 $borderColor=$borderColor?$borderColor:'black';
00783 $borderThickness=$borderThickness?$borderThickness:1;
00784
00785 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
00786 if (!$caption_align) {
00787 $caption_align = $align;
00788 }
00789
00790 $colCount = ($cols > 1) ? $cols : 1;
00791 if ($colCount > $imgCount) {$colCount = $imgCount;}
00792 $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
00793
00794 if ($rows>1) {
00795 $rowCount = $rows;
00796 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
00797 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00798 }
00799
00800
00801 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
00802 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
00803
00804 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00805 if (!$maxWInText) {
00806 $maxWInText = round($maxW/100*50);
00807 }
00808
00809 if ($maxWInText && $contentPosition>=16) {
00810 $maxW = $maxWInText;
00811 }
00812
00813 if ($maxW && $colCount > 0) {
00814
00815
00816
00817
00818
00819 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
00820 }
00821
00822 $colMaxW = Array();
00823 if ($colRelations) {
00824 $rel_parts = explode(':',$colRelations);
00825 $rel_total = 0;
00826 for ($a=0;$a<$colCount;$a++) {
00827 $rel_parts[$a] = intval($rel_parts[$a]);
00828 $rel_total+= $rel_parts[$a];
00829 }
00830 if ($rel_total) {
00831 for ($a=0;$a<$colCount;$a++) {
00832 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
00833 }
00834 if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) {
00835 $colMaxW = Array();
00836 }
00837 }
00838 }
00839 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
00840 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
00841 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00842
00843
00844 $splitArr=array();
00845 $splitArr['imgObjNum']=$conf['imgObjNum'];
00846 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
00847
00848
00849 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
00850 if ($equalHeight) {
00851 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00852 $gifCreator->init();
00853 $relations = Array();
00854 $relations_cols = Array();
00855 $totalMaxW = $maxW*$colCount;
00856 for($a=0;$a<$imgCount;$a++) {
00857 $imgKey = $a+$imgStart;
00858 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00859 $relations[$a] = $imgInfo[1] / $equalHeight;
00860 if ($relations[$a]) {
00861 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a];
00862 }
00863 }
00864 }
00865
00866 $imageRowsFinalWidths = Array();
00867 $imageRowsMaxHeights = Array();
00868 $imgsTag=array();
00869 $origImages=array();
00870 for($a=0;$a<$imgCount;$a++) {
00871 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
00872
00873 $imgKey = $a+$imgStart;
00874 $totalImagePath = $imgPath.$imgs[$imgKey];
00875 $this->data[$this->currentValKey] = $totalImagePath;
00876 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00877 $imgConf = $conf[$imgObjNum.'.'];
00878
00879 if ($equalHeight) {
00880 $scale = 1;
00881 if ($totalMaxW) {
00882 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
00883 if ($rowTotalMaxW > $totalMaxW) {
00884 $scale = $rowTotalMaxW / $totalMaxW;
00885 }
00886 }
00887
00888 $imgConf['file.']['height'] = round($equalHeight/$scale);
00889
00890 unset($imgConf['file.']['width']);
00891 unset($imgConf['file.']['maxW']);
00892 unset($imgConf['file.']['maxH']);
00893 unset($imgConf['file.']['minW']);
00894 unset($imgConf['file.']['minH']);
00895 unset($imgConf['file.']['width.']);
00896 unset($imgConf['file.']['maxW.']);
00897 unset($imgConf['file.']['maxH.']);
00898 unset($imgConf['file.']['minW.']);
00899 unset($imgConf['file.']['minH.']);
00900 $maxW = 0;
00901 }
00902
00903 if ($maxW) {
00904 if (count($colMaxW)) {
00905 $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
00906 } else {
00907 $imgConf['file.']['maxW'] = $maxW;
00908 }
00909 }
00910
00911
00912 if (is_array($imgConf)) {
00913 if ($this->image_effects[$image_effects]) {
00914 $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
00915 }
00916 if ($image_frames) {
00917 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
00918 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00919 }
00920 }
00921 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
00922 if ($image_compression==1) {
00923 $tempImport = $imgConf['file.']['import'];
00924 $tempImport_dot = $imgConf['file.']['import.'];
00925 unset($imgConf['file.']);
00926 $imgConf['file.']['import'] = $tempImport;
00927 $imgConf['file.']['import.'] = $tempImport_dot;
00928 } elseif (isset($this->image_compression[$image_compression])) {
00929 $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
00930 $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
00931 unset($imgConf['file.']['ext.']);
00932 }
00933 }
00934
00935
00936 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
00937 $imgConf['altText'] = $conf['altText'];
00938 $imgConf['altText.'] = $conf['altText.'];
00939 }
00940 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
00941 $imgConf['titleText'] = $conf['titleText'];
00942 $imgConf['titleText.'] = $conf['titleText.'];
00943 }
00944 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
00945 $imgConf['longdescURL'] = $conf['longdescURL'];
00946 $imgConf['longdescURL.'] = $conf['longdescURL.'];
00947 }
00948 } else {
00949 $imgConf = array(
00950 'altText' => $conf['altText'],
00951 'titleText' => $conf['titleText'],
00952 'longdescURL' => $conf['longdescURL'],
00953 'file' => $totalImagePath
00954 );
00955 }
00956
00957 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
00958
00959
00960 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
00961
00962 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00963 if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
00964 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
00965 }
00966 }
00967
00968
00969 $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
00970
00971
00972 $index=$imgStart;
00973
00974 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
00975 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
00976 if ($noRows) {$noCols=0;}
00977 if ($equalHeight) {
00978 $noCols=1;
00979 $noRows=0;
00980 }
00981
00982 $rowCount_temp=1;
00983 $colCount_temp=$colCount;
00984 if ($noRows) {
00985 $rowCount_temp = $rowCount;
00986 $rowCount=1;
00987 }
00988 if ($noCols) {
00989 $colCount=1;
00990 }
00991
00992 $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
00993 $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
00994
00995
00996
00997 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
00998
00999
01000 $tablecode='';
01001 $flag=0;
01002 if ($conf['noStretchAndMarginCells']!=1) {
01003 $tablecode.='<tr>';
01004 if ($txtMarg && $align=='right') {
01005 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01006 $editIconsHTML='';
01007 $flag=1;
01008 }
01009 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
01010 if ($txtMarg && $align=='left') {
01011 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01012 $editIconsHTML='';
01013 $flag=1;
01014 }
01015 if ($flag) $tableWidth+=$txtMarg+1;
01016
01017 $tablecode.='</tr>';
01018 }
01019
01020
01021 for ($c=0;$c<$rowCount;$c++) {
01022 if ($c && $rowspacing) {
01023 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
01024 }
01025 $tablecode.='<tr>';
01026 for ($b=0; $b<$colCount_temp; $b++) {
01027 if ($b && $colspacing) {
01028 if (!$noCols) {
01029 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
01030 } else {
01031 $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="" />';
01032 $colSpacer='<td valign="top">'.$colSpacer.'</td>';
01033 $tablecode.=$colSpacer;
01034 }
01035 }
01036 if (!$noCols || ($noCols && !$b)) {
01037 $tablecode.='<td valign="top">';
01038 if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}
01039 }
01040 for ($a=0;$a<$rowCount_temp;$a++) {
01041 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;
01042 $imgIndex = $index+$a*$colCount_temp;
01043 if ($imgsTag[$imgIndex]) {
01044 if ($rowspacing && $noRows && $a) {
01045 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
01046 }
01047 if ($conf['captionSplit'] || $conf['imageTextSplit']) {
01048 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
01049 }
01050 $imageHTML = $imgsTag[$imgIndex].'<br />';
01051 $Talign = (!trim($thisCaption) && !$noRows && !$conf['netprintApplicationLink']) ? ' align="left"' : '';
01052 if ($border) {$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}
01053 $imageHTML.=$editIconsHTML; $editIconsHTML='';
01054 if ($conf['netprintApplicationLink']) {$imageHTML = $this->netprintApplication_offsiteLinkWrap($imageHTML,$origImages[$imgIndex],$conf['netprintApplicationLink.']);}
01055 $imageHTML.=$thisCaption;
01056 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';}
01057 $tablecode.=$imageHTML;
01058 }
01059 }
01060 $index++;
01061 if (!$noCols || ($noCols && $b+1==$colCount_temp)) {
01062 if ($noCols) {$tablecode.='</tr></table>';}
01063 $tablecode.='</td>';
01064 }
01065 }
01066 $tablecode.='</tr>';
01067 }
01068 if ($c) {
01069 switch ($contentPosition) {
01070 case '0':
01071 case '8':
01072 switch ($align) {
01073 case 'center':
01074 $table_align = 'margin-left: auto; margin-right: auto';
01075 break;
01076 case 'right':
01077 $table_align = 'margin-left: auto; margin-right: 0px';
01078 break;
01079 default:
01080 $table_align = 'margin-left: 0px; margin-right: auto';
01081 }
01082 $table_align = 'style="'.$table_align.'"';
01083 break;
01084 case '16':
01085 $table_align = 'align="'.$align.'"';
01086 break;
01087 default:
01088 $table_align = '';
01089 }
01090
01091
01092 $tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
01093 if ($editIconsHTML) {
01094 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
01095 $editIconsHTML='';
01096 }
01097 if ($cap) {
01098 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
01099 }
01100 $tablecode.='</table>';
01101 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
01102 }
01103
01104 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
01105 switch ($contentPosition) {
01106 case '0':
01107 $output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
01108 break;
01109 case '8':
01110 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
01111 break;
01112 case '16':
01113 $output= $tablecode.$content;
01114 break;
01115 case '24':
01116 $theResult = '';
01117 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
01118 if ($align=='right') {
01119 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
01120 } else {
01121 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
01122 }
01123 $theResult.= '</tr></table>';
01124 $output= $theResult;
01125 break;
01126 }
01127 } else {
01128 $output= $content;
01129 }
01130
01131 if ($conf['stdWrap.']) {
01132 $output = $this->stdWrap($output, $conf['stdWrap.']);
01133 }
01134
01135 return $output;
01136 }
01137
01145 function CONTENT($conf) {
01146 $theValue='';
01147
01148 $originalRec = $GLOBALS['TSFE']->currentRecord;
01149 if ($originalRec) {
01150 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01151 }
01152
01153 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_') {
01154
01155 $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];
01156 $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
01157 $renderObjConf = $conf['renderObj.'];
01158
01159 $slide = intval($conf['slide'])?intval($conf['slide']):0;
01160 $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;
01161 $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;
01162 $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;
01163 $again = false;
01164
01165 do {
01166 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
01167 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
01168 $GLOBALS['TT']->setTSlogMessage($error,3);
01169 } else {
01170 $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01171 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
01172 $cObj =t3lib_div::makeInstance('tslib_cObj');
01173 $cObj->setParent($this->data,$this->currentRecord);
01174 $this->currentRecordNumber=0;
01175 $cobjValue = '';
01176 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01177
01178
01179 $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);
01180
01181
01182 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01183 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01184 }
01185
01186 if (is_array($row)) {
01187 if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {
01188 $this->currentRecordNumber++;
01189 $cObj->parentRecordNumber = $this->currentRecordNumber;
01190 $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
01191 $this->lastChanged($row['tstamp']);
01192 $cObj->start($row,$conf['table']);
01193 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01194 $cobjValue .= $tmpValue;
01195 }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
01196 }
01197 }
01198 }
01199 if ($slideCollectReverse) {
01200 $theValue = $cobjValue.$theValue;
01201 } else {
01202 $theValue .= $cobjValue;
01203 }
01204 if ($slideCollect>0) {
01205 $slideCollect--;
01206 }
01207 if ($slide) {
01208 if ($slide>0) {
01209 $slide--;
01210 }
01211 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
01212 $again = strlen($conf['select.']['pidInList'])?true:false;
01213 }
01214 } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));
01215 }
01216
01217 $theValue = $this->wrap($theValue,$conf['wrap']);
01218 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01219
01220 $GLOBALS['TSFE']->currentRecord = $originalRec;
01221 return $theValue;
01222 }
01223
01231 function RECORDS($conf) {
01232 $theValue='';
01233
01234 $originalRec = $GLOBALS['TSFE']->currentRecord;
01235 if ($originalRec) {
01236 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01237 }
01238
01239 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
01240 if ($conf['tables'] && $conf['source']) {
01241 $allowedTables = $conf['tables'];
01242 if (is_array($conf['conf.'])) {
01243 reset($conf['conf.']);
01244 while(list($k)=each($conf['conf.'])) {
01245 if (substr($k,-1)!='.') $allowedTables.=','.$k;
01246 }
01247 }
01248
01249 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
01250 $loadDB->start($conf['source'], $allowedTables);
01251 reset($loadDB->tableArray);
01252 while(list($table,)=each($loadDB->tableArray)) {
01253 if (is_array($GLOBALS['TCA'][$table])) {
01254 $loadDB->additionalWhere[$table]=$this->enableFields($table);
01255 }
01256 }
01257 $loadDB->getFromDB();
01258
01259 reset($loadDB->itemArray);
01260 $data = $loadDB->results;
01261
01262 $cObj =t3lib_div::makeInstance('tslib_cObj');
01263 $cObj->setParent($this->data,$this->currentRecord);
01264 $this->currentRecordNumber=0;
01265 $this->currentRecordTotal = count($loadDB->itemArray);
01266 reset($loadDB->itemArray);
01267 while(list(,$val)=each($loadDB->itemArray)) {
01268 $row = $data[$val['table']][$val['id']];
01269
01270
01271 $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
01272
01273
01274 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01275 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01276 }
01277
01278 if (is_array($row)) {
01279 if (!$conf['dontCheckPid']) {
01280 $row = $this->checkPid($row['pid']) ? $row : '';
01281 }
01282 if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) {
01283 $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
01284 $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
01285 $renderObjConf = $conf['conf.'][$val['table'].'.'];
01286 $this->currentRecordNumber++;
01287 $cObj->parentRecordNumber=$this->currentRecordNumber;
01288 $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
01289 $this->lastChanged($row['tstamp']);
01290 $cObj->start($row,$val['table']);
01291 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01292 $theValue .= $tmpValue;
01293 }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
01294 }
01295 }
01296 }
01297 if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']);
01298 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01299
01300 $GLOBALS['TSFE']->currentRecord = $originalRec;
01301 return $theValue;
01302 }
01303
01311 function HMENU($conf) {
01312 $content='';
01313 if ($this->checkIf($conf['if.'])) {
01314 $cls = strtolower($conf[1]);
01315 if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses,$cls)) {
01316 if ($conf['special.']['value.']) {
01317 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
01318 }
01319 $GLOBALS['TSFE']->register['count_HMENU']++;
01320 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']=0;
01321 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
01322 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']=array();
01323
01324 $menu = t3lib_div::makeInstance('tslib_'.$cls);
01325 $menu->parent_cObj = $this;
01326 $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1);
01327 $menu->makeMenu();
01328 $content.=$menu->writeMenu();
01329 }
01330 if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']);
01331 if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']);
01332 }
01333 return $content;
01334 }
01335
01343 function CTABLE ($conf) {
01344 $controlTable = t3lib_div::makeInstance('tslib_controlTable');
01345 if ($conf['tableParams']) {
01346 $controlTable->tableParams = $conf['tableParams'];
01347 }
01348
01349 $controlTable->contentW = $conf['cWidth'];
01350
01351 if (is_array($conf['c.'])) {
01352 $controlTable->content = $this->cObjGet($conf['c.'],'c.');
01353 $controlTable->contentTDparams = isset($conf['c.']['TDParams']) ? $conf['c.']['TDParams'] : 'valign="top"';
01354 }
01355 if (is_array($conf['lm.'])) {
01356 $controlTable->lm = $this->cObjGet($conf['lm.'],'lm.');
01357 $controlTable->lmTDparams = isset($conf['lm.']['TDParams']) ? $conf['lm.']['TDParams'] : 'valign="top"';
01358 }
01359 if (is_array($conf['tm.'])) {
01360 $controlTable->tm = $this->cObjGet($conf['tm.'],'tm.');
01361 $controlTable->tmTDparams = isset($conf['tm.']['TDParams']) ? $conf['tm.']['TDParams'] : 'valign="top"';
01362 }
01363 if (is_array($conf['rm.'])) {
01364 $controlTable->rm = $this->cObjGet($conf['rm.'],'rm.');
01365 $controlTable->rmTDparams = isset($conf['rm.']['TDParams']) ? $conf['rm.']['TDParams'] : 'valign="top"';
01366 }
01367 if (is_array($conf['bm.'])) {
01368 $controlTable->bm = $this->cObjGet($conf['bm.'],'bm.');
01369 $controlTable->bmTDparams = isset($conf['bm.']['TDParams']) ? $conf['bm.']['TDParams'] : 'valign="top"';
01370 }
01371 return $controlTable->start($conf['offset'],$conf['cMargins']);
01372 }
01373
01381 function OTABLE ($conf) {
01382 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
01383 if ($conf['tableParams']) {
01384 $controlTable->tableParams = $conf['tableParams'];
01385 }
01386 return $controlTable->start($this->cObjGet($conf),$conf['offset']);
01387 }
01388
01396 function COLUMNS ($conf) {
01397 $content='';
01398 if (is_array($conf) && $this->checkIf($conf['if.'])) {
01399 $tdRowCount=0;
01400 $tableParams = $conf['tableParams'] ? ' '.$conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"';
01401 $TDparams = $conf['TDparams'] ? ' '.$conf['TDparams']:' valign="top"';
01402 $rows = t3lib_div::intInRange($conf['rows'],2,20);
01403 $totalWidth = intval($conf['totalWidth']);
01404 $columnWidth=0;
01405
01406 $totalGapWidth=0;
01407 $gapData = Array(
01408 'gapWidth' => $this->stdWrap($conf['gapWidth'],$conf['gapWidth.']),
01409 'gapBgCol' => $this->stdWrap($conf['gapBgCol'],$conf['gapBgCol.']),
01410 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'],$conf['gapLineThickness.']),
01411 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.'])
01412 );
01413 $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1);
01414 reset($gapData);
01415 while(list(,$val)=each($gapData)) {
01416 $totalGapWidth+=intval($val['gapWidth']);
01417 }
01418
01419 if ($totalWidth) {
01420 $columnWidth = ceil(($totalWidth-$totalGapWidth)/$rows);
01421 $TDparams.=' width="'.$columnWidth.'"';
01422 $tableParams.=' width="'.$totalWidth.'"';
01423 } else {
01424 $TDparams.=' width="'.floor(100/$rows).'%"';
01425 $tableParams.=' width="100%"';
01426 }
01427
01428 for ($a=1;$a<=$rows;$a++) {
01429 $tdRowCount++;
01430 $content.='<td'.$TDparams.'>';
01431 $content.=$this->cObjGetSingle($conf[$a],$conf[$a.'.'], $a);
01432 $content.='</td>';
01433 if ($a < $rows) {
01434 $gapConf = $gapData[($a-1)];
01435 $gapWidth = intval($gapConf['gapWidth']);
01436 if ($gapWidth) {
01437 $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="'.$gapConf['gapBgCol'].'"' : '';
01438 $gapLine = intval($gapConf['gapLineThickness']);
01439 if ($gapLine) {
01440 $gapSurround = t3lib_div::intInRange(($gapWidth-$gapLine)/2, 1, 1000);
01441
01442 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
01443 $tdRowCount++;
01444
01445 $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="'.$gapConf['gapLineCol'].'"' : ' bgcolor="black"';
01446 $content.='<td'.$GtdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapLine.'" height="1" alt="" title="" /></td>';
01447 $tdRowCount++;
01448
01449 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
01450 $tdRowCount++;
01451 } else {
01452 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapWidth.'" height="1" alt="" title="" /></td>';
01453 $tdRowCount++;
01454 }
01455 }
01456 }
01457 }
01458 $content='<tr>'.$content.'</tr>';
01459 $content='<table'.$tableParams.'>'.$content.'</table>';
01460 $content.=$this->cObjGetSingle($conf['after'],$conf['after.'], 'after');
01461 if ($conf['stdWrap.']) {
01462 $content = $this->stdWrap($content,$conf['stdWrap.']);
01463 }
01464 }
01465 return $content;
01466 }
01467
01475 function HRULER ($conf) {
01476 $lineThickness = t3lib_div::intInRange($this->stdWrap($conf['lineThickness'],$conf['lineThickness.']),1,50);
01477 $lineColor = $conf['lineColor'] ? $conf['lineColor'] : 'black';
01478 $spaceBefore = intval($conf['spaceLeft']);
01479 $spaceAfter = intval($conf['spaceRight']);
01480 $tableWidth = $conf['tableWidth'] ? $conf['tableWidth'] : '99%';
01481 $content='';
01482
01483 $content.='<table border="0" cellspacing="0" cellpadding="0" width="'.htmlspecialchars($tableWidth).'"><tr>';
01484 if ($spaceBefore) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceBefore.'" height="1" alt="" title="" /></td>'; }
01485 $content.='<td bgcolor="'.$lineColor.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$lineThickness.'" alt="" title="" /></td>';
01486 if ($spaceAfter) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceAfter.'" height="1" alt="" title="" /></td>'; }
01487 $content.='</tr></table>';
01488
01489 $content = $this->stdWrap($content, $conf['stdWrap.']);
01490 return $content;
01491 }
01492
01500 function CASEFUNC ($conf){
01501 $content='';
01502 if ($this->checkIf($conf['if.'])) {
01503 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
01504 $key = $this->stdWrap($conf['key'],$conf['key.']);
01505 $key = strlen($conf[$key]) ? $key : 'default';
01506 $name = $conf[$key];
01507 $theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key);
01508 if ($conf['stdWrap.']) {
01509 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01510 }
01511 return $theValue;
01512 }
01513 }
01514
01525 function LOAD_REGISTER($conf,$name) {
01526 if ($name=='RESTORE_REGISTER') {
01527 $GLOBALS['TSFE']->register = array_pop($GLOBALS['TSFE']->registerStack);
01528 } else {
01529 array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register);
01530 if (is_array($conf)) {
01531 reset($conf);
01532 while(list($theKey,$theValue)=each($conf)) {
01533 if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)])) {
01534 if (strstr($theKey,'.')) {
01535 $theKey = substr($theKey,0,-1);
01536 }
01537 $GLOBALS['TSFE']->register[$theKey] = $this->stdWrap($conf[$theKey],$conf[$theKey.'.']);
01538 }
01539 }
01540 }
01541 }
01542 return '';
01543 }
01544
01565 function FORM($conf,$formData='') {
01566 $content='';
01567 if (is_array($formData)) {
01568 $dataArr = $formData;
01569 } else {
01570 $data=$this->stdWrap($conf['data'],$conf['data.']);
01571
01572 $dataArr=array();
01573
01574 if (trim($data)) {
01575 $data = ereg_replace(chr(10),'||',$data);
01576 $dataArr = explode('||',$data);
01577 }
01578
01579 if (is_array($conf['dataArray.'])) {
01580 $sKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
01581 foreach($sKeyArray as $theKey) {
01582 $dAA = $conf['dataArray.'][$theKey.'.'];
01583 if (is_array($dAA)) {
01584 $temp=array();
01585 list($temp[0])= explode('|',$dAA['label.'] ? $this->stdWrap($dAA['label'],$dAA['label.']) : $dAA['label']);
01586 list($temp[1])= explode('|',$dAA['type']);
01587 if ($dAA['required']) {$temp[1]='*'.$temp[1];}
01588 list($temp[2])= explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']);
01589
01590 if (is_array($dAA['valueArray.'])) {
01591 reset($dAA['valueArray.']);
01592 $temp_accum = array();
01593 while(list($dAKey_vA,$dAA_vA)=each($dAA['valueArray.'])) {
01594 if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) {
01595 $temp_vA=array();
01596 list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']);
01597 if ($dAA_vA['selected']) {$temp_vA[0]='*'.$temp_vA[0];}
01598 list($temp_vA[1])= explode(',',$dAA_vA['value']);
01599 }
01600 $temp_accum[] = implode('=',$temp_vA);
01601 }
01602 $temp[2] = implode(',',$temp_accum);
01603 }
01604 list($temp[3])= explode('|',$dAA['specialEval.'] ? $this->stdWrap($dAA['specialEval'],$dAA['specialEval.']) : $dAA['specialEval']);
01605
01606
01607 $dataArr[] = implode('|',$temp);
01608 }
01609 }
01610 }
01611 }
01612
01613 $attachmentCounter = '';
01614 $hiddenfields = '';
01615 $fieldlist = Array();
01616 $propertyOverride = Array();
01617 $fieldname_hashArray = Array();
01618 $cc = 0;
01619
01620 $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype);
01621
01622 if ($conf['formName']) {
01623 $formname = $this->cleanFormName($conf['formName']);
01624 } else {
01625 $formname = $GLOBALS['TSFE']->uniqueHash();
01626 $formname = 'a'.$formname;
01627 }
01628
01629 if (isset($conf['fieldPrefix'])) {
01630 if ($conf['fieldPrefix']) {
01631 $prefix = $this->cleanFormName($conf['fieldPrefix']);
01632 } else {
01633 $prefix = '';
01634 }
01635 } else {
01636 $prefix = $formname;
01637 }
01638
01639 foreach($dataArr as $val) {
01640
01641 $cc++;
01642 $confData=Array();
01643 if (is_array($formData)) {
01644 $parts = $val;
01645 $val = 1;
01646 } else {
01647 $val = trim($val);
01648 $parts = explode('|',$val);
01649 }
01650 if ($val && strcspn($val,'#/')) {
01651
01652 $confData['label'] = trim($parts[0]);
01653
01654 $fParts = explode(',',$parts[1]);
01655 $fParts[0]=trim($fParts[0]);
01656 if (substr($fParts[0],0,1)=='*') {
01657 $confData['required']=1;
01658 $fParts[0] = substr($fParts[0],1);
01659 }
01660 $typeParts = explode('=',$fParts[0]);
01661 $confData['type'] = trim(strtolower(end($typeParts)));
01662 if (count($typeParts)==1) {
01663 $confData['fieldname'] = $this->cleanFormName($parts[0]);
01664 if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email') {$confData['fieldname']='email';}
01665
01666 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
01667 $confData['fieldname'].='_'.$cc;
01668 }
01669 $fieldname_hashArray[md5($confData['fieldname'])]=$confData['fieldname'];
01670
01671 if ($confData['type']=='file') {
01672 $confData['fieldname']='attachment'.$attachmentCounter;
01673 $attachmentCounter=intval($attachmentCounter)+1;
01674 }
01675 } else {
01676 $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0]));
01677 }
01678 $fieldCode='';
01679
01680 if ($conf['wrapFieldName']) {
01681 $confData['fieldname'] = $this->wrap($confData['fieldname'],$conf['wrapFieldName']);
01682 }
01683
01684
01685 $this->setCurrentVal($confData['fieldname']);
01686
01687
01688 if (trim($confData['type'])) {
01689 $addParams=trim($conf['params']);
01690 if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
01691 $addParams=trim($conf['params.'][$confData['type']]);
01692 }
01693 if (strcmp('',$addParams)) $addParams=' '.$addParams;
01694 } else $addParams='';
01695
01696 if ($conf['dontMd5FieldNames']) {
01697 $fName = $confData['fieldname'];
01698 } else {
01699 $fName = md5($confData['fieldname']);
01700 }
01701
01702
01703 if ($conf['accessibility'] || $xhtmlStrict) {
01704 $elementIdAttribute = ' id="'.$prefix.$fName.'"';
01705 } else {
01706 $elementIdAttribute = '';
01707 }
01708
01709
01710 switch($confData['type']) {
01711 case 'textarea':
01712 $cols=trim($fParts[1]) ? intval($fParts[1]) : 20;
01713 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
01714 $compWidth = $compWidth ? $compWidth : 1;
01715 $cols = t3lib_div::intInRange($cols*$compWidth, 1, 120);
01716
01717 $rows=trim($fParts[2]) ? t3lib_div::intInRange($fParts[2],1,30) : 5;
01718 $wrap=trim($fParts[3]);
01719 if ($conf['noWrapAttr'] || $wrap === 'disabled') {
01720 $wrap='';
01721 } else {
01722 $wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"';
01723 }
01724 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',chr(10),trim($parts[2])));
01725 $fieldCode=sprintf('<textarea name="%s"'.$elementIdAttribute.' cols="%s" rows="%s"%s'.$addParams.'>%s</textarea>',
01726 $confData['fieldname'], $cols, $rows, $wrap, t3lib_div::formatForTextarea($default));
01727 break;
01728 case 'input':
01729 case 'password':
01730 $size=trim($fParts[1]) ? intval($fParts[1]) : 20;
01731 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
01732 $compWidth = $compWidth ? $compWidth : 1;
01733 $size = t3lib_div::intInRange($size*$compWidth, 1, 120);
01734 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
01735
01736 if ($confData['type']=='password') {
01737 $default='';
01738 }
01739
01740 $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : "";
01741 $theType = $confData['type']=='input' ? 'text' : 'password';
01742
01743 $fieldCode=sprintf('<input type="'.$theType.'" name="%s"'.$elementIdAttribute.' size="%s"%s value="%s"'.$addParams.' />',
01744 $confData['fieldname'], $size, $max, htmlspecialchars($default));
01745
01746 break;
01747 case 'file':
01748 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20;
01749 $fieldCode=sprintf('<input type="file" name="%s"'.$elementIdAttribute.' size="%s"'.$addParams.' />',
01750 $confData['fieldname'], $size);
01751 break;
01752 case 'check':
01753
01754 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
01755 $checked = $default ? ' checked="checked"' : '';
01756 $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"'.$elementIdAttribute.'%s'.$addParams.' />',
01757 1, $confData['fieldname'], $checked);
01758 break;
01759 case 'select':
01760 $option='';
01761 $valueParts = explode(',',$parts[2]);
01762
01763 if (strtolower(trim($fParts[1]))=='auto') {$fParts[1]=count($valueParts);}
01764 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,20) : 1;
01765
01766 $multiple = strtolower(trim($fParts[2]))=='m' ? ' multiple="multiple"' : '';
01767
01768 $items=array();
01769 $defaults=array();
01770 for($a=0;$a<count($valueParts);$a++) {
01771 $valueParts[$a]=trim($valueParts[$a]);
01772 if (substr($valueParts[$a],0,1)=='*') {
01773 $sel='selected';
01774 $valueParts[$a] = substr($valueParts[$a],1);
01775 } else $sel='';
01776
01777 $subParts=explode('=',$valueParts[$a]);
01778 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0]));
01779 $items[] = $subParts;
01780 if ($sel) {$defaults[]=$subParts[1];}
01781 }
01782
01783 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
01784 if (!is_array($default)) {
01785 $defaults=array();
01786 $defaults[] = $default;
01787 } else $defaults=$default;
01788
01789 for($a=0;$a<count($items);$a++) {
01790 $option.='<option value="'.$items[$a][1].'"'.(in_array($items[$a][1],$defaults)?' selected="selected"':'').'>'.trim($items[$a][0]).'</option>';
01791 }
01792
01793 if ($multiple) $confData['fieldname'].='[]';
01794 $fieldCode=sprintf('<select name="%s"'.$elementIdAttribute.' size="%s"%s'.$addParams.'>%s</select>',
01795 $confData['fieldname'], $size, $multiple, $option);
01796 break;
01797 case 'radio':
01798 $option='';
01799 if ($conf['accessibility']) {
01800 $option.='<fieldset'.$elementIdAttribute.'><legend>'.$confData['label'].'</legend>';
01801 }
01802 $valueParts = explode(',',$parts[2]);
01803 $items=array();
01804 $default='';
01805 for($a=0;$a<count($valueParts);$a++) {
01806 $valueParts[$a]=trim($valueParts[$a]);
01807 if (substr($valueParts[$a],0,1)=='*') {
01808 $sel='checked';
01809 $valueParts[$a] = substr($valueParts[$a],1);
01810 } else $sel='';
01811
01812 $subParts=explode('=',$valueParts[$a]);
01813 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0]));
01814 $items[] = $subParts;
01815 if ($sel) {$default=$subParts[1];}
01816 }
01817
01818 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
01819
01820 for($a=0;$a<count($items);$a++) {
01821 $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]);
01822 if ($conf['accessibility']) {
01823 $radioLabelIdAttribute = ' id="'.$radioId.'"';
01824 } else {
01825 $radioLabelIdAttribute = '';
01826 }
01827 $option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').''.$addParams.' />';
01828 if ($conf['accessibility']) {
01829 $option .= '<label for="'.$radioId.'">' . $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) . '</label>';
01830 } else {
01831 $option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
01832 }
01833 }
01834 if ($conf['accessibility']) {
01835 $option.='</fieldset>';
01836 }
01837 $fieldCode = $option;
01838 break;
01839 case 'hidden':
01840 $value = trim($parts[2]);
01841 if(strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
01842 break;
01843 }
01844 if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname'])) {
01845 $value = $GLOBALS['TSFE']->codeString($value);
01846 }
01847 $hiddenfields.=sprintf('<input type="hidden" name="%s"'.$elementIdAttribute.' value="%s" />',
01848 $confData['fieldname'], htmlspecialchars($value));
01849 break;
01850 case 'property':
01851 if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess',$confData['fieldname'])) {
01852 $value=trim($parts[2]);
01853 $propertyOverride[$confData['fieldname']] = $value;
01854 $conf[$confData['fieldname']] = $value;
01855 }
01856 break;
01857 case 'submit':
01858 $value=trim($parts[2]);
01859 if ($conf['image.']) {
01860 $this->data[$this->currentValKey]=$value;
01861 $image=$this->IMAGE($conf['image.']);
01862 } else $image='';
01863 if($image) {
01864 $fieldCode = str_replace('<img','<input type="image"'.$addParams.' name="'.$confData['fieldname'].'"' ,$image);
01865 } else {
01866 $fieldCode=sprintf('<input type="submit" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
01867 $confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
01868 }
01869 break;
01870 case 'reset':
01871 $value=trim($parts[2]);
01872 $fieldCode=sprintf('<input type="reset" name="%s"'.$elementIdAttribute.' value="%s"'.$addParams.' />',
01873 $confData['fieldname'], t3lib_div::deHSCentities(htmlspecialchars($value)));
01874 break;
01875 case 'label':
01876 $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));
01877 break;
01878 default:
01879 $confData['type'] = 'comment';
01880 $fieldCode = trim($parts[2]).' ';
01881 break;
01882 }
01883 if ($fieldCode) {
01884
01885
01886 if (t3lib_div::inList('textarea,input,password',$confData['type']) && strlen(trim($parts[3]))) {
01887 $modeParameters = t3lib_div::trimExplode(':',$parts[3]);
01888 } else {
01889 $modeParameters = array();
01890 }
01891
01892
01893 switch((string)$modeParameters[0]) {
01894 case 'EREG':
01895 $fieldlist[] = '_EREG';
01896 $fieldlist[] = rawurlencode($modeParameters[1]);
01897 $fieldlist[] = rawurlencode($modeParameters[2]);
01898 $fieldlist[] = rawurlencode($confData['fieldname']);
01899 $fieldlist[] = rawurlencode($confData['label']);
01900 $confData['required'] = 1;
01901 break;
01902 case 'EMAIL':
01903 $fieldlist[] = '_EMAIL';
01904 $fieldlist[] = rawurlencode($confData['fieldname']);
01905 $fieldlist[] = rawurlencode($confData['label']);
01906 $confData['required'] = 1;
01907 break;
01908 default:
01909 if ($confData['required'] && $confData['type']!='check') {
01910 $fieldlist[] = rawurlencode($confData['fieldname']);
01911 $fieldlist[] = rawurlencode($confData['label']);
01912 }
01913 break;
01914 }
01915
01916
01917 $fieldLabel = $confData['label'];
01918 if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/',$confData['type'])) {
01919 $fieldLabel = '<label for="'.$prefix.$fName.'">'.$fieldLabel.'</label>';
01920 }
01921
01922
01923 $fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
01924 $labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
01925 $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']);
01926 $result = $conf['layout'];
01927 if ($conf['REQ'] && $confData['required']) {
01928 if (is_array($conf['REQ.']['fieldWrap.']))
01929 $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
01930 if (is_array($conf['REQ.']['labelWrap.']))
01931 $labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
01932 if ($conf['REQ.']['layout']) {
01933 $result = $conf['REQ.']['layout'];
01934 }
01935 }
01936 if ($confData['type']=='comment' && $conf['COMMENT.']['layout']) {
01937 $result = $conf['COMMENT.']['layout'];
01938 }
01939 if ($confData['type']=='check' && $conf['CHECK.']['layout']) {
01940 $result = $conf['CHECK.']['layout'];
01941 }
01942 if ($confData['type']=='radio' && $conf['RADIO.']['layout']) {
01943 $result = $conf['RADIO.']['layout'];
01944 }
01945 if ($confData['type']=='label' && $conf['LABEL.']['layout']) {
01946 $result = $conf['LABEL.']['layout'];
01947 }
01948 $result = str_replace('###FIELD###',$fieldCode,$result);
01949 $result = str_replace('###LABEL###',$labelCode,$result);
01950 $result = str_replace('###COMMENT###',$commentCode,$result);
01951 $content.= $result;
01952 }
01953 }
01954 }
01955 if ($conf['stdWrap.']) $content=$this->stdWrap($content, $conf['stdWrap.']);
01956
01957
01958
01959 $theRedirect = $this->stdWrap($conf['redirect'], $conf['redirect.']);
01960 $page = $GLOBALS['TSFE']->page;
01961 if (!$theRedirect) {
01962 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
01963 } elseif (t3lib_div::testInt($theRedirect)) {
01964 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
01965 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
01966 } else {
01967 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'', '', $this->getClosestMPvalueForPage($page['uid']));
01968 $LD['totalURL'] = $theRedirect;
01969 $hiddenfields.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($LD['totalURL']).'" />';
01970 }
01971
01972
01973 $formtype = $propertyOverride['type'] ? $propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']);
01974 if (t3lib_div::testInt($formtype)) {
01975 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
01976 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
01977 $action = $LD_A['totalURL'];
01978 } elseif ($formtype){
01979 $LD_A = $LD;
01980 $action = $formtype;
01981 } elseif (t3lib_div::testInt($theRedirect)) {
01982 $LD_A = $LD;
01983 $action = $LD_A['totalURL'];
01984 } else {
01985 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
01986 $action = $LD_A['totalURL'];
01987 }
01988
01989
01990 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']);
01991 if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
01992 $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
01993 $hiddenfields.='<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />';
01994 }
01995
01996
01997 if ($conf['locationData']) {
01998 if ($conf['locationData']=='HTTP_POST_VARS' && isset($_POST['locationData'])) {
01999 $locationData = t3lib_div::_POST('locationData');
02000 } else {
02001 $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord;
02002 }
02003 $hiddenfields.='<input type="hidden" name="locationData" value="'.htmlspecialchars($locationData).'" />';
02004 }
02005
02006
02007 if (is_array($conf['hiddenFields.'])) {
02008 reset($conf['hiddenFields.']);
02009 while(list($hF_key,$hF_conf) = each($conf['hiddenFields.'])) {
02010 if (substr($hF_key,-1)!='.') {
02011 $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields');
02012 if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient',$hF_key)) {
02013 if($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
02014 continue;
02015 }
02016 $hF_value = $GLOBALS['TSFE']->codeString($hF_value);
02017 }
02018 $hiddenfields.='<input type="hidden" name="'.$hF_key.'" value="'.htmlspecialchars($hF_value).'" />';
02019 }
02020 }
02021 }
02022
02023
02024 $hiddenfields = '<div style="display:none;">'.$hiddenfields.'</div>';
02025
02026 if ($conf['REQ']) {
02027 $validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\','.t3lib_div::quoteJSvalue($conf['goodMess']).','.t3lib_div::quoteJSvalue($conf['badMess']).','.t3lib_div::quoteJSvalue($conf['emailMess']).')"';
02028 $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
02029 } else $validateForm='';
02030
02031
02032 $theTarget = ($theRedirect?$LD['target']:$LD_A['target']);
02033 $content = Array(
02034 '<form'.
02035 ' action="'.htmlspecialchars($action).'"'.
02036 ' id="'.$formname.'"'.($xhtmlStrict ? '' : ' name="'.$formname.'"').
02037 ' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
02038 ' method="'.($conf['method']?$conf['method']:'post').'"'.
02039 ($theTarget ? ' target="'.$theTarget.'"' : '').
02040 $validateForm.
02041 '>',
02042 $hiddenfields.$content,
02043 '</form>'
02044 );
02045 if ($conf['arrayReturnMode']) {
02046 $content['validateForm']=$validateForm;
02047 $content['formname']=$formname;
02048 return $content;
02049 } else {
02050 return implode('',$content);
02051 }
02052 }
02053
02061 function SEARCHRESULT($conf) {
02062 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
02063 $search = t3lib_div::makeInstance('tslib_search');
02064 $search->register_and_explode_search_string(t3lib_div::_GP('sword'));
02065 $search->register_tables_and_columns(t3lib_div::_GP('scols'),$conf['allowedCols']);
02066
02067 $depth=100;
02068
02069 $theStartId=0;
02070 if (t3lib_div::testInt(t3lib_div::_GP('stype'))) {
02071 $temp_theStartId=t3lib_div::_GP('stype');
02072 $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId);
02073
02074 while(list(,$val)=each($rootLine)) {
02075 if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
02076 $theStartId=$temp_theStartId;
02077 }
02078 }
02079 } else if (t3lib_div::_GP('stype')) {
02080 if (substr(t3lib_div::_GP('stype'),0,1)=='L') {
02081 $pointer = intval(substr(t3lib_div::_GP('stype'),1));
02082 $theRootLine = $GLOBALS['TSFE']->tmpl->rootLine;
02083
02084 $locDat_arr = explode(':',t3lib_div::_POST('locationData'));
02085 $pId = intval($locDat_arr[0]);
02086 if ($pId) {
02087 $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId);
02088 ksort($altRootLine);
02089 if (count($altRootLine)) {
02090
02091 reset($altRootLine);
02092 $hitRoot=0;
02093 $theNewRoot=array();
02094 while(list(,$val)=each($altRootLine)) {
02095 if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
02096 $hitRoot=1;
02097 $theNewRoot[]=$val;
02098 }
02099 }
02100 if ($hitRoot) {
02101 $theRootLine = $theNewRoot;
02102 }
02103 }
02104 }
02105 $key = $this->getKey($pointer,$theRootLine);
02106 $theStartId = $theRootLine[$key]['uid'];
02107 }
02108 }
02109 if (!$theStartId) {
02110
02111 $theStartId = $GLOBALS['TSFE']->id;
02112 }
02113
02114 $search->pageIdList.= $this->getTreeList(-1*$theStartId,$depth);
02115
02116 $endClause = 'pages.uid IN ('.$search->pageIdList.')
02117 AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?',3,4':'').')
02118 AND pages.no_search=0'.
02119 $this->enableFields($search->fTable).
02120 $this->enableFields('pages');
02121
02122 if ($conf['languageField.'][$search->fTable]) {
02123 $endClause.= ' AND '.$search->fTable.'.'.$conf['languageField.'][$search->fTable].' = '.intval($GLOBALS['TSFE']->sys_language_uid);
02124 }
02125
02126
02127 $search->build_search_query($endClause);
02128
02129
02130 if (t3lib_div::testInt(t3lib_div::_GP('scount'))) {
02131 $search->res_count = t3lib_div::_GP('scount');
02132 } else {
02133 $search->count_query();
02134 }
02135
02136
02137 $spointer = intval(t3lib_div::_GP('spointer'));
02138 if (isset($conf['range'])) {
02139 $theRange = intval($conf['range']);
02140 } else {
02141 $theRange = 20;
02142 }
02143
02144
02145 if (!$conf['noOrderBy']) {
02146 $search->queryParts['ORDERBY'] = 'pages.lastUpdated, pages.tstamp';
02147 }
02148
02149 $search->queryParts['LIMIT'] = $spointer.','.$theRange;
02150
02151
02152 $search->execute_query();
02153 if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) {
02154 $GLOBALS['TSFE']->register['SWORD_PARAMS'] = $search->get_searchwords();
02155
02156 $total = $search->res_count;
02157 $rangeLow = t3lib_div::intInRange($spointer+1,1,$total);
02158 $rangeHigh = t3lib_div::intInRange($spointer+$theRange,1,$total);
02159
02160 $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,$conf['target'],1,'', '', $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']));
02161 $targetPart = $LD['target'] ? ' target="'.htmlspecialchars($LD['target']).'"' : '';
02162 $urlParams = $this->URLqMark($LD['totalURL'],
02163 '&sword='.rawurlencode(t3lib_div::_GP('sword')).
02164 '&scols='.rawurlencode(t3lib_div::_GP('scols')).
02165 '&stype='.rawurlencode(t3lib_div::_GP('stype')).
02166 '&scount='.$total);
02167
02168 $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout');
02169 $result = str_replace('###RANGELOW###',$rangeLow,$result);
02170 $result = str_replace('###RANGEHIGH###',$rangeHigh,$result);
02171 $result = str_replace('###TOTAL###',$total,$result);
02172
02173 if ($rangeHigh<$total) {
02174 $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next');
02175 $next = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer+$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$next.'</a>';
02176 } else $next='';
02177 $result = str_replace('###NEXT###',$next,$result);
02178
02179 if ($rangeLow>1) {
02180 $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev');
02181 $prev = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer-$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$prev.'</a>';
02182 } else $prev='';
02183 $result = str_replace('###PREV###',$prev,$result);
02184
02185
02186 $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj');
02187 $cObj = t3lib_div::makeInstance('tslib_cObj');
02188 $cObj->setParent($this->data,$this->currentRecord);
02189 $renderCode='';
02190 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result)) {
02191
02192 $cObj->start($row);
02193 $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj');
02194 }
02195 $theValue.=$this->wrap($renderCode,$conf['renderWrap']);
02196 $theValue = str_replace('###RESULT###',$theValue,$result);
02197 } else {
02198 $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj');
02199 }
02200
02201 $GLOBALS['TT']->setTSlogMessage('Search in fields: '.$search->listOfSearchFields);
02202
02203
02204 $content=$theValue;
02205 if ($conf['wrap']) {
02206 $content=$this->wrap($content, $conf['wrap']);
02207 }
02208 if ($conf['stdWrap.']) {
02209 $content=$this->stdWrap($content, $conf['stdWrap.']);
02210 }
02211
02212 $GLOBALS['TSFE']->set_no_cache();
02213 return $content;
02214 }
02215 }
02216
02227 function PHP_SCRIPT($conf,$ext='') {
02228 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
02229 $content='';
02230 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
02231 switch($ext) {
02232 case 'INT':
02233 case 'EXT':
02234 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
02235 $content.='<!--'.$substKey.'-->';
02236 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
02237 'file'=>$incFile,
02238 'conf'=>$conf,
02239 'type'=>'SCRIPT'
02240 );
02241 if ($ext=='INT') {
02242 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['cObj'] = serialize($this);
02243 } else {
02244 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['data'] = $this->data;
02245 }
02246 break;
02247 default:
02248
02249 $this->oldData = $this->data;
02250
02251 include('./'.$incFile);
02252
02253 if ($RESTORE_OLD_DATA) {
02254 $this->data = $this->oldData;
02255 }
02256 break;
02257 }
02258 }
02259 return $content;
02260 }
02261
02270 function TEMPLATE($conf) {
02271 $subparts = Array();
02272 $marks = Array();
02273 $wraps = Array();
02274 $content='';
02275
02276 list($PRE,$POST) = explode('|',$conf['markerWrap'] ? $conf['markerWrap'] : '### | ###');
02277 $POST = trim($POST);
02278 $PRE = trim($PRE);
02279
02280
02281 $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template');
02282 if ($conf['workOnSubpart']) {
02283 $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
02284 }
02285
02286
02287 if ($conf['relPathPrefix']) {
02288 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
02289 $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
02290 }
02291
02292 if ($content) {
02293 if ($conf['nonCachedSubst']) {
02294
02295 if (is_array($conf['marks.'])) {
02296 reset($conf['marks.']);
02297 while(list($theKey,$theValue)=each($conf['marks.'])) {
02298 if (!strstr($theKey,'.')) {
02299 $content = str_replace(
02300 $PRE.$theKey.$POST,
02301 $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey),
02302 $content);
02303 }
02304 }
02305 }
02306
02307
02308 if (is_array($conf['subparts.'])) {
02309 reset($conf['subparts.']);
02310 while(list($theKey,$theValue)=each($conf['subparts.'])) {
02311 if (!strstr($theKey,'.')) {
02312 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02313 if ($subpart) {
02314 $this->setCurrentVal($subpart);
02315 $content = $this->substituteSubpart(
02316 $content,
02317 $PRE.$theKey.$POST,
02318 $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey),
02319 1
02320 );
02321 }
02322 }
02323 }
02324 }
02325
02326 if (is_array($conf['wraps.'])) {
02327 reset($conf['wraps.']);
02328 while(list($theKey,$theValue)=each($conf['wraps.'])) {
02329 if (!strstr($theKey,'.')) {
02330 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02331 if ($subpart) {
02332 $this->setCurrentVal($subpart);
02333 $content = $this->substituteSubpart(
02334 $content,
02335 $PRE.$theKey.$POST,
02336 explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)),
02337 1
02338 );
02339 }
02340 }
02341 }
02342 }
02343 } else {
02344
02345 if (is_array($conf['subparts.'])) {
02346 reset($conf['subparts.']);
02347 while(list($theKey,$theValue)=each($conf['subparts.'])) {
02348 if (!strstr($theKey,'.')) {
02349 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02350 if ($subpart) {
02351 $GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart;
02352 $subparts[$theKey]['name'] = $theValue;
02353 $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
02354 }
02355 }
02356 }
02357 }
02358
02359 if (is_array($conf['marks.'])) {
02360 reset($conf['marks.']);
02361 while(list($theKey,$theValue)=each($conf['marks.'])) {
02362 if (!strstr($theKey,'.')) {
02363 $marks[$theKey]['name'] = $theValue;
02364 $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
02365 }
02366 }
02367 }
02368
02369 if (is_array($conf['wraps.'])) {
02370 reset($conf['wraps.']);
02371 while(list($theKey,$theValue)=each($conf['wraps.'])) {
02372 if (!strstr($theKey,'.')) {
02373 $wraps[$theKey]['name'] = $theValue;
02374 $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
02375 }
02376 }
02377 }
02378
02379 $subpartArray =array();
02380 reset($subparts);
02381 while(list($theKey,$theValue)=each($subparts)) {
02382
02383 $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey];
02384
02385 $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey);
02386 }
02387 $this->data[$this->currentValKey] = '';
02388
02389
02390 $markerArray =array();
02391 reset($marks);
02392 while(list($theKey,$theValue)=each($marks)) {
02393 $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
02394 }
02395
02396 $subpartWraps =array();
02397 reset($wraps);
02398 while(list($theKey,$theValue)=each($wraps)) {
02399 $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
02400 }
02401
02402
02403 if ($conf['substMarksSeparately']) {
02404 $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps);
02405 $content = $this->substituteMarkerArray($content, $markerArray);
02406 } else {
02407 $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps);
02408 }
02409 }
02410 }
02411 return $content;
02412 }
02413
02421 function MULTIMEDIA($conf) {
02422 $content='';
02423 $filename=$this->stdWrap($conf['file'],$conf['file.']);
02424 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
02425 if ($incFile) {
02426 $fileinfo = t3lib_div::split_fileref($incFile);
02427 if (t3lib_div::inList('txt,html,htm',$fileinfo['fileext'])) {
02428 $content = $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02429 } else {
02430
02431 $parArray=array();
02432
02433 $parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix.$incFile.'"';
02434 if (t3lib_div::inList('au,wav,mp3',$fileinfo['fileext'])) {
02435 }
02436 if (t3lib_div::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext'])) {
02437 $parArray['width'] = 'width="200"';
02438 $parArray['height'] = 'height="200"';
02439 }
02440 if (t3lib_div::inList('swf,swa,dcr',$fileinfo['fileext'])) {
02441 $parArray['quality'] = 'quality="high"';
02442 }
02443 if (t3lib_div::inList('class',$fileinfo['fileext'])) {
02444 $parArray['width'] = 'width="200"';
02445 $parArray['height'] = 'height="200"';
02446 }
02447
02448
02449 $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.']));
02450 while(list(,$l)=each($lines)) {
02451 $parts = explode('=', $l);
02452 $parameter = strtolower(trim($parts[0]));
02453 $value = trim($parts[1]);
02454 if ((string)$value!='') {
02455 $parArray[$parameter] = $parameter.'="'.htmlspecialchars($value).'"';
02456 } else {
02457 unset($parArray[$parameter]);
02458 }
02459 }
02460 if ($fileinfo['fileext']=='class') {
02461 unset($parArray['src']);
02462 $parArray['code'] = 'code="'.htmlspecialchars($fileinfo['file']).'"';
02463 $parArray['codebase'] = 'codebase="'.htmlspecialchars($fileinfo['path']).'"';
02464 $content='<applet '.implode(' ',$parArray).'></applet>';
02465 } else {
02466 $content='<embed '.implode(' ',$parArray).'></embed>';
02467 }
02468 }
02469 }
02470
02471 if ($conf['stdWrap.']) {
02472 $content=$this->stdWrap($content, $conf['stdWrap.']);
02473 }
02474
02475 return $content;
02476 }
02477
02478
02479
02480
02481
02482
02483
02484
02485
02486
02487
02488
02489
02490
02491
02492
02493
02494
02495
02496
02497
02498
02499
02508 function getSlidePids($pidList, $pidConf) {
02509 $pidList = trim($this->stdWrap($pidList,$pidConf));
02510 if (!strcmp($pidList,'')) {
02511 $pidList = 'this';
02512 }
02513 if (trim($pidList)) {
02514 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$pidList));
02515 $listArr = $this->checkPidArray($listArr);
02516 }
02517 $pidList = array();
02518 if (is_array($listArr)&&count($listArr)) {
02519 foreach ($listArr as $uid) {
02520 $page = $GLOBALS['TSFE']->sys_page->getPage($uid);
02521 if (!$page['is_siteroot']) {
02522 $pidList[] = $page['pid'];
02523 }
02524 }
02525 }
02526 return implode(',', $pidList);
02527 }
02528
02529
02540 function netprintApplication_offsiteLinkWrap($str,$imgConf,$conf) {
02541 if ($conf['url'] && @is_file($imgConf['origFile'])) {
02542 $thisUrl = $conf['thisUrl'] ? $conf['thisUrl'] : t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
02543 $origFile=$thisUrl.$imgConf['origFile'];
02544
02545 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02546 $gifCreator->init();
02547 $origDim = $gifCreator->getImageDimensions($imgConf['origFile']);
02548 if (!$conf['linkOnlyPixelsAbove'] || $origDim[0]*$origDim[1]>$conf['linkOnlyPixelsAbove']) {
02549
02550 $thumbFile=$thisUrl.$imgConf['3'].'|'.$imgConf[0].'x'.$imgConf[1].'|'.$origDim[0].'x'.$origDim[1].'|'.filesize($imgConf['origFile']).'|'.filemtime($imgConf['origFile']);
02551
02552 $url = $conf['url']
02553 .'&NP[offsite][1]='.rawurlencode($origFile)
02554 .'&NP[offsite_thumb][1]='.rawurlencode($thumbFile);
02555 $linkCObject = $this->cObjGetSingle($conf['cObject'],$conf['cObject.']);
02556 if ($linkCObject) {
02557 $ATagParams = $this->getATagParams($conf, 0);
02558 $linkCObject='<a href="'.htmlspecialchars($url).'"'.$ATagParams.'>'.$linkCObject.'</a>';
02559 $linkCObject=$this->stdWrap($linkCObject,$conf['outerStdWrap.']);
02560 if ($conf['before']) {
02561 $str=$linkCObject.$str;
02562 } else {
02563 $str=$str.$linkCObject;
02564 }
02565 }
02566 }
02567 }
02568 return $str;
02569 }
02570
02581 function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal) {
02582 if (!$GLOBALS['TSFE']->no_cache || (!isset($_POST[$fieldName]) && !isset($_GET[$fieldName])) || $noValueInsert) {
02583 return $defaultVal;
02584 } else {
02585 return t3lib_div::_GP($fieldName);
02586 }
02587 }
02588
02599 function cImage($file,$conf) {
02600 $info = $this->getImgResource($file,$conf['file.']);
02601 $GLOBALS['TSFE']->lastImageInfo=$info;
02602 if (is_array($info)) {
02603 $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
02604 $GLOBALS['TSFE']->imagesOnPage[]=$info[3];
02605
02606 if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {
02607 $conf['altText'] = $conf['alttext'];
02608 $conf['altText.'] = $conf['alttext.'];
02609 }
02610 $altParam = $this->getAltParam($conf);
02611
02612 $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).' />';
02613 if ($conf['linkWrap']) {
02614 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
02615 } elseif ($conf['imageLinkWrap']) {
02616 $theValue = $this->imageLinkWrap($theValue,$info['origFile'],$conf['imageLinkWrap.']);
02617 }
02618 return $this->wrap($theValue,$conf['wrap']);
02619 }
02620 }
02627 function getBorderAttr($borderAttr) {
02628 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype) && !$GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) {
02629 return $borderAttr;
02630 }
02631 }
02632
02643 function imageLinkWrap($string,$imageFile,$conf) {
02644 $a1='';
02645 $a2='';
02646 $content=$string;
02647 if ($this->stdWrap($conf['enable'],$conf['enable.'])) {
02648 $content=$this->typolink($string, $conf['typolink.']);
02649
02650 if ($content==$string && @is_file($imageFile)) {
02651 $params = '';
02652 if ($conf['width']) {$params.='&width='.rawurlencode($conf['width']);}
02653 if ($conf['height']) {$params.='&height='.rawurlencode($conf['height']);}
02654 if ($conf['effects']) {$params.='&effects='.rawurlencode($conf['effects']);}
02655 if ($conf['sample']) {$params.='&sample=1';}
02656 if ($conf['alternativeTempPath']) {$params.='&alternativeTempPath='.rawurlencode($conf['alternativeTempPath']);}
02657
02658 if ($conf['bodyTag']) {$params.='&bodyTag='.rawurlencode($conf['bodyTag']);}
02659 if ($conf['title']) {$params.='&title='.rawurlencode($conf['title']);}
02660 if ($conf['wrap']) {$params.='&wrap='.rawurlencode($conf['wrap']);}
02661
02662 $md5_value = md5(
02663 $imageFile.'|'.
02664 $conf['width'].'|'.
02665 $conf['height'].'|'.
02666 $conf['effects'].'|'.
02667 $conf['bodyTag'].'|'.
02668 $conf['title'].'|'.
02669 $conf['wrap'].'|'.
02670 $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].'|');
02671
02672 $params.= '&md5='.$md5_value;
02673 $url = $GLOBALS['TSFE']->absRefPrefix.'index.php?eID=tx_cms_showpic&file='.rawurlencode($imageFile).$params;
02674 if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.']) {
02675 $altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
02676 if ($altUrl) {
02677 $url=$altUrl.'?file='.rawurlencode($imageFile).$params;
02678 }
02679 }
02680
02681
02682 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
02683 if (isset($conf['target'])) {
02684 $target = sprintf(' target="%s"', $conf['target']);
02685 } else {
02686 $target = ' target="thePicture"';
02687 }
02688 } else {
02689 $target = '';
02690 }
02691
02692 if ($conf['JSwindow']) {
02693 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02694 $gifCreator->init();
02695 $gifCreator->mayScaleUp = 0;
02696 $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile),$conf['width'],$conf['height'],'');
02697 $offset = t3lib_div::intExplode(',',$conf['JSwindow.']['expand'].',');
02698
02699 $a1='<a href="'. htmlspecialchars($url) .'" onclick="'.
02700 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;').
02701 '"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02702 $a2='</a>';
02703 $GLOBALS['TSFE']->setJS('openPic');
02704 } else {
02705 $a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02706 $a2='</a>';
02707 }
02708 $content=$a1.$string.$a2;
02709 }
02710 }
02711
02712 return $content;
02713 }
02714
02723 function fileResource($fName, $addParams='alt="" title=""') {
02724 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($fName);
02725 if ($incFile) {
02726 $fileinfo = t3lib_div::split_fileref($incFile);
02727 if (t3lib_div::inList('jpg,gif,jpeg,png',$fileinfo['fileext'])) {
02728 $imgFile = $incFile;
02729 $imgInfo = @getImageSize($imgFile);
02730 return '<img src="'.$GLOBALS['TSFE']->absRefPrefix.$imgFile.'" width="'.$imgInfo[0].'" height="'.$imgInfo[1].'"'.$this->getBorderAttr(' border="0"').' '.$addParams.' />';
02731 } elseif (filesize($incFile)<1024*1024) {
02732 return $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02733 }
02734 }
02735 }
02736
02746 function lastChanged($tstamp) {
02747 $tstamp = intval($tstamp);
02748 if ($tstamp>intval($GLOBALS['TSFE']->register['SYS_LASTCHANGED'])) {
02749 $GLOBALS['TSFE']->register['SYS_LASTCHANGED'] = $tstamp;
02750 }
02751 }
02752
02763 function linkWrap($content,$wrap) {
02764 $wrapArr = explode('|', $wrap);
02765 if (ereg("\{([0-9]*)\}",$wrapArr[0],$reg)) {
02766 if ($uid = $GLOBALS['TSFE']->tmpl->rootLine[$reg[1]]['uid']) {
02767 $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]);
02768 }
02769 }
02770 return trim($wrapArr[0]).$content.trim($wrapArr[1]);
02771 }
02772
02781 function getAltParam($conf) {
02782 $altText = trim($this->stdWrap($conf['altText'], $conf['altText.']));
02783 $titleText = trim($this->stdWrap($conf['titleText'],$conf['titleText.']));
02784 $longDesc = trim($this->stdWrap($conf['longdescURL'],$conf['longdescURL.']));
02785
02786
02787 $altParam = ' alt="'.htmlspecialchars(strip_tags($altText)).'"';
02788
02789
02790 $emptyTitleHandling = 'useAlt';
02791 if ($conf['emptyTitleHandling']) {
02792
02793 $emptyTitleHandling = $conf['emptyTitleHandling'];
02794 }
02795 if ($titleText || $emptyTitleHandling == 'keepEmpty') {
02796 $altParam.= ' title="'.htmlspecialchars(strip_tags($titleText)).'"';
02797 } elseif (!$titleText && $emptyTitleHandling == 'useAlt') {
02798 $altParam.= ' title="'.htmlspecialchars(strip_tags($altText)).'"';
02799 }
02800
02801
02802 if ($longDesc) {
02803 $altParam.= ' longdesc="'.htmlspecialchars(strip_tags($longDesc)).'"';
02804 }
02805
02806 return $altParam;
02807 }
02808
02816 function cleanFormName($name) {
02817
02818 $name = preg_replace('/\[|\]\[?/',':',trim($name));
02819
02820 return preg_replace('#[^:a-zA-Z0-9]#','',$name);
02821 }
02822
02832 function getATagParams($conf, $addGlobal=1) {
02833 $aTagParams = '';
02834 if ($conf['ATagParams.']) {
02835 $aTagParams = ' '.$this->stdWrap($conf['ATagParams'], $conf['ATagParams.']);
02836 } elseif ($conf['ATagParams']) {
02837 $aTagParams = ' '.$conf['ATagParams'];
02838 }
02839 if ($addGlobal) {
02840 $aTagParams = ' '.trim($GLOBALS['TSFE']->ATagParams.$aTagParams);
02841 }
02842 return $aTagParams;
02843 }
02844
02845
02846
02847
02848
02849
02850
02851
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861
02862
02863
02864
02865
02866
02867
02879 function getSubpart($content, $marker) {
02880 return t3lib_parsehtml::getSubpart($content, $marker);
02881 }
02882
02895 function substituteSubpart($content,$marker,$subpartContent,$recursive=1) {
02896 return t3lib_parsehtml::substituteSubpart($content, $marker, $subpartContent, $recursive);
02897 }
02898
02908 function substituteMarker($content,$marker,$markContent) {
02909 return str_replace($marker,$markContent,$content);
02910 }
02911
02928 function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array()) {
02929 $GLOBALS['TT']->push('/substituteMarkerArray/');
02930
02931
02932 if (!is_array($markContentArray)) $markContentArray=array();
02933 if (!is_array($subpartContentArray)) $subpartContentArray=array();
02934 if (!is_array($wrappedSubpartContentArray)) $wrappedSubpartContentArray=array();
02935
02936 $sPkeys = array_keys($subpartContentArray);
02937 $wPkeys = array_keys($wrappedSubpartContentArray);
02938 $aKeys = array_merge(array_keys($markContentArray),$sPkeys,$wPkeys);
02939 if (!count($aKeys)) {
02940 $GLOBALS['TT']->pull();
02941 return $content;
02942 }
02943 asort($aKeys);
02944 $storeKey = md5('substituteMarkerArrayCached_storeKey:'.serialize(array($content,$aKeys)));
02945 if ($this->substMarkerCache[$storeKey]) {
02946 $storeArr = $this->substMarkerCache[$storeKey];
02947 $GLOBALS['TT']->setTSlogMessage('Cached',0);
02948 } else {
02949 $storeArrDat = $GLOBALS['TSFE']->sys_page->getHash($storeKey,0);
02950 if (!isset($storeArrDat)) {
02951
02952 $storeArr=array();
02953
02954
02955 reset($sPkeys);
02956 while(list(,$sPK)=each($sPkeys)) {
02957 $content =$this->substituteSubpart($content,$sPK,$sPK);
02958 }
02959
02960
02961 reset($wPkeys);
02962 while(list(,$wPK)=each($wPkeys)) {
02963 $content =$this->substituteSubpart($content,$wPK,array($wPK,$wPK));
02964 }
02965
02966
02967 reset($aKeys);
02968 while(list($tK,$tV)=each($aKeys)) {
02969 $aKeys[$tK]=quotemeta($tV);
02970 }
02971 $regex = implode('|',$aKeys);
02972
02973 $storeArr['c'] = split($regex,$content);
02974 preg_match_all('/'.$regex.'/',$content,$keyList);
02975 $storeArr['k']=$keyList[0];
02976
02977 $this->substMarkerCache[$storeKey] = $storeArr;
02978
02979
02980 $GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
02981
02982 $GLOBALS['TT']->setTSlogMessage('Parsing',0);
02983 } else {
02984
02985 $storeArr = unserialize($storeArrDat);
02986
02987 $this->substMarkerCache[$storeKey] = $storeArr;
02988 $GLOBALS['TT']->setTSlogMessage('Cached from DB',0);
02989 }
02990 }
02991
02992
02993
02994 $valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
02995
02996 $wSCA_reg=array();
02997 reset($storeArr['k']);
02998 $content = '';
02999
03000 while(list($n,$keyN)=each($storeArr['k'])) {
03001 $content.=$storeArr['c'][$n];
03002 if (!is_array($valueArr[$keyN])) {
03003 $content.=$valueArr[$keyN];
03004 } else {
03005 $content.=$valueArr[$keyN][(intval($wSCA_reg[$keyN])%2)];
03006 $wSCA_reg[$keyN]++;
03007 }
03008 }
03009 $content.=$storeArr['c'][count($storeArr['k'])];
03010
03011 $GLOBALS['TT']->pull();
03012 return $content;
03013 }
03014
03026 function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0) {
03027 if (is_array($markContentArray)) {
03028 reset($markContentArray);
03029 $wrapArr=t3lib_div::trimExplode('|',$wrap);
03030 while(list($marker,$markContent)=each($markContentArray)) {
03031 if($uppercase) $marker=strtoupper($marker);
03032 if(strcmp($wrap,'')) $marker=$wrapArr[0].$marker.$wrapArr[1];
03033 $content=str_replace($marker,$markContent,$content);
03034 }
03035 }
03036 return $content;
03037 }
03038
03047 function substituteMarkerInObject(&$tree, $markContentArray) {
03048 if (is_array ($tree)) {
03049 reset($tree);
03050 while(list($key,$value)=each($tree)) {
03051 $this->substituteMarkerInObject ($tree[$key], $markContentArray);
03052 }
03053 } else {
03054 $tree = $this->substituteMarkerArray($tree,$markContentArray);
03055 }
03056 return $tree;
03057 }
03058
03070 function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE) {
03071 if ($fieldList) {
03072 $fArr = t3lib_div::trimExplode(',',$fieldList,1);
03073 foreach($fArr as $field) {
03074 $markContentArray['###'.$prefix.$field.'###'] = $nl2br?nl2br($row[$field]):$row[$field];
03075 }
03076 } else {
03077 if (is_array($row)) {
03078 foreach($row as $field => $value) {
03079 if (!t3lib_div::testInt($field)) {
03080 if ($HSC) $value = htmlspecialchars($value);
03081 $markContentArray['###'.$prefix.$field.'###'] = $nl2br ? nl2br($value) : $value;
03082 }
03083 }
03084 }
03085 }
03086
03087 return $markContentArray;
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
03119
03120
03133 function stdWrap($content,$conf) {
03134 if (is_array($conf)) {
03135
03136
03137 if ($conf['setContentToCurrent']){$this->data[$this->currentValKey]=$content;}
03138 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
03139
03140
03141 if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) {
03142 $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']];
03143 }
03144 if ($conf['data']){$content=$this->getData($conf['data'], is_array($this->alternativeData)?$this->alternativeData:$this->data);}
03145 $this->alternativeData='';
03146 if ($conf['field']) {$content=$this->getFieldVal($conf['field']);}
03147 if ($conf['current']) {$content=$this->data[$this->currentValKey];}
03148 if ($conf['cObject']) {$content=$this->cObjGetSingle($conf['cObject'],$conf['cObject.'],'/stdWrap/.cObject');}
03149 if ($conf['numRows.']) {$content=$this->numRows($conf['numRows.']);}
03150 if ($conf['filelist'] || $conf['filelist.']) {$content=$this->filelist($this->stdWrap($conf['filelist'], $conf['filelist.']));}
03151 if ($conf['preUserFunc']) {$content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);}
03152
03153
03154 if ($conf['override'] || $conf['override.']){
03155 $override = $this->stdWrap($conf['override'], $conf['override.']);
03156 if (trim($override)) {$content=$override;}
03157 }
03158 if (isset($conf['preIfEmptyListNum']) || isset($conf['preIfEmptyListNum.']['stdWrap.'])) {
03159 $preIfEmptyListNumber = isset($conf['preIfEmptyListNum.']['stdWrap.']) ? $this->stdWrap($conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['stdWrap.']) : $conf['preIfEmptyListNum'];
03160 $content=$this->listNum($content,$preIfEmptyListNumber,$conf['preIfEmptyListNum.']['splitChar']);
03161 }
03162 if (!trim($content) && ($conf['ifEmpty'] || $conf['ifEmpty.'])) {
03163 $content = $this->stdWrap($conf['ifEmpty'], $conf['ifEmpty.']);
03164 }
03165 if (!strlen(trim($content)) && ($conf['ifBlank'] || $conf['ifBlank.'])) {
03166 $content = $this->stdWrap($conf['ifBlank'], $conf['ifBlank.']);
03167 }
03168
03169
03170 if (isset($conf['listNum']) || isset($conf['listNum.']['stdWrap.'])) {
03171 $listNumber = isset($conf['listNum.']['stdWrap.']) ? $this->stdWrap($conf['listNum'], $conf['listNum.']['stdWrap.']) : $conf['listNum'];
03172 $content=$this->listNum($content,$listNumber,$conf['listNum.']['splitChar']);
03173 }
03174
03175 if ($conf['trim']) { $content=trim($content); }
03176
03177
03178 if ($conf['stdWrap']) { $content=$this->stdWrap($content,$conf['stdWrap.']); }
03179
03180 if ( ($conf['required'] && (string)$content=='') || ($conf['if.'] && !$this->checkIf($conf['if.'])) || ($conf['fieldRequired'] && !trim($this->data[$conf['fieldRequired']])) ){
03181 $content = '';
03182 } else {
03183
03184 if ($conf['csConv']) { $content=$GLOBALS['TSFE']->csConv($content,$conf['csConv']); }
03185 if ($conf['parseFunc.'] || $conf['parseFunc']) {$content=$this->parseFunc($content,$conf['parseFunc.'],$conf['parseFunc']);}
03186 if ($conf['HTMLparser'] && is_array($conf['HTMLparser.'])) {$content=$this->HTMLparser_TSbridge($content,$conf['HTMLparser.']);}
03187 if ($conf['split.']){$content=$this->splitObj($content,$conf['split.']);}
03188 if ($conf['prioriCalc']){$content=t3lib_div::calcParenthesis($content); if ($conf['prioriCalc']=='intval') $content=intval($content);}
03189 if ((string)$conf['char']!=''){$content=chr(intval($conf['char']));}
03190 if ($conf['intval']){$content=intval($content);}
03191 if ($conf['date']){$content=date($conf['date'], $content);}
03192 if ($conf['strftime']){
03193 $content = strftime($conf['strftime'], $content);
03194 $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
03195 if ($tmp_charset) {
03196 $content = $GLOBALS['TSFE']->csConv($content,$tmp_charset);
03197 }
03198 }
03199 if ($conf['age']){$content=$this->calcAge(time()-$content,$conf['age']);}
03200
03201 if ($conf['case']){$content=$this->HTMLcaseshift($content, $conf['case']);}
03202 if ($conf['bytes']){$content=$this->bytes($content,$conf['bytes.']['labels']);}
03203 if ($conf['substring']){$content=$this->substring($content,$conf['substring']);}
03204 if ($conf['removeBadHTML']) {$content = $this->removeBadHTML($content, $conf['removeBadHTML.']);}
03205 if ($conf['stripHtml']){$content = strip_tags($content);}
03206 if ($conf['crop']){$content=$this->crop($content, $conf['crop']);}
03207 if ($conf['rawUrlEncode']){$content = rawurlencode($content);}
03208 if ($conf['htmlSpecialChars']){
03209 $content=htmlSpecialChars($content);
03210 if ($conf['htmlSpecialChars.']['preserveEntities']) $content = t3lib_div::deHSCentities($content);
03211 }
03212
03213 if ($conf['doubleBrTag']) {
03214 $content=ereg_replace("\r?\n[\t ]*\r?\n",$conf['doubleBrTag'],$content);
03215 }
03216 if ($conf['br']) {$content=nl2br($content);}
03217 if ($conf['brTag']) {$content= ereg_replace(chr(10),$conf['brTag'],$content);}
03218 if ($conf['encapsLines.']) {$content=$this->encaps_lineSplit($content,$conf['encapsLines.']);}
03219 if ($conf['keywords']) {$content= $this->keywords($content);}
03220 if ($conf['innerWrap'] || $conf['innerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap'], $conf['innerWrap.']));}
03221 if ($conf['innerWrap2'] || $conf['innerWrap2.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap2'], $conf['innerWrap2.']));}
03222 if ($conf['fontTag']){$content=$this->wrap($content, $conf['fontTag']);}
03223 if ($conf['addParams.']) {$content=$this->addParams($content,$conf['addParams.']);}
03224 if ($conf['textStyle.']) {$content=$this->textStyle($content,$conf['textStyle.']);}
03225 if ($conf['tableStyle.']) {$content=$this->tableStyle($content,$conf['tableStyle.']);}
03226 if ($conf['filelink.']) {$content=$this->filelink($content,$conf['filelink.']);}
03227 if ($conf['preCObject']) {$content=$this->cObjGetSingle($conf['preCObject'],$conf['preCObject.'],'/stdWrap/.preCObject').$content;}
03228 if ($conf['postCObject']) {$content.=$this->cObjGetSingle($conf['postCObject'],$conf['postCObject.'],'/stdWrap/.postCObject');}
03229
03230 if ($conf['wrapAlign'] || $conf['wrapAlign.']){
03231 $wrapAlign = trim($this->stdWrap($conf['wrapAlign'], $conf['wrapAlign.']));
03232 if ($wrapAlign) {$content=$this->wrap($content, '<div style="text-align:'.$wrapAlign.';">|</div>');}
03233 }
03234 if ($conf['typolink.']){$content=$this->typolink($content, $conf['typolink.']);}
03235 if (is_array($conf['TCAselectItem.'])) {$content=$this->TCAlookup($content,$conf['TCAselectItem.']);}
03236
03237
03238 if ($conf['space']){$content=$this->wrapSpace($content, $conf['space']);}
03239 $spaceBefore = '';
03240 if ($conf['spaceBefore'] || $conf['spaceBefore.']) {$spaceBefore = trim($this->stdWrap($conf['spaceBefore'], $conf['spaceBefore.']));}
03241 $spaceAfter = '';
03242 if ($conf['spaceAfter'] || $conf['spaceAfter.']) {$spaceAfter = trim($this->stdWrap($conf['spaceAfter'], $conf['spaceAfter.']));}
03243 if ($spaceBefore || $spaceAfter) {$content=$this->wrapSpace($content, $spaceBefore.'|'.$spaceAfter);}
03244
03245
03246 if ($conf['wrap']){$content=$this->wrap($content, $conf['wrap'], ($conf['wrap.']['splitChar']?$conf['wrap.']['splitChar']:'|'));}
03247 if ($conf['noTrimWrap']){$content=$this->noTrimWrap($content, $conf['noTrimWrap']);}
03248 if ($conf['wrap2']){$content=$this->wrap($content, $conf['wrap2'], ($conf['wrap2.']['splitChar']?$conf['wrap2.']['splitChar']:'|'));}
03249 if ($conf['dataWrap']){$content=$this->dataWrap($content, $conf['dataWrap']);}
03250 if ($conf['prepend']){$content=$this->cObjGetSingle($conf['prepend'],$conf['prepend.'],'/stdWrap/.prepend').$content;}
03251 if ($conf['append']){$content.=$this->cObjGetSingle($conf['append'],$conf['append.'],'/stdWrap/.append');}
03252 if ($conf['wrap3']){$content=$this->wrap($content, $conf['wrap3'], ($conf['wrap3.']['splitChar']?$conf['wrap3.']['splitChar']:'|'));}
03253 if ($conf['outerWrap'] || $conf['outerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['outerWrap'], $conf['outerWrap.']));}
03254 if ($conf['insertData']) {$content = $this->insertData($content);}
03255 if ($conf['offsetWrap']){
03256 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
03257 if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {$controlTable->tableParams = $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.']);}
03258 if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {$controlTable->tdParams = ' '.$this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.']);}
03259 $content=$controlTable->start($content,$conf['offsetWrap']);
03260 if ($conf['offsetWrap.']['stdWrap.']) { $content=$this->stdWrap($content,$conf['offsetWrap.']['stdWrap.']); }
03261 }
03262 if ($conf['postUserFunc']) {$content = $this->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $content);}
03263 if ($conf['postUserFuncInt']) {
03264 $substKey = 'INT_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
03265 $GLOBALS['TSFE']->config['INTincScript'][$substKey] = array(
03266 'content' => $content,
03267 'postUserFunc' => $conf['postUserFuncInt'],
03268 'conf' => $conf['postUserFuncInt.'],
03269 'type' => 'POSTUSERFUNC',
03270 'cObj' => serialize($this),
03271 );
03272 $content ='<!--'.$substKey.'-->';
03273 }
03274
03275 if ($conf['prefixComment'] && !$GLOBALS['TSFE']->config['config']['disablePrefixComment']) {$content = $this->prefixComment($conf['prefixComment'], $conf['prefixComment.'], $content);}
03276
03277 if ($conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editIcons($content,$conf['editIcons'],$conf['editIcons.']);}
03278 if ($conf['editPanel'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editPanel($content, $conf['editPanel.']);}
03279 }
03280
03281
03282 if ($conf['debug']) {$content = '<pre>'.htmlspecialchars($content).'</pre>';}
03283 if ($conf['debugFunc']) {debug($conf['debugFunc']==2?array($content):$content);}
03284 if ($conf['debugData']) {
03285 echo '<b>$cObj->data:</b>';
03286 debug($this->data,'$cObj->data:');
03287 if (is_array($this->alternativeData)) {
03288 echo '<b>$cObj->alternativeData:</b>';
03289 debug($this->alternativeData,'$this->alternativeData');
03290 }
03291 }
03292 }
03293 return $content;
03294 }
03295
03307 function numRows($conf) {
03308 $conf['select.']['selectFields'] = 'count(*)';
03309
03310 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
03311
03312 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
03313 $GLOBALS['TT']->setTSlogMessage($error,3);
03314 } else {
03315 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
03316 return intval($row[0]);
03317 }
03318 }
03319
03328 function listNum($content,$listNum,$char) {
03329 $char = $char ? $char : ',';
03330 if (t3lib_div::testInt($char)) {
03331 $char = chr($char);
03332 }
03333 $temp = explode($char,$content);
03334 $last = ''.(count($temp)-1);
03335 $index=$this->calc(eregi_replace('last',$last,$listNum));
03336 return $temp[$index];
03337 }
03338
03348 function checkIf($conf) {
03349 if (!is_array($conf)) {return true;}
03350 if (isset($conf['directReturn'])) {return $conf['directReturn'] ? 1 : 0;}
03351 $flag = true;
03352 if (isset($conf['isTrue']) || isset($conf['isTrue.'])) {
03353 $isTrue = trim($this->stdWrap($conf['isTrue'],$conf['isTrue.']));
03354 if (!$isTrue) {
03355 $flag=0;
03356 }
03357 }
03358 if (isset($conf['isFalse']) || isset($conf['isFalse.'])) {
03359 $isFalse = trim($this->stdWrap($conf['isFalse'],$conf['isFalse.']));
03360 if ($isFalse) {
03361 $flag=0;
03362 }
03363 }
03364 if (isset($conf['isPositive']) || isset($conf['isPositive.'])) {
03365 $number = $this->calc($this->stdWrap($conf['isPositive'],$conf['isPositive.']));
03366 if ($number<1) {
03367 $flag=0;
03368 }
03369 }
03370 if ($flag) {
03371 $value = trim($this->stdWrap($conf['value'],$conf['value.']));
03372
03373 if (isset($conf['isGreaterThan']) || isset($conf['isGreaterThan.'])) {
03374 $number = trim($this->stdWrap($conf['isGreaterThan'],$conf['isGreaterThan.']));
03375 if ($number<=$value) {
03376 $flag=0;
03377 }
03378 }
03379 if (isset($conf['isLessThan']) || isset($conf['isLessThan.'])) {
03380 $number = trim($this->stdWrap($conf['isLessThan'],$conf['isLessThan.']));
03381 if ($number>=$value) {
03382 $flag=0;
03383 }
03384 }
03385 if (isset($conf['equals']) || isset($conf['equals.'])) {
03386 $number = trim($this->stdWrap($conf['equals'],$conf['equals.']));
03387 if ($number!=$value) {
03388 $flag=0;
03389 }
03390 }
03391 if (isset($conf['isInList']) || isset($conf['isInList.'])) {
03392 $number = trim($this->stdWrap($conf['isInList'],$conf['isInList.']));
03393 if (!t3lib_div::inList($value,$number)) {
03394 $flag=0;
03395 }
03396 }
03397 }
03398 if ($conf['negate']) {$flag = $flag ? 0 : 1;}
03399 return $flag;
03400 }
03401
03411 function filelist($data) {
03412 $data = trim($data);
03413 if ($data) {
03414 $data_arr = explode('|',$data);
03415
03416 if ($GLOBALS['TSFE']->lockFilePath) {
03417 $path = $this->clean_directory($data_arr[0]);
03418 $path = substr($path,0,strlen($GLOBALS['TSFE']->lockFilePath))==$GLOBALS['TSFE']->lockFilePath ? $path : '';
03419 }
03420 if ($path) {
03421 $items = Array('files'=>array(), 'sorting'=>array());
03422 $ext_list = strtolower(t3lib_div::uniqueList($data_arr[1]));
03423 $sorting = trim($data_arr[2]);
03424
03425 $d = @dir($path);
03426 $tempArray=Array();
03427 if (is_object($d)) {
03428 $count=0;
03429 while($entry=$d->read()) {
03430 if ($entry!='.' && $entry!='..') {
03431 $wholePath = $path.'/'.$entry;
03432 if (@file_exists($wholePath) && filetype($wholePath)=='file') {
03433 $info = t3lib_div::split_fileref($wholePath);
03434 if (!$ext_list || t3lib_div::inList($ext_list,$info['fileext'])) {
03435 $items['files'][] = $info['file'];
03436 switch($sorting) {
03437 case 'name':
03438 $items['sorting'][] = strtolower($info['file']);
03439 break;
03440 case 'size':
03441 $items['sorting'][] = filesize($wholePath);
03442 break;
03443 case 'ext':
03444 $items['sorting'][] = $info['fileext'];
03445 break;
03446 case 'date':
03447 $items['sorting'][] = filectime($wholePath);
03448 break;
03449 case 'mdate':
03450 $items['sorting'][] = filemtime($wholePath);
03451 break;
03452 default:
03453 $items['sorting'][] = $count;
03454 break;
03455 }
03456 $count++;
03457 }
03458 }
03459 }
03460 }
03461 $d->close();
03462 }
03463
03464 if (count($items['sorting'])) {
03465 if (strtolower(trim($data_arr[3]))!='r') {
03466 asort($items['sorting']);
03467 } else {
03468 arsort($items['sorting']);
03469 }
03470 }
03471 if (count($items['files'])) {
03472
03473 reset($items['sorting']);
03474 $fullPath = trim($data_arr[4]);
03475 $list_arr=Array();
03476 while(list($key,)=each($items['sorting'])) {
03477 $list_arr[]= $fullPath ? $path.'/'.$items['files'][$key] : $items['files'][$key];
03478 }
03479 return implode(',',$list_arr);
03480 }
03481 }
03482 }
03483 }
03484
03493 function clean_directory($theDir) {
03494 if (t3lib_div::validPathStr($theDir)) {
03495 $theDir = ereg_replace("[\/\. ]*$",'',$theDir);
03496 if (!t3lib_div::isAbsPath($theDir) && @is_dir($theDir)) {
03497 return $theDir;
03498 }
03499 }
03500 }
03501
03511 function HTMLparser_TSbridge($theValue, $conf) {
03512 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
03513 $htmlParserCfg = $htmlParser->HTMLparserConfig($conf);
03514 return $htmlParser->HTMLcleaner($theValue,$htmlParserCfg[0],$htmlParserCfg[1],$htmlParserCfg[2],$htmlParserCfg[3]);
03515 }
03516
03525 function dataWrap($content,$wrap) {
03526 return $this->wrap($content,$this->insertData($wrap));
03527 }
03528
03538 function insertData($str) {
03539 $inside=0;
03540 $newVal='';
03541 $pointer=0;
03542 $totalLen = strlen($str);
03543 do {
03544 if (!$inside) {
03545 $len = strcspn(substr($str,$pointer),'{');
03546 $newVal.= substr($str,$pointer,$len);
03547 $inside = 1;
03548 } else {
03549 $len = strcspn(substr($str,$pointer),'}')+1;
03550 $newVal.= $this->getData(substr($str,$pointer+1,$len-2),$this->data);
03551 $inside = 0;
03552 }
03553 $pointer+=$len;
03554 } while($pointer<$totalLen);
03555 return $newVal;
03556 }
03557
03568 function prefixComment($str,$conf,$content) {
03569 $parts = explode('|',$str);
03570
03571 $output =
03572 chr(10).str_pad('',$parts[0],chr(9)).
03573 '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [begin] -->'.
03574 chr(10).str_pad('',$parts[0]+1,chr(9)).
03575 $content.
03576 chr(10).str_pad('',$parts[0],chr(9)).
03577 '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [end] -->'.
03578 chr(10).str_pad('',$parts[0]+1,chr(9));
03579
03580 return $output;
03581 }
03582
03592 function substring($content,$options) {
03593 $options = t3lib_div::intExplode(',',$options.',');
03594 if ($options[1]) {
03595 return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0],$options[1]);
03596 } else {
03597 return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0]);
03598 }
03599 }
03600
03610 function crop($content,$options) {
03611 $options = explode('|',$options);
03612 $chars = intval($options[0]);
03613 $afterstring = trim($options[1]);
03614 $crop2space = trim($options[2]);
03615 if ($chars) {
03616 if (strlen($content)>abs($chars)) {
03617 if ($chars<0) {
03618 $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$chars);
03619 $trunc_at = strpos($content, ' ');
03620 $content = ($trunc_at&&$crop2space) ? $afterstring.substr($content,$trunc_at) : $afterstring.$content;
03621 } else {
03622 $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,0,$chars);
03623 $trunc_at = strrpos($content, ' ');
03624 $content = ($trunc_at&&$crop2space) ? substr($content, 0, $trunc_at).$afterstring : $content.$afterstring;
03625 }
03626 }
03627 }
03628 return $content;
03629 }
03630
03642 function removeBadHTML($text, $conf) {
03643
03644
03645 $text = preg_replace(
03646 array(
03647 "'<script[^>]*?>.*?</script[^>]*?>'si",
03648 "'<applet[^>]*?>.*?</applet[^>]*?>'si",
03649 "'<object[^>]*?>.*?</object[^>]*?>'si",
03650 "'<iframe[^>]*?>.*?</iframe[^>]*?>'si",
03651 "'<frameset[^>]*?>.*?</frameset[^>]*?>'si",
03652 "'<style[^>]*?>.*?</style[^>]*?>'si",
03653 "'<marquee[^>]*?>.*?</marquee[^>]*?>'si",
03654 "'<script[^>]*?>'si",
03655 "'<meta[^>]*?>'si",
03656 "'<base[^>]*?>'si",
03657 "'<applet[^>]*?>'si",
03658 "'<object[^>]*?>'si",
03659 "'<link[^>]*?>'si",
03660 "'<iframe[^>]*?>'si",
03661 "'<frame[^>]*?>'si",
03662 "'<frameset[^>]*?>'si",
03663 "'<input[^>]*?>'si",
03664 "'<form[^>]*?>'si",
03665 "'<embed[^>]*?>'si",
03666 "'background-image:url'si",
03667 "'<\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",
03668 ), '', $text);
03669
03670 $text = eregi_replace('<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*','',$text);
03671
03672 // Return clean content
03673 return $text;
03674 }
03675
03686 function textStyle($theValue, $conf) {
03687 $conf['face.'][1] = 'Times New Roman';
03688 $conf['face.'][2] = 'Verdana,Arial,Helvetica,Sans serif';
03689 $conf['face.'][3] = 'Arial,Helvetica,Sans serif';
03690
03691 $conf['size.'][1] = 1;
03692 $conf['size.'][2] = 2;
03693 $conf['size.'][3] = 3;
03694 $conf['size.'][4] = 4;
03695 $conf['size.'][5] = 5;
03696 $conf['size.'][10] = '+1';
03697 $conf['size.'][11] = '-1';
03698
03699 $conf['color.'][240] = 'black';
03700 $conf['color.'][241] = 'white';
03701 $conf['color.'][242] = '#333333';
03702 $conf['color.'][243] = 'gray';
03703 $conf['color.'][244] = 'silver';
03704 $conf['color.'][245] = 'red';
03705 $conf['color.'][246] = 'navy';
03706 $conf['color.'][247] = 'yellow';
03707 $conf['color.'][248] = 'green';
03708 $conf['color.'][249] = 'olive';
03709 $conf['color.'][250] = 'maroon';
03710
03711 $face = $this->data[$conf['face.']['field']];
03712 $size = $this->data[$conf['size.']['field']];
03713 $color = $this->data[$conf['color.']['field']];
03714 $align = $this->data[$conf['align.']['field']];
03715 $properties = $this->data[$conf['properties.']['field']];
03716 if (!$properties) {
03717 $properties=$this->stdWrap($conf['properties.']['default'],$conf['properties.']['default.']);
03718 }
03719
03720 // properties
03721 if (($properties&8)) {$theValue=$this->HTMLcaseshift($theValue, 'upper');}
03722 if (($properties&1)) {$theValue='<b>'.$theValue.'</b>';}
03723 if (($properties&2)) {$theValue='<i>'.$theValue.'</i>';}
03724 if (($properties&4)) {$theValue='<u>'.$theValue.'</u>';}
03725
03726 // Fonttag
03727 $theFace = $conf['face.'][$face] ? $conf['face.'][$face] : $this->stdWrap($conf['face.']['default'],$conf['face.']['default.']);
03728 $theSize = $conf['size.'][$size] ? $conf['size.'][$size] : $this->stdWrap($conf['size.']['default'],$conf['size.']['default.']);
03729 $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $this->stdWrap($conf['color.']['default'],$conf['color.']['default.']);
03730
03731 if ($conf['altWrap']) {
03732 $theValue=$this->wrap($theValue, $conf['altWrap']);
03733 } elseif ($theFace || $theSize || $theColor) {
03734 $fontWrap = '<font'.($theFace?' face="'.$theFace.'"':'').($theSize?' size="'.$theSize.'"':'').($theColor?' color="'.$theColor.'"':'').'>|</font>';
03735 $theValue=$this->wrap($theValue, $fontWrap);
03736 }
03737
03738 if ($align) {$theValue=$this->wrap($theValue, '<div style="text-align:'.$align.';">|</div>');}
03739
03740 return $theValue;
03741 }
03742
03753 function tableStyle($theValue, $conf) {
03754 $conf['color.'][240] = 'black';
03755 $conf['color.'][241] = 'white';
03756 $conf['color.'][242] = '#333333';
03757 $conf['color.'][243] = 'gray';
03758 $conf['color.'][244] = 'silver';
03759
03760 $align = $this->stdWrap($conf['align'],$conf['align.']);
03761 $border = intval($this->stdWrap($conf['border'],$conf['border.']));
03762 $cellspacing = intval($this->stdWrap($conf['cellspacing'],$conf['cellspacing.']));
03763 $cellpadding = intval($this->stdWrap($conf['cellpadding'],$conf['cellpadding.']));
03764
03765 $color = $this->data[$conf['color.']['field']];
03766 $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $conf['color.']['default'];
03767
03768 $tableTagArray = Array('<table');
03769 $tableTagArray[]='border="'.$border.'"';
03770 $tableTagArray[]='cellspacing="'.$cellspacing.'"';
03771 $tableTagArray[]='cellpadding="'.$cellpadding.'"';
03772 if ($align) {$tableTagArray[]='align="'.$align.'"';}
03773 if ($theColor) {$tableTagArray[]='bgcolor="'.$theColor.'"';}
03774
03775 if ($conf['params']) {
03776 $tableTagArray[] = $conf['params'];
03777 }
03778
03779 $tableWrap = implode(' ',$tableTagArray).'> | </table>';
03780 $theValue=$this->wrap($theValue, $tableWrap);
03781
03782 return $theValue;
03783 }
03784
03794 function addParams($content,$conf) {
03795 $lowerCaseAttributes = TRUE;
03796
03797 if (!is_array($conf)) { return $content; }
03798
03799 $key = 1;
03800 $parts = explode('<',$content);
03801 if (intval($conf['_offset'])) $key = intval($conf['_offset'])<0 ? count($parts)+intval($conf['_offset']) : intval($conf['_offset']);
03802 $subparts=explode('>',$parts[$key]);
03803 if (trim($subparts[0])) {
03804
03805 $attribs = t3lib_div::get_tag_attributes('<'.$subparts[0].'>');
03806 if (!is_array($attribs)) {$attribs=array();}
03807 list($tagName) = explode(' ',$subparts[0],2);
03808
03809 reset($conf);
03810 while(list($pkey,$val)=each($conf)) {
03811 if (substr($pkey,-1)!='.' && substr($pkey,0,1)!='_') {
03812 $tmpVal=$this->stdWrap($conf[$pkey],$conf[$pkey.'.']);
03813 if ($lowerCaseAttributes) { $pkey = strtolower($pkey); }
03814 if (strcmp($tmpVal,'')) {$attribs[$pkey]=$tmpVal;}
03815 }
03816 }
03817
03818
03819 $subparts[0]=trim($tagName.' '.t3lib_div::implodeAttributes($attribs));
03820 $parts[$key] = implode('>',$subparts);
03821 $content = implode('<',$parts);
03822 }
03823 return $content;
03824 }
03825
03837 function filelink($theValue, $conf) {
03838 $output = '';
03839 $aTagParams = $this->getATagParams($conf);
03840 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
03841 $conf['path'] = $this->stdWrap($conf['path'],$conf['path.']);
03842 $theFile = trim($conf['path']).$theValue;
03843 if (@is_file($theFile)) {
03844 $theFileEnc = str_replace('%2F', '/', rawurlencode($theFile));
03845 $locDataAdd = $conf['jumpurl.']['secure'] ? $this->locDataJU($theFileEnc,$conf['jumpurl.']['secure.']) : '';
03846 $url = ($conf['jumpurl']) ? $GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($theFileEnc).$locDataAdd.$GLOBALS['TSFE']->getMethodUrlIdToken : $theFileEnc;
03847 $theLinkWrap = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$url).'"'.($conf['target']?' target="'.$conf['target'].'"':'').$aTagParams.'>|</a>';
03848
03849 $theSize = filesize($theFile);
03850 $fI = t3lib_div::split_fileref($theFile);
03851 if ($conf['icon']) {
03852
03853 $iconP = t3lib_extMgm::siteRelPath('cms').'tslib/media/fileicons/';
03854 $icon = @is_file($iconP.$fI['fileext'].'.gif') ? $iconP.$fI['fileext'].'.gif' : $iconP.'default.gif';
03855
03856 $IEList = $this->stdWrap($conf['icon_image_ext_list'],$conf['icon_image_ext_list.']);
03857 $image_ext_list = str_replace(' ','',strtolower($IEList));
03858 if ($fI['fileext'] && t3lib_div::inList($image_ext_list, $fI['fileext'])) {
03859 if ($conf['iconCObject']) {
03860 $icon = $this->cObjGetSingle($conf['iconCObject'],$conf['iconCObject.'],'iconCObject');
03861 } else {
03862 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
03863 $thumbSize = '';
03864 if ($conf['icon_thumbSize'] || $conf['icon_thumbSize.']) { $thumbSize = '&size='.$this->stdWrap($conf['icon_thumbSize'], $conf['icon_thumbSize.']); }
03865 $icon = 't3lib/thumbs.php?dummy='.$GLOBALS['EXEC_TIME'].'&file='.rawurlencode('../'.$theFile).$thumbSize;
03866 } else {
03867 $icon = t3lib_extMgm::siteRelPath('cms').'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 $link_param = trim($link_paramA[0]);
05051 $linkClass = trim($link_paramA[2]);
05052 if ($linkClass=='-') $linkClass = '';
05053 $forceTarget = trim($link_paramA[1]);
05054 $forceTitle = trim($link_paramA[3]);
05055 if ($forceTarget=='-') $forceTarget = '';
05056
05057 $JSwindowParts = array();
05058 $JSwindowParams = '';
05059 $onClick = '';
05060 if ($forceTarget && ereg('^([0-9]+)x([0-9]+)(:(.*)|.*)$',$forceTarget,$JSwindowParts)) {
05061
05062 $JSwindow_tempParamsArr = t3lib_div::trimExplode(',',strtolower($conf['JSwindow_params'].','.$JSwindowParts[4]),1);
05063 $JSwindow_paramsArr=array();
05064 foreach($JSwindow_tempParamsArr as $JSv) {
05065 list($JSp,$JSv) = explode('=',$JSv);
05066 $JSwindow_paramsArr[$JSp]=$JSp.'='.$JSv;
05067 }
05068
05069 $JSwindow_paramsArr['width']='width='.$JSwindowParts[1];
05070 $JSwindow_paramsArr['height']='height='.$JSwindowParts[2];
05071
05072 $JSwindowParams = implode(',',$JSwindow_paramsArr);
05073 $forceTarget = '';
05074 }
05075
05076
05077 $target = isset($conf['target']) ? $conf['target'] : $GLOBALS['TSFE']->intTarget;
05078 if ($conf['target.']) {$target=$this->stdWrap($target, $conf['target.']);}
05079
05080
05081 $title = $conf['title'];
05082 if ($conf['title.']) {$title=$this->stdWrap($title, $conf['title.']);}
05083
05084
05085 $pU = parse_url($link_param);
05086
05087
05088 if(strstr($link_param,'@') && !$pU['scheme']) {
05089 $link_param = eregi_replace('^mailto:','',$link_param);
05090 list($this->lastTypoLinkUrl,$linktxt) = $this->getMailTo($link_param,$linktxt,$initP);
05091 $finalTagParts['url']=$this->lastTypoLinkUrl;
05092 $finalTagParts['TYPE']='mailto';
05093 } else {
05094 $isLocalFile=0;
05095 $fileChar=intval(strpos($link_param, '/'));
05096 $urlChar=intval(strpos($link_param, '.'));
05097
05098
05099 list($rootFileDat) = explode('?',rawurldecode($link_param));
05100 $containsSlash = strstr($rootFileDat,'/');
05101 $rFD_fI = pathinfo($rootFileDat);
05102 if (trim($rootFileDat) && !$containsSlash && (@is_file(PATH_site.$rootFileDat) || t3lib_div::inList('php,html,htm',strtolower($rFD_fI['extension'])))) {
05103 $isLocalFile = 1;
05104 } elseif ($containsSlash) {
05105 $isLocalFile = 2;
05106 }
05107
05108 if($pU['scheme'] || ($isLocalFile!=1 && $urlChar && (!$containsSlash || $urlChar<$fileChar))) {
05109 $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
05110 if ($conf['extTarget.']) {$target = $this->stdWrap($target, $conf['extTarget.']);}
05111 if ($forceTarget) {$target=$forceTarget;}
05112 if ($linktxt=='') $linktxt = $link_param;
05113 if (!$pU['scheme']) {$scheme='http:
05114 if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
05115 $this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($scheme.$link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
05116 } else {
05117 $this->lastTypoLinkUrl = $scheme.$link_param;
05118 }
05119 $this->lastTypoLinkTarget = $target;
05120 $finalTagParts['url']=$this->lastTypoLinkUrl;
05121 $finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
05122 $finalTagParts['TYPE']='url';
05123 } elseif ($containsSlash || $isLocalFile) {
05124 $splitLinkParam = explode('?', $link_param);
05125 if (@file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
05126 if ($linktxt=='') $linktxt = rawurldecode($link_param);
05127 if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
05128 $this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
05129 } else {
05130 $this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$link_param;
05131 }
05132 if ($forceTarget) {$target=$forceTarget;}
05133 $this->lastTypoLinkTarget = $target;
05134
05135 $finalTagParts['url'] = $this->lastTypoLinkUrl;
05136 $finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
05137 $finalTagParts['TYPE'] = 'file';
05138 } else {
05139 $GLOBALS['TT']->setTSlogMessage("typolink(): File '".$splitLinkParam[0]."' did not exist, so '".$linktxt."' was not linked.",1);
05140 return $linktxt;
05141 }
05142 } else {
05143 if ($conf['no_cache.']) $conf['no_cache']=$this->stdWrap($conf['no_cache'], $conf['no_cache.']);
05144 $link_params_parts=explode('#',$link_param);
05145 $link_param = trim($link_params_parts[0]);
05146 if (!strcmp($link_param,'')) {$link_param=$GLOBALS['TSFE']->id;}
05147 if ($link_params_parts[1] && !$sectionMark) {
05148 $sectionMark = trim($link_params_parts[1]);
05149 $sectionMark = (t3lib_div::testInt($sectionMark)?'#c':'#').$sectionMark;
05150 }
05151
05152 unset($theTypeP);
05153 $pairParts = t3lib_div::trimExplode(',',$link_param);
05154 if (count($pairParts)>1) {
05155 $link_param = $pairParts[0];
05156 $theTypeP = $pairParts[1];
05157 }
05158
05159 if (!t3lib_div::testInt($link_param)) {
05160 $link_param = $GLOBALS['TSFE']->sys_page->getPageIdFromAlias($link_param);
05161 }
05162
05163
05164 $disableGroupAccessCheck = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] ? TRUE : FALSE;
05165 $page = $GLOBALS['TSFE']->sys_page->getPage($link_param,$disableGroupAccessCheck);
05166
05167 if (count($page)) {
05168
05169 $MPvarAcc = array();
05170 if (!$GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue']) {
05171 $temp_MP = $this->getClosestMPvalueForPage($page['uid'],TRUE);
05172 if ($temp_MP) $MPvarAcc['closest'] = $temp_MP;
05173 }
05174
05175 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($page['uid'], $page);
05176 if (is_array($mount_info) && $mount_info['overlay']) {
05177 $page = $GLOBALS['TSFE']->sys_page->getPage($mount_info['mount_pid'],$disableGroupAccessCheck);
05178 if (!count($page)) {
05179 $GLOBALS['TT']->setTSlogMessage("typolink(): Mount point '".$mount_info['mount_pid']."' was not available, so '".$linktxt."' was not linked.",1);
05180 return $linktxt;
05181 }
05182 $MPvarAcc['re-map'] = $mount_info['MPvar'];
05183 }
05184
05185
05186 if ($linktxt=='') $linktxt = $page['title'];
05187
05188
05189 $addQueryParams = $conf['addQueryString'] ? $this->getQueryArguments($conf['addQueryString.']) : '';
05190 $addQueryParams .= trim($this->stdWrap($conf['additionalParams'],$conf['additionalParams.']));
05191 if (substr($addQueryParams,0,1)!='&') {
05192 $addQueryParams = '';
05193 } elseif ($conf['useCacheHash']) {
05194 $pA = t3lib_div::cHashParams($addQueryParams.$GLOBALS['TSFE']->linkVars);
05195 $addQueryParams.= '&cHash='.t3lib_div::shortMD5(serialize($pA));
05196 }
05197
05198 $tCR_domain = '';
05199
05200 if (count($MPvarAcc)) {
05201
05202 $addQueryParams.= '&MP='.rawurlencode(implode(',',$MPvarAcc));
05203 }
05204 elseif ($GLOBALS['TSFE']->config['config']['typolinkCheckRootline']) {
05205
05206 $tCR_rootline = $GLOBALS['TSFE']->sys_page->getRootLine($page['uid']);
05207 $tCR_flag = 0;
05208 foreach($tCR_rootline as $tCR_data) {
05209 if ($tCR_data['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
05210 $tCR_flag = 1;
05211 break;
05212 }
05213 }
05214 if (!$tCR_flag) {
05215 foreach($tCR_rootline as $tCR_data) {
05216 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_domain', 'pid='.intval($tCR_data['uid']).' AND redirectTo=\'\''.$this->enableFields('sys_domain'), '', 'sorting');
05217 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
05218 $tCR_domain = preg_replace('/\/$/','',$row['domainName']);
05219 break;
05220 }
05221 }
05222 }
05223 }
05224
05225 if (strlen($tCR_domain)) {
05226 $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
05227 if ($conf['extTarget.']) {$target = $this->stdWrap($target, $conf['extTarget.']);}
05228 if ($forceTarget) {$target=$forceTarget;}
05229 $LD['target'] = $target;
05230 $this->lastTypoLinkUrl = $this->URLqMark('http:
05231 } else {
05232 if ($forceTarget) {$target=$forceTarget;}
05233 $LD = $GLOBALS['TSFE']->tmpl->linkData($page,$target,$conf['no_cache'],'','',$addQueryParams,$theTypeP);
05234 $this->lastTypoLinkUrl = $this->URLqMark($LD['totalURL'],'').$sectionMark;
05235 }
05236
05237 $this->lastTypoLinkTarget = $LD['target'];
05238 $targetPart = $LD['target'] ? ' target="'.$LD['target'].'"' : '';
05239
05240
05241 if ($sectionMark && !trim($addQueryParams) && $page['uid']==$GLOBALS['TSFE']->id && !$GLOBALS['TSFE']->config['config']['baseURL']) {
05242 list(,$URLparams) = explode('?',$this->lastTypoLinkUrl);
05243 list($URLparams) = explode('#',$URLparams);
05244 parse_str ($URLparams.$LD['orig_type'], $URLparamsArray);
05245 if (intval($URLparamsArray['type'])==$GLOBALS['TSFE']->type) {
05246 unset($URLparamsArray['id']);
05247 unset($URLparamsArray['type']);
05248 if (!count($URLparamsArray)) {
05249 $this->lastTypoLinkUrl = $sectionMark;
05250 }
05251 }
05252 }
05253
05254
05255 if ($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] &&
05256 $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages']!=='NONE' &&
05257 !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
05258 $thePage = $GLOBALS['TSFE']->sys_page->getPage($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages']);
05259
05260 $addParams = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages_addParams'];
05261 $addParams = str_replace('###RETURN_URL###',rawurlencode($this->lastTypoLinkUrl),$addParams);
05262 $addParams = str_replace('###PAGE_ID###',$page['uid'],$addParams);
05263 $LD = $GLOBALS['TSFE']->tmpl->linkData($thePage,$target,'','','',$addParams,$theTypeP);
05264 $this->lastTypoLinkUrl = $this->URLqMark($LD['totalURL'],'');
05265 }
05266
05267
05268 $finalTagParts['url']=$this->lastTypoLinkUrl;
05269 $finalTagParts['targetParams']=$targetPart;
05270 $finalTagParts['TYPE']='page';
05271 } else {
05272 $GLOBALS['TT']->setTSlogMessage("typolink(): Page id '".$link_param."' was not found, so '".$linktxt."' was not linked.",1);
05273 return $linktxt;
05274 }
05275 }
05276 }
05277
05278 if ($forceTitle) {$title=$forceTitle;}
05279
05280 if ($JSwindowParams) {
05281
05282
05283 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
05284 $target = ' target="FEopenLink"';
05285 } else {
05286 $target = '';
05287 }
05288
05289 $onClick="vHWin=window.open('".$GLOBALS['TSFE']->baseUrlWrap($finalTagParts['url'])."','FEopenLink','".$JSwindowParams."');vHWin.focus();return false;";
05290 $res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'. $target .' onclick="'.htmlspecialchars($onClick).'"'.($title?' title="'.$title.'"':'').($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
05291 } else {
05292 if ($GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii' && $finalTagParts['TYPE'] === 'mailto') {
05293 $res = '<a href="'.$finalTagParts['url'].'"'.($title?' title="'.$title.'"':'').$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
05294 } else {
05295 $res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.($title?' title="'.$title.'"':'').$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
05296 }
05297 }
05298
05299
05300 if ($conf['userFunc']) {
05301 $finalTagParts['TAG']=$res;
05302 $res = $this->callUserFunction($conf['userFunc'],$conf['userFunc.'],$finalTagParts);
05303 }
05304
05305
05306 if ($conf['returnLast']) {
05307 switch($conf['returnLast']) {
05308 case 'url':
05309 return $this->lastTypoLinkUrl;
05310 break;
05311 case 'target':
05312 return $this->lastTypoLinkTarget;
05313 break;
05314 }
05315 }
05316
05317 if ($conf['ATagBeforeWrap']) {
05318 return $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
05319 } else {
05320 return $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
05321 }
05322 } else {
05323 return $linktxt;
05324 }
05325 }
05326
05335 function typoLink_URL($conf) {
05336 $this->typolink('|',$conf);
05337 return $this->lastTypoLinkUrl;
05338 }
05339
05353 function getTypoLink($label,$params,$urlParameters=array(),$target='') {
05354 $conf=array();
05355 $conf['parameter'] = $params;
05356 if ($target) {
05357 $conf['target']=$target;
05358 $conf['extTarget']=$target;
05359 }
05360 if (is_array($urlParameters)) {
05361 if (count($urlParameters)) {
05362 $conf['additionalParams'].= t3lib_div::implodeArrayForUrl('',$urlParameters);
05363 }
05364 } else {
05365 $conf['additionalParams'].=$urlParameters;
05366 }
05367 $out = $this->typolink($label,$conf);
05368 return $out;
05369 }
05370
05380 function getTypoLink_URL($params,$urlParameters=array(),$target='') {
05381 $this->getTypoLink('',$params,$urlParameters,$target);
05382 return $this->lastTypoLinkUrl;
05383 }
05384
05392 function typolinkWrap($conf) {
05393 $k=md5(microtime());
05394 return explode($k,$this->typolink($k,$conf));
05395 }
05396
05405 function currentPageUrl($urlParameters=array(),$id=0) {
05406 return $this->getTypoLink_URL($id?$id:$GLOBALS['TSFE']->id,$urlParameters,$GLOBALS['TSFE']->sPre);
05407 }
05408
05418 function getClosestMPvalueForPage($pageId, $raw=FALSE) {
05419
05420 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'] && $GLOBALS['TSFE']->MP) {
05421
05422 if (!strcmp($GLOBALS['TSFE']->id, $pageId)) {
05423 $MP = $GLOBALS['TSFE']->MP;
05424 } else {
05425 $tCR_rootline = $GLOBALS['TSFE']->sys_page->getRootLine($pageId, '', TRUE);
05426 $inverseTmplRootline = array_reverse($GLOBALS['TSFE']->tmpl->rootLine);
05427
05428 $rl_mpArray = array();
05429 $startMPaccu = FALSE;
05430
05431
05432 foreach($tCR_rootline as $tCR_data) {
05433 foreach($inverseTmplRootline as $rlKey => $invTmplRLRec) {
05434
05435
05436 if ($startMPaccu && $invTmplRLRec['_MP_PARAM']) {
05437 $rl_mpArray[] = $invTmplRLRec['_MP_PARAM'];
05438 }
05439
05440
05441
05442 if ($tCR_data['pid']==$invTmplRLRec['pid'] && count($inverseTmplRootline)!=$rlKey+1) {
05443 $startMPaccu = TRUE;
05444 }
05445 }
05446 if ($startMPaccu) break;
05447 }
05448
05449 if (count($rl_mpArray)) {
05450 $MP = implode(',', array_reverse($rl_mpArray));
05451 }
05452 }
05453 }
05454
05455 return !$raw ? ($MP ? '&MP='.rawurlencode($MP) : '') : $MP;
05456 }
05457
05468 function getMailTo($mailAddress,$linktxt,$initP='?') {
05469 if(!strcmp($linktxt,'')) { $linktxt = $mailAddress; }
05470
05471 $mailToUrl = 'mailto:'.$mailAddress;
05472
05473 if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
05474 if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
05475 if ($GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii') {
05476 $mailToUrl = $GLOBALS['TSFE']->encryptEmail($mailToUrl);
05477 } else {
05478 $mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail($mailToUrl)."');";
05479 }
05480 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
05481 $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
05482 }
05483 $linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
05484
05485 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']) {
05486 $lastDotLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']);
05487 $lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)';
05488 $linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
05489 }
05490 }
05491 } else {
05492 $mailToUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($mailToUrl).$GLOBALS['TSFE']->getMethodUrlIdToken;
05493 }
05494 return array($mailToUrl,$linktxt);
05495 }
05496
05506 function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE) {
05507 $rawValues = FALSE;
05508 switch((string)$conf['method']) {
05509 case 'GET':
05510 $q_in = t3lib_div::_GET();
05511 break;
05512 case 'POST':
05513 $q_in = t3lib_div::_POST();
05514 break;
05515 default:
05516
05517 if (!$conf['exclude']) return '&'.t3lib_div::getIndpEnv('QUERY_STRING');
05518
05519 $q_in = array();
05520 foreach (explode('&',t3lib_div::getIndpEnv('QUERY_STRING')) as $arg) {
05521 list($k,$v) = explode('=',$arg);
05522 $q_in[$k] = $v;
05523 }
05524 $rawValues = TRUE;
05525 }
05526
05527 if ($conf['exclude']) {
05528 $q_out = array();
05529 $exclude = t3lib_div::trimExplode(',', $conf['exclude']);
05530 $exclude[] = 'id';
05531 foreach ($q_in as $k => $v) {
05532 if (!in_array($k, $exclude)) {
05533 if (isset($overruleQueryArgs[$k])) {
05534 $v = $overruleQueryArgs[$k];
05535 unset($overruleQueryArgs[$k]);
05536 }
05537 $q_out[$k] = $v;
05538 }
05539 }
05540
05541 if ($forceArgs) {
05542 foreach ($overruleQueryArgs as $k => $v) {
05543 $q_out[$k] = $v;
05544 }
05545 }
05546 } else {
05547 $q_out = &$q_in;
05548 }
05549
05550 $content = '';
05551 foreach ($q_out as $k => $v) {
05552 $content .= '&'.$k.'='.($rawValues ? $v : rawurlencode($v));
05553 }
05554 return $content;
05555 }
05556
05557
05558
05559
05560
05561
05562
05563
05564
05565
05566
05567
05568
05569
05570
05571
05572
05573
05574
05575
05576
05577
05578
05579
05591 function wrap($content,$wrap,$char='|') {
05592 if ($wrap) {
05593 $wrapArr = explode($char, $wrap);
05594 return trim($wrapArr[0]).$content.trim($wrapArr[1]);
05595 } else return $content;
05596 }
05597
05607 function noTrimWrap($content,$wrap) {
05608 if ($wrap) {
05609 $wrapArr = explode('|', $wrap);
05610 return $wrapArr[1].$content.$wrapArr[2];
05611 } else return $content;
05612 }
05613
05621 function wrapSpace($content, $wrap) {
05622 $result = $content;
05623 if (trim($wrap)) {
05624 $wrapArray = explode('|',$wrap);
05625 $wrapBefore = intval($wrapArray[0]);
05626 $wrapAfter = intval($wrapArray[1]);
05627 if ($wrapBefore) {
05628 $result = '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$wrapBefore.'"'.$this->getBorderAttr(' border="0"').' class="spacer-gif" alt="" title="" /><br />'.$result;
05629 }
05630 if ($wrapAfter) {
05631 $result.='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$wrapAfter.'"'.$this->getBorderAttr(' border="0"').' class="spacer-gif" alt="" title="" /><br />';
05632 }
05633 }
05634 return $result;
05635 }
05636
05647 function callUserFunction($funcName,$conf,$content) {
05648 $pre = $GLOBALS['TSFE']->TYPO3_CONF_VARS['FE']['userFuncClassPrefix'];
05649 if ($pre &&
05650 !t3lib_div::isFirstPartOfStr(trim($funcName),$pre) &&
05651 !t3lib_div::isFirstPartOfStr(trim($funcName),'tx_')
05652 ) {
05653 $GLOBALS['TT']->setTSlogMessage('Function "'.$funcName.'" was not prepended with "'.$pre.'"',3);
05654 return $content;
05655 }
05656
05657 $parts = explode('->',$funcName);
05658 if (count($parts)==2) {
05659 $cls = t3lib_div::makeInstanceClassName($parts[0]);
05660 if (class_exists ($cls)) {
05661 $classObj = new $cls;
05662 if (method_exists($classObj, $parts[1])) {
05663 $classObj->cObj = &$this;
05664 $content = call_user_method($parts[1], $classObj, $content, $conf);
05665 } else {
05666 $GLOBALS['TT']->setTSlogMessage('Method "'.$parts[1].'" did not exist in class "'.$cls.'"',3);
05667 }
05668 } else {
05669 $GLOBALS['TT']->setTSlogMessage('Class "'.$cls.'" did not exist',3);
05670 }
05671 } else {
05672 if (function_exists($funcName)) {
05673 $content = call_user_func($funcName, $content, $conf);
05674 } else {
05675 $GLOBALS['TT']->setTSlogMessage('Function "'.$funcName.'" did not exist',3);
05676 }
05677 }
05678 return $content;
05679 }
05680
05688 function processParams($params) {
05689 $paramArr=array();
05690 $lines=t3lib_div::trimExplode(chr(10),$params,1);
05691 foreach($lines as $val) {
05692 $pair = explode('=',$val,2);
05693 if (!t3lib_div::inList('#,/',substr(trim($pair[0]),0,1))) {
05694 $paramArr[trim($pair[0])] = trim($pair[1]);
05695 }
05696 }
05697 return $paramArr;
05698 }
05699
05706 function keywords($content) {
05707 $listArr = split(',|;|'.chr(10),$content);
05708 reset($listArr);
05709 while(list($k,$v)=each($listArr)) {
05710 $listArr[$k]=trim($v);
05711 }
05712 return implode(',',$listArr);
05713 }
05714
05723 function caseshift($theValue, $case) {
05724 $case = strtolower($case);
05725 switch($case) {
05726 case 'upper':
05727 $theValue = $GLOBALS['TSFE']->csConvObj->conv_case($GLOBALS['TSFE']->renderCharset,$theValue,'toUpper');
05728 #$theValue = strtoupper($theValue);
05729 #$theValue = strtr($theValue, $this->caseConvStrings[0], $this->caseConvStrings[1]);
05730 break;
05731 case 'lower':
05732 $theValue = $GLOBALS['TSFE']->csConvObj->conv_case($GLOBALS['TSFE']->renderCharset,$theValue,'toLower');
05733 #$theValue = strtolower($theValue);
05734 #$theValue = strtr($theValue, $this->caseConvStrings[1], $this->caseConvStrings[0]);
05735 break;
05736 }
05737 return $theValue;
05738 }
05739
05748 function HTMLcaseshift($theValue, $case) {
05749 $inside = 0;
05750 $newVal = '';
05751 $pointer = 0;
05752 $totalLen = strlen($theValue);
05753 do {
05754 if (!$inside) {
05755 $len = strcspn(substr($theValue,$pointer),'<');
05756 $newVal.= $this->caseshift(substr($theValue,$pointer,$len),$case);
05757 $inside = 1;
05758 } else {
05759 $len = strcspn(substr($theValue,$pointer),'>')+1;
05760 $newVal.= substr($theValue,$pointer,$len);
05761 $inside = 0;
05762 }
05763 $pointer+=$len;
05764 } while($pointer<$totalLen);
05765 return $newVal;
05766 }
05767
05777 function bytes($sizeInBytes,$labels) {
05778 return t3lib_div::formatSize($sizeInBytes,$labels);
05779 }
05780
05788 function calcAge($seconds,$labels) {
05789 if (t3lib_div::testInt($labels)) {
05790 $labels = ' min| hrs| days| yrs';
05791 } else {
05792 $labels=str_replace('"','',$labels);
05793 }
05794
05795 $labelArr = explode('|',$labels);
05796 $absSeconds = abs($seconds);
05797 if ($absSeconds<3600) {
05798 $seconds = round ($seconds/60).$labelArr[0];
05799 } elseif ($absSeconds<24*3600) {
05800 $seconds = round ($seconds/3600).$labelArr[1];
05801 } elseif ($absSeconds<365*24*3600) {
05802 $seconds = round ($seconds/(24*3600)).$labelArr[2];
05803 } else {
05804 $seconds = round ($seconds/(365*24*3600)).$labelArr[3];
05805 }
05806 return $seconds;
05807 }
05808
05820 function sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName='', $replyTo='') {
05821
05822 $headers=array();
05823 if ($email_from) {$headers[]='From: '.$email_fromName.' <'.$email_from.'>';}
05824 if ($replyTo) {$headers[]='Reply-To: '.$replyTo;}
05825
05826 $recipients=implode(',',t3lib_div::trimExplode(',',$recipients,1));
05827
05828 $emailContent = trim($msg);
05829 if ($emailContent) {
05830 $parts = split(chr(10),$emailContent,2);
05831 $subject=trim($parts[0]);
05832 $plain_message=trim($parts[1]);
05833
05834 if ($recipients) $GLOBALS['TSFE']->plainMailEncoded($recipients, $subject, $plain_message, implode(chr(10),$headers));
05835 if ($cc) $GLOBALS['TSFE']->plainMailEncoded($cc, $subject, $plain_message, implode(chr(10),$headers));
05836 return true;
05837 }
05838 }
05839
05847 function URLqMark($url,$params) {
05848 if ($params && !strstr($url,'?')) {
05849 return $url.'?'.$params;
05850 } else {
05851 return $url.$params;
05852 }
05853 }
05854
05863 function checkEmail($email) {
05864 return t3lib_div::validEmail($email);
05865 }
05866
05875 function clearTSProperties($TSArr,$propList) {
05876 $list = explode(',',$propList);
05877 while(list(,$prop)=each($list)) {
05878 $prop = trim($prop);
05879 unset($TSArr[$prop]);
05880 unset($TSArr[$prop.'.']);
05881 }
05882 return $TSArr;
05883 }
05884
05894 function mergeTSRef($confArr,$prop) {
05895 if (substr($confArr[$prop],0,1)=='<') {
05896 $key = trim(substr($confArr[$prop],1));
05897 $cF = t3lib_div::makeInstance('t3lib_TSparser');
05898
05899 $old_conf=$confArr[$prop.'.'];
05900 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
05901 if (is_array($old_conf) && count($old_conf)) {
05902 $conf = $this->joinTSarrays($conf,$old_conf);
05903 }
05904 $confArr[$prop.'.']=$conf;
05905 }
05906 return $confArr;
05907 }
05908
05917 function joinTSarrays($conf,$old_conf) {
05918 if (is_array($old_conf)) {
05919 reset($old_conf);
05920 while(list($key,$val)=each($old_conf)) {
05921 if (is_array($val)) {
05922 $conf[$key] = $this->joinTSarrays($conf[$key],$val);
05923 } else {
05924 $conf[$key] = $val;
05925 }
05926 }
05927 }
05928 return $conf;
05929 }
05930
05940 function gifBuilderTextBox($gifbuilderConf, $conf, $text) {
05941 $chars = intval($conf['chars']) ? intval($conf['chars']) : 20;
05942 $lineDist = intval($conf['lineDist']) ? intval($conf['lineDist']) : 20;
05943 $Valign = strtolower(trim($conf['Valign']));
05944 $tmplObjNumber = intval($conf['tmplObjNumber']);
05945 $maxLines = intval($conf['maxLines']);
05946
05947 if ($tmplObjNumber && $gifbuilderConf[$tmplObjNumber]=='TEXT') {
05948 $textArr = $this->linebreaks($text,$chars,$maxLines);
05949 $angle = intval($gifbuilderConf[$tmplObjNumber.'.']['angle']);
05950 reset($textArr);
05951 while(list($c,$textChunk)=each($textArr)) {
05952 $index = $tmplObjNumber+1+($c*2);
05953
05954 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$index);
05955 $rad_angle = 2*pi()/360*$angle;
05956 $x_d = sin($rad_angle)*$lineDist;
05957 $y_d = cos($rad_angle)*$lineDist;
05958
05959 $diff_x_d=0;
05960 $diff_y_d=0;
05961 if ($Valign=='center') {
05962 $diff_x_d = $x_d*count($textArr);
05963 $diff_x_d = $diff_x_d/2;
05964 $diff_y_d = $y_d*count($textArr);
05965 $diff_y_d = $diff_y_d/2;
05966 }
05967
05968
05969 $x_d = round($x_d*$c - $diff_x_d);
05970 $y_d = round($y_d*$c - $diff_y_d);
05971
05972 $gifbuilderConf[$index] = 'WORKAREA';
05973 $gifbuilderConf[$index.'.']['set'] = $x_d.','.$y_d;
05974
05975 $index++;
05976 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$index);
05977 $gifbuilderConf[$index] = 'TEXT';
05978 $gifbuilderConf[$index.'.'] = $this->clearTSProperties($gifbuilderConf[$tmplObjNumber.'.'],'text');
05979 $gifbuilderConf[$index.'.']['text'] = $textChunk;
05980 }
05981 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$tmplObjNumber);
05982 }
05983 return $gifbuilderConf;
05984 }
05985
05996 function linebreaks($string,$chars,$maxLines=0) {
05997 $lines = explode(chr(10),$string);
05998 $lineArr=Array();
05999 $c=0;
06000 while(list(,$paragraph)=each($lines)) {
06001 $words = explode(' ',$paragraph);
06002 while(list(,$word)=each($words)) {
06003 if (strlen($lineArr[$c].$word)>$chars) {
06004 $c++;
06005 }
06006 if (!$maxLines || $c<$maxLines) {
06007 $lineArr[$c].= $word.' ';
06008 }
06009 }
06010 $c++;
06011 }
06012 return $lineArr;
06013 }
06014
06027 function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) {
06028 $JSPart='';
06029 $updateValues=t3lib_div::trimExplode(',',$fieldList);
06030 while(list(,$fKey)=each($updateValues)) {
06031 $value = $dataArray[$fKey];
06032 if (is_array($value)) {
06033 reset($value);
06034 while(list(,$Nvalue)=each($value)) {
06035 $JSPart.="
06036 updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',".t3lib_div::quoteJSvalue($Nvalue, true).")";
06037 }
06038
06039 } else {
06040 $JSPart.="
06041 updateForm('".$formName."','".$arrPrefix."[".$fKey."]',".t3lib_div::quoteJSvalue($value, true).")";
06042 }
06043 }
06044 $JSPart='<script type="text/javascript">
06045 '.$JSPart.'
06046
06047 </script>
06048 ';
06049 $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']='<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.updateform.js"></script>';
06050 return $JSPart;
06051 }
06052
06053
06054
06055
06056
06057
06058
06059
06060
06061
06062
06063
06064
06065
06066
06067
06068
06069
06070
06071
06072
06073
06074
06075
06076
06077
06078
06079
06080
06081
06082
06083
06084
06085
06096 function DBgetDelete($table, $uid, $doExec=FALSE) {
06097 if (intval($uid)) {
06098 if ($GLOBALS['TCA'][$table]['ctrl']['delete']) {
06099 if ($doExec) {
06100 return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), array($GLOBALS['TCA'][$table]['ctrl']['delete'] => 1));
06101 } else {
06102 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid='.intval($uid), array($GLOBALS['TCA'][$table]['ctrl']['delete'] => 1));
06103 }
06104 } else {
06105 if ($doExec) {
06106 return $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid='.intval($uid));
06107 } else {
06108 return $GLOBALS['TYPO3_DB']->DELETEquery($table, 'uid='.intval($uid));
06109 }
06110 }
06111 }
06112 }
06113
06128 function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE) {
06129 unset($dataArr['uid']);
06130 $uid=intval($uid);
06131
06132 if ($uid) {
06133 $fieldList = implode(',',t3lib_div::trimExplode(',',$fieldList,1));
06134 $updateFields=array();
06135
06136 foreach($dataArr as $f => $v) {
06137 if (t3lib_div::inList($fieldList,$f)) {
06138 $updateFields[$f] = $v;
06139 }
06140 }
06141
06142 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
06143 $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = time();
06144 }
06145
06146 if (count($updateFields)) {
06147 if ($doExec) {
06148 return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
06149 } else {
06150 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid='.intval($uid), $updateFields);
06151 }
06152 }
06153 }
06154 }
06155
06170 function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE) {
06171 $extraList='pid';
06172 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {$field=$GLOBALS['TCA'][$table]['ctrl']['tstamp']; $dataArr[$field]=time(); $extraList.=','.$field;}
06173 if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) {$field=$GLOBALS['TCA'][$table]['ctrl']['crdate']; $dataArr[$field]=time(); $extraList.=','.$field;}
06174 if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['cruser_id']; $dataArr[$field]=0; $extraList.=','.$field;}
06175 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']; $dataArr[$field]=intval($GLOBALS['TSFE']->fe_user->user['uid']); $extraList.=','.$field;}
06176 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']; list($dataArr[$field])=explode(',',$GLOBALS['TSFE']->fe_user->user['usergroup']); $dataArr[$field]=intval($dataArr[$field]); $extraList.=','.$field;}
06177
06178 unset($dataArr['uid']);
06179 if ($pid>=0) { $dataArr['pid'] = $pid; }
06180 $fieldList = implode(',',t3lib_div::trimExplode(',',$fieldList.','.$extraList,1));
06181
06182 $insertFields = array();
06183 foreach($dataArr as $f => $v) {
06184 if (t3lib_div::inList($fieldList,$f)) {
06185 $insertFields[$f] = $v;
06186 }
06187 }
06188
06189 if ($doExec) {
06190 return $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields);
06191 } else {
06192 return $GLOBALS['TYPO3_DB']->INSERTquery($table, $insertFields);
06193 }
06194 }
06195
06207 function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0) {
06208 $groupList = $allowedGroups ? implode(',',array_intersect(t3lib_div::trimExplode(',',$feUserRow['usergroup'],1),t3lib_div::trimExplode(',',$allowedGroups,1))) : $feUserRow['usergroup'];
06209 $ok=0;
06210
06211 if (!$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] || !$row[$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']]) {
06212
06213 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {
06214 $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']]);
06215 if ($rowFEUser && $rowFEUser==$feUserRow['uid']) {
06216 $ok=1;
06217 }
06218 }
06219
06220 if ($feEditSelf && $table=='fe_users' && !strcmp($feUserRow['uid'],$row['uid'])) {
06221 $ok=1;
06222 }
06223
06224 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {
06225 $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']]);
06226 if ($rowFEUser) {
06227 if (t3lib_div::inList($groupList, $rowFEUser)) {
06228 $ok=1;
06229 }
06230 }
06231 }
06232 }
06233 return $ok;
06234 }
06235
06247 function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0) {
06248
06249 $groupList = $allowedGroups ? implode(',',array_intersect(t3lib_div::trimExplode(',',$feUserRow['usergroup'],1),t3lib_div::trimExplode(',',$allowedGroups,1))) : $feUserRow['usergroup'];
06250 $OR_arr=array();
06251
06252 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {
06253 $OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id'].'='.$feUserRow['uid'];
06254 }
06255
06256 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {
06257 $values = t3lib_div::intExplode(',',$groupList);
06258 while(list(,$theGroupUid)=each($values)) {
06259 if ($theGroupUid) {$OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'].'='.$theGroupUid;}
06260 }
06261 }
06262
06263 if ($feEditSelf && $table=='fe_users') {
06264 $OR_arr[]='uid='.intval($feUserRow['uid']);
06265 }
06266
06267 $whereDef=' AND 1=0';
06268 if (count($OR_arr)) {
06269 $whereDef=' AND ('.implode(' OR ',$OR_arr).')';
06270 if ($GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']) {
06271 $whereDef.=' AND '.$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'].'=0';
06272 }
06273 }
06274 return $whereDef;
06275 }
06276
06287 function enableFields($table,$show_hidden=0) {
06288 return $GLOBALS['TSFE']->sys_page->enableFields($table,$show_hidden?$show_hidden:($table=='pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords));
06289 }
06290
06311 function getTreeList($id,$depth,$begin=0,$dontCheckEnableFields=FALSE,$addSelectFields='',$moreWhereClauses='', $prevId_array=array(), $recursionLevel=0) {
06312
06313
06314 $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state'.$addSelectFields;
06315 $depth = intval($depth);
06316 $begin = intval($begin);
06317 $id = intval($id);
06318 $theList = '';
06319 $addId = 0;
06320
06321 if ($id) {
06322
06323
06324 if (!$recursionLevel) {
06325
06326 if ($id < 0) {
06327 $addId = $id = abs($id);
06328 }
06329
06330 if ($GLOBALS['TSFE']->sys_page->getRawRecord('pages',$id,'uid')) {
06331
06332
06333 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($id);
06334 if (is_array($mount_info)) {
06335 $id = $mount_info['mount_pid'];
06336
06337 if ($addId && $mount_info['overlay']) {
06338 $addId = $id;
06339 }
06340 }
06341 } else return '';
06342 }
06343
06344
06345 if ($begin<=0) {
06346 $prevId_array[] = $id;
06347 }
06348
06349
06350 if ($depth>0) {
06351 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($allFields, 'pages', 'pid='.intval($id).' AND deleted=0'.$moreWhereClauses, '' ,'sorting');
06352 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
06353 $GLOBALS['TSFE']->sys_page->versionOL('pages',$row);
06354
06355 if ($row['doktype']==255 || $row['doktype']==6 || $row['t3ver_state']==1) { unset($row); }
06356
06357 if (is_array($row)) {
06358
06359 $next_id = $row['uid'];
06360 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($next_id, $row);
06361
06362 if (is_array($mount_info) && $mount_info['overlay']) {
06363 $next_id = $mount_info['mount_pid'];
06364 $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($allFields, 'pages', 'uid='.intval($next_id).' AND deleted=0'.$moreWhereClauses, '' ,'sorting');
06365 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2);
06366 $GLOBALS['TSFE']->sys_page->versionOL('pages',$row);
06367
06368 if ($row['doktype']==255 || $row['doktype']==6 || $row['t3ver_state']==1) { unset($row); }
06369 }
06370
06371 if (is_array($row) && ($dontCheckEnableFields || $GLOBALS['TSFE']->checkPagerecordForIncludeSection($row))) {
06372
06373 if ($begin<=0) {
06374 if ($dontCheckEnableFields || $GLOBALS['TSFE']->checkEnableFields($row)) {
06375 $theList.= $next_id.',';
06376 }
06377 }
06378
06379 if ($depth>1 && !$row['php_tree_stop']) {
06380
06381 if (is_array($mount_info) && !$mount_info['overlay']) {
06382 $next_id = $mount_info['mount_pid'];
06383 }
06384
06385 if (!in_array($next_id,$prevId_array)) {
06386 $theList.= tslib_cObj::getTreeList($next_id, $depth-1, $begin-1, $dontCheckEnableFields, $addSelectFields, $moreWhereClauses, $prevId_array, $recursionLevel+1);
06387 }
06388 }
06389 }
06390 }
06391 }
06392 }
06393 }
06394
06395 if (!$recursionLevel) {
06396 if ($addId) {
06397 if ($begin>0) {
06398 $theList.= 0;
06399 } else {
06400 $theList.= $addId;
06401 }
06402 }
06403 }
06404
06405 return $theList;
06406 }
06407
06417 function whereSelectFromList($field,$value) {
06418 return $GLOBALS['TYPO3_DB']->listQuery($field,$value,'');
06419 }
06420
06435 function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') {
06436 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
06437 $select,
06438 $local_table.','.$mm_table.($foreign_table?','.$foreign_table:''),
06439 $local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').
06440 $whereClause,
06441 $groupBy,
06442 $orderBy,
06443 $limit
06444 );
06445 }
06446
06462 function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='') {
06463 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
06464 $select,
06465 $mm_table.($foreign_table?','.$foreign_table:''),
06466 $mm_table.'.uid_local IN ('.$local_table_uidlist.')'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').
06467 $whereClause,
06468 $groupBy,
06469 $orderBy,
06470 $limit
06471 );
06472 }
06473
06483 function searchWhere($sw,$searchFieldList,$searchTable='') {
06484 global $TYPO3_DB;
06485
06486 $prefixTableName = $searchTable ? $searchTable.'.' : '';
06487 $where = '';
06488 if ($sw) {
06489 $searchFields = explode(',',$searchFieldList);
06490 $kw = split('[ ,]',$sw);
06491
06492 while(list(,$val)=each($kw)) {
06493 $val = trim($val);
06494 $where_p = array();
06495 if (strlen($val)>=2) {
06496 $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val,$searchTable),$searchTable);
06497 reset($searchFields);
06498 while(list(,$field)=each($searchFields)) {
06499 $where_p[] = $prefixTableName.$field.' LIKE \'%'.$val.'%\'';
06500 }
06501 }
06502 if (count($where_p)) {
06503 $where.=' AND ('.implode(' OR ',$where_p).')';
06504 }
06505 }
06506 }
06507 return $where;
06508 }
06509
06519 function exec_getQuery($table, $conf) {
06520 $queryParts = $this->getQuery($table, $conf, TRUE);
06521
06522 return $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
06523 }
06524
06537 function getQuery($table, $conf, $returnQueryArray=FALSE) {
06538
06539
06540 $conf['pidInList'] = trim($this->stdWrap($conf['pidInList'],$conf['pidInList.']));
06541 if (!strcmp($conf['pidInList'],'')) {
06542 $conf['pidInList'] = 'this';
06543 }
06544 $queryParts = $this->getWhere($table,$conf,TRUE);
06545
06546
06547 $queryParts['SELECT'] = $conf['selectFields'] ? $conf['selectFields'] : '*';
06548
06549
06550 if ($conf['max'] || $conf['begin']) {
06551 $error=0;
06552
06553
06554 if (strstr(strtolower($conf['begin'].$conf['max']),'total')) {
06555 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, $queryParts['WHERE'], $queryParts['GROUPBY']);
06556 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
06557 $GLOBALS['TT']->setTSlogMessage($error);
06558 } else {
06559 $total = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
06560 $conf['max'] = eregi_replace('total', (string)$total, $conf['max']);
06561 $conf['begin'] = eregi_replace('total', (string)$total, $conf['begin']);
06562 }
06563 }
06564 if (!$error) {
06565 $conf['begin'] = t3lib_div::intInRange(ceil($this->calc($conf['begin'])),0);
06566 $conf['max'] = t3lib_div::intInRange(ceil($this->calc($conf['max'])),0);
06567 if ($conf['begin'] && !$conf['max']) {
06568 $conf['max'] = 100000;
06569 }
06570
06571 if ($conf['begin'] && $conf['max']) {
06572 $queryParts['LIMIT'] = $conf['begin'].','.$conf['max'];
06573 } elseif (!$conf['begin'] && $conf['max']) {
06574 $queryParts['LIMIT'] = $conf['max'];
06575 }
06576 }
06577 }
06578
06579 if (!$error) {
06580
06581
06582 $joinPart='';
06583 if ($conf['join']) {
06584 $joinPart = 'JOIN ' .trim($conf['join']);
06585 } elseif ($conf['leftjoin']) {
06586 $joinPart = 'LEFT OUTER JOIN ' .trim($conf['leftjoin']);
06587 } elseif ($conf['rightjoin']) {
06588 $joinPart = 'RIGHT OUTER JOIN ' .trim($conf['rightjoin']);
06589 }
06590
06591
06592 $queryParts['FROM'] = trim($table.' '.$joinPart);
06593 $query = $GLOBALS['TYPO3_DB']->SELECTquery(
06594 $queryParts['SELECT'],
06595 $queryParts['FROM'],
06596 $queryParts['WHERE'],
06597 $queryParts['GROUPBY'],
06598 $queryParts['ORDERBY'],
06599 $queryParts['LIMIT']
06600 );
06601 return $returnQueryArray ? $queryParts : $query;
06602 }
06603 }
06604
06616 function getWhere($table,$conf, $returnQueryArray=FALSE) {
06617 global $TCA;
06618
06619
06620 $query = '';
06621 $pid_uid_flag=0;
06622 $queryParts = array(
06623 'SELECT' => '',
06624 'FROM' => '',
06625 'WHERE' => '',
06626 'GROUPBY' => '',
06627 'ORDERBY' => '',
06628 'LIMIT' => ''
06629 );
06630
06631 if (trim($conf['uidInList'])) {
06632 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['uidInList']));
06633 if (count($listArr)==1) {
06634 $query.=' AND '.$table.'.uid='.intval($listArr[0]);
06635 } else {
06636 $query.=' AND '.$table.'.uid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($listArr)).')';
06637 }
06638 $pid_uid_flag++;
06639 }
06640 if (trim($conf['pidInList'])) {
06641 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['pidInList']));
06642
06643 $listArr = $this->checkPidArray($listArr);
06644 if (count($listArr)) {
06645 $query.=' AND '.$table.'.pid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($listArr)).')';
06646 $pid_uid_flag++;
06647 } else {
06648 $pid_uid_flag=0;
06649 }
06650 }
06651 if (!$pid_uid_flag) {
06652 $query.=' AND '.$table.'.uid=0';
06653 }
06654 if ($where = trim($conf['where'])) {
06655 $query.=' AND '.$where;
06656 }
06657
06658 if ($conf['languageField']) {
06659 if ($GLOBALS['TSFE']->sys_language_contentOL && $TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
06660
06661 $sys_language_content = '0,-1';
06662 } else {
06663 $sys_language_content = intval($GLOBALS['TSFE']->sys_language_content);
06664 }
06665 $query.=' AND '.$conf['languageField'].' IN ('.$sys_language_content.')';
06666 }
06667
06668 $andWhere = trim($this->stdWrap($conf['andWhere'],$conf['andWhere.']));
06669 if ($andWhere) {
06670 $query.=' AND '.$andWhere;
06671 }
06672
06673
06674 if ($table=='pages') {
06675 $query.=' '.$GLOBALS['TSFE']->sys_page->where_hid_del.
06676 $GLOBALS['TSFE']->sys_page->where_groupAccess;
06677 } else {
06678 $query.=$this->enableFields($table);
06679 }
06680
06681
06682 if ($query) {
06683 $queryParts['WHERE'] = trim(substr($query,4));
06684 $query = 'WHERE '.$queryParts['WHERE'];
06685 }
06686
06687
06688 if (trim($conf['groupBy'])) {
06689 $queryParts['GROUPBY'] = trim($conf['groupBy']);
06690 $query.=' GROUP BY '.$queryParts['GROUPBY'];
06691 }
06692
06693
06694 if (trim($conf['orderBy'])) {
06695 $queryParts['ORDERBY'] = trim($conf['orderBy']);
06696 $query.=' ORDER BY '.$queryParts['ORDERBY'];
06697 }
06698
06699
06700 return $returnQueryArray ? $queryParts : $query;
06701 }
06702
06711 function checkPidArray($listArr) {
06712 $outArr = Array();
06713 if (is_array($listArr) && count($listArr)) {
06714 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid IN ('.implode(',',$listArr).')'.$this->enableFields('pages').' AND doktype NOT IN ('.$this->checkPid_badDoktypeList.')');
06715 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
06716 $GLOBALS['TT']->setTSlogMessage($error.': '.$query,3);
06717 } else {
06718 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
06719 $outArr[] = $row['uid'];
06720 }
06721 }
06722 }
06723 return $outArr;
06724 }
06725
06734 function checkPid($uid) {
06735 $uid = intval($uid);
06736 if (!isset($this->checkPid_cache[$uid])) {
06737 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid='.intval($uid).$this->enableFields('pages').' AND doktype NOT IN ('.$this->checkPid_badDoktypeList.')');
06738 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
06739 $this->checkPid_cache[$uid] = 1;
06740 } else {
06741 $this->checkPid_cache[$uid] = 0;
06742 }
06743 }
06744 return $this->checkPid_cache[$uid];
06745 }
06746
06747
06748
06749
06750
06751
06752
06753
06754
06755
06756
06757
06758
06759
06760
06761
06762
06763
06764
06765
06766
06767
06768
06769
06770
06771
06772
06773
06774
06775
06776
06777
06790 function editPanel($content, $conf, $currentRecord='', $dataArr=array()) {
06791 global $TCA,$BE_USER;
06792
06793
06794 if (!$GLOBALS['TSFE']->beUserLogin) { return $content; }
06795
06796
06797 if ($conf['newRecordFromTable']) {
06798 $currentRecord = $conf['newRecordFromTable'].':NEW';
06799 $conf['allow']='new';
06800 }
06801
06802 if (!$currentRecord) $currentRecord=$this->currentRecord;
06803 if (!count($dataArr)) $dataArr=$this->data;
06804 list($table,$uid) = explode(':',$currentRecord);
06805 $mayEdit=0;
06806 $nPid=intval($conf['newRecordInPid']);
06807
06808
06809 if ($table === 'pages') {
06810 $lang = $GLOBALS['TSFE']->sys_language_uid;
06811 } elseif ($table === 'tt_content') {
06812 $lang = $GLOBALS['TSFE']->sys_language_content;
06813 } elseif ($TCA[$table]['ctrl']['languageField']) {
06814 $lang = $currentRecord[$TCA[$table]['ctrl']['languageField']];
06815 } else {
06816 $lang = -1;
06817 }
06818 if (!$BE_USER->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid)) { return $content; }
06819
06820 if (!$conf['onlyCurrentPid'] || $dataArr['pid']==$GLOBALS['TSFE']->id) {
06821
06822 $types = t3lib_div::trimExplode(',',strtolower($conf['allow']),1);
06823 $allow = array_flip($types);
06824
06825 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
06826 if ($table=='pages') {
06827 if (count($GLOBALS['TSFE']->config['rootLine'])==1) {unset($allow['move']); unset($allow['hide']); unset($allow['delete']);}
06828 if (!($perms&2)) {unset($allow['edit']);unset($allow['move']);unset($allow['hide']);}
06829 if (!($perms&4)) unset($allow['delete']);
06830 if (!($perms&8)) unset($allow['new']);
06831 if (count($allow)) $mayEdit=1;
06832 $newUid = $uid;
06833 } else {
06834 $mayEdit = count($allow)&&($perms&16);
06835 if ($conf['newRecordFromTable']) {
06836 $newUid=$GLOBALS['TSFE']->id;
06837 if ($nPid) $newUid=$nPid;
06838 } else {
06839 $newUid = -1*$uid;
06840 }
06841 }
06842 }
06843
06844 if ($GLOBALS['TSFE']->displayEditIcons && $table && $mayEdit) {
06845 $GLOBALS['TSFE']->set_no_cache();
06846 $formName = 'TSFE_EDIT_FORM_'.substr($GLOBALS['TSFE']->uniqueHash(),0,4);
06847 $formTag = '<form name="'.$formName.'" action="'.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" onsubmit="return TBE_EDITOR_checkSubmit(1);" style="margin: 0 0 0 0;">';
06848 $sortField = $TCA[$table]['ctrl']['sortby'];
06849 $labelField = $TCA[$table]['ctrl']['label'];
06850 $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
06851 $blackLine = $conf['line']?'<img src="clear.gif" width="1" height="'.intval($conf['line']).'" alt="" title="" /><br /><table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="black" style="border: 0px;"><tr style="border: 0px;"><td style="border: 0px;"><img src="clear.gif" width="1" height="1" alt="" title="" /></td></tr></table><br />':'';
06852
06853 $theCmd='';
06854 $TSFE_EDIT = t3lib_div::_POST('TSFE_EDIT');
06855 if (is_array($TSFE_EDIT) && $TSFE_EDIT['record']==$currentRecord && !$TSFE_EDIT['update_close']) {
06856 $theCmd =$TSFE_EDIT['cmd'];
06857 }
06858
06859 switch($theCmd) {
06860 case 'edit':
06861 case 'new':
06862 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms_FE');
06863 $tceforms->prependFormFieldNames = 'TSFE_EDIT[data]';
06864 $tceforms->prependFormFieldNames_file = 'TSFE_EDIT_file';
06865 $tceforms->doSaveFieldName = 'TSFE_EDIT[doSave]';
06866 $tceforms->formName = $formName;
06867 $tceforms->backPath = TYPO3_mainDir;
06868 $tceforms->setFancyDesign();
06869 $tceforms->defStyle = 'font-family:Verdana;font-size:10px;';
06870 $tceforms->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
06871 $tceforms->helpTextFontTag='<font face="verdana,sans-serif" color="#333333" size="1">';
06872
06873 $trData = t3lib_div::makeInstance('t3lib_transferData');
06874 $trData->addRawData = TRUE;
06875 $trData->defVals = t3lib_div::_GP('defVals');
06876 $trData->fetchRecord($table, ($theCmd=='new'?$newUid:$dataArr['uid']), ($theCmd=='new'?'new':'') );
06877 reset($trData->regTableItems_data);
06878 $processedDataArr = current($trData->regTableItems_data);
06879 $processedDataArr['uid']=$theCmd=='new'?'NEW':$dataArr['uid'];
06880 $processedDataArr['pid']=$theCmd=='new'?$newUid:$dataArr['pid'];
06881
06882 $panel='';
06883 $buttons = '<input type="image" border="0" name="TSFE_EDIT[update]" src="'.$tceforms->backPath.'gfx/savedok.gif" hspace="2" width="21" height="16" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc',1).'" />';
06884 $buttons.= '<input type="image" border="0" name="TSFE_EDIT[update_close]" src="'.$tceforms->backPath.'gfx/saveandclosedok.gif" hspace="2" width="21" height="16" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc',1).'" />';
06885 $buttons.= '<input type="image" border="0" name="TSFE_EDIT[cancel]" onclick="'.
06886 htmlspecialchars('window.location.href=\''.t3lib_div::getIndpEnv('REQUEST_URI').'\';return false;').
06887 '" src="'.$tceforms->backPath.'gfx/closedok.gif" hspace="2" width="21" height="16" title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc',1).'" />';
06888 $panel.=$tceforms->intoTemplate(array('ITEM'=>$buttons));
06889 $panel.=$tceforms->getMainFields($table,$processedDataArr);
06890
06891 $hiddenF="";
06892 if ($theCmd=='new') {
06893 $hiddenF.='<input type="hidden" name="TSFE_EDIT[data]['.$table.'][NEW][pid]" value="'.$newUid.'" />';
06894 if ($table=='pages') $hiddenF.='<input type="hidden" name="TSFE_EDIT[data]['.$table.'][NEW][hidden]" value="0" />';
06895 } else {
06896 $hiddenF.='<input type="hidden" name="TSFE_EDIT[record]" value="'.$currentRecord.'" />';
06897 $hiddenF.='<input type="hidden" name="TSFE_EDIT[cmd]" value="edit" />';
06898 }
06899 $hiddenF.='<input type="hidden" name="TSFE_EDIT[doSave]" value="0" />';
06900 $panel.=$tceforms->intoTemplate(array('ITEM'=>$buttons.$hiddenF));
06901
06902 $panel=$formTag.$tceforms->wrapTotal($panel,$dataArr,$table).'</form>'.($theCmd!='new'?$blackLine:'');
06903 $finalOut = $tceforms->printNeededJSFunctions_top().($conf['edit.']['displayRecord']?$content:'').$panel.($theCmd=='new'?$blackLine:'').$tceforms->printNeededJSFunctions();
06904 break;
06905 default:
06906 $panel = '';
06907 if (isset($allow['toolbar'])) $panel.=$GLOBALS['BE_USER']->ext_makeToolBar().'<img src="clear.gif" width="2" height="1" alt="" title="" />';
06908 if (isset($allow['edit'])) $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/edit2.gif" width="11" height="12" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_editRecord').'" align="top" alt="" title="" />',$formName,'edit',$dataArr['_LOCALIZED_UID'] ? $table.':'.$dataArr['_LOCALIZED_UID'] : $currentRecord);
06909 if (isset($allow['move']) && $sortField && $BE_USER->workspace===0) {
06910 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/button_up.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_moveUp').'" align="top" alt="" title="" />',$formName,'up');
06911 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/button_down.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_moveDown').'" align="top" alt="" title="" />',$formName,'down');
06912 }
06913 if (isset($allow['hide']) && $hideField && $BE_USER->workspace===0 && !$dataArr['_LOCALIZED_UID']) {
06914 if ($dataArr[$hideField]) {
06915 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/button_unhide.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_unhide').'" align="top" alt="" title="" />',$formName,'unhide');
06916 } else {
06917 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/button_hide.gif" width="11" height="10" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_hide').'" align="top" alt="" title="" />',$formName,'hide','',$BE_USER->extGetLL('p_hideConfirm'));
06918 }
06919 }
06920 if (isset($allow['new'])) {
06921 if ($table=='pages') {
06922 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/new_page.gif" width="13" height="12" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_newSubpage').'" align="top" alt="" title="" />',$formName,'new',$currentRecord,'',$nPid);
06923 } else {
06924 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/new_record.gif" width="16" height="12" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_newRecordAfter').'" align="top" alt="" title="" />',$formName,'new',$currentRecord,'',$nPid);
06925 }
06926 }
06927 if (isset($allow['delete']) && $BE_USER->workspace===0 && !$dataArr['_LOCALIZED_UID']) {
06928 $panel.=$this->editPanelLinkWrap('<img src="'.TYPO3_mainDir.'gfx/delete_record.gif" width="12" height="12" vspace="1" hspace="2" border="0" title="'.$BE_USER->extGetLL('p_delete').'" align="top" alt="" title="" />',$formName,'delete','',$BE_USER->extGetLL('p_deleteConfirm'));
06929 }
06930
06931
06932 $labelTxt = $this->stdWrap($conf['label'],$conf['label.']);
06933 $panel='
06934
06935 <!-- BE_USER Edit Panel: -->
06936 '.$formTag.'
06937 <input type="hidden" name="TSFE_EDIT[cmd]" value="" />
06938 <input type="hidden" name="TSFE_EDIT[record]" value="'.$currentRecord.'" />
06939 <table border="0" cellpadding="0" cellspacing="0" border="1" bordercolor="black" class="typo3-editPanel">
06940 <tr>
06941 <td nowrap="nowrap" bgcolor="#ABBBB4" class="typo3-editPanel-controls">'.$panel.'</td>'.($labelTxt?'
06942 <td nowrap="nowrap" bgcolor="#F6F2E6" class="typo3-editPanel-label"><font face="verdana" size="1" color="black"> '.sprintf($labelTxt,htmlspecialchars(t3lib_div::fixed_lgd($dataArr[$labelField],50))).' </font></td>':'').'
06943 </tr>
06944 </table>
06945 </form>';
06946
06947 if ($conf['innerWrap']) $panel = $this->wrap($panel,$conf['innerWrap']);
06948 if ($conf['innerWrap.']) $panel = $this->stdWrap($panel,$conf['innerWrap.']);
06949
06950 $panel.=$blackLine;
06951
06952 if ($conf['outerWrap']) $panel = $this->wrap($panel,$conf['outerWrap']);
06953 if ($conf['outerWrap.']) $panel = $this->stdWrap($panel,$conf['outerWrap.']);
06954 $finalOut = $content.$panel;
06955 break;
06956 }
06957
06958 if ($conf['previewBorder']) $finalOut = $this->editPanelPreviewBorder($table,$dataArr,$finalOut,$conf['previewBorder'],$conf['previewBorder.']);
06959 return $finalOut;
06960 } else {
06961 return $content;
06962 }
06963 }
06964
06977 function editIcons($content,$params, $conf=array(), $currentRecord='', $dataArr=array(),$addUrlParamStr='') {
06978 global $BE_USER;
06979
06980
06981 if (!$GLOBALS['TSFE']->beUserLogin) {return $content;}
06982
06983
06984 $rParts = explode(':',$currentRecord?$currentRecord:$this->currentRecord);
06985
06986 list($table,$fieldList)=t3lib_div::trimExplode(':',$params,1);
06987 if (!$fieldList) {
06988 $fieldList=$table;
06989 $table=$rParts[0];
06990 } else {
06991 if ($table!=$rParts[0]) return $content;
06992 }
06993
06994
06995 $mayEdit=0;
06996 $dataArr=count($dataArr)?$dataArr:$this->data;
06997
06998 $editUid = $dataArr['_LOCALIZED_UID'] ? $dataArr['_LOCALIZED_UID'] : $rParts[1];
06999
07000 if ($table=='pages') {
07001 $mayEdit = $BE_USER->isAdmin()||$BE_USER->doesUserHaveAccess($dataArr,2)?1:0;
07002 } else {
07003 $mayEdit = $BE_USER->isAdmin()||$BE_USER->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages',$dataArr['pid']),16)?1:0;
07004 }
07005
07006
07007 if ($mayEdit) {
07008 if ($table === 'pages') {
07009 $lang = $GLOBALS['TSFE']->sys_language_uid;
07010 } elseif ($table === 'tt_content') {
07011 $lang = $GLOBALS['TSFE']->sys_language_content;
07012 } elseif ($TCA[$table]['ctrl']['languageField']) {
07013 $lang = $currentRecord[$TCA[$table]['ctrl']['languageField']];
07014 } else {
07015 $lang = -1;
07016 }
07017 if (!$BE_USER->checkLanguageAccess($GLOBALS['TSFE']->sys_language_uid)) { $mayEdit = 0; }
07018 }
07019
07020 if ($GLOBALS['TSFE']->displayFieldEditIcons && $table && $mayEdit && $fieldList) {
07021 $GLOBALS['TSFE']->set_no_cache();
07022 $style = $conf['styleAttribute'] ? ' style="'.htmlspecialchars($conf['styleAttribute']).'"' : '';
07023 $iconTitle = $this->stdWrap($conf['iconTitle'],$conf['iconTitle.']);
07024 $iconImg = $conf['iconImg'] ? $conf['iconImg'] : '<img src="'.TYPO3_mainDir.'gfx/edit_fe.gif" width="11" height="12" border="0" align="top" title="'.t3lib_div::deHSCentities(htmlspecialchars($iconTitle)).'"'.$style.' class="frontEndEditIcons" alt="" title="" />';
07025 $nV=t3lib_div::_GP('ADMCMD_view')?1:0;
07026 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir;
07027 $icon = $this->editPanelLinkWrap_doWrap($iconImg, $adminURL.'alt_doc.php?edit['.$rParts[0].']['.$editUid.']=edit&columnsOnly='.rawurlencode($fieldList).'&noView='.$nV.$addUrlParamStr,implode(':',$rParts));
07028 if ($conf['beforeLastTag']<0) {
07029 $content=$icon.$content;
07030 } elseif ($conf['beforeLastTag']>0) {
07031 $cBuf = rtrim($content);
07032 $securCount=30;
07033 while($securCount && substr($cBuf,-1)=='>' && substr($cBuf,-4)!='</a>') {
07034 $cBuf = rtrim(ereg_replace('<[^<]*>$','',$cBuf));
07035 $securCount--;
07036 }
07037 $content = strlen($cBuf)&&$securCount ? substr($content,0,strlen($cBuf)).$icon.substr($content,strlen($cBuf)) : $content=$icon.$content;
07038 } else {
07039 $content.=$icon;
07040 }
07041 }
07042 return $content;
07043 }
07044
07059 function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='',$nPid='') {
07060 $eFONPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $BE_USER->workspace===0;
07061 $nV=t3lib_div::_GP('ADMCMD_view')?1:0;
07062 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir;
07063
07064 if ($cmd=='edit' && !$eFONPage) {
07065 $rParts = explode(':',$currentRecord);
07066 $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'alt_doc.php?edit['.$rParts[0].']['.$rParts[1].']=edit&noView='.$nV,$currentRecord);
07067 } elseif ($cmd=='new' && !$eFONPage) {
07068 $rParts = explode(':',$currentRecord);
07069 if ($rParts[0]=='pages') {
07070 $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'db_new.php?id='.$rParts[1].'&pagesOnly=1',$currentRecord);
07071 } else {
07072 if (!intval($nPid)) {
07073 $nPid = t3lib_div::testInt($rParts[1]) ? -$rParts[1] : $GLOBALS['TSFE']->id;
07074 }
07075 $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'alt_doc.php?edit['.$rParts[0].']['.$nPid.']=new&noView='.$nV,$currentRecord);
07076 }
07077 } else {
07078 if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) {
07079 $cf1="if (confirm(".t3lib_div::quoteJSvalue($confirm, true).")){";
07080 $cf2='}';
07081 } else {
07082 $cf1=$cf2='';
07083 }
07084 $out='<a href="#" onclick="'.
07085 htmlspecialchars($cf1.'document.'.$formName.'[\'TSFE_EDIT[cmd]\'].value=\''.$cmd.'\'; document.'.$formName.'.submit();'.$cf2.' return false;').
07086 '">'.$string.'</a>';
07087 }
07088 return $out;
07089 }
07090
07101 function editPanelLinkWrap_doWrap($string,$url,$currentRecord) {
07102 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] || $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceNoPopup']) {
07103 $retUrl = t3lib_div::getIndpEnv('REQUEST_URI');
07104 $rParts = explode(':',$currentRecord);
07105 if ($rParts[0]=='tt_content' && $this->parentRecordNumber>2) {
07106 $retUrl.='#'.$rParts[1];
07107 }
07108 return '<a href="'.htmlspecialchars($url.'&returnUrl='.rawurlencode($retUrl)).'">'.$string.'</a>';
07109 } else {
07110 return '<a href="#" onclick="'.
07111 htmlspecialchars('vHWin=window.open(\''.$url.'&returnUrl=close.html\',\'FEquickEditWindow\',\''.($GLOBALS['BE_USER']->uc['edit_wideDocument']?'width=690,height=500':'width=540,height=400').',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;').
07112 '">'.$string.'</a>';
07113 }
07114 }
07115
07129 function editPanelPreviewBorder($table,$row,$content,$thick,$conf=array()) {
07130 if ($this->isDisabled($table,$row)) {
07131 $thick = t3lib_div::intInRange($thick,1,100);
07132 $color = $conf['color'] ? $conf['color'] : '#cccccc';
07133 if ($conf['innerWrap']) $content = $this->wrap($content,$conf['innerWrap']);
07134 if ($conf['innerWrap.']) $content = $this->stdWrap($content,$conf['innerWrap.']);
07135 $content='<table class="typo3-editPanel-previewBorder" border="'.$thick.'" cellpadding="0" cellspacing="0" bordercolor="'.$color.'" width="100%"><tr><td>'.$content.'</td></tr></table>';
07136 if ($conf['outerWrap']) $content = $this->wrap($content,$conf['outerWrap']);
07137 if ($conf['outerWrap.']) $content = $this->stdWrap($panel,$conf['outerWrap.']);
07138 }
07139 return $content;
07140 }
07141
07151 function isDisabled($table,$row) {
07152 global $TCA;
07153 if (
07154 ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) ||
07155 ($TCA[$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup && $row[$TCA[$table]['ctrl']['enablecolumns']['fe_group']]==$GLOBALS['TSFE']->simUserGroup) ||
07156 ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']]>time() ) ||
07157 ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']]<time())
07158 ) return true;
07159 }
07160 }
07161
07162
07163
07164
07165
07166
07167
07168
07169
07170
07171
07172
07173
07174
07182 class tslib_frameset {
07183
07192 function make($setup) {
07193 $content = '';
07194 if (is_array($setup)) {
07195 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
07196 reset($sKeyArray);
07197 while(list(,$theKey)=each($sKeyArray)) {
07198 $theValue=$setup[$theKey];
07199 if (intval($theKey) && $conf=$setup[$theKey.'.']) {
07200 switch($theValue) {
07201 case 'FRAME':
07202 $typeNum = intval($GLOBALS['TSFE']->tmpl->setup[$conf['obj'].'.']['typeNum']);
07203 if (!$conf['src'] && !$typeNum) {
07204 $typeNum = -1;
07205 }
07206 $content.='<frame'.$this->frameParams($conf,$typeNum).' />'.chr(10);
07207 break;
07208 case 'FRAMESET':
07209 $frameset = t3lib_div::makeInstance('tslib_frameset');
07210 $content.=$frameset->make($conf).chr(10);
07211 break;
07212 }
07213 }
07214 }
07215 return '<frameset'.$this->framesetParams($setup).'>'.chr(10).$content.'</frameset>';
07216 }
07217 }
07218
07229 function frameParams($setup, $typeNum) {
07230 $paramStr = '';
07231 $name = $setup['obj'];
07232
07233
07234
07235
07236
07237
07238
07239
07240
07241
07242
07243
07244
07245
07246
07247
07248
07249
07250
07251
07252
07253
07254 $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,'',$GLOBALS['TSFE']->no_cache,'','',($setup['options']?'&'.$setup['options']:'').$GLOBALS['TSFE']->cObj->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']), intval($typeNum));
07255 $finalURL = $LD['totalURL'];
07256
07257
07258 if ($setup['src']) {$paramStr.=' src="'.htmlspecialchars($setup['src']).'"';} else {$paramStr.=' src="'.htmlspecialchars($finalURL).'"';}
07259 if ($setup['name']) {$paramStr.=' name="'.$setup['name'].'"';} else {$paramStr.=' name="'.$name.'"';}
07260 if ($setup['params']) {$paramStr.=' '.$setup['params'];}
07261 return $paramStr;
07262 }
07263
07272 function framesetParams($setup) {
07273 $paramStr = '';
07274 if ($setup['cols']) { $paramStr.=' cols="'.$setup['cols'].'"'; }
07275 if ($setup['rows']) { $paramStr.=' rows="'.$setup['rows'].'"'; }
07276 if ($setup['params']) { $paramStr.=' '.$setup['params']; }
07277 return $paramStr;
07278 }
07279 }
07280
07281
07282
07283
07284
07285
07286
07287
07288
07289
07290
07291
07292
07293
07294
07295
07296
07305 class tslib_tableOffset {
07306 var $tableParams = 'border="0" cellspacing="0" cellpadding="0"';
07307 var $default_tableParams = 'border="0" cellspacing="0" cellpadding="0"';
07308 var $tdParams = ' width="99%" valign="top"';
07309
07317 function start($content,$offset) {
07318 $valPairs = t3lib_div::intExplode(',',$offset.',,,,,');
07319
07320 if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) {
07321
07322 if ($valPairs[4] && $this->default_tableParams==$this->tableParams) {$this->tableParams.=' width="1"';}
07323
07324 $this->begin = chr(10).'<table '.$this->tableParams.'>';
07325 $this->end = '</table>';
07326 $rows=array();
07327 $widthImg = '';
07328 $heightImg = '';
07329
07330 if ($valPairs[4]) {
07331 if (!$valPairs[3]) $valPairs[3]=1;
07332 $widthImg='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$valPairs[4].'" height="1" alt="" title="" />';
07333 }
07334
07335 if ($valPairs[5]) {
07336 if (!$valPairs[2]) $valPairs[2]=1;
07337 $valPairs[2]=1; $heightImg='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$valPairs[5].'" alt="" title="" />';
07338 }
07339
07340
07341 if ($valPairs[1]) {
07342 $rows[1].= '<tr>';
07343 $rows[1].= '<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($valPairs[0]?$valPairs[0]:1).'" height="'.$valPairs[1].'" alt="" title="" /></td>';
07344 if ($valPairs[0]) $rows[1].= '<td></td>';
07345 if ($valPairs[2]) $rows[1].= '<td></td>';
07346 $rows[1].= '</tr>';
07347 }
07348
07349 $rows[2].= '<tr>';
07350 if ($valPairs[0]) {$rows[2].= $valPairs[1] ? '<td></td>' : '<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$valPairs[0].'" height="1" alt="" title="" /></td>';}
07351 $rows[2].= '<td'.$this->tdParams.'>'.$content.'</td>';
07352 if ($valPairs[2]) {$rows[2].= $valPairs[3] ? '<td>'.$heightImg.'</td>' : '<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$valPairs[2].'" height="'.($valPairs[5]?$valPairs[5]:1).'" alt="" title="" /></td>';}
07353 $rows[2].= '</tr>';
07354
07355 if ($valPairs[3]) {
07356 $rows[3].= '<tr>';
07357 if ($valPairs[0]) $rows[3].= '<td></td>';
07358 if ($valPairs[2]) $rows[3].= '<td>'.$widthImg.'</td>';
07359 $rows[3].= '<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($valPairs[2]?$valPairs[2]:($valPairs[4]?$valPairs[4]:1)).'" height="'.$valPairs[3].'" alt="" title="" /></td>';
07360 $rows[3].= '</tr>';
07361 }
07362 return $this->begin.implode('',$rows).$this->end;
07363 } else return $content;
07364 }
07365 }
07366
07367
07368
07369
07370
07371
07372
07373
07374
07375
07376
07377
07378
07379
07380
07381
07382
07383
07384
07385
07386
07395 class tslib_controlTable {
07396 var $offX = 0;
07397 var $offY = 0;
07398
07399 var $tm = '';
07400 var $lm = '';
07401 var $rm = '';
07402 var $bm = '';
07403 var $content = '';
07404
07405 var $tmTDparams = 'valign="top"';
07406 var $lmTDparams = 'valign="top"';
07407 var $rmTDparams = 'valign="top"';
07408 var $bmTDparams = 'valign="top"';
07409 var $contentTDparams = 'valign="top"';
07410
07411 var $cMl = 1;
07412 var $cMr = 1;
07413 var $cMt = 0;
07414 var $cMb = 1;
07415
07416 var $contentW = 0;
07417
07418 var $tableParams = 'border="0" cellspacing="0" cellpadding="0"';
07419
07430 function start($offset,$cMargins) {
07431 $offArr = t3lib_div::intExplode(',',$offset);
07432 $cMargArr = t3lib_div::intExplode(',',$cMargins);
07433
07434 $cols = 0;
07435 $rows = 0;
07436
07437 if ($this->lm) $cols++;
07438 if ($this->rm) $cols++;
07439 if ($cMargArr[0]) $cols++;
07440 if ($cMargArr[2]) $cols++;
07441 if ($cMargArr[1]||$cMargArr[3]||$this->tm||$this->bm||$this->content||$this->contentW) $cols++;
07442
07443 if ($cMargArr[1]) $rows++;
07444 if ($cMargArr[3]) $rows++;
07445 if ($this->tm) $rows++;
07446 if ($this->bm) $rows++;
07447 if ($this->content) $rows++;
07448 if ($this->contentW) $rows++;
07449 if (!$rows && $cols) $rows=1;
07450
07451 if ($rows&&$cols) {
07452 $res = chr(10).'<table '.$this->tableParams.'>';
07453
07454 if ($offArr[1]) {
07455 $xoff = $offArr[0] ? 1 : 0;
07456 if ($cols+$xoff > 1) {$colspan =' colspan="'.($cols+$xoff).'"';}
07457 $res.= '<tr><td'.$colspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$offArr[1].'" alt="" title="" /></td></tr>';
07458 }
07459
07460 if ($rows>1) {$rowspan =' rowspan="'.($rows).'"';}
07461 $res.= '<tr>';
07462 if ($offArr[0]) { $res.='<td'.$rowspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$offArr[0].'" alt="" title="" /></td>'; }
07463 if ($this->lm) { $res.='<td'.$rowspan.' '.$this->lmTDparams.'>'.$this->lm.'</td>'; }
07464 if ($cMargArr[0]) { $res.='<td'.$rowspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$cMargArr[0].'" alt="" title="" /></td>'; }
07465
07466
07467 $middle=Array();
07468 if ($this->tm) { $middle[]='<td '.$this->tmTDparams.'>'.$this->tm.'</td>';}
07469 if ($cMargArr[1]) { $middle[]='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$cMargArr[1].'" alt="" title="" /></td>';}
07470 if ($this->content) { $middle[]='<td '.$this->contentTDparams.'>'.$this->content.'</td>';}
07471 if ($cMargArr[3]) { $middle[]='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$cMargArr[3].'" alt="" title="" /></td>';}
07472 if ($this->bm) { $middle[]='<td '.$this->bmTDparams.'>'.$this->bm.'</td>';}
07473 if ($this->contentW) { $middle[]='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$this->contentW.'" alt="" title="" /></td>';}
07474 if (isset($middle[0])) {$res.=$middle[0];}
07475
07476
07477 if ($cMargArr[2]) { $res.='<td'.$rowspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$cMargArr[2].'" alt="" title="" /></td>'; }
07478 if ($this->rm) { $res.='<td'.$rowspan.' '.$this->rmTDparams.'>'.$this->rm.'</td>'; }
07479 $res.= '</tr>';
07480
07481
07482 $mCount = count($middle);
07483 for($a=1;$a<$mCount;$a++) {
07484 $res.='<tr>'.$middle[$a].'</tr>';
07485 }
07486 $res.='</table>';
07487 return $res;
07488 }
07489 }
07490 }
07491
07492
07493
07494
07495
07496 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']) {
07497 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']);
07498 }
07499 ?>