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, false)));
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 $captionArray = array();
00758 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
00759 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);
00760 }
00761 if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
00762 $legacyCaptionSplit = 1;
00763 $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
00764 if (!$capSplit) {$capSplit=chr(10);}
00765 $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
00766 while (list($ca_key, $ca_val) = each($captionArray)) {
00767 $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
00768 }
00769 }
00770
00771 $tablecode='';
00772 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
00773
00774 $tmppos = $position&7;
00775 $contentPosition = $position&24;
00776 $align = $this->align[$tmppos];
00777 $cap = ($caption)?1:0;
00778 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
00779 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
00780 $txtMarg=0;
00781 }
00782
00783 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
00784 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
00785 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
00786 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
00787
00788 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
00789 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
00790 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
00791
00792 $borderColor=$borderColor?$borderColor:'black';
00793 $borderThickness=$borderThickness?$borderThickness:1;
00794
00795 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
00796 if (!$caption_align) {
00797 $caption_align = $align;
00798 }
00799
00800 $colCount = ($cols > 1) ? $cols : 1;
00801 if ($colCount > $imgCount) {$colCount = $imgCount;}
00802 $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
00803
00804 if ($rows>1) {
00805 $rowCount = $rows;
00806 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
00807 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00808 }
00809
00810
00811 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
00812 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
00813
00814 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00815 if (!$maxWInText) {
00816 $maxWInText = round($maxW/2);
00817 }
00818
00819 if ($maxWInText && $contentPosition>=16) {
00820 $maxW = $maxWInText;
00821 }
00822
00823 if ($maxW && $colCount > 0) {
00824
00825
00826
00827
00828
00829 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
00830 }
00831
00832 $colMaxW = Array();
00833 if ($colRelations) {
00834 $rel_parts = explode(':',$colRelations);
00835 $rel_total = 0;
00836 for ($a=0;$a<$colCount;$a++) {
00837 $rel_parts[$a] = intval($rel_parts[$a]);
00838 $rel_total+= $rel_parts[$a];
00839 }
00840 if ($rel_total) {
00841 for ($a=0;$a<$colCount;$a++) {
00842 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
00843 }
00844 if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) {
00845 $colMaxW = Array();
00846 }
00847 }
00848 }
00849 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
00850 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
00851 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00852
00853
00854 $splitArr=array();
00855 $splitArr['imgObjNum']=$conf['imgObjNum'];
00856 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
00857
00858
00859 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
00860 if ($equalHeight) {
00861 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00862 $gifCreator->init();
00863 $relations = Array();
00864 $relations_cols = Array();
00865 $totalMaxW = $maxW*$colCount;
00866 for($a=0;$a<$imgCount;$a++) {
00867 $imgKey = $a+$imgStart;
00868 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00869 $relations[$a] = $imgInfo[1] / $equalHeight;
00870 if ($relations[$a]) {
00871 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a];
00872 }
00873 }
00874 }
00875
00876 $imageRowsFinalWidths = Array();
00877 $imageRowsMaxHeights = Array();
00878 $imgsTag=array();
00879 $origImages=array();
00880 for($a=0;$a<$imgCount;$a++) {
00881 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
00882 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
00883
00884 $imgKey = $a+$imgStart;
00885 $totalImagePath = $imgPath.$imgs[$imgKey];
00886 $this->data[$this->currentValKey] = $totalImagePath;
00887 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00888 $imgConf = $conf[$imgObjNum.'.'];
00889
00890 if ($equalHeight) {
00891 $scale = 1;
00892 if ($totalMaxW) {
00893 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
00894 if ($rowTotalMaxW > $totalMaxW) {
00895 $scale = $rowTotalMaxW / $totalMaxW;
00896 }
00897 }
00898
00899 $imgConf['file.']['height'] = round($equalHeight/$scale);
00900
00901 unset($imgConf['file.']['width']);
00902 unset($imgConf['file.']['maxW']);
00903 unset($imgConf['file.']['maxH']);
00904 unset($imgConf['file.']['minW']);
00905 unset($imgConf['file.']['minH']);
00906 unset($imgConf['file.']['width.']);
00907 unset($imgConf['file.']['maxW.']);
00908 unset($imgConf['file.']['maxH.']);
00909 unset($imgConf['file.']['minW.']);
00910 unset($imgConf['file.']['minH.']);
00911 $maxW = 0;
00912 }
00913
00914 if ($maxW) {
00915 if (count($colMaxW)) {
00916 $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
00917 } else {
00918 $imgConf['file.']['maxW'] = $maxW;
00919 }
00920 }
00921
00922
00923 if (is_array($imgConf)) {
00924 if ($this->image_effects[$image_effects]) {
00925 $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
00926 }
00927 if ($image_frames) {
00928 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
00929 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00930 }
00931 }
00932 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
00933 if ($image_compression==1) {
00934 $tempImport = $imgConf['file.']['import'];
00935 $tempImport_dot = $imgConf['file.']['import.'];
00936 unset($imgConf['file.']);
00937 $imgConf['file.']['import'] = $tempImport;
00938 $imgConf['file.']['import.'] = $tempImport_dot;
00939 } elseif (isset($this->image_compression[$image_compression])) {
00940 $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
00941 $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
00942 unset($imgConf['file.']['ext.']);
00943 }
00944 }
00945
00946
00947 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
00948 $imgConf['altText'] = $conf['altText'];
00949 $imgConf['altText.'] = $conf['altText.'];
00950 }
00951 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
00952 $imgConf['titleText'] = $conf['titleText'];
00953 $imgConf['titleText.'] = $conf['titleText.'];
00954 }
00955 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
00956 $imgConf['longdescURL'] = $conf['longdescURL'];
00957 $imgConf['longdescURL.'] = $conf['longdescURL.'];
00958 }
00959 } else {
00960 $imgConf = array(
00961 'altText' => $conf['altText'],
00962 'titleText' => $conf['titleText'],
00963 'longdescURL' => $conf['longdescURL'],
00964 'file' => $totalImagePath
00965 );
00966 }
00967
00968 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
00969
00970
00971 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
00972
00973 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00974 if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
00975 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
00976 }
00977 }
00978
00979
00980 $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
00981
00982
00983 $index=$imgStart;
00984
00985 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
00986 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
00987 if ($noRows) {$noCols=0;}
00988 if ($equalHeight) {
00989 $noCols=1;
00990 $noRows=0;
00991 }
00992
00993 $rowCount_temp=1;
00994 $colCount_temp=$colCount;
00995 if ($noRows) {
00996 $rowCount_temp = $rowCount;
00997 $rowCount=1;
00998 }
00999 if ($noCols) {
01000 $colCount=1;
01001 }
01002
01003 $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
01004 $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
01005
01006
01007
01008 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
01009
01010
01011 $tablecode='';
01012 $flag=0;
01013 if ($conf['noStretchAndMarginCells']!=1) {
01014 $tablecode.='<tr>';
01015 if ($txtMarg && $align=='right') {
01016 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01017 $editIconsHTML='';
01018 $flag=1;
01019 }
01020 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
01021 if ($txtMarg && $align=='left') {
01022 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01023 $editIconsHTML='';
01024 $flag=1;
01025 }
01026 if ($flag) $tableWidth+=$txtMarg+1;
01027
01028 $tablecode.='</tr>';
01029 }
01030
01031
01032 for ($c=0;$c<$rowCount;$c++) {
01033 if ($c && $rowspacing) {
01034 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
01035 }
01036 $tablecode.='<tr>';
01037 for ($b=0; $b<$colCount_temp; $b++) {
01038 if ($b && $colspacing) {
01039 if (!$noCols) {
01040 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
01041 } else {
01042 $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="" />';
01043 $colSpacer='<td valign="top">'.$colSpacer.'</td>';
01044 $tablecode.=$colSpacer;
01045 }
01046 }
01047 if (!$noCols || ($noCols && !$b)) {
01048 $tablecode.='<td valign="top">';
01049 if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}
01050 }
01051 for ($a=0;$a<$rowCount_temp;$a++) {
01052 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;
01053 $imgIndex = $index+$a*$colCount_temp;
01054 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
01055 if ($imgsTag[$imgIndex]) {
01056 if ($rowspacing && $noRows && $a) {
01057 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
01058 }
01059 if ($legacyCaptionSplit) {
01060 $thisCaption = $captionArray[$imgIndex];
01061 } else if ($conf['captionSplit'] || $conf['imageTextSplit']) {
01062 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
01063 }
01064 $imageHTML = $imgsTag[$imgIndex].'<br />';
01065 $Talign = (!trim($thisCaption) && !$noRows && !$conf['netprintApplicationLink']) ? ' align="left"' : '';
01066 if ($border) {$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}
01067 $imageHTML.=$editIconsHTML; $editIconsHTML='';
01068 if ($conf['netprintApplicationLink']) {$imageHTML = $this->netprintApplication_offsiteLinkWrap($imageHTML,$origImages[$imgIndex],$conf['netprintApplicationLink.']);}
01069 $imageHTML.=$thisCaption;
01070 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';}
01071 $tablecode.=$imageHTML;
01072 }
01073 }
01074 $index++;
01075 if (!$noCols || ($noCols && $b+1==$colCount_temp)) {
01076 if ($noCols) {$tablecode.='</tr></table>';}
01077 $tablecode.='</td>';
01078 }
01079 }
01080 $tablecode.='</tr>';
01081 }
01082 if ($c) {
01083 switch ($contentPosition) {
01084 case '0':
01085 case '8':
01086 switch ($align) {
01087 case 'center':
01088 $table_align = 'margin-left: auto; margin-right: auto';
01089 break;
01090 case 'right':
01091 $table_align = 'margin-left: auto; margin-right: 0px';
01092 break;
01093 default:
01094 $table_align = 'margin-left: 0px; margin-right: auto';
01095 }
01096 $table_align = 'style="'.$table_align.'"';
01097 break;
01098 case '16':
01099 $table_align = 'align="'.$align.'"';
01100 break;
01101 default:
01102 $table_align = '';
01103 }
01104
01105
01106 $tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
01107 if ($editIconsHTML) {
01108 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
01109 $editIconsHTML='';
01110 }
01111 if ($cap) {
01112 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
01113 }
01114 $tablecode.='</table>';
01115 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
01116 }
01117
01118 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
01119 switch ($contentPosition) {
01120 case '0':
01121 $output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
01122 break;
01123 case '8':
01124 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
01125 break;
01126 case '16':
01127 $output= $tablecode.$content;
01128 break;
01129 case '24':
01130 $theResult = '';
01131 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
01132 if ($align=='right') {
01133 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
01134 } else {
01135 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
01136 }
01137 $theResult.= '</tr></table>';
01138 $output= $theResult;
01139 break;
01140 }
01141 } else {
01142 $output= $content;
01143 }
01144
01145 if ($conf['stdWrap.']) {
01146 $output = $this->stdWrap($output, $conf['stdWrap.']);
01147 }
01148
01149 return $output;
01150 }
01151
01159 function CONTENT($conf) {
01160 $theValue='';
01161
01162 $originalRec = $GLOBALS['TSFE']->currentRecord;
01163 if ($originalRec) {
01164 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01165 }
01166
01167 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_') {
01168
01169 $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];
01170 $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
01171 $renderObjConf = $conf['renderObj.'];
01172
01173 $slide = intval($conf['slide'])?intval($conf['slide']):0;
01174 $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;
01175 $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;
01176 $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;
01177 $again = false;
01178
01179 do {
01180 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
01181 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
01182 $GLOBALS['TT']->setTSlogMessage($error,3);
01183 } else {
01184 $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01185 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
01186 $cObj =t3lib_div::makeInstance('tslib_cObj');
01187 $cObj->setParent($this->data,$this->currentRecord);
01188 $this->currentRecordNumber=0;
01189 $cobjValue = '';
01190 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01191
01192
01193 $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);
01194
01195
01196 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01197 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01198 }
01199
01200 if (is_array($row)) {
01201 if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {
01202 $this->currentRecordNumber++;
01203 $cObj->parentRecordNumber = $this->currentRecordNumber;
01204 $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
01205 $this->lastChanged($row['tstamp']);
01206 $cObj->start($row,$conf['table']);
01207 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01208 $cobjValue .= $tmpValue;
01209 }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
01210 }
01211 }
01212 }
01213 if ($slideCollectReverse) {
01214 $theValue = $cobjValue.$theValue;
01215 } else {
01216 $theValue .= $cobjValue;
01217 }
01218 if ($slideCollect>0) {
01219 $slideCollect--;
01220 }
01221 if ($slide) {
01222 if ($slide>0) {
01223 $slide--;
01224 }
01225 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
01226 $again = strlen($conf['select.']['pidInList'])?true:false;
01227 }
01228 } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));
01229 }
01230
01231 $theValue = $this->wrap($theValue,$conf['wrap']);
01232 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01233
01234 $GLOBALS['TSFE']->currentRecord = $originalRec;
01235 return $theValue;
01236 }
01237
01245 function RECORDS($conf) {
01246 $theValue='';
01247
01248 $originalRec = $GLOBALS['TSFE']->currentRecord;
01249 if ($originalRec) {
01250 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01251 }
01252
01253 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
01254 if ($conf['tables'] && $conf['source']) {
01255 $allowedTables = $conf['tables'];
01256 if (is_array($conf['conf.'])) {
01257 reset($conf['conf.']);
01258 while(list($k)=each($conf['conf.'])) {
01259 if (substr($k,-1)!='.') $allowedTables.=','.$k;
01260 }
01261 }
01262
01263 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
01264 $loadDB->start($conf['source'], $allowedTables);
01265 reset($loadDB->tableArray);
01266 while(list($table,)=each($loadDB->tableArray)) {
01267 if (is_array($GLOBALS['TCA'][$table])) {
01268 $loadDB->additionalWhere[$table]=$this->enableFields($table);
01269 }
01270 }
01271 $loadDB->getFromDB();
01272
01273 reset($loadDB->itemArray);
01274 $data = $loadDB->results;
01275
01276 $cObj =t3lib_div::makeInstance('tslib_cObj');
01277 $cObj->setParent($this->data,$this->currentRecord);
01278 $this->currentRecordNumber=0;
01279 $this->currentRecordTotal = count($loadDB->itemArray);
01280 reset($loadDB->itemArray);
01281 while(list(,$val)=each($loadDB->itemArray)) {
01282 $row = $data[$val['table']][$val['id']];
01283
01284
01285 $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
01286
01287
01288 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01289 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01290 }
01291
01292 if (is_array($row)) {
01293 if (!$conf['dontCheckPid']) {
01294 $row = $this->checkPid($row['pid']) ? $row : '';
01295 }
01296 if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) {
01297 $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
01298 $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
01299 $renderObjConf = $conf['conf.'][$val['table'].'.'];
01300 $this->currentRecordNumber++;
01301 $cObj->parentRecordNumber=$this->currentRecordNumber;
01302 $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
01303 $this->lastChanged($row['tstamp']);
01304 $cObj->start($row,$val['table']);
01305 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01306 $theValue .= $tmpValue;
01307 }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
01308 }
01309 }
01310 }
01311 if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']);
01312 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01313
01314 $GLOBALS['TSFE']->currentRecord = $originalRec;
01315 return $theValue;
01316 }
01317
01325 function HMENU($conf) {
01326 $content='';
01327 if ($this->checkIf($conf['if.'])) {
01328 $cls = strtolower($conf[1]);
01329 if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses,$cls)) {
01330 if ($conf['special.']['value.']) {
01331 $conf['special.']['value'] = $this->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
01332 }
01333 $GLOBALS['TSFE']->register['count_HMENU']++;
01334 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']=0;
01335 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
01336 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']=array();
01337
01338 $menu = t3lib_div::makeInstance('tslib_'.$cls);
01339 $menu->parent_cObj = $this;
01340 $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1);
01341 $menu->makeMenu();
01342 $content.=$menu->writeMenu();
01343 }
01344 if ($conf['wrap']) $content=$this->wrap($content, $conf['wrap']);
01345 if ($conf['stdWrap.']) $content = $this->stdWrap($content, $conf['stdWrap.']);
01346 }
01347 return $content;
01348 }
01349
01357 function CTABLE ($conf) {
01358 $controlTable = t3lib_div::makeInstance('tslib_controlTable');
01359 if ($conf['tableParams']) {
01360 $controlTable->tableParams = $conf['tableParams'];
01361 }
01362
01363 $controlTable->contentW = $conf['cWidth'];
01364
01365 if (is_array($conf['c.'])) {
01366 $controlTable->content = $this->cObjGet($conf['c.'],'c.');
01367 $controlTable->contentTDparams = isset($conf['c.']['TDParams']) ? $conf['c.']['TDParams'] : 'valign="top"';
01368 }
01369 if (is_array($conf['lm.'])) {
01370 $controlTable->lm = $this->cObjGet($conf['lm.'],'lm.');
01371 $controlTable->lmTDparams = isset($conf['lm.']['TDParams']) ? $conf['lm.']['TDParams'] : 'valign="top"';
01372 }
01373 if (is_array($conf['tm.'])) {
01374 $controlTable->tm = $this->cObjGet($conf['tm.'],'tm.');
01375 $controlTable->tmTDparams = isset($conf['tm.']['TDParams']) ? $conf['tm.']['TDParams'] : 'valign="top"';
01376 }
01377 if (is_array($conf['rm.'])) {
01378 $controlTable->rm = $this->cObjGet($conf['rm.'],'rm.');
01379 $controlTable->rmTDparams = isset($conf['rm.']['TDParams']) ? $conf['rm.']['TDParams'] : 'valign="top"';
01380 }
01381 if (is_array($conf['bm.'])) {
01382 $controlTable->bm = $this->cObjGet($conf['bm.'],'bm.');
01383 $controlTable->bmTDparams = isset($conf['bm.']['TDParams']) ? $conf['bm.']['TDParams'] : 'valign="top"';
01384 }
01385 return $controlTable->start($conf['offset'],$conf['cMargins']);
01386 }
01387
01395 function OTABLE ($conf) {
01396 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
01397 if ($conf['tableParams']) {
01398 $controlTable->tableParams = $conf['tableParams'];
01399 }
01400 return $controlTable->start($this->cObjGet($conf),$conf['offset']);
01401 }
01402
01410 function COLUMNS ($conf) {
01411 $content='';
01412 if (is_array($conf) && $this->checkIf($conf['if.'])) {
01413 $tdRowCount=0;
01414 $tableParams = $conf['tableParams'] ? ' '.$conf['tableParams'] : ' border="0" cellspacing="0" cellpadding="0"';
01415 $TDparams = $conf['TDparams'] ? ' '.$conf['TDparams']:' valign="top"';
01416 $rows = t3lib_div::intInRange($conf['rows'],2,20);
01417 $totalWidth = intval($conf['totalWidth']);
01418 $columnWidth=0;
01419
01420 $totalGapWidth=0;
01421 $gapData = Array(
01422 'gapWidth' => $this->stdWrap($conf['gapWidth'],$conf['gapWidth.']),
01423 'gapBgCol' => $this->stdWrap($conf['gapBgCol'],$conf['gapBgCol.']),
01424 'gapLineThickness' => $this->stdWrap($conf['gapLineThickness'],$conf['gapLineThickness.']),
01425 'gapLineCol' => $this->stdWrap($conf['gapLineCol'],$conf['gapLineCol.'])
01426 );
01427 $gapData = $GLOBALS['TSFE']->tmpl->splitConfArray($gapData,$rows-1);
01428 reset($gapData);
01429 while(list(,$val)=each($gapData)) {
01430 $totalGapWidth+=intval($val['gapWidth']);
01431 }
01432
01433 if ($totalWidth) {
01434 $columnWidth = ceil(($totalWidth-$totalGapWidth)/$rows);
01435 $TDparams.=' width="'.$columnWidth.'"';
01436 $tableParams.=' width="'.$totalWidth.'"';
01437 } else {
01438 $TDparams.=' width="'.floor(100/$rows).'%"';
01439 $tableParams.=' width="100%"';
01440 }
01441
01442 for ($a=1;$a<=$rows;$a++) {
01443 $tdRowCount++;
01444 $content.='<td'.$TDparams.'>';
01445 $content.=$this->cObjGetSingle($conf[$a],$conf[$a.'.'], $a);
01446 $content.='</td>';
01447 if ($a < $rows) {
01448 $gapConf = $gapData[($a-1)];
01449 $gapWidth = intval($gapConf['gapWidth']);
01450 if ($gapWidth) {
01451 $tdPar = $gapConf['gapBgCol'] ? ' bgcolor="'.$gapConf['gapBgCol'].'"' : '';
01452 $gapLine = intval($gapConf['gapLineThickness']);
01453 if ($gapLine) {
01454 $gapSurround = t3lib_div::intInRange(($gapWidth-$gapLine)/2, 1, 1000);
01455
01456 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
01457 $tdRowCount++;
01458
01459 $GtdPar = $gapConf['gapLineCol'] ? ' bgcolor="'.$gapConf['gapLineCol'].'"' : ' bgcolor="black"';
01460 $content.='<td'.$GtdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapLine.'" height="1" alt="" title="" /></td>';
01461 $tdRowCount++;
01462
01463 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapSurround.'" height="1" alt="" title="" /></td>';
01464 $tdRowCount++;
01465 } else {
01466 $content.='<td'.$tdPar.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$gapWidth.'" height="1" alt="" title="" /></td>';
01467 $tdRowCount++;
01468 }
01469 }
01470 }
01471 }
01472 $content='<tr>'.$content.'</tr>';
01473 $content='<table'.$tableParams.'>'.$content.'</table>';
01474 $content.=$this->cObjGetSingle($conf['after'],$conf['after.'], 'after');
01475 if ($conf['stdWrap.']) {
01476 $content = $this->stdWrap($content,$conf['stdWrap.']);
01477 }
01478 }
01479 return $content;
01480 }
01481
01489 function HRULER ($conf) {
01490 $lineThickness = t3lib_div::intInRange($this->stdWrap($conf['lineThickness'],$conf['lineThickness.']),1,50);
01491 $lineColor = $conf['lineColor'] ? $conf['lineColor'] : 'black';
01492 $spaceBefore = intval($conf['spaceLeft']);
01493 $spaceAfter = intval($conf['spaceRight']);
01494 $tableWidth = $conf['tableWidth'] ? $conf['tableWidth'] : '99%';
01495 $content='';
01496
01497 $content.='<table border="0" cellspacing="0" cellpadding="0" width="'.htmlspecialchars($tableWidth).'"><tr>';
01498 if ($spaceBefore) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceBefore.'" height="1" alt="" title="" /></td>'; }
01499 $content.='<td bgcolor="'.$lineColor.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$lineThickness.'" alt="" title="" /></td>';
01500 if ($spaceAfter) {$content.='<td width="1"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$spaceAfter.'" height="1" alt="" title="" /></td>'; }
01501 $content.='</tr></table>';
01502
01503 $content = $this->stdWrap($content, $conf['stdWrap.']);
01504 return $content;
01505 }
01506
01514 function CASEFUNC ($conf){
01515 $content='';
01516 if ($this->checkIf($conf['if.'])) {
01517 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
01518 $key = $this->stdWrap($conf['key'],$conf['key.']);
01519 $key = strlen($conf[$key]) ? $key : 'default';
01520 $name = $conf[$key];
01521 $theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key);
01522 if ($conf['stdWrap.']) {
01523 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01524 }
01525 return $theValue;
01526 }
01527 }
01528
01539 function LOAD_REGISTER($conf,$name) {
01540 if ($name=='RESTORE_REGISTER') {
01541 $GLOBALS['TSFE']->register = array_pop($GLOBALS['TSFE']->registerStack);
01542 } else {
01543 array_push($GLOBALS['TSFE']->registerStack,$GLOBALS['TSFE']->register);
01544 if (is_array($conf)) {
01545 reset($conf);
01546 while(list($theKey,$theValue)=each($conf)) {
01547 if (!strstr($theKey,'.') || !isset($conf[substr($theKey,0,-1)])) {
01548 if (strstr($theKey,'.')) {
01549 $theKey = substr($theKey,0,-1);
01550 }
01551 $GLOBALS['TSFE']->register[$theKey] = $this->stdWrap($conf[$theKey],$conf[$theKey.'.']);
01552 }
01553 }
01554 }
01555 }
01556 return '';
01557 }
01558
01579 function FORM($conf,$formData='') {
01580 $content='';
01581 if (is_array($formData)) {
01582 $dataArr = $formData;
01583 } else {
01584 $data=$this->stdWrap($conf['data'],$conf['data.']);
01585
01586 $dataArr=array();
01587
01588 if (trim($data)) {
01589 $data = ereg_replace(chr(10),'||',$data);
01590 $dataArr = explode('||',$data);
01591 }
01592
01593 if (is_array($conf['dataArray.'])) {
01594 $sKeyArray = t3lib_TStemplate::sortedKeyList($conf['dataArray.'], TRUE);
01595 foreach($sKeyArray as $theKey) {
01596 $dAA = $conf['dataArray.'][$theKey.'.'];
01597 if (is_array($dAA)) {
01598 $temp=array();
01599 list($temp[0])= explode('|',$dAA['label.'] ? $this->stdWrap($dAA['label'],$dAA['label.']) : $dAA['label']);
01600 list($temp[1])= explode('|',$dAA['type']);
01601 if ($dAA['required']) {$temp[1]='*'.$temp[1];}
01602 list($temp[2])= explode('|',$dAA['value.'] ? $this->stdWrap($dAA['value'],$dAA['value.']) : $dAA['value']);
01603
01604 if (is_array($dAA['valueArray.'])) {
01605 reset($dAA['valueArray.']);
01606 $temp_accum = array();
01607 while(list($dAKey_vA,$dAA_vA)=each($dAA['valueArray.'])) {
01608 if (is_array($dAA_vA) && !strcmp(intval($dAKey_vA).'.',$dAKey_vA)) {
01609 $temp_vA=array();
01610 list($temp_vA[0])= explode('=',$dAA_vA['label.'] ? $this->stdWrap($dAA_vA['label'],$dAA_vA['label.']) : $dAA_vA['label']);
01611 if ($dAA_vA['selected']) {$temp_vA[0]='*'.$temp_vA[0];}
01612 list($temp_vA[1])= explode(',',$dAA_vA['value']);
01613 }
01614 $temp_accum[] = implode('=',$temp_vA);
01615 }
01616 $temp[2] = implode(',',$temp_accum);
01617 }
01618 list($temp[3])= explode('|',$dAA['specialEval.'] ? $this->stdWrap($dAA['specialEval'],$dAA['specialEval.']) : $dAA['specialEval']);
01619
01620
01621 $dataArr[] = implode('|',$temp);
01622 }
01623 }
01624 }
01625 }
01626
01627 $attachmentCounter = '';
01628 $hiddenfields = '';
01629 $fieldlist = Array();
01630 $propertyOverride = Array();
01631 $fieldname_hashArray = Array();
01632 $cc = 0;
01633
01634 $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype);
01635
01636 if ($conf['formName']) {
01637 $formname = $this->cleanFormName($conf['formName']);
01638 } else {
01639 $formname = $GLOBALS['TSFE']->uniqueHash();
01640 $formname = 'a'.$formname;
01641 }
01642
01643 if (isset($conf['fieldPrefix'])) {
01644 if ($conf['fieldPrefix']) {
01645 $prefix = $this->cleanFormName($conf['fieldPrefix']);
01646 } else {
01647 $prefix = '';
01648 }
01649 } else {
01650 $prefix = $formname;
01651 }
01652
01653 foreach($dataArr as $val) {
01654
01655 $cc++;
01656 $confData=Array();
01657 if (is_array($formData)) {
01658 $parts = $val;
01659 $val = 1;
01660 } else {
01661 $val = trim($val);
01662 $parts = explode('|',$val);
01663 }
01664 if ($val && strcspn($val,'#/')) {
01665
01666 $confData['label'] = trim($parts[0]);
01667
01668 $fParts = explode(',',$parts[1]);
01669 $fParts[0]=trim($fParts[0]);
01670 if (substr($fParts[0],0,1)=='*') {
01671 $confData['required']=1;
01672 $fParts[0] = substr($fParts[0],1);
01673 }
01674 $typeParts = explode('=',$fParts[0]);
01675 $confData['type'] = trim(strtolower(end($typeParts)));
01676 if (count($typeParts)==1) {
01677 $confData['fieldname'] = $this->cleanFormName($parts[0]);
01678 if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email') {$confData['fieldname']='email';}
01679
01680 if (isset($fieldname_hashArray[md5($confData['fieldname'])])) {
01681 $confData['fieldname'].='_'.$cc;
01682 }
01683 $fieldname_hashArray[md5($confData['fieldname'])]=$confData['fieldname'];
01684
01685 if ($confData['type']=='file') {
01686 $confData['fieldname']='attachment'.$attachmentCounter;
01687 $attachmentCounter=intval($attachmentCounter)+1;
01688 }
01689 } else {
01690 $confData['fieldname'] = str_replace(' ','_',trim($typeParts[0]));
01691 }
01692 $fieldCode='';
01693
01694 if ($conf['wrapFieldName']) {
01695 $confData['fieldname'] = $this->wrap($confData['fieldname'],$conf['wrapFieldName']);
01696 }
01697
01698
01699 $this->setCurrentVal($confData['fieldname']);
01700
01701
01702 if (trim($confData['type'])) {
01703 $addParams=trim($conf['params']);
01704 if (is_array($conf['params.']) && isset($conf['params.'][$confData['type']])) {
01705 $addParams=trim($conf['params.'][$confData['type']]);
01706 }
01707 if (strcmp('',$addParams)) $addParams=' '.$addParams;
01708 } else $addParams='';
01709
01710 if ($conf['dontMd5FieldNames']) {
01711 $fName = $confData['fieldname'];
01712 } else {
01713 $fName = md5($confData['fieldname']);
01714 }
01715
01716
01717 if ($conf['accessibility'] || $xhtmlStrict) {
01718 $elementIdAttribute = ' id="'.$prefix.$fName.'"';
01719 } else {
01720 $elementIdAttribute = '';
01721 }
01722
01723
01724 switch($confData['type']) {
01725 case 'textarea':
01726 $cols=trim($fParts[1]) ? intval($fParts[1]) : 20;
01727 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
01728 $compWidth = $compWidth ? $compWidth : 1;
01729 $cols = t3lib_div::intInRange($cols*$compWidth, 1, 120);
01730
01731 $rows=trim($fParts[2]) ? t3lib_div::intInRange($fParts[2],1,30) : 5;
01732 $wrap=trim($fParts[3]);
01733 if ($conf['noWrapAttr'] || $wrap === 'disabled') {
01734 $wrap='';
01735 } else {
01736 $wrap = $wrap ? ' wrap="'.$wrap.'"' : ' wrap="virtual"';
01737 }
01738 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], str_replace('\n',chr(10),trim($parts[2])));
01739 $fieldCode=sprintf('<textarea name="%s"%s cols="%s" rows="%s"%s%s>%s</textarea>',
01740 $confData['fieldname'], $elementIdAttribute, $cols, $rows, $wrap, $addParams, t3lib_div::formatForTextarea($default));
01741 break;
01742 case 'input':
01743 case 'password':
01744 $size=trim($fParts[1]) ? intval($fParts[1]) : 20;
01745 $compWidth = doubleval($conf['compensateFieldWidth'] ? $conf['compensateFieldWidth'] : $GLOBALS['TSFE']->compensateFieldWidth);
01746 $compWidth = $compWidth ? $compWidth : 1;
01747 $size = t3lib_div::intInRange($size*$compWidth, 1, 120);
01748 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
01749
01750 if ($confData['type']=='password') {
01751 $default='';
01752 }
01753
01754 $max=trim($fParts[2]) ? ' maxlength="'.t3lib_div::intInRange($fParts[2],1,1000).'"' : "";
01755 $theType = $confData['type']=='input' ? 'text' : 'password';
01756
01757 $fieldCode=sprintf('<input type="%s" name="%s"%s size="%s"%s value="%s"%s />',
01758 $theType, $confData['fieldname'], $elementIdAttribute, $size, $max, htmlspecialchars($default), $addParams);
01759
01760 break;
01761 case 'file':
01762 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,60) : 20;
01763 $fieldCode=sprintf('<input type="file" name="%s"%s size="%s"%s />',
01764 $confData['fieldname'], $elementIdAttribute, $size, $addParams);
01765 break;
01766 case 'check':
01767
01768 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], trim($parts[2]));
01769 $checked = $default ? ' checked="checked"' : '';
01770 $fieldCode=sprintf('<input type="checkbox" value="%s" name="%s"%s%s%s />',
01771 1, $confData['fieldname'], $elementIdAttribute, $checked, $addParams);
01772 break;
01773 case 'select':
01774 $option='';
01775 $valueParts = explode(',',$parts[2]);
01776
01777 if (strtolower(trim($fParts[1]))=='auto') {$fParts[1]=count($valueParts);}
01778 $size=trim($fParts[1]) ? t3lib_div::intInRange($fParts[1],1,20) : 1;
01779
01780 $multiple = strtolower(trim($fParts[2]))=='m' ? ' multiple="multiple"' : '';
01781
01782 $items=array();
01783 $defaults=array();
01784 $pCount = count($valueParts);
01785 for($a=0;$a<$pCount;$a++) {
01786 $valueParts[$a]=trim($valueParts[$a]);
01787 if (substr($valueParts[$a],0,1)=='*') {
01788 $sel='selected';
01789 $valueParts[$a] = substr($valueParts[$a],1);
01790 } else $sel='';
01791
01792 $subParts=explode('=',$valueParts[$a]);
01793 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0]));
01794 $items[] = $subParts;
01795 if ($sel) {$defaults[]=$subParts[1];}
01796 }
01797
01798 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $defaults);
01799 if (!is_array($default)) {
01800 $defaults=array();
01801 $defaults[] = $default;
01802 } else $defaults=$default;
01803
01804 $iCount = count($items);
01805 for($a=0;$a<$iCount;$a++) {
01806 $option.='<option value="'.$items[$a][1].'"'.(in_array($items[$a][1],$defaults)?' selected="selected"':'').'>'.trim($items[$a][0]).'</option>';
01807 }
01808
01809 if ($multiple) $confData['fieldname'].='[]';
01810 $fieldCode=sprintf('<select name="%s"%s size="%s"%s%s>%s</select>',
01811 $confData['fieldname'], $elementIdAttribute, $size, $multiple, $addParams, $option);
01812 break;
01813 case 'radio':
01814 $option='';
01815 if ($conf['accessibility']) {
01816 $option.='<fieldset'.$elementIdAttribute.'><legend>'.$confData['label'].'</legend>';
01817 }
01818 $valueParts = explode(',',$parts[2]);
01819 $items=array();
01820 $default='';
01821 $pCount = count($valueParts);
01822 for($a=0;$a<$pCount;$a++) {
01823 $valueParts[$a]=trim($valueParts[$a]);
01824 if (substr($valueParts[$a],0,1)=='*') {
01825 $sel='checked';
01826 $valueParts[$a] = substr($valueParts[$a],1);
01827 } else $sel='';
01828
01829 $subParts=explode('=',$valueParts[$a]);
01830 $subParts[1] = (isset($subParts[1])?trim($subParts[1]):trim($subParts[0]));
01831 $items[] = $subParts;
01832 if ($sel) {$default=$subParts[1];}
01833 }
01834
01835 $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default);
01836
01837 $iCount = count($items);
01838 for($a=0;$a<$iCount;$a++) {
01839 $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]);
01840 if ($conf['accessibility']) {
01841 $radioLabelIdAttribute = ' id="'.$radioId.'"';
01842 } else {
01843 $radioLabelIdAttribute = '';
01844 }
01845 $option .= '<input type="radio" name="'.$confData['fieldname'].'"'.$radioLabelIdAttribute.' value="'.$items[$a][1].'"'.(!strcmp($items[$a][1],$default)?' checked="checked"':'').$addParams.' />';
01846 if ($conf['accessibility']) {
01847 $option .= '<label for="'.$radioId.'">' . $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']) . '</label>';
01848 } else {
01849 $option .= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']);
01850 }
01851 }
01852 if ($conf['accessibility']) {
01853 $option.='</fieldset>';
01854 }
01855 $fieldCode = $option;
01856 break;
01857 case 'hidden':
01858 $value = trim($parts[2]);
01859 if(strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
01860 break;
01861 }
01862 if (strlen($value) && t3lib_div::inList('recipient_copy,recipient',$confData['fieldname'])) {
01863 $value = $GLOBALS['TSFE']->codeString($value);
01864 }
01865 $hiddenfields.=sprintf('<input type="hidden" name="%s"%s value="%s" />',
01866 $confData['fieldname'], $elementIdAttribute, htmlspecialchars($value));
01867 break;
01868 case 'property':
01869 if (t3lib_div::inList('type,locationData,goodMess,badMess,emailMess',$confData['fieldname'])) {
01870 $value=trim($parts[2]);
01871 $propertyOverride[$confData['fieldname']] = $value;
01872 $conf[$confData['fieldname']] = $value;
01873 }
01874 break;
01875 case 'submit':
01876 $value=trim($parts[2]);
01877 if ($conf['image.']) {
01878 $this->data[$this->currentValKey] = $value;
01879 $image = $this->IMG_RESOURCE($conf['image.']);
01880 $params = $conf['image.']['params'] ? ' '.$conf['image.']['params'] : '';
01881 $params.= $this->getAltParam($conf['image.'], false);
01882 $params.= $addParams;
01883 } else {
01884 $image = '';
01885 }
01886 if ($image) {
01887 $fieldCode=sprintf('<input type="image" name="%s"%s src="%s"%s />',
01888 $confData['fieldname'], $elementIdAttribute, $image, $params);
01889 } else {
01890 $fieldCode=sprintf('<input type="submit" name="%s"%s value="%s"%s />',
01891 $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
01892 }
01893 break;
01894 case 'reset':
01895 $value=trim($parts[2]);
01896 $fieldCode=sprintf('<input type="reset" name="%s"%s value="%s"%s />',
01897 $confData['fieldname'], $elementIdAttribute, t3lib_div::deHSCentities(htmlspecialchars($value)), $addParams);
01898 break;
01899 case 'label':
01900 $fieldCode = nl2br(htmlspecialchars(trim($parts[2])));
01901 break;
01902 default:
01903 $confData['type'] = 'comment';
01904 $fieldCode = trim($parts[2]).' ';
01905 break;
01906 }
01907 if ($fieldCode) {
01908
01909
01910 if (t3lib_div::inList('textarea,input,password',$confData['type']) && strlen(trim($parts[3]))) {
01911 $modeParameters = t3lib_div::trimExplode(':',$parts[3]);
01912 } else {
01913 $modeParameters = array();
01914 }
01915
01916
01917 switch((string)$modeParameters[0]) {
01918 case 'EREG':
01919 $fieldlist[] = '_EREG';
01920 $fieldlist[] = rawurlencode($modeParameters[1]);
01921 $fieldlist[] = rawurlencode($modeParameters[2]);
01922 $fieldlist[] = rawurlencode($confData['fieldname']);
01923 $fieldlist[] = rawurlencode($confData['label']);
01924 $confData['required'] = 1;
01925 break;
01926 case 'EMAIL':
01927 $fieldlist[] = '_EMAIL';
01928 $fieldlist[] = rawurlencode($confData['fieldname']);
01929 $fieldlist[] = rawurlencode($confData['label']);
01930 $confData['required'] = 1;
01931 break;
01932 default:
01933 if ($confData['required'] && $confData['type']!='check') {
01934 $fieldlist[] = rawurlencode($confData['fieldname']);
01935 $fieldlist[] = rawurlencode($confData['label']);
01936 }
01937 break;
01938 }
01939
01940
01941 $fieldLabel = $confData['label'];
01942 if ($conf['accessibility'] && trim($fieldLabel) && !preg_match('/^(label|hidden|comment)$/',$confData['type'])) {
01943 $fieldLabel = '<label for="'.$prefix.$fName.'">'.$fieldLabel.'</label>';
01944 }
01945
01946
01947 $fieldCode = $this->stdWrap($fieldCode, $conf['fieldWrap.']);
01948 $labelCode = $this->stdWrap($fieldLabel, $conf['labelWrap.']);
01949 $commentCode = $this->stdWrap($confData['label'], $conf['commentWrap.']);
01950 $result = $conf['layout'];
01951 if ($conf['REQ'] && $confData['required']) {
01952 if (is_array($conf['REQ.']['fieldWrap.']))
01953 $fieldCode = $this->stdWrap($fieldCode, $conf['REQ.']['fieldWrap.']);
01954 if (is_array($conf['REQ.']['labelWrap.']))
01955 $labelCode = $this->stdWrap($fieldLabel, $conf['REQ.']['labelWrap.']);
01956 if ($conf['REQ.']['layout']) {
01957 $result = $conf['REQ.']['layout'];
01958 }
01959 }
01960 if ($confData['type']=='comment' && $conf['COMMENT.']['layout']) {
01961 $result = $conf['COMMENT.']['layout'];
01962 }
01963 if ($confData['type']=='check' && $conf['CHECK.']['layout']) {
01964 $result = $conf['CHECK.']['layout'];
01965 }
01966 if ($confData['type']=='radio' && $conf['RADIO.']['layout']) {
01967 $result = $conf['RADIO.']['layout'];
01968 }
01969 if ($confData['type']=='label' && $conf['LABEL.']['layout']) {
01970 $result = $conf['LABEL.']['layout'];
01971 }
01972 $result = str_replace('###FIELD###',$fieldCode,$result);
01973 $result = str_replace('###LABEL###',$labelCode,$result);
01974 $result = str_replace('###COMMENT###',$commentCode,$result);
01975 $content.= $result;
01976 }
01977 }
01978 }
01979 if ($conf['stdWrap.']) $content=$this->stdWrap($content, $conf['stdWrap.']);
01980
01981
01982
01983 $theRedirect = $this->stdWrap($conf['redirect'], $conf['redirect.']);
01984 $page = $GLOBALS['TSFE']->page;
01985 if (!$theRedirect) {
01986 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
01987 } elseif (t3lib_div::testInt($theRedirect)) {
01988 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($theRedirect);
01989 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'index.php', '', $this->getClosestMPvalueForPage($page['uid']));
01990 } else {
01991 $LD = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'],'', '', $this->getClosestMPvalueForPage($page['uid']));
01992 $LD['totalURL'] = $theRedirect;
01993 $hiddenfields.= '<input type="hidden" name="redirect" value="'.htmlspecialchars($LD['totalURL']).'" />';
01994 }
01995
01996
01997 $formtype = $propertyOverride['type'] ? $propertyOverride['type'] : $this->stdWrap($conf['type'], $conf['type.']);
01998 if (t3lib_div::testInt($formtype)) {
01999 $page = $GLOBALS['TSFE']->sys_page->getPage_noCheck($formtype);
02000 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
02001 $action = $LD_A['totalURL'];
02002 } elseif ($formtype){
02003 $LD_A = $LD;
02004 $action = $formtype;
02005 } elseif (t3lib_div::testInt($theRedirect)) {
02006 $LD_A = $LD;
02007 $action = $LD_A['totalURL'];
02008 } else {
02009 $LD_A = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page, $conf['target'], $conf['no_cache'], '', '', $this->getClosestMPvalueForPage($page['uid']));
02010 $action = $LD_A['totalURL'];
02011 }
02012
02013
02014 $theEmail = $this->stdWrap($conf['recipient'], $conf['recipient.']);
02015 if ($theEmail && !$GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
02016 $theEmail = $GLOBALS['TSFE']->codeString($theEmail);
02017 $hiddenfields.='<input type="hidden" name="recipient" value="'.htmlspecialchars($theEmail).'" />';
02018 }
02019
02020
02021 if ($conf['locationData']) {
02022 if ($conf['locationData']=='HTTP_POST_VARS' && isset($_POST['locationData'])) {
02023 $locationData = t3lib_div::_POST('locationData');
02024 } else {
02025 $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord;
02026 }
02027 $hiddenfields.='<input type="hidden" name="locationData" value="'.htmlspecialchars($locationData).'" />';
02028 }
02029
02030
02031 if (is_array($conf['hiddenFields.'])) {
02032 reset($conf['hiddenFields.']);
02033 while(list($hF_key,$hF_conf) = each($conf['hiddenFields.'])) {
02034 if (substr($hF_key,-1)!='.') {
02035 $hF_value = $this->cObjGetSingle($hF_conf,$conf['hiddenFields.'][$hF_key.'.'],'hiddenfields');
02036 if (strlen($hF_value) && t3lib_div::inList('recipient_copy,recipient',$hF_key)) {
02037 if($GLOBALS['TYPO3_CONF_VARS']['FE']['secureFormmail']) {
02038 continue;
02039 }
02040 $hF_value = $GLOBALS['TSFE']->codeString($hF_value);
02041 }
02042 $hiddenfields.='<input type="hidden" name="'.$hF_key.'" value="'.htmlspecialchars($hF_value).'" />';
02043 }
02044 }
02045 }
02046
02047
02048 $hiddenfields = '<div style="display:none;">'.$hiddenfields.'</div>';
02049
02050 if ($conf['REQ']) {
02051 $validateForm=' onsubmit="return validateForm(\''.$formname.'\',\''.implode(',',$fieldlist).'\','.t3lib_div::quoteJSvalue($conf['goodMess']).','.t3lib_div::quoteJSvalue($conf['badMess']).','.t3lib_div::quoteJSvalue($conf['emailMess']).')"';
02052 $GLOBALS['TSFE']->additionalHeaderData['JSFormValidate'] = '<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.validateform.js"></script>';
02053 } else $validateForm='';
02054
02055
02056 $theTarget = ($theRedirect?$LD['target']:$LD_A['target']);
02057 $content = Array(
02058 '<form'.
02059 ' action="'.htmlspecialchars($action).'"'.
02060 ' id="'.$formname.'"'.($xhtmlStrict ? '' : ' name="'.$formname.'"').
02061 ' enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'"'.
02062 ' method="'.($conf['method']?$conf['method']:'post').'"'.
02063 ($theTarget ? ' target="'.$theTarget.'"' : '').
02064 $validateForm.
02065 '>',
02066 $hiddenfields.$content,
02067 '</form>'
02068 );
02069
02070 if ($conf['arrayReturnMode']) {
02071 $content['validateForm']=$validateForm;
02072 $content['formname']=$formname;
02073 return $content;
02074 } else {
02075 return implode('',$content);
02076 }
02077 }
02078
02086 function SEARCHRESULT($conf) {
02087 if (t3lib_div::_GP('sword') && t3lib_div::_GP('scols')) {
02088 $search = t3lib_div::makeInstance('tslib_search');
02089 $search->register_and_explode_search_string(t3lib_div::_GP('sword'));
02090 $search->register_tables_and_columns(t3lib_div::_GP('scols'),$conf['allowedCols']);
02091
02092 $depth=100;
02093
02094 $theStartId=0;
02095 if (t3lib_div::testInt(t3lib_div::_GP('stype'))) {
02096 $temp_theStartId=t3lib_div::_GP('stype');
02097 $rootLine = $GLOBALS['TSFE']->sys_page->getRootLine($temp_theStartId);
02098
02099 while(list(,$val)=each($rootLine)) {
02100 if($val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
02101 $theStartId=$temp_theStartId;
02102 }
02103 }
02104 } else if (t3lib_div::_GP('stype')) {
02105 if (substr(t3lib_div::_GP('stype'),0,1)=='L') {
02106 $pointer = intval(substr(t3lib_div::_GP('stype'),1));
02107 $theRootLine = $GLOBALS['TSFE']->tmpl->rootLine;
02108
02109 $locDat_arr = explode(':',t3lib_div::_POST('locationData'));
02110 $pId = intval($locDat_arr[0]);
02111 if ($pId) {
02112 $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId);
02113 ksort($altRootLine);
02114 if (count($altRootLine)) {
02115
02116 reset($altRootLine);
02117 $hitRoot=0;
02118 $theNewRoot=array();
02119 while(list(,$val)=each($altRootLine)) {
02120 if($hitRoot || $val['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
02121 $hitRoot=1;
02122 $theNewRoot[]=$val;
02123 }
02124 }
02125 if ($hitRoot) {
02126 $theRootLine = $theNewRoot;
02127 }
02128 }
02129 }
02130 $key = $this->getKey($pointer,$theRootLine);
02131 $theStartId = $theRootLine[$key]['uid'];
02132 }
02133 }
02134 if (!$theStartId) {
02135
02136 $theStartId = $GLOBALS['TSFE']->id;
02137 }
02138
02139 $search->pageIdList.= $this->getTreeList(-1*$theStartId,$depth);
02140
02141 $endClause = 'pages.uid IN ('.$search->pageIdList.')
02142 AND pages.doktype in ('.$GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'].($conf['addExtUrlsAndShortCuts']?',3,4':'').')
02143 AND pages.no_search=0'.
02144 $this->enableFields($search->fTable).
02145 $this->enableFields('pages');
02146
02147 if ($conf['languageField.'][$search->fTable]) {
02148 $endClause.= ' AND '.$search->fTable.'.'.$conf['languageField.'][$search->fTable].' = '.intval($GLOBALS['TSFE']->sys_language_uid);
02149 }
02150
02151
02152 $search->build_search_query($endClause);
02153
02154
02155 if (t3lib_div::testInt(t3lib_div::_GP('scount'))) {
02156 $search->res_count = t3lib_div::_GP('scount');
02157 } else {
02158 $search->count_query();
02159 }
02160
02161
02162 $spointer = intval(t3lib_div::_GP('spointer'));
02163 if (isset($conf['range'])) {
02164 $theRange = intval($conf['range']);
02165 } else {
02166 $theRange = 20;
02167 }
02168
02169
02170 if (!$conf['noOrderBy']) {
02171 $search->queryParts['ORDERBY'] = 'pages.lastUpdated, pages.tstamp';
02172 }
02173
02174 $search->queryParts['LIMIT'] = $spointer.','.$theRange;
02175
02176
02177 $search->execute_query();
02178 if ($GLOBALS['TYPO3_DB']->sql_num_rows($search->result)) {
02179 $GLOBALS['TSFE']->register['SWORD_PARAMS'] = $search->get_searchwords();
02180
02181 $total = $search->res_count;
02182 $rangeLow = t3lib_div::intInRange($spointer+1,1,$total);
02183 $rangeHigh = t3lib_div::intInRange($spointer+$theRange,1,$total);
02184
02185 $LD = $GLOBALS['TSFE']->tmpl->linkData($GLOBALS['TSFE']->page,$conf['target'],1,'', '', $this->getClosestMPvalueForPage($GLOBALS['TSFE']->page['uid']));
02186 $targetPart = $LD['target'] ? ' target="'.htmlspecialchars($LD['target']).'"' : '';
02187 $urlParams = $this->URLqMark($LD['totalURL'],
02188 '&sword='.rawurlencode(t3lib_div::_GP('sword')).
02189 '&scols='.rawurlencode(t3lib_div::_GP('scols')).
02190 '&stype='.rawurlencode(t3lib_div::_GP('stype')).
02191 '&scount='.$total);
02192
02193 $result= $this->cObjGetSingle($conf['layout'],$conf['layout.'], 'layout');
02194 $result = str_replace('###RANGELOW###',$rangeLow,$result);
02195 $result = str_replace('###RANGEHIGH###',$rangeHigh,$result);
02196 $result = str_replace('###TOTAL###',$total,$result);
02197
02198 if ($rangeHigh<$total) {
02199 $next = $this->cObjGetSingle($conf['next'], $conf['next.'], 'next');
02200 $next = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer+$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$next.'</a>';
02201 } else $next='';
02202 $result = str_replace('###NEXT###',$next,$result);
02203
02204 if ($rangeLow>1) {
02205 $prev = $this->cObjGetSingle($conf['prev'], $conf['prev.'], 'prev');
02206 $prev = '<a href="'.htmlspecialchars($urlParams.'&spointer='.($spointer-$theRange)).'"'.$targetPart.$GLOBALS['TSFE']->ATagParams.'>'.$prev.'</a>';
02207 } else $prev='';
02208 $result = str_replace('###PREV###',$prev,$result);
02209
02210
02211 $theValue = $this->cObjGetSingle($conf['resultObj'], $conf['resultObj.'],'resultObj');
02212 $cObj = t3lib_div::makeInstance('tslib_cObj');
02213 $cObj->setParent($this->data,$this->currentRecord);
02214 $renderCode='';
02215 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($search->result)) {
02216
02217 $cObj->start($row);
02218 $renderCode.=$cObj->cObjGetSingle($conf['renderObj'], $conf['renderObj.'],'renderObj');
02219 }
02220 $theValue.=$this->wrap($renderCode,$conf['renderWrap']);
02221 $theValue = str_replace('###RESULT###',$theValue,$result);
02222 } else {
02223 $theValue = $this->cObjGetSingle($conf['noResultObj'], $conf['noResultObj.'],'noResultObj');
02224 }
02225
02226 $GLOBALS['TT']->setTSlogMessage('Search in fields: '.$search->listOfSearchFields);
02227
02228
02229 $content=$theValue;
02230 if ($conf['wrap']) {
02231 $content=$this->wrap($content, $conf['wrap']);
02232 }
02233 if ($conf['stdWrap.']) {
02234 $content=$this->stdWrap($content, $conf['stdWrap.']);
02235 }
02236
02237 $GLOBALS['TSFE']->set_no_cache();
02238 return $content;
02239 }
02240 }
02241
02252 function PHP_SCRIPT($conf,$ext='') {
02253 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
02254 $content='';
02255 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
02256 switch($ext) {
02257 case 'INT':
02258 case 'EXT':
02259 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
02260 $content.='<!--'.$substKey.'-->';
02261 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
02262 'file'=>$incFile,
02263 'conf'=>$conf,
02264 'type'=>'SCRIPT'
02265 );
02266 if ($ext=='INT') {
02267 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['cObj'] = serialize($this);
02268 } else {
02269 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey]['data'] = $this->data;
02270 }
02271 break;
02272 default:
02273
02274 $this->oldData = $this->data;
02275
02276 include('./'.$incFile);
02277
02278 if ($RESTORE_OLD_DATA) {
02279 $this->data = $this->oldData;
02280 }
02281 break;
02282 }
02283 }
02284 return $content;
02285 }
02286
02295 function TEMPLATE($conf) {
02296 $subparts = Array();
02297 $marks = Array();
02298 $wraps = Array();
02299 $content='';
02300
02301 list($PRE,$POST) = explode('|',$conf['markerWrap'] ? $conf['markerWrap'] : '### | ###');
02302 $POST = trim($POST);
02303 $PRE = trim($PRE);
02304
02305
02306 $content = $this->cObjGetSingle($conf['template'],$conf['template.'],'template');
02307 if ($conf['workOnSubpart']) {
02308 $content = $this->getSubpart($content, $PRE.$conf['workOnSubpart'].$POST);
02309 }
02310
02311
02312 if ($conf['relPathPrefix']) {
02313 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
02314 $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'],$content,$conf['relPathPrefix.']);
02315 }
02316
02317 if ($content) {
02318 if ($conf['nonCachedSubst']) {
02319
02320 if (is_array($conf['marks.'])) {
02321 reset($conf['marks.']);
02322 while(list($theKey,$theValue)=each($conf['marks.'])) {
02323 if (!strstr($theKey,'.')) {
02324 $content = str_replace(
02325 $PRE.$theKey.$POST,
02326 $this->cObjGetSingle($theValue,$conf['marks.'][$theKey.'.'],'marks.'.$theKey),
02327 $content);
02328 }
02329 }
02330 }
02331
02332
02333 if (is_array($conf['subparts.'])) {
02334 reset($conf['subparts.']);
02335 while(list($theKey,$theValue)=each($conf['subparts.'])) {
02336 if (!strstr($theKey,'.')) {
02337 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02338 if ($subpart) {
02339 $this->setCurrentVal($subpart);
02340 $content = $this->substituteSubpart(
02341 $content,
02342 $PRE.$theKey.$POST,
02343 $this->cObjGetSingle($theValue,$conf['subparts.'][$theKey.'.'],'subparts.'.$theKey),
02344 1
02345 );
02346 }
02347 }
02348 }
02349 }
02350
02351 if (is_array($conf['wraps.'])) {
02352 reset($conf['wraps.']);
02353 while(list($theKey,$theValue)=each($conf['wraps.'])) {
02354 if (!strstr($theKey,'.')) {
02355 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02356 if ($subpart) {
02357 $this->setCurrentVal($subpart);
02358 $content = $this->substituteSubpart(
02359 $content,
02360 $PRE.$theKey.$POST,
02361 explode('|',$this->cObjGetSingle($theValue,$conf['wraps.'][$theKey.'.'],'wraps.'.$theKey)),
02362 1
02363 );
02364 }
02365 }
02366 }
02367 }
02368 } else {
02369
02370 if (is_array($conf['subparts.'])) {
02371 reset($conf['subparts.']);
02372 while(list($theKey,$theValue)=each($conf['subparts.'])) {
02373 if (!strstr($theKey,'.')) {
02374 $subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
02375 if ($subpart) {
02376 $GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart;
02377 $subparts[$theKey]['name'] = $theValue;
02378 $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
02379 }
02380 }
02381 }
02382 }
02383
02384 if (is_array($conf['marks.'])) {
02385 reset($conf['marks.']);
02386 while(list($theKey,$theValue)=each($conf['marks.'])) {
02387 if (!strstr($theKey,'.')) {
02388 $marks[$theKey]['name'] = $theValue;
02389 $marks[$theKey]['conf'] = $conf['marks.'][$theKey.'.'];
02390 }
02391 }
02392 }
02393
02394 if (is_array($conf['wraps.'])) {
02395 reset($conf['wraps.']);
02396 while(list($theKey,$theValue)=each($conf['wraps.'])) {
02397 if (!strstr($theKey,'.')) {
02398 $wraps[$theKey]['name'] = $theValue;
02399 $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey.'.'];
02400 }
02401 }
02402 }
02403
02404 $subpartArray =array();
02405 reset($subparts);
02406 while(list($theKey,$theValue)=each($subparts)) {
02407
02408 $this->data[$this->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_'.$theKey];
02409
02410 $subpartArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'subparts.'.$theKey);
02411 }
02412 $this->data[$this->currentValKey] = '';
02413
02414
02415 $markerArray =array();
02416 reset($marks);
02417 while(list($theKey,$theValue)=each($marks)) {
02418 $markerArray[$PRE.$theKey.$POST] = $this->cObjGetSingle($theValue['name'],$theValue['conf'],'marks.'.$theKey);
02419 }
02420
02421 $subpartWraps =array();
02422 reset($wraps);
02423 while(list($theKey,$theValue)=each($wraps)) {
02424 $subpartWraps[$PRE.$theKey.$POST] = explode('|',$this->cObjGetSingle($theValue['name'],$theValue['conf'],'wraps.'.$theKey));
02425 }
02426
02427
02428 if ($conf['substMarksSeparately']) {
02429 $content = $this->substituteMarkerArrayCached($content,array(),$subpartArray,$subpartWraps);
02430 $content = $this->substituteMarkerArray($content, $markerArray);
02431 } else {
02432 $content = $this->substituteMarkerArrayCached($content,$markerArray,$subpartArray,$subpartWraps);
02433 }
02434 }
02435 }
02436 return $content;
02437 }
02438
02446 function MULTIMEDIA($conf) {
02447 $content='';
02448 $filename=$this->stdWrap($conf['file'],$conf['file.']);
02449 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($filename);
02450 if ($incFile) {
02451 $fileinfo = t3lib_div::split_fileref($incFile);
02452 if (t3lib_div::inList('txt,html,htm',$fileinfo['fileext'])) {
02453 $content = $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02454 } else {
02455
02456 $parArray=array();
02457
02458 $parArray['src']='src="'.$GLOBALS['TSFE']->absRefPrefix.$incFile.'"';
02459 if (t3lib_div::inList('au,wav,mp3',$fileinfo['fileext'])) {
02460 }
02461 if (t3lib_div::inList('avi,mov,mpg,asf,wmv',$fileinfo['fileext'])) {
02462 $parArray['width'] = 'width="200"';
02463 $parArray['height'] = 'height="200"';
02464 }
02465 if (t3lib_div::inList('swf,swa,dcr',$fileinfo['fileext'])) {
02466 $parArray['quality'] = 'quality="high"';
02467 }
02468 if (t3lib_div::inList('class',$fileinfo['fileext'])) {
02469 $parArray['width'] = 'width="200"';
02470 $parArray['height'] = 'height="200"';
02471 }
02472
02473
02474 $lines = explode(chr(10), $this->stdWrap($conf['params'],$conf['params.']));
02475 while(list(,$l)=each($lines)) {
02476 $parts = explode('=', $l);
02477 $parameter = strtolower(trim($parts[0]));
02478 $value = trim($parts[1]);
02479 if ((string)$value!='') {
02480 $parArray[$parameter] = $parameter.'="'.htmlspecialchars($value).'"';
02481 } else {
02482 unset($parArray[$parameter]);
02483 }
02484 }
02485 if ($fileinfo['fileext']=='class') {
02486 unset($parArray['src']);
02487 $parArray['code'] = 'code="'.htmlspecialchars($fileinfo['file']).'"';
02488 $parArray['codebase'] = 'codebase="'.htmlspecialchars($fileinfo['path']).'"';
02489 $content='<applet '.implode(' ',$parArray).'></applet>';
02490 } else {
02491 $content='<embed '.implode(' ',$parArray).'></embed>';
02492 }
02493 }
02494 }
02495
02496 if ($conf['stdWrap.']) {
02497 $content=$this->stdWrap($content, $conf['stdWrap.']);
02498 }
02499
02500 return $content;
02501 }
02502
02503
02504
02505
02506
02507
02508
02509
02510
02511
02512
02513
02514
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02533 function getSlidePids($pidList, $pidConf) {
02534 $pidList = trim($this->stdWrap($pidList,$pidConf));
02535 if (!strcmp($pidList,'')) {
02536 $pidList = 'this';
02537 }
02538 if (trim($pidList)) {
02539 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$pidList));
02540 $listArr = $this->checkPidArray($listArr);
02541 }
02542 $pidList = array();
02543 if (is_array($listArr)&&count($listArr)) {
02544 foreach ($listArr as $uid) {
02545 $page = $GLOBALS['TSFE']->sys_page->getPage($uid);
02546 if (!$page['is_siteroot']) {
02547 $pidList[] = $page['pid'];
02548 }
02549 }
02550 }
02551 return implode(',', $pidList);
02552 }
02553
02554
02565 function netprintApplication_offsiteLinkWrap($str,$imgConf,$conf) {
02566 if ($conf['url'] && @is_file($imgConf['origFile'])) {
02567 $thisUrl = $conf['thisUrl'] ? $conf['thisUrl'] : t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
02568 $origFile=$thisUrl.$imgConf['origFile'];
02569
02570 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02571 $gifCreator->init();
02572 $origDim = $gifCreator->getImageDimensions($imgConf['origFile']);
02573 if (!$conf['linkOnlyPixelsAbove'] || $origDim[0]*$origDim[1]>$conf['linkOnlyPixelsAbove']) {
02574
02575 $thumbFile=$thisUrl.$imgConf['3'].'|'.$imgConf[0].'x'.$imgConf[1].'|'.$origDim[0].'x'.$origDim[1].'|'.filesize($imgConf['origFile']).'|'.filemtime($imgConf['origFile']);
02576
02577 $url = $conf['url']
02578 .'&NP[offsite][1]='.rawurlencode($origFile)
02579 .'&NP[offsite_thumb][1]='.rawurlencode($thumbFile);
02580 $linkCObject = $this->cObjGetSingle($conf['cObject'],$conf['cObject.']);
02581 if ($linkCObject) {
02582 $ATagParams = $this->getATagParams($conf, 0);
02583 $linkCObject='<a href="'.htmlspecialchars($url).'"'.$ATagParams.'>'.$linkCObject.'</a>';
02584 $linkCObject=$this->stdWrap($linkCObject,$conf['outerStdWrap.']);
02585 if ($conf['before']) {
02586 $str=$linkCObject.$str;
02587 } else {
02588 $str=$str.$linkCObject;
02589 }
02590 }
02591 }
02592 }
02593 return $str;
02594 }
02595
02606 function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal) {
02607 if (!$GLOBALS['TSFE']->no_cache || (!isset($_POST[$fieldName]) && !isset($_GET[$fieldName])) || $noValueInsert) {
02608 return $defaultVal;
02609 } else {
02610 return t3lib_div::_GP($fieldName);
02611 }
02612 }
02613
02624 function cImage($file,$conf) {
02625 $info = $this->getImgResource($file,$conf['file.']);
02626 $GLOBALS['TSFE']->lastImageInfo=$info;
02627 if (is_array($info)) {
02628 $info[3] = t3lib_div::png_to_gif_by_imagemagick($info[3]);
02629 $GLOBALS['TSFE']->imagesOnPage[]=$info[3];
02630
02631 if (!strlen($conf['altText']) && !is_array($conf['altText.'])) {
02632 $conf['altText'] = $conf['alttext'];
02633 $conf['altText.'] = $conf['alttext.'];
02634 }
02635 $altParam = $this->getAltParam($conf);
02636
02637 $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).' />';
02638 if ($conf['linkWrap']) {
02639 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
02640 } elseif ($conf['imageLinkWrap']) {
02641 $theValue = $this->imageLinkWrap($theValue,$info['origFile'],$conf['imageLinkWrap.']);
02642 }
02643 return $this->wrap($theValue,$conf['wrap']);
02644 }
02645 }
02652 function getBorderAttr($borderAttr) {
02653 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->xhtmlDoctype) && !$GLOBALS['TSFE']->config['config']['disableImgBorderAttr']) {
02654 return $borderAttr;
02655 }
02656 }
02657
02668 function imageLinkWrap($string,$imageFile,$conf) {
02669 $a1='';
02670 $a2='';
02671 $content=$string;
02672 if ($this->stdWrap($conf['enable'],$conf['enable.'])) {
02673 $content=$this->typolink($string, $conf['typolink.']);
02674
02675 if ($content==$string && @is_file($imageFile)) {
02676 $params = '';
02677 if ($conf['width']) {$params.='&width='.rawurlencode($conf['width']);}
02678 if ($conf['height']) {$params.='&height='.rawurlencode($conf['height']);}
02679 if ($conf['effects']) {$params.='&effects='.rawurlencode($conf['effects']);}
02680 if ($conf['sample']) {$params.='&sample=1';}
02681 if ($conf['alternativeTempPath']) {$params.='&alternativeTempPath='.rawurlencode($conf['alternativeTempPath']);}
02682
02683 if ($conf['bodyTag']) {$params.='&bodyTag='.rawurlencode($conf['bodyTag']);}
02684 if ($conf['title']) {$params.='&title='.rawurlencode($conf['title']);}
02685 if ($conf['wrap']) {$params.='&wrap='.rawurlencode($conf['wrap']);}
02686
02687 $md5_value = md5(
02688 $imageFile.'|'.
02689 $conf['width'].'|'.
02690 $conf['height'].'|'.
02691 $conf['effects'].'|'.
02692 $conf['bodyTag'].'|'.
02693 $conf['title'].'|'.
02694 $conf['wrap'].'|'.
02695 $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].'|');
02696
02697 $params.= '&md5='.$md5_value;
02698 $url = $GLOBALS['TSFE']->absRefPrefix.'index.php?eID=tx_cms_showpic&file='.rawurlencode($imageFile).$params;
02699 if ($conf['JSwindow.']['altUrl'] || $conf['JSwindow.']['altUrl.']) {
02700 $altUrl = $this->stdWrap($conf['JSwindow.']['altUrl'], $conf['JSwindow.']['altUrl.']);
02701 if ($altUrl) {
02702 $url = $altUrl . ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file='.rawurlencode($imageFile).$params);
02703 }
02704 }
02705
02706
02707 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
02708 if (isset($conf['target'])) {
02709 $target = sprintf(' target="%s"', $conf['target']);
02710 } else {
02711 $target = ' target="thePicture"';
02712 }
02713 } else {
02714 $target = '';
02715 }
02716
02717 if ($conf['JSwindow']) {
02718 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
02719 $gifCreator->init();
02720 $gifCreator->mayScaleUp = 0;
02721 $dims = $gifCreator->getImageScale($gifCreator->getImageDimensions($imageFile),$conf['width'],$conf['height'],'');
02722 $offset = t3lib_div::intExplode(',',$conf['JSwindow.']['expand'].',');
02723
02724 $a1='<a href="'. htmlspecialchars($url) .'" onclick="'.
02725 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;').
02726 '"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02727 $a2='</a>';
02728 $GLOBALS['TSFE']->setJS('openPic');
02729 } else {
02730 $a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
02731 $a2='</a>';
02732 }
02733 $content=$a1.$string.$a2;
02734 }
02735 }
02736
02737 return $content;
02738 }
02739
02748 function fileResource($fName, $addParams='alt="" title=""') {
02749 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($fName);
02750 if ($incFile) {
02751 $fileinfo = t3lib_div::split_fileref($incFile);
02752 if (t3lib_div::inList('jpg,gif,jpeg,png',$fileinfo['fileext'])) {
02753 $imgFile = $incFile;
02754 $imgInfo = @getImageSize($imgFile);
02755 return '<img src="'.$GLOBALS['TSFE']->absRefPrefix.$imgFile.'" width="'.$imgInfo[0].'" height="'.$imgInfo[1].'"'.$this->getBorderAttr(' border="0"').' '.$addParams.' />';
02756 } elseif (filesize($incFile)<1024*1024) {
02757 return $GLOBALS['TSFE']->tmpl->fileContent($incFile);
02758 }
02759 }
02760 }
02761
02771 function lastChanged($tstamp) {
02772 $tstamp = intval($tstamp);
02773 if ($tstamp>intval($GLOBALS['TSFE']->register['SYS_LASTCHANGED'])) {
02774 $GLOBALS['TSFE']->register['SYS_LASTCHANGED'] = $tstamp;
02775 }
02776 }
02777
02788 function linkWrap($content,$wrap) {
02789 $wrapArr = explode('|', $wrap);
02790 if (ereg("\{([0-9]*)\}",$wrapArr[0],$reg)) {
02791 if ($uid = $GLOBALS['TSFE']->tmpl->rootLine[$reg[1]]['uid']) {
02792 $wrapArr[0] = str_replace($reg[0],$uid,$wrapArr[0]);
02793 }
02794 }
02795 return trim($wrapArr[0]).$content.trim($wrapArr[1]);
02796 }
02797
02807 function getAltParam($conf, $longDesc=true) {
02808 $altText = trim($this->stdWrap($conf['altText'], $conf['altText.']));
02809 $titleText = trim($this->stdWrap($conf['titleText'],$conf['titleText.']));
02810 $longDesc = trim($this->stdWrap($conf['longdescURL'],$conf['longdescURL.']));
02811
02812
02813 $altParam = ' alt="'.htmlspecialchars(strip_tags($altText)).'"';
02814
02815
02816 $emptyTitleHandling = 'useAlt';
02817 if ($conf['emptyTitleHandling']) {
02818
02819 $emptyTitleHandling = $conf['emptyTitleHandling'];
02820 }
02821 if ($titleText || $emptyTitleHandling == 'keepEmpty') {
02822 $altParam.= ' title="'.htmlspecialchars(strip_tags($titleText)).'"';
02823 } elseif (!$titleText && $emptyTitleHandling == 'useAlt') {
02824 $altParam.= ' title="'.htmlspecialchars(strip_tags($altText)).'"';
02825 }
02826
02827
02828 if ($longDesc) {
02829 $altParam.= ' longdesc="'.htmlspecialchars(strip_tags($longDesc)).'"';
02830 }
02831
02832 return $altParam;
02833 }
02834
02842 function cleanFormName($name) {
02843
02844 $name = preg_replace('/\[|\]\[?/',':',trim($name));
02845
02846 return preg_replace('#[^:a-zA-Z0-9]#','',$name);
02847 }
02848
02858 function getATagParams($conf, $addGlobal=1) {
02859 $aTagParams = '';
02860 if ($conf['ATagParams.']) {
02861 $aTagParams = ' '.$this->stdWrap($conf['ATagParams'], $conf['ATagParams.']);
02862 } elseif ($conf['ATagParams']) {
02863 $aTagParams = ' '.$conf['ATagParams'];
02864 }
02865 if ($addGlobal) {
02866 $aTagParams = ' '.trim($GLOBALS['TSFE']->ATagParams.$aTagParams);
02867 }
02868 return $aTagParams;
02869 }
02870
02871
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884
02885
02886
02887
02888
02889
02890
02891
02892
02893
02905 function getSubpart($content, $marker) {
02906 return t3lib_parsehtml::getSubpart($content, $marker);
02907 }
02908
02921 function substituteSubpart($content,$marker,$subpartContent,$recursive=1) {
02922 return t3lib_parsehtml::substituteSubpart($content, $marker, $subpartContent, $recursive);
02923 }
02924
02934 function substituteMarker($content,$marker,$markContent) {
02935 return str_replace($marker,$markContent,$content);
02936 }
02937
02954 function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array()) {
02955 $GLOBALS['TT']->push('/substituteMarkerArray/');
02956
02957
02958 if (!is_array($markContentArray)) $markContentArray=array();
02959 if (!is_array($subpartContentArray)) $subpartContentArray=array();
02960 if (!is_array($wrappedSubpartContentArray)) $wrappedSubpartContentArray=array();
02961
02962 $sPkeys = array_keys($subpartContentArray);
02963 $wPkeys = array_keys($wrappedSubpartContentArray);
02964 $aKeys = array_merge(array_keys($markContentArray),$sPkeys,$wPkeys);
02965 if (!count($aKeys)) {
02966 $GLOBALS['TT']->pull();
02967 return $content;
02968 }
02969 asort($aKeys);
02970 $storeKey = md5('substituteMarkerArrayCached_storeKey:'.serialize(array($content,$aKeys)));
02971 if ($this->substMarkerCache[$storeKey]) {
02972 $storeArr = $this->substMarkerCache[$storeKey];
02973 $GLOBALS['TT']->setTSlogMessage('Cached',0);
02974 } else {
02975 $storeArrDat = $GLOBALS['TSFE']->sys_page->getHash($storeKey,0);
02976 if (!isset($storeArrDat)) {
02977
02978 $storeArr=array();
02979
02980
02981 reset($sPkeys);
02982 while(list(,$sPK)=each($sPkeys)) {
02983 $content =$this->substituteSubpart($content,$sPK,$sPK);
02984 }
02985
02986
02987 reset($wPkeys);
02988 while(list(,$wPK)=each($wPkeys)) {
02989 $content =$this->substituteSubpart($content,$wPK,array($wPK,$wPK));
02990 }
02991
02992
02993 reset($aKeys);
02994 while(list($tK,$tV)=each($aKeys)) {
02995 $aKeys[$tK]=quotemeta($tV);
02996 }
02997 $regex = implode('|',$aKeys);
02998
02999 $storeArr['c'] = split($regex,$content);
03000 preg_match_all('/'.$regex.'/',$content,$keyList);
03001 $storeArr['k']=$keyList[0];
03002
03003 $this->substMarkerCache[$storeKey] = $storeArr;
03004
03005
03006 $GLOBALS['TSFE']->sys_page->storeHash($storeKey, serialize($storeArr), 'substMarkArrayCached');
03007
03008 $GLOBALS['TT']->setTSlogMessage('Parsing',0);
03009 } else {
03010
03011 $storeArr = unserialize($storeArrDat);
03012
03013 $this->substMarkerCache[$storeKey] = $storeArr;
03014 $GLOBALS['TT']->setTSlogMessage('Cached from DB',0);
03015 }
03016 }
03017
03018
03019
03020 $valueArr = array_merge($markContentArray,$subpartContentArray,$wrappedSubpartContentArray);
03021
03022 $wSCA_reg=array();
03023 reset($storeArr['k']);
03024 $content = '';
03025
03026 while(list($n,$keyN)=each($storeArr['k'])) {
03027 $content.=$storeArr['c'][$n];
03028 if (!is_array($valueArr[$keyN])) {
03029 $content.=$valueArr[$keyN];
03030 } else {
03031 $content.=$valueArr[$keyN][(intval($wSCA_reg[$keyN])%2)];
03032 $wSCA_reg[$keyN]++;
03033 }
03034 }
03035 $content.=$storeArr['c'][count($storeArr['k'])];
03036
03037 $GLOBALS['TT']->pull();
03038 return $content;
03039 }
03040
03052 function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0) {
03053 if (is_array($markContentArray)) {
03054 reset($markContentArray);
03055 $wrapArr=t3lib_div::trimExplode('|',$wrap);
03056 while(list($marker,$markContent)=each($markContentArray)) {
03057 if($uppercase) $marker=strtoupper($marker);
03058 if(strcmp($wrap,'')) $marker=$wrapArr[0].$marker.$wrapArr[1];
03059 $content=str_replace($marker,$markContent,$content);
03060 }
03061 }
03062 return $content;
03063 }
03064
03073 function substituteMarkerInObject(&$tree, $markContentArray) {
03074 if (is_array ($tree)) {
03075 reset($tree);
03076 while(list($key,$value)=each($tree)) {
03077 $this->substituteMarkerInObject ($tree[$key], $markContentArray);
03078 }
03079 } else {
03080 $tree = $this->substituteMarkerArray($tree,$markContentArray);
03081 }
03082 return $tree;
03083 }
03084
03096 function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE) {
03097 if ($fieldList) {
03098 $fArr = t3lib_div::trimExplode(',',$fieldList,1);
03099 foreach($fArr as $field) {
03100 $markContentArray['###'.$prefix.$field.'###'] = $nl2br?nl2br($row[$field]):$row[$field];
03101 }
03102 } else {
03103 if (is_array($row)) {
03104 foreach($row as $field => $value) {
03105 if (!t3lib_div::testInt($field)) {
03106 if ($HSC) $value = htmlspecialchars($value);
03107 $markContentArray['###'.$prefix.$field.'###'] = $nl2br ? nl2br($value) : $value;
03108 }
03109 }
03110 }
03111 }
03112
03113 return $markContentArray;
03114 }
03115
03116
03117
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03159 function stdWrap($content,$conf) {
03160 if (is_array($conf)) {
03161
03162
03163 if ($conf['setContentToCurrent']){$this->data[$this->currentValKey]=$content;}
03164 if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
03165
03166
03167 if (isset($conf['lang.']) && $GLOBALS['TSFE']->config['config']['language'] && isset($conf['lang.'][$GLOBALS['TSFE']->config['config']['language']])) {
03168 $content = $conf['lang.'][$GLOBALS['TSFE']->config['config']['language']];
03169 }
03170 if ($conf['data']){$content=$this->getData($conf['data'], is_array($this->alternativeData)?$this->alternativeData:$this->data);}
03171 $this->alternativeData='';
03172 if ($conf['field']) {$content=$this->getFieldVal($conf['field']);}
03173 if ($conf['current']) {$content=$this->data[$this->currentValKey];}
03174 if ($conf['cObject']) {$content=$this->cObjGetSingle($conf['cObject'],$conf['cObject.'],'/stdWrap/.cObject');}
03175 if ($conf['numRows.']) {$content=$this->numRows($conf['numRows.']);}
03176 if ($conf['filelist'] || $conf['filelist.']) {$content=$this->filelist($this->stdWrap($conf['filelist'], $conf['filelist.']));}
03177 if ($conf['preUserFunc']) {$content = $this->callUserFunction($conf['preUserFunc'], $conf['preUserFunc.'], $content);}
03178
03179
03180 if ($conf['override'] || $conf['override.']){
03181 $override = $this->stdWrap($conf['override'], $conf['override.']);
03182 if (trim($override)) {$content=$override;}
03183 }
03184 if (isset($conf['preIfEmptyListNum']) || isset($conf['preIfEmptyListNum.']['stdWrap.'])) {
03185 $preIfEmptyListNumber = isset($conf['preIfEmptyListNum.']['stdWrap.']) ? $this->stdWrap($conf['preIfEmptyListNum'], $conf['preIfEmptyListNum.']['stdWrap.']) : $conf['preIfEmptyListNum'];
03186 $content=$this->listNum($content,$preIfEmptyListNumber,$conf['preIfEmptyListNum.']['splitChar']);
03187 }
03188 if (!trim($content) && ($conf['ifEmpty'] || $conf['ifEmpty.'])) {
03189 $content = $this->stdWrap($conf['ifEmpty'], $conf['ifEmpty.']);
03190 }
03191 if (!strlen(trim($content)) && ($conf['ifBlank'] || $conf['ifBlank.'])) {
03192 $content = $this->stdWrap($conf['ifBlank'], $conf['ifBlank.']);
03193 }
03194
03195
03196 if (isset($conf['listNum']) || isset($conf['listNum.']['stdWrap.'])) {
03197 $listNumber = isset($conf['listNum.']['stdWrap.']) ? $this->stdWrap($conf['listNum'], $conf['listNum.']['stdWrap.']) : $conf['listNum'];
03198 $content=$this->listNum($content,$listNumber,$conf['listNum.']['splitChar']);
03199 }
03200
03201 if ($conf['trim']) { $content=trim($content); }
03202
03203
03204 if ($conf['stdWrap']) { $content=$this->stdWrap($content,$conf['stdWrap.']); }
03205
03206 if ( ($conf['required'] && (string)$content=='') || ($conf['if.'] && !$this->checkIf($conf['if.'])) || ($conf['fieldRequired'] && !trim($this->data[$conf['fieldRequired']])) ){
03207 $content = '';
03208 } else {
03209
03210 if ($conf['csConv']) { $content=$GLOBALS['TSFE']->csConv($content,$conf['csConv']); }
03211 if ($conf['parseFunc.'] || $conf['parseFunc']) {$content=$this->parseFunc($content,$conf['parseFunc.'],$conf['parseFunc']);}
03212 if ($conf['HTMLparser'] && is_array($conf['HTMLparser.'])) {$content=$this->HTMLparser_TSbridge($content,$conf['HTMLparser.']);}
03213 if ($conf['split.']){$content=$this->splitObj($content,$conf['split.']);}
03214 if ($conf['prioriCalc']){$content=t3lib_div::calcParenthesis($content); if ($conf['prioriCalc']=='intval') $content=intval($content);}
03215 if ((string)$conf['char']!=''){$content=chr(intval($conf['char']));}
03216 if ($conf['intval']){$content=intval($content);}
03217 if ($conf['date']){$content=date($conf['date'], $content);}
03218 if ($conf['strftime']){
03219 $content = strftime($conf['strftime'], $content);
03220 $tmp_charset = $conf['strftime.']['charset'] ? $conf['strftime.']['charset'] : $GLOBALS['TSFE']->localeCharset;
03221 if ($tmp_charset) {
03222 $content = $GLOBALS['TSFE']->csConv($content,$tmp_charset);
03223 }
03224 }
03225 if ($conf['age']){$content=$this->calcAge(time()-$content,$conf['age']);}
03226
03227 if ($conf['case']){$content=$this->HTMLcaseshift($content, $conf['case']);}
03228 if ($conf['bytes']){$content=$this->bytes($content,$conf['bytes.']['labels']);}
03229 if ($conf['substring']){$content=$this->substring($content,$conf['substring']);}
03230 if ($conf['removeBadHTML']) {$content = $this->removeBadHTML($content, $conf['removeBadHTML.']);}
03231 if ($conf['stripHtml']){$content = strip_tags($content);}
03232 if ($conf['crop']){$content=$this->crop($content, $conf['crop']);}
03233 if ($conf['rawUrlEncode']){$content = rawurlencode($content);}
03234 if ($conf['htmlSpecialChars']){
03235 $content=htmlSpecialChars($content);
03236 if ($conf['htmlSpecialChars.']['preserveEntities']) $content = t3lib_div::deHSCentities($content);
03237 }
03238
03239 if ($conf['doubleBrTag']) {
03240 $content=ereg_replace("\r?\n[\t ]*\r?\n",$conf['doubleBrTag'],$content);
03241 }
03242 if ($conf['br']) {$content=nl2br($content);}
03243 if ($conf['brTag']) {$content= ereg_replace(chr(10),$conf['brTag'],$content);}
03244 if ($conf['encapsLines.']) {$content=$this->encaps_lineSplit($content,$conf['encapsLines.']);}
03245 if ($conf['keywords']) {$content= $this->keywords($content);}
03246 if ($conf['innerWrap'] || $conf['innerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap'], $conf['innerWrap.']));}
03247 if ($conf['innerWrap2'] || $conf['innerWrap2.']){$content=$this->wrap($content, $this->stdWrap($conf['innerWrap2'], $conf['innerWrap2.']));}
03248 if ($conf['fontTag']){$content=$this->wrap($content, $conf['fontTag']);}
03249 if ($conf['addParams.']) {$content=$this->addParams($content,$conf['addParams.']);}
03250 if ($conf['textStyle.']) {$content=$this->textStyle($content,$conf['textStyle.']);}
03251 if ($conf['tableStyle.']) {$content=$this->tableStyle($content,$conf['tableStyle.']);}
03252 if ($conf['filelink.']) {$content=$this->filelink($content,$conf['filelink.']);}
03253 if ($conf['preCObject']) {$content=$this->cObjGetSingle($conf['preCObject'],$conf['preCObject.'],'/stdWrap/.preCObject').$content;}
03254 if ($conf['postCObject']) {$content.=$this->cObjGetSingle($conf['postCObject'],$conf['postCObject.'],'/stdWrap/.postCObject');}
03255
03256 if ($conf['wrapAlign'] || $conf['wrapAlign.']){
03257 $wrapAlign = trim($this->stdWrap($conf['wrapAlign'], $conf['wrapAlign.']));
03258 if ($wrapAlign) {$content=$this->wrap($content, '<div style="text-align:'.$wrapAlign.';">|</div>');}
03259 }
03260 if ($conf['typolink.']){$content=$this->typolink($content, $conf['typolink.']);}
03261 if (is_array($conf['TCAselectItem.'])) {$content=$this->TCAlookup($content,$conf['TCAselectItem.']);}
03262
03263
03264 if ($conf['space']){$content=$this->wrapSpace($content, $conf['space']);}
03265 $spaceBefore = '';
03266 if ($conf['spaceBefore'] || $conf['spaceBefore.']) {$spaceBefore = trim($this->stdWrap($conf['spaceBefore'], $conf['spaceBefore.']));}
03267 $spaceAfter = '';
03268 if ($conf['spaceAfter'] || $conf['spaceAfter.']) {$spaceAfter = trim($this->stdWrap($conf['spaceAfter'], $conf['spaceAfter.']));}
03269 if ($spaceBefore || $spaceAfter) {$content=$this->wrapSpace($content, $spaceBefore.'|'.$spaceAfter);}
03270
03271
03272 if ($conf['wrap']){$content=$this->wrap($content, $conf['wrap'], ($conf['wrap.']['splitChar']?$conf['wrap.']['splitChar']:'|'));}
03273 if ($conf['noTrimWrap']){$content=$this->noTrimWrap($content, $conf['noTrimWrap']);}
03274 if ($conf['wrap2']){$content=$this->wrap($content, $conf['wrap2'], ($conf['wrap2.']['splitChar']?$conf['wrap2.']['splitChar']:'|'));}
03275 if ($conf['dataWrap']){$content=$this->dataWrap($content, $conf['dataWrap']);}
03276 if ($conf['prepend']){$content=$this->cObjGetSingle($conf['prepend'],$conf['prepend.'],'/stdWrap/.prepend').$content;}
03277 if ($conf['append']){$content.=$this->cObjGetSingle($conf['append'],$conf['append.'],'/stdWrap/.append');}
03278 if ($conf['wrap3']){$content=$this->wrap($content, $conf['wrap3'], ($conf['wrap3.']['splitChar']?$conf['wrap3.']['splitChar']:'|'));}
03279 if ($conf['outerWrap'] || $conf['outerWrap.']){$content=$this->wrap($content, $this->stdWrap($conf['outerWrap'], $conf['outerWrap.']));}
03280 if ($conf['insertData']) {$content = $this->insertData($content);}
03281 if ($conf['offsetWrap']){
03282 $controlTable = t3lib_div::makeInstance('tslib_tableOffset');
03283 if ($conf['offsetWrap.']['tableParams'] || $conf['offsetWrap.']['tableParams.']) {$controlTable->tableParams = $this->stdWrap($conf['offsetWrap.']['tableParams'], $conf['offsetWrap.']['tableParams.']);}
03284 if ($conf['offsetWrap.']['tdParams'] || $conf['offsetWrap.']['tdParams.']) {$controlTable->tdParams = ' '.$this->stdWrap($conf['offsetWrap.']['tdParams'], $conf['offsetWrap.']['tdParams.']);}
03285 $content=$controlTable->start($content,$conf['offsetWrap']);
03286 if ($conf['offsetWrap.']['stdWrap.']) { $content=$this->stdWrap($content,$conf['offsetWrap.']['stdWrap.']); }
03287 }
03288 if ($conf['postUserFunc']) {$content = $this->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $content);}
03289 if ($conf['postUserFuncInt']) {
03290 $substKey = 'INT_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
03291 $GLOBALS['TSFE']->config['INTincScript'][$substKey] = array(
03292 'content' => $content,
03293 'postUserFunc' => $conf['postUserFuncInt'],
03294 'conf' => $conf['postUserFuncInt.'],
03295 'type' => 'POSTUSERFUNC',
03296 'cObj' => serialize($this),
03297 );
03298 $content ='<!--'.$substKey.'-->';
03299 }
03300
03301 if ($conf['prefixComment'] && !$GLOBALS['TSFE']->config['config']['disablePrefixComment']) {$content = $this->prefixComment($conf['prefixComment'], $conf['prefixComment.'], $content);}
03302
03303 if ($conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editIcons($content,$conf['editIcons'],$conf['editIcons.']);}
03304 if ($conf['editPanel'] && $GLOBALS['TSFE']->beUserLogin){$content=$this->editPanel($content, $conf['editPanel.']);}
03305 }
03306
03307
03308 if ($conf['debug']) {$content = '<pre>'.htmlspecialchars($content).'</pre>';}
03309 if ($conf['debugFunc']) {debug($conf['debugFunc']==2?array($content):$content);}
03310 if ($conf['debugData']) {
03311 echo '<b>$cObj->data:</b>';
03312 debug($this->data,'$cObj->data:');
03313 if (is_array($this->alternativeData)) {
03314 echo '<b>$cObj->alternativeData:</b>';
03315 debug($this->alternativeData,'$this->alternativeData');
03316 }
03317 }
03318 }
03319 return $content;
03320 }
03321
03333 function numRows($conf) {
03334 $conf['select.']['selectFields'] = 'count(*)';
03335
03336 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
03337
03338 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
03339 $GLOBALS['TT']->setTSlogMessage($error,3);
03340 } else {
03341 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
03342 return intval($row[0]);
03343 }
03344 }
03345
03354 function listNum($content,$listNum,$char) {
03355 $char = $char ? $char : ',';
03356 if (t3lib_div::testInt($char)) {
03357 $char = chr($char);
03358 }
03359 $temp = explode($char,$content);
03360 $last = ''.(count($temp)-1);
03361 $index=$this->calc(eregi_replace('last',$last,$listNum));
03362 return $temp[$index];
03363 }
03364
03374 function checkIf($conf) {
03375 if (!is_array($conf)) {return true;}
03376 if (isset($conf['directReturn'])) {return $conf['directReturn'] ? 1 : 0;}
03377 $flag = true;
03378 if (isset($conf['isTrue']) || isset($conf['isTrue.'])) {
03379 $isTrue = trim($this->stdWrap($conf['isTrue'],$conf['isTrue.']));
03380 if (!$isTrue) {
03381 $flag=0;
03382 }
03383 }
03384 if (isset($conf['isFalse']) || isset($conf['isFalse.'])) {
03385 $isFalse = trim($this->stdWrap($conf['isFalse'],$conf['isFalse.']));
03386 if ($isFalse) {
03387 $flag=0;
03388 }
03389 }
03390 if (isset($conf['isPositive']) || isset($conf['isPositive.'])) {
03391 $number = $this->calc($this->stdWrap($conf['isPositive'],$conf['isPositive.']));
03392 if ($number<1) {
03393 $flag=0;
03394 }
03395 }
03396 if ($flag) {
03397 $value = trim($this->stdWrap($conf['value'],$conf['value.']));
03398
03399 if (isset($conf['isGreaterThan']) || isset($conf['isGreaterThan.'])) {
03400 $number = trim($this->stdWrap($conf['isGreaterThan'],$conf['isGreaterThan.']));
03401 if ($number<=$value) {
03402 $flag=0;
03403 }
03404 }
03405 if (isset($conf['isLessThan']) || isset($conf['isLessThan.'])) {
03406 $number = trim($this->stdWrap($conf['isLessThan'],$conf['isLessThan.']));
03407 if ($number>=$value) {
03408 $flag=0;
03409 }
03410 }
03411 if (isset($conf['equals']) || isset($conf['equals.'])) {
03412 $number = trim($this->stdWrap($conf['equals'],$conf['equals.']));
03413 if ($number!=$value) {
03414 $flag=0;
03415 }
03416 }
03417 if (isset($conf['isInList']) || isset($conf['isInList.'])) {
03418 $number = trim($this->stdWrap($conf['isInList'],$conf['isInList.']));
03419 if (!t3lib_div::inList($value,$number)) {
03420 $flag=0;
03421 }
03422 }
03423 }
03424 if ($conf['negate']) {$flag = $flag ? 0 : 1;}
03425 return $flag;
03426 }
03427
03437 function filelist($data) {
03438 $data = trim($data);
03439 if ($data) {
03440 $data_arr = explode('|',$data);
03441
03442 if ($GLOBALS['TSFE']->lockFilePath) {
03443 $path = $this->clean_directory($data_arr[0]);
03444 $path = substr($path,0,strlen($GLOBALS['TSFE']->lockFilePath))==$GLOBALS['TSFE']->lockFilePath ? $path : '';
03445 }
03446 if ($path) {
03447 $items = Array('files'=>array(), 'sorting'=>array());
03448 $ext_list = strtolower(t3lib_div::uniqueList($data_arr[1]));
03449 $sorting = trim($data_arr[2]);
03450
03451 $d = @dir($path);
03452 $tempArray=Array();
03453 if (is_object($d)) {
03454 $count=0;
03455 while($entry=$d->read()) {
03456 if ($entry!='.' && $entry!='..') {
03457 $wholePath = $path.'/'.$entry;
03458 if (@file_exists($wholePath) && filetype($wholePath)=='file') {
03459 $info = t3lib_div::split_fileref($wholePath);
03460 if (!$ext_list || t3lib_div::inList($ext_list,$info['fileext'])) {
03461 $items['files'][] = $info['file'];
03462 switch($sorting) {
03463 case 'name':
03464 $items['sorting'][] = strtolower($info['file']);
03465 break;
03466 case 'size':
03467 $items['sorting'][] = filesize($wholePath);
03468 break;
03469 case 'ext':
03470 $items['sorting'][] = $info['fileext'];
03471 break;
03472 case 'date':
03473 $items['sorting'][] = filectime($wholePath);
03474 break;
03475 case 'mdate':
03476 $items['sorting'][] = filemtime($wholePath);
03477 break;
03478 default:
03479 $items['sorting'][] = $count;
03480 break;
03481 }
03482 $count++;
03483 }
03484 }
03485 }
03486 }
03487 $d->close();
03488 }
03489
03490 if (count($items['sorting'])) {
03491 if (strtolower(trim($data_arr[3]))!='r') {
03492 asort($items['sorting']);
03493 } else {
03494 arsort($items['sorting']);
03495 }
03496 }
03497 if (count($items['files'])) {
03498
03499 reset($items['sorting']);
03500 $fullPath = trim($data_arr[4]);
03501 $list_arr=Array();
03502 while(list($key,)=each($items['sorting'])) {
03503 $list_arr[]= $fullPath ? $path.'/'.$items['files'][$key] : $items['files'][$key];
03504 }
03505 return implode(',',$list_arr);
03506 }
03507 }
03508 }
03509 }
03510
03519 function clean_directory($theDir) {
03520 if (t3lib_div::validPathStr($theDir)) {
03521 $theDir = ereg_replace("[\/\. ]*$",'',$theDir);
03522 if (!t3lib_div::isAbsPath($theDir) && @is_dir($theDir)) {
03523 return $theDir;
03524 }
03525 }
03526 }
03527
03537 function HTMLparser_TSbridge($theValue, $conf) {
03538 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
03539 $htmlParserCfg = $htmlParser->HTMLparserConfig($conf);
03540 return $htmlParser->HTMLcleaner($theValue,$htmlParserCfg[0],$htmlParserCfg[1],$htmlParserCfg[2],$htmlParserCfg[3]);
03541 }
03542
03551 function dataWrap($content,$wrap) {
03552 return $this->wrap($content,$this->insertData($wrap));
03553 }
03554
03564 function insertData($str) {
03565 $inside=0;
03566 $newVal='';
03567 $pointer=0;
03568 $totalLen = strlen($str);
03569 do {
03570 if (!$inside) {
03571 $len = strcspn(substr($str,$pointer),'{');
03572 $newVal.= substr($str,$pointer,$len);
03573 $inside = 1;
03574 } else {
03575 $len = strcspn(substr($str,$pointer),'}')+1;
03576 $newVal.= $this->getData(substr($str,$pointer+1,$len-2),$this->data);
03577 $inside = 0;
03578 }
03579 $pointer+=$len;
03580 } while($pointer<$totalLen);
03581 return $newVal;
03582 }
03583
03594 function prefixComment($str,$conf,$content) {
03595 $parts = explode('|',$str);
03596
03597 $output =
03598 chr(10).str_pad('',$parts[0],chr(9)).
03599 '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [begin] -->'.
03600 chr(10).str_pad('',$parts[0]+1,chr(9)).
03601 $content.
03602 chr(10).str_pad('',$parts[0],chr(9)).
03603 '<!-- '.htmlspecialchars($this->insertData($parts[1])).' [end] -->'.
03604 chr(10).str_pad('',$parts[0]+1,chr(9));
03605
03606 return $output;
03607 }
03608
03618 function substring($content,$options) {
03619 $options = t3lib_div::intExplode(',',$options.',');
03620 if ($options[1]) {
03621 return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0],$options[1]);
03622 } else {
03623 return $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$options[0]);
03624 }
03625 }
03626
03636 function crop($content,$options) {
03637 $options = explode('|',$options);
03638 $chars = intval($options[0]);
03639 $afterstring = trim($options[1]);
03640 $crop2space = trim($options[2]);
03641 if ($chars) {
03642 if (strlen($content)>abs($chars)) {
03643 if ($chars<0) {
03644 $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,$chars);
03645 $trunc_at = strpos($content, ' ');
03646 $content = ($trunc_at&&$crop2space) ? $afterstring.substr($content,$trunc_at) : $afterstring.$content;
03647 } else {
03648 $content = $GLOBALS['TSFE']->csConvObj->substr($GLOBALS['TSFE']->renderCharset,$content,0,$chars);
03649 $trunc_at = strrpos($content, ' ');
03650 $content = ($trunc_at&&$crop2space) ? substr($content, 0, $trunc_at).$afterstring : $content.$afterstring;
03651 }
03652 }
03653 }
03654 return $content;
03655 }
03656
03668 function removeBadHTML($text, $conf) {
03669
03670
03671 $text = preg_replace(
03672 array(
03673 "'<script[^>]*?>.*?</script[^>]*?>'si",
03674 "'<applet[^>]*?>.*?</applet[^>]*?>'si",
03675 "'<object[^>]*?>.*?</object[^>]*?>'si",
03676 "'<iframe[^>]*?>.*?</iframe[^>]*?>'si",
03677 "'<frameset[^>]*?>.*?</frameset[^>]*?>'si",
03678 "'<style[^>]*?>.*?</style[^>]*?>'si",
03679 "'<marquee[^>]*?>.*?</marquee[^>]*?>'si",
03680 "'<script[^>]*?>'si",
03681 "'<meta[^>]*?>'si",
03682 "'<base[^>]*?>'si",
03683 "'<applet[^>]*?>'si",
03684 "'<object[^>]*?>'si",
03685 "'<link[^>]*?>'si",
03686 "'<iframe[^>]*?>'si",
03687 "'<frame[^>]*?>'si",
03688 "'<frameset[^>]*?>'si",
03689 "'<input[^>]*?>'si",
03690 "'<form[^>]*?>'si",
03691 "'<embed[^>]*?>'si",
03692 "'background-image:url'si",
03693 "'<\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",
03694 ), '', $text);
03695
03696 $text = eregi_replace('<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*','',$text);
03697
03698 // Return clean content
03699 return $text;
03700 }
03701
03712 function textStyle($theValue, $conf) {
03713 $conf['face.'][1] = 'Times New Roman';
03714 $conf['face.'][2] = 'Verdana,Arial,Helvetica,Sans serif';
03715 $conf['face.'][3] = 'Arial,Helvetica,Sans serif';
03716
03717 $conf['size.'][1] = 1;
03718 $conf['size.'][2] = 2;
03719 $conf['size.'][3] = 3;
03720 $conf['size.'][4] = 4;
03721 $conf['size.'][5] = 5;
03722 $conf['size.'][10] = '+1';
03723 $conf['size.'][11] = '-1';
03724
03725 $conf['color.'][240] = 'black';
03726 $conf['color.'][241] = 'white';
03727 $conf['color.'][242] = '#333333';
03728 $conf['color.'][243] = 'gray';
03729 $conf['color.'][244] = 'silver';
03730 $conf['color.'][245] = 'red';
03731 $conf['color.'][246] = 'navy';
03732 $conf['color.'][247] = 'yellow';
03733 $conf['color.'][248] = 'green';
03734 $conf['color.'][249] = 'olive';
03735 $conf['color.'][250] = 'maroon';
03736
03737 $face = $this->data[$conf['face.']['field']];
03738 $size = $this->data[$conf['size.']['field']];
03739 $color = $this->data[$conf['color.']['field']];
03740 $align = $this->data[$conf['align.']['field']];
03741 $properties = $this->data[$conf['properties.']['field']];
03742 if (!$properties) {
03743 $properties=$this->stdWrap($conf['properties.']['default'],$conf['properties.']['default.']);
03744 }
03745
03746 // properties
03747 if (($properties&8)) {$theValue=$this->HTMLcaseshift($theValue, 'upper');}
03748 if (($properties&1)) {$theValue='<b>'.$theValue.'</b>';}
03749 if (($properties&2)) {$theValue='<i>'.$theValue.'</i>';}
03750 if (($properties&4)) {$theValue='<u>'.$theValue.'</u>';}
03751
03752 // Fonttag
03753 $theFace = $conf['face.'][$face] ? $conf['face.'][$face] : $this->stdWrap($conf['face.']['default'],$conf['face.']['default.']);
03754 $theSize = $conf['size.'][$size] ? $conf['size.'][$size] : $this->stdWrap($conf['size.']['default'],$conf['size.']['default.']);
03755 $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $this->stdWrap($conf['color.']['default'],$conf['color.']['default.']);
03756
03757 if ($conf['altWrap']) {
03758 $theValue=$this->wrap($theValue, $conf['altWrap']);
03759 } elseif ($theFace || $theSize || $theColor) {
03760 $fontWrap = '<font'.($theFace?' face="'.$theFace.'"':'').($theSize?' size="'.$theSize.'"':'').($theColor?' color="'.$theColor.'"':'').'>|</font>';
03761 $theValue=$this->wrap($theValue, $fontWrap);
03762 }
03763
03764 if ($align) {$theValue=$this->wrap($theValue, '<div style="text-align:'.$align.';">|</div>');}
03765
03766 return $theValue;
03767 }
03768
03779 function tableStyle($theValue, $conf) {
03780 $conf['color.'][240] = 'black';
03781 $conf['color.'][241] = 'white';
03782 $conf['color.'][242] = '#333333';
03783 $conf['color.'][243] = 'gray';
03784 $conf['color.'][244] = 'silver';
03785
03786 $align = $this->stdWrap($conf['align'],$conf['align.']);
03787 $border = intval($this->stdWrap($conf['border'],$conf['border.']));
03788 $cellspacing = intval($this->stdWrap($conf['cellspacing'],$conf['cellspacing.']));
03789 $cellpadding = intval($this->stdWrap($conf['cellpadding'],$conf['cellpadding.']));
03790
03791 $color = $this->data[$conf['color.']['field']];
03792 $theColor = $conf['color.'][$color] ? $conf['color.'][$color] : $conf['color.']['default'];
03793
03794 $tableTagArray = Array('<table');
03795 $tableTagArray[]='border="'.$border.'"';
03796 $tableTagArray[]='cellspacing="'.$cellspacing.'"';
03797 $tableTagArray[]='cellpadding="'.$cellpadding.'"';
03798 if ($align) {$tableTagArray[]='align="'.$align.'"';}
03799 if ($theColor) {$tableTagArray[]='bgcolor="'.$theColor.'"';}
03800
03801 if ($conf['params']) {
03802 $tableTagArray[] = $conf['params'];
03803 }
03804
03805 $tableWrap = implode(' ',$tableTagArray).'> | </table>';
03806 $theValue=$this->wrap($theValue, $tableWrap);
03807
03808 return $theValue;
03809 }
03810
03820 function addParams($content,$conf) {
03821 $lowerCaseAttributes = TRUE;
03822
03823 if (!is_array($conf)) { return $content; }
03824
03825 $key = 1;
03826 $parts = explode('<',$content);
03827 if (intval($conf['_offset'])) $key = intval($conf['_offset'])<0 ? count($parts)+intval($conf['_offset']) : intval($conf['_offset']);
03828 $subparts=explode('>',$parts[$key]);
03829 if (trim($subparts[0])) {
03830
03831 $attribs = t3lib_div::get_tag_attributes('<'.$subparts[0].'>');
03832 if (!is_array($attribs)) {$attribs=array();}
03833 list($tagName) = explode(' ',$subparts[0],2);
03834
03835 reset($conf);
03836 while(list($pkey,$val)=each($conf)) {
03837 if (substr($pkey,-1)!='.' && substr($pkey,0,1)!='_') {
03838 $tmpVal=$this->stdWrap($conf[$pkey],$conf[$pkey.'.']);
03839 if ($lowerCaseAttributes) { $pkey = strtolower($pkey); }
03840 if (strcmp($tmpVal,'')) {$attribs[$pkey]=$tmpVal;}
03841 }
03842 }
03843
03844
03845 $subparts[0]=trim($tagName.' '.t3lib_div::implodeAttributes($attribs));
03846 $parts[$key] = implode('>',$subparts);
03847 $content = implode('<',$parts);
03848 }
03849 return $content;
03850 }
03851
03863 function filelink($theValue, $conf) {
03864 $output = '';
03865 $aTagParams = $this->getATagParams($conf);
03866 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
03867 $conf['path'] = $this->stdWrap($conf['path'],$conf['path.']);
03868 $theFile = trim($conf['path']).$theValue;
03869 if (@is_file($theFile)) {
03870 $theFileEnc = str_replace('%2F', '/', rawurlencode($theFile));
03871 $locDataAdd = $conf['jumpurl.']['secure'] ? $this->locDataJU($theFileEnc,$conf['jumpurl.']['secure.']) : '';
03872 $url = ($conf['jumpurl']) ? $GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($theFileEnc).$locDataAdd.$GLOBALS['TSFE']->getMethodUrlIdToken : $theFileEnc;
03873 $theLinkWrap = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$url).'"'.($conf['target']?' target="'.$conf['target'].'"':'').$aTagParams.'>|</a>';
03874
03875 $theSize = filesize($theFile);
03876 $fI = t3lib_div::split_fileref($theFile);
03877 if ($conf['icon']) {
03878
03879 $iconP = t3lib_extMgm::siteRelPath('cms').'tslib/media/fileicons/';
03880 $icon = @is_file($iconP.$fI['fileext'].'.gif') ? $iconP.$fI['fileext'].'.gif' : $iconP.'default.gif';
03881
03882 $IEList = $this->stdWrap($conf['icon_image_ext_list'],$conf['icon_image_ext_list.']);
03883 $image_ext_list = str_replace(' ','',strtolower($IEList));
03884 if ($fI['fileext'] && t3lib_div::inList($image_ext_list, $fI['fileext'])) {
03885 if ($conf['iconCObject']) {
03886 $icon = $this->cObjGetSingle($conf['iconCObject'],$conf['iconCObject.'],'iconCObject');
03887 } else {
03888 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) {
03889 $thumbSize = '';
03890 if ($conf['icon_thumbSize'] || $conf['icon_thumbSize.']) { $thumbSize = '&size='.$this->stdWrap($conf['icon_thumbSize'], $conf['icon_thumbSize.']); }
03891 $icon = 't3lib/thumbs.php?dummy='.$GLOBALS['EXEC_TIME'].'&file='.rawurlencode('../'.$theFile).$thumbSize;
03892 } else {
03893 $icon = t3lib_extMgm::siteRelPath('cms').'tslib/media/miscicons/notfound_thumb.gif';
03894 }
03895 $icon = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$icon).'"'.$this->getBorderAttr(' border="0"').''.$this->getAltParam($conf).' />';
03896 }
03897 } else {
03898 $icon = '<img src="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$icon).'" width="18" height="16"'.$this->getBorderAttr(' border="0"').''.$this->getAltParam($conf).' />';
03899 }
03900 if ($conf['icon_link']) {$icon = $this->wrap($icon, $theLinkWrap);}
03901 $icon = $this->stdWrap($icon,$conf['icon.']);
03902 }
03903 if ($conf['size']) {
03904 $size = $this->stdWrap($theSize,$conf['size.']);
03905 }
03906
03907
03908 if ($conf['removePrependedNumbers']) $theValue=ereg_replace('_[0-9][0-9](\.[[:alnum:]]*)$','\1',$theValue);
03909 $theValue = $this->stdWrap($theValue,$conf['labelStdWrap.']);
03910
03911
03912 if ($conf['ATagBeforeWrap']) {
03913 $theValue = $this->wrap($this->wrap($theValue, $conf['wrap']), $theLinkWrap);
03914 } else {
03915 $theValue = $this->wrap($this->wrap($theValue, $theLinkWrap), $conf['wrap']);
03916 }
03917 $file = $this->stdWrap($theValue,$conf['file.']);
03918
03919 return $this->stdWrap($icon.$file.$size, $conf['stdWrap.']);
03920 }
03921 }
03922
03933 function locDataJU($jumpUrl,$conf) {
03934 $fI = pathinfo($jumpUrl);
03935 $mimetype='';
03936 if ($fI['extension']) {
03937 $mimeTypes = t3lib_div::trimExplode(',',$conf['mimeTypes'],1);
03938 reset($mimeTypes);
03939 while(list(,$v)=each($mimeTypes)) {
03940 $parts = explode('=',$v,2);
03941 if (strtolower($fI['extension']) == strtolower(trim($parts[0]))) {
03942 $mimetype = '&mimeType='.rawurlencode(trim($parts[1]));
03943 }
03944 }
03945 }
03946 $locationData = $GLOBALS['TSFE']->id.':'.$this->currentRecord;
03947 $rec='&locationData='.rawurlencode($locationData);
03948 $hArr = array(
03949 $jumpUrl,
03950 $locationData,
03951 $GLOBALS['TSFE']->TYPO3_CONF_VARS['SYS']['encryptionKey']
03952 );
03953 $juHash='&juHash='.t3lib_div::shortMD5(serialize($hArr));
03954 return '&juSecure=1'.$mimetype.$rec.$juHash;
03955 }
03956
03964 function calc($val) {
03965 $parts= t3lib_div::splitCalc($val,'+-*/');
03966 $value=0;
03967 reset($parts);
03968 while(list(,$part)=each($parts)) {
03969 $theVal = $part[1];
03970 $sign = $part[0];
03971 if ((string)intval($theVal)==(string)$theVal) {
03972 $theVal = intval($theVal);
03973 } else {
03974 $theVal =0;
03975 }
03976 if ($sign=='-') {$value-=$theVal;}
03977 if ($sign=='+') {$value+=$theVal;}
03978 if ($sign=='/') {if (intval($theVal)) $value/=intval($theVal);}
03979 if ($sign=='*') {$value*=$theVal;}
03980 }
03981 return $value;
03982 }
03983
03993 function calcIntExplode($delim, $string) {
03994 $temp = explode($delim,$string);
03995 while(list($key,$val)=each($temp)) {
03996 $temp[$key]=intval(tslib_cObj::calc($val));
03997 }
03998 return $temp;
03999 }
04000
04013 function splitObj($value, $conf) {
04014 $conf['token']=$this->stdWrap($conf['token'],$conf['token.']);
04015 if (!$conf['token']) {
04016 return $value;
04017 }
04018 $conf['max']=intval($this->stdWrap($conf['max'],$conf['max.']));
04019 $conf['min']=intval($this->stdWrap($conf['min'],$conf['min.']));
04020
04021 $valArr=explode($conf['token'],$value);
04022
04023 if (count($valArr) && ($conf['returnKey'] || $conf['returnKey.'])) {
04024 $key = intval($this->stdWrap($conf['returnKey'],$conf['returnKey.']));
04025 $content = isset($valArr[$key]) ? $valArr[$key] : '';
04026 } else {
04027
04028 $splitCount = count($valArr);
04029 if ($conf['max'] && $splitCount>$conf['max']) {
04030 $splitCount=$conf['max'];
04031 }
04032 if ($conf['min'] && $splitCount<$conf['min']) {
04033 $splitCount=$conf['min'];
04034 }
04035
04036 if ($conf['wrap'] || $conf['cObjNum']) {
04037 $splitArr=array();
04038 $splitArr['wrap']=$conf['wrap'];
04039 $splitArr['cObjNum']=$conf['cObjNum'];
04040 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$splitCount);
04041 }
04042
04043 $content='';
04044 for($a=0;$a<$splitCount;$a++) {
04045 $GLOBALS['TSFE']->register['SPLIT_COUNT']=$a;
04046 $value = ''.$valArr[$a];
04047 $this->data[$this->currentValKey] = $value;
04048 if ($splitArr[$a]['cObjNum']) {
04049 $objName=intval($splitArr[$a]['cObjNum']);
04050 $value = $this->stdWrap($this->cObjGet($conf[$objName.'.'],$objName.'.'),$conf[$objName.'.']);
04051 }
04052 if ($splitArr[$a]['wrap']) {
04053 $value=$this->wrap($value,$splitArr[$a]['wrap']);
04054 }
04055 $content.=$value;
04056 }
04057 }
04058 return $content;
04059 }
04060
04075 function parseFunc($theValue, $conf, $ref='') {
04076
04077
04078 if ($ref) {
04079 $temp_conf = array(
04080 'parseFunc' => $ref,
04081 'parseFunc.' => $conf
04082 );
04083 $temp_conf = $this->mergeTSRef($temp_conf, 'parseFunc');
04084 $conf = $temp_conf['parseFunc.'];
04085 }
04086
04087
04088 if (strcmp($conf['externalBlocks'],'')) {
04089 $tags = strtolower(implode(',',t3lib_div::trimExplode(',',$conf['externalBlocks'])));
04090 $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
04091 $parts = $htmlParser->splitIntoBlock($tags,$theValue);
04092
04093 reset($parts);
04094 while(list($k,$v)=each($parts)) {
04095 if ($k%2) {
04096 $tagName=strtolower($htmlParser->getFirstTagName($v));
04097 $cfg=$conf['externalBlocks.'][$tagName.'.'];
04098 if ($cfg['stripNLprev'] || $cfg['stripNL']) {
04099 $parts[$k-1]=ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $parts[$k-1]);
04100 }
04101 if ($cfg['stripNLnext'] || $cfg['stripNL']) {
04102 $parts[$k+1]=ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $parts[$k+1]);
04103 }
04104 }
04105 }
04106
04107 reset($parts);
04108 while(list($k,$v)=each($parts)) {
04109 if ($k%2) {
04110 $tag=$htmlParser->getFirstTag($v);
04111 $tagName=strtolower($htmlParser->getFirstTagName($v));
04112 $cfg=$conf['externalBlocks.'][$tagName.'.'];
04113 if ($cfg['callRecursive']) {
04114 $parts[$k]=$this->parseFunc($htmlParser->removeFirstAndLastTag($v), $conf);
04115 if (!$cfg['callRecursive.']['dontWrapSelf']) {
04116 if ($cfg['callRecursive.']['alternativeWrap']) {
04117 $parts[$k] = $this->wrap($parts[$k], $cfg['callRecursive.']['alternativeWrap']);
04118 } else {
04119 if (is_array($cfg['callRecursive.']['tagStdWrap.'])) {
04120 $tag = $this->stdWrap($tag,$cfg['callRecursive.']['tagStdWrap.']);
04121 }
04122 $parts[$k]=$tag.$parts[$k].'</'.$tagName.'>';
04123 }
04124 }
04125 } elseif($cfg['HTMLtableCells']) {
04126 $rowParts = $htmlParser->splitIntoBlock('tr',$parts[$k]);
04127 reset($rowParts);
04128 while(list($kk,$vv)=each($rowParts)) {
04129 if ($kk%2) {
04130 $colParts = $htmlParser->splitIntoBlock('td',$vv);
04131 reset($colParts);
04132 $cc=0;
04133 while(list($kkk,$vvv)=each($colParts)) {
04134 if ($kkk%2) {
04135 $cc++;
04136 $tag=$htmlParser->getFirstTag($vvv);
04137 $tagName=strtolower($htmlParser->getFirstTagName($vvv));
04138 $colParts[$kkk] = $htmlParser->removeFirstAndLastTag($vvv);
04139
04140 if ($cfg['HTMLtableCells.'][$cc.'.']['callRecursive'] || (!isset($cfg['HTMLtableCells.'][$cc.'.']['callRecursive']) && $cfg['HTMLtableCells.']['default.']['callRecursive'])) {
04141 if ($cfg['HTMLtableCells.']['addChr10BetweenParagraphs']) $colParts[$kkk]=str_replace('</p><p>','</p>'.chr(10).'<p>',$colParts[$kkk]);
04142 $colParts[$kkk] = $this->parseFunc($colParts[$kkk], $conf);
04143 }
04144
04145 $tagStdWrap = is_array($cfg['HTMLtableCells.'][$cc.'.']['tagStdWrap.'])?$cfg['HTMLtableCells.'][$cc.'.']['tagStdWrap.']:$cfg['HTMLtableCells.']['default.']['tagStdWrap.'];
04146 if (is_array($tagStdWrap)) {
04147 $tag = $this->stdWrap($tag,$tagStdWrap);
04148 }
04149
04150 $stdWrap = is_array($cfg['HTMLtableCells.'][$cc.'.']['stdWrap.'])?$cfg['HTMLtableCells.'][$cc.'.']['stdWrap.']:$cfg['HTMLtableCells.']['default.']['stdWrap.'];
04151 if (is_array($stdWrap)) {
04152 $colParts[$kkk] = $this->stdWrap($colParts[$kkk],$stdWrap);
04153 }
04154
04155 $colParts[$kkk]=$tag.$colParts[$kkk].'</'.$tagName.'>';
04156 }
04157 }
04158 $rowParts[$kk] = implode('',$colParts);
04159 }
04160 }
04161 $parts[$k] = implode('',$rowParts);
04162 }
04163
04164 if (is_array($cfg['stdWrap.'])) {
04165 $parts[$k] = $this->stdWrap($parts[$k],$cfg['stdWrap.']);
04166 }
04167 } else {
04168 $parts[$k]=$this->_parseFunc($parts[$k], $conf);
04169 }
04170 }
04171
04172 return implode('',$parts);
04173 } else return $this->_parseFunc($theValue, $conf);
04174 }
04175
04185 function _parseFunc ($theValue, $conf) {
04186 if (!$this->checkIf($conf['if.'])) {
04187 return $theValue;
04188 }
04189 $inside=0;
04190 $pointer=0;
04191 $currentTag='';
04192 $stripNL=0;
04193 $contentAccum=array();
04194 $contentAccumP=0;
04195
04196 $allowTags=strtolower(str_replace(' ','',$conf['allowTags']));
04197 $denyTags=strtolower(str_replace(' ','',$conf['denyTags']));
04198
04199 $totalLen = strlen($theValue);
04200 do {
04201 if (!$inside) {
04202 if (!is_array($currentTag)) {
04203
04204 $len_p=0;
04205 $c=100;
04206 do {
04207 $len = strcspn(substr($theValue,$pointer+$len_p),'<');
04208 $len_p+=$len+1;
04209 $endChar = ord(strtolower(substr($theValue,$pointer+$len_p,1)));
04210 $c--;
04211 } while ($c>0 && $endChar && ($endChar<97 || $endChar>122) && $endChar!=47);
04212 $len = $len_p-1;
04213 } else {
04214
04215 $tempContent = strtolower(substr($theValue,$pointer));
04216 $len = strpos ($tempContent, '</'.$currentTag[0]);
04217 if (is_string ($len) && !$len) {
04218 $len = strlen($tempContent);
04219 }
04220 }
04221
04222 $data = substr($theValue,$pointer,$len);
04223 if ($data!='') {
04224 if ($stripNL) {
04225 $data = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $data);
04226 }
04227
04228 if (!is_array($currentTag)) {
04229
04230 if ($conf['constants'] && is_array($GLOBALS['TSFE']->tmpl->setup['constants.'])) {
04231 reset($GLOBALS['TSFE']->tmpl->setup['constants.']);
04232 while(list($key,$val)=each($GLOBALS['TSFE']->tmpl->setup['constants.'])) {
04233 if (is_string($val)) {
04234 $data = str_replace('###'.$key.'###', $val, $data);
04235 }
04236 }
04237 }
04238
04239 if (is_array($conf['short.'])) {
04240 $shortWords = $conf['short.'];
04241 krsort($shortWords);
04242 reset($shortWords);
04243 while(list($key,$val)=each($shortWords)) {
04244 if (is_string($val)) {
04245 $data = str_replace($key, $val, $data);
04246 }
04247 }
04248 }
04249
04250
04251 if (is_array($conf['plainTextStdWrap.'])) {$data = $this->stdWrap($data,$conf['plainTextStdWrap.']);}
04252
04253 if ($conf['userFunc']) {$data = $this->callUserFunction($conf['userFunc'], $conf['userFunc.'], $data);}
04254
04255
04256 if ($conf['makelinks']) {
04257 $data = $this->http_makelinks($data,$conf['makelinks.']['http.']);
04258 $data = $this->mailto_makelinks($data,$conf['makelinks.']['mailto.']);
04259 }
04260
04261
04262 if ($GLOBALS['TSFE']->no_cache && $conf['sword'] && is_array($GLOBALS['TSFE']->sWordList) && $GLOBALS['TSFE']->sWordRegEx) {
04263 $newstring = '';
04264 do {
04265 $pieces = split($GLOBALS['TSFE']->sWordRegEx,$data,2);
04266 $newstring.=$pieces[0];
04267 $match_len = strlen($data)-(strlen($pieces[0])+strlen($pieces[1]));
04268 if (strstr($pieces[0],'<') || strstr($pieces[0],'>')) {
04269 $inTag = strrpos($pieces[0],'<') > strrpos($pieces[0],'>');
04270 }
04271
04272 $match = substr($data,strlen($pieces[0]),$match_len);
04273
04274 if (trim($match) && strlen($match)>1 && !$inTag) {
04275 $match = $this->wrap($match, $conf['sword']);
04276 }
04277
04278 $newstring.= $match;
04279 $data=$pieces[1];
04280 } while ($pieces[1]);
04281 $data = $newstring;
04282 }
04283 }
04284 $contentAccum[$contentAccumP].=$data;
04285 }
04286 $inside = 1;
04287 } else {
04288
04289 $len = strcspn(substr($theValue,$pointer),'>')+1;
04290 $data = substr($theValue,$pointer,$len);
04291
04292 $tag = explode(' ',trim(substr($data,1,-1)),2);
04293 $tag[0]=strtolower($tag[0]);
04294 if (substr($tag[0],0,1)=='/') {
04295 $tag[0]=substr($tag[0],1);
04296 $tag['out']=1;
04297 }
04298 if($conf['tags.'][$tag[0]]) {
04299 $treated=0;
04300 $stripNL = 0;
04301
04302 if (!$currentTag && !$tag['out']) {
04303 $currentTag = $tag;
04304 $contentAccumP++;
04305 $treated=1;
04306 }
04307
04308 if ($currentTag[0]==$tag[0] && $tag['out']) {
04309 $theName = $conf['tags.'][$tag[0]];
04310 $theConf = $conf['tags.'][$tag[0].'.'];
04311 $stripNL = ($theConf['stripNL'] ? 1 : 0);
04312 $breakOut = ($theConf['breakoutTypoTagContent'] ? 1 : 0);
04313
04314 $this->parameters=Array();
04315 if ($currentTag[1]) {
04316 $params=t3lib_div::get_tag_attributes($currentTag[1]);
04317 if (is_array($params)) {
04318 reset($params);
04319 while(list($option,$val)=each($params)) {
04320 $this->parameters[strtolower($option)]=$val;
04321 }
04322 }
04323 }
04324 $this->parameters['allParams']=trim($currentTag[1]);
04325 if ($stripNL) {
04326 $contentAccum[$contentAccumP-1] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP-1]);
04327 $contentAccum[$contentAccumP] = ereg_replace('^[ ]*'.chr(13).'?'.chr(10), '', $contentAccum[$contentAccumP]);
04328 $contentAccum[$contentAccumP] = ereg_replace(chr(13).'?'.chr(10).'[ ]*$', '', $contentAccum[$contentAccumP]);
04329 }
04330 $this->data[$this->currentValKey] = $contentAccum[$contentAccumP];
04331 $newInput=$this->cObjGetSingle($theName,$theConf,'/parseFunc/.tags.'.$tag[0]);
04332
04333 $contentAccum[$contentAccumP]=$newInput;
04334 $contentAccumP++;
04335
04336
04337 if (!$breakOut) {
04338 $contentAccum[$contentAccumP-2].=$contentAccum[$contentAccumP-1].$contentAccum[$contentAccumP];
04339 unset($contentAccum[$contentAccumP]);
04340 unset($contentAccum[$contentAccumP-1]);
04341 $contentAccumP-=2;
04342 }
04343
04344 unset($currentTag);
04345 $treated=1;
04346 }
04347
04348 if (!$treated) {
04349 $contentAccum[$contentAccumP].=$data;
04350 }
04351 } else {
04352
04353 $stripNL = 0;
04354 if (t3lib_div::inList($allowTags,$tag[0]) || ($denyTags!='*' && !t3lib_div::inList($denyTags,$tag[0]))) {
04355 $contentAccum[$contentAccumP].=$data;
04356 } else {
04357 $contentAccum[$contentAccumP].=HTMLSpecialChars($data);
04358 }
04359 }
04360 $inside = 0;
04361 }
04362 $pointer+=$len;
04363 } while($pointer<$totalLen);
04364
04365
04366 reset($contentAccum);
04367 for ($a=0;$a<count($contentAccum);$a++) {
04368 if ($a%2 != 1) {
04369
04370 if (is_array($conf['nonTypoTagStdWrap.'])) {$contentAccum[$a] = $this->stdWrap($contentAccum[$a],$conf['nonTypoTagStdWrap.']);}
04371
04372 if ($conf['nonTypoTagUserFunc']) {$contentAccum[$a] = $this->callUserFunction($conf['nonTypoTagUserFunc'], $conf['nonTypoTagUserFunc.'], $contentAccum[$a]);}
04373 }
04374 }
04375 return implode('',$contentAccum);
04376 }
04377
04387 function encaps_lineSplit($theValue, $conf) {
04388 $lParts = explode(chr(10),$theValue);
04389
04390 $encapTags = t3lib_div::trimExplode(',',strtolower($conf['encapsTagList']),1);
04391 $nonWrappedTag = $conf['nonWrappedTag'];
04392 $defaultAlign=trim($this->stdWrap($conf['defaultAlign'],$conf['defaultAlign.']));
04393
04394 if (!strcmp('',$theValue)) return '';
04395
04396 while(list($k,$l)=each($lParts)) {
04397 $sameBeginEnd=0;
04398 $l=trim($l);
04399 $attrib=array();
04400 $nWrapped=0;
04401 $byPass=0;
04402 if (substr($l,0,1)=='<' && substr($l,-1)=='>') {
04403 $fwParts = explode('>',substr($l,1),2);
04404 $backParts = t3lib_div::revExplode('<', substr($fwParts[1],0,-1), 2);
04405 $attrib = t3lib_div::get_tag_attributes('<'.$fwParts[0].'>');
04406 list($tagName) = explode(' ',$fwParts[0]);
04407 $str_content = $backParts[0];
04408 $sameBeginEnd = (substr(strtolower($backParts[1]),1,strlen($tagName))==strtolower($tagName));
04409 }
04410
04411 if ($sameBeginEnd && in_array(strtolower($tagName),$encapTags)) {
04412 $uTagName = strtoupper($tagName);
04413 $uTagName = strtoupper($conf['remapTag.'][$uTagName]?$conf['remapTag.'][$uTagName]:$uTagName);
04414 } else {
04415 $uTagName = strtoupper($nonWrappedTag);
04416 $str_content = $lParts[$k];
04417 $nWrapped=1;
04418 $attrib=array();
04419 }
04420
04421
04422 if (is_array($conf['innerStdWrap_all.'])) {$str_content = $this->stdWrap($str_content,$conf['innerStdWrap_all.']);}
04423
04424 if ($uTagName) {
04425
04426 if (is_array($conf['addAttributes.'][$uTagName.'.'])) {
04427 reset($conf['addAttributes.'][$uTagName.'.']);
04428 while(list($kk,$vv)=each($conf['addAttributes.'][$uTagName.'.'])) {
04429 if (!is_array($vv)) {
04430 if ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='blank') {
04431 if (!strcmp($attrib[$kk],'')) $attrib[$kk]=$vv;
04432 } elseif ((string)$conf['addAttributes.'][$uTagName.'.'][$kk.'.']['setOnly']=='exists') {
04433 if (!isset($attrib[$kk])) $attrib[$kk]=$vv;
04434 } else {
04435 $attrib[$kk]=$vv;
04436 }
04437 }
04438 }
04439 }
04440
04441 if (is_array($conf['encapsLinesStdWrap.'][$uTagName.'.'])) {$str_content = $this->stdWrap($str_content,$conf['encapsLinesStdWrap.'][$uTagName.'.']);}
04442
04443 if (!$attrib['align'] && $defaultAlign) $attrib['align']=$defaultAlign;
04444
04445 $params = t3lib_div::implodeAttributes($attrib,1);
04446 if ($conf['removeWrapping']) {
04447 $str_content=$str_content;
04448 } else {
04449 $str_content='<'.strtolower($uTagName).(trim($params)?' '.trim($params):'').'>'.$str_content.'</'.strtolower($uTagName).'>';
04450 }
04451 }
04452
04453 if ($nWrapped && $conf['wrapNonWrappedLines']) {$str_content = $this->wrap($str_content,$conf['wrapNonWrappedLines']);}
04454 $lParts[$k] = $str_content;
04455 }
04456
04457 return implode(chr(10),$lParts);
04458 }
04459
04470 function http_makelinks($data,$conf) {
04471 $aTagParams = $this->getATagParams($conf);
04472 $textpieces = explode('http:
04473 $pieces = count($textpieces);
04474 $textstr = $textpieces[0];
04475 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
04476 for($i=1; $i<$pieces; $i++) {
04477 $len=strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
04478 if (trim(substr($textstr,-1))=='' && $len) {
04479
04480 $lastChar=substr($textpieces[$i],$len-1,1);
04481 if (!ereg('[A-Za-z0-9\/#_-]',$lastChar)) {$len--;}
04482
04483 $parts[0]=substr($textpieces[$i],0,$len);
04484 $parts[1]=substr($textpieces[$i],$len);
04485
04486 $keep=$conf['keep'];
04487 $linkParts=parse_url('http:
04488 $linktxt='';
04489 if (strstr($keep,'scheme')) {
04490 $linktxt='http:
04491 }
04492 $linktxt.= $linkParts['host'];
04493 if (strstr($keep,'path')) {
04494 $linktxt.= $linkParts['path'];
04495 if (strstr($keep,'query') && $linkParts['query']) {
04496 $linktxt.= '?'.$linkParts['query'];
04497 } elseif ($linkParts['path']=='/') {
04498 $linktxt=substr($linktxt,0,-1);
04499 }
04500 }
04501 $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
04502 if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
04503 $res = '<a'.
04504 ' href="'.htmlspecialchars($GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode('http://'.$parts[0]).$GLOBALS['TSFE']->getMethodUrlIdToken).'"'.
04505 ($target ? ' target="'.$target.'"' : '').
04506 $aTagParams.
04507 '>';
04508 } else {
04509 $res = '<a'.
04510 ' href="http://'.htmlspecialchars($parts[0]).'"'.
04511 ($target ? ' target="'.$target.'"' : '').
04512 $aTagParams.
04513 '>';
04514 }
04515 if ($conf['ATagBeforeWrap']) {
04516 $res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
04517 } else {
04518 $res= $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
04519 }
04520 $textstr.=$res.$parts[1];
04521 } else {
04522 $textstr.='http:
04523 }
04524 }
04525 return $textstr;
04526 }
04527
04537 function mailto_makelinks($data,$conf) {
04538
04539 $aTagParams = $this->getATagParams($conf);
04540 $textpieces = explode('mailto:', $data);
04541 $pieces = count($textpieces);
04542 $textstr = $textpieces[0];
04543 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
04544 for($i=1; $i<$pieces; $i++) {
04545 $len = strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
04546 if (trim(substr($textstr,-1))=='' && $len) {
04547 $lastChar = substr($textpieces[$i],$len-1,1);
04548 if (!ereg('[A-Za-z0-9]',$lastChar)) {$len--;}
04549
04550 $parts[0] = substr($textpieces[$i],0,$len);
04551 $parts[1] = substr($textpieces[$i],$len);
04552 $linktxt = ereg_replace('\?.*','',$parts[0]);
04553 list($mailToUrl,$linktxt) = $this->getMailTo($parts[0],$linktxt,$initP);
04554 $mailToUrl = $GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii'?$mailToUrl:htmlspecialchars($mailToUrl);
04555 $res = '<a href="'.$mailToUrl.'"'.$aTagParams.'>';
04556 if ($conf['ATagBeforeWrap']) {
04557 $res= $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
04558 } else {
04559 $res= $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
04560 }
04561 $textstr.=$res.$parts[1];
04562 } else {
04563 $textstr.='mailto:'.$textpieces[$i];
04564 }
04565 }
04566 return $textstr;
04567 }
04568
04580 function getImgResource($file,$fileArray) {
04581 if (is_array($fileArray)) {
04582 switch($file) {
04583 case 'GIFBUILDER':
04584 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04585 $gifCreator->init();
04586 $theImage='';
04587 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
04588 $gifCreator->start($fileArray,$this->data);
04589 $theImage = $gifCreator->gifBuild();
04590 }
04591 return $gifCreator->getImageDimensions($theImage);
04592 break;
04593 default:
04594 if ($fileArray['import.']) {
04595 $ifile = $this->stdWrap('',$fileArray['import.']);
04596 if ($ifile) {$file = $fileArray['import'].$ifile;}
04597 }
04598 $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
04599 if ($theImage) {
04600 $fileArray['width']= $this->stdWrap($fileArray['width'],$fileArray['width.']);
04601 $fileArray['height']= $this->stdWrap($fileArray['height'],$fileArray['height.']);
04602 $fileArray['ext']= $this->stdWrap($fileArray['ext'],$fileArray['ext.']);
04603 $fileArray['maxW']= intval($this->stdWrap($fileArray['maxW'],$fileArray['maxW.']));
04604 $fileArray['maxH']= intval($this->stdWrap($fileArray['maxH'],$fileArray['maxH.']));
04605 $fileArray['minW']= intval($fileArray['minW']);
04606 $fileArray['minH']= intval($fileArray['minH']);
04607 $maskArray= $fileArray['m.'];
04608 $maskImages=array();
04609 if (is_array($fileArray['m.'])) {
04610 $maskImages['m_mask'] = $this->getImgResource($maskArray['mask'],$maskArray['mask.']);
04611 $maskImages['m_bgImg'] = $this->getImgResource($maskArray['bgImg'],$maskArray['bgImg.']);
04612 $maskImages['m_bottomImg'] = $this->getImgResource($maskArray['bottomImg'],$maskArray['bottomImg.']);
04613 $maskImages['m_bottomImg_mask'] = $this->getImgResource($maskArray['bottomImg_mask'],$maskArray['bottomImg_mask.']);
04614 }
04615 $hash = t3lib_div::shortMD5($theImage.serialize($fileArray).serialize($maskImages));
04616 if (!isset($GLOBALS['TSFE']->tmpl->fileCache[$hash])) {
04617 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04618 $gifCreator->init();
04619
04620 if ($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']) {
04621 $gifCreator->filenamePrefix = $GLOBALS['TSFE']->fileNameASCIIPrefix(ereg_replace('\.[[:alnum:]]+$','',basename($theImage)),intval($GLOBALS['TSFE']->config['config']['meaningfulTempFilePrefix']),'_');
04622 }
04623
04624 if ($fileArray['sample']) {
04625 $gifCreator->scalecmd = '-sample';
04626 $GLOBALS['TT']->setTSlogMessage('Sample option: Images are scaled with -sample.');
04627 }
04628 if ($fileArray['alternativeTempPath'] && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['allowedTempPaths'],$fileArray['alternativeTempPath'])) {
04629 $gifCreator->tempPath = $fileArray['alternativeTempPath'];
04630 $GLOBALS['TT']->setTSlogMessage('Set alternativeTempPath: '.$fileArray['alternativeTempPath']);
04631 }
04632
04633 if (!trim($fileArray['ext'])){$fileArray['ext']='web';}
04634 $options = Array();
04635 if ($fileArray['maxW']) {$options['maxW']=$fileArray['maxW'];}
04636 if ($fileArray['maxH']) {$options['maxH']=$fileArray['maxH'];}
04637 if ($fileArray['minW']) {$options['minW']=$fileArray['minW'];}
04638 if ($fileArray['minH']) {$options['minH']=$fileArray['minH'];}
04639
04640
04641 if (is_array($maskArray) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im']) {
04642
04643 $fI = t3lib_div::split_fileref($theImage);
04644 $imgExt = (strtolower($fI['fileext'])==$gifCreator->gifExtension ? $gifCreator->gifExtension : 'jpg');
04645 $dest = $gifCreator->tempPath.$hash.'.'.$imgExt;
04646 if (!@file_exists($dest)) {
04647 $m_mask= $maskImages['m_mask'];
04648 $m_bgImg = $maskImages['m_bgImg'];
04649 if ($m_mask && $m_bgImg) {
04650 $negate = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] ? ' -negate' : '';
04651
04652 $temp_ext='png';
04653 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_gif']) {
04654 $temp_ext=$gifCreator->gifExtension;
04655 }
04656
04657 $tempFileInfo = $gifCreator->imageMagickConvert($theImage,$temp_ext,$fileArray['width'],$fileArray['height'],$fileArray['params'],$fileArray['frame'],$options);
04658 if (is_array($tempFileInfo)) {
04659 $m_bottomImg = $maskImages['m_bottomImg'];
04660 if ($m_bottomImg) {
04661 $m_bottomImg_mask = $maskImages['m_bottomImg_mask'];
04662 }
04663
04664 $tempScale=array();
04665 $command = '-geometry '.$tempFileInfo[0].'x'.$tempFileInfo[1].'!';
04666 $tmpStr = $gifCreator->randomName();
04667
04668
04669 $tempScale['m_mask']=$tmpStr.'_mask.'.$temp_ext;
04670 $gifCreator->imageMagickExec($m_mask[3],$tempScale['m_mask'],$command.$negate);
04671
04672 $tempScale['m_bgImg']=$tmpStr.'_bgImg.'.trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
04673 $gifCreator->imageMagickExec($m_bgImg[3],$tempScale['m_bgImg'],$command);
04674
04675
04676 if ($m_bottomImg && $m_bottomImg_mask) {
04677 $tempScale['m_bottomImg']=$tmpStr.'_bottomImg.'.$temp_ext;
04678 $gifCreator->imageMagickExec($m_bottomImg[3],$tempScale['m_bottomImg'],$command);
04679 $tempScale['m_bottomImg_mask']=$tmpStr.'_bottomImg_mask.'.$temp_ext;
04680 $gifCreator->imageMagickExec($m_bottomImg_mask[3],$tempScale['m_bottomImg_mask'],$command.$negate);
04681
04682
04683
04684 $gifCreator->combineExec($tempScale['m_bgImg'],$tempScale['m_bottomImg'],$tempScale['m_bottomImg_mask'],$tempScale['m_bgImg']);
04685 }
04686
04687 $gifCreator->combineExec($tempScale['m_bgImg'],$tempFileInfo[3],$tempScale['m_mask'],$dest);
04688
04689 reset($tempScale);
04690 while(list(,$file)=each($tempScale)) {
04691 if (@is_file($file)) {
04692 unlink($file);
04693 }
04694 }
04695
04696 }
04697 }
04698 }
04699
04700 if (($fileArray['reduceColors'] || ($imgExt=='png' && !$gifCreateor->png_truecolor)) && is_file($dest)) {
04701 $reduced = $gifCreator->IMreduceColors($dest, t3lib_div::intInRange($fileArray['reduceColors'], 256, $gifCreator->truecolorColors, 256));
04702 if (is_file($reduced)) {
04703 unlink($dest);
04704 rename($reduced, $dest);
04705 }
04706 }
04707 $GLOBALS['TSFE']->tmpl->fileCache[$hash]= $gifCreator->getImageDimensions($dest);
04708 } else {
04709 $GLOBALS['TSFE']->tmpl->fileCache[$hash]= $gifCreator->imageMagickConvert($theImage,$fileArray['ext'],$fileArray['width'],$fileArray['height'],$fileArray['params'],$fileArray['frame'],$options);
04710 if (($fileArray['reduceColors'] || ($imgExt=='png' && !$gifCreateor->png_truecolor)) && is_file($GLOBALS['TSFE']->tmpl->fileCache[$hash][3])) {
04711 $reduced = $gifCreator->IMreduceColors($GLOBALS['TSFE']->tmpl->fileCache[$hash][3], t3lib_div::intInRange($fileArray['reduceColors'], 256, $gifCreator->truecolorColors, 256));
04712 if (is_file($reduced)) {
04713 unlink($GLOBALS['TSFE']->tmpl->fileCache[$hash][3]);
04714 rename($reduced, $GLOBALS['TSFE']->tmpl->fileCache[$hash][3]);
04715 }
04716 }
04717 }
04718 $GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile'] = $theImage;
04719 $GLOBALS['TSFE']->tmpl->fileCache[$hash]['origFile_mtime'] = @filemtime($theImage);
04720 }
04721 return $GLOBALS['TSFE']->tmpl->fileCache[$hash];
04722 }
04723
04724 break;
04725 }
04726 }
04727 $theImage = $GLOBALS['TSFE']->tmpl->getFileName($file);
04728 if ($theImage) {
04729 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
04730 $gifCreator->init();
04731 $info= $gifCreator->imageMagickConvert($theImage,'WEB','','','','','');
04732 $info['origFile'] = $theImage;
04733 $info['origFile_mtime'] = @filemtime($theImage);
04734 return $info;
04735 }
04736 }
04737
04738
04739
04740
04741
04742
04743
04744
04745
04746
04747
04748
04749
04750
04751
04752
04753
04754
04755
04756
04757
04758
04759
04760
04761
04762
04763
04764
04765
04772 function getFieldVal($field) {
04773 if (!strstr($field,'
04774 return $this->data[trim($field)];
04775 } else {
04776 $sections = t3lib_div::trimExplode('
04777 while (list(,$k)=each($sections)) {
04778 if (strcmp($this->data[$k],'')) return $this->data[$k];
04779 }
04780 }
04781 }
04782
04792 function getData($string,$fieldArray) {
04793 if (!is_array($fieldArray)) {
04794 $fieldArray=$GLOBALS['TSFE']->page;
04795 }
04796 $retVal = '';
04797 $sections = explode('
04798
04799 while (!$retVal AND list($secKey, $secVal)=each($sections)) {
04800 $parts = explode(':',$secVal,2);
04801 $key = trim($parts[1]);
04802 if ((string)$key!='') {
04803 switch(strtolower(trim($parts[0]))) {
04804 case 'gpvar':
04805 list($firstKey, $rest) = explode('|', $key, 2);
04806 if (strlen(trim($firstKey))) {
04807 $retVal = t3lib_div::_GP(trim($firstKey));
04808
04809 if (strlen(trim($rest))) {
04810 $retVal = is_array($retVal) ? $this->getGlobal($rest, $retVal) : '';
04811 }
04812
04813 if (is_array($retVal)) $retVal = '';
04814 }
04815 break;
04816 case 'tsfe':
04817 $retVal = $this->getGlobal ('TSFE|'.$key);
04818 break;
04819 case 'getenv':
04820 $retVal = getenv($key);
04821 break;
04822 case 'getindpenv':
04823 $retVal = t3lib_div::getIndpEnv($key);
04824 break;
04825 case 'field':
04826 $retVal = $fieldArray[$key];
04827 break;
04828 case 'parameters':
04829 $retVal = $this->parameters[$key];
04830 break;
04831 case 'register':
04832 $retVal = $GLOBALS['TSFE']->register[$key];
04833 break;
04834 case 'global':
04835 $retVal = $this->getGlobal($key);
04836 break;
04837 case 'leveltitle':
04838 $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04839 $retVal = $this->rootLineValue($nkey,'title',stristr($key,'slide'));
04840 break;
04841 case 'levelmedia':
04842 $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04843 $retVal = $this->rootLineValue($nkey,'media',stristr($key,'slide'));
04844 break;
04845 case 'leveluid':
04846 $nkey = $this->getKey($key,$GLOBALS['TSFE']->tmpl->rootLine);
04847 $retVal = $this->rootLineValue($nkey,'uid',stristr($key,'slide'));
04848 break;
04849 case 'levelfield':
04850 $keyP = t3lib_div::trimExplode(',',$key);
04851 $nkey = $this->getKey($keyP[0],$GLOBALS['TSFE']->tmpl->rootLine);
04852 $retVal = $this->rootLineValue($nkey,$keyP[1],strtolower($keyP[2])=='slide');
04853 break;
04854 case 'fullrootline':
04855 $keyP = t3lib_div::trimExplode(',',$key);
04856 $fullKey = intval($keyP[0])-count($GLOBALS['TSFE']->tmpl->rootLine)+count($GLOBALS['TSFE']->rootLine);
04857 if ($fullKey>=0) {
04858 $retVal = $this->rootLineValue($fullKey,$keyP[1],stristr($keyP[2],'slide'),$GLOBALS['TSFE']->rootLine);
04859 }
04860 break;
04861 case 'date':
04862 if (!$key) {$key = 'd/m Y';}
04863 $retVal = date($key, time());
04864 break;
04865 case 'page':
04866 $retVal = $GLOBALS['TSFE']->page[$key];
04867 break;
04868 case 'current':
04869 $retVal = $this->data[$this->currentValKey];
04870 break;
04871 case 'level':
04872 $retVal = count($GLOBALS['TSFE']->tmpl->rootLine)-1;
04873 break;
04874 case 'db':
04875 $selectParts = t3lib_div::trimExplode(':',$key);
04876 $db_rec = $GLOBALS['TSFE']->sys_page->getRawRecord($selectParts[0],$selectParts[1]);
04877 if (is_array($db_rec) && $selectParts[2]) {$retVal = $db_rec[$selectParts[2]];}
04878 break;
04879 case 'lll':
04880 $retVal = $GLOBALS['TSFE']->sL('LLL:'.$key);
04881 break;
04882 case 'path':
04883 $retVal = $GLOBALS['TSFE']->tmpl->getFileName($key);
04884 break;
04885 case 'cobj':
04886 switch((string)$key) {
04887 case 'parentRecordNumber':
04888 $retVal = $this->parentRecordNumber;
04889 break;
04890 }
04891 break;
04892 case 'debug':
04893 switch((string)$key) {
04894 case 'rootLine':
04895 $retVal = t3lib_div::view_array($GLOBALS['TSFE']->tmpl->rootLine);
04896 break;
04897 case 'fullRootLine':
04898 $retVal = t3lib_div::view_array($GLOBALS['TSFE']->rootLine);
04899 break;
04900 case 'data':
04901 $retVal = t3lib_div::view_array($this->data);
04902 break;
04903 }
04904 break;
04905 }
04906 }
04907 }
04908 return $retVal;
04909 }
04910
04922 function rootLineValue($key,$field,$slideBack=0,$altRootLine='') {
04923 $rootLine = is_array($altRootLine) ? $altRootLine : $GLOBALS['TSFE']->tmpl->rootLine;
04924 if (!$slideBack) {
04925 return $rootLine[$key][$field];
04926 } else {
04927 for ($a=$key;$a>=0;$a--) {
04928 $val = $rootLine[$a][$field];
04929 if ($val) {return $val;}
04930 }
04931 }
04932 }
04933
04944 function getGlobal($var, $source=NULL) {
04945 $vars = explode('|', $var);
04946 $c = count($vars);
04947 $k = trim($vars[0]);
04948 $theVar = isset($source) ? $source[$k] : $GLOBALS[$k];
04949
04950 for ($a=1;$a<$c;$a++) {
04951 if (!isset($theVar)) { break; }
04952
04953 $key = trim($vars[$a]);
04954 if (is_object($theVar)) {
04955 $theVar = $theVar->$key;
04956 } elseif (is_array($theVar)) {
04957 $theVar = $theVar[$key];
04958 } else {
04959 return '';
04960 }
04961 }
04962
04963 if (!is_array($theVar) && !is_object($theVar)) {
04964 return $theVar;
04965 } else {
04966 return '';
04967 }
04968 }
04969
04980 function getKey($key,$arr) {
04981 $key = intval($key);
04982 if (is_array($arr)) {
04983 if ($key < 0) {
04984 $key = count($arr)+$key;
04985 }
04986 if ($key < 0) {
04987 $key=0;
04988 }
04989 }
04990 return $key;
04991 }
04992
04993
05003 function TCAlookup($inputValue,$conf) {
05004 global $TCA;
05005
05006 $table = $conf['table'];
05007 $field = $conf['field'];
05008 $delimiter = $conf['delimiter']?$conf['delimiter']:' ,';
05009
05010 $GLOBALS['TSFE']->includeTCA();
05011
05012 if (is_array($TCA[$table]) && is_array($TCA[$table]['columns'][$field]) && is_array($TCA[$table]['columns'][$field]['config']['items'])) {
05013 $values = t3lib_div::trimExplode(',',$inputValue);
05014 foreach ($values as $value) {
05015
05016 reset($TCA[$table]['columns'][$field]['config']['items']);
05017 while(list($key,$item)=each($TCA[$table]['columns'][$field]['config']['items'])) {
05018
05019 if (!strcmp($item[1],trim($value))) $output[] = $GLOBALS['TSFE']->sL($item[0]);
05020 }
05021 }
05022 $returnValue = implode($delimiter,$output);
05023 } else {
05024 $returnValue = $inputValue;
05025 }
05026 return $returnValue;
05027 }
05028
05029
05030
05031
05032
05033
05034
05035
05036
05037
05038
05039
05040
05041
05042
05043
05044
05045
05046
05047
05048
05049
05063 function typoLink($linktxt, $conf) {
05064 $finalTagParts = array();
05065 $finalTagParts['aTagParams'] = $this->getATagParams($conf);
05066
05067 $link_param = trim($this->stdWrap($conf['parameter'],$conf['parameter.']));
05068
05069 $sectionMark = trim($this->stdWrap($conf['section'],$conf['section.']));
05070 $sectionMark = $sectionMark ? (t3lib_div::testInt($sectionMark)?'#c':'#').$sectionMark : '';
05071 $initP = '?id='.$GLOBALS['TSFE']->id.'&type='.$GLOBALS['TSFE']->type;
05072 $this->lastTypoLinkUrl = '';
05073 $this->lastTypoLinkTarget = '';
05074 if ($link_param) {
05075 $link_paramA = t3lib_div::unQuoteFilenames($link_param,true);
05076 $link_param = trim($link_paramA[0]);
05077 $linkClass = trim($link_paramA[2]);
05078 if ($linkClass=='-') $linkClass = '';
05079 $forceTarget = trim($link_paramA[1]);
05080 $forceTitle = trim($link_paramA[3]);
05081 if ($forceTarget=='-') $forceTarget = '';
05082
05083 $JSwindowParts = array();
05084 $JSwindowParams = '';
05085 $onClick = '';
05086 if ($forceTarget && ereg('^([0-9]+)x([0-9]+)(:(.*)|.*)$',$forceTarget,$JSwindowParts)) {
05087
05088 $JSwindow_tempParamsArr = t3lib_div::trimExplode(',',strtolower($conf['JSwindow_params'].','.$JSwindowParts[4]),1);
05089 $JSwindow_paramsArr=array();
05090 foreach($JSwindow_tempParamsArr as $JSv) {
05091 list($JSp,$JSv) = explode('=',$JSv);
05092 $JSwindow_paramsArr[$JSp]=$JSp.'='.$JSv;
05093 }
05094
05095 $JSwindow_paramsArr['width']='width='.$JSwindowParts[1];
05096 $JSwindow_paramsArr['height']='height='.$JSwindowParts[2];
05097
05098 $JSwindowParams = implode(',',$JSwindow_paramsArr);
05099 $forceTarget = '';
05100 }
05101
05102
05103 $target = isset($conf['target']) ? $conf['target'] : $GLOBALS['TSFE']->intTarget;
05104 if ($conf['target.']) {$target=$this->stdWrap($target, $conf['target.']);}
05105
05106
05107 $title = $conf['title'];
05108 if ($conf['title.']) {$title=$this->stdWrap($title, $conf['title.']);}
05109
05110
05111 $pU = parse_url($link_param);
05112
05113
05114 if(strstr($link_param,'@') && (!$pU['scheme'] || $pU['scheme']=='mailto')) {
05115 $link_param = eregi_replace('^mailto:','',$link_param);
05116 list($this->lastTypoLinkUrl,$linktxt) = $this->getMailTo($link_param,$linktxt,$initP);
05117 $finalTagParts['url']=$this->lastTypoLinkUrl;
05118 $finalTagParts['TYPE']='mailto';
05119 } else {
05120 $isLocalFile=0;
05121 $fileChar=intval(strpos($link_param, '/'));
05122 $urlChar=intval(strpos($link_param, '.'));
05123
05124
05125 list($rootFileDat) = explode('?',rawurldecode($link_param));
05126 $containsSlash = strstr($rootFileDat,'/');
05127 $rFD_fI = pathinfo($rootFileDat);
05128 if (trim($rootFileDat) && !$containsSlash && (@is_file(PATH_site.$rootFileDat) || t3lib_div::inList('php,html,htm',strtolower($rFD_fI['extension'])))) {
05129 $isLocalFile = 1;
05130 } elseif ($containsSlash) {
05131 $isLocalFile = 2;
05132 }
05133
05134 if($pU['scheme'] || ($isLocalFile!=1 && $urlChar && (!$containsSlash || $urlChar<$fileChar))) {
05135 $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
05136 if ($conf['extTarget.']) {$target = $this->stdWrap($target, $conf['extTarget.']);}
05137 if ($forceTarget) {$target=$forceTarget;}
05138 if ($linktxt=='') $linktxt = $link_param;
05139 if (!$pU['scheme']) {$scheme='http:
05140 if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
05141 $this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($scheme.$link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
05142 } else {
05143 $this->lastTypoLinkUrl = $scheme.$link_param;
05144 }
05145 $this->lastTypoLinkTarget = $target;
05146 $finalTagParts['url']=$this->lastTypoLinkUrl;
05147 $finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
05148 $finalTagParts['TYPE']='url';
05149 } elseif ($containsSlash || $isLocalFile) {
05150 $splitLinkParam = explode('?', $link_param);
05151 if (@file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
05152 if ($linktxt=='') $linktxt = rawurldecode($link_param);
05153 if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
05154 $this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
05155 } else {
05156 $this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$link_param;
05157 }
05158 if ($forceTarget) {$target=$forceTarget;}
05159 $this->lastTypoLinkTarget = $target;
05160
05161 $finalTagParts['url'] = $this->lastTypoLinkUrl;
05162 $finalTagParts['targetParams'] = $target ? ' target="'.$target.'"' : '';
05163 $finalTagParts['TYPE'] = 'file';
05164 } else {
05165 $GLOBALS['TT']->setTSlogMessage("typolink(): File '".$splitLinkParam[0]."' did not exist, so '".$linktxt."' was not linked.",1);
05166 return $linktxt;
05167 }
05168 } else {
05169 if ($conf['no_cache.']) $conf['no_cache']=$this->stdWrap($conf['no_cache'], $conf['no_cache.']);
05170 $link_params_parts=explode('#',$link_param);
05171 $link_param = trim($link_params_parts[0]);
05172 if (!strcmp($link_param,'')) {$link_param=$GLOBALS['TSFE']->id;}
05173 if ($link_params_parts[1] && !$sectionMark) {
05174 $sectionMark = trim($link_params_parts[1]);
05175 $sectionMark = (t3lib_div::testInt($sectionMark)?'#c':'#').$sectionMark;
05176 }
05177
05178 unset($theTypeP);
05179 $pairParts = t3lib_div::trimExplode(',',$link_param);
05180 if (count($pairParts)>1) {
05181 $link_param = $pairParts[0];
05182 $theTypeP = $pairParts[1];
05183 }
05184
05185 if (!t3lib_div::testInt($link_param)) {
05186 $link_param = $GLOBALS['TSFE']->sys_page->getPageIdFromAlias($link_param);
05187 }
05188
05189
05190 $disableGroupAccessCheck = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] ? TRUE : FALSE;
05191 $page = $GLOBALS['TSFE']->sys_page->getPage($link_param,$disableGroupAccessCheck);
05192
05193 if (count($page)) {
05194
05195 $MPvarAcc = array();
05196 if (!$GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue']) {
05197 $temp_MP = $this->getClosestMPvalueForPage($page['uid'],TRUE);
05198 if ($temp_MP) $MPvarAcc['closest'] = $temp_MP;
05199 }
05200
05201 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($page['uid'], $page);
05202 if (is_array($mount_info) && $mount_info['overlay']) {
05203 $page = $GLOBALS['TSFE']->sys_page->getPage($mount_info['mount_pid'],$disableGroupAccessCheck);
05204 if (!count($page)) {
05205 $GLOBALS['TT']->setTSlogMessage("typolink(): Mount point '".$mount_info['mount_pid']."' was not available, so '".$linktxt."' was not linked.",1);
05206 return $linktxt;
05207 }
05208 $MPvarAcc['re-map'] = $mount_info['MPvar'];
05209 }
05210
05211
05212 if ($linktxt=='') $linktxt = $page['title'];
05213
05214
05215 $addQueryParams = $conf['addQueryString'] ? $this->getQueryArguments($conf['addQueryString.']) : '';
05216 $addQueryParams .= trim($this->stdWrap($conf['additionalParams'],$conf['additionalParams.']));
05217 if (substr($addQueryParams,0,1)!='&') {
05218 $addQueryParams = '';
05219 } elseif ($conf['useCacheHash']) {
05220 $pA = t3lib_div::cHashParams($addQueryParams.$GLOBALS['TSFE']->linkVars);
05221 $addQueryParams.= '&cHash='.t3lib_div::shortMD5(serialize($pA));
05222 }
05223
05224 $tCR_domain = '';
05225
05226 if (count($MPvarAcc)) {
05227
05228 $addQueryParams.= '&MP='.rawurlencode(implode(',',$MPvarAcc));
05229 }
05230 elseif ($GLOBALS['TSFE']->config['config']['typolinkCheckRootline']) {
05231
05232 $tCR_rootline = $GLOBALS['TSFE']->sys_page->getRootLine($page['uid']);
05233 $tCR_flag = 0;
05234 foreach($tCR_rootline as $tCR_data) {
05235 if ($tCR_data['uid']==$GLOBALS['TSFE']->tmpl->rootLine[0]['uid']) {
05236 $tCR_flag = 1;
05237 break;
05238 }
05239 }
05240 if (!$tCR_flag) {
05241 foreach($tCR_rootline as $tCR_data) {
05242 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_domain', 'pid='.intval($tCR_data['uid']).' AND redirectTo=\'\''.$this->enableFields('sys_domain'), '', 'sorting');
05243 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
05244 $tCR_domain = preg_replace('/\/$/','',$row['domainName']);
05245 break;
05246 }
05247 }
05248 }
05249 }
05250
05251 if (strlen($tCR_domain)) {
05252 $target = isset($conf['extTarget']) ? $conf['extTarget'] : $GLOBALS['TSFE']->extTarget;
05253 if ($conf['extTarget.']) {$target = $this->stdWrap($target, $conf['extTarget.']);}
05254 if ($forceTarget) {$target=$forceTarget;}
05255 $LD['target'] = $target;
05256 $this->lastTypoLinkUrl = $this->URLqMark('http:
05257 } else {
05258 if ($forceTarget) {$target=$forceTarget;}
05259 $LD = $GLOBALS['TSFE']->tmpl->linkData($page,$target,$conf['no_cache'],'','',$addQueryParams,$theTypeP);
05260 $this->lastTypoLinkUrl = $this->URLqMark($LD['totalURL'],'').$sectionMark;
05261 }
05262
05263 $this->lastTypoLinkTarget = $LD['target'];
05264 $targetPart = $LD['target'] ? ' target="'.$LD['target'].'"' : '';
05265
05266
05267 if ($sectionMark && !trim($addQueryParams) && $page['uid']==$GLOBALS['TSFE']->id && !$GLOBALS['TSFE']->config['config']['baseURL']) {
05268 list(,$URLparams) = explode('?',$this->lastTypoLinkUrl);
05269 list($URLparams) = explode('#',$URLparams);
05270 parse_str ($URLparams.$LD['orig_type'], $URLparamsArray);
05271 if (intval($URLparamsArray['type'])==$GLOBALS['TSFE']->type) {
05272 unset($URLparamsArray['id']);
05273 unset($URLparamsArray['type']);
05274 if (!count($URLparamsArray)) {
05275 $this->lastTypoLinkUrl = $sectionMark;
05276 }
05277 }
05278 }
05279
05280
05281 if ($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages'] &&
05282 $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages']!=='NONE' &&
05283 !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
05284 $thePage = $GLOBALS['TSFE']->sys_page->getPage($GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages']);
05285
05286 $addParams = $GLOBALS['TSFE']->config['config']['typolinkLinkAccessRestrictedPages_addParams'];
05287 $addParams = str_replace('###RETURN_URL###',rawurlencode($this->lastTypoLinkUrl),$addParams);
05288 $addParams = str_replace('###PAGE_ID###',$page['uid'],$addParams);
05289 $LD = $GLOBALS['TSFE']->tmpl->linkData($thePage,$target,'','','',$addParams,$theTypeP);
05290 $this->lastTypoLinkUrl = $this->URLqMark($LD['totalURL'],'');
05291 }
05292
05293
05294 $finalTagParts['url']=$this->lastTypoLinkUrl;
05295 $finalTagParts['targetParams']=$targetPart;
05296 $finalTagParts['TYPE']='page';
05297 } else {
05298 $GLOBALS['TT']->setTSlogMessage("typolink(): Page id '".$link_param."' was not found, so '".$linktxt."' was not linked.",1);
05299 return $linktxt;
05300 }
05301 }
05302 }
05303
05304 if ($forceTitle) {$title=$forceTitle;}
05305
05306 if ($JSwindowParams) {
05307
05308
05309 if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
05310 $target = ' target="FEopenLink"';
05311 } else {
05312 $target = '';
05313 }
05314
05315 $onClick="vHWin=window.open('".$GLOBALS['TSFE']->baseUrlWrap($finalTagParts['url'])."','FEopenLink','".$JSwindowParams."');vHWin.focus();return false;";
05316 $res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'. $target .' onclick="'.htmlspecialchars($onClick).'"'.($title?' title="'.$title.'"':'').($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
05317 } else {
05318 if ($GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii' && $finalTagParts['TYPE'] === 'mailto') {
05319 $res = '<a href="'.$finalTagParts['url'].'"'.($title?' title="'.$title.'"':'').$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
05320 } else {
05321 $res = '<a href="'.htmlspecialchars($finalTagParts['url']).'"'.($title?' title="'.$title.'"':'').$finalTagParts['targetParams'].($linkClass?' class="'.$linkClass.'"':'').$finalTagParts['aTagParams'].'>';
05322 }
05323 }
05324
05325
05326 if ($conf['userFunc']) {
05327 $finalTagParts['TAG']=$res;
05328 $res = $this->callUserFunction($conf['userFunc'],$conf['userFunc.'],$finalTagParts);
05329 }
05330
05331
05332 if ($conf['returnLast']) {
05333 switch($conf['returnLast']) {
05334 case 'url':
05335 return $this->lastTypoLinkUrl;
05336 break;
05337 case 'target':
05338 return $this->lastTypoLinkTarget;
05339 break;
05340 }
05341 }
05342
05343 if ($conf['ATagBeforeWrap']) {
05344 return $res.$this->wrap($linktxt, $conf['wrap']).'</a>';
05345 } else {
05346 return $this->wrap($res.$linktxt.'</a>', $conf['wrap']);
05347 }
05348 } else {
05349 return $linktxt;
05350 }
05351 }
05352
05361 function typoLink_URL($conf) {
05362 $this->typolink('|',$conf);
05363 return $this->lastTypoLinkUrl;
05364 }
05365
05379 function getTypoLink($label,$params,$urlParameters=array(),$target='') {
05380 $conf=array();
05381 $conf['parameter'] = $params;
05382 if ($target) {
05383 $conf['target']=$target;
05384 $conf['extTarget']=$target;
05385 }
05386 if (is_array($urlParameters)) {
05387 if (count($urlParameters)) {
05388 $conf['additionalParams'].= t3lib_div::implodeArrayForUrl('',$urlParameters);
05389 }
05390 } else {
05391 $conf['additionalParams'].=$urlParameters;
05392 }
05393 $out = $this->typolink($label,$conf);
05394 return $out;
05395 }
05396
05406 function getTypoLink_URL($params,$urlParameters=array(),$target='') {
05407 $this->getTypoLink('',$params,$urlParameters,$target);
05408 return $this->lastTypoLinkUrl;
05409 }
05410
05418 function typolinkWrap($conf) {
05419 $k=md5(microtime());
05420 return explode($k,$this->typolink($k,$conf));
05421 }
05422
05431 function currentPageUrl($urlParameters=array(),$id=0) {
05432 return $this->getTypoLink_URL($id?$id:$GLOBALS['TSFE']->id,$urlParameters,$GLOBALS['TSFE']->sPre);
05433 }
05434
05444 function getClosestMPvalueForPage($pageId, $raw=FALSE) {
05445
05446 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'] && $GLOBALS['TSFE']->MP) {
05447
05448 if (!strcmp($GLOBALS['TSFE']->id, $pageId)) {
05449 $MP = $GLOBALS['TSFE']->MP;
05450 } else {
05451 $tCR_rootline = $GLOBALS['TSFE']->sys_page->getRootLine($pageId, '', TRUE);
05452 $inverseTmplRootline = array_reverse($GLOBALS['TSFE']->tmpl->rootLine);
05453
05454 $rl_mpArray = array();
05455 $startMPaccu = FALSE;
05456
05457
05458 foreach($tCR_rootline as $tCR_data) {
05459 foreach($inverseTmplRootline as $rlKey => $invTmplRLRec) {
05460
05461
05462 if ($startMPaccu && $invTmplRLRec['_MP_PARAM']) {
05463 $rl_mpArray[] = $invTmplRLRec['_MP_PARAM'];
05464 }
05465
05466
05467
05468 if ($tCR_data['pid']==$invTmplRLRec['pid'] && count($inverseTmplRootline)!=$rlKey+1) {
05469 $startMPaccu = TRUE;
05470 }
05471 }
05472 if ($startMPaccu) break;
05473 }
05474
05475 if (count($rl_mpArray)) {
05476 $MP = implode(',', array_reverse($rl_mpArray));
05477 }
05478 }
05479 }
05480
05481 return !$raw ? ($MP ? '&MP='.rawurlencode($MP) : '') : $MP;
05482 }
05483
05494 function getMailTo($mailAddress,$linktxt,$initP='?') {
05495 if(!strcmp($linktxt,'')) { $linktxt = $mailAddress; }
05496
05497 $mailToUrl = 'mailto:'.$mailAddress;
05498
05499 if (!$GLOBALS['TSFE']->config['config']['jumpurl_enable'] || $GLOBALS['TSFE']->config['config']['jumpurl_mailto_disable']) {
05500 if ($GLOBALS['TSFE']->spamProtectEmailAddresses) {
05501 if ($GLOBALS['TSFE']->spamProtectEmailAddresses === 'ascii') {
05502 $mailToUrl = $GLOBALS['TSFE']->encryptEmail($mailToUrl);
05503 } else {
05504 $mailToUrl = "javascript:linkTo_UnCryptMailto('".$GLOBALS['TSFE']->encryptEmail($mailToUrl)."');";
05505 }
05506 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']) {
05507 $atLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_atSubst']);
05508 }
05509 $linktxt = str_replace('@',$atLabel?$atLabel:'(at)',$linktxt);
05510
05511 if ($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']) {
05512 $lastDotLabel = trim($GLOBALS['TSFE']->config['config']['spamProtectEmailAddresses_lastDotSubst']);
05513 $lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)';
05514 $linktxt = preg_replace('/\.([^\.]+)$/', $lastDotLabel.'$1', $linktxt);
05515 }
05516 }
05517 } else {
05518 $mailToUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($mailToUrl).$GLOBALS['TSFE']->getMethodUrlIdToken;
05519 }
05520 return array($mailToUrl,$linktxt);
05521 }
05522
05532 function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE) {
05533 $rawValues = FALSE;
05534 switch((string)$conf['method']) {
05535 case 'GET':
05536 $q_in = t3lib_div::_GET();
05537 break;
05538 case 'POST':
05539 $q_in = t3lib_div::_POST();
05540 break;
05541 default:
05542
05543 if (!$conf['exclude']) return '&'.t3lib_div::getIndpEnv('QUERY_STRING');
05544
05545 $q_in = array();
05546 foreach (explode('&',t3lib_div::getIndpEnv('QUERY_STRING')) as $arg) {
05547 list($k,$v) = explode('=',$arg);
05548 $q_in[$k] = $v;
05549 }
05550 $rawValues = TRUE;
05551 }
05552
05553 if ($conf['exclude']) {
05554 $q_out = array();
05555 $exclude = t3lib_div::trimExplode(',', $conf['exclude']);
05556 $exclude[] = 'id';
05557 foreach ($q_in as $k => $v) {
05558 if (!in_array($k, $exclude)) {
05559 if (isset($overruleQueryArgs[$k])) {
05560 $v = $overruleQueryArgs[$k];
05561 unset($overruleQueryArgs[$k]);
05562 }
05563 $q_out[$k] = $v;
05564 }
05565 }
05566
05567 if ($forceArgs) {
05568 foreach ($overruleQueryArgs as $k => $v) {
05569 $q_out[$k] = $v;
05570 }
05571 }
05572 } else {
05573 $q_out = &$q_in;
05574 }
05575
05576 $content = '';
05577 if ($rawValues) {
05578 foreach ($q_out as $k => $v) {
05579 $content .= '&'.$k.'='.$v;
05580 }
05581 } else {
05582 $content = t3lib_div::implodeArrayForUrl('',$q_out);
05583 }
05584
05585 return $content;
05586 }
05587
05588
05589
05590
05591
05592
05593
05594
05595
05596
05597
05598
05599
05600
05601
05602
05603
05604
05605
05606
05607
05608
05609
05610
05622 function wrap($content,$wrap,$char='|') {
05623 if ($wrap) {
05624 $wrapArr = explode($char, $wrap);
05625 return trim($wrapArr[0]).$content.trim($wrapArr[1]);
05626 } else return $content;
05627 }
05628
05638 function noTrimWrap($content,$wrap) {
05639 if ($wrap) {
05640 $wrapArr = explode('|', $wrap);
05641 return $wrapArr[1].$content.$wrapArr[2];
05642 } else return $content;
05643 }
05644
05652 function wrapSpace($content, $wrap) {
05653 $result = $content;
05654 if (trim($wrap)) {
05655 $wrapArray = explode('|',$wrap);
05656 $wrapBefore = intval($wrapArray[0]);
05657 $wrapAfter = intval($wrapArray[1]);
05658 if ($wrapBefore) {
05659 $result = '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$wrapBefore.'"'.$this->getBorderAttr(' border="0"').' class="spacer-gif" alt="" title="" /><br />'.$result;
05660 }
05661 if ($wrapAfter) {
05662 $result.='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$wrapAfter.'"'.$this->getBorderAttr(' border="0"').' class="spacer-gif" alt="" title="" /><br />';
05663 }
05664 }
05665 return $result;
05666 }
05667
05678 function callUserFunction($funcName,$conf,$content) {
05679 $pre = $GLOBALS['TSFE']->TYPO3_CONF_VARS['FE']['userFuncClassPrefix'];
05680 if ($pre &&
05681 !t3lib_div::isFirstPartOfStr(trim($funcName),$pre) &&
05682 !t3lib_div::isFirstPartOfStr(trim($funcName),'tx_')
05683 ) {
05684 $GLOBALS['TT']->setTSlogMessage('Function "'.$funcName.'" was not prepended with "'.$pre.'"',3);
05685 return $content;
05686 }
05687
05688 $parts = explode('->',$funcName);
05689 if (count($parts)==2) {
05690 $cls = t3lib_div::makeInstanceClassName($parts[0]);
05691 if (class_exists ($cls)) {
05692 $classObj = new $cls;
05693 if (method_exists($classObj, $parts[1])) {
05694 $classObj->cObj = &$this;
05695 $content = call_user_method($parts[1], $classObj, $content, $conf);
05696 } else {
05697 $GLOBALS['TT']->setTSlogMessage('Method "'.$parts[1].'" did not exist in class "'.$cls.'"',3);
05698 }
05699 } else {
05700 $GLOBALS['TT']->setTSlogMessage('Class "'.$cls.'" did not exist',3);
05701 }
05702 } else {
05703 if (function_exists($funcName)) {
05704 $content = call_user_func($funcName, $content, $conf);
05705 } else {
05706 $GLOBALS['TT']->setTSlogMessage('Function "'.$funcName.'" did not exist',3);
05707 }
05708 }
05709 return $content;
05710 }
05711
05719 function processParams($params) {
05720 $paramArr=array();
05721 $lines=t3lib_div::trimExplode(chr(10),$params,1);
05722 foreach($lines as $val) {
05723 $pair = explode('=',$val,2);
05724 if (!t3lib_div::inList('#,/',substr(trim($pair[0]),0,1))) {
05725 $paramArr[trim($pair[0])] = trim($pair[1]);
05726 }
05727 }
05728 return $paramArr;
05729 }
05730
05737 function keywords($content) {
05738 $listArr = split(',|;|'.chr(10),$content);
05739 reset($listArr);
05740 while(list($k,$v)=each($listArr)) {
05741 $listArr[$k]=trim($v);
05742 }
05743 return implode(',',$listArr);
05744 }
05745
05754 function caseshift($theValue, $case) {
05755 $case = strtolower($case);
05756 switch($case) {
05757 case 'upper':
05758 $theValue = $GLOBALS['TSFE']->csConvObj->conv_case($GLOBALS['TSFE']->renderCharset,$theValue,'toUpper');
05759 #$theValue = strtoupper($theValue);
05760 #$theValue = strtr($theValue, $this->caseConvStrings[0], $this->caseConvStrings[1]);
05761 break;
05762 case 'lower':
05763 $theValue = $GLOBALS['TSFE']->csConvObj->conv_case($GLOBALS['TSFE']->renderCharset,$theValue,'toLower');
05764 #$theValue = strtolower($theValue);
05765 #$theValue = strtr($theValue, $this->caseConvStrings[1], $this->caseConvStrings[0]);
05766 break;
05767 }
05768 return $theValue;
05769 }
05770
05779 function HTMLcaseshift($theValue, $case) {
05780 $inside = 0;
05781 $newVal = '';
05782 $pointer = 0;
05783 $totalLen = strlen($theValue);
05784 do {
05785 if (!$inside) {
05786 $len = strcspn(substr($theValue,$pointer),'<');
05787 $newVal.= $this->caseshift(substr($theValue,$pointer,$len),$case);
05788 $inside = 1;
05789 } else {
05790 $len = strcspn(substr($theValue,$pointer),'>')+1;
05791 $newVal.= substr($theValue,$pointer,$len);
05792 $inside = 0;
05793 }
05794 $pointer+=$len;
05795 } while($pointer<$totalLen);
05796 return $newVal;
05797 }
05798
05808 function bytes($sizeInBytes,$labels) {
05809 return t3lib_div::formatSize($sizeInBytes,$labels);
05810 }
05811
05819 function calcAge($seconds,$labels) {
05820 if (t3lib_div::testInt($labels)) {
05821 $labels = ' min| hrs| days| yrs';
05822 } else {
05823 $labels=str_replace('"','',$labels);
05824 }
05825
05826 $labelArr = explode('|',$labels);
05827 $absSeconds = abs($seconds);
05828 if ($absSeconds<3600) {
05829 $seconds = round ($seconds/60).$labelArr[0];
05830 } elseif ($absSeconds<24*3600) {
05831 $seconds = round ($seconds/3600).$labelArr[1];
05832 } elseif ($absSeconds<365*24*3600) {
05833 $seconds = round ($seconds/(24*3600)).$labelArr[2];
05834 } else {
05835 $seconds = round ($seconds/(365*24*3600)).$labelArr[3];
05836 }
05837 return $seconds;
05838 }
05839
05851 function sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName='', $replyTo='') {
05852
05853 $headers=array();
05854 if ($email_from) {$headers[]='From: '.$email_fromName.' <'.$email_from.'>';}
05855 if ($replyTo) {$headers[]='Reply-To: '.$replyTo;}
05856
05857 $recipients=implode(',',t3lib_div::trimExplode(',',$recipients,1));
05858
05859 $emailContent = trim($msg);
05860 if ($emailContent) {
05861 $parts = split(chr(10),$emailContent,2);
05862 $subject=trim($parts[0]);
05863 $plain_message=trim($parts[1]);
05864
05865 if ($recipients) $GLOBALS['TSFE']->plainMailEncoded($recipients, $subject, $plain_message, implode(chr(10),$headers));
05866 if ($cc) $GLOBALS['TSFE']->plainMailEncoded($cc, $subject, $plain_message, implode(chr(10),$headers));
05867 return true;
05868 }
05869 }
05870
05878 function URLqMark($url,$params) {
05879 if ($params && !strstr($url,'?')) {
05880 return $url.'?'.$params;
05881 } else {
05882 return $url.$params;
05883 }
05884 }
05885
05894 function checkEmail($email) {
05895 return t3lib_div::validEmail($email);
05896 }
05897
05906 function clearTSProperties($TSArr,$propList) {
05907 $list = explode(',',$propList);
05908 while(list(,$prop)=each($list)) {
05909 $prop = trim($prop);
05910 unset($TSArr[$prop]);
05911 unset($TSArr[$prop.'.']);
05912 }
05913 return $TSArr;
05914 }
05915
05925 function mergeTSRef($confArr,$prop) {
05926 if (substr($confArr[$prop],0,1)=='<') {
05927 $key = trim(substr($confArr[$prop],1));
05928 $cF = t3lib_div::makeInstance('t3lib_TSparser');
05929
05930 $old_conf=$confArr[$prop.'.'];
05931 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
05932 if (is_array($old_conf) && count($old_conf)) {
05933 $conf = $this->joinTSarrays($conf,$old_conf);
05934 }
05935 $confArr[$prop.'.']=$conf;
05936 }
05937 return $confArr;
05938 }
05939
05948 function joinTSarrays($conf,$old_conf) {
05949 if (is_array($old_conf)) {
05950 reset($old_conf);
05951 while(list($key,$val)=each($old_conf)) {
05952 if (is_array($val)) {
05953 $conf[$key] = $this->joinTSarrays($conf[$key],$val);
05954 } else {
05955 $conf[$key] = $val;
05956 }
05957 }
05958 }
05959 return $conf;
05960 }
05961
05971 function gifBuilderTextBox($gifbuilderConf, $conf, $text) {
05972 $chars = intval($conf['chars']) ? intval($conf['chars']) : 20;
05973 $lineDist = intval($conf['lineDist']) ? intval($conf['lineDist']) : 20;
05974 $Valign = strtolower(trim($conf['Valign']));
05975 $tmplObjNumber = intval($conf['tmplObjNumber']);
05976 $maxLines = intval($conf['maxLines']);
05977
05978 if ($tmplObjNumber && $gifbuilderConf[$tmplObjNumber]=='TEXT') {
05979 $textArr = $this->linebreaks($text,$chars,$maxLines);
05980 $angle = intval($gifbuilderConf[$tmplObjNumber.'.']['angle']);
05981 reset($textArr);
05982 while(list($c,$textChunk)=each($textArr)) {
05983 $index = $tmplObjNumber+1+($c*2);
05984
05985 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$index);
05986 $rad_angle = 2*pi()/360*$angle;
05987 $x_d = sin($rad_angle)*$lineDist;
05988 $y_d = cos($rad_angle)*$lineDist;
05989
05990 $diff_x_d=0;
05991 $diff_y_d=0;
05992 if ($Valign=='center') {
05993 $diff_x_d = $x_d*count($textArr);
05994 $diff_x_d = $diff_x_d/2;
05995 $diff_y_d = $y_d*count($textArr);
05996 $diff_y_d = $diff_y_d/2;
05997 }
05998
05999
06000 $x_d = round($x_d*$c - $diff_x_d);
06001 $y_d = round($y_d*$c - $diff_y_d);
06002
06003 $gifbuilderConf[$index] = 'WORKAREA';
06004 $gifbuilderConf[$index.'.']['set'] = $x_d.','.$y_d;
06005
06006 $index++;
06007 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$index);
06008 $gifbuilderConf[$index] = 'TEXT';
06009 $gifbuilderConf[$index.'.'] = $this->clearTSProperties($gifbuilderConf[$tmplObjNumber.'.'],'text');
06010 $gifbuilderConf[$index.'.']['text'] = $textChunk;
06011 }
06012 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf,$tmplObjNumber);
06013 }
06014 return $gifbuilderConf;
06015 }
06016
06027 function linebreaks($string,$chars,$maxLines=0) {
06028 $lines = explode(chr(10),$string);
06029 $lineArr=Array();
06030 $c=0;
06031 while(list(,$paragraph)=each($lines)) {
06032 $words = explode(' ',$paragraph);
06033 while(list(,$word)=each($words)) {
06034 if (strlen($lineArr[$c].$word)>$chars) {
06035 $c++;
06036 }
06037 if (!$maxLines || $c<$maxLines) {
06038 $lineArr[$c].= $word.' ';
06039 }
06040 }
06041 $c++;
06042 }
06043 return $lineArr;
06044 }
06045
06058 function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) {
06059 $JSPart='';
06060 $updateValues=t3lib_div::trimExplode(',',$fieldList);
06061 while(list(,$fKey)=each($updateValues)) {
06062 $value = $dataArray[$fKey];
06063 if (is_array($value)) {
06064 reset($value);
06065 while(list(,$Nvalue)=each($value)) {
06066 $JSPart.="
06067 updateForm('".$formName."','".$arrPrefix."[".$fKey."][]',".t3lib_div::quoteJSvalue($Nvalue, true).")";
06068 }
06069
06070 } else {
06071 $JSPart.="
06072 updateForm('".$formName."','".$arrPrefix."[".$fKey."]',".t3lib_div::quoteJSvalue($value, true).")";
06073 }
06074 }
06075 $JSPart='<script type="text/javascript">
06076 '.$JSPart.'
06077
06078 </script>
06079 ';
06080 $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']='<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.updateform.js"></script>';
06081 return $JSPart;
06082 }
06083
06084
06085
06086
06087
06088
06089
06090
06091
06092
06093
06094
06095
06096
06097
06098
06099
06100
06101
06102
06103
06104
06105
06106
06107
06108
06109
06110
06111
06112
06113
06114
06115
06116
06127 function DBgetDelete($table, $uid, $doExec=FALSE) {
06128 if (intval($uid)) {
06129 if ($GLOBALS['TCA'][$table]['ctrl']['delete']) {
06130 if ($doExec) {
06131 return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), array($GLOBALS['TCA'][$table]['ctrl']['delete'] => 1));
06132 } else {
06133 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid='.intval($uid), array($GLOBALS['TCA'][$table]['ctrl']['delete'] => 1));
06134 }
06135 } else {
06136 if ($doExec) {
06137 return $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid='.intval($uid));
06138 } else {
06139 return $GLOBALS['TYPO3_DB']->DELETEquery($table, 'uid='.intval($uid));
06140 }
06141 }
06142 }
06143 }
06144
06159 function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE) {
06160 unset($dataArr['uid']);
06161 $uid=intval($uid);
06162
06163 if ($uid) {
06164 $fieldList = implode(',',t3lib_div::trimExplode(',',$fieldList,1));
06165 $updateFields=array();
06166
06167 foreach($dataArr as $f => $v) {
06168 if (t3lib_div::inList($fieldList,$f)) {
06169 $updateFields[$f] = $v;
06170 }
06171 }
06172
06173 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
06174 $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = time();
06175 }
06176
06177 if (count($updateFields)) {
06178 if ($doExec) {
06179 return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid='.intval($uid), $updateFields);
06180 } else {
06181 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid='.intval($uid), $updateFields);
06182 }
06183 }
06184 }
06185 }
06186
06201 function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE) {
06202 $extraList='pid';
06203 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {$field=$GLOBALS['TCA'][$table]['ctrl']['tstamp']; $dataArr[$field]=time(); $extraList.=','.$field;}
06204 if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) {$field=$GLOBALS['TCA'][$table]['ctrl']['crdate']; $dataArr[$field]=time(); $extraList.=','.$field;}
06205 if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) {$field=$GLOBALS['TCA'][$table]['ctrl']['cruser_id']; $dataArr[$field]=0; $extraList.=','.$field;}
06206 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;}
06207 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;}
06208
06209 unset($dataArr['uid']);
06210 if ($pid>=0) { $dataArr['pid'] = $pid; }
06211 $fieldList = implode(',',t3lib_div::trimExplode(',',$fieldList.','.$extraList,1));
06212
06213 $insertFields = array();
06214 foreach($dataArr as $f => $v) {
06215 if (t3lib_div::inList($fieldList,$f)) {
06216 $insertFields[$f] = $v;
06217 }
06218 }
06219
06220 if ($doExec) {
06221 return $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields);
06222 } else {
06223 return $GLOBALS['TYPO3_DB']->INSERTquery($table, $insertFields);
06224 }
06225 }
06226
06238 function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0) {
06239 $groupList = $allowedGroups ? implode(',',array_intersect(t3lib_div::trimExplode(',',$feUserRow['usergroup'],1),t3lib_div::trimExplode(',',$allowedGroups,1))) : $feUserRow['usergroup'];
06240 $ok=0;
06241
06242 if (!$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] || !$row[$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']]) {
06243
06244 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {
06245 $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']]);
06246 if ($rowFEUser && $rowFEUser==$feUserRow['uid']) {
06247 $ok=1;
06248 }
06249 }
06250
06251 if ($feEditSelf && $table=='fe_users' && !strcmp($feUserRow['uid'],$row['uid'])) {
06252 $ok=1;
06253 }
06254
06255 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {
06256 $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']]);
06257 if ($rowFEUser) {
06258 if (t3lib_div::inList($groupList, $rowFEUser)) {
06259 $ok=1;
06260 }
06261 }
06262 }
06263 }
06264 return $ok;
06265 }
06266
06278 function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0) {
06279
06280 $groupList = $allowedGroups ? implode(',',array_intersect(t3lib_div::trimExplode(',',$feUserRow['usergroup'],1),t3lib_div::trimExplode(',',$allowedGroups,1))) : $feUserRow['usergroup'];
06281 $OR_arr=array();
06282
06283 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {
06284 $OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id'].'='.$feUserRow['uid'];
06285 }
06286
06287 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {
06288 $values = t3lib_div::intExplode(',',$groupList);
06289 while(list(,$theGroupUid)=each($values)) {
06290 if ($theGroupUid) {$OR_arr[]=$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'].'='.$theGroupUid;}
06291 }
06292 }
06293
06294 if ($feEditSelf && $table=='fe_users') {
06295 $OR_arr[]='uid='.intval($feUserRow['uid']);
06296 }
06297
06298 $whereDef=' AND 1=0';
06299 if (count($OR_arr)) {
06300 $whereDef=' AND ('.implode(' OR ',$OR_arr).')';
06301 if ($GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']) {
06302 $whereDef.=' AND '.$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'].'=0';
06303 }
06304 }
06305 return $whereDef;
06306 }
06307
06318 function enableFields($table,$show_hidden=0) {
06319 return $GLOBALS['TSFE']->sys_page->enableFields($table,$show_hidden?$show_hidden:($table=='pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords));
06320 }
06321
06342 function getTreeList($id,$depth,$begin=0,$dontCheckEnableFields=FALSE,$addSelectFields='',$moreWhereClauses='', $prevId_array=array(), $recursionLevel=0) {
06343
06344
06345 $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state'.$addSelectFields;
06346 $depth = intval($depth);
06347 $begin = intval($begin);
06348 $id = intval($id);
06349 $theList = '';
06350 $addId = 0;
06351
06352 if ($id) {
06353
06354
06355 if (!$recursionLevel) {
06356
06357 if ($id < 0) {
06358 $addId = $id = abs($id);
06359 }
06360
06361 if ($GLOBALS['TSFE']->sys_page->getRawRecord('pages',$id,'uid')) {
06362
06363
06364 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($id);
06365 if (is_array($mount_info)) {
06366 $id = $mount_info['mount_pid'];
06367
06368 if ($addId && $mount_info['overlay']) {
06369 $addId = $id;
06370 }
06371 }
06372 } else return '';
06373 }
06374
06375
06376 if ($begin<=0) {
06377 $prevId_array[] = $id;
06378 }
06379
06380
06381 if ($depth>0) {
06382 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($allFields, 'pages', 'pid='.intval($id).' AND deleted=0'.$moreWhereClauses, '' ,'sorting');
06383 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
06384 $GLOBALS['TSFE']->sys_page->versionOL('pages',$row);
06385
06386 if ($row['doktype']==255 || $row['doktype']==6 || $row['t3ver_state']==1) { unset($row); }
06387
06388 if (is_array($row)) {
06389
06390 $next_id = $row['uid'];
06391 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($next_id, $row);
06392
06393 if (is_array($mount_info) && $mount_info['overlay']) {
06394 $next_id = $mount_info['mount_pid'];
06395 $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery($allFields, 'pages', 'uid='.intval($next_id).' AND deleted=0'.$moreWhereClauses, '' ,'sorting');
06396 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res2);
06397 $GLOBALS['TSFE']->sys_page->versionOL('pages',$row);
06398
06399 if ($row['doktype']==255 || $row['doktype']==6 || $row['t3ver_state']==1) { unset($row); }
06400 }
06401
06402 if (is_array($row) && ($dontCheckEnableFields || $GLOBALS['TSFE']->checkPagerecordForIncludeSection($row))) {
06403
06404 if ($begin<=0) {
06405 if ($dontCheckEnableFields || $GLOBALS['TSFE']->checkEnableFields($row)) {
06406 $theList.= $next_id.',';
06407 }
06408 }
06409
06410 if ($depth>1 && !$row['php_tree_stop']) {
06411
06412 if (is_array($mount_info) && !$mount_info['overlay']) {
06413 $next_id = $mount_info['mount_pid'];
06414 }
06415
06416 if (!in_array($next_id,$prevId_array)) {
06417 $theList.= tslib_cObj::getTreeList($next_id, $depth-1, $begin-1, $dontCheckEnableFields, $addSelectFields, $moreWhereClauses, $prevId_array, $recursionLevel+1);
06418 }
06419 }
06420 }
06421 }
06422 }
06423 }
06424 }
06425
06426 if (!$recursionLevel) {
06427 if ($addId) {
06428 if ($begin>0) {
06429 $theList.= 0;
06430 } else {
06431 $theList.= $addId;
06432 }
06433 }
06434 }
06435
06436 return $theList;
06437 }
06438
06448 function whereSelectFromList($field,$value) {
06449 return $GLOBALS['TYPO3_DB']->listQuery($field,$value,'');
06450 }
06451
06466 function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') {
06467 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
06468 $select,
06469 $local_table.','.$mm_table.($foreign_table?','.$foreign_table:''),
06470 $local_table.'.uid='.$mm_table.'.uid_local'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').
06471 $whereClause,
06472 $groupBy,
06473 $orderBy,
06474 $limit
06475 );
06476 }
06477
06493 function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='') {
06494 return $GLOBALS['TYPO3_DB']->exec_SELECTquery(
06495 $select,
06496 $mm_table.($foreign_table?','.$foreign_table:''),
06497 $mm_table.'.uid_local IN ('.$local_table_uidlist.')'.($foreign_table?' AND '.$foreign_table.'.uid='.$mm_table.'.uid_foreign':'').
06498 $whereClause,
06499 $groupBy,
06500 $orderBy,
06501 $limit
06502 );
06503 }
06504
06514 function searchWhere($sw,$searchFieldList,$searchTable='') {
06515 global $TYPO3_DB;
06516
06517 $prefixTableName = $searchTable ? $searchTable.'.' : '';
06518 $where = '';
06519 if ($sw) {
06520 $searchFields = explode(',',$searchFieldList);
06521 $kw = split('[ ,]',$sw);
06522
06523 while(list(,$val)=each($kw)) {
06524 $val = trim($val);
06525 $where_p = array();
06526 if (strlen($val)>=2) {
06527 $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val,$searchTable),$searchTable);
06528 reset($searchFields);
06529 while(list(,$field)=each($searchFields)) {
06530 $where_p[] = $prefixTableName.$field.' LIKE \'%'.$val.'%\'';
06531 }
06532 }
06533 if (count($where_p)) {
06534 $where.=' AND ('.implode(' OR ',$where_p).')';
06535 }
06536 }
06537 }
06538 return $where;
06539 }
06540
06550 function exec_getQuery($table, $conf) {
06551 $queryParts = $this->getQuery($table, $conf, TRUE);
06552
06553 return $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
06554 }
06555
06568 function getQuery($table, $conf, $returnQueryArray=FALSE) {
06569
06570
06571 $conf['pidInList'] = trim($this->stdWrap($conf['pidInList'],$conf['pidInList.']));
06572 if (!strcmp($conf['pidInList'],'')) {
06573 $conf['pidInList'] = 'this';
06574 }
06575 $queryParts = $this->getWhere($table,$conf,TRUE);
06576
06577
06578 $queryParts['SELECT'] = $conf['selectFields'] ? $conf['selectFields'] : '*';
06579
06580
06581 if ($conf['max'] || $conf['begin']) {
06582 $error=0;
06583
06584
06585 if (strstr(strtolower($conf['begin'].$conf['max']),'total')) {
06586 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', $table, $queryParts['WHERE'], $queryParts['GROUPBY']);
06587 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
06588 $GLOBALS['TT']->setTSlogMessage($error);
06589 } else {
06590 $total = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
06591 $conf['max'] = eregi_replace('total', (string)$total, $conf['max']);
06592 $conf['begin'] = eregi_replace('total', (string)$total, $conf['begin']);
06593 }
06594 }
06595 if (!$error) {
06596 $conf['begin'] = t3lib_div::intInRange(ceil($this->calc($conf['begin'])),0);
06597 $conf['max'] = t3lib_div::intInRange(ceil($this->calc($conf['max'])),0);
06598 if ($conf['begin'] && !$conf['max']) {
06599 $conf['max'] = 100000;
06600 }
06601
06602 if ($conf['begin'] && $conf['max']) {
06603 $queryParts['LIMIT'] = $conf['begin'].','.$conf['max'];
06604 } elseif (!$conf['begin'] && $conf['max']) {
06605 $queryParts['LIMIT'] = $conf['max'];
06606 }
06607 }
06608 }
06609
06610 if (!$error) {
06611
06612
06613 $joinPart='';
06614 if ($conf['join']) {
06615 $joinPart = 'JOIN ' .trim($conf['join']);
06616 } elseif ($conf['leftjoin']) {
06617 $joinPart = 'LEFT OUTER JOIN ' .trim($conf['leftjoin']);
06618 } elseif ($conf['rightjoin']) {
06619 $joinPart = 'RIGHT OUTER JOIN ' .trim($conf['rightjoin']);
06620 }
06621
06622
06623 $queryParts['FROM'] = trim($table.' '.$joinPart);
06624 $query = $GLOBALS['TYPO3_DB']->SELECTquery(
06625 $queryParts['SELECT'],
06626 $queryParts['FROM'],
06627 $queryParts['WHERE'],
06628 $queryParts['GROUPBY'],
06629 $queryParts['ORDERBY'],
06630 $queryParts['LIMIT']
06631 );
06632 return $returnQueryArray ? $queryParts : $query;
06633 }
06634 }
06635
06647 function getWhere($table,$conf, $returnQueryArray=FALSE) {
06648 global $TCA;
06649
06650
06651 $query = '';
06652 $pid_uid_flag=0;
06653 $queryParts = array(
06654 'SELECT' => '',
06655 'FROM' => '',
06656 'WHERE' => '',
06657 'GROUPBY' => '',
06658 'ORDERBY' => '',
06659 'LIMIT' => ''
06660 );
06661
06662 if (trim($conf['uidInList'])) {
06663 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['uidInList']));
06664 if (count($listArr)==1) {
06665 $query.=' AND '.$table.'.uid='.intval($listArr[0]);
06666 } else {
06667 $query.=' AND '.$table.'.uid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($listArr)).')';
06668 }
06669 $pid_uid_flag++;
06670 }
06671 if (trim($conf['pidInList'])) {
06672 $listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['pidInList']));
06673
06674 $listArr = $this->checkPidArray($listArr);
06675 if (count($listArr)) {
06676 $query.=' AND '.$table.'.pid IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($listArr)).')';
06677 $pid_uid_flag++;
06678 } else {
06679 $pid_uid_flag=0;
06680 }
06681 }
06682 if (!$pid_uid_flag) {
06683 $query.=' AND '.$table.'.uid=0';
06684 }
06685 if ($where = trim($conf['where'])) {
06686 $query.=' AND '.$where;
06687 }
06688
06689 if ($conf['languageField']) {
06690 if ($GLOBALS['TSFE']->sys_language_contentOL && $TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
06691
06692 $sys_language_content = '0,-1';
06693 } else {
06694 $sys_language_content = intval($GLOBALS['TSFE']->sys_language_content);
06695 }
06696 $query.=' AND '.$conf['languageField'].' IN ('.$sys_language_content.')';
06697 }
06698
06699 $andWhere = trim($this->stdWrap($conf['andWhere'],$conf['andWhere.']));
06700 if ($andWhere) {
06701 $query.=' AND '.$andWhere;
06702 }
06703
06704
06705 if ($table=='pages') {
06706 $query.=' '.$GLOBALS['TSFE']->sys_page->where_hid_del.
06707 $GLOBALS['TSFE']->sys_page->where_groupAccess;
06708 } else {
06709 $query.=$this->enableFields($table);
06710 }
06711
06712
06713 if ($query) {
06714 $queryParts['WHERE'] = trim(substr($query,4));
06715 $query = 'WHERE '.$queryParts['WHERE'];
06716 }
06717
06718
06719 if (trim($conf['groupBy'])) {
06720 $queryParts['GROUPBY'] = trim($conf['groupBy']);
06721 $query.=' GROUP BY '.$queryParts['GROUPBY'];
06722 }
06723
06724
06725 if (trim($conf['orderBy'])) {
06726 $queryParts['ORDERBY'] = trim($conf['orderBy']);
06727 $query.=' ORDER BY '.$queryParts['ORDERBY'];
06728 }
06729
06730
06731 return $returnQueryArray ? $queryParts : $query;
06732 }
06733
06742 function checkPidArray($listArr) {
06743 $outArr = Array();
06744 if (is_array($listArr) && count($listArr)) {
06745 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid IN ('.implode(',',$listArr).')'.$this->enableFields('pages').' AND doktype NOT IN ('.$this->checkPid_badDoktypeList.')');
06746 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
06747 $GLOBALS['TT']->setTSlogMessage($error.': '.$query,3);
06748 } else {
06749 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
06750 $outArr[] = $row['uid'];
06751 }
06752 }
06753 }
06754 return $outArr;
06755 }
06756
06765 function checkPid($uid) {
06766 $uid = intval($uid);
06767 if (!isset($this->checkPid_cache[$uid])) {
06768 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid='.intval($uid).$this->enableFields('pages').' AND doktype NOT IN ('.$this->checkPid_badDoktypeList.')');
06769 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
06770 $this->checkPid_cache[$uid] = 1;
06771 } else {
06772 $this->checkPid_cache[$uid] = 0;
06773 }
06774 }
06775 return $this->checkPid_cache[$uid];
06776 }
06777
06778
06779
06780
06781
06782
06783
06784
06785
06786
06787
06788
06789
06790
06791
06792
06793
06794
06795
06796
06797
06798
06799
06800
06801
06802
06803
06804
06805
06806
06807
06808
06821 function editPanel($content, $conf, $currentRecord='', $dataArr=array()) {
06822 global $TCA,$BE_USER;
06823
06824
06825 if (!$GLOBALS['TSFE']->beUserLogin) { return $content; }
06826
06827
06828 if ($conf['newRecordFromTable']) {
06829 $currentRecord = $conf['newRecordFromTable'].':NEW';
06830 $conf['allow']='new';
06831 }
06832
06833 if (!$currentRecord) $currentRecord=$this->currentRecord;
06834 if (!count($dataArr)) $dataArr=$this->data;
06835 list($table,$uid) = explode(':',$currentRecord);
06836 $mayEdit=0;
06837 $nPid=intval($conf['newRecordInPid']);
06838
06839
06840 if ($table === 'pages') {
06841 $lang = $GLOBALS['TSFE']->sys_language_uid;
06842 } elseif ($table === 'tt_content') {
06843 $lang = $GLOBALS['TSFE']->sys_language_content;
06844 } elseif ($TCA[$table]['ctrl']['languageField']) {
06845 $lang = $currentRecord[$TCA[$table]['ctrl']['languageField']];
06846 } else {
06847 $lang = -1;
06848 }
06849 if (!$BE_USER->checkLanguageAccess($lang)) { return $content; }
06850
06851 if (!$conf['onlyCurrentPid'] || $dataArr['pid']==$GLOBALS['TSFE']->id) {
06852
06853 $types = t3lib_div::trimExplode(',',strtolower($conf['allow']),1);
06854 $allow = array_flip($types);
06855
06856 $perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
06857 if ($table=='pages') {
06858 if (count($GLOBALS['TSFE']->config['rootLine'])==1) {unset($allow['move']); unset($allow['hide']); unset($allow['delete']);}
06859 if (!($perms&2)) {unset($allow['edit']);unset($allow['move']);unset($allow['hide']);}
06860 if (!($perms&4)) unset($allow['delete']);
06861 if (!($perms&8)) unset($allow['new']);
06862 if (count($allow)) $mayEdit=1;
06863 $newUid = $uid;
06864 } else {
06865 $mayEdit = count($allow)&&($perms&16);
06866 if ($conf['newRecordFromTable']) {
06867 $newUid=$GLOBALS['TSFE']->id;
06868 if ($nPid) $newUid=$nPid;
06869 } else {
06870 $newUid = -1*$uid;
06871 }
06872 }
06873 }
06874
06875 if ($GLOBALS['TSFE']->displayEditIcons && $table && $mayEdit) {
06876 $GLOBALS['TSFE']->set_no_cache();
06877 $formName = 'TSFE_EDIT_FORM_'.substr($GLOBALS['TSFE']->uniqueHash(),0,4);
06878 $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;">';
06879 $sortField = $TCA[$table]['ctrl']['sortby'];
06880 $labelField = $TCA[$table]['ctrl']['label'];
06881 $hideField = $TCA[$table]['ctrl']['enablecolumns']['disabled'];
06882 $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 />':'';
06883
06884 $theCmd='';
06885 $TSFE_EDIT = t3lib_div::_POST('TSFE_EDIT');
06886 if (is_array($TSFE_EDIT) && $TSFE_EDIT['record']==$currentRecord && !$TSFE_EDIT['update_close']) {
06887 $theCmd =$TSFE_EDIT['cmd'];
06888 }
06889
06890 switch($theCmd) {
06891 case 'edit':
06892 case 'new':
06893 $tceforms = t3lib_div::makeInstance('t3lib_TCEforms_FE');
06894 $tceforms->prependFormFieldNames = 'TSFE_EDIT[data]';
06895 $tceforms->prependFormFieldNames_file = 'TSFE_EDIT_file';
06896 $tceforms->doSaveFieldName = 'TSFE_EDIT[doSave]';
06897 $tceforms->formName = $formName;
06898 $tceforms->backPath = TYPO3_mainDir;
06899 $tceforms->setFancyDesign();
06900 $tceforms->defStyle = 'font-family:Verdana;font-size:10px;';
06901 $tceforms->edit_showFieldHelp = $GLOBALS['BE_USER']->uc['edit_showFieldHelp'];
06902 $tceforms->helpTextFontTag='<font face="verdana,sans-serif" color="#333333" size="1">';
06903
06904 $trData = t3lib_div::makeInstance('t3lib_transferData');
06905 $trData->addRawData = TRUE;
06906 $trData->defVals = t3lib_div::_GP('defVals');
06907 $trData->fetchRecord($table, ($theCmd=='new'?$newUid:$dataArr['uid']), ($theCmd=='new'?'new':'') );
06908 reset($trData->regTableItems_data);
06909 $processedDataArr = current($trData->regTableItems_data);
06910 $processedDataArr['uid']=$theCmd=='new'?'NEW':$dataArr['uid'];
06911 $processedDataArr['pid']=$theCmd=='new'?$newUid:$dataArr['pid'];
06912
06913 $panel='';
06914 $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).'" />';
06915 $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).'" />';
06916 $buttons.= '<input type="image" border="0" name="TSFE_EDIT[cancel]" onclick="'.
06917 htmlspecialchars('window.location.href=\''.t3lib_div::getIndpEnv('REQUEST_URI').'\';return false;').
06918 '" 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).'" />';
06919 $panel.=$tceforms->intoTemplate(array('ITEM'=>$buttons));
06920 $panel.=$tceforms->getMainFields($table,$processedDataArr);
06921
06922 $hiddenF="";
06923 if ($theCmd=='new') {
06924 $hiddenF.='<input type="hidden" name="TSFE_EDIT[data]['.$table.'][NEW][pid]" value="'.$newUid.'" />';
06925 if ($table=='pages') $hiddenF.='<input type="hidden" name="TSFE_EDIT[data]['.$table.'][NEW][hidden]" value="0" />';
06926 } else {
06927 $hiddenF.='<input type="hidden" name="TSFE_EDIT[record]" value="'.$currentRecord.'" />';
06928 $hiddenF.='<input type="hidden" name="TSFE_EDIT[cmd]" value="edit" />';
06929 }
06930 $hiddenF.='<input type="hidden" name="TSFE_EDIT[doSave]" value="0" />';
06931 $panel.=$tceforms->intoTemplate(array('ITEM'=>$buttons.$hiddenF));
06932
06933 $panel=$formTag.$tceforms->wrapTotal($panel,$dataArr,$table).'</form>'.($theCmd!='new'?$blackLine:'');
06934 $finalOut = $tceforms->printNeededJSFunctions_top().($conf['edit.']['displayRecord']?$content:'').$panel.($theCmd=='new'?$blackLine:'').$tceforms->printNeededJSFunctions();
06935 break;
06936 default:
06937 $panel = '';
06938 if (isset($allow['toolbar'])) $panel.=$GLOBALS['BE_USER']->ext_makeToolBar().'<img src="clear.gif" width="2" height="1" alt="" title="" />';
06939 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);
06940 if (isset($allow['move']) && $sortField && $BE_USER->workspace===0) {
06941 $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');
06942 $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');
06943 }
06944 if (isset($allow['hide']) && $hideField && $BE_USER->workspace===0 && !$dataArr['_LOCALIZED_UID']) {
06945 if ($dataArr[$hideField]) {
06946 $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');
06947 } else {
06948 $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'));
06949 }
06950 }
06951 if (isset($allow['new'])) {
06952 if ($table=='pages') {
06953 $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);
06954 } else {
06955 $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);
06956 }
06957 }
06958 if (isset($allow['delete']) && $BE_USER->workspace===0 && !$dataArr['_LOCALIZED_UID']) {
06959 $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'));
06960 }
06961
06962
06963 $labelTxt = $this->stdWrap($conf['label'],$conf['label.']);
06964 $panel='
06965
06966 <!-- BE_USER Edit Panel: -->
06967 '.$formTag.'
06968 <input type="hidden" name="TSFE_EDIT[cmd]" value="" />
06969 <input type="hidden" name="TSFE_EDIT[record]" value="'.$currentRecord.'" />
06970 <table border="0" cellpadding="0" cellspacing="0" border="1" bordercolor="black" class="typo3-editPanel">
06971 <tr>
06972 <td nowrap="nowrap" bgcolor="#ABBBB4" class="typo3-editPanel-controls">'.$panel.'</td>'.($labelTxt?'
06973 <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>':'').'
06974 </tr>
06975 </table>
06976 </form>';
06977
06978 if ($conf['innerWrap']) $panel = $this->wrap($panel,$conf['innerWrap']);
06979 if ($conf['innerWrap.']) $panel = $this->stdWrap($panel,$conf['innerWrap.']);
06980
06981 $panel.=$blackLine;
06982
06983 if ($conf['outerWrap']) $panel = $this->wrap($panel,$conf['outerWrap']);
06984 if ($conf['outerWrap.']) $panel = $this->stdWrap($panel,$conf['outerWrap.']);
06985 $finalOut = $content.$panel;
06986 break;
06987 }
06988
06989 if ($conf['previewBorder']) $finalOut = $this->editPanelPreviewBorder($table,$dataArr,$finalOut,$conf['previewBorder'],$conf['previewBorder.']);
06990 return $finalOut;
06991 } else {
06992 return $content;
06993 }
06994 }
06995
07008 function editIcons($content,$params, $conf=array(), $currentRecord='', $dataArr=array(),$addUrlParamStr='') {
07009 global $BE_USER;
07010
07011
07012 if (!$GLOBALS['TSFE']->beUserLogin) {return $content;}
07013
07014
07015 $rParts = explode(':',$currentRecord?$currentRecord:$this->currentRecord);
07016
07017 list($table,$fieldList)=t3lib_div::trimExplode(':',$params,1);
07018 if (!$fieldList) {
07019 $fieldList=$table;
07020 $table=$rParts[0];
07021 } else {
07022 if ($table!=$rParts[0]) return $content;
07023 }
07024
07025
07026 $mayEdit=0;
07027 $dataArr=count($dataArr)?$dataArr:$this->data;
07028
07029 $editUid = $dataArr['_LOCALIZED_UID'] ? $dataArr['_LOCALIZED_UID'] : $rParts[1];
07030
07031 if ($table=='pages') {
07032 $mayEdit = $BE_USER->isAdmin()||$BE_USER->doesUserHaveAccess($dataArr,2)?1:0;
07033 } else {
07034 $mayEdit = $BE_USER->isAdmin()||$BE_USER->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages',$dataArr['pid']),16)?1:0;
07035 }
07036
07037
07038 if ($mayEdit) {
07039 if ($table === 'pages') {
07040 $lang = $GLOBALS['TSFE']->sys_language_uid;
07041 } elseif ($table === 'tt_content') {
07042 $lang = $GLOBALS['TSFE']->sys_language_content;
07043 } elseif ($TCA[$table]['ctrl']['languageField']) {
07044 $lang = $currentRecord[$TCA[$table]['ctrl']['languageField']];
07045 } else {
07046 $lang = -1;
07047 }
07048 if (!$BE_USER->checkLanguageAccess($lang)) { $mayEdit = 0; }
07049 }
07050
07051 if ($GLOBALS['TSFE']->displayFieldEditIcons && $table && $mayEdit && $fieldList) {
07052 $GLOBALS['TSFE']->set_no_cache();
07053 $style = $conf['styleAttribute'] ? ' style="'.htmlspecialchars($conf['styleAttribute']).'"' : '';
07054 $iconTitle = $this->stdWrap($conf['iconTitle'],$conf['iconTitle.']);
07055 $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="" />';
07056 $nV=t3lib_div::_GP('ADMCMD_view')?1:0;
07057 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir;
07058 $icon = $this->editPanelLinkWrap_doWrap($iconImg, $adminURL.'alt_doc.php?edit['.$rParts[0].']['.$editUid.']=edit&columnsOnly='.rawurlencode($fieldList).'&noView='.$nV.$addUrlParamStr,implode(':',$rParts));
07059 if ($conf['beforeLastTag']<0) {
07060 $content=$icon.$content;
07061 } elseif ($conf['beforeLastTag']>0) {
07062 $cBuf = rtrim($content);
07063 $securCount=30;
07064 while($securCount && substr($cBuf,-1)=='>' && substr($cBuf,-4)!='</a>') {
07065 $cBuf = rtrim(ereg_replace('<[^<]*>$','',$cBuf));
07066 $securCount--;
07067 }
07068 $content = strlen($cBuf)&&$securCount ? substr($content,0,strlen($cBuf)).$icon.substr($content,strlen($cBuf)) : $content=$icon.$content;
07069 } else {
07070 $content.=$icon;
07071 }
07072 }
07073 return $content;
07074 }
07075
07090 function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='',$nPid='') {
07091 $eFONPage = $GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editFormsOnPage'] && $GLOBALS['BE_USER']->workspace===0;
07092 $nV=t3lib_div::_GP('ADMCMD_view')?1:0;
07093 $adminURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir;
07094
07095 if ($cmd=='edit' && !$eFONPage) {
07096 $rParts = explode(':',$currentRecord);
07097 $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'alt_doc.php?edit['.$rParts[0].']['.$rParts[1].']=edit&noView='.$nV,$currentRecord);
07098 } elseif ($cmd=='new' && !$eFONPage) {
07099 $rParts = explode(':',$currentRecord);
07100 if ($rParts[0]=='pages') {
07101 $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'db_new.php?id='.$rParts[1].'&pagesOnly=1',$currentRecord);
07102 } else {
07103 if (!intval($nPid)) {
07104 $nPid = t3lib_div::testInt($rParts[1]) ? -$rParts[1] : $GLOBALS['TSFE']->id;
07105 }
07106 $out=$this->editPanelLinkWrap_doWrap($string,$adminURL.'alt_doc.php?edit['.$rParts[0].']['.$nPid.']=new&noView='.$nV,$currentRecord);
07107 }
07108 } else {
07109 if ($confirm && $GLOBALS['BE_USER']->jsConfirmation(8)) {
07110 $cf1="if (confirm(".t3lib_div::quoteJSvalue($confirm, true).")){";
07111 $cf2='}';
07112 } else {
07113 $cf1=$cf2='';
07114 }
07115 $out='<a href="#" onclick="'.
07116 htmlspecialchars($cf1.'document.'.$formName.'[\'TSFE_EDIT[cmd]\'].value=\''.$cmd.'\'; document.'.$formName.'.submit();'.$cf2.' return false;').
07117 '">'.$string.'</a>';
07118 }
07119 return $out;
07120 }
07121
07132 function editPanelLinkWrap_doWrap($string,$url,$currentRecord) {
07133 if ($GLOBALS['BE_USER']->uc['TSFE_adminConfig']['edit_editNoPopup'] || $GLOBALS['BE_USER']->extAdminConfig['module.']['edit.']['forceNoPopup']) {
07134 $retUrl = t3lib_div::getIndpEnv('REQUEST_URI');
07135 $rParts = explode(':',$currentRecord);
07136 if ($rParts[0]=='tt_content' && $this->parentRecordNumber>2) {
07137 $retUrl.='#'.$rParts[1];
07138 }
07139 return '<a href="'.htmlspecialchars($url.'&returnUrl='.rawurlencode($retUrl)).'">'.$string.'</a>';
07140 } else {
07141 return '<a href="#" onclick="'.
07142 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;').
07143 '">'.$string.'</a>';
07144 }
07145 }
07146
07160 function editPanelPreviewBorder($table,$row,$content,$thick,$conf=array()) {
07161 if ($this->isDisabled($table,$row)) {
07162 $thick = t3lib_div::intInRange($thick,1,100);
07163 $color = $conf['color'] ? $conf['color'] : '#cccccc';
07164 if ($conf['innerWrap']) $content = $this->wrap($content,$conf['innerWrap']);
07165 if ($conf['innerWrap.']) $content = $this->stdWrap($content,$conf['innerWrap.']);
07166 $content='<table class="typo3-editPanel-previewBorder" border="'.$thick.'" cellpadding="0" cellspacing="0" bordercolor="'.$color.'" width="100%"><tr><td>'.$content.'</td></tr></table>';
07167 if ($conf['outerWrap']) $content = $this->wrap($content,$conf['outerWrap']);
07168 if ($conf['outerWrap.']) $content = $this->stdWrap($panel,$conf['outerWrap.']);
07169 }
07170 return $content;
07171 }
07172
07182 function isDisabled($table,$row) {
07183 global $TCA;
07184 if (
07185 ($TCA[$table]['ctrl']['enablecolumns']['disabled'] && $row[$TCA[$table]['ctrl']['enablecolumns']['disabled']]) ||
07186 ($TCA[$table]['ctrl']['enablecolumns']['fe_group'] && $GLOBALS['TSFE']->simUserGroup && $row[$TCA[$table]['ctrl']['enablecolumns']['fe_group']]==$GLOBALS['TSFE']->simUserGroup) ||
07187 ($TCA[$table]['ctrl']['enablecolumns']['starttime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['starttime']]>time() ) ||
07188 ($TCA[$table]['ctrl']['enablecolumns']['endtime'] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']] && $row[$TCA[$table]['ctrl']['enablecolumns']['endtime']]<time())
07189 ) return true;
07190 }
07191 }
07192
07193
07194
07195
07196
07197
07198
07199
07200
07201
07202
07203
07204
07205
07213 class tslib_frameset {
07214
07223 function make($setup) {
07224 $content = '';
07225 if (is_array($setup)) {
07226 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
07227 reset($sKeyArray);
07228 while(list(,$theKey)=each($sKeyArray)) {
07229 $theValue=$setup[$theKey];
07230 if (intval($theKey) && $conf=$setup[$theKey.'.']) {
07231 switch($theValue) {
07232 case 'FRAME':
07233 $typeNum = intval($GLOBALS['TSFE']->tmpl->setup[$conf['obj'].'.']['typeNum']);
07234 if (!$conf['src'] && !$typeNum) {
07235 $typeNum = -1;
07236 }
07237 $content.='<frame'.$this->frameParams($conf,$typeNum).' />'.chr(10);
07238 break;
07239 case 'FRAMESET':
07240 $frameset = t3lib_div::makeInstance('tslib_frameset');
07241 $content.=$frameset->make($conf).chr(10);
07242 break;
07243 }
07244 }
07245 }
07246 return '<frameset'.$this->framesetParams($setup).'>'.chr(10).$content.'</frameset>';
07247 }
07248 }
07249
07260 function frameParams($setup, $typeNum) {
07261 $paramStr = '';
07262 $name = $setup['obj'];
07263
07264
07265
07266
07267
07268
07269
07270
07271
07272
07273
07274
07275
07276
07277
07278
07279
07280
07281
07282
07283
07284
07285 $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));
07286 $finalURL = $LD['totalURL'];
07287
07288
07289 if ($setup['src']) {$paramStr.=' src="'.htmlspecialchars($setup['src']).'"';} else {$paramStr.=' src="'.htmlspecialchars($finalURL).'"';}
07290 if ($setup['name']) {$paramStr.=' name="'.$setup['name'].'"';} else {$paramStr.=' name="'.$name.'"';}
07291 if ($setup['params']) {$paramStr.=' '.$setup['params'];}
07292 return $paramStr;
07293 }
07294
07303 function framesetParams($setup) {
07304 $paramStr = '';
07305 if ($setup['cols']) { $paramStr.=' cols="'.$setup['cols'].'"'; }
07306 if ($setup['rows']) { $paramStr.=' rows="'.$setup['rows'].'"'; }
07307 if ($setup['params']) { $paramStr.=' '.$setup['params']; }
07308 return $paramStr;
07309 }
07310 }
07311
07312
07313
07314
07315
07316
07317
07318
07319
07320
07321
07322
07323
07324
07325
07326
07327
07336 class tslib_tableOffset {
07337 var $tableParams = 'border="0" cellspacing="0" cellpadding="0"';
07338 var $default_tableParams = 'border="0" cellspacing="0" cellpadding="0"';
07339 var $tdParams = ' width="99%" valign="top"';
07340
07348 function start($content,$offset) {
07349 $valPairs = t3lib_div::intExplode(',',$offset.',,,,,');
07350
07351 if ($valPairs[0] || $valPairs[1] || $valPairs[2] || $valPairs[3] || $valPairs[4] || $valPairs[5]) {
07352
07353 if ($valPairs[4] && $this->default_tableParams==$this->tableParams) {$this->tableParams.=' width="1"';}
07354
07355 $this->begin = chr(10).'<table '.$this->tableParams.'>';
07356 $this->end = '</table>';
07357 $rows=array();
07358 $widthImg = '';
07359 $heightImg = '';
07360
07361 if ($valPairs[4]) {
07362 if (!$valPairs[3]) $valPairs[3]=1;
07363 $widthImg='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$valPairs[4].'" height="1" alt="" title="" />';
07364 }
07365
07366 if ($valPairs[5]) {
07367 if (!$valPairs[2]) $valPairs[2]=1;
07368 $valPairs[2]=1; $heightImg='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$valPairs[5].'" alt="" title="" />';
07369 }
07370
07371
07372 if ($valPairs[1]) {
07373 $rows[1].= '<tr>';
07374 $rows[1].= '<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($valPairs[0]?$valPairs[0]:1).'" height="'.$valPairs[1].'" alt="" title="" /></td>';
07375 if ($valPairs[0]) $rows[1].= '<td></td>';
07376 if ($valPairs[2]) $rows[1].= '<td></td>';
07377 $rows[1].= '</tr>';
07378 }
07379
07380 $rows[2].= '<tr>';
07381 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>';}
07382 $rows[2].= '<td'.$this->tdParams.'>'.$content.'</td>';
07383 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>';}
07384 $rows[2].= '</tr>';
07385
07386 if ($valPairs[3]) {
07387 $rows[3].= '<tr>';
07388 if ($valPairs[0]) $rows[3].= '<td></td>';
07389 if ($valPairs[2]) $rows[3].= '<td>'.$widthImg.'</td>';
07390 $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>';
07391 $rows[3].= '</tr>';
07392 }
07393 return $this->begin.implode('',$rows).$this->end;
07394 } else return $content;
07395 }
07396 }
07397
07398
07399
07400
07401
07402
07403
07404
07405
07406
07407
07408
07409
07410
07411
07412
07413
07414
07415
07416
07417
07426 class tslib_controlTable {
07427 var $offX = 0;
07428 var $offY = 0;
07429
07430 var $tm = '';
07431 var $lm = '';
07432 var $rm = '';
07433 var $bm = '';
07434 var $content = '';
07435
07436 var $tmTDparams = 'valign="top"';
07437 var $lmTDparams = 'valign="top"';
07438 var $rmTDparams = 'valign="top"';
07439 var $bmTDparams = 'valign="top"';
07440 var $contentTDparams = 'valign="top"';
07441
07442 var $cMl = 1;
07443 var $cMr = 1;
07444 var $cMt = 0;
07445 var $cMb = 1;
07446
07447 var $contentW = 0;
07448
07449 var $tableParams = 'border="0" cellspacing="0" cellpadding="0"';
07450
07461 function start($offset,$cMargins) {
07462 $offArr = t3lib_div::intExplode(',',$offset);
07463 $cMargArr = t3lib_div::intExplode(',',$cMargins);
07464
07465 $cols = 0;
07466 $rows = 0;
07467
07468 if ($this->lm) $cols++;
07469 if ($this->rm) $cols++;
07470 if ($cMargArr[0]) $cols++;
07471 if ($cMargArr[2]) $cols++;
07472 if ($cMargArr[1]||$cMargArr[3]||$this->tm||$this->bm||$this->content||$this->contentW) $cols++;
07473
07474 if ($cMargArr[1]) $rows++;
07475 if ($cMargArr[3]) $rows++;
07476 if ($this->tm) $rows++;
07477 if ($this->bm) $rows++;
07478 if ($this->content) $rows++;
07479 if ($this->contentW) $rows++;
07480 if (!$rows && $cols) $rows=1;
07481
07482 if ($rows&&$cols) {
07483 $res = chr(10).'<table '.$this->tableParams.'>';
07484
07485 if ($offArr[1]) {
07486 $xoff = $offArr[0] ? 1 : 0;
07487 if ($cols+$xoff > 1) {$colspan =' colspan="'.($cols+$xoff).'"';}
07488 $res.= '<tr><td'.$colspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$offArr[1].'" alt="" title="" /></td></tr>';
07489 }
07490
07491 if ($rows>1) {$rowspan =' rowspan="'.($rows).'"';}
07492 $res.= '<tr>';
07493 if ($offArr[0]) { $res.='<td'.$rowspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$offArr[0].'" alt="" title="" /></td>'; }
07494 if ($this->lm) { $res.='<td'.$rowspan.' '.$this->lmTDparams.'>'.$this->lm.'</td>'; }
07495 if ($cMargArr[0]) { $res.='<td'.$rowspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$cMargArr[0].'" alt="" title="" /></td>'; }
07496
07497
07498 $middle=Array();
07499 if ($this->tm) { $middle[]='<td '.$this->tmTDparams.'>'.$this->tm.'</td>';}
07500 if ($cMargArr[1]) { $middle[]='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$cMargArr[1].'" alt="" title="" /></td>';}
07501 if ($this->content) { $middle[]='<td '.$this->contentTDparams.'>'.$this->content.'</td>';}
07502 if ($cMargArr[3]) { $middle[]='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$cMargArr[3].'" alt="" title="" /></td>';}
07503 if ($this->bm) { $middle[]='<td '.$this->bmTDparams.'>'.$this->bm.'</td>';}
07504 if ($this->contentW) { $middle[]='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$this->contentW.'" alt="" title="" /></td>';}
07505 if (isset($middle[0])) {$res.=$middle[0];}
07506
07507
07508 if ($cMargArr[2]) { $res.='<td'.$rowspan.'><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" height="1" width="'.$cMargArr[2].'" alt="" title="" /></td>'; }
07509 if ($this->rm) { $res.='<td'.$rowspan.' '.$this->rmTDparams.'>'.$this->rm.'</td>'; }
07510 $res.= '</tr>';
07511
07512
07513 $mCount = count($middle);
07514 for($a=1;$a<$mCount;$a++) {
07515 $res.='<tr>'.$middle[$a].'</tr>';
07516 }
07517 $res.='</table>';
07518 return $res;
07519 }
07520 }
07521 }
07522
07523
07524
07525
07526
07527 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']) {
07528 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']);
07529 }
07530 ?>