| Current Path : /home/h/a/p/happyrenas/myreco.online/administration/panel/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/h/a/p/happyrenas/myreco.online/administration/panel/traduction.php |
<?
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/../');
include("../../configuration.php");
include("../../includes/fonctions.php");
setlocale(LC_TIME, 'fr_FR.UTF-8');
include("auth.php");
//INSERT INTO traduction (cle_traduction, code_langue, texte_traduction) SELECT DISTINCT cle_traduction, 'EN', '' FROM traduction WHERE code_langue = 'FR' -- ou 'IT' ou 'ES' AND cle_traduction NOT IN (SELECT cle_traduction FROM traduction WHERE code_langue = 'EN');//
///////////////////////
//PARAMETRES DE LA PAGE
///////////////////////
$totem = "traduction";
$page = "traduction";
$ariane1 = "Les traductions";
$ariane2 = "Les traductions";
$titre = "Les traductions";
$datatable_nom = "traduction_table";
$date_creation = date("Y-m-d");
$date_heure_creation = date("Y-m-d H:i");
$miseajour = $_REQUEST['miseajour'];
$langue = $_REQUEST['langue'];
if (!$langue) {$langue="FR";}
$cles = $_POST['cles'];
$textes = $_POST['textes'];
if (isset($_POST['submit_traductions'])) {
// đ Mise Ă jour des traductions existantes
if (!empty($_POST['cles']) && !empty($_POST['textes'])) {
foreach ($_POST['cles'] as $index => $cle) {
$texte = $_POST['textes'][$index];
$texte = convertirEmojiEnEntiteHTML($texte); // â Ajout ici
$cle_safe = $db->escape($cle);
$texte_safe = $db->escape($texte);
$requete="UPDATE traduction SET texte_traduction = '$texte_safe' WHERE cle_traduction = '$cle_safe' AND code_langue = '$langue'";
//echo $requete."<br>";
$db->query($requete);
}
}
// â Ajout nouvelle clĂ©
if (!empty($_POST['nouvelle_cle']) && !empty($_POST['nouvelle_traduction'])) {
$cle = $db->escape($_POST['nouvelle_cle']);
foreach ($_POST['nouvelle_traduction'] as $code => $texte) {
$texte = $texte ?? '';
$texte = convertirEmojiEnEntiteHTML($texte); // â Ajout ici
$texte_safe = $db->escape($texte);
$code_safe = $db->escape($code);
// VĂ©rifie si la traduction existe dĂ©jĂ
$exists = $db->get_var("SELECT COUNT(*) FROM traduction WHERE cle_traduction = '$cle' AND code_langue = '$code_safe'");
if ($exists == 0) {
$db->query("INSERT INTO traduction (cle_traduction, code_langue, texte_traduction) VALUES ('$cle', '$code_safe', '$texte_safe')");
}
}
}
//echo "<p style='color:green'>Traductions enregistrées.</p>";
header("Refresh:0; url=traduction.php?miseajour=1&langue=".$langue);exit;
}
?>
<!DOCTYPE html>
<html lang="fr">
<?include("includes/head.php");?>
<style>
#traduction_table td {
vertical-align: top;
}
.input-cle.readonly-cle {
cursor: not-allowed;
background-color: #f1f1f1;
color: #555;
border-color: #ddd;
}
.input-cle {
cursor: not-allowed;
background-color: #f1f1f1;
color: #555;
border-color: #ddd;
}
#traduction_table colgroup col:nth-child(1) { width: 20%; }
#traduction_table colgroup col:nth-child(2) { width: 40%; }
#traduction_table colgroup col:nth-child(3) { width: 40%; }
</style>
<body id="kt_body" class="page-loading-enabled page-loading header-fixed header-mobile-fixed subheader-enabled subheader-fixed aside-enabled aside-fixed page-loading">
<div id="halt_loader_overlay"></div><div id="halt_loader" class=""><i class="fa fa-spinner fa-spin"></i> Chargement des informations, merci de patienter...</div>
<div class="d-flex flex-column flex-root">
<!--begin::Page-->
<div class="d-flex flex-row flex-column-fluid page">
<?include("includes/header_left.php");?>
<!--begin::Wrapper-->
<div class="d-flex flex-column flex-row-fluid wrapper" id="kt_wrapper">
<?include("includes/header_top.php");?>
<!--begin::Content-->
<div class="content d-flex flex-column flex-column-fluid" id="kt_content">
<!--begin::Subheader-->
<div class="subheader py-2 py-lg-4 subheader-solid" id="kt_subheader">
<div class="container-fluid d-flex align-items-center justify-content-between flex-wrap flex-sm-nowrap">
<div class="d-flex align-items-center flex-wrap mr-2">
<h5 class="text-dark font-weight-bold mt-2 mb-2 mr-5"><?echo $ariane1;?></h5>
<div class="subheader-separator subheader-separator-ver mt-2 mb-2 mr-5 bg-gray-200"></div>
<h5 class="text-dark font-weight-bold mt-2 mb-2 mr-5"><?echo $langue?></h5>
<div class="d-flex align-items-center" id="kt_subheader_search">
<span class="text-dark-50 font-weight-bold" id="kt_subheader_total"></span>
</div>
</div>
<div class="d-flex align-items-center">
<div class="btn-group ml-2">
<!-- Bouton placé ailleurs sur la page -->
<button type="submit" name="submit_traductions" form="formulaire_principal"
class="form_bouton btn btn-primary font-weight-bold btn-sm px-3 font-size-base"
onclick="showLoader();"
>
ENREGISTRER
</button>
</div>
</div>
</div>
</div>
<!--end::Subheader-->
<?
$traductions = $db->get_results("SELECT * FROM traduction ORDER BY cle_traduction");
?>
<div class="d-flex flex-column-fluid">
<div class="<?echo $container_type;?>">
<div class="row">
<div class="col-xl-12" >
<form id="formulaire_principal" action="traduction.php" method="post">
<input type="hidden" name="action" value="modifier">
<input type="hidden" name="langue" value="<?echo $langue;?>">
<div class="card card-custom" style="border: 1px solid <?echo $couleur_bordure;?>;">
<div class="card-header flex-wrap py-3">
<div class="card-title">
<h3 class="card-label">Ajouter une nouvelle clef</h3>
</div>
<div class="card-toolbar" id="card-toolbar">
</div>
</div>
<div class="card-body">
<div class="col-xl-12">
<div class="form-group">
<label>Clef </label>
<div class="input-group">
<input type="text" name="nouvelle_cle" class="form-control" placeholder="Nouvelle clé" value="" >
</div>
</div>
<?php foreach ($langues as $code): ?>
<div class="form-group">
<label>Traduction pour <?= $code ?> </label>
<div class="input-group">
<textarea class='form-control' name='nouvelle_traduction[<?= $code ?>]' style='width:100%; height:60px'></textarea>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<div class="card card-custom mt-2" style="border: 1px solid <?echo $couleur_bordure;?>;">
<div class="card-header flex-wrap py-3">
<div class="card-title">
<h3 class="card-label">Gestion des traductions</h3>
</div>
<div class="card-toolbar" id="card-toolbar">
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-xl-12">
<table class='table compacted table-bordered table-sm table-hover' id='traduction_table'>
<colgroup>
<col style="width:20%">
<col style="width:40%">
<col style="width:40%">
</colgroup>
<thead>
<tr>
<th>Clé</th>
<th>Traduction (<?= $langue ?>)</th>
<th>Prévisualisation</th>
</tr>
</thead>
<tbody>
<?php foreach ($traductions as $tr): ?>
<?php if ($tr->code_langue != $langue) continue; ?>
<tr>
<td>
<input class='form-control input-cle' type='text' name='cles[]'
value="<?= htmlspecialchars($tr->cle_traduction) ?>" readonly style='width:100%'>
</td>
<td><textarea class='form-control' name='textes[]' style='width:100%; height:60px'><?= htmlspecialchars($tr->texte_traduction) ?></textarea></td>
<td style='padding:10px'><?= $tr->texte_traduction ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!--end::Content-->
</div>
<!--begin::Footer-->
<?include("includes/footer.php");?>
<!--end::Footer-->
</div>
<!--end::Wrapper-->
</div>
<!--end::Page-->
</div>
<!--end::Main-->
<?include("includes/extrav2.php");?>
<script type="text/javascript" class="init">
$(document).ready(function() {
$('#traduction_table').DataTable({
responsive: true,
paging: false,
stateSave: false,
autoWidth: false,
pageLength: 100,
order: [],
columnDefs: [
{ targets: [0], visible: true, orderable: false },
{ targets: [1], visible: true, orderable: false },
{ targets: [2], visible: true, orderable: false },
],
orderable: false,
orderClasses: false,
bSort: false,
info:false,
searching: true,
language: {
zeroRecords: "Aucun résultat",
sLengthMenu: "Afficher _MENU_ lignes",
info: "_TOTAL_ enregistrement(s) ",
infoEmpty: "Aucun enregistrement",
infoFiltered: "(Sur _MAX_ résultats)",
sSearch: "Rechercher : ",
}
});
////////////////////////
//NOTIFICATION EN HAUT//
////////////////////////
<?if ($miseajour==1) {$title="Mise à jour demandée";$message="La mise à jour a été effectuée avec succÚs";$type="success";}?>
<?if ($miseajour) {?>
$.notify({title: '<?echo $title;?>',message: '<?echo $message;?>',},{element: 'body',position: null,type: "<?echo $type;?>",allow_dismiss: true,newest_on_top: true,spacing: 10,delay : 1000,placement: {from: "top",align: "center"},offset: {x: 30,y: 30},z_index: 10000,animate: {enter: 'animate__animated animate__bounce',exit: 'animate__animated animate__bounce'}});
<?}?>
});
</script>
<?include("includes/end.php");?>
</body>
</html>