From 6814ab81d70ff7f614aedecae53b36445e6faeb2 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 16 May 2007 14:14:57 +0000 Subject: [PATCH] Revisiting #11024 Making a few things prettier in the progress. git-svn-id: file:///svn/phpbb/trunk@7607 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/viewsource.html | 3 ++- phpBB/includes/acp/acp_styles.php | 15 ++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/phpBB/adm/style/viewsource.html b/phpBB/adm/style/viewsource.html index 077a00b2b5..7f0fde239c 100644 --- a/phpBB/adm/style/viewsource.html +++ b/phpBB/adm/style/viewsource.html @@ -1,7 +1,7 @@
- +

{FILENAME}

@@ -15,6 +15,7 @@
+
\ No newline at end of file diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 12327694cf..d42e52ea15 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -934,13 +934,13 @@ parse_css_file = {PARSE_CSS_FILE} $marker = 'MARKER' . time(); $code = highlight_string(str_replace("\n", $marker, $code), true); $code = str_replace($marker, "\n", $code); - $str_from = array('', '', '','[', ']', '.', ':'); $str_to = array('', '', '', '[', ']', '.', ':'); $code = str_replace($str_from, $str_to, $code); $code = preg_replace('#^()\n?(.*?)\n?()$#ism', '$1$2$3', $code); - + $code = substr($code, strlen('')); + $code = substr($code, 0, -1 * strlen('')); $code = explode("\n", $code); foreach ($code as $key => $line) @@ -976,9 +976,14 @@ parse_css_file = {PARSE_CSS_FILE} foreach ($file_ary as $file) { - $file = str_replace('/', '.', $file); + $file = str_replace('/', '.', $file); + + // perform some dirty guessing to get the path right. + // We assume that three dots in a row were '../' + $tpl_file = str_replace('.', '/', $file); + $tpl_file = str_replace('///', '../', $tpl_file); + $filename = "{$cache_prefix}_$file.html.$phpEx"; - $template->assign_block_vars('file', array( 'U_VIEWSOURCE' => $this->u_action . "&action=cache&id=$template_id&source=$file", @@ -987,7 +992,7 @@ parse_css_file = {PARSE_CSS_FILE} 'CACHED' => $user->format_date(filemtime("{$phpbb_root_path}cache/$filename")), 'FILENAME' => $file, 'FILESIZE' => sprintf('%.1f KB', filesize("{$phpbb_root_path}cache/$filename") / 1024), - 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/" . str_replace('.', '/', $file) . '.html') : $filemtime[$file . '.html'])) + 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime("{$phpbb_root_path}styles/{$template_row['template_path']}/template/$tpl_file.html") : $filemtime[$file . '.html'])) ); } unset($filemtime);