diff options
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 42 |
1 files changed, 29 insertions, 13 deletions
@@ -5,9 +5,6 @@ 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"]){ @@ -16,11 +13,11 @@ if ( isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]){ $a = "0_"; } -if ( $cache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 ) { +if ( ! $c->bypassCache && $_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)){ + if ( $c->existsPageCache($token)){ header("X-Cache: Hit"); - echo $c->getValue($token); + echo $c->getPageCache($token); ob_end_flush(); exit; } @@ -28,13 +25,16 @@ if ( $cache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS" header("X-Cache: Miss "); } +$moar = new Moar(); $db = new db(); + if ( ! isset($_SESSION["username"])) $u = null; else $u = $_SESSION["username"]; $user = new jg($u); + if( ! isset($_GET["page"]) || $_GET["page"] == "" ) $_GET["page"] = "index"; @@ -44,16 +44,19 @@ if( ! isset($_GET["page"]) || $_GET["page"] == "" ) <head> <meta charset="utf-8"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> + <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <?php - //<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;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> + <!--%%placeholder-head%%--> <noscript><style>.navbar{margin-bottom:0;}</style></noscript> - <title>Junge Gemeinde Adlershof | <?php ucfirst($_GET["page"]); ?></title> + <title>Junge Gemeinde Adlershof | <?php echo htmlentities(ucfirst($_GET["page"])); ?></title> <link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'> <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <?php + $moar->playHeader(); + ?> </head> <?php require_once 'static/header.php'; @@ -90,6 +93,12 @@ require_once 'static/header.php'; case("download"): print_download(); break; + case("foto"): + list_gallery(); + break; + case("gallery"): + show_gallery(); + break; case("action"): require_once 'action.php'; break; @@ -111,10 +120,17 @@ require_once 'static/header.php'; </div> <?php require_once 'static/footer.php'; - +$moar->playFooter(); +?> + </body> +</html> +<?php $html = ob_get_contents(); +ob_end_clean(); + +$html = $moar->magicHeader($html); +echo $html; -if ( $cache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 ) { - $c->setKey($token, $html, 3600); +if ( ! $c->bypassCache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 ) { + $c->setPageCache($token, $html, 3600); } -ob_end_flush(); |
