Fix bug #46145 - Template cache error for files of template-subfolders

Authorised by: acydburn

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9600 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Joas Schilling 2009-06-16 16:13:53 +00:00
parent bfc8906a5e
commit ef0eed4d9e
2 changed files with 10 additions and 9 deletions

View file

@ -110,6 +110,7 @@
<li>[Fix] Wrong message shown to user, when adding bots to friends/foes. (Bug #40205 - Patch by nickvergessen)</li> <li>[Fix] Wrong message shown to user, when adding bots to friends/foes. (Bug #40205 - Patch by nickvergessen)</li>
<li>[Fix] Fix Oracle database backup (Bug #46715)</li> <li>[Fix] Fix Oracle database backup (Bug #46715)</li>
<li>[Fix] Update attachments table when deleting user and retaining his posts. (Bug #40245 - Patch by rxu)</li> <li>[Fix] Update attachments table when deleting user and retaining his posts. (Bug #40245 - Patch by rxu)</li>
<li>[Fix] Template cache error for files of template-subfolders (Bug #46145 - Patch by nickvergessen)</li>
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li> <li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li> <li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
<li>[Change] Template engine now permits to a limited extent variable includes.</li> <li>[Change] Template engine now permits to a limited extent variable includes.</li>

View file

@ -1066,6 +1066,11 @@ parse_css_file = {PARSE_CSS_FILE}
} }
} }
// Correct the filename if it is stored in database and the file is in a subfolder.
if ($template_row['template_storedb'])
{
$file = str_replace('.', '/', $file);
}
$template->assign_block_vars('file', array( $template->assign_block_vars('file', array(
'U_VIEWSOURCE' => $this->u_action . "&amp;action=cache&amp;id=$template_id&amp;source=$file", 'U_VIEWSOURCE' => $this->u_action . "&amp;action=cache&amp;id=$template_id&amp;source=$file",
@ -1073,7 +1078,7 @@ parse_css_file = {PARSE_CSS_FILE}
'CACHED' => $user->format_date(filemtime("{$phpbb_root_path}cache/$filename")), 'CACHED' => $user->format_date(filemtime("{$phpbb_root_path}cache/$filename")),
'FILENAME' => $file, 'FILENAME' => $file,
'FILENAME_PATH' => $file_tpl, 'FILENAME_PATH' => $file_tpl,
'FILESIZE' => sprintf('%.1f ' . $user->lang['KIB'], filesize("{$phpbb_root_path}cache/$filename") / 1024), 'FILESIZE' => get_formatted_filesize(filesize("{$phpbb_root_path}cache/$filename")),
'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime($file_tpl) : $filemtime[$file . '.html'])) 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime($file_tpl) : $filemtime[$file . '.html']))
); );
} }
@ -1271,7 +1276,6 @@ parse_css_file = {PARSE_CSS_FILE}
); );
} }
/** /**
* Edit imagesets * Edit imagesets
* *
@ -2409,7 +2413,6 @@ parse_css_file = {PARSE_CSS_FILE}
} }
} }
if ($mode == 'template') if ($mode == 'template')
{ {
$super = array(); $super = array();
@ -3209,7 +3212,6 @@ parse_css_file = {PARSE_CSS_FILE}
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ($row) if ($row)
{ {
// If it exist, we just use the style on installation // If it exist, we just use the style on installation
@ -3260,7 +3262,6 @@ parse_css_file = {PARSE_CSS_FILE}
$inherit_bf = false; $inherit_bf = false;
} }
if (sizeof($error)) if (sizeof($error))
{ {
return false; return false;
@ -3530,7 +3531,6 @@ parse_css_file = {PARSE_CSS_FILE}
break; break;
} }
$sql = "SELECT {$mode}_inherits_id $sql = "SELECT {$mode}_inherits_id
FROM $sql_from FROM $sql_from
WHERE {$mode}_id = " . (int) $id; WHERE {$mode}_id = " . (int) $id;