diff options
| author | root | 2014-09-25 10:26:56 +0200 |
|---|---|---|
| committer | root | 2014-09-25 10:26:56 +0200 |
| commit | 2036626b560f22efd59673187a2de3b1319fcf8a (patch) | |
| tree | 5180be078e3758b6fe3c37834cf6074c148394d1 /bootstrap/index.php | |
| parent | 7ea240aef9b75758d05cb5212ef7c99b47b4180b (diff) | |
| download | jungegemeinde-2036626b560f22efd59673187a2de3b1319fcf8a.tar.gz | |
version 4.0
Diffstat (limited to 'bootstrap/index.php')
| -rw-r--r-- | bootstrap/index.php | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/bootstrap/index.php b/bootstrap/index.php index 32b4a97..21cbda7 100644 --- a/bootstrap/index.php +++ b/bootstrap/index.php @@ -1,22 +1,52 @@ <?php -ob_start(); -# if we kann redirect user mit the ?goto variable +# if we kann redirect user with the ?goto variable $redirect = true; require_once( dirname(__FILE__) . '/bootstrap.php'); +ob_start('minify'); +session_name(SESSION); +session_start(); + +$c = new cache(REDIS_CONNECT, REDIS_DB); + +if ( isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]){ + $a = "1_"; +} else { + $a = "0_"; +} + +if ( $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 && strpos($_SERVER["QUERY_STRING"], "account") === false ) { + $token = $c->getToken($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]. $_SERVER["QUERY_STRING"], $a); + if ( $c->exists($token)){ + header("X-Cache: Hit"); + echo $c->getValue($token); + ob_end_flush(); + exit; + } +} else { + header("X-Cache: Miss "); +} $db = new db(); -$user = new jg(); +if ( ! isset($_SESSION["username"])) + $u = null; +else + $u = $_SESSION["username"]; + +$user = new jg($u); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> - <link rel ="stylesheet" href="/static/style.css"> - <style>.dl-horizontal dt{white-space: normal;} .btn-info{background-color:#3083D6;}</style> + <?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;} .img-responsive{margin: 0 auto;} @-moz-document url-prefix() { fieldset { display: table-cell; } }</style> <title>Junge Gemeinde Adlershof</title> <link rel='shortcut icon' href='/favicon.ico' type='image/x-icon'> <meta name="viewport" content="width=device-width, initial-scale=1.0"> @@ -29,6 +59,8 @@ require_once 'static/header.php'; <div class="text-center"> <div class="row"> <?php + if( ! isset($_GET["page"])) + $_GET["page"] = ""; if($_GET["page"] == "" || $_GET["page"] == "index") print_index(); @@ -37,24 +69,36 @@ require_once 'static/header.php'; case("login"): print_login(); break; + case("logout"): + print_logout(); + break; case("liste"): print_list(); break; - + case("register"): + print_register(); + break; case("update"): print_update_list($_GET['id']); break; case("add"): print_add_entry_to_list(); break; + case("account"): + print_account(); + break; case("404"): print_404(); break; case("action"): require_once 'action.php'; break; + case("recover"). + print_recover(); + break; default: print_index(); + break; } } @@ -69,3 +113,10 @@ if ( isset($_GET['goto']) && $_GET['goto'] != "" && $redirect ){ </div> <?php require_once 'static/footer.php'; + +$html = ob_get_contents(); + +if ( $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 && strpos($_SERVER["QUERY_STRING"], "account") === false ) { + $c->setKey($token, $html, 3600); +} +ob_end_flush(); |
