From 0f0d160ded7fd129d40a4ec0372cab11d7ce7a88 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 6 Oct 2006 18:43:55 +0000 Subject: - 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 --- phpBB/style.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'phpBB/style.php') 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'); -- cgit v1.2.1