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
00143 class tslib_menu {
00144 var $menuNumber = 1;
00145 var $entryLevel = 0;
00146 var $spacerIDList = '199';
00147 var $doktypeExcludeList = '5,6';
00148 var $alwaysActivePIDlist=array();
00149 var $imgNamePrefix = 'img';
00150 var $imgNameNotRandom=0;
00151 var $debug = 0;
00152 var $parent_cObj ='';
00153 var $GMENU_fixKey='gmenu';
00154 var $MP_array=array();
00155
00156
00157 var $conf = Array();
00158 var $mconf = Array();
00159 var $tmpl;
00160 var $sys_page;
00161 var $id;
00162 var $nextActive;
00163 var $menuArr;
00164 var $hash;
00165 var $result = Array();
00166 var $rL_uidRegister = '';
00167 var $INPfixMD5;
00168 var $I;
00169 var $WMresult;
00170 var $WMfreezePrefix;
00171 var $WMmenuItems;
00172 var $WMsubmenuObjSuffixes;
00173 var $WMextraScript;
00174 var $alternativeMenuTempArray='';
00175
00188 function start(&$tmpl,&$sys_page,$id,$conf,$menuNumber,$objSuffix='') {
00189
00190
00191 $this->conf = $conf;
00192 $this->menuNumber = $menuNumber;
00193 $this->mconf = $conf[$this->menuNumber.$objSuffix.'.'];
00194 $this->debug=$GLOBALS['TSFE']->debug;
00195
00196
00197 if ($this->conf[$this->menuNumber.$objSuffix] && is_object($tmpl) && is_object($sys_page)) {
00198 $this->tmpl = &$tmpl;
00199 $this->sys_page = &$sys_page;
00200
00201
00202 if (trim($this->conf['alwaysActivePIDlist'])) {
00203 $this->alwaysActivePIDlist = t3lib_div::intExplode(',', $this->conf['alwaysActivePIDlist']);
00204 }
00205
00206
00207 if($this->conf['excludeDoktypes']) {
00208 $this->doktypeExcludeList = $GLOBALS['TYPO3_DB']->cleanIntList($this->conf['excludeDoktypes']);
00209 }
00210 if($this->conf['includeNotInMenu']) {
00211 $exclDoktypeArr = t3lib_div::trimExplode(',',$this->doktypeExcludeList,1);
00212 $exclDoktypeArr = t3lib_div::removeArrayEntryByValue($exclDoktypeArr,'5');
00213 $this->doktypeExcludeList = implode(',',$exclDoktypeArr);
00214 }
00215
00216
00217 $this->entryLevel = tslib_cObj::getKey ($conf['entryLevel'],$this->tmpl->rootLine);
00218
00219
00220 if ($id) {
00221 $this->id = intval($id);
00222 } else {
00223 $this->id = intval($this->tmpl->rootLine[$this->entryLevel]['uid']);
00224
00225
00226
00227 foreach($this->tmpl->rootLine as $entryLevel => $levelRec) {
00228
00229 if ($levelRec['_MP_PARAM'] && $levelRec['_MOUNT_OL']) {
00230 $this->MP_array[] = $levelRec['_MP_PARAM'];
00231 }
00232
00233 if ($entryLevel>=$this->entryLevel) break;
00234
00235
00236 if ($levelRec['_MP_PARAM'] && !$levelRec['_MOUNT_OL']) {
00237 $this->MP_array[] = $levelRec['_MP_PARAM'];
00238 }
00239 }
00240 }
00241
00242
00243 if ($this->id<=0) {
00244 return FALSE;
00245 }
00246
00247
00248
00249 $mount_info = $this->sys_page->getMountPointInfo($this->id);
00250 if (is_array($mount_info)) {
00251 $this->MP_array[] = $mount_info['MPvar'];
00252 $this->id = $mount_info['mount_pid'];
00253 }
00254
00255
00256
00257 if (!is_array($this->rL_uidRegister)) {
00258 $rl_MParray = array();
00259 foreach($this->tmpl->rootLine as $v_rl) {
00260
00261 if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) {
00262 $rl_MParray[] = $v_rl['_MP_PARAM'];
00263 }
00264
00265
00266 $this->rL_uidRegister[] = 'ITEM:'.$v_rl['uid'].(count($rl_MParray) ? ':'.implode(',',$rl_MParray) : '');
00267
00268
00269 if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) {
00270 $rl_MParray[] = $v_rl['_MP_PARAM'];
00271 }
00272 }
00273 }
00274
00275
00276
00277 if (is_array($this->tmpl->rootLine[$this->entryLevel+$this->menuNumber])) {
00278 $nextMParray = $this->MP_array;
00279 if ($this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['_MOUNT_OL']) {
00280 $nextMParray[] = $this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['_MP_PARAM'];
00281 }
00282 $this->nextActive = $this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['uid'].
00283 (count($nextMParray)?':'.implode(',',$nextMParray):'');
00284 } else {
00285 $this->nextActive = '';
00286 }
00287
00288
00289 if ($this->mconf['imgNamePrefix']) {
00290 $this->imgNamePrefix=$this->mconf['imgNamePrefix'];
00291 }
00292 $this->imgNameNotRandom = $this->mconf['imgNameNotRandom'];
00293
00294 $retVal = TRUE;
00295 } else {
00296 $GLOBALS['TT']->setTSlogMessage('ERROR in menu',3);
00297 $retVal = FALSE;
00298 }
00299 return $retVal;
00300 }
00301
00309 function makeMenu() {
00310 if ($this->id) {
00311
00312
00313 if ($this->mconf['showAccessRestrictedPages']) {
00314
00315 $SAVED_where_groupAccess = $this->sys_page->where_groupAccess;
00316 $this->sys_page->where_groupAccess = '';
00317 }
00318
00319
00320 $temp = array();
00321 $altSortFieldValue = trim($this->mconf['alternativeSortingField']);
00322 $altSortField = $altSortFieldValue ? $altSortFieldValue : 'sorting';
00323 if ($this->menuNumber==1 && $this->conf['special']) {
00324 $value = $this->conf['special.']['value'];
00325
00326 switch($this->conf['special']) {
00327 case 'userdefined':
00328 $temp = $this->includeMakeMenu($this->conf['special.'],$altSortField);
00329 break;
00330 case 'userfunction':
00331 $temp = $this->parent_cObj->callUserFunction(
00332 $this->conf['special.']['userFunc'],
00333 array_merge($this->conf['special.'],array('_altSortField'=>$altSortField)),
00334 ''
00335 );
00336 if (!is_array($temp)) $temp=array();
00337 break;
00338 case 'language':
00339 $temp = array();
00340
00341
00342 $currentPageWithNoOverlay = $this->sys_page->getRawRecord('pages',$GLOBALS['TSFE']->page['uid']);
00343
00344
00345 $languageItems = t3lib_div::intExplode(',',$value);
00346 foreach($languageItems as $sUid) {
00347
00348 if ($sUid) {
00349 $lRecs = $this->sys_page->getPageOverlay($GLOBALS['TSFE']->page['uid'],$sUid);
00350 } else $lRecs=array();
00351
00352 if (
00353 (t3lib_div::hideIfNotTranslated($GLOBALS['TSFE']->page['l18n_cfg']) && $sUid && !count($lRecs))
00354 || ($GLOBALS['TSFE']->page['l18n_cfg']&1 && (!$sUid || !count($lRecs)))
00355 || (!$this->conf['special.']['normalWhenNoLanguage'] && $sUid && !count($lRecs))
00356 ) {
00357 $iState = $GLOBALS['TSFE']->sys_language_uid==$sUid ? 'USERDEF2' : 'USERDEF1';
00358 } else {
00359 $iState = $GLOBALS['TSFE']->sys_language_uid==$sUid ? 'ACT' : 'NO';
00360 }
00361
00362 $temp[] = array_merge(
00363 array_merge($currentPageWithNoOverlay, $lRecs),
00364 array(
00365 'ITEM_STATE' => $iState,
00366 '_ADD_GETVARS' => '&L='.$sUid,
00367 '_SAFE' => TRUE
00368 )
00369 );
00370 }
00371 break;
00372 case 'directory':
00373 if ($value=='') {
00374 $value=$GLOBALS['TSFE']->page['uid'];
00375 }
00376 $items=t3lib_div::intExplode(',',$value);
00377
00378 foreach($items as $id) {
00379 $MP = $this->tmpl->getFromMPmap($id);
00380
00381
00382 $mount_info = $this->sys_page->getMountPointInfo($id);
00383 if (is_array($mount_info)) {
00384 if ($mount_info['overlay']) {
00385 $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']);
00386 $MP = $MP ? $MP : $mount_info['MPvar'];
00387 } else {
00388 $MP = ($MP ? $MP.',' : '').$mount_info['MPvar'];
00389 }
00390 $id = $mount_info['mount_pid'];
00391 }
00392
00393
00394 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>$id,'orderBy'=>$altSortField));
00395 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00396
00397
00398 $mount_info = $this->sys_page->getMountPointInfo($row['uid'], $row);
00399 if (is_array($mount_info) && $mount_info['overlay']) {
00400 $mp_row = $this->sys_page->getPage($mount_info['mount_pid']);
00401 if (count($mp_row)) {
00402 $row = $mp_row;
00403 $row['_MP_PARAM'] = $mount_info['MPvar'];
00404 } else unset($row);
00405 }
00406
00407
00408 if (is_array($row)) {
00409 if ($MP) $row['_MP_PARAM'] = $MP.($row['_MP_PARAM'] ? ','.$row['_MP_PARAM'] : '');
00410 $temp[$row['uid']] = $this->sys_page->getPageOverlay($row);
00411 }
00412 }
00413 }
00414 break;
00415 case 'list':
00416 if ($value=='') {
00417 $value=$this->id;
00418 }
00419 $loadDB = t3lib_div::makeInstance('FE_loadDBGroup');
00420 $loadDB->start($value, 'pages');
00421 $loadDB->additionalWhere['pages']=tslib_cObj::enableFields('pages');
00422 $loadDB->getFromDB();
00423
00424 foreach($loadDB->itemArray as $val) {
00425 $MP = $this->tmpl->getFromMPmap($val['id']);
00426
00427
00428 $mount_info = $this->sys_page->getMountPointInfo($val['id']);
00429 if (is_array($mount_info) && $mount_info['overlay']) {
00430 $mp_row = $this->sys_page->getPage($mount_info['mount_pid']);
00431 if (count($mp_row)) {
00432 $row = $mp_row;
00433 $row['_MP_PARAM'] = $mount_info['MPvar'];
00434
00435 if ($mount_info['overlay']) {
00436 $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']);
00437 if ($MP) unset($row['_MP_PARAM']);
00438 }
00439
00440 } else unset($row);
00441 } else {
00442 $row = $loadDB->results['pages'][$val['id']];
00443 }
00444
00445
00446 if (is_array($row)) {
00447 if ($MP) $row['_MP_PARAM'] = $MP.($row['_MP_PARAM'] ? ','.$row['_MP_PARAM'] : '');
00448 $temp[] = $this->sys_page->getPageOverlay($row);
00449 }
00450 }
00451 break;
00452 case 'updated':
00453 if ($value=='') {
00454 $value=$GLOBALS['TSFE']->page['uid'];
00455 }
00456 $items=t3lib_div::intExplode(',',$value);
00457 if (t3lib_div::testInt($this->conf['special.']['depth'])) {
00458 $depth = t3lib_div::intInRange($this->conf['special.']['depth'],1,20);
00459 } else {
00460 $depth=20;
00461 }
00462 $limit = t3lib_div::intInRange($this->conf['special.']['limit'],0,100);
00463 $maxAge = intval(tslib_cObj::calc($this->conf['special.']['maxAge']));
00464 if (!$limit) $limit=10;
00465 $mode = $this->conf['special.']['mode'];
00466
00467 $id_list_arr = Array();
00468
00469 foreach($items as $id) {
00470 $bA = t3lib_div::intInRange($this->conf['special.']['beginAtLevel'],0,100);
00471 $id_list_arr[] = tslib_cObj::getTreeList(-1*$id,$depth-1+$bA,$bA-1);
00472 }
00473 $id_list = implode(',',$id_list_arr);
00474
00475 switch($mode) {
00476 case 'starttime':
00477 $sortField = 'starttime';
00478 break;
00479 case 'lastUpdated':
00480 case 'manual':
00481 $sortField = 'lastUpdated';
00482 break;
00483 case 'tstamp':
00484 $sortField = 'tstamp';
00485 break;
00486 case 'crdate':
00487 $sortField = 'crdate';
00488 break;
00489 default:
00490 $sortField = 'SYS_LASTCHANGED';
00491 break;
00492 }
00493
00494 $extraWhere = ' AND pages.nav_hide=0'.$this->getDoktypeExcludeWhere();
00495
00496 if ($this->conf['special.']['excludeNoSearchPages']) {
00497 $extraWhere.= ' AND pages.no_search=0';
00498 }
00499 if ($maxAge>0) {
00500 $extraWhere.=' AND '.$sortField.'>'.($GLOBALS['SIM_EXEC_TIME']-$maxAge);
00501 }
00502
00503 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>'0', 'uidInList'=>$id_list, 'where'=>$sortField.'>=0'.$extraWhere, 'orderBy'=>($altSortFieldValue ? $altSortFieldValue : $sortField.' desc'),'max'=>$limit));
00504 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00505 $temp[$row['uid']]=$this->sys_page->getPageOverlay($row);
00506 }
00507 break;
00508 case 'keywords':
00509 list($value)=t3lib_div::intExplode(',',$value);
00510 if (!$value) {
00511 $value=$GLOBALS['TSFE']->page['uid'];
00512 }
00513 if ($this->conf['special.']['setKeywords'] || $this->conf['special.']['setKeywords.']) {
00514 $kw = $this->parent_cObj->stdWrap($this->conf['special.']['setKeywords'], $this->conf['special.']['setKeywords.']);
00515 } else {
00516 $value_rec=$this->sys_page->getPage($value);
00517
00518 $kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords';
00519 $kw = trim(tslib_cObj::keywords($value_rec[$kfieldSrc]));
00520 }
00521
00522 $mode = $this->conf['special.']['mode'];
00523 switch($mode) {
00524 case 'starttime':
00525 $sortField = 'starttime';
00526 break;
00527 case 'lastUpdated':
00528 case 'manual':
00529 $sortField = 'lastUpdated';
00530 break;
00531 case 'tstamp':
00532 $sortField = 'tstamp';
00533 break;
00534 case 'crdate':
00535 $sortField = 'crdate';
00536 break;
00537 default:
00538 $sortField = 'SYS_LASTCHANGED';
00539 break;
00540 }
00541
00542
00543 if (t3lib_div::testInt($this->conf['special.']['depth'])) {
00544 $depth = t3lib_div::intInRange($this->conf['special.']['depth'],0,20);
00545 } else {
00546 $depth=20;
00547 }
00548 $limit = t3lib_div::intInRange($this->conf['special.']['limit'],0,100);
00549 $extraWhere = ' AND pages.uid!='.$value.' AND pages.nav_hide=0'.$this->getDoktypeExcludeWhere();
00550 if ($this->conf['special.']['excludeNoSearchPages']) {
00551 $extraWhere.= ' AND pages.no_search=0';
00552 }
00553
00554 $eLevel = tslib_cObj::getKey (intval($this->conf['special.']['entryLevel']),$this->tmpl->rootLine);
00555 $startUid = intval($this->tmpl->rootLine[$eLevel]['uid']);
00556
00557
00558 $kfield = 'keywords';
00559 if ( $this->conf['special.']['keywordsField'] ) {
00560 list($kfield) = explode(' ',trim ($this->conf['special.']['keywordsField']));
00561 }
00562
00563
00564 if ($kw && $startUid) {
00565 $bA = t3lib_div::intInRange($this->conf['special.']['beginAtLevel'],0,100);
00566 $id_list=tslib_cObj::getTreeList(-1*$startUid,$depth-1+$bA,$bA-1);
00567
00568 $kwArr = explode(',',$kw);
00569 foreach($kwArr as $word) {
00570 $word = trim($word);
00571 if ($word) {
00572 $keyWordsWhereArr[] = $kfield.' LIKE \'%'.$GLOBALS['TYPO3_DB']->quoteStr($word, 'pages').'%\'';
00573 }
00574 }
00575 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>'0', 'uidInList'=>$id_list, 'where'=>'('.implode(' OR ',$keyWordsWhereArr).')'.$extraWhere, 'orderBy'=>($altSortFieldValue ? $altSortFieldValue : $sortField.' desc'),'max'=>$limit));
00576 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00577 $temp[$row['uid']]=$this->sys_page->getPageOverlay($row);
00578 }
00579 }
00580 break;
00581 case 'rootline':
00582 $begin_end = explode('|',$this->conf['special.']['range']);
00583 if (!t3lib_div::testInt($begin_end[0])) {intval($begin_end[0]);}
00584 if (!t3lib_div::testInt($begin_end[1])) {$begin_end[1]=-1;}
00585
00586 $beginKey = tslib_cObj::getKey ($begin_end[0],$this->tmpl->rootLine);
00587 $endKey = tslib_cObj::getKey ($begin_end[1],$this->tmpl->rootLine);
00588 if ($endKey<$beginKey) {$endKey=$beginKey;}
00589
00590 $rl_MParray = array();
00591 foreach($this->tmpl->rootLine as $k_rl => $v_rl) {
00592
00593 if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) {
00594 $rl_MParray[] = $v_rl['_MP_PARAM'];
00595 }
00596
00597 if ($k_rl>=$beginKey && $k_rl<=$endKey) {
00598 $temp_key=$k_rl;
00599 $temp[$temp_key]=$this->sys_page->getPage($v_rl['uid']);
00600 if (count($temp[$temp_key])) {
00601 if (!$temp[$temp_key]['target']) {
00602 $temp[$temp_key]['target'] = $this->conf['special.']['targets.'][$k_rl];
00603 $temp[$temp_key]['_MP_PARAM'] = implode(',',$rl_MParray);
00604 }
00605 } else unset($temp[$temp_key]);
00606 }
00607
00608 if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) {
00609 $rl_MParray[] = $v_rl['_MP_PARAM'];
00610 }
00611 }
00612 break;
00613 case 'browse':
00614 list($value)=t3lib_div::intExplode(',',$value);
00615 if (!$value) {
00616 $value=$GLOBALS['TSFE']->page['uid'];
00617 }
00618 if ($value!=$this->tmpl->rootLine[0]['uid']) {
00619 $recArr=array();
00620 $value_rec=$this->sys_page->getPage($value);
00621 if ($value_rec['pid']) {
00622 $recArr['up']=$this->sys_page->getPage($value_rec['pid']);
00623 }
00624 if ($recArr['up']['pid'] && $value_rec['pid']!=$this->tmpl->rootLine[0]['uid']) {
00625 $recArr['index']=$this->sys_page->getPage($recArr['up']['pid']);
00626 }
00627
00628
00629 $prevnext_menu = $this->sys_page->getMenu($value_rec['pid'],'*',$altSortField);
00630 $lastKey=0;
00631 $nextActive=0;
00632 reset($prevnext_menu);
00633 while(list($k_b,$v_b)=each($prevnext_menu)) {
00634 if ($nextActive) {
00635 $recArr['next']=$v_b;
00636 $nextActive=0;
00637 }
00638 if ($v_b['uid']==$value) {
00639 if ($lastKey) {
00640 $recArr['prev']=$prevnext_menu[$lastKey];
00641 }
00642 $nextActive=1;
00643 }
00644 $lastKey=$k_b;
00645 }
00646 reset($prevnext_menu);
00647 $recArr['first']=pos($prevnext_menu);
00648 end($prevnext_menu);
00649 $recArr['last']=pos($prevnext_menu);
00650
00651
00652 if (is_array($recArr['index'])) {
00653 $prevnextsection_menu = $this->sys_page->getMenu($recArr['index']['uid'],'*',$altSortField);
00654 $lastKey=0;
00655 $nextActive=0;
00656 reset($prevnextsection_menu);
00657 while(list($k_b,$v_b)=each($prevnextsection_menu)) {
00658 if ($nextActive) {
00659 $sectionRec_temp = $this->sys_page->getMenu($v_b['uid'],'*',$altSortField);
00660 if (count($sectionRec_temp)) {
00661 reset($sectionRec_temp);
00662 $recArr['nextsection']=pos($sectionRec_temp);
00663 end ($sectionRec_temp);
00664 $recArr['nextsection_last']=pos($sectionRec_temp);
00665 $nextActive=0;
00666 }
00667 }
00668 if ($v_b['uid']==$value_rec['pid']) {
00669 if ($lastKey) {
00670 $sectionRec_temp = $this->sys_page->getMenu($prevnextsection_menu[$lastKey]['uid'],'*',$altSortField);
00671 if (count($sectionRec_temp)) {
00672 reset($sectionRec_temp);
00673 $recArr['prevsection']=pos($sectionRec_temp);
00674 end ($sectionRec_temp);
00675 $recArr['prevsection_last']=pos($sectionRec_temp);
00676 }
00677 }
00678 $nextActive=1;
00679 }
00680 $lastKey=$k_b;
00681 }
00682 }
00683 if ($this->conf['special.']['items.']['prevnextToSection']) {
00684 if (!is_array($recArr['prev']) && is_array($recArr['prevsection_last'])) {
00685 $recArr['prev']=$recArr['prevsection_last'];
00686 }
00687 if (!is_array($recArr['next']) && is_array($recArr['nextsection'])) {
00688 $recArr['next']=$recArr['nextsection'];
00689 }
00690 }
00691
00692 $items = explode('|',$this->conf['special.']['items']);
00693 $c=0;
00694 while(list($k_b,$v_b)=each($items)) {
00695 $v_b=strtolower(trim($v_b));
00696 if (intval($this->conf['special.'][$v_b.'.']['uid'])) {
00697 $recArr[$v_b] = $this->sys_page->getPage(intval($this->conf['special.'][$v_b.'.']['uid']));
00698 }
00699 if (is_array($recArr[$v_b])) {
00700 $temp[$c]=$recArr[$v_b];
00701 if ($this->conf['special.'][$v_b.'.']['target']) {
00702 $temp[$c]['target']=$this->conf['special.'][$v_b.'.']['target'];
00703 }
00704 if (is_array($this->conf['special.'][$v_b.'.']['fields.'])) {
00705 reset($this->conf['special.'][$v_b.'.']['fields.']);
00706 while(list($fk,$val)=each($this->conf['special.'][$v_b.'.']['fields.'])) {
00707 $temp[$c][$fk]=$val;
00708 }
00709 }
00710 $c++;
00711 }
00712 }
00713 }
00714 break;
00715 }
00716 } elseif (is_array($this->alternativeMenuTempArray)) {
00717 $temp = $this->alternativeMenuTempArray;
00718 } elseif ($this->mconf['sectionIndex']) {
00719 if ($GLOBALS['TSFE']->sys_language_uid && count($this->sys_page->getPageOverlay($this->id))) {
00720 $sys_language_uid = intval($GLOBALS['TSFE']->sys_language_uid);
00721 } else $sys_language_uid=0;
00722
00723 $selectSetup = Array(
00724 'pidInList'=>$this->id,
00725 'orderBy'=>$altSortField,
00726 'where' => 'colPos=0 AND sys_language_uid='.$sys_language_uid,
00727 'andWhere' => 'sectionIndex!=0'
00728 );
00729 switch($this->mconf['sectionIndex.']['type']) {
00730 case 'all':
00731 unset($selectSetup['andWhere']);
00732 break;
00733 case 'header':
00734 $selectSetup['andWhere']='header_layout!=100 AND header!=""';
00735 break;
00736 }
00737 $basePageRow=$this->sys_page->getPage($this->id);
00738 if (is_array($basePageRow)) {
00739 $res = $GLOBALS['TSFE']->cObj->exec_getQuery('tt_content', $selectSetup);
00740 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00741 $temp[$row['uid']]=$basePageRow;
00742 $temp[$row['uid']]['title']=$row['header'];
00743 $temp[$row['uid']]['subtitle']=$row['subheader'];
00744 $temp[$row['uid']]['starttime']=$row['starttime'];
00745 $temp[$row['uid']]['endtime']=$row['endtime'];
00746 $temp[$row['uid']]['fe_group']=$row['fe_group'];
00747 $temp[$row['uid']]['media']=$row['media'];
00748
00749 $temp[$row['uid']]['header_layout']=$row['header_layout'];
00750 $temp[$row['uid']]['bodytext']=$row['bodytext'];
00751 $temp[$row['uid']]['image']=$row['image'];
00752
00753 $temp[$row['uid']]['sectionIndex_uid']=$row['uid'];
00754 }
00755 }
00756 } else {
00757 $temp = $this->sys_page->getMenu($this->id,'*',$altSortField);
00758 }
00759
00760 $c=0;
00761 $c_b=0;
00762 $minItems = intval($this->mconf['minItems'] ? $this->mconf['minItems'] : $this->conf['minItems']);
00763 $maxItems = intval($this->mconf['maxItems'] ? $this->mconf['maxItems'] : $this->conf['maxItems']);
00764 $begin = tslib_cObj::calc($this->mconf['begin'] ? $this->mconf['begin'] : $this->conf['begin']);
00765
00766 $banUidArray=array();
00767 if (trim($this->conf['excludeUidList'])) {
00768 $banUidArray = t3lib_div::intExplode(',', $this->conf['excludeUidList']);
00769 }
00770
00771
00772 $this->menuArr = Array();
00773 foreach($temp as $data) {
00774 $spacer = (t3lib_div::inList($this->spacerIDList,$data['doktype']) || !strcmp($data['ITEM_STATE'],'SPC')) ? 1 : 0;
00775 if ($this->filterMenuPages($data, $banUidArray, $spacer)) {
00776 $c_b++;
00777 if ($begin<=$c_b) {
00778 $this->menuArr[$c] = $data;
00779 $this->menuArr[$c]['isSpacer'] = $spacer;
00780 $c++;
00781 if ($maxItems && $c>=$maxItems) {
00782 break;
00783 }
00784 }
00785 }
00786 }
00787
00788
00789 if ($minItems) {
00790 while($c<$minItems) {
00791 $this->menuArr[$c] = Array(
00792 'title' => '...',
00793 'uid' => $GLOBALS['TSFE']->id
00794 );
00795 $c++;
00796 }
00797 }
00798
00799 $GLOBALS['TSFE']->register['count_menuItems'] = count($this->menuArr);
00800
00801 if ($this->mconf['itemArrayProcFunc']) {
00802 if (!is_array($this->parentMenuArr)) {$this->parentMenuArr=array();}
00803 $this->menuArr = $this->userProcess('itemArrayProcFunc',$this->menuArr);
00804 }
00805 $this->hash = md5(serialize($this->menuArr).serialize($this->mconf).serialize($this->tmpl->rootLine).serialize($this->MP_array));
00806
00807 $serData = $this->sys_page->getHash($this->hash, 60*60*24);
00808 if (!$serData) {
00809 $this->generate();
00810 $this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA');
00811 } else {
00812 $this->result=unserialize($serData);
00813 }
00814
00815
00816 if ($this->mconf['showAccessRestrictedPages']) {
00817
00818 $this->sys_page->where_groupAccess = $SAVED_where_groupAccess;
00819 }
00820 }
00821 }
00822
00833 function includeMakeMenu($conf,$altSortField) {
00834 $incFile = $GLOBALS['TSFE']->tmpl->getFileName($conf['file']);
00835 if ($incFile && $GLOBALS['TSFE']->checkFileInclude($incFile)) {
00836 include($incFile);
00837 }
00838 return is_array($menuItemsArray) ? $menuItemsArray : array();
00839 }
00840
00849 function filterMenuPages(&$data,$banUidArray,$spacer) {
00850
00851 if ($data['_SAFE']) return TRUE;
00852
00853 $uid = $data['uid'];
00854 if ($this->mconf['SPC'] || !$spacer) {
00855 if (!t3lib_div::inList($this->doktypeExcludeList,$data['doktype'])) {
00856 if (!$data['nav_hide']) {
00857 if (!t3lib_div::inArray($banUidArray,$uid)) {
00858
00859
00860
00861 $blockPage = $data['l18n_cfg']&1 && (!$GLOBALS['TSFE']->sys_language_uid || ($GLOBALS['TSFE']->sys_language_uid && !$data['_PAGES_OVERLAY']));
00862 if (!$blockPage) {
00863
00864
00865 $tok = TRUE;
00866 if ($GLOBALS['TSFE']->sys_language_uid && t3lib_div::hideIfNotTranslated($data['l18n_cfg'])) {
00867 if (!$data['_PAGES_OVERLAY']) {
00868 $tok = FALSE;
00869 }
00870 }
00871
00872
00873 if ($tok) {
00874
00875
00876 if ($this->conf['protectLvar']) {
00877 $Lvar = intval(t3lib_div::_GP('L'));
00878 if (($this->conf['protectLvar']=='all' || t3lib_div::hideIfNotTranslated($data['l18n_cfg'])) && $Lvar!=$GLOBALS['TSFE']->sys_language_uid) {
00879 $olRec = $GLOBALS['TSFE']->sys_page->getPageOverlay($data['uid'], $Lvar);
00880 if (!count($olRec)) {
00881
00882 $data['_ADD_GETVARS'].= '&L=0';
00883 }
00884 }
00885 }
00886
00887 return TRUE;
00888 }
00889 }
00890 }
00891 }
00892 }
00893 }
00894 }
00895
00905 function procesItemStates($splitCount) {
00906
00907
00908 if (!is_array($this->mconf['NO.']) && $this->mconf['NO']) $this->mconf['NO.']=array();
00909 $NOconf = $this->tmpl->splitConfArray($this->mconf['NO.'],$splitCount);
00910
00911
00912 $ROconf=array();
00913 if ($this->mconf['RO']) {
00914 $ROconf = $this->tmpl->splitConfArray($this->mconf['RO.'],$splitCount);
00915 }
00916
00917
00918
00919 if ($this->mconf['IFSUB']) {
00920 $IFSUBinit = 0;
00921 reset($NOconf);
00922 while (list($key,$val)=each($NOconf)) {
00923 if ($this->isItemState('IFSUB',$key)) {
00924 if (!$IFSUBinit) {
00925 $IFSUBconf = $this->tmpl->splitConfArray($this->mconf['IFSUB.'],$splitCount);
00926 if ($this->mconf['IFSUBRO']) {
00927 $IFSUBROconf = $this->tmpl->splitConfArray($this->mconf['IFSUBRO.'],$splitCount);
00928 }
00929 $IFSUBinit = 1;
00930 }
00931 $NOconf[$key] = $IFSUBconf[$key];
00932 if ($ROconf) {
00933 $ROconf[$key] = $IFSUBROconf[$key] ? $IFSUBROconf[$key] : $IFSUBconf[$key];
00934 }
00935 }
00936 }
00937 }
00938
00939 if ($this->mconf['ACT']) {
00940 $ACTinit = 0;
00941 reset($NOconf);
00942 while (list($key,$val)=each($NOconf)) {
00943 if ($this->isItemState('ACT',$key)) {
00944 if (!$ACTinit) {
00945 $ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'],$splitCount);
00946
00947 if ($this->mconf['ACTRO']) {
00948 $ACTROconf = $this->tmpl->splitConfArray($this->mconf['ACTRO.'],$splitCount);
00949 }
00950 $ACTinit = 1;
00951 }
00952 $NOconf[$key] = $ACTconf[$key];
00953 if ($ROconf) {
00954 $ROconf[$key] = $ACTROconf[$key] ? $ACTROconf[$key] : $ACTconf[$key];
00955 }
00956 }
00957 }
00958 }
00959
00960
00961 if ($this->mconf['ACTIFSUB']) {
00962 $ACTIFSUBinit = 0;
00963 reset($NOconf);
00964 while (list($key,$val)=each($NOconf)) {
00965 if ($this->isItemState('ACTIFSUB',$key)) {
00966 if (!$ACTIFSUBinit) {
00967 $ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'],$splitCount);
00968
00969 if ($this->mconf['ACTIFSUBRO']) {
00970 $ACTIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUBRO.'],$splitCount);
00971 }
00972 $ACTIFSUBinit = 1;
00973 }
00974 $NOconf[$key] = $ACTIFSUBconf[$key];
00975 if ($ROconf) {
00976 $ROconf[$key] = $ACTIFSUBROconf[$key] ? $ACTIFSUBROconf[$key] : $ACTIFSUBconf[$key];
00977 }
00978 }
00979 }
00980 }
00981
00982
00983 if ($this->mconf['CUR']) {
00984 $CURinit = 0;
00985 reset($NOconf);
00986 while (list($key,$val)=each($NOconf)) {
00987 if ($this->isItemState('CUR',$key)) {
00988 if (!$CURinit) {
00989 $CURconf = $this->tmpl->splitConfArray($this->mconf['CUR.'],$splitCount);
00990 if ($this->mconf['CURRO']) {
00991 $CURROconf = $this->tmpl->splitConfArray($this->mconf['CURRO.'],$splitCount);
00992 }
00993 $CURinit = 1;
00994 }
00995 $NOconf[$key] = $CURconf[$key];
00996 if ($ROconf) {
00997 $ROconf[$key] = $CURROconf[$key] ? $CURROconf[$key] : $CURconf[$key];
00998 }
00999 }
01000 }
01001 }
01002
01003
01004 if ($this->mconf['CURIFSUB']) {
01005 $CURIFSUBinit = 0;
01006 reset($NOconf);
01007 while (list($key,$val)=each($NOconf)) {
01008 if ($this->isItemState('CURIFSUB',$key)) {
01009 if (!$CURIFSUBinit) {
01010 $CURIFSUBconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUB.'],$splitCount);
01011
01012 if ($this->mconf['CURIFSUBRO']) {
01013 $CURIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUBRO.'],$splitCount);
01014 }
01015 $CURIFSUBinit = 1;
01016 }
01017 $NOconf[$key] = $CURIFSUBconf[$key];
01018 if ($ROconf) {
01019 $ROconf[$key] = $CURIFSUBROconf[$key] ? $CURIFSUBROconf[$key] : $CURIFSUBconf[$key];
01020 }
01021 }
01022 }
01023 }
01024
01025 if ($this->mconf['USR']) {
01026 $USRinit = 0;
01027 reset($NOconf);
01028 while (list($key,$val)=each($NOconf)) {
01029 if ($this->isItemState('USR',$key)) {
01030 if (!$USRinit) {
01031 $USRconf = $this->tmpl->splitConfArray($this->mconf['USR.'],$splitCount);
01032
01033 if ($this->mconf['USRRO']) {
01034 $USRROconf = $this->tmpl->splitConfArray($this->mconf['USRRO.'],$splitCount);
01035 }
01036 $USRinit = 1;
01037 }
01038 $NOconf[$key] = $USRconf[$key];
01039 if ($ROconf) {
01040 $ROconf[$key] = $USRROconf[$key] ? $USRROconf[$key] : $USRconf[$key];
01041 }
01042 }
01043 }
01044 }
01045
01046 if ($this->mconf['SPC']) {
01047 $SPCinit = 0;
01048 reset($NOconf);
01049 while (list($key,$val)=each($NOconf)) {
01050 if ($this->isItemState('SPC',$key)) {
01051 if (!$SPCinit) {
01052 $SPCconf = $this->tmpl->splitConfArray($this->mconf['SPC.'],$splitCount);
01053 $SPCinit = 1;
01054 }
01055 $NOconf[$key] = $SPCconf[$key];
01056 }
01057 }
01058 }
01059
01060 if ($this->mconf['USERDEF1']) {
01061 $USERDEF1init = 0;
01062 reset($NOconf);
01063 while (list($key,$val)=each($NOconf)) {
01064 if ($this->isItemState('USERDE