From cb799c7c666c37831ac41eb9c7a40dc4d0209d22 Mon Sep 17 00:00:00 2001 From: Clemens Creutzburg Date: Fri, 17 Jul 2026 11:37:41 +0200 Subject: [PATCH] Deployment-Vorbereitung: Domain-Split und Legacy-/Debug-Seiten entfernt - index.php zeigt bei abweichendem Host (APP_HOST-Env) die Landingpage statt des Dashboards, damit kaffeeliste.de und app.kaffeeliste.de aus demselben Webspace bedient werden koennen. Ohne gesetztes APP_HOST (lokale Entwicklung) unveraendertes Verhalten. - landing.php verlinkt Login/Registrierung ueber APP_HOST fest auf die App-Domain, damit Besucher der Marketingdomain dort landen. - functionsLDAP.php entfernt (nur ueber die tote IIS/AUTH_USER-Branch erreichbar, vollstaendig durch app/saas-auth.php ersetzt); zugehoerige tote AD/LDAP-Variablen aus config.php und der AUTH_USER-Zweig aus functions.php entfernt. - mailausgebe.php, umfrage.php, umfrageergebnisse.php entfernt: aus der Navigation nicht erreichbare Debug-/Einzweck-Seiten ohne echte Berechtigungspruefung (mailausgebe.php dumpte alle Mitglieder-E-Mails, umfrageergebnisse.php hatte nur einen auskommentierten Basic-Auth- Block). scripts/http-smoke.php entsprechend bereinigt. --- app/bootstrap.php | 28 ++++ config.php | 22 --- functions.php | 6 - functionsLDAP.php | 166 ------------------ index.php | 13 ++ landing.php | 12 +- mailausgebe.php | 50 ------ scripts/http-smoke.php | 15 -- umfrage.php | 344 -------------------------------------- umfrageergebnisse.php | 370 ----------------------------------------- 10 files changed, 47 insertions(+), 979 deletions(-) delete mode 100644 functionsLDAP.php delete mode 100644 mailausgebe.php delete mode 100644 umfrage.php delete mode 100644 umfrageergebnisse.php diff --git a/app/bootstrap.php b/app/bootstrap.php index 2f710e5..018d5de 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -50,6 +50,34 @@ function app_send_security_headers(): void } } +/** + * The application's own primary hostname in production (e.g. + * app.kaffeeliste.de), configured via APP_HOST. Unset in dev, where + * index.php should keep behaving exactly as before (no host split). + */ +function app_primary_host(): ?string +{ + return app_env('APP_HOST'); +} + +/** + * Builds a URL that always points at the app's own host, even when the + * current request came in on a different domain (e.g. the marketing + * domain linking to /login.php). Falls back to a relative path when + * APP_HOST isn't configured, so local dev is unaffected. + */ +function app_primary_url(string $path): string +{ + $host = app_primary_host(); + if ($host === null) { + return ltrim($path, '/'); + } + + $scheme = app_is_https() ? 'https' : 'http'; + + return $scheme . '://' . $host . '/' . ltrim($path, '/'); +} + function app_start_session(): void { if (PHP_SAPI === 'cli' || session_status() === PHP_SESSION_ACTIVE) { diff --git a/config.php b/config.php index 11b0e15..9aa6643 100644 --- a/config.php +++ b/config.php @@ -8,28 +8,6 @@ if ((getenv('APP_DB_DRIVER') ?: '') === 'mysql' && !function_exists('sqlsrv_conn require_once __DIR__ . '/lib/sqlsrv_mysql_compat.php'; } -### ZUGANGSDATEN AD -$aduser = ''; -$adpassword = ''; -$domain = ''; -## OU für die Suche der Benutzerkonten -#$basedn = ''; -$basedn = ''; -## OU für die Suche der Benutzerkonten -#$basednandereKasse = ''; -## OU für die Suche der Gruppen -$basedngroup = ''; -## Zugriffsgruppe für Automatisierungsclient -$zugriffsACgroup = ''; -## Zugriffsgruppe für Automatische Abwesenheitsnachricht -$zugriffsAbwesenheitgroup = ''; -## Zugriffsgruppe für alle Anfragen des Automatisierungsclient -$zugriffsalleACgroup = ''; -## Zugriffsgruppe für Anfragen der Abwesenheitsnachrichten -$zugriffsalleAbwesenheitgroup = ''; -## Zugriff auf alles -$zugriffsAdminsgroup = ''; - // Verbindung zur Datenbank herstellen (ersetze die Platzhalter durch deine Daten) $serverName = getenv('DB_HOST') ?: ""; $connectionOptions = array( diff --git a/functions.php b/functions.php index 9c9251d..a43e76b 100644 --- a/functions.php +++ b/functions.php @@ -15,12 +15,6 @@ if ($saasUser !== null) { if ($devAuthEmail !== '') { $mailadress = strtolower(trim($devAuthEmail)); $kennung = $mailadress; - } elseif (!empty($_SERVER['AUTH_USER'])) { - $kennungtemp = $_SERVER['AUTH_USER']; - $teile = explode("\\", $kennungtemp); - $kennung = $teile[1] ?? $kennungtemp; - - include_once "functionsLDAP.php"; } } diff --git a/functionsLDAP.php b/functionsLDAP.php deleted file mode 100644 index 32b1771..0000000 --- a/functionsLDAP.php +++ /dev/null @@ -1,166 +0,0 @@ - 0) - { - return $entries[0]['dn']; - } - - return ''; -} - -function getADMail($ad, $samaccountname, $basedn) -{ - $attributes = array('mail'); - $resultz = ldap_search($ad, $basedn, "(samaccountname={$samaccountname})", $attributes); - $entriesz = ldap_get_entries($ad, $resultz); - - #return $entriesz[0]['mail']; - # $entries = ldap_get_entries($ad, $result); - if ($entriesz['count'] > 0) - { - return $entriesz[0]['mail'][0]; - } - - return 'nichts gefunden'; -} - - -/** - * This function retrieves and returns Common Name from a given Distinguished - * Name. - * - * @param string $dn - * The Distinguished Name. - * @return string The Common Name. - */ -function getCN($dn) -{ - preg_match('/[^,]*/', $dn, $matchs, PREG_OFFSET_CAPTURE, 3); - return $matchs[0][0]; -} - -/** - * This function checks group membership of the user, searching only in - * specified group (not recursively). - * - * @param resource $ad - * An LDAP link identifier, returned by ldap_connect(). - * @param string $userdn - * The user Distinguished Name. - * @param string $groupdn - * The group Distinguished Name. - * @return boolean Return true if user is a member of group, and false if not - * a member. - */ -function checkGroup($ad, $userdn, $groupdn) -{ - $result = ldap_read($ad, $userdn, "(memberof={$groupdn})", array( - 'members' - )); - if (! $result) - { - return false; - } - - $entries = ldap_get_entries($ad, $result); - - return ($entries['count'] > 0); -} - -/** - * This function checks group membership of the user, searching in specified - * group and groups which is its members (recursively). - * - * @param resource $ad - * An LDAP link identifier, returned by ldap_connect(). - * @param string $userdn - * The user Distinguished Name. - * @param string $groupdn - * The group Distinguished Name. - * @return boolean Return true if user is a member of group, and false if not - * a member. - */ -function checkGroupEx($ad, $userdn, $groupdn) -{ - if ($groupdn == "") - { - return false; - } - - $result = ldap_read($ad, $userdn, '(objectclass=*)', array( - 'memberof' - )); - if (! $result) - { - return false; - } - - $entries = ldap_get_entries($ad, $result); - if ($entries['count'] <= 0) - { - return false; - } - - if (empty($entries[0]['memberof'])) - { - return false; - } - - for ($i = 0; $i < $entries[0]['memberof']['count']; $i ++) - { - if ($entries[0]['memberof'][$i] == $groupdn) - { - return true; - } - elseif (checkGroupEx($ad, $entries[0]['memberof'][$i], $groupdn)) - { - return true; - } - } - - return false; -} - -?> \ No newline at end of file diff --git a/index.php b/index.php index edb6503..969ea25 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,18 @@ Kaffeeliste

Die Kaffeekasse, die von allein mitrechnet

Schluss mit Strichlisten auf Papier und Kopfrechnen beim Kassensturz: Kaffeeliste hält für dein Team, Büro oder deinen Verein fest, wer wie viele Striche gemacht hat, wer bezahlt hat und wer gerade offen ist – jederzeit einsehbar, für jeden nachvollziehbar.

@@ -128,8 +128,8 @@

In wenigen Minuten eingerichtet, für dein ganzes Team nutzbar.

diff --git a/mailausgebe.php b/mailausgebe.php deleted file mode 100644 index b932717..0000000 --- a/mailausgebe.php +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/scripts/http-smoke.php b/scripts/http-smoke.php index 9d0da42..cdb5716 100644 --- a/scripts/http-smoke.php +++ b/scripts/http-smoke.php @@ -167,21 +167,6 @@ $checks = [ 'path' => 'teilnehmerauswertung.php?user_id=1', 'contains' => ['Auswertung', 'Test Admin', 'Jahresübersicht', 'Letzte Einzahlungen'], ], - [ - 'label' => 'Mailausgabe', - 'path' => 'mailausgebe.php', - 'contains' => ['admin@test.local'], - ], - [ - 'label' => 'Umfrage', - 'path' => 'umfrage.php', - 'contains' => ['Kaffeeliste', 'Danke'], - ], - [ - 'label' => 'Umfrageergebnisse', - 'path' => 'umfrageergebnisse.php', - 'contains' => ['Umfrage', 'Ergebnisse'], - ], [ 'label' => 'PDF-Export', 'path' => 'exportKaffeeliste.php', diff --git a/umfrage.php b/umfrage.php deleted file mode 100644 index cf9a286..0000000 --- a/umfrage.php +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - diff --git a/umfrageergebnisse.php b/umfrageergebnisse.php deleted file mode 100644 index 7535bc2..0000000 --- a/umfrageergebnisse.php +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - \ No newline at end of file