aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/style.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-07-26 10:08:52 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-07-26 10:08:52 +0000
commit04c3add2ee043447c3e188cd9659c025e101ce1c (patch)
tree70bcc809be0c6677104bbdd82f9e86f9d7b72e6b /phpBB/style.php
parent074b6e127ab66c8f4d90eb0aa0b2ec8587528290 (diff)
downloadforums-04c3add2ee043447c3e188cd9659c025e101ce1c.tar
forums-04c3add2ee043447c3e188cd9659c025e101ce1c.tar.gz
forums-04c3add2ee043447c3e188cd9659c025e101ce1c.tar.bz2
forums-04c3add2ee043447c3e188cd9659c025e101ce1c.tar.xz
forums-04c3add2ee043447c3e188cd9659c025e101ce1c.zip
add support for gzip compression to style.php as well as adding a much higher expire date - though could be much more effective (but also error prone) due to the session id.
git-svn-id: file:///svn/phpbb/trunk@7949 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/style.php')
-rw-r--r--phpBB/style.php55
1 files changed, 36 insertions, 19 deletions
diff --git a/phpBB/style.php b/phpBB/style.php
index 3578993691..23ebc55bd6 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -126,6 +126,19 @@ if ($id && $sid)
exit;
}
+ // gzip_compression
+ if ($config['gzip_compress'])
+ {
+ if (@extension_loaded('zlib') && !headers_sent())
+ {
+ ob_start('ob_gzhandler');
+ }
+ }
+
+ // Expire time of seven days if not recached
+ $expire_time = 7*86400;
+ $recache = false;
+
// Re-cache stylesheet data if necessary
if ($recompile || empty($theme['theme_data']))
{
@@ -156,36 +169,38 @@ if ($id && $sid)
closedir($dir);
}
}
+ }
- if ($recache)
- {
- include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
+ header('Content-type: text/css; charset=UTF-8');
- $theme['theme_data'] = acp_styles::db_theme_data($theme);
- $theme['theme_mtime'] = $update_time;
+ if ($recache)
+ {
+ include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
- // Save CSS contents
- $sql_ary = array(
- 'theme_mtime' => $theme['theme_mtime'],
- 'theme_data' => $theme['theme_data']
- );
+ $theme['theme_data'] = acp_styles::db_theme_data($theme);
+ $theme['theme_mtime'] = $update_time;
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE theme_id = $id";
- $db->sql_query($sql);
+ // Save CSS contents
+ $sql_ary = array(
+ 'theme_mtime' => $theme['theme_mtime'],
+ 'theme_data' => $theme['theme_data']
+ );
- $cache->destroy('sql', STYLES_THEME_TABLE);
+ $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE theme_id = $id";
+ $db->sql_query($sql);
- header('Expires: 0');
- }
+ $cache->destroy('sql', STYLES_THEME_TABLE);
+
+ header('Cache-Control: private, no-cache="set-cookie"');
+ header('Expires: 0');
+ header('Pragma: no-cache');
}
else
{
- header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $expire_time));
}
- header('Content-type: text/css');
-
// Parse Theme Data
$replace = array(
'{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme',
@@ -260,4 +275,6 @@ if ($id && $sid)
$db->sql_close();
}
+exit;
+
?> \ No newline at end of file