mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 11:28:42 +00:00
Refactor configuration loading: Updated multiple public PHP files to require a new bootstrap file for configuration management. Adjusted paths for product configuration to enhance maintainability and consistency across the application.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = '404 - Seite nicht gefunden | HexaHost.de';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = '500 - Serverfehler | HexaHost.de';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Über mich - HexaHost.de | Hosting aus Niederbayern';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Allgemeine Geschäftsbedingungen - HexaHost.de | AGB';
|
||||
|
||||
41
public/bootstrap.php
Normal file
41
public/bootstrap.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* HexaHost – Bootstrap für Monorepo- und Produktions-Layout
|
||||
*
|
||||
* Monorepo: public/../backend/{includes,config}
|
||||
* Produktion: public/{includes,config} (nach Backend-Kopie)
|
||||
*/
|
||||
|
||||
if (!defined('HEXAHOST_BOOTSTRAPPED')) {
|
||||
$pathCandidates = [
|
||||
[
|
||||
'includes' => __DIR__ . '/includes',
|
||||
'config' => __DIR__ . '/config',
|
||||
],
|
||||
[
|
||||
'includes' => __DIR__ . '/../backend/includes',
|
||||
'config' => __DIR__ . '/../backend/config',
|
||||
],
|
||||
];
|
||||
|
||||
$resolved = false;
|
||||
|
||||
foreach ($pathCandidates as $paths) {
|
||||
if (is_file($paths['includes'] . '/functions.php')) {
|
||||
define('HEXAHOST_INCLUDES_DIR', $paths['includes']);
|
||||
define('HEXAHOST_CONFIG_DIR', $paths['config']);
|
||||
require_once $paths['includes'] . '/functions.php';
|
||||
$resolved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$resolved) {
|
||||
http_response_code(500);
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo 'HexaHost: Anwendung konnte nicht gestartet werden (includes nicht gefunden).';
|
||||
exit;
|
||||
}
|
||||
|
||||
define('HEXAHOST_BOOTSTRAPPED', true);
|
||||
}
|
||||
@@ -9,8 +9,10 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
// Konfiguration laden
|
||||
require_once 'config/mail-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
$configDir = defined('HEXAHOST_CONFIG_DIR') ? HEXAHOST_CONFIG_DIR : __DIR__ . '/config';
|
||||
require_once $configDir . '/mail-config.php';
|
||||
|
||||
// PHPMailer Autoload (falls via Composer installiert)
|
||||
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
|
||||
@@ -43,13 +45,8 @@ function validateCSRFToken($token) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// CORS Headers für AJAX-Requests (nur eigene Domain erlauben)
|
||||
$allowed_origins = [
|
||||
'https://hexahost.de',
|
||||
'https://www.hexahost.de',
|
||||
'http://localhost', // Für Entwicklung
|
||||
'http://127.0.0.1' // Für Entwicklung
|
||||
];
|
||||
// CORS Headers für AJAX-Requests (nur eigene Domains erlauben)
|
||||
$allowed_origins = getAllowedOrigins();
|
||||
|
||||
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
|
||||
if (in_array($origin, $allowed_origins)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/../backend/config/products-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once HEXAHOST_CONFIG_DIR . '/products-config.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Kontakt - HexaHost.de | Hosting aus Niederbayern';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Datenschutzerklärung - HexaHost.de | Datenschutz';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Impressum - HexaHost.de | Rechtliche Angaben';
|
||||
@@ -23,7 +23,7 @@ includeHeader($page_title, $page_description, $current_page);
|
||||
?>
|
||||
<h1 class="legal-hero-title">Impressum</h1>
|
||||
<p class="legal-hero-description">
|
||||
|
||||
Rechtliche Angaben und Pflichtinformationen gemäß § 5 DDG
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/../backend/config/products-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once HEXAHOST_CONFIG_DIR . '/products-config.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'HexaHost.de - Zuverlässiges Hosting aus Niederbayern';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'IT-Dienstleistungen - HexaHost.de | Privat & Gewerblich';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/../backend/config/products-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once HEXAHOST_CONFIG_DIR . '/products-config.php';
|
||||
|
||||
// Produkt-Daten aus Config laden
|
||||
$product = getProduct('mail-gateway');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/../backend/config/products-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once HEXAHOST_CONFIG_DIR . '/products-config.php';
|
||||
|
||||
// Produkt-Daten aus Config laden
|
||||
$product = getProduct('vpc');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/../backend/config/products-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once HEXAHOST_CONFIG_DIR . '/products-config.php';
|
||||
|
||||
// Produkt-Daten aus Config laden
|
||||
$product = getProduct('vps');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/../backend/config/products-config.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
require_once HEXAHOST_CONFIG_DIR . '/products-config.php';
|
||||
|
||||
// Produkt-Daten aus Config laden
|
||||
$product = getProduct('webhosting');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../backend/includes/functions.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Widerrufsbelehrung - HexaHost.de';
|
||||
|
||||
Reference in New Issue
Block a user