Merge branch 'master' of git@github.com:shish/shimmie2

This commit is contained in:
Shish 2011-12-27 19:27:05 +00:00
commit 77b4bd8d46
4 changed files with 29 additions and 5 deletions

View File

@ -30,9 +30,12 @@ DefaultType image/jpeg
<IfModule mod_expires.c> <IfModule mod_expires.c>
ExpiresActive On ExpiresActive On
ExpiresDefault "access plus 1 month" <FilesMatch "([0-9a-f]{32}|\.(gif|jpe?g|png|css|js))$">
ExpiresByType text/html "now" Header set Cache-Control "public, max-age=2629743"
ExpiresByType text/plain "now" ExpiresDefault "access plus 1 month"
</FilesMatch>
#ExpiresByType text/html "now"
#ExpiresByType text/plain "now"
</IfModule> </IfModule>
<ifmodule mod_deflate.c> <ifmodule mod_deflate.c>

View File

@ -183,7 +183,7 @@ class Page {
* Display the page according to the mode and data given * Display the page according to the mode and data given
*/ */
public function display() { public function display() {
global $page; global $page, $user;
header("Content-type: ".$this->type); header("Content-type: ".$this->type);
header("X-Powered-By: SCore-".SCORE_VERSION); header("X-Powered-By: SCore-".SCORE_VERSION);
@ -196,7 +196,22 @@ class Page {
switch($this->mode) { switch($this->mode) {
case "page": case "page":
header("Cache-control: no-cache"); header("Vary: Cookie, Accept-Encoding");
if(CACHE_HTTP) {
if($user->is_anonymous() && $_SERVER["REQUEST_METHOD"] == "GET") {
header("Cache-control: public, max-age=600");
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 600) . ' GMT');
}
else {
#header("Cache-control: private, max-age=0");
header("Cache-control: no-cache");
header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 600) . ' GMT');
}
}
else {
header("Cache-control: no-cache");
header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 600) . ' GMT');
}
usort($this->blocks, "blockcmp"); usort($this->blocks, "blockcmp");
$this->add_auto_html_headers(); $this->add_auto_html_headers();
$layout = new Layout(); $layout = new Layout();

View File

@ -79,6 +79,11 @@ class UserPage extends SimpleExtension {
} }
else if($event->get_arg(0) == "logout") { else if($event->get_arg(0) == "logout") {
set_prefixed_cookie("session", "", time()+60*60*24*$config->get_int('login_memory'), "/"); set_prefixed_cookie("session", "", time()+60*60*24*$config->get_int('login_memory'), "/");
if(CACHE_HTTP) {
# to keep as few versions of content as possible,
# make cookies all-or-nothing
set_prefixed_cookie("user", "", time()+60*60*24*$config->get_int('login_memory'), "/");
}
log_info("user", "Logged out"); log_info("user", "Logged out");
$page->set_mode("redirect"); $page->set_mode("redirect");
$page->set_redirect(make_link()); $page->set_redirect(make_link());

View File

@ -62,6 +62,7 @@ define("COVERAGE", true);
define("CONTEXT", false); define("CONTEXT", false);
define("CACHE_MEMCACHE", false); define("CACHE_MEMCACHE", false);
define("CACHE_DIR", false); define("CACHE_DIR", false);
define("CACHE_HTTP", false);
define("VERSION", 'trunk'); define("VERSION", 'trunk');
define("SCORE_VERSION", 's2hack/'.VERSION); define("SCORE_VERSION", 's2hack/'.VERSION);
define("COOKIE_PREFIX", 'shm'); define("COOKIE_PREFIX", 'shm');