aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/style.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-10-06 18:43:55 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-10-06 18:43:55 +0000
commit0f0d160ded7fd129d40a4ec0372cab11d7ce7a88 (patch)
treef8e6f506f09bb6fdb81deece5da18f2ee41e3a7e /phpBB/style.php
parentc645088a34bfcaf31ba10e90badb148a284e7133 (diff)
downloadforums-0f0d160ded7fd129d40a4ec0372cab11d7ce7a88.tar
forums-0f0d160ded7fd129d40a4ec0372cab11d7ce7a88.tar.gz
forums-0f0d160ded7fd129d40a4ec0372cab11d7ce7a88.tar.bz2
forums-0f0d160ded7fd129d40a4ec0372cab11d7ce7a88.tar.xz
forums-0f0d160ded7fd129d40a4ec0372cab11d7ce7a88.zip
- support re-caching of theme data if stylesheet.css changed and load_tplcompile enabled
- mcp fixes - fixed some usability issues git-svn-id: file:///svn/phpbb/trunk@6447 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/style.php')
-rw-r--r--phpBB/style.php28
1 files changed, 23 insertions, 5 deletions
diff --git a/phpBB/style.php b/phpBB/style.php
index 075f20db3d..496ae7c8e0 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -54,6 +54,7 @@ if ($id && $sid)
require($phpbb_root_path . 'includes/acm/acm_' . $acm_type . '.' . $phpEx);
require($phpbb_root_path . 'includes/cache.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
+ require($phpbb_root_path . 'includes/constants.' . $phpEx);
$db = new $sql_db();
$cache = new cache();
@@ -64,6 +65,8 @@ if ($id && $sid)
exit;
}
+ $config = $cache->obtain_config();
+
$sql = "SELECT s.session_id, u.user_lang
FROM {$table_prefix}sessions s, {$table_prefix}users u
WHERE s.session_id = '" . $db->sql_escape($sid) . "'
@@ -89,11 +92,26 @@ if ($id && $sid)
exit;
}
- /**
- * @todo What happens if the theme_data value is older than the file?
- * It should be re-cached as is done with templates and the template cache
- * if ($theme['theme_mtime'] < filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
- */
+ // Re-cache stylesheet data if necessary
+ if ($config['load_tplcompile'] && $theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
+ {
+ include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
+
+ $theme['theme_data'] = acp_styles::db_theme_data($theme);
+ $theme['theme_mtime'] = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
+
+ // Save CSS contents
+ $sql_ary = array(
+ 'theme_mtime' => $theme['theme_mtime'],
+ 'theme_data' => $theme['theme_data']
+ );
+
+ $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE theme_id = $id";
+ $db->sql_query($sql);
+
+ $cache->destroy('sql', STYLES_THEME_TABLE);
+ }
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
header('Content-type: text/css');