Project

General

Profile

Bug #17604 » class.ux_tslib_fe.php

Administrator Admin, 2007-10-08 17:22

 
<?php
/**
* changes to the tslib_fe class by cab services ag
* - Fixed bug 0006343 - tslib_fe - no proper connection to root when shortcut page in rootline
*
* @author Jonas Dübi <jd@cabag.ch>
* @package TYPO3
* @subpackage cabag_patch
*/
class ux_tslib_fe extends tslib_fe{
/**
* Gets the page and rootline arrays based on the id, $this->id
*
* If the id does not correspond to a proper page, the 'previous' valid page in the rootline is found
* If the page is a shortcut (doktype=4), the ->id is loaded with that id
*
* Whether or not the ->id is changed to the shortcut id or the previous id in rootline (eg if a page is hidden), the ->page-array and ->rootline is found and must also be valid.
*
* Sets or manipulates internal variables such as: $this->id, $this->page, $this->rootLine, $this->MP, $this->pageNotFound
*
* @return void
* @access private
*/
function getPageAndRootline() {
$this->page = $this->sys_page->getPage($this->id);
if (!count($this->page)) {
// If no page, we try to find the page before in the rootLine.
$this->pageNotFound=1; // Page is 'not found' in case the id itself was not an accessible page. code 1
$this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
if (count($this->rootLine)) {
$c=count($this->rootLine)-1;
while($c>0) {

// Add to page access failure history:
$this->pageAccessFailureHistory['direct_access'][] = $this->rootLine[$c];

// Decrease to next page in rootline and check the access to that, if OK, set as page record and ID value.
$c--;
$this->id = $this->rootLine[$c]['uid'];
$this->page = $this->sys_page->getPage($this->id);
if (count($this->page)){ break; }
}
}
// If still no page...
if (!count($this->page)) {
if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
$this->pageNotFoundAndExit('The requested page does not exist!');
} else {
$this->printError('The requested page does not exist!');
exit;
}
}
}

// Spacer is not accessible in frontend
if ($this->page['doktype'] == 199) {
if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
$this->pageNotFoundAndExit('The requested page does not exist!');
} else {
$this->printError('The requested page does not exist!');
exit;
}
}

// Is the ID a link to another page??
if ($this->page['doktype']==4) {
$this->MP = ''; // We need to clear MP if the page is a shortcut. Reason is if the short cut goes to another page, then we LEAVE the rootline which the MP expects.
$this->page = $this->getPageShortcut($this->page['shortcut'],$this->page['shortcut_mode'],$this->page['uid']);
$this->id = $this->page['uid'];
}

// Gets the rootLine
$this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);

// If not rootline we're off...
if (!count($this->rootLine)) {
$ws = $this->whichWorkspace();
if ($this->sys_page->error_getRootLine_failPid==-1 && $ws) {
$this->sys_page->versioningPreview = TRUE;
$this->versioningWorkspaceId = $ws;
$this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
}
if (!count($this->rootLine)) {
$this->pageNotFoundAndExit('The requested page didn\'t have a proper connection to the tree-root! <br /><br />('.$this->sys_page->error_getRootLine.')');
exit;
}
$this->fePreview = 1;
}

// Checking for include section regarding the hidden/starttime/endtime/fe_user (that is access control of a whole subbranch!)
if ($this->checkRootlineForIncludeSection()) {
if (!count($this->rootLine)) {
$this->pageNotFoundAndExit('The requested page was not accessible!');
exit;
} else {
$el = reset($this->rootLine);
$this->id = $el['uid'];
$this->page = $this->sys_page->getPage($this->id);
$this->rootLine = $this->sys_page->getRootLine($this->id,$this->MP);
}
}
}
}

if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cabag_patch/class.ux_tslib_fe.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cabag_patch/class.ux_tslib_fe.php']);
}
?>
    (1-1/1)