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