Init Git Prod Mars 2026
This commit is contained in:
commit
d81efe93b1
362 files changed
+86627
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// Définir la langue par défaut
|
||||
if (!isset($_SESSION['lang'])) {
|
||||
$_SESSION['lang'] = 'ru'; // par défaut russe
|
||||
}
|
||||
|
||||
// Charger le fichier de langue correspondant
|
||||
$lang = $_SESSION['lang'];
|
||||
$lang_file = __DIR__ . "/../lang/{$lang}.php";
|
||||
|
||||
// Si le fichier n'existe pas, on repasse en russe
|
||||
if (!file_exists($lang_file)) {
|
||||
$lang_file = __DIR__ . "/../lang/ru.php";
|
||||
}
|
||||
|
||||
// Charger les traductions
|
||||
$translations = require $lang_file;
|
||||
|
||||
/**
|
||||
* Asset helper: ajoute une version ?v= basée sur filemtime()
|
||||
* Usage: asset('/includes/custom_style.css')
|
||||
*/
|
||||
if (!function_exists('asset')) {
|
||||
function asset(string $webPath): string
|
||||
{
|
||||
// Normalise
|
||||
if ($webPath === '') return $webPath;
|
||||
if ($webPath[0] !== '/') $webPath = '/' . $webPath;
|
||||
|
||||
$docRoot = rtrim($_SERVER['DOCUMENT_ROOT'] ?? '', '/');
|
||||
$fsPath = $docRoot . $webPath;
|
||||
|
||||
$v = (is_file($fsPath) ? filemtime($fsPath) : time()); // fallback si non trouvé
|
||||
return $webPath . '?v=' . $v;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user