00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00218
00219 require_once(PATH_t3lib."class.t3lib_parsehtml.php");
00220
00221
00222 if(t3lib_extMgm::isLoaded('obts')) {
00223 require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php');
00224 }
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00256 class tslib_cObj {
00257 var $align = Array ('center', 'right', 'left');
00258
00269 var $image_compression = Array(
00270 10 => Array('params'=>'', 'ext'=>'gif'),
00271 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
00272 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
00273 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
00274 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
00275 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
00276
00277 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
00278 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
00279 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
00280 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
00281 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
00282 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
00283 39 => Array('params'=>'', 'ext'=>'png'),
00284
00285 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
00286 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
00287 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
00288 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
00289 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
00290 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
00291 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
00292 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
00293 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
00294 );
00295
00301 var $image_effects = Array(
00302 1 => '-rotate 90',
00303 2 => '-rotate 270',
00304 3 => '-rotate 180',
00305 10 => '-colorspace GRAY',
00306 11 => '-sharpen 70',
00307 20 => '-normalize',
00308 23 => '-contrast',
00309 25 => '-gamma 1.3',
00310 26 => '-gamma 0.8'
00311 );
00312
00320 var $data = Array();
00321 var $oldData = Array();
00322 var $alternativeData ='';
00323 var $parameters = Array();
00324 var $currentValKey = 'currentValue_kidjls9dksoje';
00325 var $currentRecord = '';
00326 var $currentRecordTotal = 0;
00327 var $currentRecordNumber = 0;
00328 var $parentRecordNumber = 0;
00329 var $parentRecord = array();
00330 var $regObj;
00331
00332
00333 var $INT_include=0;
00334 var $checkPid_cache = Array();
00335 var $checkPid_badDoktypeList = '255';
00336 var $lastTypoLinkUrl='';
00337 var $lastTypoLinkTarget='';
00338 var $substMarkerCache=array();
00339 var $recordRegister=array();
00340 var $cObjHookObjectsArr = array();
00341
00351 function start($data,$table='') {
00352 global $TYPO3_CONF_VARS;
00353 $this->data = $data;
00354 $this->currentRecord = $table ? $table.':'.$this->data['uid'] : '';
00355 $this->parameters = Array();
00356 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) {
00357 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) {
00358 $this->cObjHookObjectsArr[$classArr[0]] = &t3lib_div::getUserObj($classArr[1]);
00359 }
00360 }
00361 }
00362
00372 function setParent($data,$currentRecord) {
00373 $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord);
00374 }
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00397 function getCurrentVal() {
00398 return $this->data[$this->currentValKey];
00399 }
00400
00408 function setCurrentVal($value) {
00409 $this->data[$this->currentValKey] = $value;
00410 }
00411
00421 function cObjGet($setup,$addKey='') {
00422 if (is_array($setup)) {
00423 $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
00424 $content ='';
00425 foreach($sKeyArray as $theKey) {
00426 $theValue=$setup[$theKey];
00427 if (intval($theKey) && !strstr($theKey,'.')) {
00428 $conf=$setup[$theKey.'.'];
00429 $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey);
00430 }
00431 }
00432 return $content;
00433 }
00434 }
00435
00445 function cObjGetSingle($name,$conf,$TSkey='__') {
00446 $content='';
00447
00448 $GLOBALS['TSFE']->cObjectDepthCounter--;
00449 if ($GLOBALS['TSFE']->cObjectDepthCounter>0) {
00450 $name = trim($name);
00451 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name);
00452
00453
00454 if (substr($name,0,1)=='<') {
00455 $key = trim(substr($name,1));
00456 $cF = t3lib_div::makeInstance('t3lib_TSparser');
00457
00458 $old_conf=$conf;
00459 list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
00460 if (is_array($old_conf) && count($old_conf)) {
00461 $conf = $this->joinTSarrays($conf,$old_conf);
00462
00463 }
00464
00465 $GLOBALS['TT']->incStackPointer();
00466 $content.=$this->cObjGetSingle($name,$conf,$key);
00467 $GLOBALS['TT']->decStackPointer();
00468 } else {
00469
00470 $hooked = false;
00471
00472 foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) {
00473 if (($name===$cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) {
00474 $content.= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
00475 $hooked = true;
00476 }
00477 }
00478 if (!$hooked && t3lib_extMgm::isLoaded('obts') && isset($GLOBALS['OBTS']['tso_list'][$name])) {
00479 $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this);
00480 } elseif (!$hooked) {
00481
00482 switch($name) {
00483 case 'COBJ_ARRAY':
00484 case 'COA':
00485 $content.=$this->COBJ_ARRAY($conf);
00486 break;
00487 case 'COA_INT':
00488 $content.=$this->COBJ_ARRAY($conf,'INT');
00489 break;
00490 case 'HTML':
00491 $content.=$this->HTML($conf);
00492 break;
00493 case 'TEXT':
00494 $content.=$this->TEXT($conf);
00495 break;
00496 case 'CLEARGIF':
00497 $content.=$this->CLEARGIF($conf);
00498 break;
00499 case 'FILE':
00500 $content.=$this->FILE($conf);
00501 break;
00502 case 'IMAGE':
00503 $content.=$this->IMAGE($conf);
00504 break;
00505 case 'IMG_RESOURCE':
00506 $content.=$this->IMG_RESOURCE($conf);
00507 break;
00508 case 'IMGTEXT':
00509 $content.=$this->IMGTEXT($conf);
00510 break;
00511 case 'CONTENT':
00512 $content.=$this->CONTENT($conf);
00513 break;
00514 case 'RECORDS':
00515 $content.=$this->RECORDS($conf);
00516 break;
00517 case 'HMENU':
00518 $content.=$this->HMENU($conf);
00519 break;
00520 case 'CTABLE':
00521 $content.=$this->CTABLE($conf);
00522 break;
00523 case 'OTABLE':
00524 $content.=$this->OTABLE($conf);
00525 break;
00526 case 'COLUMNS':
00527 $content.=$this->COLUMNS($conf);
00528 break;
00529 case 'HRULER':
00530 $content.=$this->HRULER($conf);
00531 break;
00532 case 'CASE':
00533 $content.=$this->CASEFUNC($conf);
00534 break;
00535 case 'LOAD_REGISTER':
00536 case 'RESTORE_REGISTER':
00537 $this->LOAD_REGISTER($conf,$name);
00538 break;
00539 case 'FORM':
00540 $content.=$this->FORM($conf);
00541 break;
00542 case 'SEARCHRESULT':
00543 $content.=$this->SEARCHRESULT($conf);
00544 break;
00545 case 'PHP_SCRIPT':
00546 $content.=$this->PHP_SCRIPT($conf);
00547 break;
00548 case 'PHP_SCRIPT_EXT':
00549 $content.=$this->PHP_SCRIPT($conf,'EXT');
00550 break;
00551 case 'PHP_SCRIPT_INT':
00552 $content.=$this->PHP_SCRIPT($conf,'INT');
00553 break;
00554 case 'USER':
00555 $content.=$this->USER($conf);
00556 break;
00557 case 'USER_INT':
00558 $content.=$this->USER($conf,'INT');
00559 break;
00560 case 'TEMPLATE':
00561 $content.=$this->TEMPLATE($conf);
00562 break;
00563 case 'EDITPANEL':
00564 if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);}
00565 break;
00566 case 'MULTIMEDIA':
00567 $content.=$this->MULTIMEDIA($conf);
00568 break;
00569 }
00570 }
00571 }
00572 if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content);
00573 }
00574
00575 $GLOBALS['TSFE']->cObjectDepthCounter++;
00576 return $content;
00577 }
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00598 function HTML($conf) {
00599 return $this->stdWrap($conf['value'],$conf['value.']);
00600 }
00601
00609 function TEXT($conf) {
00610 return $this->stdWrap($conf['value'],$conf);
00611 }
00612
00620 function CLEARGIF($conf) {
00621 $w = $this->stdWrap($conf['width'],$conf['width.']);
00622 $h = $this->stdWrap($conf['height'],$conf['height.']);
00623 $w = $w ? $w : 1;
00624 $h = $h ? $h : 1;
00625 $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />';
00626 $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap);
00627
00628 return $this->stdWrap($theValue,$conf['stdWrap.']);
00629 }
00630
00639 function COBJ_ARRAY($conf,$ext='') {
00640 $content='';
00641 switch($ext) {
00642 case 'INT':
00643 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00644 $content.='<!--'.$substKey.'-->';
00645 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00646 'file'=>$incFile,
00647 'conf'=>$conf,
00648 'cObj'=>serialize($this),
00649 'type'=>'COA'
00650 );
00651 break;
00652 default:
00653 if ($this->checkIf($conf['if.'])) {
00654 $content=$this->cObjGet($conf);
00655 if ($conf['wrap']) {
00656 $content=$this->wrap($content, $conf['wrap']);
00657 }
00658 if ($conf['stdWrap.']) {
00659 $content=$this->stdWrap($content, $conf['stdWrap.']);
00660 }
00661 }
00662 break;
00663 }
00664 return $content;
00665 }
00666
00675 function USER($conf,$ext='') {
00676 $content='';
00677 switch($ext) {
00678 case 'INT':
00679 $substKey = $ext.'_SCRIPT.'.$GLOBALS['TSFE']->uniqueHash();
00680 $content.='<!--'.$substKey.'-->';
00681 $GLOBALS['TSFE']->config[$ext.'incScript'][$substKey] = array(
00682 'file' => $incFile,
00683 'conf' => $conf,
00684 'cObj' => serialize($this),
00685 'type' => 'FUNC'
00686 );
00687 break;
00688 default:
00689 $content.=$this->callUserFunction($conf['userFunc'],$conf,'');
00690 break;
00691 }
00692 return $content;
00693 }
00694
00702 function FILE($conf) {
00703 $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf, false)));
00704 if ($conf['linkWrap']) {
00705 $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
00706 }
00707 return $this->wrap($theValue,$conf['wrap']);
00708 }
00709
00718 function IMAGE($conf) {
00719 $content='';
00720 if ($this->checkIf($conf['if.'])) {
00721 $theValue = $this->cImage($conf['file'],$conf);
00722 if ($conf['stdWrap.']) {
00723 $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
00724 }
00725 return $theValue;
00726 }
00727 }
00728
00737 function IMG_RESOURCE($conf) {
00738 $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'],$conf['file.']);
00739 return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3],$conf['stdWrap.']);
00740 }
00741
00749 function IMGTEXT($conf) {
00750 $content='';
00751 if (is_array($conf['text.'])) {
00752 $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']);
00753 }
00754 $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.']));
00755 if ($imgList) {
00756 $imgs = t3lib_div::trimExplode(',',$imgList);
00757 $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
00758
00759 $imgCount= count($imgs)-$imgStart;
00760
00761 $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
00762 if ($imgMax) {
00763 $imgCount = t3lib_div::intInRange($imgCount,0,$conf['imgMax']);
00764 }
00765
00766 $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
00767
00768
00769 $caption='';
00770 $captionArray = array();
00771 if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
00772 $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);
00773 }
00774 if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
00775 $legacyCaptionSplit = 1;
00776 $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
00777 if (!$capSplit) {$capSplit=chr(10);}
00778 $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
00779 while (list($ca_key, $ca_val) = each($captionArray)) {
00780 $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
00781 }
00782 }
00783
00784 $tablecode='';
00785 $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
00786
00787 $tmppos = $position&7;
00788 $contentPosition = $position&24;
00789 $align = $this->align[$tmppos];
00790 $cap = ($caption)?1:0;
00791 $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
00792 if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
00793 $txtMarg=0;
00794 }
00795
00796 $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
00797 $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
00798 $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
00799 $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
00800
00801 $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
00802 $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
00803 $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
00804
00805 $borderColor=$borderColor?$borderColor:'black';
00806 $borderThickness=$borderThickness?$borderThickness:1;
00807
00808 $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
00809 if (!$caption_align) {
00810 $caption_align = $align;
00811 }
00812
00813 $colCount = ($cols > 1) ? $cols : 1;
00814 if ($colCount > $imgCount) {$colCount = $imgCount;}
00815 $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
00816
00817 if ($rows>1) {
00818 $rowCount = $rows;
00819 if ($rowCount > $imgCount) {$rowCount = $imgCount;}
00820 $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
00821 }
00822
00823
00824 $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
00825 $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
00826
00827 $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
00828 if (!$maxWInText) {
00829 $maxWInText = round($maxW/2);
00830 }
00831
00832 if ($maxWInText && $contentPosition>=16) {
00833 $maxW = $maxWInText;
00834 }
00835
00836 if ($maxW && $colCount > 0) {
00837
00838
00839
00840
00841
00842 $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
00843 }
00844
00845 $colMaxW = Array();
00846 if ($colRelations) {
00847 $rel_parts = explode(':',$colRelations);
00848 $rel_total = 0;
00849 for ($a=0;$a<$colCount;$a++) {
00850 $rel_parts[$a] = intval($rel_parts[$a]);
00851 $rel_total+= $rel_parts[$a];
00852 }
00853 if ($rel_total) {
00854 for ($a=0;$a<$colCount;$a++) {
00855 $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
00856 }
00857 if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) {
00858 $colMaxW = Array();
00859 }
00860 }
00861 }
00862 $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
00863 $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
00864 $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
00865
00866
00867 $splitArr=array();
00868 $splitArr['imgObjNum']=$conf['imgObjNum'];
00869 $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
00870
00871
00872 $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
00873 if ($equalHeight) {
00874 $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
00875 $gifCreator->init();
00876 $relations = Array();
00877 $relations_cols = Array();
00878 $totalMaxW = $maxW*$colCount;
00879 for($a=0;$a<$imgCount;$a++) {
00880 $imgKey = $a+$imgStart;
00881 $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
00882 $relations[$a] = $imgInfo[1] / $equalHeight;
00883 if ($relations[$a]) {
00884 $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a];
00885 }
00886 }
00887 }
00888
00889 $imageRowsFinalWidths = Array();
00890 $imageRowsMaxHeights = Array();
00891 $imgsTag=array();
00892 $origImages=array();
00893 for($a=0;$a<$imgCount;$a++) {
00894 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
00895 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
00896
00897 $imgKey = $a+$imgStart;
00898 $totalImagePath = $imgPath.$imgs[$imgKey];
00899 $this->data[$this->currentValKey] = $totalImagePath;
00900 $imgObjNum = intval($splitArr[$a]['imgObjNum']);
00901 $imgConf = $conf[$imgObjNum.'.'];
00902
00903 if ($equalHeight) {
00904 $scale = 1;
00905 if ($totalMaxW) {
00906 $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
00907 if ($rowTotalMaxW > $totalMaxW) {
00908 $scale = $rowTotalMaxW / $totalMaxW;
00909 }
00910 }
00911
00912 $imgConf['file.']['height'] = round($equalHeight/$scale);
00913
00914 unset($imgConf['file.']['width']);
00915 unset($imgConf['file.']['maxW']);
00916 unset($imgConf['file.']['maxH']);
00917 unset($imgConf['file.']['minW']);
00918 unset($imgConf['file.']['minH']);
00919 unset($imgConf['file.']['width.']);
00920 unset($imgConf['file.']['maxW.']);
00921 unset($imgConf['file.']['maxH.']);
00922 unset($imgConf['file.']['minW.']);
00923 unset($imgConf['file.']['minH.']);
00924 $maxW = 0;
00925 }
00926
00927 if ($maxW) {
00928 if (count($colMaxW)) {
00929 $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
00930 } else {
00931 $imgConf['file.']['maxW'] = $maxW;
00932 }
00933 }
00934
00935
00936 if (is_array($imgConf)) {
00937 if ($this->image_effects[$image_effects]) {
00938 $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
00939 }
00940 if ($image_frames) {
00941 if (is_array($conf['image_frames.'][$image_frames.'.'])) {
00942 $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
00943 }
00944 }
00945 if ($image_compression && $imgConf['file']!='GIFBUILDER') {
00946 if ($image_compression==1) {
00947 $tempImport = $imgConf['file.']['import'];
00948 $tempImport_dot = $imgConf['file.']['import.'];
00949 unset($imgConf['file.']);
00950 $imgConf['file.']['import'] = $tempImport;
00951 $imgConf['file.']['import.'] = $tempImport_dot;
00952 } elseif (isset($this->image_compression[$image_compression])) {
00953 $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
00954 $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
00955 unset($imgConf['file.']['ext.']);
00956 }
00957 }
00958
00959
00960 if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
00961 $imgConf['altText'] = $conf['altText'];
00962 $imgConf['altText.'] = $conf['altText.'];
00963 }
00964 if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
00965 $imgConf['titleText'] = $conf['titleText'];
00966 $imgConf['titleText.'] = $conf['titleText.'];
00967 }
00968 if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
00969 $imgConf['longdescURL'] = $conf['longdescURL'];
00970 $imgConf['longdescURL.'] = $conf['longdescURL.'];
00971 }
00972 } else {
00973 $imgConf = array(
00974 'altText' => $conf['altText'],
00975 'titleText' => $conf['titleText'],
00976 'longdescURL' => $conf['longdescURL'],
00977 'file' => $totalImagePath
00978 );
00979 }
00980
00981 $imgsTag[$imgKey] = $this->IMAGE($imgConf);
00982
00983
00984 $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
00985
00986 $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
00987 if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
00988 $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
00989 }
00990 }
00991
00992
00993 $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
00994
00995
00996 $index=$imgStart;
00997
00998 $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
00999 $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
01000 if ($noRows) {$noCols=0;}
01001 if ($equalHeight) {
01002 $noCols=1;
01003 $noRows=0;
01004 }
01005
01006 $rowCount_temp=1;
01007 $colCount_temp=$colCount;
01008 if ($noRows) {
01009 $rowCount_temp = $rowCount;
01010 $rowCount=1;
01011 }
01012 if ($noCols) {
01013 $colCount=1;
01014 }
01015
01016 $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
01017 $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
01018
01019
01020
01021 $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
01022
01023
01024 $tablecode='';
01025 $flag=0;
01026 if ($conf['noStretchAndMarginCells']!=1) {
01027 $tablecode.='<tr>';
01028 if ($txtMarg && $align=='right') {
01029 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01030 $editIconsHTML='';
01031 $flag=1;
01032 }
01033 $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
01034 if ($txtMarg && $align=='left') {
01035 $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
01036 $editIconsHTML='';
01037 $flag=1;
01038 }
01039 if ($flag) $tableWidth+=$txtMarg+1;
01040
01041 $tablecode.='</tr>';
01042 }
01043
01044
01045 for ($c=0;$c<$rowCount;$c++) {
01046 if ($c && $rowspacing) {
01047 $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
01048 }
01049 $tablecode.='<tr>';
01050 for ($b=0; $b<$colCount_temp; $b++) {
01051 if ($b && $colspacing) {
01052 if (!$noCols) {
01053 $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
01054 } else {
01055 $colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($border?$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+($border?$borderThickness*2:0)).'"'.$this->getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />';
01056 $colSpacer='<td valign="top">'.$colSpacer.'</td>';
01057 $tablecode.=$colSpacer;
01058 }
01059 }
01060 if (!$noCols || ($noCols && !$b)) {
01061 $tablecode.='<td valign="top">';
01062 if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';}
01063 }
01064 for ($a=0;$a<$rowCount_temp;$a++) {
01065 $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;
01066 $imgIndex = $index+$a*$colCount_temp;
01067 $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
01068 if ($imgsTag[$imgIndex]) {
01069 if ($rowspacing && $noRows && $a) {
01070 $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
01071 }
01072 if ($legacyCaptionSplit) {
01073 $thisCaption = $captionArray[$imgIndex];
01074 } else if ($conf['captionSplit'] || $conf['imageTextSplit']) {
01075 $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
01076 }
01077 $imageHTML = $imgsTag[$imgIndex].'<br />';
01078 $Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : '';
01079 if ($border) {$imageHTML='<table border="0" cellpadding="'.$borderThickness.'" cellspacing="0" bgcolor="'.$borderColor.'"'.$Talign.'><tr><td>'.$imageHTML.'</td></tr></table>';}
01080 $imageHTML.=$editIconsHTML;
01081 $editIconsHTML='';
01082 $imageHTML.=$thisCaption;
01083 if ($noCols) {$imageHTML='<td valign="top">'.$imageHTML.'</td>';}
01084 $tablecode.=$imageHTML;
01085 }
01086 }
01087 $index++;
01088 if (!$noCols || ($noCols && $b+1==$colCount_temp)) {
01089 if ($noCols) {$tablecode.='</tr></table>';}
01090 $tablecode.='</td>';
01091 }
01092 }
01093 $tablecode.='</tr>';
01094 }
01095 if ($c) {
01096 switch ($contentPosition) {
01097 case '0':
01098 case '8':
01099 switch ($align) {
01100 case 'center':
01101 $table_align = 'margin-left: auto; margin-right: auto';
01102 break;
01103 case 'right':
01104 $table_align = 'margin-left: auto; margin-right: 0px';
01105 break;
01106 default:
01107 $table_align = 'margin-left: 0px; margin-right: auto';
01108 }
01109 $table_align = 'style="'.$table_align.'"';
01110 break;
01111 case '16':
01112 $table_align = 'align="'.$align.'"';
01113 break;
01114 default:
01115 $table_align = '';
01116 }
01117
01118
01119 $tablecode = '<table'.($tableWidth?' width="'.$tableWidth.'"':'').' border="0" cellspacing="0" cellpadding="0" '.$table_align.' class="imgtext-table">'.$tablecode;
01120 if ($editIconsHTML) {
01121 $tablecode.='<tr><td colspan="'.$colspan.'">'.$editIconsHTML.'</td></tr>';
01122 $editIconsHTML='';
01123 }
01124 if ($cap) {
01125 $tablecode.='<tr><td colspan="'.$colspan.'" align="'.$caption_align.'">'.$caption.'</td></tr>';
01126 }
01127 $tablecode.='</table>';
01128 if ($conf['tableStdWrap.']) {$tablecode=$this->stdWrap($tablecode,$conf['tableStdWrap.']);}
01129 }
01130
01131 $spaceBelowAbove = intval($this->stdWrap($conf['spaceBelowAbove'],$conf['spaceBelowAbove.']));
01132 switch ($contentPosition) {
01133 case '0':
01134 $output= '<div style="text-align:'.$align.';">'.$tablecode.'</div>'.$this->wrapSpace($content, $spaceBelowAbove.'|0');
01135 break;
01136 case '8':
01137 $output= $this->wrapSpace($content, '0|'.$spaceBelowAbove).'<div style="text-align:'.$align.';">'.$tablecode.'</div>';
01138 break;
01139 case '16':
01140 $output= $tablecode.$content;
01141 break;
01142 case '24':
01143 $theResult = '';
01144 $theResult.= '<table border="0" cellspacing="0" cellpadding="0" class="imgtext-nowrap"><tr>';
01145 if ($align=='right') {
01146 $theResult.= '<td valign="top">'.$content.'</td><td valign="top">'.$tablecode.'</td>';
01147 } else {
01148 $theResult.= '<td valign="top">'.$tablecode.'</td><td valign="top">'.$content.'</td>';
01149 }
01150 $theResult.= '</tr></table>';
01151 $output= $theResult;
01152 break;
01153 }
01154 } else {
01155 $output= $content;
01156 }
01157
01158 if ($conf['stdWrap.']) {
01159 $output = $this->stdWrap($output, $conf['stdWrap.']);
01160 }
01161
01162 return $output;
01163 }
01164
01172 function CONTENT($conf) {
01173 $theValue='';
01174
01175 $originalRec = $GLOBALS['TSFE']->currentRecord;
01176 if ($originalRec) {
01177 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01178 }
01179
01180 if ($conf['table']=='pages' || substr($conf['table'],0,3)=='tt_' || substr($conf['table'],0,3)=='fe_' || substr($conf['table'],0,3)=='tx_' || substr($conf['table'],0,4)=='ttx_' || substr($conf['table'],0,5)=='user_') {
01181
01182 $renderObjName = $conf['renderObj'] ? $conf['renderObj'] : '<'.$conf['table'];
01183 $renderObjKey = $conf['renderObj'] ? 'renderObj' : '';
01184 $renderObjConf = $conf['renderObj.'];
01185
01186 $slide = intval($conf['slide'])?intval($conf['slide']):0;
01187 $slideCollect = intval($conf['slide.']['collect'])?intval($conf['slide.']['collect']):0;
01188 $slideCollectReverse = intval($conf['slide.']['collectReverse'])?true:false;
01189 $slideCollectFuzzy = $slideCollect?(intval($conf['slide.']['collectFuzzy'])?true:false):true;
01190 $again = false;
01191
01192 do {
01193 $res = $this->exec_getQuery($conf['table'],$conf['select.']);
01194 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
01195 $GLOBALS['TT']->setTSlogMessage($error,3);
01196 } else {
01197 $this->currentRecordTotal = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01198 $GLOBALS['TT']->setTSlogMessage('NUMROWS: '.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
01199 $cObj =t3lib_div::makeInstance('tslib_cObj');
01200 $cObj->setParent($this->data,$this->currentRecord);
01201 $this->currentRecordNumber=0;
01202 $cobjValue = '';
01203 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
01204
01205
01206 $GLOBALS['TSFE']->sys_page->versionOL($conf['table'],$row);
01207
01208
01209 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01210 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01211 }
01212
01213 if (is_array($row)) {
01214 if (!$GLOBALS['TSFE']->recordRegister[$conf['table'].':'.$row['uid']]) {
01215 $this->currentRecordNumber++;
01216 $cObj->parentRecordNumber = $this->currentRecordNumber;
01217 $GLOBALS['TSFE']->currentRecord = $conf['table'].':'.$row['uid'];
01218 $this->lastChanged($row['tstamp']);
01219 $cObj->start($row,$conf['table']);
01220 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01221 $cobjValue .= $tmpValue;
01222 }# else debug($GLOBALS['TSFE']->recordRegister,'CONTENT');
01223 }
01224 }
01225 }
01226 if ($slideCollectReverse) {
01227 $theValue = $cobjValue.$theValue;
01228 } else {
01229 $theValue .= $cobjValue;
01230 }
01231 if ($slideCollect>0) {
01232 $slideCollect--;
01233 }
01234 if ($slide) {
01235 if ($slide>0) {
01236 $slide--;
01237 }
01238 $conf['select.']['pidInList'] = $this->getSlidePids($conf['select.']['pidInList'], $conf['select.']['pidInList.']);
01239 $again = strlen($conf['select.']['pidInList'])?true:false;
01240 }
01241 } while ($again&&(($slide&&!strlen($tmpValue)&&$slideCollectFuzzy)||($slide&&$slideCollect)));
01242 }
01243
01244 $theValue = $this->wrap($theValue,$conf['wrap']);
01245 if ($conf['stdWrap.']) $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
01246
01247 $GLOBALS['TSFE']->currentRecord = $originalRec;
01248 return $theValue;
01249 }
01250
01258 function RECORDS($conf) {
01259 $theValue='';
01260
01261 $originalRec = $GLOBALS['TSFE']->currentRecord;
01262 if ($originalRec) {
01263 $GLOBALS['TSFE']->recordRegister[$originalRec]++;
01264 }
01265
01266 $conf['source'] = $this->stdWrap($conf['source'],$conf['source.']);
01267 if ($conf['tables'] && $conf['source']) {
01268 $allowedTables = $conf['tables'];
01269 if (is_array($conf['conf.'])) {
01270 reset($conf['conf.']);
01271 while(list($k)=each($conf['conf.'])) {
01272 if (substr($k,-1)!='.') $allowedTables.=','.$k;
01273 }
01274 }
01275
01276 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
01277 $loadDB->start($conf['source'], $allowedTables);
01278 reset($loadDB->tableArray);
01279 while(list($table,)=each($loadDB->tableArray)) {
01280 if (is_array($GLOBALS['TCA'][$table])) {
01281 $loadDB->additionalWhere[$table]=$this->enableFields($table);
01282 }
01283 }
01284 $loadDB->getFromDB();
01285
01286 reset($loadDB->itemArray);
01287 $data = $loadDB->results;
01288
01289 $cObj =t3lib_div::makeInstance('tslib_cObj');
01290 $cObj->setParent($this->data,$this->currentRecord);
01291 $this->currentRecordNumber=0;
01292 $this->currentRecordTotal = count($loadDB->itemArray);
01293 reset($loadDB->itemArray);
01294 while(list(,$val)=each($loadDB->itemArray)) {
01295 $row = $data[$val['table']][$val['id']];
01296
01297
01298 $GLOBALS['TSFE']->sys_page->versionOL($val['table'],$row);
01299
01300
01301 if (is_array($row) && $GLOBALS['TSFE']->sys_language_contentOL) {
01302 $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'],$row,$GLOBALS['TSFE']->sys_language_content,$GLOBALS['TSFE']->sys_language_contentOL);
01303 }
01304
01305 if (is_array($row)) {
01306 if (!$conf['dontCheckPid']) {
01307 $row = $this->checkPid($row['pid']) ? $row : '';
01308 }
01309 if ($row && !$GLOBALS['TSFE']->recordRegister[$val['table'].':'.$val['id']]) {
01310 $renderObjName = $conf['conf.'][$val['table']] ? $conf['conf.'][$val['table']] : '<'.$val['table'];
01311 $renderObjKey = $conf['conf.'][$val['table']] ? 'conf.'.$val['table'] : '';
01312 $renderObjConf = $conf['conf.'][$val['table'].'.'];
01313 $this->currentRecordNumber++;
01314 $cObj->parentRecordNumber=$this->currentRecordNumber;
01315 $GLOBALS['TSFE']->currentRecord = $val['table'].':'.$val['id'];
01316 $this->lastChanged($row['tstamp']);
01317 $cObj->start($row,$val['table']);
01318 $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
01319 $theValue .= $tmpValue;
01320 }# else debug($GLOBALS['TSFE']->recordRegister,'RECORDS');
01321 }
01322 }
01323 }
01324 if ($conf['wrap']) $theValue = $this->wrap($theValue,$conf['wrap']);
01325