Project

General

Profile

Actions

Bug #19416

closed

getHtmlTemplate should use resolveBackPath

Added by Steffen Gebert about 16 years ago. Updated about 16 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2008-10-05
Due date:
% Done:

0%

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

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);
}
&lt;/snip&gt;

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

getHtmlTemplate-resolveBackPath.diff (474 Bytes) getHtmlTemplate-resolveBackPath.diff Administrator Admin, 2008-10-05 16:02

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #19432: getHtmlTemplate should use resolveBackPathClosedErnesto Baschny2008-10-08

Actions
Actions

Also available in: Atom PDF