diff options
author | Urban Müller | 2013-10-24 12:13:26 +0000 |
---|---|---|
committer | Urban Müller | 2013-10-24 12:13:26 +0000 |
commit | c69d635a4d3a31fca2735428df7bf1926d883168 (patch) | |
tree | cd4bacf35614510026d6a070d169a30cebe2e62a | |
parent | 47cdae9bdf926e856a328a4657f6f6691b9d34b2 (diff) | |
download | itools-c69d635a4d3a31fca2735428df7bf1926d883168.tar.gz itools-c69d635a4d3a31fca2735428df7bf1926d883168.tar.bz2 itools-c69d635a4d3a31fca2735428df7bf1926d883168.zip |
prevent proxy caching, add jquery to md5
-rw-r--r-- | itjs.class | 7 | ||||
-rw-r--r-- | itjs.php | 2 |
2 files changed, 5 insertions, 4 deletions
@@ -157,7 +157,7 @@ static function filecontents($filenames, $execphp = true) { ob_start(); # Needs to capture inside loop to guarantee file order if (!(it::match('W3C_CSS_Validator', $_SERVER['HTTP_USER_AGENT']) && it::match('jquery-ui\.css', $filename))) - $result .= it::replace(array('^1$' => ""), $execphp ? @include($filename) : file_get_contents($filename), array('utf8' => false)); + $result .= it::replace(array('^1$' => ""), $execphp ? @include($filename) : @file_get_contents($filename), array('utf8' => false)); $result .= ob_get_clean(); } @@ -190,9 +190,10 @@ static function strip($code) */ static function checksum($fnlist) { - $key = "itjs_" . md5(join("", it::map('"$v" . filemtime("$v")', is_array($fnlist) ? $fnlist : itjs::filenames($fnlist)))); + $filenames = array_merge(is_array($fnlist) ? $fnlist : itjs::filenames($fnlist), array("/www/lib.search.ch/var/jquery-ui/dist/minified/jquery.ui.core.min.js", "/www/lib.search.ch/var/jquery/dist/jquery.min.js")); + $key = "itjs_" . md5(join("", it::map('"$v" . filemtime("$v")', $filenames))); - return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents(is_array($fnlist) ? $fnlist : itjs::filenames($fnlist), false)), 0, 8)); + return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents($filenames, false)), 0, 8)); } } @@ -62,7 +62,7 @@ else if (!it::match('\.html$', $file)) if (!preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) && it::is_live() && !$_REQUEST['retry']) { - header("Cache-Control: max-age=604800"); + header("Cache-Control: max-age=604800, private"); # proxies should not cache since contents of same url can differ between browsers header("Expires: " . gmdate("D, d M Y H:i:s", time()+604800). " GMT"); } |