From fdbd749b1b436b874166cbe2dc976a69279d568d Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Wed, 17 Sep 2025 16:03:45 +0200 Subject: [PATCH] Update from xhtml to html and add /files/stat --- www/de/{index.xhtml => index.html} | 31 +++++++++++----------- www/en/{index.xhtml => index.html} | 31 +++++++++++----------- www/files/create.sql.php | 2 +- www/files/index.php | 42 +++++++++++++++++++++++++----- 4 files changed, 66 insertions(+), 40 deletions(-) rename www/de/{index.xhtml => index.html} (87%) rename www/en/{index.xhtml => index.html} (87%) diff --git a/www/de/index.xhtml b/www/de/index.html similarity index 87% rename from www/de/index.xhtml rename to www/de/index.html index 418384f..f49769b 100644 --- a/www/de/index.xhtml +++ b/www/de/index.html @@ -1,5 +1,4 @@ - - + Elwig - Elektronische Winzergenossenschaftsverwaltung @@ -39,7 +38,7 @@
  • Quellcode
  • -
    +
    @@ -55,11 +54,11 @@
    -
    +
    - +

    Elwig

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore etdolore magna aliquyam erat, sed diam voluptua. @@ -76,12 +75,12 @@

    -
    -
    +
    +
    - +

    Die Genossenschaften

    @@ -92,9 +91,9 @@ -
    +
    -
    +

    Winzerkeller im Weinviertel

    Winzerkeller im Weinviertel
    reg. Gen.m.b.H.
    @@ -103,18 +102,18 @@ -
    +
    -
    +

    WG Weinland

    Winzergenossenschaft Weinland, mit dem Sitz in Groß-Inzersdorf,
    reg. Gen.m.b.H.
    Zweigstellen:
    Groß-Inzersdorf
    -
    +
    -
    +

    WG Baden

    Winzergenossenschaft Baden - Bad Vöslau
    reg. Gen.m.b.H.
    @@ -123,13 +122,13 @@ -
    +
    -
    +
    diff --git a/www/en/index.xhtml b/www/en/index.html similarity index 87% rename from www/en/index.xhtml rename to www/en/index.html index 1e1e48f..dbdd848 100644 --- a/www/en/index.xhtml +++ b/www/en/index.html @@ -1,5 +1,4 @@ - - + Elwig - Electronic Management for Vintners' Cooperatives @@ -39,7 +38,7 @@
  • Source Code
  • -
    +
    @@ -55,11 +54,11 @@
    -
    +
    - +

    Elwig

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore etdolore magna aliquyam erat, sed diam voluptua. @@ -76,12 +75,12 @@

    -
    -
    +
    +
    - +

    The Cooperatives

    @@ -92,9 +91,9 @@ -
    +
    -
    +

    Winzerkeller im Weinviertel

    Winzerkeller im Weinviertel
    reg. Gen.m.b.H.
    @@ -103,18 +102,18 @@ -
    +
    -
    +

    WG Weinland

    Winzergenossenschaft Weinland, mit dem Sitz in Groß-Inzersdorf,
    reg. Gen.m.b.H.
    Branches:
    Groß-Inzersdorf
    -
    +
    -
    +

    WG Baden

    Winzergenossenschaft Baden - Bad Vöslau
    reg. Gen.m.b.H.
    @@ -123,13 +122,13 @@ -
    +
    -
    +
    diff --git a/www/files/create.sql.php b/www/files/create.sql.php index d98cca9..a4e07fb 100644 --- a/www/files/create.sql.php +++ b/www/files/create.sql.php @@ -3,7 +3,7 @@ require "../.php/auth.inc"; require "../.php/credentials.inc"; global $GITEA_TOKEN; -if ($_SERVER['PHP_AUTH_USER'] !== 'elwig' || $_SERVER['PHP_AUTH_PW'] !== 'ganzGeheim123!') { +if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] !== 'elwig' || $_SERVER['PHP_AUTH_PW'] !== 'ganzGeheim123!') { http_401_unauthorized(); } diff --git a/www/files/index.php b/www/files/index.php index 2c085d4..775e3c4 100644 --- a/www/files/index.php +++ b/www/files/index.php @@ -2,6 +2,8 @@ require "../.php/format.inc"; require "../.php/auth.inc"; +$ua = $_SERVER['HTTP_USER_AGENT'] ?? null;; + if ($_SERVER['REQUEST_METHOD'] === 'PUT') { authenticate(); @@ -49,6 +51,26 @@ if ($_SERVER['REQUEST_METHOD'] === 'PUT') { exit("405 Method Not Allowed\n"); } +if ($_SERVER['PATH_INFO'] === '/stat') { + if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_USER'] !== 'elwig' || $_SERVER['PHP_AUTH_PW'] !== 'ganzGeheim123!') { + header('Status: 401'); + header('WWW-Authenticate: Basic realm="Elwig"'); + header('Content-Length: 0'); + exit; + } + + header("Content-Type: text/html; charset=UTF-8"); + echo "\n"; + echo "\n"; + passthru(<<:g' +EOF); + echo "
    TimestampIP AddressMethodURIFormatUser Agent
    :g;s:^:
    :g;s:$:
    \n"; + exit; +} + global $getProd; global $getVers; $getProd = null; @@ -56,7 +78,7 @@ $getVers = null; $info = explode('/', $_SERVER['PATH_INFO']); if (sizeof($info) > 1 && ($info[1] === 'elwig' || $info[1] === 'winziprint')) { $getProd = $info[1]; - $getVers = $info[2]; + if (sizeof($info) > 2) $getVers = $info[2]; if (sizeof($info) > 3) { header('Status: 404'); header('Content-Length: 0'); @@ -78,13 +100,18 @@ foreach ($filesRaw as $file) { $entities = []; foreach ($files as $name => [$size, $mtime, $ctime]) { - $p1 = strrpos($name, '-') + 1; + $p1 = strrpos($name, '-'); $p2 = strrpos($name, '.'); - $vers = substr($name, $p1, $p2 - $p1); $url = "https://elwig.at/files/$name"; + if ($p1 === false || $p2 === false) { + $vers = null; + $prod = null; + } else { + $vers = substr($name, $p1 + 1, $p2 - $p1 - 1); + $prod = strtolower(substr($name, 0, $p1)); + } $mod = date(DATE_ATOM, $mtime); $cre = date(DATE_ATOM, $ctime); - $prod = strtolower(substr($name, 0, $p1 - 1)); $entities[$name] = [ $prod, $vers, @@ -113,6 +140,8 @@ $entities = array_filter($entities, function($e) { }); $format = get_fmt(); +file_put_contents('.log.csv', time() . "|$_SERVER[REMOTE_ADDR]|$_SERVER[REQUEST_METHOD]|$_SERVER[REQUEST_URI]|$format|$ua\n", FILE_APPEND); + if ($format === 'json') { header('Content-Type: application/json; charset=UTF-8'); echo "{\"data\": [\n"; @@ -135,10 +164,9 @@ if ($format === 'json') { header('Content-Length: 0'); exit(); } - header('Content-Type: application/xhtml+xml; charset=UTF-8'); - echo "\n"; + header('Content-Type: text/html; charset=UTF-8'); ?> - + Downloads - Elwig