Documentation TYPO3 par Ameos

class.tslib_menu.php

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('USERDEF1',$key))        {
01065                                         if (!$USERDEF1init)     {       // if this is the first active, we must generate USERDEF1.
01066                                                 $USERDEF1conf = $this->tmpl->splitConfArray($this->mconf['USERDEF1.'],$splitCount);
01067                                                         // Prepare active rollOver settings, overriding normal active settings
01068                                                 if ($this->mconf['USERDEF1RO']) {
01069                                                         $USERDEF1ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF1RO.'],$splitCount);
01070                                                 }
01071                                                 $USERDEF1init = 1;
01072                                         }
01073                                         $NOconf[$key] = $USERDEF1conf[$key];            // Substitute normal with active
01074                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
01075                                                 $ROconf[$key] = $USERDEF1ROconf[$key] ? $USERDEF1ROconf[$key] : $USERDEF1conf[$key];            // If RollOver on active then apply this
01076                                         }
01077                                 }
01078                         }
01079                 }
01080                         // Prepare Userdefined settings
01081                 if ($this->mconf['USERDEF2'])   {
01082                         $USERDEF2init = 0;      // Flag: If $USERDEF2 is generated
01083                         reset($NOconf);
01084                         while (list($key,$val)=each($NOconf))   {       // Find active
01085                                 if ($this->isItemState('USERDEF2',$key))        {
01086                                         if (!$USERDEF2init)     {       // if this is the first active, we must generate USERDEF2.
01087                                                 $USERDEF2conf = $this->tmpl->splitConfArray($this->mconf['USERDEF2.'],$splitCount);
01088                                                         // Prepare active rollOver settings, overriding normal active settings
01089                                                 if ($this->mconf['USERDEF2RO']) {
01090                                                         $USERDEF2ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF2RO.'],$splitCount);
01091                                                 }
01092                                                 $USERDEF2init = 1;
01093                                         }
01094                                         $NOconf[$key] = $USERDEF2conf[$key];            // Substitute normal with active
01095                                         if ($ROconf)    {       // If rollOver on normal, we must apply a state for rollOver on the active
01096                                                 $ROconf[$key] = $USERDEF2ROconf[$key] ? $USERDEF2ROconf[$key] : $USERDEF2conf[$key];            // If RollOver on active then apply this
01097                                         }
01098                                 }
01099                         }
01100                 }
01101 
01102                 return array($NOconf,$ROconf);
01103         }
01104 
01115         function link($key,$altTarget='',$typeOverride='') {
01116 
01117                         // Mount points:
01118                 $MP_var = $this->getMPvar($key);
01119                 $MP_params = $MP_var ? '&MP='.rawurlencode($MP_var) : '';
01120 
01121                         // Setting override ID
01122                 if ($this->mconf['overrideId'] || $this->menuArr[$key]['overrideId'])   {
01123                         $overrideArray = array();
01124                                 // If a user script returned the value overrideId in the menu array we use that as page id
01125                         $overrideArray['uid'] = $this->mconf['overrideId']?$this->mconf['overrideId']:$this->menuArr[$key]['overrideId'];
01126                         $overrideArray['alias'] = '';
01127                         $MP_params = '';        // clear MP parameters since ID was changed.
01128                 } else {
01129                         $overrideArray='';
01130                 }
01131 
01132                         // Setting main target:
01133                 $mainTarget = $altTarget ? $altTarget : $this->mconf['target'];
01134 
01135                         // Creating link:
01136                 if ($this->mconf['collapse'] && $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key)))    {
01137                         $thePage = $this->sys_page->getPage($this->menuArr[$key]['pid']);
01138                         $LD = $this->tmpl->linkData($thePage,$mainTarget,'','',$overrideArray, $this->mconf['addParams'].$MP_params.$this->menuArr[$key]['_ADD_GETVARS'], $typeOverride);
01139                 } else {
01140                         $LD = $this->tmpl->linkData($this->menuArr[$key],$mainTarget,'','',$overrideArray, $this->mconf['addParams'].$MP_params.$this->menuArr[$key]['_ADD_GETVARS'], $typeOverride);
01141                 }
01142 
01143                         // Manipulation in case of access restricted pages:
01144                 $this->changeLinksForAccessRestrictedPages($LD,$this->menuArr[$key],$mainTarget,$typeOverride);
01145 
01146                         // Overriding URL / Target if set to do so:
01147                 if ($this->menuArr[$key]['_OVERRIDE_HREF'])     {
01148                         $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF'];
01149                         if ($this->menuArr[$key]['_OVERRIDE_TARGET'])   $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
01150                 }
01151 
01152                         // OnClick open in windows.
01153                 $onClick='';
01154                 if ($this->mconf['JSWindow'])   {
01155                         $conf=$this->mconf['JSWindow.'];
01156                         $url=$LD['totalURL'];
01157                         $LD['totalURL'] = '#';
01158                         $onClick= 'openPic(\''.$GLOBALS['TSFE']->baseUrlWrap($url).'\',\''.($conf['newWindow']?md5($url):'theNewPage').'\',\''.$conf['params'].'\'); return false;';
01159                         $GLOBALS['TSFE']->setJS('openPic');
01160                 }
01161 
01162                         // out:
01163                 $list = array();
01164                 $list['HREF'] = strlen($LD['totalURL']) ? $LD['totalURL'] : $GLOBALS['TSFE']->baseUrl;  // Added this check: What it does is to enter the baseUrl (if set, which it should for "realurl" based sites) as URL if the calculated value is empty. The problem is that no link is generated with a blank URL and blank URLs might appear when the realurl encoding is used and a link to the frontpage is generated.
01165                 $list['TARGET'] = $LD['target'];
01166                 $list['onClick'] = $onClick;
01167 
01168                 return $list;
01169         }
01170 
01180         function changeLinksForAccessRestrictedPages(&$LD, $page, $mainTarget, $typeOverride)   {
01181 
01182                         // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
01183                 if ($this->mconf['showAccessRestrictedPages'] && $this->mconf['showAccessRestrictedPages']!=='NONE' && !$GLOBALS['TSFE']->checkPageGroupAccess($page))          {
01184                         $thePage = $this->sys_page->getPage($this->mconf['showAccessRestrictedPages']);
01185 
01186                         $addParams = $this->mconf['showAccessRestrictedPages.']['addParams'];
01187                         $addParams = str_replace('###RETURN_URL###',rawurlencode($LD['totalURL']),$addParams);
01188                         $addParams = str_replace('###PAGE_ID###',$page['uid'],$addParams);
01189                         $LD = $this->tmpl->linkData($thePage,$mainTarget,'','','', $addParams, $typeOverride);
01190                 }
01191         }
01192 
01201         function subMenu($uid, $objSuffix='')   {
01202 
01203                         // Setting alternative menu item array if _SUB_MENU has been defined in the current ->menuArr
01204                 $altArray = '';
01205                 if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && count($this->menuArr[$this->I['key']]['_SUB_MENU']))      {
01206                         $altArray = $this->menuArr[$this->I['key']]['_SUB_MENU'];
01207                 }
01208 
01209                         // Make submenu if the page is the next active
01210                 $cls = strtolower($this->conf[($this->menuNumber+1).$objSuffix]);
01211                 $subLevelClass = ($cls && t3lib_div::inList($this->tmpl->menuclasses,$cls)) ? $cls : '';
01212 
01213                 if ($subLevelClass && ($this->mconf['expAll'] || $this->isNext($uid, $this->getMPvar($this->I['key'])) || is_array($altArray)) && !$this->mconf['sectionIndex'])        {
01214                         $submenu = t3lib_div::makeInstance('tslib_'.$subLevelClass);
01215                         $submenu->entryLevel = $this->entryLevel+1;
01216                         $submenu->rL_uidRegister = $this->rL_uidRegister;
01217                         $submenu->MP_array = $this->MP_array;
01218                         if ($this->menuArr[$this->I['key']]['_MP_PARAM'])       {
01219                                 $submenu->MP_array[] = $this->menuArr[$this->I['key']]['_MP_PARAM'];
01220                         }
01221 
01222                                 // especially scripts that build the submenu needs the parent data
01223                         $submenu->parentMenuArr = $this->menuArr;
01224 
01225                                 // Setting alternativeMenuTempArray (will be effective only if an array)
01226                         if (is_array($altArray))        {
01227                                 $submenu->alternativeMenuTempArray = $altArray;
01228                         }
01229 
01230                         if ($submenu->start($this->tmpl, $this->sys_page, $uid, $this->conf, $this->menuNumber+1, $objSuffix))  {
01231                                 $submenu->makeMenu();
01232                                 return $submenu->writeMenu();
01233                         }
01234                 }
01235         }
01236 
01246         function isNext($uid, $MPvar='')        {
01247 
01248                         // Check for always active PIDs:
01249                 if (count($this->alwaysActivePIDlist) && in_array($uid,$this->alwaysActivePIDlist))     {
01250                         return TRUE;
01251                 }
01252 
01253                 $testUid = $uid.($MPvar?':'.$MPvar:'');
01254                 if ($uid && $testUid==$this->nextActive)        {
01255                         return TRUE;
01256                 }
01257         }
01258 
01267         function isActive($uid, $MPvar='')      {
01268 
01269                         // Check for always active PIDs:
01270                 if (count($this->alwaysActivePIDlist) && in_array($uid,$this->alwaysActivePIDlist))     {
01271                         return TRUE;
01272                 }
01273 
01274                 $testUid = $uid.($MPvar?':'.$MPvar:'');
01275                 if ($uid && in_array('ITEM:'.$testUid, $this->rL_uidRegister))  {
01276                         return TRUE;
01277                 }
01278         }
01279 
01288         function isCurrent($uid, $MPvar='')     {
01289                 $testUid = $uid.($MPvar?':'.$MPvar:'');
01290                 if ($uid && !strcmp(end($this->rL_uidRegister),'ITEM:'.$testUid))       {
01291                         return TRUE;
01292         }
01293         }
01294 
01303         function isSubMenu($uid)        {
01304 
01305                         // Looking for a mount-pid for this UID since if that exists we should look for a subpages THERE and not in the input $uid;
01306                 $mount_info = $this->sys_page->getMountPointInfo($uid);
01307                 if (is_array($mount_info))      {
01308                         $uid = $mount_info['mount_pid'];
01309                 }
01310 
01311                 $recs = $this->sys_page->getMenu($uid,'uid,pid,doktype,mount_pid,mount_pid_ol,nav_hide');
01312                 foreach($recs as $theRec)       {
01313                         if (!t3lib_div::inList($this->doktypeExcludeList,$theRec['doktype']) && !$theRec['nav_hide'])   {       // If a menu item seems to be another type than 'Not in menu', then return true (there were items!)
01314                                 return TRUE;
01315                         }
01316                 }
01317         }
01318 
01328         function isItemState($kind,$key)        {
01329                 $natVal=0;
01330                 if ($this->menuArr[$key]['ITEM_STATE']) {               // If any value is set for ITEM_STATE the normal evaluation is discarded
01331                         if (!strcmp($this->menuArr[$key]['ITEM_STATE'],$kind))  {$natVal=1;}
01332                 } else {
01333                         switch($kind)   {
01334                                 case 'SPC':
01335                                         $natVal = $this->menuArr[$key]['isSpacer'];
01336                                 break;
01337                                 case 'IFSUB':
01338                                         $natVal = $this->isSubMenu($this->menuArr[$key]['uid']);
01339                                 break;
01340                                 case 'ACT':
01341                                         $natVal = $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key));
01342                                 break;
01343                                 case 'ACTIFSUB':
01344                                         $natVal = $this->isActive($this->menuArr[$key]['uid'], $this->getMPvar($key)) && $this->isSubMenu($this->menuArr[$key]['uid']);
01345                                 break;
01346                                 case 'CUR':
01347                                         $natVal = $this->isCurrent($this->menuArr[$key]['uid'], $this->getMPvar($key));
01348                                 break;
01349                                 case 'CURIFSUB':
01350                                         $natVal = $this->isCurrent($this->menuArr[$key]['uid'], $this->getMPvar($key)) && $this->isSubMenu($this->menuArr[$key]['uid']);
01351                                 break;
01352                                 case 'USR':
01353                                         $natVal = $this->menuArr[$key]['fe_group'];
01354                                 break;
01355                         }
01356                 }
01357 
01358                 return $natVal;
01359         }
01360 
01368         function accessKey($title)      {
01369                         // The global array ACCESSKEY is used to globally control if letters are already used!!
01370                 $result = Array();
01371 
01372                 $titleLen = strlen($title);
01373                 for ($a=0;$a<$titleLen;$a++)    {
01374                         $key = strtoupper(trim(substr($title,$a,1)));
01375                         if (preg_match('/[a-zA-Z]/', $key) && !isset($GLOBALS['TSFE']->accessKey[$key]))        {
01376                                 $GLOBALS['TSFE']->accessKey[$key]=1;
01377                                 $result['code'] = ' accesskey="'.$key.'"';
01378                                 $result['alt'] = ' (ALT+'.$key.')';
01379                                 break;
01380                         }
01381                 }
01382                 return $result;
01383         }
01384 
01394         function userProcess($mConfKey,$passVar)        {
01395                 if ($this->mconf[$mConfKey])    {
01396                         $funcConf = $this->mconf[$mConfKey.'.'];
01397                         $funcConf['parentObj']=&$this;
01398                         $passVar = $GLOBALS['TSFE']->cObj->callUserFunction($this->mconf[$mConfKey], $funcConf, $passVar);
01399                 }
01400                 return $passVar;
01401         }
01402 
01409         function setATagParts() {
01410                 $this->I['A1'] = '<a '.t3lib_div::implodeAttributes($this->I['linkHREF'],1).$this->I['val']['ATagParams'].$this->I['addATagParams'].$this->I['accessKey']['code'].'>';
01411                 $this->I['A2'] = '</a>';
01412         }
01413 
01422         function getPageTitle($title,$nav_title)        {
01423                 return strcmp(trim($nav_title),'') ? $nav_title : $title;
01424         }
01425 
01434         function getMPvar($key) {
01435                 if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'])     {
01436                         $localMP_array = $this->MP_array;
01437                         if ($this->menuArr[$key]['_MP_PARAM'])  $localMP_array[] = $this->menuArr[$key]['_MP_PARAM'];   // NOTICE: "_MP_PARAM" is allowed to be a commalist of PID pairs!
01438                         $MP_params = count($localMP_array) ? implode(',',$localMP_array) : '';
01439                         return $MP_params;
01440                 }
01441         }
01442 
01449         function getDoktypeExcludeWhere() {
01450                 return $this->doktypeExcludeList ? ' AND pages.doktype NOT IN ('.$this->doktypeExcludeList.')' : '';
01451         }
01452 
01453 }
01454 
01455 
01456 
01457 
01458 
01459 
01460 
01461 
01462 
01463 
01464 
01465 
01466 
01467 
01468 
01469 
01470 
01471 
01472 
01481 class tslib_tmenu extends tslib_menu {
01482 
01490         function generate()     {
01491                 $splitCount = count($this->menuArr);
01492                 if ($splitCount)        {
01493                         list($NOconf) = $this->procesItemStates($splitCount);
01494                 }
01495                 if ($this->mconf['debugItemConf'])      {echo '<h3>$NOconf:</h3>';      debug($NOconf); }
01496                 $this->result = $NOconf;
01497         }
01498 
01506         function writeMenu()    {
01507                 if (is_array($this->result) && count($this->result))    {
01508                         $this->WMcObj =t3lib_div::makeInstance('tslib_cObj');   // Create new tslib_cObj for our use
01509                         $this->WMresult='';
01510                         $this->INPfixMD5 = substr(md5(microtime().'tmenu'),0,4);
01511                         $this->WMmenuItems = count($this->result);
01512 
01513                         $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix'=>$this->mconf['submenuObjSuffixes']),$this->WMmenuItems);
01514 
01515                         $this->extProc_init();
01516                         reset($this->result);
01517                         while (list($key,$val)=each($this->result))     {
01518                                 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
01519                                 $GLOBALS['TSFE']->register['count_MENUOBJ']++;
01520 
01521                                 $this->I=array();
01522                                 $this->WMcObj->start($this->menuArr[$key],'pages');             // Initialize the cObj with the page record of the menu item
01523                                 $this->I['key'] = $key;
01524                                 $this->I['INPfix']= $this->imgNameNotRandom?'':'_'.$this->INPfixMD5.'_'.$key;
01525                                 $this->I['val'] = $val;
01526                                 $this->I['title'] = $this->WMcObj->stdWrap($this->getPageTitle($this->menuArr[$key]['title'],$this->menuArr[$key]['nav_title']),$this->I['val']['stdWrap.']);
01527                                 $this->I['uid'] = $this->menuArr[$key]['uid'];
01528                                 $this->I['mount_pid'] = $this->menuArr[$key]['mount_pid'];
01529                                 $this->I['pid'] = $this->menuArr[$key]['pid'];
01530                                 $this->I['spacer'] = $this->menuArr[$key]['isSpacer'];
01531 
01532                                         // Make link tag
01533                                 $this->I['val']['ATagParams'] = $this->I['val']['ATagParams'] ? ' '.$this->I['val']['ATagParams'] : '';
01534                                 $this->I['linkHREF'] =  $this->link($key,$this->I['val']['altTarget'],$this->mconf['forceTypeValue']);
01535 
01536                                         // Title attribute of links:
01537                                 $titleAttrValue = $this->WMcObj->stdWrap($this->I['val']['ATagTitle'],$this->I['val']['ATagTitle.']);
01538                                 if (strlen($titleAttrValue))    {
01539                                         $this->I['linkHREF']['title'] = $titleAttrValue;
01540                                 }
01541 
01542                                         // Setting "blurlink()" function:
01543                                 if (!$this->mconf['noBlur'])    {
01544                                         $this->I['linkHREF']['onFocus']='blurLink(this);';
01545                                 }
01546 
01547                                         // Make link:
01548                                 if ($this->I['val']['RO'])      {
01549                                         $this->I['theName'] = $this->imgNamePrefix.$this->I['uid'].$this->I['INPfix'];
01550                                         $over='';
01551                                         $out ='';
01552                                         if ($this->I['val']['beforeROImg'])     {
01553                                                 $over.= $this->WMfreezePrefix."over('".$this->I['theName']."before');";
01554                                                 $out.= $this->WMfreezePrefix."out('".$this->I['theName']."before');";
01555                                         }
01556                                         if ($this->I['val']['afterROImg'])      {
01557                                                 $over.= $this->WMfreezePrefix."over('".$this->I['theName']."after');";
01558                                                 $out.= $this->WMfreezePrefix."out('".$this->I['theName']."after');";
01559                                         }
01560                                         $this->I['linkHREF']['onMouseover']=$over;
01561                                         $this->I['linkHREF']['onMouseout']=$out;
01562                                         if ($over || $out)      $GLOBALS['TSFE']->setJS('mouseOver');
01563 
01564                                                 // Change background color:
01565                                         if ($this->I['val']['RO_chBgColor'])    {
01566                                                 $this->addJScolorShiftFunction();
01567                                                 $chBgP = t3lib_div::trimExplode('|',$this->I['val']['RO_chBgColor']);
01568                                                 $this->I['linkHREF']['onMouseover'].="changeBGcolor('".$chBgP[2].$this->I['uid']."','".$chBgP[0]."');";
01569                                                 $this->I['linkHREF']['onMouseout'].="changeBGcolor('".$chBgP[2].$this->I['uid']."','".$chBgP[1]."');";
01570                                         }
01571 
01572                                         $this->extProc_RO($key);
01573                                 }
01574 
01575 
01576                                         // Calling extra processing function
01577                                 $this->extProc_beforeLinking($key);
01578 
01579                                         // Compile link tag
01580                                 if (!$this->I['val']['doNotLinkIt']) {$this->I['val']['doNotLinkIt']=0;}
01581                                 if (!$this->I['spacer'] && $this->I['val']['doNotLinkIt']!=1)   {
01582                                         $this->setATagParts();
01583                                 } else {
01584                                         $this->I['A1'] = '';
01585                                         $this->I['A2'] = '';
01586                                 }
01587 
01588                                         // ATAGBeforeWrap processing:
01589                                 if ($this->I['val']['ATagBeforeWrap'])  {
01590                                         $wrapPartsBefore = explode('|',$this->I['val']['linkWrap']);
01591                                         $wrapPartsAfter = array('','');
01592                                 } else {
01593                                         $wrapPartsBefore = array('','');
01594                                         $wrapPartsAfter = explode('|',$this->I['val']['linkWrap']);
01595                                 }
01596                                 if ($this->I['val']['stdWrap2'] || isset($this->I['val']['stdWrap2.'])) {
01597                                         $wrapPartsStdWrap = explode($this->I['val']['stdWrap2']?$this->I['val']['stdWrap2']:'|',$this->WMcObj->stdWrap('|',$this->I['val']['stdWrap2.']));
01598                                 } else {$wrapPartsStdWrap = array('','');}
01599 
01600                                         // Make before, middle and after parts
01601                                 $this->I['parts'] = array();
01602                                 $this->I['parts']['before']=$this->getBeforeAfter('before');
01603                                 $this->I['parts']['stdWrap2_begin']=$wrapPartsStdWrap[0];
01604                                 if (!$this->I['val']['doNotShowLink']) {
01605                                         $this->I['parts']['notATagBeforeWrap_begin'] = $wrapPartsAfter[0];
01606                                         $this->I['parts']['ATag_begin'] = $this->I['A1'];
01607                                         $this->I['parts']['ATagBeforeWrap_begin'] = $wrapPartsBefore[0];
01608                                         $this->I['parts']['title'] = $this->I['title'];
01609                                         $this->I['parts']['ATagBeforeWrap_end'] = $wrapPartsBefore[1];
01610                                         $this->I['parts']['ATag_end'] = $this->I['A2'];
01611                                         $this->I['parts']['notATagBeforeWrap_end'] = $wrapPartsAfter[1];
01612                                 }
01613                                 $this->I['parts']['stdWrap2_end']=$wrapPartsStdWrap[1];
01614                                 $this->I['parts']['after']=$this->getBeforeAfter('after');
01615 
01616                                         // Passing I to a user function
01617                                 if ($this->mconf['IProcFunc'])  {
01618                                         $this->I = $this->userProcess('IProcFunc',$this->I);
01619                                 }
01620 
01621                                         // Merge parts + beforeAllWrap
01622                                 $this->I['theItem']= implode('',$this->I['parts']);
01623                                 $this->I['theItem']= $this->extProc_beforeAllWrap($this->I['theItem'],$key);
01624 
01625                                         // allWrap:
01626                                 $allWrap = $this->WMcObj->stdWrap($this->I['val']['allWrap'],$this->I['val']['allWrap.']);
01627                                 $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'],$allWrap);
01628 
01629                                 if ($this->I['val']['subst_elementUid'])        $this->I['theItem'] = str_replace('{elementUid}',$this->I['uid'],$this->I['theItem']);
01630 
01631                                         // allStdWrap:
01632                                 if (is_array($this->I['val']['allStdWrap.']))   {
01633                                         $this->I['theItem'] = $this->WMcObj->stdWrap($this->I['theItem'],$this->I['val']['allStdWrap.']);
01634                                 }
01635 
01636                                         // Calling extra processing function
01637                                 $this->extProc_afterLinking($key);
01638                         }
01639                         return $this->extProc_finish();
01640                 }
01641         }
01642 
01650         function getBeforeAfter($pref)  {
01651                 $res = '';
01652                 if ($imgInfo = $this->WMcObj->getImgResource($this->I['val'][$pref.'Img'],$this->I['val'][$pref.'Img.']))       {
01653                         $imgInfo[3] = t3lib_div::png_to_gif_by_imagemagick($imgInfo[3]);
01654                         if ($this->I['val']['RO'] && $this->I['val'][$pref.'ROImg'] && !$this->I['spacer'])     {
01655                                 $imgROInfo = $this->WMcObj->getImgResource($this->I['val'][$pref.'ROImg'],$this->I['val'][$pref.'ROImg.']);
01656                                 $imgROInfo[3] = t3lib_div::png_to_gif_by_imagemagick($imgROInfo[3]);
01657                                 if ($imgROInfo) {
01658                                         $theName = $this->imgNamePrefix.$this->I['uid'].$this->I['INPfix'].$pref;
01659                                         $name = ' name="'.$theName.'"';
01660                                         $GLOBALS['TSFE']->JSImgCode.= chr(10).$theName.'_n=new Image(); '.$theName.'_n.src = "'.$GLOBALS['TSFE']->absRefPrefix.$imgInfo[3].'"; ';
01661                                         $GLOBALS['TSFE']->JSImgCode.= chr(10).$theName.'_h=new Image(); '.$theName.'_h.src = "'.$GLOBALS['TSFE']->absRefPrefix.$imgROInfo[3].'"; ';
01662                                 }
01663                         }
01664                         $GLOBALS['TSFE']->imagesOnPage[]=$imgInfo[3];
01665                         $res='<img src="'.$GLOBALS['TSFE']->absRefPrefix.$imgInfo[3].'" width="'.$imgInfo[0].'" height="'.$imgInfo[1].'"'.$name.($this->I['val'][$pref.'ImgTagParams']?" ".$this->I['val'][$pref.'ImgTagParams']:'').' border="0"';
01666                         if (!strstr($res,'alt="'))      $res.=' alt=""';        // Adding alt attribute if not set.
01667                         $res.=' />';
01668                         if ($this->I['val'][$pref.'ImgLink'])   {$res=$this->I['A1'].$res.$this->I['A2'];}
01669                 }
01670                 return $this->tmpl->wrap($res.$this->WMcObj->stdWrap($this->I['val'][$pref],$this->I['val'][$pref.'.']), $this->I['val'][$pref.'Wrap']);
01671         }
01672 
01680         function addJScolorShiftFunction()      {
01681                 $GLOBALS['TSFE']->additionalJavaScript['TMENU:changeBGcolor()']='
01682                         function changeBGcolor(id,color) {      //
01683                                 if (document.getElementById && document.getElementById(id))     {
01684                                         document.getElementById(id).style.background = color;
01685                                         return true;
01686                                 } else if (document.layers && document.layers[id]) {
01687                                 document.layers[id].bgColor = color;
01688                                         return true;
01689                             }
01690                         }
01691                 ';
01692         }
01693 
01702         function extProc_init() {
01703         }
01704 
01713         function extProc_RO($key)       {
01714         }
01715 
01724         function extProc_beforeLinking($key)    {
01725         }
01726 
01736         function extProc_afterLinking($key)     {
01737                         // Add part to the accumulated result + fetch submenus
01738                 if (!$this->I['spacer'])        {
01739                         $this->I['theItem'].= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
01740                 }
01741                 $this->WMresult.= $this->I['val']['wrapItemAndSub'] ? $this->tmpl->wrap($this->I['theItem'],$this->I['val']['wrapItemAndSub']) : $this->I['theItem'];
01742         }
01743 
01753         function extProc_beforeAllWrap($item,$key)      {
01754                 return $item;
01755         }
01756 
01764         function extProc_finish()       {
01765                 return $this->tmpl->wrap($this->WMresult,$this->mconf['wrap']).$this->WMextraScript;
01766         }
01767 }
01768 
01769 
01770 
01771 
01772 
01773 
01774 
01775 
01776 
01777 
01778 
01779 
01780 
01781 
01782 
01783 
01784 
01785 
01786 
01787 
01788 
01789 
01790 
01791 
01800 class tslib_gmenu extends tslib_menu {
01801 
01809         function generate()     {
01810                 $splitCount = count($this->menuArr);
01811                 if ($splitCount)        {
01812                         list($NOconf,$ROconf) = $this->procesItemStates($splitCount);
01813 
01814                                 //store initial count value
01815                         $temp_HMENU_MENUOBJ = $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'];
01816                         $temp_MENUOBJ = $GLOBALS['TSFE']->register['count_MENUOBJ'];
01817                                 // Now we generate the giffiles:
01818                         $this->makeGifs($NOconf,'NO');
01819                                 // store count from NO obj
01820                         $tempcnt_HMENU_MENUOBJ = $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'];
01821                         $tempcnt_MENUOBJ = $GLOBALS['TSFE']->register['count_MENUOBJ'];
01822 
01823                         if ($this->mconf['debugItemConf'])      {echo '<h3>$NOconf:</h3>';      debug($NOconf); }
01824                         if ($ROconf)    {               // RollOver
01825                                         //start recount for rollover with initial values
01826                                 $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']= $temp_HMENU_MENUOBJ;
01827                                 $GLOBALS['TSFE']->register['count_MENUOBJ']= $temp_MENUOBJ;
01828                                 $this->makeGifs($ROconf,'RO');
01829                                 if ($this->mconf['debugItemConf'])      {echo '<h3>$ROconf:</h3>';      debug($ROconf); }
01830                         }
01831                                 // use count from NO obj
01832                         $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = $tempcnt_HMENU_MENUOBJ;
01833                         $GLOBALS['TSFE']->register['count_MENUOBJ'] = $tempcnt_MENUOBJ;
01834                 }
01835         }
01836 
01847         function makeGifs($conf, $resKey)       {
01848                 $isGD = $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'];
01849 
01850                 if (!is_array($conf)) {
01851                         $conf = Array();
01852                 }
01853 
01854                 $totalWH=array();
01855                 $items = count($conf);
01856                 if ($isGD)      {
01857                                 // generate the gif-files. the $menuArr is filled with some values like output_w, output_h, output_file
01858                         $Hcounter = 0;
01859                         $Wcounter = 0;
01860                         $Hobjs = $this->mconf['applyTotalH'];
01861                         if ($Hobjs)     {$Hobjs = t3lib_div::intExplode(',',$Hobjs);}
01862                         $Wobjs = $this->mconf['applyTotalW'];
01863                         if ($Wobjs)     {$Wobjs = t3lib_div::intExplode(',',$Wobjs);}
01864                         $minDim = $this->mconf['min'];
01865                         if ($minDim) {$minDim = tslib_cObj::calcIntExplode(',',$minDim.',');}
01866                         $maxDim = $this->mconf['max'];
01867                         if ($maxDim) {$maxDim = tslib_cObj::calcIntExplode(',',$maxDim.',');}
01868 
01869                         if ($minDim)    {
01870                                 $conf[$items]=$conf[$items-1];
01871                                 $this->menuArr[$items]=Array();
01872                                 $items = count($conf);
01873                         }
01874 
01875                         // TOTAL width
01876                         if ($this->mconf['useLargestItemX'] || $this->mconf['useLargestItemY'] || $this->mconf['distributeX'] || $this->mconf['distributeY'])   {
01877                                 $totalWH = $this->findLargestDims($conf,$items,$Hobjs,$Wobjs,$minDim,$maxDim);
01878                         }
01879                 }
01880 
01881                 $c=0;
01882                 $maxFlag=0;
01883                 $distributeAccu=array('H'=>0,'W'=>0);
01884                 reset($conf);
01885                 while (list($key,$val)=each($conf))     {
01886                         $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']++;
01887                         $GLOBALS['TSFE']->register['count_MENUOBJ']++;
01888 
01889                         if ($items==($c+1) && $minDim)  {
01890                                 $Lobjs = $this->mconf['removeObjectsOfDummy'];
01891                                 if ($Lobjs)     {
01892                                         $Lobjs = t3lib_div::intExplode(',',$Lobjs);
01893                                         reset($Lobjs);
01894                                         while(list(,$remItem)=each($Lobjs))     {
01895                                                 unset($val[$remItem]);
01896                                                 unset($val[$remItem.'.']);
01897                                         }
01898                                 }
01899 
01900                                 $flag =0;
01901                                 $tempXY = explode(',',$val['XY']);
01902                                 if ($Wcounter<$minDim[0])       {$tempXY[0]=$minDim[0]-$Wcounter; $flag=1;}
01903                                 if ($Hcounter<$minDim[1])       {$tempXY[1]=$minDim[1]-$Hcounter; $flag=1;}
01904                                 $val['XY'] = implode(',',$tempXY);
01905                                 if (!$flag){break;}
01906                         }
01907                         $c++;
01908 
01909 
01910                         if ($isGD)      {
01911                                         // Pre-working the item
01912                                 $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
01913                                 $gifCreator->init();
01914                                 $gifCreator->start($val,$this->menuArr[$key]);
01915 
01916                                         // If useLargestItemH/W is specified
01917                                 if (count($totalWH) && ($this->mconf['useLargestItemX'] || $this->mconf['useLargestItemY']))    {
01918                                         $tempXY = explode(',',$gifCreator->setup['XY']);
01919                                         if ($this->mconf['useLargestItemX'])    {$tempXY[0] = max($totalWH['W']);}
01920                                         if ($this->mconf['useLargestItemY'])    {$tempXY[1] = max($totalWH['H']);}
01921                                                 // regenerate the new values...
01922                                         $val['XY'] = implode(',',$tempXY);
01923                                         $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
01924                                         $gifCreator->init();
01925                                         $gifCreator->start($val,$this->menuArr[$key]);
01926                                 }
01927 
01928                                         // If distributeH/W is specified
01929                                 if (count($totalWH) && ($this->mconf['distributeX'] || $this->mconf['distributeY']))    {
01930                                         $tempXY = explode(',',$gifCreator->setup['XY']);
01931 
01932                                         if ($this->mconf['distributeX'])        {
01933                                                 $diff = $this->mconf['distributeX']-$totalWH['W_total']-$distributeAccu['W'];
01934                                                 $compensate = round($diff /($items-$c+1));
01935                                                 $distributeAccu['W']+=$compensate;
01936                                                 $tempXY[0] = $totalWH['W'][$key]+$compensate;
01937                                         }
01938                                         if ($this->mconf['distributeY'])        {
01939                                                 $diff = $this->mconf['distributeY']-$totalWH['H_total']-$distributeAccu['H'];
01940                                                 $compensate = round($diff /($items-$c+1));
01941                                                 $distributeAccu['H']+=$compensate;
01942                                                 $tempXY[1] = $totalWH['H'][$key]+$compensate;
01943                                         }
01944                                                 // regenerate the new values...
01945                                         $val['XY'] = implode(',',$tempXY);
01946                                         $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
01947                                         $gifCreator->init();
01948                                         $gifCreator->start($val,$this->menuArr[$key]);
01949                                 }
01950 
01951                                         // If max dimensions are specified
01952                                 if ($maxDim)    {
01953                                         $tempXY = explode(',',$val['XY']);
01954                                         if ($maxDim[0] && $Wcounter+$gifCreator->XY[0]>=$maxDim[0])     {$tempXY[0]==$maxDim[0]-$Wcounter; $maxFlag=1;}
01955                                         if ($maxDim[1] && $Hcounter+$gifCreator->XY[1]>=$maxDim[1])     {$tempXY[1]=$maxDim[1]-$Hcounter; $maxFlag=1;}
01956                                         if ($maxFlag)   {
01957                                                 $val['XY'] = implode(',',$tempXY);
01958                                                 $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
01959                                                 $gifCreator->init();
01960                                                 $gifCreator->start($val,$this->menuArr[$key]);
01961                                         }
01962                                 }
01963 
01964 
01965 
01966 
01967                                 // displace
01968                                 if ($Hobjs)     {
01969                                         reset($Hobjs);
01970                                         while(list(,$index)=each($Hobjs))       {
01971                                                 if ($gifCreator->setup[$index] && $gifCreator->setup[$index.'.'])       {
01972                                                         $oldOffset = explode(',',$gifCreator->setup[$index.'.']['offset']);
01973                                                         $gifCreator->setup[$index.'.']['offset'] = implode(',',$gifCreator->applyOffset($oldOffset,Array(0,-$Hcounter)));
01974                                                 }
01975                                         }
01976                                 }
01977 
01978                                 if ($Wobjs)     {
01979                                         reset($Wobjs);
01980                                         while(list(,$index)=each($Wobjs))       {
01981                                                 if ($gifCreator->setup[$index] && $gifCreator->setup[$index.'.'])       {
01982                                                         $oldOffset = explode(',',$gifCreator->setup[$index.'.']['offset']);
01983                                                         $gifCreator->setup[$index.'.']['offset'] = implode(',',$gifCreator->applyOffset($oldOffset,Array(-$Wcounter,0)));
01984                                                 }
01985                                         }
01986                                 }
01987                         }
01988 
01989                                 // Finding alternative GIF names if any (by altImgResource)
01990                         $gifFileName='';
01991                         if ($conf[$key]['altImgResource'] || is_array($conf[$key]['altImgResource.']))  {
01992                                 if (!is_object($cObj)) {$cObj=t3lib_div::makeInstance('tslib_cObj');}
01993                                 $cObj->start($this->menuArr[$key],'pages');
01994                                 $altImgInfo = $cObj->getImgResource($conf[$key]['altImgResource'],$conf[$key]['altImgResource.']);
01995                                 $gifFileName=$altImgInfo[3];
01996                         }
01997 
01998                                 // If an alternative name was NOT given, find the GIFBUILDER name.
01999                         if (!$gifFileName && $isGD)     {
02000                                 $gifCreator->createTempSubDir('menu/');
02001                                 $gifFileName = $gifCreator->fileName('menu/');
02002                         }
02003 
02004                                 // Generation of image file:
02005                         if (@file_exists($gifFileName)) {               // File exists
02006                                 $info = @getimagesize($gifFileName);
02007                                 $this->result[$resKey][$key]['output_w']=intval($info[0]);
02008                                 $this->result[$resKey][$key]['output_h']=intval($info[1]);
02009                                 $this->result[$resKey][$key]['output_file']=$gifFileName;
02010                         } elseif ($isGD) {              // file is generated
02011                                 $gifCreator->make();
02012                                 $this->result[$resKey][$key]['output_w']=$gifCreator->w;
02013                                 $this->result[$resKey][$key]['output_h']=$gifCreator->h;
02014                                 $this->result[$resKey][$key]['output_file'] = $gifFileName;
02015                                 $gifCreator->output($this->result[$resKey][$key]['output_file']);
02016                                 $gifCreator->destroy();
02017                         }
02018                         $this->result[$resKey][$key]['output_file'] = t3lib_div::png_to_gif_by_imagemagick($this->result[$resKey][$key]['output_file']);
02019                         $this->result[$resKey][$key]['noLink']=$conf[$key]['noLink'];
02020                         $this->result[$resKey][$key]['altTarget']=$conf[$key]['altTarget'];
02021                         $this->result[$resKey][$key]['imgParams']=$conf[$key]['imgParams'];
02022                         $this->result[$resKey][$key]['ATagTitle'] = $conf[$key]['ATagTitle'];
02023                         $this->result[$resKey][$key]['ATagTitle.'] = $conf[$key]['ATagTitle.'];
02024                         $this->result[$resKey][$key]['wrap'] = $conf[$key]['wrap'];
02025                         $this->result[$resKey][$key]['allWrap'] = $conf[$key]['allWrap'];
02026                         $this->result[$resKey][$key]['allWrap.'] = $conf[$key]['allWrap.'];
02027                         $this->result[$resKey][$key]['subst_elementUid'] = $conf[$key]['subst_elementUid'];
02028                         $this->result[$resKey][$key]['allStdWrap.'] = $conf[$key]['allStdWrap.'];
02029 
02030                         $Hcounter+=$this->result[$resKey][$key]['output_h'];            // counter is increased
02031                         $Wcounter+=$this->result[$resKey][$key]['output_w'];            // counter is increased
02032 
02033                         if ($maxFlag){break;}
02034                 }
02035         }
02036 
02052         function findLargestDims($conf,$items,$Hobjs,$Wobjs,$minDim,$maxDim)    {
02053                 $totalWH = array(
02054                         'W' => array(),
02055                         'H' => array(),
02056                         'W_total' => 0,
02057                         'H_total' => 0
02058                 );
02059 
02060                 $Hcounter = 0;
02061                 $Wcounter = 0;
02062                 $c=0;
02063                 $maxFlag=0;
02064                 reset($conf);
02065                 while (list($key,$val)=each($conf))     {
02066                         // SAME CODE AS makeGifs()! BEGIN
02067                         if ($items==($c+1) && $minDim)  {
02068                                 $Lobjs = $this->mconf['removeObjectsOfDummy'];
02069                                 if ($Lobjs)     {
02070                                         $Lobjs = t3lib_div::intExplode(',',$Lobjs);
02071                                         reset($Lobjs);
02072                                         while(list(,$remItem)=each($Lobjs))     {
02073                                                 unset($val[$remItem]);
02074                                                 unset($val[$remItem.'.']);
02075                                         }
02076                                 }
02077 
02078                                 $flag =0;
02079                                 $tempXY = explode(',',$val['XY']);
02080                                 if ($Wcounter<$minDim[0])       {$tempXY[0]=$minDim[0]-$Wcounter; $flag=1;}
02081                                 if ($Hcounter<$minDim[1])       {$tempXY[1]=$minDim[1]-$Hcounter; $flag=1;}
02082                                 $val['XY'] = implode(',',$tempXY);
02083                                 if (!$flag){break;}
02084                         }
02085                         $c++;
02086 
02087                         $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
02088                         $gifCreator->init();
02089                         $gifCreator->start($val,$this->menuArr[$key]);
02090                         if ($maxDim)    {
02091                                 $tempXY = explode(',',$val['XY']);
02092                                 if ($maxDim[0] && $Wcounter+$gifCreator->XY[0]>=$maxDim[0])     {$tempXY[0]==$maxDim[0]-$Wcounter; $maxFlag=1;}
02093                                 if ($maxDim[1] && $Hcounter+$gifCreator->XY[1]>=$maxDim[1])     {$tempXY[1]=$maxDim[1]-$Hcounter; $maxFlag=1;}
02094                                 if ($maxFlag)   {
02095                                         $val['XY'] = implode(',',$tempXY);
02096                                         $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
02097                                         $gifCreator->init();
02098                                         $gifCreator->start($val,$this->menuArr[$key]);
02099                                 }
02100                         }
02101                         // SAME CODE AS makeGifs()! END
02102 
02103                                 // Setting the width/height
02104                         $totalWH['W'][$key]=$gifCreator->XY[0];
02105                         $totalWH['H'][$key]=$gifCreator->XY[1];
02106                         $totalWH['W_total']+=$gifCreator->XY[0];
02107                         $totalWH['H_total']+=$gifCreator->XY[1];
02108                                 // ---- //
02109 
02110                         $Hcounter+=$gifCreator->XY[1];          // counter is increased
02111                         $Wcounter+=$gifCreator->XY[0];          // counter is increased
02112 
02113                         if ($maxFlag){break;}
02114                 }
02115                 return $totalWH;
02116         }
02117 
02124         function writeMenu()    {
02125                 if (is_array($this->menuArr) && is_array($this->result) && count($this->result) && is_array($this->result['NO']))       {
02126                         $this->WMcObj = t3lib_div::makeInstance('tslib_cObj');  // Create new tslib_cObj for our use
02127                         $this->WMresult='';
02128                         $this->INPfixMD5 = substr(md5(microtime().$this->GMENU_fixKey),0,4);
02129                         $this->WMmenuItems = count($this->result['NO']);
02130 
02131                         $this->WMsubmenuObjSuffixes = $this->tmpl->splitConfArray(array('sOSuffix'=>$this->mconf['submenuObjSuffixes']),$this->WMmenuItems);
02132 
02133                         $this->extProc_init();
02134                         for ($key=0;$key<$this->WMmenuItems;$key++)     {
02135                                 if ($this->result['NO'][$key]['output_file'])   {
02136                                         $this->WMcObj->start($this->menuArr[$key],'pages');             // Initialize the cObj with the page record of the menu item
02137 
02138                                         $this->I =array();
02139                                         $this->I['key'] = $key;
02140                                         $this->I['INPfix']= $this->imgNameNotRandom?'':'_'.$this->INPfixMD5.'_'.$key;
02141                                         $this->I['val'] = $this->result['NO'][$key];
02142                                         $this->I['title'] = $this->getPageTitle($this->menuArr[$key]['title'],$this->menuArr[$key]['nav_title']);
02143                                         $this->I['uid'] = $this->menuArr[$key]['uid'];
02144                                         $this->I['mount_pid'] = $this->menuArr[$key]['mount_pid'];
02145                                         $this->I['pid'] = $this->menuArr[$key]['pid'];
02146                                         $this->I['spacer'] = $this->menuArr[$key]['isSpacer'];
02147                                         if (!$this->I['uid'] && !$this->menuArr[$key]['_OVERRIDE_HREF']) {$this->I['spacer']=1;}
02148                                         $this->I['noLink'] = ($this->I['spacer'] || $this->I['val']['noLink'] || !count($this->menuArr[$key]));         // !count($this->menuArr[$key]) means that this item is a dummyItem
02149                                         $this->I['name']='';
02150 
02151                                                 // Get link.
02152                                         $this->I['linkHREF'] = $this->link($key,$this->I['val']['altTarget'],$this->mconf['forceTypeValue']);
02153                                                 // Title attribute of links:
02154                                         $titleAttrValue = $this->WMcObj->stdWrap($this->I['val']['ATagTitle'],$this->I['val']['ATagTitle.']);
02155                                         if (strlen($titleAttrValue))    {
02156                                                 $this->I['linkHREF']['title'] = $titleAttrValue;
02157                                         }
02158                                                 // Setting "blurlink()" function:
02159                                         if (!$this->mconf['noBlur'])    {
02160                                                 $this->I['linkHREF']['onFocus']='blurLink(this);';
02161                                         }
02162 
02163                                                 // Set rollover
02164                                         if ($this->result['RO'][$key] && !$this->I['noLink'])   {
02165                                                 $this->I['theName'] = $this->imgNamePrefix.$this->I['uid'].$this->I['INPfix'];
02166                                                 $this->I['name'] = ' name="'.$this->I["theName"].'"';
02167                                                 $this->I['linkHREF']['onMouseover']=$this->WMfreezePrefix.'over(\''.$this->I['theName'].'\');';
02168                                                 $this->I['linkHREF']['onMouseout']=$this->WMfreezePrefix.'out(\''.$this->I['theName'].'\');';
02169                                                 $GLOBALS['TSFE']->JSImgCode.= chr(10).$this->I['theName'].'_n=new Image(); '.$this->I['theName'].'_n.src = "'.$GLOBALS['TSFE']->absRefPrefix.$this->I['val']['output_file'].'"; ';
02170                                                 $GLOBALS['TSFE']->JSImgCode.= chr(10).$this->I['theName'].'_h=new Image(); '.$this->I['theName'].'_h.src = "'.$GLOBALS['TSFE']->absRefPrefix.$this->result['RO'][$key]['output_file'].'"; ';
02171                                                 $GLOBALS['TSFE']->imagesOnPage[]=$this->result['RO'][$key]['output_file'];
02172                                                 $GLOBALS['TSFE']->setJS('mouseOver');
02173                                                 $this->extProc_RO($key);
02174                                         }
02175                                                 // Set access key
02176                                         if ($this->mconf['accessKey'])  {
02177                                                 $this->I['accessKey'] = $this->accessKey($this->I['title']);
02178                                         } else {
02179                                                 $this->I['accessKey']=Array();
02180                                         }
02181 
02182                                                 // Set altText
02183                                         $this->I['altText'] = $this->mconf['disableAltText'] ? '' : $this->I['title'].$this->I['accessKey']['alt'];
02184 
02185                                                 // Calling extra processing function
02186                                         $this->extProc_beforeLinking($key);
02187 
02188                                                 // Set linking
02189                                         if (!$this->I['noLink'])        {
02190                                                 $this->setATagParts();
02191                                         } else {
02192                                                 $this->I['A1'] = '';
02193                                                 $this->I['A2'] = '';
02194                                         }
02195                                         $this->I['IMG'] = '<img src="'.$GLOBALS['TSFE']->absRefPrefix.$this->I['val']['output_file'].'" width="'.$this->I['val']['output_w'].'" height="'.$this->I['val']['output_h'].'" border="0" alt="'.htmlspecialchars($this->I['altText']).'"'.$this->I['name'].($this->I['val']['imgParams']?' '.$this->I['val']['imgParams']:'').' />';
02196 
02197                                                 // Make before, middle and after parts
02198                                         $this->I['parts'] = array();
02199                                         $this->I['parts']['ATag_begin'] = $this->I['A1'];
02200                                         $this->I['parts']['image'] = $this->I['IMG'];
02201                                         $this->I['parts']['ATag_end'] = $this->I['A2'];
02202 
02203                                                 // Passing I to a user function
02204                                         if ($this->mconf['IProcFunc'])  {
02205                                                 $this->I = $this->userProcess('IProcFunc',$this->I);
02206                                         }
02207 
02208                                                 // Putting the item together.
02209                                                 // Merge parts + beforeAllWrap
02210                                         $this->I['theItem']= implode('',$this->I['parts']);
02211                                         $this->I['theItem']= $this->extProc_beforeAllWrap($this->I['theItem'],$key);
02212 
02213                                                 // wrap:
02214                                         $this->I['theItem']= $this->tmpl->wrap($this->I['theItem'],$this->I['val']['wrap']);
02215 
02216                                                 // allWrap:
02217                                         $allWrap = $this->WMcObj->stdWrap($this->I['val']['allWrap'],$this->I['val']['allWrap.']);
02218                                         $this->I['theItem'] = $this->tmpl->wrap($this->I['theItem'],$allWrap);
02219 
02220                                         if ($this->I['val']['subst_elementUid'])        $this->I['theItem'] = str_replace('{elementUid}',$this->I['uid'],$this->I['theItem']);
02221 
02222                                                 // allStdWrap:
02223                                         if (is_array($this->I['val']['allStdWrap.']))   {
02224                                                 $this->I['theItem'] = $this->WMcObj->stdWrap($this->I['theItem'],$this->I['val']['allStdWrap.']);
02225                                         }
02226 
02227                                         $GLOBALS['TSFE']->imagesOnPage[]=$this->I['val']['output_file'];
02228 
02229                                         $this->extProc_afterLinking($key);
02230                                 }
02231                         }
02232                         return $this->extProc_finish();
02233                 }
02234         }
02235 
02244         function extProc_init() {
02245         }
02246 
02255         function extProc_RO($key)       {
02256         }
02257 
02266         function extProc_beforeLinking($key)    {
02267         }
02268 
02279         function extProc_afterLinking($key)     {
02280                 $this->WMresult.=$this->I['theItem'];
02281                 if (!$this->I['spacer'])        {
02282                         $this->WMresult.= $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
02283                 }
02284         }
02285 
02286 
02296         function extProc_beforeAllWrap($item,$key)      {
02297                 return $item;
02298         }
02299 
02307         function extProc_finish()       {
02308                 return $this->tmpl->wrap($this->WMresult,$this->mconf['wrap']).$this->WMextraScript;
02309         }
02310 }
02311 
02312 
02313 
02314 
02315 
02316 
02317 
02318 
02319 
02320 
02321 
02322 
02323 
02324 
02325 
02326 
02327 
02328 
02329 
02330 
02331 
02332 
02341 class tslib_imgmenu extends tslib_menu {
02342 
02350         function generate()     {
02351                 $splitCount = count($this->menuArr);
02352                 if ($splitCount)        {
02353                         list($NOconf) = $this->procesItemStates($splitCount);
02354                 }
02355                 if ($this->mconf['debugItemConf'])      {echo '<h3>$NOconf:</h3>';      debug($NOconf); }
02356                 $this->makeImageMap($NOconf);
02357         }
02358 
02368         function makeImageMap($conf)    {
02369                 if (!is_array($conf)) {
02370                         $conf = Array();
02371                 }
02372                 if (is_array($this->mconf['main.']))    {
02373                         $gifCreator = t3lib_div::makeInstance('tslib_gifBuilder');
02374                         $gifCreator->init();
02375 
02376                         $itemsConf = $conf;
02377                         $conf = $this->mconf['main.'];
02378                         if (is_array($conf))    {
02379                                 $gifObjCount = 0;
02380 
02381                                 $sKeyArray=t3lib_TStemplate::sortedKeyList($conf);
02382                                 $gifObjCount=intval(end($sKeyArray));
02383 
02384                                 $lastOriginal = $gifObjCount;
02385 
02386                                         // Now we add graphical objects to the gifbuilder-setup
02387                                 reset($itemsConf);
02388                                 $waArr = Array();
02389                                 while (list($key,$val)=each($itemsConf))        {
02390                                         if (is_array($val))     {
02391                                                 $gifObjCount++;
02392                                                 $waArr[$key]['free']=$gifObjCount;
02393 
02394                                                 $sKeyArray=t3lib_TStemplate::sortedKeyList($val);
02395 
02396                                                 foreach($sKeyArray as $theKey)  {
02397                                                         $theValue=$val[$theKey];
02398 
02399 
02400                                                         if (intval($theKey) && $theValArr=$val[$theKey.'.'])    {
02401                                                                 $cObjData = $this->menuArr[$key] ? $this->menuArr[$key] : Array();
02402 
02403                                                                 $gifObjCount++;
02404                                                                 if ($theValue=='TEXT') {
02405                                                                         $waArr[$key]['textNum']=$gifObjCount;
02406 
02407                                                                         $gifCreator->data = $cObjData;
02408                                                                         $theValArr = $gifCreator->checkTextObj($theValArr);
02409                                                                         unset($theValArr['text.']);     // if this is not done it seems that imageMaps will be rendered wrong!!
02410                                                                                 // check links
02411 
02412                                                                         $LD = $this->tmpl->linkData($this->menuArr[$key],$this->mconf['target'],'','',array(),'',$this->mconf['forceTypeValue']);
02413 
02414                                                                                 // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
02415                                                                         $this->changeLinksForAccessRestrictedPages($LD, $this->menuArr[$key], $this->mconf['target'], $this->mconf['forceTypeValue']);
02416 
02417                                                                                 // Overriding URL / Target if set to do so:
02418                                                                         if ($this->menuArr[$key]['_OVERRIDE_HREF'])     {
02419                                                                                 $LD['totalURL'] = $this->menuArr[$key]['_OVERRIDE_HREF'];
02420                                                                                 if ($this->menuArr[$key]['_OVERRIDE_TARGET'])   $LD['target'] = $this->menuArr[$key]['_OVERRIDE_TARGET'];
02421                                                                         }
02422 
02423                                                                                 // Setting target/url for Image Map:
02424                                                                         if ($theValArr['imgMap.']['url']=='')   {
02425                                                                                 $theValArr['imgMap.']['url'] = $LD['totalURL'];
02426                                                                         }
02427                                                                         if ($theValArr['imgMap.']['target']=='')        {
02428                                                                                 $theValArr['imgMap.']['target'] = $LD['target'];
02429                                                                         }
02430                                                                         if ($theValArr['imgMap.']['noBlur']=='')        {
02431                                                                                 $theValArr['imgMap.']['noBlur'] = $this->mconf['noBlur'];
02432                                                                         }
02433                                                                         if (is_array($theValArr['imgMap.']['altText.']))        {
02434                                                                                 $cObj =t3lib_div::makeInstance('tslib_cObj');
02435                                                                                 $cObj->start($cObjData,'pages');
02436                                                                                 $theValArr['imgMap.']['altText'] = $cObj->stdWrap($theValArr['imgMap.']['altText'], $theValArr['imgMap.']['altText.']);
02437                                                                                 unset($theValArr['imgMap.']['altText.']);
02438                                                                 }
02439                                                                         if (is_array($theValArr['imgMap.']['titleText.']))      {
02440                                                                                 $cObj =t3lib_div::makeInstance('tslib_cObj');
02441                                                                                 $cObj->start($cObjData,'pages');
02442                                                                                 $theValArr['imgMap.']['titleText'] = $cObj->stdWrap($theValArr['imgMap.']['titleText'], $theValArr['imgMap.']['titleText.']);
02443                                                                                 unset($theValArr['imgMap.']['titleText.']);
02444                                                                         }
02445                                                                 }
02446                                                                         // This code goes one level in if the object is an image. If 'file' and/or 'mask' appears to be GIFBUILDER-objects, they are both searched for TEXT objects, and if a textobj is found, it's checked with the currently loaded record!!
02447                                                                 if ($theValue=='IMAGE') {
02448                                                                         if ($theValArr['file']=='GIFBUILDER')   {
02449                                                                                 $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['file.']);
02450                                                                                 reset($temp_sKeyArray);
02451                                                                                 while(list(,$temp_theKey)=each($temp_sKeyArray))        {
02452                                                                                         if ($theValArr['mask.'][$temp_theKey]=='TEXT')  {
02453                                                                                                 $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array();
02454                                                                                                 $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']);
02455                                                                                                 unset($theValArr['mask.'][$temp_theKey.'.']['text.']);  // if this is not done it seems that imageMaps will be rendered wrong!!
02456                                                                                         }
02457                                                                                 }
02458                                                                         }
02459                                                                         if ($theValArr['mask']=='GIFBUILDER')   {
02460                                                                                 $temp_sKeyArray=t3lib_TStemplate::sortedKeyList($theValArr['mask.']);
02461                                                                                 reset($temp_sKeyArray);
02462                                                                                 while(list(,$temp_theKey)=each($temp_sKeyArray))        {
02463                                                                                         if ($theValArr['mask.'][$temp_theKey]=='TEXT')  {
02464                                                                                                 $gifCreator->data = $this->menuArr[$key] ? $this->menuArr[$key] : Array();
02465                                                                                                 $theValArr['mask.'][$temp_theKey.'.'] = $gifCreator->checkTextObj($theValArr['mask.'][$temp_theKey.'.']);
02466                                                                                                 unset($theValArr['mask.'][$temp_theKey.'.']['text.']);  // if this is not done it seems that imageMaps will be rendered wrong!!
02467                                                                                         }
02468                                                                                 }
02469                                                                         }
02470                                                                 }
02471 
02472                                                                         // Checks if disabled is set...
02473                                                                 $setObjFlag=1;
02474                                                                 if ($theValArr['if.'])  {
02475                                                                         $cObj =t3lib_div::makeInstance('tslib_cObj');
02476                                                                         $cObj->start($cObjData,'pages');
02477                                                                         if (!$cObj->checkIf($theValArr['if.'])) {
02478                                                                                 $setObjFlag=0;
02479                                                                         }
02480                                                                         unset($theValArr['if.']);
02481                                                                 }
02482                                                                         // Set the object!
02483                                                                 if ($setObjFlag)        {
02484                                                                         $conf[$gifObjCount] = $theValue;
02485                                                                         $conf[$gifObjCount.'.'] = $theValArr;
02486                                                                 }
02487                                                         }
02488                                                 }
02489                                         }
02490                                 }
02491 
02492                                 $gifCreator->start($conf,$GLOBALS['TSFE']->page);
02493                                         // calculations
02494 
02495                                 $sum=Array(0,0,0,0);
02496                                 reset($waArr);
02497                                 while (list($key,$val)=each($waArr))    {
02498                                         if ($dConf[$key] =$itemsConf[$key]['distrib'])  {
02499                                                 $textBB = $gifCreator->objBB[$val['textNum']];
02500                                                 $dConf[$key] = str_replace('textX',$textBB[0],$dConf[$key]);
02501                                                 $dConf[$key] = str_replace('textY',$textBB[1],$dConf[$key]);
02502                                                 $dConf[$key] = t3lib_div::intExplode(',',$gifCreator->calcOffset($dConf[$key]));
02503                                         }
02504                                 }
02505                                 $workArea = t3lib_div::intExplode(',',$gifCreator->calcOffset($this->mconf['dWorkArea']));
02506                                 reset($waArr);
02507                                 while (list($key,$val)=each($waArr))    {
02508                                         $index = $val['free'];
02509                                         $gifCreator->setup[$index] = 'WORKAREA';
02510                                         $workArea[2] = $dConf[$key][2] ? $dConf[$key][2] : $dConf[$key][0];
02511                                         $workArea[3] = $dConf[$key][3] ? $dConf[$key][3] : $dConf[$key][1];
02512 
02513                                         $gifCreator->setup[$index.'.']['set'] = implode(',',$workArea);
02514                                         $workArea[0]+=$dConf[$key][0];
02515                                         $workArea[1]+=$dConf[$key][1];
02516                                 }
02517 
02518                                 if ($this->mconf['debugRenumberedObject'])      {echo '<h3>Renumbered GIFBUILDER object:</h3>'; debug($gifCreator->setup);}
02519 
02520                                 $gifCreator->createTempSubDir('menu/');
02521                                 $gifFileName = $gifCreator->fileName('menu/');
02522 
02523                                         // Gets the ImageMap from the cache...
02524                                 $imgHash = md5($gifFileName);
02525                                 $imgMap = $this->sys_page->getHash($imgHash, 0);
02526 
02527                                 if ($imgMap && @file_exists($gifFileName))      {               // File exists
02528                                         $info = @getimagesize($gifFileName);
02529                                         $w=$info[0];
02530                                         $h=$info[1];
02531                                 } else {                // file is generated
02532                                         $gifCreator->make();
02533                                         $w=$gifCreator->w;
02534                                         $h=$gifCreator->h;
02535                                         $gifCreator->output($gifFileName);
02536                                         $gifCreator->destroy();
02537                                         $imgMap=$gifCreator->map;
02538                                         $this->sys_page->storeHash($imgHash, $imgMap, 'MENU IMAGEMAP');
02539                                 }
02540                                 $imgMap.=$this->mconf['imgMapExtras'];
02541 
02542                                 $gifFileName = t3lib_div::png_to_gif_by_imagemagick($gifFileName);
02543                                 $this->result = Array('output_file'=>$gifFileName, 'output_w'=>$w, 'output_h'=>$h, 'imgMap'=>$imgMap);
02544                         }
02545                 }
02546         }
02547 
02554         function writeMenu()    {
02555                 if ($this->result)      {
02556                         $res = $this->result;
02557                         $menuName = 'menu_'.t3lib_div::shortMD5($res['imgMap']);        // shortMD5 260900
02558                         $result = '<img src="'.$GLOBALS['TSFE']->absRefPrefix.$res['output_file'].'" width="'.$res['output_w'].'" height="'.$res['output_h'].'" usemap="#'.$menuName.'" border="0" '.$this->mconf['params'];
02559                         if (!strstr($result,'alt="'))   $result.=' alt="Menu Image Map"';       // Adding alt attribute if not set.
02560                         $result.= ' /><map name="'.$menuName.'" id="'.$menuName.'">'.$res['imgMap'].'</map>';
02561 
02562                         $GLOBALS['TSFE']->imagesOnPage[]=$res['output_file'];
02563 
02564                         return $this->tmpl->wrap($result,$this->mconf['wrap']);
02565                 }
02566         }
02567 }
02568 
02569 
02570 
02571 
02572 
02573 
02574 
02575 
02576 
02577 
02578 
02579 
02580 
02581 
02582 
02583 
02584 
02585 
02586 
02587 
02588 
02597 class tslib_jsmenu extends tslib_menu {
02598 
02604         function generate()     {
02605         }
02606 
02612         function writeMenu()    {
02613                 if ($this->id)  {
02614                                 // Making levels:
02615                         $levels = t3lib_div::intInRange($this->mconf['levels'],1,5);
02616                         $this->levels = $levels;
02617                         $this->JSVarName='eid';
02618                         $this->JSMenuName= $this->mconf['menuName'] ? $this->mconf['menuName'] : 'JSmenu';
02619 
02620                         $JScode="\n var ".$this->JSMenuName." = new JSmenu(".$levels.",'".$this->JSMenuName."Form');";
02621 
02622                         for ($a=1;$a<=$levels;$a++)     {
02623                                 $JScode.="\n var ".$this->JSVarName.$a."=0;";
02624                         }
02625                         $JScode.= $this->generate_level($levels,1,$this->id,$this->menuArr,$this->MP_array)."\n";
02626 
02627                         $GLOBALS['TSFE']->additionalHeaderData['JSMenuCode']='<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.menu.js"></script>';
02628                         $GLOBALS['TSFE']->JSCode.=$JScode;
02629 
02630                                 // Printing:
02631                         $allFormCode="";
02632                         for ($a=1;$a<=$this->levels;$a++)       {
02633                                 $formCode='';
02634                                 $levelConf = $this->mconf[$a.'.'];
02635                                 $length = $levelConf['width'] ? $levelConf['width'] : 14;
02636                                 $lenghtStr='';
02637                                 for ($b=0;$b<$length;$b++)      {
02638                                         $lenghtStr.='_';
02639                                 }
02640                                 $height = $levelConf['elements'] ? $levelConf['elements'] : 5;
02641 
02642                                 $formCode.= '<select name="selector'.$a.'" onchange="'.$this->JSMenuName.'.act('.$a.');"'.($levelConf['additionalParams']?' '.$levelConf['additionalParams']:'').'>';
02643                                 for ($b=0;$b<$height;$b++)      {
02644                                         $formCode.= '<option value="0">';
02645                                         if ($b==0)      {
02646                                                 $formCode.= $lenghtStr;
02647                                         }
02648                                         $formCode.='</option>';
02649                                 }
02650                                 $formCode.= '</select>';
02651                                 $allFormCode.=$this->tmpl->wrap($formCode,$levelConf['wrap']);
02652                         }
02653                         $formCode = $this->tmpl->wrap($allFormCode,$this->mconf['wrap']);
02654 
02655                         $formCode= '<form action="" method="post" style="margin: 0 0 0 0;" name="'.$this->JSMenuName.'Form">'.$formCode.'</form>';
02656                         $formCode.='<script type="text/javascript"> /*<![CDATA[*/ '.$this->JSMenuName.'.writeOut(1,'.$this->JSMenuName.'.openID,1); /*]]>*/ </script>';
02657                         return $this->tmpl->wrap($formCode,$this->mconf['wrapAfterTags']);
02658                 }
02659         }
02660 
02673         function generate_level($levels,$count,$pid,$menuItemArray='',$MP_array=array())        {
02674                 $levelConf = $this->mconf[$count.'.'];
02675 
02676                         // Translate PID to a mount page, if any:
02677                 $mount_info = $this->sys_page->getMountPointInfo($pid);
02678                 if (is_array($mount_info))      {
02679                         $MP_array[] = $mount_info['MPvar'];
02680                         $pid = $mount_info['mount_pid'];
02681                 }
02682 
02683                         // Set "&MP=" var:
02684                 $MP_var = implode(',',$MP_array);
02685                 $MP_params = $MP_var ? '&MP='.rawurlencode($MP_var) : '';
02686 
02687                         // UIDs to ban:
02688                 $banUidArray=array();
02689                 if (trim($this->conf['excludeUidList']))        {
02690                         $banUidArray = t3lib_div::intExplode(',', $this->conf['excludeUidList']);
02691                 }
02692 
02693                         // Initializing variables:
02694                 $var = $this->JSVarName;
02695                 $menuName = $this->JSMenuName;
02696                 $parent = $count==1 ? 0 : $var.($count-1);
02697                 $prev=0;
02698                 $c=0;
02699 
02700                 $menuItems = is_array($menuItemArray) ? $menuItemArray : $this->sys_page->getMenu($pid);
02701                 foreach($menuItems as $uid => $data)    {
02702                         $spacer = (t3lib_div::inList($this->spacerIDList,$data['doktype'])?1:0);                // if item is a spacer, $spacer is set
02703                         if ($this->mconf['SPC'] || !$spacer)    {       // If the spacer-function is not enabled, spacers will not enter the $menuArr
02704                                 if (!t3lib_div::inList($this->doktypeExcludeList,$data['doktype']) && !$data['nav_hide'] && !t3lib_div::inArray($banUidArray,$uid))     {               // Page may not be 'not_in_menu' or 'Backend User Section' + not in banned uid's
02705                                         if ($count<$levels)     {
02706                                                 $addLines = $this->generate_level($levels,$count+1,$data['uid'],'',$MP_array);
02707                                         } else {
02708                                                 $addLines = '';
02709                                         }
02710                                         $title=rawurlencode($data['title']);
02711                                         $url='';
02712                                         $target='';
02713                                         if ((!$addLines && !$levelConf['noLink']) || $levelConf['alwaysLink']) {
02714                                                 $LD = $this->tmpl->linkData($data,$this->mconf['target'],'','',array(),$MP_params,$this->mconf['forceTypeValue']);
02715 
02716                                                         // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
02717                                                 $this->changeLinksForAccessRestrictedPages($LD, $data, $this->mconf['target'], $this->mconf['forceTypeValue']);
02718 
02719                                                 $url = rawurlencode($LD['totalURL']);
02720                                                 $target = rawurlencode($LD['target']);
02721                                         }
02722                                         $codeLines.="\n".$var.$count."=".$menuName.".add(".$parent.",".$prev.",0,'".$title."','".$GLOBALS['TSFE']->baseUrlWrap($url)."','".$target."');";
02723                                                 // If the active one should be chosen...
02724                                         $active = ($levelConf['showActive'] && $data['uid'] == $this->tmpl->rootLine[$count]['uid']);
02725                                                 // If the first item should be shown
02726                                         $first = (!$c && $levelConf['showFirst']);
02727                                                 // do it...
02728                                         if ($active || $first)  {
02729                                                 if ($count==1)  {
02730                                                         $codeLines.="\n".$menuName.".openID = ".$var.$count.";";
02731                                                 } else {
02732                                                         $codeLines.="\n".$menuName.".entry[".$parent."].openID = ".$var.$count.";";
02733                                                 }
02734                                         }
02735                                                 // Add submenu...
02736                                         $codeLines.=$addLines;
02737 
02738                                         $prev=$var.$count;
02739                                         $c++;
02740                                 }
02741                         }
02742                 }
02743                 if ($this->mconf['firstLabelGeneral'] && !$levelConf['firstLabel'])     {
02744                         $levelConf['firstLabel'] = $this->mconf['firstLabelGeneral'];
02745                 }
02746                 if ($levelConf['firstLabel'] && $codeLines)     {
02747                         $codeLines.="\n".$menuName.".defTopTitle[".$count."] = unescape('".rawurlencode($levelConf['firstLabel'])."');";
02748                 }
02749                 return $codeLines;
02750         }
02751 }
02752 
02753 
02754 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_menu.php'])      {
02755         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_menu.php']);
02756 }
02757 
02758 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6