From 7075c0b8519cc6b3c8e4a53dddf78f7ded598456 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Oct 2014 00:43:34 +0200 Subject: cache buster, more glyphicons, improved caching --- action.php | 4 +++- functions.php | 51 ++++++++++++++++++++++++++++++++++++++------------ index.php | 12 +++++++++--- static/error-320.webm | Bin 0 -> 259769 bytes static/error-480.webm | Bin 0 -> 296928 bytes static/header.php | 2 +- static/style.css | 2 +- 7 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 static/error-320.webm create mode 100644 static/error-480.webm diff --git a/action.php b/action.php index 2f1bb58..86129ae 100644 --- a/action.php +++ b/action.php @@ -1,7 +1,8 @@
- +
@@ -111,6 +111,8 @@ if( isset($_GET["goto"]) && $_GET["goto"] != "" ) { } function print_logout(){ + global $cache; + $cache = false; global $user; if ( $user->isLoggedIn() ){ $user->logout(); @@ -186,7 +188,8 @@ function print_list($option = false){ ".htmlentities($row['handynummer'])." ".htmlentities($row['email'])." ".htmlentities($row['geburtstag'])." - + + "; $count++; } @@ -194,8 +197,8 @@ function print_list($option = false){ -
token; ?>> - + +
@@ -251,7 +254,7 @@ function print_update_list($id){ - + @@ -264,7 +267,7 @@ function print_update_list($id){
- +
@@ -313,7 +316,7 @@ function print_add_entry_to_list(){ - +

Error 404 - Not Found

@@ -340,7 +345,13 @@ function print_404(){
- + +

Wir haben die Seite '' nicht gefunden!

@@ -439,7 +450,7 @@ function print_register($option = false){
- +
@@ -452,6 +463,8 @@ function print_register($option = false){ } function print_account($option = false){ + global $cache; + $cache = false; lredirect("account"); global $user; ?> @@ -530,7 +543,7 @@ function print_account($option = false){
- +
@@ -581,7 +594,7 @@ function print_recover($option = false){
- +
@@ -593,13 +606,15 @@ function print_recover($option = false){ } function print_download(){ + global $cache; + $cache = false; if ( ! isset($_GET["type"]) || $_GET["type"] == "plain" ) $type = "plain"; else $type = "csv"; lredirect("download;type=".$type); - header($_SERVER["SERVER_PROTOCOL"] . " 301 Moved"); + header($_SERVER["SERVER_PROTOCOL"] . " 302 Moved"); header("Refresh: 2; ".DOMAIN."/?page=action&task=download&type=".$type); ?>

Download

@@ -613,6 +628,18 @@ function print_download(){ flush(); + global $cache; + $cache = false; +?> +

Cache flushed!

+
+[^\S ]+/s', // strip whitespaces after tags, except space diff --git a/index.php b/index.php index 8c94c91..268f0f2 100644 --- a/index.php +++ b/index.php @@ -5,6 +5,9 @@ ob_start('minify'); session_name(SESSION); session_start(); +if ( ! isset($cache) ) + $cache = true; + $c = new cache(REDIS_CONNECT, REDIS_DB); if ( isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]){ @@ -13,7 +16,7 @@ if ( isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]){ $a = "0_"; } -if ( $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 && strpos($_SERVER["QUERY_STRING"], "account") === false && strpos($_SERVER["QUERY_STRING"], "logout") === false && strpos($_SERVER["QUERY_STRING"], "action") === false) { +if ( $cache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 ) { $token = $c->getToken($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]. $_SERVER["QUERY_STRING"], $a); if ( $c->exists($token)){ header("X-Cache: Hit"); @@ -42,7 +45,7 @@ $user = new jg($u); // echo " + .dl-horizontal dt{white-space: normal;}.btn-info{background-color:#3083D6;border-color:#357ebd}.btn-primary{background-color:#3083D6;}.img-responsive{margin:0 auto;}@-moz-document url-prefix(){fieldset{display:table-cell;}}ul.nav li.dropdown:hover ul.dropdown-menu {display:block;}.video{max-width:720px;margin-right: auto;margin-left: auto;}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active{background-color:#3071a9} Junge Gemeinde Adlershof @@ -95,6 +98,9 @@ require_once 'static/header.php'; case("recover"): print_recover(); break; + case("cache"): + flush_cache(); + break; default: print_404(); break; @@ -108,7 +114,7 @@ require_once 'static/footer.php'; $html = ob_get_contents(); -if ( $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 && strpos($_SERVER["QUERY_STRING"], "account") === false && strpos($_SERVER["QUERY_STRING"], "logout") === false && strpos($_SERVER["QUERY_STRING"], "action") === false) { +if ( $cache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 ) { $c->setKey($token, $html, 3600); } ob_end_flush(); diff --git a/static/error-320.webm b/static/error-320.webm new file mode 100644 index 0000000..d5faddc Binary files /dev/null and b/static/error-320.webm differ diff --git a/static/error-480.webm b/static/error-480.webm new file mode 100644 index 0000000..442706c Binary files /dev/null and b/static/error-480.webm differ diff --git a/static/header.php b/static/header.php index f47d815..0276f94 100644 --- a/static/header.php +++ b/static/header.php @@ -23,7 +23,7 @@ E-Mail Verteiler
  • - Mail Archiv + Mail Archiv