/**
  * Tests whether the getPage Hook is called correctly.
  *
  * @test
  */
 public function isGetPageHookCalled()
 {
     // Create a hook mock object
     $className = uniqid('tx_coretest');
     $getPageHookMock = $this->getMock('t3lib_pageSelect_getPageHook', array('getPage_preProcess'), array(), $className);
     // Register hook mock object
     $GLOBALS['T3_VAR']['getUserObj'][$className] = $getPageHookMock;
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getPage'][] = $className;
     // Test if hook is called and register a callback method to check given arguments
     $getPageHookMock->expects($this->once())->method('getPage_preProcess')->will($this->returnCallback(array($this, 'isGetPagePreProcessCalledCallback')));
     $this->pageSelectObject->getPage(42, FALSE);
 }
Ejemplo n.º 2
0
 /**
  * @param array $page
  * @param array $rootLine
  * @return array
  */
 protected function getMenuItemEntry($page, $rootLine)
 {
     $getLL = t3lib_div::_GP('L');
     $pageUid = $page['uid'];
     $doktype = $page['doktype'];
     if ($getLL) {
         $pageOverlay = $this->pageSelect->getPageOverlay($pageUid, $getLL);
         foreach ($pageOverlay as $name => $value) {
             if (empty($value) === FALSE) {
                 $page[$name] = $value;
             }
         }
     } else {
         $page = $this->pageSelect->getPage($pageUid);
     }
     $title = $page['title'];
     $titleFieldList = t3lib_div::trimExplode(',', $this->arguments['titleFields']);
     foreach ($titleFieldList as $titleFieldName) {
         if (empty($page[$titleFieldName]) === FALSE) {
             $title = $page[$titleFieldName];
             break;
         }
     }
     $shortcut = $doktype == constant('t3lib_pageSelect::DOKTYPE_SHORTCUT') ? $page['shortcut'] : $page['url'];
     $page['active'] = $this->isActive($pageUid, $rootLine);
     $page['current'] = $this->isCurrent($pageUid);
     $page['hasSubPages'] = count($this->pageSelect->getMenu($pageUid)) > 0 ? 1 : 0;
     $page['link'] = $this->getItemLink($pageUid, $doktype, $shortcut);
     $page['class'] = implode(' ', $this->getItemClass($page));
     $page['title'] = $title;
     $page['doktype'] = $doktype;
     return $page;
 }
 /**
  * Will change $LD (passed by reference) if the page is access restricted
  *
  * @param	array		$LD, the array from the linkData() function
  * @param	array		Page array
  * @param	string		Main target value
  * @param	string		Type number override if any
  * @return	void		($LD passed by reference might be changed.)
  */
 function changeLinksForAccessRestrictedPages(&$LD, $page, $mainTarget, $typeOverride)
 {
     // If access restricted pages should be shown in menus, change the link of such pages to link to a redirection page:
     if ($this->mconf['showAccessRestrictedPages'] && $this->mconf['showAccessRestrictedPages'] !== 'NONE' && !$GLOBALS['TSFE']->checkPageGroupAccess($page)) {
         $thePage = $this->sys_page->getPage($this->mconf['showAccessRestrictedPages']);
         $addParams = $this->mconf['showAccessRestrictedPages.']['addParams'];
         $addParams = str_replace('###RETURN_URL###', rawurlencode($LD['totalURL']), $addParams);
         $addParams = str_replace('###PAGE_ID###', $page['uid'], $addParams);
         $LD = $this->menuTypoLink($thePage, $mainTarget, '', '', '', $addParams, $typeOverride);
     }
 }
 /**
  * Checks if a formmail submission can be sent as email
  *
  * @param	string		The input from $_POST['locationData']
  * @return	void
  * @access private
  * @see checkDataSubmission()
  */
 function locDataCheck($locationData)
 {
     $locData = explode(':', $locationData);
     if (!$locData[1] || $this->sys_page->checkRecord($locData[1], $locData[2], 1)) {
         if (count($this->sys_page->getPage($locData[0]))) {
             // $locData[1] -check means that a record is checked only if the locationData has a value for a record else than the page.
             return 1;
         } else {
             $GLOBALS['TT']->setTSlogMessage('LocationData Error: The page pointed to by location data (' . $locationData . ') was not accessible.', 2);
         }
     } else {
         $GLOBALS['TT']->setTSlogMessage('LocationData Error: Location data (' . $locationData . ') record pointed to was not accessible.', 2);
     }
 }