diff options
| author | Horus3 | 2014-10-05 22:00:46 +0200 |
|---|---|---|
| committer | Horus3 | 2014-10-05 22:00:46 +0200 |
| commit | a3009bf57d50fbc25a707b32fb3c5c170d011680 (patch) | |
| tree | 4c65be59038335b14cf5c7bfabc98e6c7dee13c9 | |
| parent | 1851c3a180eafb4563a9f6e4dd40fcc5e925896a (diff) | |
| parent | 3833ab7e3588b4f5c05f440713f5cdf30b9029ae (diff) | |
| download | jungegemeinde-a3009bf57d50fbc25a707b32fb3c5c170d011680.tar.gz | |
Merge branch 'master' of git.iamfabulous.de:jungegemeinde
| -rw-r--r-- | action.php | 30 | ||||
| -rw-r--r-- | functions.php | 19 | ||||
| -rw-r--r-- | index.php | 2 | ||||
| -rw-r--r-- | static/header.php | 22 |
4 files changed, 50 insertions, 23 deletions
@@ -259,23 +259,27 @@ JG Adlershof"; $suffix = ".csv"; } lredirect("download;type=".$type); - $res = $db->doQuery("SELECT * FROM " . DBPREFIX . "member;"); - $content .= "\n"; - $count = 1; - while ($row = $res->fetch_array() ){ + if ( $c->exists(CACHEPREFIX . "adressliste".$suffix) ){ + $content = $c->getValue(CACHEPREFIX . "adressliste".$suffix); + } else { + $res = $db->doQuery("SELECT * FROM " . DBPREFIX . "member;"); + $content .= "\n"; + $count = 1; + while ($row = $res->fetch_array() ){ - if ( $type == "plain" ){ - $content .= $count . " | " . $row["name"] . " | " . $row["adresse"] . " | " . $row["telefonnummer"] . " | " . $row["handynummer"] . " | " . $row["email"] . " | " . $row["geburtstag"] . "\n"; - } else { - $content .= $count; - for ( $i=1;$i<7;$i++){ - $content .= ';' . $row[$i]; + if ( $type == "plain" ){ + $content .= $count . " | " . $row["name"] . " | " . $row["adresse"] . " | " . $row["telefonnummer"] . " | " . $row["handynummer"] . " | " . $row["email"] . " | " . $row["geburtstag"] . "\n"; + } else { + $content .= $count; + for ( $i=1;$i<7;$i++){ + $content .= ';' . $row[$i]; + } + $content .= "\n"; } - $content .= "\n"; + $count++; } - $count++; + $c->setKey(CACHEPREFIX . "adressliste".$suffix, $content); } - ob_clean(); header("Content-Type: text/".$type."; Charset=UTF-8"); header("Content-Disposition: attachment; filename=\"JG Adressliste ".date("j.n.Y", time()).$suffix."\""); diff --git a/functions.php b/functions.php index 62d5299..9f5ff49 100644 --- a/functions.php +++ b/functions.php @@ -162,6 +162,15 @@ function print_list($option = false){ <?php } ?> +<?php +# start caching + if ( $c->exists(CACHEPREFIX . "adressliste.html")){ + echo $c->getValue(CACHEPREFIX . "adressliste.html"); + header("X-Cache-Table: Hit"); + return; + } + ob_start(); +?> </div> <div class="row"> <div class="table-responsive"> @@ -188,10 +197,10 @@ function print_list($option = false){ <td>".htmlentities($row['adresse'])."</td> <td>".htmlentities($row['telefonnummer'])."</td> <td>".htmlentities($row['handynummer'])."</td> - <td>".htmlentities($row['email'])."</td> + <td><a href='mailto:".htmlentities($row['email'])."' title='Sende ".htmlentities($row['name'])." eine E-Mail'>".htmlentities($row['email'])."</a></td> <td>".htmlentities($row['geburtstag'])."</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> + <td><a href='/?page=update&id=".htmlentities($row['member_id'])."' title='Ändere den Eintrag'><span class='glyphicon glyphicon-pencil'></span></a></td> </tr>"; $count++; } @@ -204,8 +213,10 @@ function print_list($option = false){ </form> </div> </div> - <?php + $table = ob_get_contents(); + $c->setKey(CACHEPREFIX . "adressliste.html", $table); + ob_end_flush(); } function print_update_list($id){ @@ -617,7 +628,7 @@ function print_download(){ lredirect("download;type=".$type); header($_SERVER["SERVER_PROTOCOL"] . " 302 Moved"); - header("Refresh: 2; ".DOMAIN."/?page=action&task=download&type=".$type); + header("Refresh: 0; ".DOMAIN."/?page=action&task=download&type=".$type); ?> <h1>Download</h1> <h4>Der Download der Adressliste (vom Typ 'text/<?php echo $type; ?>') sollte automatisch starten.</h4> @@ -11,7 +11,7 @@ if ( ! isset($cache) ) $c = new cache(REDIS_CONNECT, REDIS_DB); if ( isset($_SESSION["loggedin"]) && $_SESSION["loggedin"]){ - $a = "1_"; + $a = $_SESSION["userid"]."_"; } else { $a = "0_"; } diff --git a/static/header.php b/static/header.php index ff51e71..f6ecfd9 100644 --- a/static/header.php +++ b/static/header.php @@ -15,8 +15,8 @@ <li class="dropdown"> <a href="/?page=liste" title="Liste aller JG-Mitglieder"><span class="glyphicon glyphicon-th-list"></span> Adressliste <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> - <li><a href="/?page=download&task=download&type=plain" title="Download: text/plain">Download als Text</a></li> - <li><a href="/?page=download&task=download&type=csv" title="Download: text/csv">Download als CSV</a></li> + <li><a href="/?page=download&task=download&type=plain" title="Download: text/plain"><span class="glyphicon glyphicon-download"></span> Download als Text</a></li> + <li><a href="/?page=download&task=download&type=csv" title="Download: text/csv"><span class="glyphicon glyphicon-arrow-down"></span> Download als CSV</a></li> </ul> </li> <li> @@ -31,20 +31,32 @@ <a href="#" title="Much fancy, many amazing, wow" onclick="loadFancy();"><span class="glyphicon glyphicon-flag"></span> Fancy Mode</a> </li> <li class="dropdown"> - <a href="/?page=account" title="Manage deinen Account"><span class="glyphicon glyphicon-user"></span> Mitglied<span class="caret"></span></a> + <?php + if ( $user->isLoggedIn() ) { + $_name = $user->username; + $_title = "Ändere dein Profil"; + } else { + $_name = "Mitglied"; + $_title = "Einloggen, registrieren, Profil"; + } + ?> + <a href="/?page=account" title="<?php echo $_title; ?>"><span class="glyphicon glyphicon-user"></span> <?php echo $_name; ?> <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li> <?php if ( $user->isLoggedIn() ) { ?> + <a href="/?page=account" title="Ändere dein Passwort"><span class="glyphicon glyphicon-user"></span> Profil</a> + </li> + <li> <a href="/?page=logout" title="Beende die Session"><span class="glyphicon glyphicon-off"></span> Logout</a> <?php } else { ?> - <a href="/?page=login&goto=index" title="Login"><span class="glyphicon glyphicon-off"></span> Login</a> + <a href="/?page=register&goto=index" title="Registriere dich für unbeschränkten Zugang"><span class="glyphicon glyphicon-share-alt"></span> Register</a> </li> <li> - <a href="/?page=register&goto=index" title="Registriere dich für unbeschränkten Zugang"><span class="glyphicon glyphicon-user"></span> Register</a> + <a href="/?page=login&goto=index" title="Login"><span class="glyphicon glyphicon-off"></span> Login</a> <?php } ?> |
