From 25610c0ccb4c7c99fe0d6d82d6738dbcc40d05e3 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 28 Oct 2014 00:52:21 +0100 Subject: v4.2 Sortable table + other improvements. --- .gitignore | 2 + action.php | 20 +- bootstrap.php | 4 +- class/moar.php | 27 +- functions.php | 48 +- index.php | 6 +- js/eyecancer.js | 63 + js/eyecancer.min.js | 1 + js/functions.js | 21 + js/tablesorter.js | 1901 +++++++++++++++++++++++ js/tablesorter.min.js | 5 + js/upload.js | 3345 +++++++++++++++++++++++++++++++++++++++++ static/eyecancer.js | 62 - static/eyecancer.min.js | 1 - static/footer.php | 38 +- static/header.php | 3 +- static/modal-edit-gallery.php | 2 +- static/modal-new-gallery.html | 2 +- static/style.css | 2 +- static/style.min.css | 2 +- static/tablesorter.css | 38 + static/tablesorter.min.css | 1 + 22 files changed, 5471 insertions(+), 123 deletions(-) create mode 100644 js/eyecancer.js create mode 100644 js/eyecancer.min.js create mode 100644 js/functions.js create mode 100644 js/tablesorter.js create mode 100644 js/tablesorter.min.js create mode 100644 js/upload.js delete mode 100644 static/eyecancer.js delete mode 100644 static/eyecancer.min.js create mode 100644 static/tablesorter.css create mode 100644 static/tablesorter.min.css diff --git a/.gitignore b/.gitignore index 957f04e..bb25470 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ *.swp *.tmp +protected/ + setup.php piwik.html favicon.ico diff --git a/action.php b/action.php index f15f776..a4d47f1 100644 --- a/action.php +++ b/action.php @@ -351,30 +351,32 @@ JG Adlershof"; redirect("foto"); break; case("downloadGallery"): - if ( $_SERVER['REQUEST_METHOD'] != 'POST' ){ + if ( $_SERVER['REQUEST_METHOD'] != 'GET' ){ header($_SERVER["SERVER_PROTOCOL"] . " 405 Method Not Allowed"); ob_clean(); echo "Method not allowed"; exit; } lredirect( "gallery;gallery=".htmlentities($_GET["gallery"]) ); - if ( ! isset($_GET["gallery"]) || $_GET["gallery"] == "" || ! preg_match("/^[0-9]+$", $_GET["gallery"]) ){ + if ( ! isset($_GET["gallery"]) || $_GET["gallery"] == "" || ! preg_match("/^[0-9]+$/", $_GET["gallery"]) ){ redirect( "gallery;gallery=".htmlentities($_SESSION["gallery"]) ); } - $zname = '/tmp/jg_fotoalbum_'.$_GET["gallery"]; - $zip = new ZipArchive; - if ( $zip->open($zname) === TRUE ){ - $images = array_diff( scandir(IMAGE_PATH . $_GET["gallery"]), array('..', '.') ); + $zname = '/tmp/jg_fotoalbum.zip'; + $zip = new ZipArchive(); + if ( $zip->open($zname, ZipArchive::CREATE) == TRUE ){ + $images = array_diff( scandir(IMAGE_PATH . $_GET["gallery"].'/'), array('..', '.') ); foreach( $images as $image){ - if ( is_file($image) ){ - $zip->addFile($image, basename($image)); + if ( is_file(IMAGE_PATH . $_GET["gallery"] . '/' . $image) ){ + //$zip->addFile($image, basename($image)); + $zip->addFile(IMAGE_PATH . $_GET["gallery"] . '/' . $image, $image); } } $zip->close(); ob_end_clean(); + $name = $c->get2(CACHEPREFIX . $_GET["gallery"]); header("Content-Type: application/zip"); header("Content-Length: " . filesize($zname)); - header("Content-Disposition: attachment; filename=jg_fotoalbum_".$_GET["gallery"]); + header("Content-Disposition: attachment; filename=\"".$name.".zip\""); readfile($zname); unlink($zname); exit; diff --git a/bootstrap.php b/bootstrap.php index ed260d9..098288b 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -1,5 +1,5 @@ footer[] = $string; } - public function playHeader(){ + public function playHeader($output = true){ if ( ! empty( $this->header ) ){ + if ( ! $output ) + $buffer = ""; foreach( $this->header as $value ){ - echo $value; + if ( $output ) + echo $value; + else + $buffer .= $value; } } $this->deleteHeader(); + if ( isset($buffer) ) + return $buffer; } - public function playFooter(){ + public function playFooter($output = true){ if ( ! empty( $this->footer ) ){ + if ( ! $output ) + $buffer = ""; foreach( $this->footer as $value ){ - echo $value; + if ( $output ) + echo $value; + else + $buffer .= $value; } } $this->deleteFooter(); + if ( isset($buffer) ) + return $buffer; } public function deleteHeader(){ @@ -45,10 +59,7 @@ class Moar { } public function magicHeader($html){ - ob_start(); - $this->playHeader(); - $header = ob_get_contents(); - ob_end_clean(); + $header = $this->playHeader(false); return preg_replace("/\<\!\-\-%%placeholder\-head%%\-\-\>/", $header, $html); } diff --git a/functions.php b/functions.php index eba19f9..17c2ce3 100644 --- a/functions.php +++ b/functions.php @@ -146,10 +146,31 @@ function print_list($option = false){ lredirect("liste"); global $db; global $c; + global $moar; + + $moar->addHeader(''); + $moar->addFooter(' + + '); $result = $db->doQuery("SELECT * FROM " . DBPREFIX . "member;"); ?> -

Adress Liste

+

Adressliste

@@ -191,9 +212,11 @@ function print_list($option = false){ fetch_array(MYSQLI_ASSOC) ){ + $surname = explode(" ", $row['name']); + $surname = $surname[ count($surname) - 1 ]; echo " $count - ".htmlentities($row['name'])." + ".htmlentities($surname)."".htmlentities($row['name'])." ".htmlentities($row['adresse'])." ".htmlentities($row['telefonnummer'])." ".htmlentities($row['handynummer'])." @@ -564,6 +587,9 @@ function print_account($option = false){

Mit * markierte Felder sind Pflichtfelder.

+

Log dich aus

+
+ Logout Ändern
  • Neu
  • Löschen
  • -
  • " role="tab"> +
  • " role="tab"> + exists2(CACHEPREFIX . $_GET["gallery"]) ) $c->set2(CACHEPREFIX . $_GET["gallery"], $row['name']); ?> Download
  • @@ -745,7 +772,7 @@ function show_gallery(){
    - exists( CACHEPREFIX . "gallery_imagelinks_" . $_SESSION["gallery"] ) ){ + if ( $c->exists2( CACHEPREFIX . "gallery_imagelinks_" . $_SESSION["gallery"] ) ){ echo $c->get2( CACHEPREFIX . "gallery_imagelinks_" . $_SESSION["gallery"] ); } else { ob_start(); @@ -794,6 +821,11 @@ function show_gallery(){ echo "
    "; } else { echo "

    Keine Bilder in der aktuellen Gallerie vorhanden!

    "; + $c->set2(CACHEPREFIX . "gallery_no_download_" . $_SESSION["gallery"], 1); + $moar->addFooter(''); } $c->set2( CACHEPREFIX . "gallery_imagelinks_" . $_SESSION["gallery"], ob_get_contents() ); ob_end_flush(); @@ -804,6 +836,12 @@ function show_gallery(){ addFooter(''); + //$moar->addFooter(''); + if ( $c->exists2(CACHEPREFIX . "gallery_no_download_" . $_SESSION["gallery"]) ) + $moar->addFooter(''); ?>
    diff --git a/index.php b/index.php index 85f22c7..ba776d9 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,7 @@ require_once( dirname(__FILE__) . '/bootstrap.php'); ob_start('minify'); +session_set_cookie_params(SESSION_LIFETIME, '/', HOST, true, true); session_name(SESSION); session_start(); @@ -121,16 +122,17 @@ require_once 'static/header.php'; playFooter(); +include("static/piwik.html"); ?> magicHeader($html); +ob_clean(); echo $html; if ( ! $c->bypassCache && $_SERVER["REQUEST_METHOD"] == "GET" && $_SERVER["REDIRECT_STATUS"] == 200 ) { $c->setPageCache($token, $html, 3600); } +ob_end_flush(); diff --git a/js/eyecancer.js b/js/eyecancer.js new file mode 100644 index 0000000..c2c2168 --- /dev/null +++ b/js/eyecancer.js @@ -0,0 +1,63 @@ +function randomizeColor(c){ + var bg=document.getElementsByClassName("random-bg"); + for (var i=0; i