From dfc781f3ed60f16c57a325045a8885442921ad87 Mon Sep 17 00:00:00 2001 From: smueller Date: Wed, 27 May 2026 12:38:30 +0200 Subject: [PATCH] chore(release): production build 2026-05-27 12:38 --- backend/config/config.php | 15 +- backend/config/mail-config.php | 124 +++---- backend/config/products-config.php | 77 ++--- backend/includes/footer.php | 6 +- backend/includes/functions.php | 55 +-- backend/includes/header.php | 16 +- public/404.php | 6 +- public/500.php | 6 +- public/about.php | 62 +--- public/agb.php | 42 +-- public/assets/css/custom.css | 18 +- public/assets/js/contact.js | 2 +- public/assets/js/cookie-consent.js | 2 +- public/assets/js/main.js | 2 +- public/config/config.php | 6 + public/config/contact-config.php | 64 ++++ public/config/mail-config.php | 144 +++++++- public/config/products-config.php | 514 +++++++++++++++++++++++++++++ public/contact.php | 18 +- public/datenschutz.php | 36 +- public/impressum.php | 28 +- public/includes/api-helpers.php | 112 +++++++ public/includes/footer.php | 167 ++++++++++ public/includes/functions.php | 125 +++++++ public/includes/header.php | 81 +++++ public/index.php | 16 +- public/it-dienstleistungen.php | 14 +- public/mail-gateway.php | 18 +- public/vpc.php | 18 +- public/vps.php | 18 +- public/webhosting.php | 18 +- public/widerruf.php | 6 +- 32 files changed, 1438 insertions(+), 398 deletions(-) create mode 100644 public/config/config.php create mode 100644 public/config/contact-config.php create mode 100644 public/config/products-config.php create mode 100644 public/includes/api-helpers.php create mode 100644 public/includes/footer.php create mode 100644 public/includes/functions.php create mode 100644 public/includes/header.php diff --git a/backend/config/config.php b/backend/config/config.php index 60968a7..ea8ee0f 100644 --- a/backend/config/config.php +++ b/backend/config/config.php @@ -1,17 +1,6 @@ diff --git a/backend/config/mail-config.php b/backend/config/mail-config.php index 55850c0..83ec17f 100644 --- a/backend/config/mail-config.php +++ b/backend/config/mail-config.php @@ -1,67 +1,31 @@ 'HexaHost.de Contact Form', 'X-Priority' => '3', @@ -72,27 +36,27 @@ define('ADDITIONAL_HEADERS', [ 'Precedence' => 'bulk' ]); -// Erlaubte Domains für E-Mail-Adressen (optional) + define('ALLOWED_EMAIL_DOMAINS', [ - // Leer lassen für alle Domains zu erlauben - // 'gmail.com', - // 'outlook.com', - // 'web.de', - // 'gmx.de' + + + + + ]); -// Blacklist für E-Mail-Adressen (optional) + define('BLACKLISTED_EMAILS', [ - // 'spam@example.com', - // 'test@test.com' + + ]); -// Validierung der Konfiguration + if (!defined('SMTP_HOST') || !defined('SMTP_USERNAME') || !defined('SMTP_PASSWORD')) { die('SMTP-Konfiguration ist unvollständig. Bitte überprüfen Sie die mail-config.php'); } -// Überprüfung der E-Mail-Adressen + if (!filter_var(SMTP_FROM_EMAIL, FILTER_VALIDATE_EMAIL)) { die('Ungültige SMTP_FROM_EMAIL Adresse'); } @@ -101,7 +65,7 @@ if (!filter_var(SMTP_TO_EMAIL, FILTER_VALIDATE_EMAIL)) { die('Ungültige SMTP_TO_EMAIL Adresse'); } -// Logging-Funktion + function logEmail($type, $data) { if (!LOG_EMAILS) return; @@ -118,18 +82,18 @@ function logEmail($type, $data) { file_put_contents($logFile, $logEntry, FILE_APPEND | LOCK_EX); } -// Hilfsfunktion für E-Mail-Validierung + function isValidEmail($email) { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return false; } - // Prüfe Blacklist + if (in_array($email, BLACKLISTED_EMAILS)) { return false; } - // Prüfe Domain-Whitelist (falls gesetzt) + if (!empty(ALLOWED_EMAIL_DOMAINS)) { $domain = substr(strrchr($email, "@"), 1); if (!in_array($domain, ALLOWED_EMAIL_DOMAINS)) { @@ -140,36 +104,30 @@ function isValidEmail($email) { return true; } -/** - * Hilfsfunktion zum Abrufen der Konfiguration als Array - * Kompatibilität mit contact-handler.php - * - * @param string|null $key Optional: einzelner Schlüssel - * @return mixed Konfigurationsarray oder einzelner Wert - */ + function getHexaHostConfig($key = null) { $config = [ - // SMTP Server-Einstellungen + 'smtp_host' => SMTP_HOST, 'smtp_port' => SMTP_PORT, 'smtp_username' => SMTP_USERNAME, 'smtp_password' => SMTP_PASSWORD, 'smtp_encryption' => 'tls', - // Absender/Empfänger + 'from_email' => SMTP_FROM_EMAIL, 'from_name' => 'HexaHost.de Kontaktformular', 'to_email' => SMTP_TO_EMAIL, 'to_name' => 'HexaHost Support', - // Sicherheit + 'max_requests_per_hour' => MAX_REQUESTS_PER_HOUR, 'honeypot_field' => 'website', 'enable_csrf' => ENABLE_CSRF_PROTECTION, 'min_message_length' => MIN_MESSAGE_LENGTH, 'max_message_length' => MAX_MESSAGE_LENGTH, - // Debug + 'debug_mode' => DEBUG_MODE, 'log_errors' => LOG_EMAILS, ]; diff --git a/backend/config/products-config.php b/backend/config/products-config.php index 74e128a..72f6415 100644 --- a/backend/config/products-config.php +++ b/backend/config/products-config.php @@ -1,18 +1,9 @@ 'Virtual Private Container', 'short_name' => 'VPC', @@ -112,9 +103,9 @@ $PRODUCTS['vpc'] = [ ], ]; -// ============================================================================ -// VIRTUAL PRIVATE SERVER (VPS) -// ============================================================================ + + + $PRODUCTS['vps'] = [ 'name' => 'Virtual Private Server', 'short_name' => 'VPS', @@ -214,9 +205,9 @@ $PRODUCTS['vps'] = [ ], ]; -// ============================================================================ -// MAIL GATEWAY -// ============================================================================ + + + $PRODUCTS['mail-gateway'] = [ 'name' => 'Mail Gateway', 'short_name' => 'Mail', @@ -316,9 +307,9 @@ $PRODUCTS['mail-gateway'] = [ ], ]; -// ============================================================================ -// WEBHOSTING -// ============================================================================ + + + $PRODUCTS['webhosting'] = [ 'name' => 'Webhosting', 'short_name' => 'Webhosting', @@ -418,68 +409,52 @@ $PRODUCTS['webhosting'] = [ ], ]; -// ============================================================================ -// HILFSFUNKTIONEN -// ============================================================================ -/** - * Alle Produkte abrufen - */ + + + + function getAllProducts() { global $PRODUCTS; return $PRODUCTS; } -/** - * Ein Produkt abrufen - */ + function getProduct($productId) { global $PRODUCTS; return $PRODUCTS[$productId] ?? null; } -/** - * Alle Pakete eines Produkts abrufen - */ + function getProductPackages($productId) { global $PRODUCTS; return $PRODUCTS[$productId]['packages'] ?? []; } -/** - * Ein bestimmtes Paket abrufen - */ + function getPackage($productId, $packageId) { global $PRODUCTS; return $PRODUCTS[$productId]['packages'][$packageId] ?? null; } -/** - * Preis eines Pakets abrufen - */ + function getPackagePrice($productId, $packageId) { $package = getPackage($productId, $packageId); return $package['price'] ?? null; } -/** - * Minimalen Preis eines Produkts abrufen - */ + function getMinPrice($productId) { global $PRODUCTS; return $PRODUCTS[$productId]['min_price'] ?? null; } -/** - * Preis formatiert ausgeben - */ + function formatPrice($price, $withCurrency = true) { return $withCurrency ? $price . '€' : $price; } -/** - * Generiert HTML für eine Paket-Karte - */ + function renderPackageCard($productId, $packageId, $package) { $featuredClass = $package['featured'] ? ' featured' : ''; $featuredBadge = $package['featured'] ? '' : ''; @@ -527,9 +502,7 @@ function renderPackageCard($productId, $packageId, $package) { ); } -/** - * Generiert HTML für alle Pakete eines Produkts - */ + function renderAllPackages($productId) { $packages = getProductPackages($productId); $html = ''; diff --git a/backend/includes/footer.php b/backend/includes/footer.php index 03118f4..7d884de 100644 --- a/backend/includes/footer.php +++ b/backend/includes/footer.php @@ -49,7 +49,7 @@ - + '; +} + + +function generateCSRFToken() { + if (!isset($_SESSION['csrf_token'])) { + $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); + } + return $_SESSION['csrf_token']; +} + + +function validateCSRFToken($token) { + if (!isset($_SESSION['csrf_token']) || !is_string($token)) { + return false; + } + if (!hash_equals($_SESSION['csrf_token'], $token)) { + return false; + } + unset($_SESSION['csrf_token']); + return true; +} + + +function sanitizeHeaderValue(string $value): string { + return str_replace(["\r", "\n", "\0"], '', trim($value)); +} + + +function getClientIP(): string { + if (!empty($_SERVER['HTTP_CF_CONNECTING_IP']) + && filter_var($_SERVER['HTTP_CF_CONNECTING_IP'], FILTER_VALIDATE_IP)) { + return $_SERVER['HTTP_CF_CONNECTING_IP']; + } + + $remoteAddr = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0'; + $isTrustedProxy = filter_var( + $remoteAddr, + FILTER_VALIDATE_IP, + FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE + ) === false; + + if ($isTrustedProxy) { + foreach (['HTTP_X_REAL_IP', 'HTTP_X_FORWARDED_FOR'] as $header) { + if (empty($_SERVER[$header])) { + continue; + } + $ip = trim(explode(',', $_SERVER[$header])[0]); + if (filter_var($ip, FILTER_VALIDATE_IP)) { + return $ip; + } + } + } + + return $remoteAddr; +} +?> \ No newline at end of file diff --git a/public/includes/header.php b/public/includes/header.php new file mode 100644 index 0000000..649f96d --- /dev/null +++ b/public/includes/header.php @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + <?php echo isset($page_title) ? htmlspecialchars($page_title) : 'HexaHost.de - Zuverlässiges Hosting aus Niederbayern'; ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/public/index.php b/public/index.php index d32ca7d..9df9005 100644 --- a/public/index.php +++ b/public/index.php @@ -1,17 +1,17 @@
- +
@@ -44,7 +44,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -150,7 +150,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -192,7 +192,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -248,7 +248,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -265,6 +265,6 @@ includeHeader($page_title, $page_description, $current_page);
\ No newline at end of file diff --git a/public/it-dienstleistungen.php b/public/it-dienstleistungen.php index 7cd8237..de6439a 100644 --- a/public/it-dienstleistungen.php +++ b/public/it-dienstleistungen.php @@ -1,17 +1,17 @@
- +
@@ -32,7 +32,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -60,7 +60,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -128,7 +128,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -143,6 +143,6 @@ includeHeader($page_title, $page_description, $current_page);
diff --git a/public/mail-gateway.php b/public/mail-gateway.php index b0fd0f2..d247076 100644 --- a/public/mail-gateway.php +++ b/public/mail-gateway.php @@ -2,21 +2,21 @@ require_once __DIR__ . '/../backend/includes/functions.php'; require_once __DIR__ . '/../backend/config/products-config.php'; -// Produkt-Daten aus Config laden + $product = getProduct('mail-gateway'); $packages = getProductPackages('mail-gateway'); -// Page configuration + $page_title = $product['page_title']; $page_description = $product['page_description']; $current_page = 'mail-gateway'; -// Include header + includeHeader($page_title, $page_description, $current_page); ?>
- +
@@ -59,7 +59,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -74,7 +74,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -129,7 +129,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -159,7 +159,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -175,6 +175,6 @@ includeHeader($page_title, $page_description, $current_page);
diff --git a/public/vpc.php b/public/vpc.php index bc24083..786f5df 100644 --- a/public/vpc.php +++ b/public/vpc.php @@ -2,21 +2,21 @@ require_once __DIR__ . '/../backend/includes/functions.php'; require_once __DIR__ . '/../backend/config/products-config.php'; -// Produkt-Daten aus Config laden + $product = getProduct('vpc'); $packages = getProductPackages('vpc'); -// Page configuration + $page_title = $product['page_title']; $page_description = $product['page_description']; $current_page = 'vpc'; -// Include header + includeHeader($page_title, $page_description, $current_page); ?>
- +
@@ -58,7 +58,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -73,7 +73,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -129,7 +129,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -159,7 +159,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -175,6 +175,6 @@ includeHeader($page_title, $page_description, $current_page);
diff --git a/public/vps.php b/public/vps.php index 8e2fd5a..d675f8c 100644 --- a/public/vps.php +++ b/public/vps.php @@ -2,21 +2,21 @@ require_once __DIR__ . '/../backend/includes/functions.php'; require_once __DIR__ . '/../backend/config/products-config.php'; -// Produkt-Daten aus Config laden + $product = getProduct('vps'); $packages = getProductPackages('vps'); -// Page configuration + $page_title = $product['page_title']; $page_description = $product['page_description']; $current_page = 'vps'; -// Include header + includeHeader($page_title, $page_description, $current_page); ?>
- +
@@ -63,7 +63,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -78,7 +78,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -134,7 +134,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -164,7 +164,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -180,6 +180,6 @@ includeHeader($page_title, $page_description, $current_page);
diff --git a/public/webhosting.php b/public/webhosting.php index 86c2bc7..3d803c5 100644 --- a/public/webhosting.php +++ b/public/webhosting.php @@ -2,21 +2,21 @@ require_once __DIR__ . '/../backend/includes/functions.php'; require_once __DIR__ . '/../backend/config/products-config.php'; -// Produkt-Daten aus Config laden + $product = getProduct('webhosting'); $packages = getProductPackages('webhosting'); -// Page configuration + $page_title = $product['page_title']; $page_description = $product['page_description']; $current_page = 'webhosting'; -// Include header + includeHeader($page_title, $page_description, $current_page); ?>
- +
@@ -60,7 +60,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -75,7 +75,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -133,7 +133,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -163,7 +163,7 @@ includeHeader($page_title, $page_description, $current_page);
- +
@@ -179,6 +179,6 @@ includeHeader($page_title, $page_description, $current_page);
diff --git a/public/widerruf.php b/public/widerruf.php index cba182a..e831971 100644 --- a/public/widerruf.php +++ b/public/widerruf.php @@ -1,12 +1,12 @@ @@ -131,6 +131,6 @@ includeHeader($page_title, $page_description, $current_page);