[Typo3-dev] preview of versioned page (bug 842) resolved

Irene Höppner mail at isinett.de
Wed Jul 27 11:56:30 CEST 2005


Hi all,

this post is related to the problem described in
http://typo3.org/documentation/mailing-lists/dev-list-archive/thread/110112616/  
and
http://bugs.typo3.org/bug_view_advanced_page.php?bug_id=0000842

I'm using Typo3 3.8.0.

The problem is, that a not-admin-user won't be able to see a preview of a  
versioned page, if TYPO3_CONF_VARS[BE][lockBeUserToDBmounts] is set to 1  
(which is default).

I localized the reason in the index.php for the frontend:
In Line 261 the function $BE_USER->extPageReadAccess($TSFE->page) is  
called, which - for not-admin-users and pid==-1 (versioned page) - will  
call functions that need the TCA to be loaded.
The first function that needs the TCA is be t3lib_BEfunc::fixVersioningPid.
But: At this point no TCA is loaded. It will be loaded just a few lines  
later in the index.php: line 280 ($TSFE->getCompressedTCarray();

There seem to be two solutions to the ptoblem:
1. Load TCA earlier in index.php. This would have to be in line 158:
<snip>
	$TSFE->determineId();
	$TSFE->getCompressedTCarray();
		// Now, if there is a backend user logged in and he has NO access to  
this page, then re-evaluate the id shown!
	if ($TSFE->beUserLogin && !$BE_USER->extPageReadAccess($TSFE->page))	{
</snip>

2. Check, if TCA is loaded and if not do so in  
t3lib_BEfunc::fixVersioningPid:
<snip>
		global $TCA;
		if (!is_array($TCA))	{
			$GLOBALS['TSFE']->getCompressedTCarray();
		}
		if ($rr['pid']==-1 && $TCA[$table]['ctrl']['versioning'])	{
</snip>

As I'm not sure which is the better way at all, I added both patches to  
the bugtracker.
Loading TCA before using functions that need it seems to be somehow  
"cleaner" to me. However, maybe it makes sence to add the tca-check to  
some other functions in t3lib_BEfunc as well...

Would be nice, if you could do some testing as well :-).

Greets: Irene




More information about the TYPO3-dev mailing list