tslib/class.tslib_menu.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00143 class tslib_menu {
00144         var $menuNumber = 1;                            // tells you which menu-number this is. This is important when getting data from the setup
00145         var $entryLevel = 0;                            // 0 = rootFolder
00146         var $spacerIDList = '199';                      // The doktype-number that defines a spacer
00147         var $doktypeExcludeList = '5,6';                        // doktypes that define which should not be included in a menu
00148         var $alwaysActivePIDlist=array();
00149         var $imgNamePrefix = 'img';
00150         var $imgNameNotRandom=0;
00151         var $debug = 0;
00152         var $parent_cObj ='';                           // Loaded with the parent cObj-object when a new HMENU is made
00153         var $GMENU_fixKey='gmenu';
00154         var $MP_array=array();                          // accumulation of mount point data
00155 
00156                 // internal
00157         var $conf = Array();                            // HMENU configuration
00158         var $mconf = Array();                           // xMENU configuration (TMENU, GMENU etc)
00159         var $tmpl;              // template-object
00160         var $sys_page;  // sys_page-object
00161         var $id;                                                        // The base page-id of the menu.
00162         var $nextActive;                                        // Holds the page uid of the NEXT page in the root line from the page pointed to by entryLevel; Used to expand the menu automatically if in a certain root line.
00163         var $menuArr;   // The array of menuItems which is built
00164         var $hash;
00165         var $result = Array();
00166         var $rL_uidRegister = '';                       // Array: Is filled with an array of page uid numbers + RL parameters which are in the current root line (used to evaluate whether a menu item is in active state)
00167         var $INPfixMD5;
00168         var $I;
00169         var $WMresult;
00170         var $WMfreezePrefix;
00171         var $WMmenuItems;
00172         var $WMsubmenuObjSuffixes;
00173         var $WMextraScript;
00174         var $alternativeMenuTempArray='';               // Can be set to contain menu item arrays for sub-levels.
00175 
00188         function start(&$tmpl,&$sys_page,$id,$conf,$menuNumber,$objSuffix='')   {
00189 
00190                         // Init:
00191                 $this->conf = $conf;
00192                 $this->menuNumber = $menuNumber;
00193                 $this->mconf = $conf[$this->menuNumber.$objSuffix.'.'];
00194                 $this->debug=$GLOBALS['TSFE']->debug;
00195 
00196                         // Sets the internal vars. $tmpl MUST be the template-object. $sys_page MUST be the sys_page object
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                                 // alwaysActivePIDlist initialized:
00202                         if (trim($this->conf['alwaysActivePIDlist']))   {
00203                                 $this->alwaysActivePIDlist = t3lib_div::intExplode(',', $this->conf['alwaysActivePIDlist']);
00204                         }
00205 
00206                                 // 'not in menu' doktypes
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                                 // EntryLevel
00217                         $this->entryLevel = tslib_cObj::getKey ($conf['entryLevel'],$this->tmpl->rootLine);
00218 
00219                                 // Set parent page: If $id not stated with start() then the base-id will be found from rootLine[$this->entryLevel]
00220                         if ($id)        {       // Called as the next level in a menu. It is assumed that $this->MP_array is set from parent menu.
00221                                 $this->id = intval($id);
00222                         } else {        // This is a BRAND NEW menu, first level. So we take ID from rootline and also find MP_array (mount points)
00223                                 $this->id = intval($this->tmpl->rootLine[$this->entryLevel]['uid']);
00224 
00225                                         // Traverse rootline to build MP_array of pages BEFORE the entryLevel
00226                                         // (MP var for ->id is picked up in the next part of the code...)
00227                                 foreach($this->tmpl->rootLine as $entryLevel => $levelRec)      {
00228                                                 // For overlaid mount points, set the variable right now:
00229                                         if ($levelRec['_MP_PARAM'] && $levelRec['_MOUNT_OL'])   {
00230                                                 $this->MP_array[] = $levelRec['_MP_PARAM'];
00231                         }
00232                                                 // Break when entry level is reached:
00233                                         if ($entryLevel>=$this->entryLevel)     break;
00234 
00235                                                 // For normal mount points, set the variable for next level.
00236                                         if ($levelRec['_MP_PARAM'] && !$levelRec['_MOUNT_OL'])  {
00237                                                 $this->MP_array[] = $levelRec['_MP_PARAM'];
00238                                         }
00239                                 }
00240                         }
00241 
00242                                 // Return false if no page ID was set (thus no menu of subpages can be made).
00243                         if ($this->id<=0)       {
00244                                 return FALSE;
00245                         }
00246 
00247                                 // Check if page is a mount point, and if so set id and MP_array
00248                                 // (basically this is ONLY for non-overlay mode, but in overlay mode an ID with a mount point should never reach this point anyways, so no harm done...)
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                                 // Gather list of page uids in root line (for "isActive" evaluation). Also adds the MP params in the path so Mount Points are respected.
00256                                 // (List is specific for this rootline, so it may be supplied from parent menus for speed...)
00257                         if (!is_array($this->rL_uidRegister))   {
00258                                 $rl_MParray = array();
00259                                 foreach($this->tmpl->rootLine as $v_rl) {
00260                                                 // For overlaid mount points, set the variable right now:
00261                                         if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL'])   {
00262                                                 $rl_MParray[] = $v_rl['_MP_PARAM'];
00263                                         }
00264 
00265                                                 // Add to register:
00266                                         $this->rL_uidRegister[] = 'ITEM:'.$v_rl['uid'].(count($rl_MParray) ? ':'.implode(',',$rl_MParray) : '');
00267 
00268                                                 // For normal mount points, set the variable for next level.
00269                                         if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL'])  {
00270                                                 $rl_MParray[] = $v_rl['_MP_PARAM'];
00271                                         }
00272                                 }
00273                         }
00274 
00275                                 // Setting "nextActive": This is the page uid + MPvar of the NEXT page in rootline. Used to expand the menu if we are in the right branch of the tree
00276                                 // Notice: The automatic expansion of a menu is designed to work only when no "special" modes are used.
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'])    {       // In overlay mode, add next level MPvars as well:
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                                 // imgNamePrefix
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                                 // Initializing showAccessRestrictedPages
00313                         if ($this->mconf['showAccessRestrictedPages'])  {
00314                                         // SAVING where_groupAccess
00315                                 $SAVED_where_groupAccess = $this->sys_page->where_groupAccess;
00316                                 $this->sys_page->where_groupAccess = '';        // Temporarily removing fe_group checking!
00317                         }
00318 
00319                                 // Begin production of menu:
00320                         $temp = array();
00321                         $altSortFieldValue = trim($this->mconf['alternativeSortingField']);
00322                         $altSortField = $altSortFieldValue ? $altSortFieldValue : 'sorting';
00323                         if ($this->menuNumber==1 && $this->conf['special'])     {               // ... only for the FIRST level of a HMENU
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                                                         // Getting current page record NOT overlaid by any translation:
00342                                                 $currentPageWithNoOverlay = $this->sys_page->getRawRecord('pages',$GLOBALS['TSFE']->page['uid']);
00343 
00344                                                         // Traverse languages set up:
00345                                                 $languageItems = t3lib_div::intExplode(',',$value);
00346                                                 foreach($languageItems as $sUid)        {
00347                                                                 // Find overlay record:
00348                                                         if ($sUid)      {
00349                                                                 $lRecs = $this->sys_page->getPageOverlay($GLOBALS['TSFE']->page['uid'],$sUid);
00350                                                         } else $lRecs=array();
00351                                                                 // Checking if the "disabled" state should be set.
00352                                                         if (
00353                                                                                 (t3lib_div::hideIfNotTranslated($GLOBALS['TSFE']->page['l18n_cfg']) && $sUid && !count($lRecs)) // Blocking for all translations?
00354                                                                         || ($GLOBALS['TSFE']->page['l18n_cfg']&1 && (!$sUid || !count($lRecs))) // Blocking default translation?
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                                                                 // Adding menu item:
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                                                                 // Checking if a page is a mount page and if so, change the ID and set the MP var properly.
00382                                                         $mount_info = $this->sys_page->getMountPointInfo($id);
00383                                                         if (is_array($mount_info))      {
00384                                                                 if ($mount_info['overlay'])     {       // Overlays should already have their full MPvars calculated:
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                                                                 // Get sub-pages:
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                                                                         // Keep mount point?
00398                                                                 $mount_info = $this->sys_page->getMountPointInfo($row['uid'], $row);
00399                                                                 if (is_array($mount_info) && $mount_info['overlay'])    {       // There is a valid mount point.
00400                                                                         $mp_row = $this->sys_page->getPage($mount_info['mount_pid']);           // Using "getPage" is OK since we need the check for enableFields AND for type 2 of mount pids we DO require a doktype < 200!
00401                                                                         if (count($mp_row))     {
00402                                                                                 $row = $mp_row;
00403                                                                                 $row['_MP_PARAM'] = $mount_info['MPvar'];
00404                                                                         } else unset($row);     // If the mount point could not be fetched with respect to enableFields, unset the row so it does not become a part of the menu!
00405                                                                 }
00406 
00407                                                                         // Add external MP params, then the row:
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                                                                 // Keep mount point?
00428                                                         $mount_info = $this->sys_page->getMountPointInfo($val['id']);
00429                                                         if (is_array($mount_info) && $mount_info['overlay'])    {       // There is a valid mount point.
00430                                                                 $mp_row = $this->sys_page->getPage($mount_info['mount_pid']);           // Using "getPage" is OK since we need the check for enableFields AND for type 2 of mount pids we DO require a doktype < 200!
00431                                                                 if (count($mp_row))     {
00432                                                                         $row = $mp_row;
00433                                                                         $row['_MP_PARAM'] = $mount_info['MPvar'];
00434 
00435                                                                         if ($mount_info['overlay'])     {       // Overlays should already have their full MPvars calculated:
00436                                                                                 $MP = $this->tmpl->getFromMPmap($mount_info['mount_pid']);
00437                                                                                 if ($MP) unset($row['_MP_PARAM']);
00438                                                         }
00439 
00440                                                                 } else unset($row);     // If the mount point could not be fetched with respect to enableFields, unset the row so it does not become a part of the menu!
00441                                                         } else {
00442                                                                 $row = $loadDB->results['pages'][$val['id']];
00443                                                 }
00444 
00445                                                                 // Add external MP params, then the row:
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);          // Tree depth
00459                                                 } else {
00460                                                         $depth=20;
00461                                                 }
00462                                                 $limit = t3lib_div::intInRange($this->conf['special.']['limit'],0,100); // max number of items
00463                                                 $maxAge = intval(tslib_cObj::calc($this->conf['special.']['maxAge']));
00464                                                 if (!$limit)    $limit=10;
00465                                                 $mode = $this->conf['special.']['mode'];        // *'auto', 'manual', 'tstamp'
00466                                                         // Get id's
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                                                         // Get sortField (mode)
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                                                         // Get
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);    // The page record of the 'value'.
00517 
00518                                                         $kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords';
00519                                                         $kw = trim(tslib_cObj::keywords($value_rec[$kfieldSrc]));               // keywords.
00520                                                 }
00521 
00522                                                 $mode = $this->conf['special.']['mode'];        // *'auto', 'manual', 'tstamp'
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                                                         // depth, limit, extra where
00543                                                 if (t3lib_div::testInt($this->conf['special.']['depth']))       {
00544                                                         $depth = t3lib_div::intInRange($this->conf['special.']['depth'],0,20);          // Tree depth
00545                                                 } else {
00546                                                         $depth=20;
00547                                                 }
00548                                                 $limit = t3lib_div::intInRange($this->conf['special.']['limit'],0,100); // max number of items
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                                                         // start point
00554                                                 $eLevel = tslib_cObj::getKey (intval($this->conf['special.']['entryLevel']),$this->tmpl->rootLine);
00555                                                 $startUid = intval($this->tmpl->rootLine[$eLevel]['uid']);
00556 
00557                                                         // which field is for keywords
00558                                                 $kfield = 'keywords';
00559                                                 if ( $this->conf['special.']['keywordsField'] ) {
00560                                                         list($kfield) = explode(' ',trim ($this->conf['special.']['keywordsField']));
00561                                                 }
00562 
00563                                                         // If there are keywords and the startuid is present.
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                                                                 // For overlaid mount points, set the variable right now:
00593                                                         if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL'])   {
00594                                                                 $rl_MParray[] = $v_rl['_MP_PARAM'];
00595                                                         }
00596                                                                 // Traverse rootline:
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'])        {       // If there are no specific target for the page, put the level specific target on.
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                                                                 // For normal mount points, set the variable for next level.
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'])    {       // Will not work out of rootline
00619                                                         $recArr=array();
00620                                                         $value_rec=$this->sys_page->getPage($value);    // The page record of the 'value'.
00621                                                         if ($value_rec['pid'])  {       // 'up' page cannot be outside rootline
00622                                                                 $recArr['up']=$this->sys_page->getPage($value_rec['pid']);      // The page record of 'up'.
00623                                                         }
00624                                                         if ($recArr['up']['pid'] && $value_rec['pid']!=$this->tmpl->rootLine[0]['uid']) {       // If the 'up' item was NOT level 0 in rootline...
00625                                                                 $recArr['index']=$this->sys_page->getPage($recArr['up']['pid']);        // The page record of "index".
00626                                                         }
00627 
00628                                                                 // prev / next is found
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                                                                 // prevsection / nextsection is found
00652                                                         if (is_array($recArr['index'])) {       // You can only do this, if there is a valid page two levels up!
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']));     // fetches the page in case of a hardcoded pid in template
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))    {       // Setting $temp array if not level 1.
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 {        // Default:
00757                                 $temp = $this->sys_page->getMenu($this->id,'*',$altSortField);          // gets the menu
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                                 // Fill in the menuArr with elements that should go into the menu:
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;              // if item is a spacer, $spacer is set
00775                                 if ($this->filterMenuPages($data, $banUidArray, $spacer))       {
00776                                         $c_b++;
00777                                         if ($begin<=$c_b)       {               // If the beginning item has been reached.
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                                 // Fill in fake items, if min-items is set.
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                                 // Setting number of menu items
00799                         $GLOBALS['TSFE']->register['count_menuItems'] = count($this->menuArr);
00800                                 //      Passing the menuArr through a user defined function:
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                                 // End showAccessRestrictedPages
00816                         if ($this->mconf['showAccessRestrictedPages'])  {
00817                                         // RESTORING where_groupAccess
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)    {       // If the spacer-function is not enabled, spacers will not enter the $menuArr
00855                         if (!t3lib_div::inList($this->doktypeExcludeList,$data['doktype']))     {               // Page may not be 'not_in_menu' or 'Backend User Section'
00856                                 if (!$data['nav_hide']) {       // Not hidden in navigation
00857                                         if (!t3lib_div::inArray($banUidArray,$uid))     {       // not in banned uid's
00858 
00859                                                         // Checks if the default language version can be shown:
00860                                                         // Block page is set, if l18n_cfg allows plus: 1) Either default language or 2) another language but NO overlay record set for page!
00861                                                 $blockPage = $data['l18n_cfg']&1 && (!$GLOBALS['TSFE']->sys_language_uid || ($GLOBALS['TSFE']->sys_language_uid && !$data['_PAGES_OVERLAY']));
00862                                                 if (!$blockPage)        {
00863 
00864                                                                 // Checking if a page should be shown in the menu depending on whether a translation exists:
00865                                                         $tok = TRUE;
00866                                                         if ($GLOBALS['TSFE']->sys_language_uid && t3lib_div::hideIfNotTranslated($data['l18n_cfg']))    {       // There is an alternative language active AND the current page requires a translation:
00867                                                                 if (!$data['_PAGES_OVERLAY'])   {
00868                                                                         $tok = FALSE;
00869                                                                 }
00870                                                         }
00871 
00872                                                                 // Continue if token is true:
00873                                                         if ($tok)       {
00874 
00875                                                                         // Checking if "&L" should be modified so links to non-accessible pages will not happen.
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)      {       // page cannot be access in locaization and Lvar is different than sys_language uid - this means we must check!
00879                                                                                 $olRec = $GLOBALS['TSFE']->sys_page->getPageOverlay($data['uid'], $Lvar);
00880                                                                                 if (!count($olRec))     {
00881                                                                                                 // If no pages_language_overlay record then page can NOT be accessed in the language pointed to by "&L" and therefore we protect the link by setting "&L=0"
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                         // Prepare normal settings
00908                 if (!is_array($this->mconf['NO.']) && $this->mconf['NO'])       $this->mconf['NO.']=array();    // Setting a blank array if NO=1 and there are no properties.
00909                 $NOconf = $this->tmpl->splitConfArray($this->mconf['NO.'],$splitCount);
00910 
00911                         // Prepare rollOver settings, overriding normal settings
00912                 $ROconf=array();
00913                 if ($this->mconf['RO']) {
00914                         $ROconf = $this->tmpl->splitConfArray($this->mconf['RO.'],$splitCount);
00915                 }
00916 
00917                         // Prepare IFSUB settings, overriding normal settings
00918                         // IFSUB is true if there exist submenu items to the current item
00919                 if ($this->mconf['IFSUB'])      {
00920                         $IFSUBinit = 0; // Flag: If $IFSUB is generated
00921                         reset($NOconf);
00922                         while (list($key,$val)=each($NOconf))   {
00923                                 if ($this->isItemState('IFSUB',$key))   {
00924                                         if (!$IFSUBinit)        {       // if this is the first IFSUB element, we must generate IFSUB.
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];               // Substitute normal with ifsub
00932                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
00933                                                 $ROconf[$key] = $IFSUBROconf[$key] ? $IFSUBROconf[$key] : $IFSUBconf[$key];             // If RollOver on active then apply this
00934                                         }
00935                                 }
00936                         }
00937                 }
00938                         // Prepare active settings, overriding normal settings
00939                 if ($this->mconf['ACT'])        {
00940                         $ACTinit = 0;   // Flag: If $ACT is generated
00941                         reset($NOconf);
00942                         while (list($key,$val)=each($NOconf))   {       // Find active
00943                                 if ($this->isItemState('ACT',$key))     {
00944                                         if (!$ACTinit)  {       // if this is the first 'active', we must generate ACT.
00945                                                 $ACTconf = $this->tmpl->splitConfArray($this->mconf['ACT.'],$splitCount);
00946                                                         // Prepare active rollOver settings, overriding normal active settings
00947                                                 if ($this->mconf['ACTRO'])      {
00948                                                         $ACTROconf = $this->tmpl->splitConfArray($this->mconf['ACTRO.'],$splitCount);
00949                                                 }
00950                                                 $ACTinit = 1;
00951                                         }
00952                                         $NOconf[$key] = $ACTconf[$key];         // Substitute normal with active
00953                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
00954                                                 $ROconf[$key] = $ACTROconf[$key] ? $ACTROconf[$key] : $ACTconf[$key];           // If RollOver on active then apply this
00955                                         }
00956                                 }
00957                         }
00958                 }
00959                         // Prepare ACT (active)/IFSUB settings, overriding normal settings
00960                         // ACTIFSUB is true if there exist submenu items to the current item and the current item is active
00961                 if ($this->mconf['ACTIFSUB'])   {
00962                         $ACTIFSUBinit = 0;      // Flag: If $ACTIFSUB is generated
00963                         reset($NOconf);
00964                         while (list($key,$val)=each($NOconf))   {       // Find active
00965                                 if ($this->isItemState('ACTIFSUB',$key))        {
00966                                         if (!$ACTIFSUBinit)     {       // if this is the first 'active', we must generate ACTIFSUB.
00967                                                 $ACTIFSUBconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUB.'],$splitCount);
00968                                                         // Prepare active rollOver settings, overriding normal active settings
00969                                                 if ($this->mconf['ACTIFSUBRO']) {
00970                                                         $ACTIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['ACTIFSUBRO.'],$splitCount);
00971                                                 }
00972                                                 $ACTIFSUBinit = 1;
00973                                         }
00974                                         $NOconf[$key] = $ACTIFSUBconf[$key];            // Substitute normal with active
00975                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
00976                                                 $ROconf[$key] = $ACTIFSUBROconf[$key] ? $ACTIFSUBROconf[$key] : $ACTIFSUBconf[$key];            // If RollOver on active then apply this
00977                                         }
00978                                 }
00979                         }
00980                 }
00981                         // Prepare CUR (current) settings, overriding normal settings
00982                         // CUR is true if the current page equals the item here!
00983                 if ($this->mconf['CUR'])        {
00984                         $CURinit = 0;   // Flag: If $CUR is generated
00985                         reset($NOconf);
00986                         while (list($key,$val)=each($NOconf))   {
00987                                 if ($this->isItemState('CUR',$key))     {
00988                                         if (!$CURinit)  {       // if this is the first 'current', we must generate CUR. Basically this control is just inherited from the other implementations as current would only exist one time and thats it (unless you use special-features of HMENU)
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];         // Substitute normal with current
00996                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
00997                                                 $ROconf[$key] = $CURROconf[$key] ? $CURROconf[$key] : $CURconf[$key];           // If RollOver on active then apply this
00998                                         }
00999                                 }
01000                         }
01001                 }
01002                         // Prepare CUR (current)/IFSUB settings, overriding normal settings
01003                         // CURIFSUB is true if there exist submenu items to the current item and the current page equals the item here!
01004                 if ($this->mconf['CURIFSUB'])   {
01005                         $CURIFSUBinit = 0;      // Flag: If $CURIFSUB is generated
01006                         reset($NOconf);
01007                         while (list($key,$val)=each($NOconf))   {
01008                                 if ($this->isItemState('CURIFSUB',$key))        {
01009                                         if (!$CURIFSUBinit)     {       // if this is the first 'current', we must generate CURIFSUB.
01010                                                 $CURIFSUBconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUB.'],$splitCount);
01011                                                         // Prepare current rollOver settings, overriding normal current settings
01012                                                 if ($this->mconf['CURIFSUBRO']) {
01013                                                         $CURIFSUBROconf = $this->tmpl->splitConfArray($this->mconf['CURIFSUBRO.'],$splitCount);
01014                                                 }
01015                                                 $CURIFSUBinit = 1;
01016                                         }
01017                                         $NOconf[$key] = $CURIFSUBconf[$key];            // Substitute normal with active
01018                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the current
01019                                                 $ROconf[$key] = $CURIFSUBROconf[$key] ? $CURIFSUBROconf[$key] : $CURIFSUBconf[$key];            // If RollOver on current then apply this
01020                                         }
01021                                 }
01022                         }
01023                 }
01024                         // Prepare active settings, overriding normal settings
01025                 if ($this->mconf['USR'])        {
01026                         $USRinit = 0;   // Flag: If $USR is generated
01027                         reset($NOconf);
01028                         while (list($key,$val)=each($NOconf))   {       // Find active
01029                                 if ($this->isItemState('USR',$key))     {
01030                                         if (!$USRinit)  {       // if this is the first active, we must generate USR.
01031                                                 $USRconf = $this->tmpl->splitConfArray($this->mconf['USR.'],$splitCount);
01032                                                         // Prepare active rollOver settings, overriding normal active settings
01033                                                 if ($this->mconf['USRRO'])      {
01034                                                         $USRROconf = $this->tmpl->splitConfArray($this->mconf['USRRO.'],$splitCount);
01035                                                 }
01036                                                 $USRinit = 1;
01037                                         }
01038                                         $NOconf[$key] = $USRconf[$key];         // Substitute normal with active
01039                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
01040                                                 $ROconf[$key] = $USRROconf[$key] ? $USRROconf[$key] : $USRconf[$key];           // If RollOver on active then apply this
01041                                         }
01042                                 }
01043                         }
01044                 }
01045                         // Prepare spacer settings, overriding normal settings
01046                 if ($this->mconf['SPC'])        {
01047                         $SPCinit = 0;   // Flag: If $SPC is generated
01048                         reset($NOconf);
01049                         while (list($key,$val)=each($NOconf))   {       // Find spacers
01050                                 if ($this->isItemState('SPC',$key))     {
01051                                         if (!$SPCinit)  {       // if this is the first spacer, we must generate SPC.
01052                                                 $SPCconf = $this->tmpl->splitConfArray($this->mconf['SPC.'],$splitCount);
01053                                                 $SPCinit = 1;
01054                                         }
01055                                         $NOconf[$key] = $SPCconf[$key];         // Substitute normal with spacer
01056                                 }
01057                         }
01058                 }
01059                         // Prepare Userdefined settings
01060                 if ($this->mconf['USERDEF1'])   {
01061                         $USERDEF1init = 0;      // Flag: If $USERDEF1 is generated
01062                         reset($NOconf);
01063                         while (list($key,$val)=each($NOconf))   {       // Find active
01064                                 if ($this->isItemState('USERDE