|
<?PHP
|
|
|
|
//MODIFIED: We add a 4th reason
|
|
function fetch_the_id() {
|
|
$GLOBALS['TT']->push('fetch_the_id initialize/','');
|
|
|
|
// Initialize the page-select functions.
|
|
$this->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
|
|
$this->sys_page->init($this->showHiddenPage);
|
|
$this->sys_page->versioningPreview = $this->fePreview ? TRUE : FALSE;
|
|
if ($this->sys_page->versioningPreview) {
|
|
$this->sys_page->versionPreviewMap = $this->versionPreviewMap;
|
|
}
|
|
|
|
// Set the valid usergroups for FE
|
|
$this->initUserGroups();
|
|
|
|
// Sets sys_page where-clause
|
|
$this->setSysPageWhereClause();
|
|
|
|
// Splitting $this->id by a period (.). First part is 'id' and second part - if exists - will overrule the &type param if given
|
|
$pParts = explode('.',$this->id);
|
|
$this->id = $pParts[0]; // Set it.
|
|
|
|
if (isset($pParts[1])) {$this->type=$pParts[1];}
|
|
|
|
// Splitting $this->id by a comma (,). First part is 'id' and other parts are just stored for use in scripts.
|
|
$this->idParts = explode(',',$this->id);
|
|
|
|
// Splitting by a '+' sign - used for base64/md5 methods of parameter encryption for simulate static documents.
|
|
list($pgID,$SSD_p)=explode('+',$this->idParts[0],2);
|
|
if ($SSD_p) { $this->idPartsAnalyze($SSD_p); }
|
|
$this->id = $pgID; // Set id
|
|
|
|
// If $this->id is a string, it's an alias
|
|
$this->checkAndSetAlias();
|
|
// The id and type is set to the integer-value - just to be sure...
|
|
$this->id = intval($this->id);
|
|
$this->type = intval($this->type);
|
|
$GLOBALS['TT']->pull();
|
|
|
|
// We find the first page belonging to the current domain
|
|
$GLOBALS['TT']->push('fetch_the_id domain/','');
|
|
$this->domainStartPage = $this->findDomainRecord($this->TYPO3_CONF_VARS['SYS']['recursiveDomainSearch']); // the page_id of the current domain
|
|
if (!$this->id) {
|
|
if ($this->domainStartPage) {
|
|
$this->id = $this->domainStartPage; // If the id was not previously set, set it to the id of the domain.
|
|
} else {
|
|
$theFirstPage = $this->sys_page->getFirstWebPage($this->id); // Find the first 'visible' page in that domain
|
|
if ($theFirstPage) {
|
|
$this->id = $theFirstPage['uid'];
|
|
} else {
|
|
$this->printError('No pages are found on the rootlevel!');
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
$GLOBALS['TT']->pull();
|
|
|
|
$GLOBALS['TT']->push('fetch_the_id rootLine/','');
|
|
$requestedId = $this->id; // We store the originally requested id
|
|
$this->getPageAndRootlineWithDomain($this->domainStartPage);
|
|
$GLOBALS['TT']->pull();
|
|
|
|
//MODIFIED: We add a 4th reason
|
|
if ($this->pageNotFound && $this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
|
|
$pNotFoundMsg = array(
|
|
1 => 'ID was not an accessible page',
|
|
2 => 'Subsection was found and not accessible',
|
|
3 => 'ID was outside the domain',
|
|
4 => 'Alias didn\'t exist. SETUP configuration enables 404 handling.' // modified
|
|
);
|
|
$this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
|
|
}
|
|
|
|
// set no_cache if set
|
|
if ($this->page['no_cache']) {
|
|
$this->set_no_cache();
|
|
}
|
|
|
|
// Init SYS_LASTCHANGED
|
|
$this->register['SYS_LASTCHANGED'] = intval($this->page['tstamp']);
|
|
if ($this->register['SYS_LASTCHANGED'] < intval($this->page['SYS_LASTCHANGED'])) {
|
|
$this->register['SYS_LASTCHANGED'] = intval($this->page['SYS_LASTCHANGED']);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// MODIFIED: We set the error if no alias found
|
|
function checkAndSetAlias() {
|
|
if ($this->id && !t3lib_div::testInt($this->id)) {
|
|
$aid = $this->sys_page->getPageIdFromAlias($this->id);
|
|
if ($aid) {
|
|
$this->id=$aid;
|
|
} else { // modificado
|
|
$this->pageNotFound = 4;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
?>
|