diff options
| author | root | 2014-10-01 00:43:34 +0200 |
|---|---|---|
| committer | root | 2014-10-01 00:43:34 +0200 |
| commit | 7075c0b8519cc6b3c8e4a53dddf78f7ded598456 (patch) | |
| tree | 820d2dacdd0dc6cf5f3e625107e0ceb599752176 | |
| parent | 27bc0fe2182afafee830bda8b161f67282f631c8 (diff) | |
| download | jungegemeinde-7075c0b8519cc6b3c8e4a53dddf78f7ded598456.tar.gz | |
cache buster, more glyphicons, improved caching
| -rw-r--r-- | action.php | 4 | ||||
| -rw-r--r-- | functions.php | 51 | ||||
| -rw-r--r-- | index.php | 12 | ||||
| -rw-r--r-- | static/error-320.webm | bin | 0 -> 259769 bytes | |||
| -rw-r--r-- | static/error-480.webm | bin | 0 -> 296928 bytes | |||
| -rw-r--r-- | static/header.php | 2 | ||||
| -rw-r--r-- | static/style.css | 2 |
7 files changed, 53 insertions, 18 deletions
@@ -1,7 +1,8 @@ <?php if ( ! isset($_GET["page"]) || $_GET["page"] != "action" ){ header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); - ob_clean(); + $_GET["page"] = "404"; + require 'index.php'; exit; } @@ -11,6 +12,7 @@ if ( ! isset($_GET["task"]) || $_GET["task"] == "" ){ ob_clean(); exit; } +$cache = false; switch($_GET["task"]){ case("login"): diff --git a/functions.php b/functions.php index 854489f..fcebb9f 100644 --- a/functions.php +++ b/functions.php @@ -95,7 +95,7 @@ if( isset($_GET["goto"]) && $_GET["goto"] != "" ) { <div class="form-group"> <label class="col-md-4 control-label" for="submit"></label> <div class="col-md-4"> - <button id="submit" name="submit" class="btn btn-info">Log In</button> + <button id="submit" name="submit" class="btn btn-info"><span class="glyphicon glyphicon-log-in"></span> Lass mich rein</button> </div> </div> @@ -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){ <td>".htmlentities($row['handynummer'])."</td> <td>".htmlentities($row['email'])."</td> <td>".htmlentities($row['geburtstag'])."</td> - <td><a href='/?page=update&id=".htmlentities($row['member_id'])."'><input type='checkbox' name='change' value='true'></a></td> + <!--td><a href='/?page=update&id=".htmlentities($row['member_id'])."' onclick=\"window.location='/?page=update&id=".htmlentities($row['member_id'])."'\"><input type='checkbox' name='change' value='true'></a></td--> + <td><a href='/?page=update&id=".htmlentities($row['member_id'])."'><span class='glyphicon glyphicon-pencil'></span></a></td> </tr>"; $count++; } @@ -194,8 +197,8 @@ function print_list($option = false){ </tbody> </table> </div> - <form method="POST" action="/?page=add&_flush="<?php echo $c->token; ?>> - <button id="singlebutton" class="btn btn-info" type="submit">Füge jemanden hinzu</button> + <form method="POST" action="/?page=add&_flush=<?php echo $c->token; ?>"> + <button id="singlebutton" class="btn btn-info" type="submit"><span class="glyphicon glyphicon-ok-sign"></span> Füge jemanden hinzu</button> </form> </div> </div> @@ -251,7 +254,7 @@ function print_update_list($id){ </table> </div> - <button id="singlebutton" name="singlebutton" class="btn btn-info" type="submit">Ändere!</button> + <button id="singlebutton" name="singlebutton" class="btn btn-info" type="submit"><span class="glyphicon glyphicon-cog"></span> Ändere!</button> @@ -264,7 +267,7 @@ function print_update_list($id){ <div class="form-group"> <label class="col-md-4 control-label" for="singlebutton"></label> <div class="col-md-4"> - <button id="singlebutton" name="singlebutton" class="btn btn-danger" type="submit" onclick="return confirm('Bist du dir sicher? Der Datensatz wird unwiederbringlich gelöscht werden!');">Löschen!</button> + <button id="singlebutton" name="singlebutton" class="btn btn-danger" type="submit" onclick="return confirm('Bist du dir sicher? Der Datensatz wird unwiederbringlich gelöscht werden!');"><span class="glyphicon glyphicon-warning-sign"></span> Löschen!</button> </div> </div> </fieldset> @@ -313,7 +316,7 @@ function print_add_entry_to_list(){ </tbody> </table> </div> - <button id="singlebutton" name="singlebutton" class="btn btn-info" type="submit">Hinzufügen!</button> + <button id="singlebutton" name="singlebutton" class="btn btn-info" type="submit"><span class="glyphicon glyphicon-check"></span> Hinzufügen!</button> </form> </div> <?php @@ -332,6 +335,8 @@ function _add_entry(){ function print_404(){ header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); + global $cache; + $cache = false; ?> <!--h1 style="color:red;font-size:3.0em;">404 - Not Found</h1--> <h1>Error 404 - Not Found</h1> @@ -340,7 +345,13 @@ function print_404(){ </div> <div class="row video"> <div class="embed-responsive embed-responsive-16by9"> - <video class="embed-responsive-item" src="/static/error.webm" controls autoplay loop></video> + <!--video class="embed-responsive-item" src="/static/error.webm" controls autoplay loop></video--> + <video class="embed-responsive-item" autoplay loop> + <source src="/static/error.webm" type="video/webm" media="all and (min-width: 720px)"> + <source src="/static/error-480.webm" type="video/webm" media="all and (min-width: 480px)"> + <source src="/static/error-320.webm" type="video/webm" media="all and (max-width: 479px)"> + Tja, tut mir Leid. Leider unterstützt dein Browser keine HTML5 Videos. Schon mal über ein Upgrade nachgedacht? + </video> </div> <br> <p>Wir haben die Seite <strong>'<?php echo htmlentities($_SERVER['REQUEST_URI']); ?>'</strong> nicht gefunden!</p> @@ -439,7 +450,7 @@ function print_register($option = false){ <div class="form-group"> <label class="col-md-4 control-label" for="submit"></label> <div class="col-md-4"> - <button id="submit" name="submit" class="btn btn-info">Registrieren</button> + <button id="submit" name="submit" class="btn btn-info"><span class="glyphicon glyphicon-share-alt"></span> Registrieren</button> </div> </div> @@ -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){ <div class="form-group"> <label class="col-md-4 control-label" for="submit"></label> <div class="col-md-4"> - <button id="submit" name="submit" class="btn btn-primary">Ändere!</button> + <button id="submit" name="submit" class="btn btn-primary"><span class="glyphicon glyphicon-cog"></span> Ändere!</button> </div> </div> @@ -581,7 +594,7 @@ function print_recover($option = false){ <div class="form-group"> <label class="col-md-4 control-label" for="submit"></label> <div class="col-md-4"> - <button id="submit" name="submit" class="btn btn-primary">Recover!</button> + <button id="submit" name="submit" class="btn btn-primary"><span class="glyphicon glyphicon-export"></span> Recover!</button> </div> </div> @@ -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); ?> <h1>Download</h1> @@ -613,6 +628,18 @@ function print_download(){ <?php } +function flush_cache(){ + lredirect("cache"); + global $c; + $c->flush(); + global $cache; + $cache = false; +?> +<h1>Cache flushed!</h1> +</div> +<?php +} + function minify($buffer){ $search = array( '/\>[^\S ]+/s', // strip whitespaces after tags, except space @@ -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(); diff --git a/static/error-320.webm b/static/error-320.webm Binary files differnew file mode 100644 index 0000000..d5faddc --- /dev/null +++ b/static/error-320.webm diff --git a/static/error-480.webm b/static/error-480.webm Binary files differnew file mode 100644 index 0000000..442706c --- /dev/null +++ b/static/error-480.webm 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 @@ <a href="https://lists.iamfabulous.de/mailman/listinfo/jungegemeinde" target="_blank" title="JG E-Mail Verteiler"><span class="glyphicon glyphicon-envelope"></span> E-Mail Verteiler</a> </li> <li> - <a href="https://lists.iamfabulous.de/mailman/private/jungegemeinde" target="_blank" title="Archiv der Mailing Liste "><span class="glyphicon glyphicon-send"></span> Mail Archiv</a> + <a href="https://lists.iamfabulous.de/mailman/private/jungegemeinde/" target="_blank" title="Archiv der Mailing Liste "><span class="glyphicon glyphicon-send"></span> Mail Archiv</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> diff --git a/static/style.css b/static/style.css index 5821df4..eaf3af0 100644 --- a/static/style.css +++ b/static/style.css @@ -51,7 +51,7 @@ a { /* noscript */ .noscript { - background-color: red; + background-color: #dd5148; color: white; } |
