Bug #19416
closedgetHtmlTemplate should use resolveBackPath
0%
Description
typo3/template.php:
function getHtmlTemplate($filename) {
if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) {
$filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename];
}
return ($filename ? t3lib_div::getURL($this->backPath . $filename) : '');
"$this->backPath . $filename" may be ../../../../typo3/../typo3conf/ext/tt_news/mod1/mod_ttnews_admin.html e.g. which causes problems on some systems.
t3lib_div::resolveBackPath($this->backPath . $filename) would clean this: ../../../../typo3conf/ext/tt_news/mod1/mod_ttnews_admin.html and this works well
I found this issue in tt_news code (trunk version) of News-Admin module:
tt_news/mod1/index.php:main()
<snip>
$this->doc = t3lib_div::makeInstance('template');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('mod_ttnews_admin.html');
$this->doc->docType = 'xhtml_trans';
/**
* FIXME:
* on some servers $this->doc->moduleTemplate is empty (occured only on netcreators servers until now)
* by opening the template directly it worked.
* possible reasons:
* - paths with '../typo3/../' could make problems
* - php settings which influence the functionality of t3lib_div::getURL(). allow_url_fopen and the like
* - ...
*/
if (!$this->doc->moduleTemplate) {
t3lib_div::devLog('cannot set moduleTemplate', 'tt_news', 2, array(
'backpath' => $this->doc->backPath,
'filename from TBE_STYLES' => $GLOBALS['TBE_STYLES']['htmlTemplates']['mod_ttnews_admin.html'],
'full path' => $this->doc->backPath.$GLOBALS['TBE_STYLES']['htmlTemplates']['mod_ttnews_admin.html']
));
$tfile = t3lib_extMgm::siteRelPath('tt_news').'mod1/mod_ttnews_admin.html';
$this->doc->moduleTemplate = @file_get_contents(PATH_site.$tfile);
}
</snip>
typo3/template.php:
function getHtmlTemplate($filename) {
if ($GLOBALS['TBE_STYLES']['htmlTemplates'][$filename]) {
$filename = $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename];
}
return ($filename ? t3lib_div::getURL($this->backPath . $filename) : '');
}
$this->backPath . $filename) => ../../../../typo3/../typo3conf/ext/tt_news/mod1/mod_ttnews_admin.html
Trying to access this path in bash:
typo3conf/ext/tt_news/mod1$ cat ../../../../typo3/../typo3conf/ext/tt_news/mod1/mod_ttneypo3conf/ext/tt_news/mod1/mod_ttnews_admin.html
cat: ../../../../typo3/../typo3conf/ext/tt_news/mod1/mod_ttnews_admin.html: Datei oder Verzeichnis nicht gefunden
After resolving the backpath (so removing typo3/../) it works. May be it's because of the symlink typo3 -> typo3_src/typo3.
System is Debian Etch.
(issue imported from #M9487)
Files
Updated by Steffen Gebert about 16 years ago
Ohh.. shame on me - I couldn't remember that I already created a bug report.
Since #19432 is referenced in core list discussion, please see http://bugs.typo3.org/view.php?id=9511 which describes the same issue.