Project

General

Profile

Bug #17537 » 17537-v3.diff

Updated patch against TYPO3 4.5 - Andreas Wolf, 2012-03-30 14:00

View differences:

typo3/sysext/cms/tslib/class.tslib_fe.php
// Is the ID a link to another page??
if ($this->page['doktype'] == t3lib_pageSelect::DOKTYPE_SHORTCUT) {
$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.
// saving the page so that we can check later - when we know
// about languages - whether we took the correct shortcut or
// whether a translation of the page overwrites the shortcut
......
case t3lib_pageSelect::SHORTCUT_MODE_FIRST_SUBPAGE:
case t3lib_pageSelect::SHORTCUT_MODE_RANDOM_SUBPAGE:
$pageArray = $this->sys_page->getMenu(($idArray[0] ? $idArray[0] : $thisUid), '*', 'sorting', 'AND pages.doktype<199 AND pages.doktype!=' . t3lib_pageSelect::DOKTYPE_BE_USER_SECTION);
$pO = 0;
if ($mode == t3lib_pageSelect::SHORTCUT_MODE_RANDOM_SUBPAGE && count($pageArray)) {
$randval = intval(rand(0,count($pageArray)-1));
$pO = $randval;
$randval = intval(rand(0, count($pageArray) - 1));
$pageArray = array_values($pageArray);
$page = $pageArray[$randval];
} else {
$page = reset($pageArray);
}
$c = 0;
foreach ($pageArray as $pV) {
if ($c==$pO) {
$page = $pV;
break;
// get back MP vars (stored here by getMenu function)
if (isset($page['_MP_PARAM']) && $page['_MP_PARAM']) {
if ($this->MP) {
$this->MP .= ',';
}
$c++;
$this->MP .= $page['_MP_PARAM'];
}
break;
case t3lib_pageSelect::SHORTCUT_MODE_PARENT_PAGE:
$parent = $this->sys_page->getPage($thisUid);
$page = $this->sys_page->getPage($parent['pid']);
if ($this->MP != '') {
list($mountedPage, $mountPoint) = explode('-', $this->MP);
$mountPointRecord = t3lib_BEfunc::getRecordRaw('pages', 'uid=' . intval($mountPoint));
if ($mountPointRecord['mount_pid_ol'] == 1) {
$targetPageId = $mountedPage;
} else {
$targetPageId = $mountPoint;
// reset the mount point because we moved to it and thus are not in the mounted subtree anymore
$this->MP = '';
}
} else {
$shortcutPage = $this->sys_page->getPage($thisUid);
$targetPageId = $shortcutPage['pid'];
}
$page = $this->sys_page->getPage($targetPageId);
break;
default:
$this->MP = ''; // We need to clear MP if the page is a shortcut. Reason is AS the short cut goes to another page, then we LEAVE the rootline which the MP expects.
$page = $this->sys_page->getPage($idArray[0]);
break;
}
(3-3/3)