Project

General

Profile

Actions

Bug #16429

closed

Problem with workspace preview and multiple sites

Added by Morten Hansen over 17 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Should have
Category:
Workspaces
Target version:
-
Start date:
2006-08-04
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have a site with multiple subdomains, all representing a site in the same TYPO3 installation.

The backend users is allowed to log in from all subdomains, as some of them is allowed to edit multiple sites. It is not possible for me to use the lock-to-domain feature, for the backend groups representing there rights for different subdomains, as I want a user to see all he’s sites next to each other in TYPO3.

The problem:

If a user logs in to TYPO3 through the domain A.example.com/typo3, he can see multiple sites in the backend, lets say pagetrees corresponding to A.example.com and B.example.com.
If the user then wants to preview a page corresponding to the B.example.com branch (when logged in through A.example.com/typo3), from a workspace he sees the page A.example.com in both preview frames.

Problem in code:

In the file typo3/mod/user/ws/wsol_preview.php line 138-144, we have:

$this->URL = array(
'liveHeader' => 'wsol_preview.php?header=live',
'draftHeader' => 'wsol_preview.php?header=draft',
'live' => t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$pageId.'&L='.$language.'&ADM\
CMD_noBeUser=1',
'draft' => t3lib_div::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$pageId.'&L='.$language.'&AD\
MCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS='.$this->workspace,
'versionMod' => '../../../sysext/version/cm1/index.php?id='.intval(t3lib_div::_GP('id')).'&diff\
Only=1'
);

Here we see that the links to the two frames is generated with TYPO3_SITE_URL, which is A.example.com when logged in through A.example.com/typo3, and so it is not possible to preview a page from the B.example.com branch of the page tree.

A solution would be to preview with the right domain instead of TYPO3_SITE_URL.

(issue imported from #M3976)


Files

bug_3976.diff (2.62 KB) bug_3976.diff Administrator Admin, 2008-02-21 22:10

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #18540: Workspace preview is not aware of domain-recordsClosedSebastian Kurfuerst2008-04-02

Actions
Actions #1

Updated by Morten Hansen over 17 years ago

I have a proposal for a solution to this problem.

Change lines 135-144 in typo3/mod/user/ws/wsol_preview.php to:

$pageId = intval(t3lib_div::_GP('id'));
$language = intval(t3lib_div::_GP('L'));
// Get the domain record, if present:
$domainRec = array();
$pId = $pageId;
while($page = t3lib_befunc::getRecord('pages',$pId)) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*','sys_domain','pid='.$pId.' AND redirectTo=\'\'','','sorting');
if($domainRec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
break;
}
$pId = $page['pid'];
}
// Set the prefix, if domain record found, use it:
$prefix = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
if(!empty($domainRec)) {
$prefix = 'http://'.preg_replace('/\/$/','',$domainRec['domainName']).'/';
}
$this->URL = array(
'liveHeader' => 'wsol_preview.php?header=live',
'draftHeader' => 'wsol_preview.php?header=draft',
'live' => $prefix.'index.php?id='.$pageId.'&L='.$language.'&ADMCMD_noBeUser=1',
'draft' => $prefix.'index.php?id='.$pageId.'&L='.$language.'&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS='.$this->workspace,
'versionMod' => '../../../sysext/version/cm1/index.php?id='.intval(t3lib_div::_GP('id')).'&diffOnly=1'
);

And if you want this to work (with the setup descriped in the problem) you need to setup your backend user sessions to work over multiple domains, which can be done with $TYPO3_CONF_VARS['SYS']['cookieDomain'] from the install tool.

Example for subdomains could be (be aware of the dot):
$TYPO3_CONF_VARS['SYS']['cookieDomain'] = .example.com

If this is implemented in the core, it might be a good idea to implement a warning message in the workspace preview, when you preview without beeing looked in (this happens if $TYPO3_CONF_VARS['SYS']['cookieDomain'] is not set correctly).

Actions #2

Updated by Morten Hansen over 17 years ago

If you copy the above code, then be aware of that mantis is adding something to the end of the http thing

Actions #3

Updated by Administrator Admin about 16 years ago

I had the same problem.
But I think the problem is in the function viewOnClick in the file t3lib/class.t3lib_befunc.php.

The path must be changed for the right domain also for the workspace preview instead of using only TYPO3_SITE_URL.

The patch "bug_3976.diff" solves the problem.

I use version 4.1.5 of TYPO3.

Actions #4

Updated by Ernesto Baschny almost 16 years ago

Doesn't the Draft-Preview require BE-user authentication? How will the browser submit the session-cookie from its "a.domain/typo3/" BE-Session when accessing the "b.domain/index.php?..."? Or isn't there any BE-access check for Workspace previews?

What exactly is the problem? In my eyes the Drafts-Preview should work without checking domain records and without using realurl, because:

http://a.domain/index.php?id=X

should output the same content as:

http://b.domain/index.php?id=X

If they both come from the same TYPO3 database. The "page-id" is unique across all domains, so no matter what domain you access it from. Isn't that working?

Cheers,
Ernesto

Actions #5

Updated by Sebastian Kurfuerst almost 16 years ago

fixed in 4.2 RC2

Actions #6

Updated by Michael Stucki over 10 years ago

  • Category set to Workspaces
Actions #7

Updated by Michael Stucki over 10 years ago

  • Project changed from 624 to TYPO3 Core
  • Category changed from Workspaces to Workspaces
  • Target version deleted (0)
Actions

Also available in: Atom PDF