diff options
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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); //<link rel ="stylesheet" href="/static/style.css"> echo "<style>" . file_get_contents('static/style.min.css');?> - .dl-horizontal dt{white-space: normal;}.btn-info{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;}</style> + .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}</style> <noscript><style>.navbar{margin-bottom:0;}</style></noscript> <title>Junge Gemeinde Adlershof</title> <link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'> @@ -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(); |
