asd
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
if (!defined('ASSET_VERSION')) {
|
if (!defined('ASSET_VERSION')) {
|
||||||
define('ASSET_VERSION', '2024-11-22'); // oder deine aktuelle Version
|
define('ASSET_VERSION', '2024-11-22'); // oder deine aktuelle Version
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
ini_set('display_errors', 0);
|
|
||||||
ini_set('display_startup_errors', 0);
|
|
||||||
error_reporting(E_ALL); // aber in ein Log schreiben lassen
|
|
||||||
if (php_sapi_name() !== 'cli') {
|
|
||||||
// Session nur starten, wenn noch keine läuft
|
|
||||||
if (session_status() === PHP_SESSION_NONE) {
|
|
||||||
|
|
||||||
// Optional: Session-Konfiguration vor session_start
|
|
||||||
session_name('usbcheck_session');
|
|
||||||
|
|
||||||
session_set_cookie_params([
|
|
||||||
'lifetime' => 0, // Session-Cookie
|
|
||||||
'path' => '/',
|
|
||||||
'domain' => '', // leer = aktuelle Domain
|
|
||||||
'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'),
|
|
||||||
'httponly' => true,
|
|
||||||
'samesite' => 'Lax', // oder 'Strict' falls du sehr streng sein willst
|
|
||||||
]);
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require_once __DIR__ . "/config.php";
|
|
||||||
require_once __DIR__ . "/db.php";
|
|
||||||
require_once __DIR__ . '/../src/functions.php';
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
if (!defined('ASSET_VERSION')) {
|
if (!defined('ASSET_VERSION')) {
|
||||||
define('ASSET_VERSION', time()); // oder deine aktuelle Version
|
define('ASSET_VERSION', time()); // oder deine aktuelle Version
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// Session starten
|
// Session starten
|
||||||
@@ -24,6 +21,10 @@ if (php_sapi_name() !== 'cli') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once __DIR__ . "/../config.php";
|
||||||
|
require_once __DIR__ . "/../db.php";
|
||||||
|
require_once __DIR__ . '/../src/functions.php';
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// 1) Sprache bestimmen (vor dem Laden der JSON-Dateien!)
|
// 1) Sprache bestimmen (vor dem Laden der JSON-Dateien!)
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
@@ -46,23 +47,39 @@ $langFiles = glob($i18nDir . '/*.json') ?: [];
|
|||||||
|
|
||||||
$availableLangs = [];
|
$availableLangs = [];
|
||||||
|
|
||||||
|
// Alle vorhandenen JSONs einsammeln
|
||||||
foreach ($langFiles as $file) {
|
foreach ($langFiles as $file) {
|
||||||
$json = json_decode(file_get_contents($file), true);
|
$json = json_decode(@file_get_contents($file), true);
|
||||||
if (!$json || !isset($json['meta'])) continue;
|
if (!is_array($json) || !isset($json['meta'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$meta = $json['meta'];
|
$meta = $json['meta'];
|
||||||
$code = strtolower($meta['code'] ?? basename($file, ".json"));
|
$code = strtolower($meta['code'] ?? basename($file, '.json'));
|
||||||
|
|
||||||
$availableLangs[$code] = [
|
$availableLangs[$code] = [
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
'label' => $meta['label'] ?? strtoupper($code),
|
'label' => $meta['label'] ?? strtoupper($code),
|
||||||
'flag' => $meta['flag'] ?? '🏳️'
|
'flag' => $meta['flag'] ?? '🏳️',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Falls Sprache ungültig oder nicht vorhanden → erste verfügbare Sprache wählen
|
// Falls keine Sprachdateien gefunden wurden → Minimal-Fallback
|
||||||
|
if (empty($availableLangs)) {
|
||||||
|
$availableLangs = [
|
||||||
|
'en' => [
|
||||||
|
'code' => 'en',
|
||||||
|
'label' => 'English',
|
||||||
|
'flag' => '🇬🇧',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Falls Sprache ungültig oder nicht in available → erste verfügbare Sprache wählen
|
||||||
if (!$lang || !isset($availableLangs[$lang])) {
|
if (!$lang || !isset($availableLangs[$lang])) {
|
||||||
$lang = array_key_first($availableLangs) ?: 'en';
|
// erste Sprache aus dem Array, ohne array_key_first (falls ältere PHP-Version)
|
||||||
|
$keys = array_keys($availableLangs);
|
||||||
|
$lang = $keys[0] ?? 'en';
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
@@ -72,7 +89,7 @@ $activeLangFile = $i18nDir . '/' . $lang . '.json';
|
|||||||
$activeLangData = [];
|
$activeLangData = [];
|
||||||
|
|
||||||
if (is_readable($activeLangFile)) {
|
if (is_readable($activeLangFile)) {
|
||||||
$json = json_decode(file_get_contents($activeLangFile), true);
|
$json = json_decode(@file_get_contents($activeLangFile), true);
|
||||||
if (is_array($json)) {
|
if (is_array($json)) {
|
||||||
$activeLangData = $json;
|
$activeLangData = $json;
|
||||||
}
|
}
|
||||||
@@ -85,7 +102,7 @@ $fallbackLangData = [];
|
|||||||
$fallbackFile = $i18nDir . '/en.json';
|
$fallbackFile = $i18nDir . '/en.json';
|
||||||
|
|
||||||
if ($lang !== 'en' && is_readable($fallbackFile)) {
|
if ($lang !== 'en' && is_readable($fallbackFile)) {
|
||||||
$json = json_decode(file_get_contents($fallbackFile), true);
|
$json = json_decode(@file_get_contents($fallbackFile), true);
|
||||||
if (is_array($json)) {
|
if (is_array($json)) {
|
||||||
$fallbackLangData = $json;
|
$fallbackLangData = $json;
|
||||||
}
|
}
|
||||||
@@ -105,6 +122,4 @@ $GLOBALS['i18n'] = [
|
|||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
// 6) Rest des Systems laden
|
// 6) Rest des Systems laden
|
||||||
// -----------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
require_once __DIR__ . "/config.php";
|
|
||||||
require_once __DIR__ . "/db.php";
|
|
||||||
require_once __DIR__ . '/../src/functions.php';
|
|
||||||
Reference in New Issue
Block a user