asa
This commit is contained in:
@@ -3,15 +3,31 @@
|
|||||||
|
|
||||||
// Host-Infos ermitteln (für URLs / Redirects etc.)
|
// Host-Infos ermitteln (für URLs / Redirects etc.)
|
||||||
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||||
$host = $_SERVER['HTTP_HOST'] ?? app_primary_domain();
|
$host = $_SERVER['HTTP_HOST'] ?? (function_exists('app_primary_domain') ? app_primary_domain() : 'localhost');
|
||||||
$requestUri = $_SERVER['REQUEST_URI'] ?? '/';
|
$requestUri = $_SERVER['REQUEST_URI'] ?? '/';
|
||||||
|
|
||||||
// Aktuelle Sprache & Sprachen aus den GLOBALS (fileload.php)
|
// Aktuelle Sprache & Sprachen aus den GLOBALS (kommen aus fileload.php / i18n.php)
|
||||||
$currentLang = $GLOBALS['lang'] ?? ($lang ?? 'en');
|
$currentLang = $GLOBALS['lang'] ?? ($lang ?? 'en');
|
||||||
$allAvailable = $GLOBALS['availableLangs'] ?? [];
|
$allAvailable = $GLOBALS['availableLangs'] ?? [];
|
||||||
|
|
||||||
// Optional: Environment aus config.php (du hattest $env → $GLOBALS['app_env'])
|
// Environment & Basis-URLs aus config.php / fileload.php
|
||||||
$env = $GLOBALS['app_env'] ?? 'prod';
|
$appEnv = $GLOBALS['app_env'] ?? (defined('APP_ENV') ? APP_ENV : 'prod');
|
||||||
|
$appBaseUrl = $GLOBALS['app_base_url'] ?? ($scheme . '://' . $host);
|
||||||
|
$appApiBase = $GLOBALS['app_api_base'] ?? ($scheme . '://api.' . ($host));
|
||||||
|
|
||||||
|
// Optional: Helfer-Funktionen nutzen, falls vorhanden
|
||||||
|
$primaryDomain = function_exists('app_primary_domain') ? app_primary_domain() : $host;
|
||||||
|
$primaryUrl = function_exists('app_primary_url') ? app_primary_url() : ($scheme . '://' . $primaryDomain);
|
||||||
|
$fakecheckDomain = function_exists('app_fakecheck_domain') ? app_fakecheck_domain() : null;
|
||||||
|
$fakecheckUrl = function_exists('app_fakecheck_url') ? app_fakecheck_url() : null;
|
||||||
|
|
||||||
|
// i18n-Config aus deiner zentralen i18n-Logik
|
||||||
|
$i18nConfig = function_exists('app_i18n_get_frontend_config')
|
||||||
|
? app_i18n_get_frontend_config()
|
||||||
|
: [
|
||||||
|
'available' => $allAvailable,
|
||||||
|
'current' => $currentLang,
|
||||||
|
];
|
||||||
|
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
// USBCheck JavaScript-Konfiguration
|
// USBCheck JavaScript-Konfiguration
|
||||||
@@ -26,33 +42,34 @@ $usbConfig = [
|
|||||||
'assetVersion' => defined('ASSET_VERSION') ? ASSET_VERSION : null,
|
'assetVersion' => defined('ASSET_VERSION') ? ASSET_VERSION : null,
|
||||||
|
|
||||||
// Environment (prod, staging, dev)
|
// Environment (prod, staging, dev)
|
||||||
'env' => $env,
|
'env' => $appEnv,
|
||||||
|
|
||||||
// Domains
|
// Domains
|
||||||
'domains' => [
|
'domains' => [
|
||||||
'primaryDomain' => app_primary_domain(),
|
'primaryDomain' => $primaryDomain,
|
||||||
'primaryUrl' => app_primary_url(),
|
'primaryUrl' => $primaryUrl,
|
||||||
'fakecheckDomain' => app_fakecheck_domain(),
|
'fakecheckDomain' => $fakecheckDomain,
|
||||||
'fakecheckUrl' => app_fakecheck_url(),
|
'fakecheckUrl' => $fakecheckUrl,
|
||||||
],
|
],
|
||||||
|
|
||||||
// Fakecheck-Tool-Config
|
// Fakecheck-Tool-Config
|
||||||
'fakecheck' => [
|
'fakecheck' => [
|
||||||
'baseUrl' => $GLOBALS['app_url'] ?? '',
|
'baseUrl' => $appBaseUrl,
|
||||||
'apiBaseUrl' => $GLOBALS['app_api_url'] ?? 'https://api.usbcheck.it',
|
'apiBaseUrl' => $appApiBase,
|
||||||
'locale' => $currentLang,
|
'locale' => $currentLang,
|
||||||
],
|
],
|
||||||
'i18n' => app_i18n_get_frontend_config(),
|
|
||||||
// i18n-Konfiguration
|
// i18n-Konfiguration (zentrale Struktur)
|
||||||
'i18n' => [
|
'i18n' => $i18nConfig,
|
||||||
'available' => $allAvailable,
|
|
||||||
'current' => $currentLang,
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
window.usbConfig = <?= json_encode(
|
// Zentrales JS-Config-Objekt für deine Tools
|
||||||
|
window.usbcheck = <?= json_encode(
|
||||||
$usbConfig,
|
$usbConfig,
|
||||||
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE
|
JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_SUBSTITUTE
|
||||||
) ?>;
|
) ?>;
|
||||||
|
|
||||||
|
// Alias für eventuelle ältere Stellen
|
||||||
|
window.usbConfig = window.usbcheck;
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user