Import initial du site ship2net.fr : pages PHP, config, traductions t(), composer.json

This commit is contained in:
2026-09-28 08:04:25 +00:00
commit 82f431b3ae
175 changed files with 25531 additions and 0 deletions
+497
View File
@@ -0,0 +1,497 @@
<?php
include "../config/config.php";
Init_session(basename($_SERVER['SCRIPT_NAME'])); // Fonction ouvrant la session et vérifiant que les accès sont autorisés.
Entete_page_html();
//************************************************************************************************************************************
// Initialisation des variables globales
//************************************************************************************************************************************
$message_erreur = "";
$message_information = "";
$flag_redirection = false;
Ouverture_bdd(); // Connexion à MySql
//************************************************************************************************************************************
// Traitement des variables d'entrées
//************************************************************************************************************************************
// Variables de SESSION :
if (!isset($_SESSION['Textes']['page'])) $_SESSION['Textes']['page'] = 'Accueil';
// Variables GET :
if (isset($_GET['action']))
{
switch ($_GET['action'])
{
//===================================
case "navigation":
{
if (isset($_GET['destination']))
{
$_SESSION['Textes']['page'] = $_GET['destination'];
$_SESSION['texte_fichier'] = "";
$_SESSION['texte_page'] = "";
$_SESSION['texte_bloc'] = "";
$_SESSION['texte_nom'] = "";
$_SESSION['texte_current_page']= "";
//Textes a modifier
if ($_SESSION['Textes']['page'] == "Accueil" && $_GET['fichier']!= ""){
$_SESSION['texte_fichier'] = $_GET['fichier'];
$_SESSION['texte_page'] = $_GET['page'];
$_SESSION['texte_bloc'] = $_GET['bloc'];
$_SESSION['texte_nom'] = $_GET['nom'];
$_SESSION['texte_current_page']= $_GET['current_page'];
}
}
break;
}
//===================================
case "changement_langue":
{
if (isset($_GET['langue']))
{
$_SESSION['langue'] = $_GET['langue'];
chargement_langue();
}
break;
}
case "changement_type":
{
if (isset($_GET['type']))
{
$_SESSION['type_utilisateur'] = $_GET['type'];
chargement_langue();
}
break;
}
case "toggle_edit":
{
if ($_SESSION['modifier_texte'] == 0) $_SESSION['modifier_texte'] = 1;
else if ($_SESSION['modifier_texte'] == 1) $_SESSION['modifier_texte'] = 0;
break;
}
}
if (!$flag_redirection) header('Location:textes.php');
}
// Variables POST :
if(isset($_POST['annuler_ajout_texte'])){
header('Location:administration.php');
}
if (isset($_POST['validation_ajout_texte'])){
$texte['Fichier'] = isset($_POST['fichier']) ? strtolower($_POST['fichier']) : "";
$texte['Page'] = isset($_POST['page']) ? strtolower($_POST['page']) : "";
$texte['Bloc'] = isset($_POST['bloc']) ? strtolower($_POST['bloc']) : "";
$texte['Nom'] = isset($_POST['nom']) ? strtolower($_POST['nom']) : "";
$texte['Texte_fr_par'] = isset($_POST['text_fr_par']) ? addslashes ($_POST['text_fr_par']) : "";
$texte['Texte_en_par'] = isset($_POST['text_en_par']) ? addslashes ($_POST['text_en_par']) : "";
$texte['Texte_fr_pro'] = isset($_POST['text_fr_pro']) ? addslashes ($_POST['text_fr_pro']) : "";
$texte['Texte_en_pro'] = isset($_POST['text_en_pro']) ? addslashes ($_POST['text_en_pro']) : "";
//reserver un id pour le texte
$requete = 'INSERT INTO TB_Textes VALUES ()';
Requete_preparee_bdd($requete, array(), __FILE__, __LINE__);
$texte['id'] = Recuperation_id_cree_bdd();
//inserer les textes
$requete = 'INSERT INTO TB_Textes_traduction (ID_LANGUAGES, ID_TYPE, ID_TEXTES, Texte) VALUES ';
$requete .= '('.$_SESSION['id_langue']['FR'].', 1, ?, ?), ';
$requete .= '('.$_SESSION['id_langue']['EN'].', 1, ?, ?), ';
$requete .= '('.$_SESSION['id_langue']['FR'].', 2, ?, ?), ';
$requete .= '('.$_SESSION['id_langue']['EN'].', 2, ?, ?) ';
Requete_preparee_bdd($requete,
array(
array('i', $texte['id']),
array('s', $texte['Texte_fr_par']),
array('i', $texte['id']),
array('s', $texte['Texte_en_par']),
array('i', $texte['id']),
array('s', $texte['Texte_fr_pro']),
array('i', $texte['id']),
array('s', $texte['Texte_en_pro'])),
__FILE__, __LINE__);
//générer le chemin d'accès
$requete = 'INSERT INTO TB_Textes_acces (Fichier, Page, Bloc, Nom, ID_TEXTES) VALUES ';
$requete .= '(?, ?, ?, ?, ?) ';
Requete_preparee_bdd($requete,
array(
array('s', $texte['Fichier']),
array('s', $texte['Page']),
array('s', $texte['Bloc']),
array('s', $texte['Nom']),
array('i', $texte['id'])),
__FILE__, __LINE__);
// header('Location:textes.php');
}
if(isset($_POST['validation_modification_texte'])){
$textes['Texte_fr_par'] = isset($_POST['text_fr_par']) ? $_POST['text_fr_par'] : "";
$textes['Texte_en_par'] = isset($_POST['text_en_par']) ? $_POST['text_en_par'] : "";
$textes['Texte_fr_pro'] = isset($_POST['text_fr_pro']) ? $_POST['text_fr_pro'] : "";
$textes['Texte_en_pro'] = isset($_POST['text_en_pro']) ? $_POST['text_en_pro'] : "";
$requete = 'UPDATE TB_Textes_traduction SET Texte = ? where ID_LANGUAGES = "1" and ID_TYPE = 1 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = "1" and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)';
Requete_preparee_bdd($requete,
array(
array('s', $textes['Texte_fr_par'] ),
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
$requete = 'UPDATE TB_Textes_traduction SET Texte = ? where ID_LANGUAGES = "1" and ID_TYPE = 2 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = "1" and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)';
Requete_preparee_bdd($requete,
array(
array('s', $textes['Texte_fr_pro'] ),
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
$requete = 'UPDATE TB_Textes_traduction SET Texte = ? where ID_LANGUAGES = "2" and ID_TYPE = 1 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = "1" and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)';
Requete_preparee_bdd($requete,
array(
array('s', $textes['Texte_en_par'] ),
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
$requete = 'UPDATE TB_Textes_traduction SET Texte = ? where ID_LANGUAGES = "2" and ID_TYPE = 2 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = "1" and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)';
Requete_preparee_bdd($requete,
array(
array('s', $textes['Texte_en_pro'] ),
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
//rechargement du contenu
chargement_langue();
//redirection vers la bonne page
header('Location:'.$_SESSION['texte_current_page'].'');
}
if(isset($_POST['annuler_modification_texte'])){
$_SESSION['texte_fichier'] = "";
$_SESSION['texte_page'] = "";
$_SESSION['texte_bloc'] = "";
$_SESSION['texte_nom'] = "";
$page = $_SESSION['texte_current_page'];
$_SESSION['texte_current_page'] = "";
header('Location:'.$page.'');
}
//************************************************************************************************************************************
// Traitement des données
//************************************************************************************************************************************
Ouverture_bdd();
// Protection contre les accès directs :
if ((!$_SESSION['acces_valide']) OR ($_SESSION['shipmember']['Niveau_acces'] < NIVEAU_EDITEUR_ACCES_ADMINISTATEUR)) header('Location:administration.php?action=navigation&destination=Accueil');
;
switch ($_SESSION['Textes']['page'])
{
//****************************************************************************************************************************
case "Accueil":
{
if ($_SESSION['texte_fichier'] != ""){
$requete = "SELECT Texte from TB_Textes_traduction where ID_LANGUAGES = '1' AND ID_TYPE = 1 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = '1' and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)";
$reponse = Requete_preparee_bdd($requete,
array(
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
while ($donnees = Recherche_ligne_bdd($reponse))
{
$textes['fr_par'] = $donnees['Texte'];
}
Liberation_jeu_de_resultat_bdd($reponse);
$requete = "SELECT Texte from TB_Textes_traduction where ID_LANGUAGES = '1' AND ID_TYPE = 2 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = '1' and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)";
$reponse = Requete_preparee_bdd($requete,
array(
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
while ($donnees = Recherche_ligne_bdd($reponse))
{
$textes['fr_pro'] = $donnees['Texte'];
}
Liberation_jeu_de_resultat_bdd($reponse);
$requete = "SELECT Texte from TB_Textes_traduction where ID_LANGUAGES = '2' AND ID_TYPE = 1 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = '1' and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)";
$reponse = Requete_preparee_bdd($requete,
array(
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
while ($donnees = Recherche_ligne_bdd($reponse))
{
$textes['en_par'] = $donnees['Texte'];
}
Liberation_jeu_de_resultat_bdd($reponse);
$requete = "SELECT Texte from TB_Textes_traduction where ID_LANGUAGES = '2' AND ID_TYPE = 2 and ID_TEXTES = (SELECT ID_TEXTES as ID from TB_Textes_acces where Validite = '1' and Fichier = ? and Page = ? and Bloc = ? and Nom = ?)";
$reponse = Requete_preparee_bdd($requete,
array(
array('s', $_SESSION['texte_fichier'] ),
array('s', $_SESSION['texte_page'] ),
array('s', $_SESSION['texte_bloc'] ),
array('s', $_SESSION['texte_nom'] )),
__FILE__, __LINE__);
while ($donnees = Recherche_ligne_bdd($reponse))
{
$textes['en_pro'] = $donnees['Texte'];
}
Liberation_jeu_de_resultat_bdd($reponse);
}
break;
}
}
Fermeture_bdd(); // Déconnexion de MySQL
//************************************************************************************************************************************
// Affichage
//************************************************************************************************************************************
//********************************************************************************************************************************
// Affichage principal :
echo '<div id="Textes">';
//=========================================================================================
// Entête :
Entete_page($message_erreur, $message_information);
switch ($_SESSION['Textes']['page'])
{
//************************************************************************************************************************
case "Accueil":
{
echo '<div id="accueil" class="page_principale">';
if ($_SESSION['texte_fichier'] == ""){
echo '<h2> Ajouter un texte </h2>';
echo '<div class="create_text">
<form action="textes.php" method="post" enctype="multipart/form-data">
<div class="top_part">
<label for="fichier" id="label_fichier">
<select id="fichier" name="fichier" required onclick="generate_acces();">
<option value = "accueil"> Accueil </option>
<option value = "bienvenue"> Bienvenue </option>
<option value = "bateau"> Bateau </option>
<option value = "contact"> Contact </option>
<option value = "devis"> Devis </option>
<option value = "faq"> Faq </option>
<option value = "fonctionnalites"> Fonctionnalites </option>
<option value = "galerie"> Galerie </option>
<option value = "installations"> Installations </option>
<option value = "produit_desc"> Produit description </option>
<option value = "produits"> Produits </option>
<option value = "shipmember"> Shipmember </option>
<option value = "support"> Support </option>
<option value = "documentation"> Documentation </option>
<option value = "fonctions"> Fonctions </option>
</select>
<span> Fichier </span>
</label>
<label for="page" id="label_page">
<input type="text" id="page" name="page" required onkeyup="generate_acces();">
<span> Page </span>
</label>
<label for="bloc" id="label_bloc">
<input type="text" id="bloc" name="bloc" required onkeyup="generate_acces();">
<span> Bloc </span>
</label>
<label for="nom" id="label_nom">
<input type="text" id="nom" name="nom" required onkeyup="generate_acces();">
<span> Nom </span>
</label>
</div>
<div class="textes">
<label for="text_fr_par" id="label_text_fr_par">
<textarea name="text_fr_par" id="text_fr_par" placeholder="Texte en français - particulier" required></textarea>
<span> Texte en français - particulier</span>
</label>
<label for="text_fr_pro" id="label_text_fr_pro">
<textarea name="text_fr_pro" id="text_fr_pro" placeholder="Texte en français - professionnel" required></textarea>
<span> Texte en français - professionnel </span>
</label>
<label for="text_en_par" id="label_text_en_par">
<textarea name="text_en_par" id="text_en_par" placeholder="Texte en anglais - particulier" required></textarea>
<span> Texte en anglais - particulier</span>
</label>
<label for="text_en_pro" id="label_text_en_pro">
<textarea name="text_en_pro" id="text_en_pro" placeholder="Texte en anglais - professionnel" required></textarea>
<span> Texte en anglais - professionnel </span>
</label>
</div>
<label for="chemin_acces" id="label_chemin_acces">
<textarea name="chemin_acces" disabled id="chemin_acces" placeholder="$_SESSION[\'textes\'][\'x\'][\'x\'][\'x\'][\'x\'] &#10;Recuperer_texte(\'x\',\'x\',\'x\',\'x\') &#10;Ajouter_lien_modif(\'x\',\'x\',\'x\',\'x\') &#10;Ajouter_lien_modif_buttons(\'x\',\'x\',\'x\',\'x\')" required></textarea>
<span> Chemin d\'accès </span>
</label>
<div class="boutons_bas_de_page">
<button class="Retour" title="Retour..." type="submit" formnovalidate name="annuler_ajout_texte">Retour</button>
<button class="Suivant" title="Ajouter le texte" type="submit" name="validation_ajout_texte">Ajouter</button>
</div>
</form>
</div>';
}
if ($_SESSION['texte_fichier'] != ""){
echo '<h2> Modifier le texte </h2>';
echo '<div class="create_text">
<form action="textes.php" method="post" enctype="multipart/form-data">
<div class="top_part">
<label for="fichier" id="label_fichier">
<select id="fichier" name="fichier" required disabled>
<option value = "'.$_SESSION['texte_fichier'].'"> '.$_SESSION['texte_fichier'].' </option>
</select>
<span> Fichier </span>
</label>
<label for="page" id="label_page">
<input type="text" id="page" name="page" required value="'.$_SESSION['texte_page'].'" disabled>
<span> Page </span>
</label>
<label for="bloc" id="label_bloc">
<input type="text" id="bloc" name="bloc" required value="'.$_SESSION['texte_bloc'].'" disabled>
<span> Bloc </span>
</label>
<label for="nom" id="label_nom">
<input type="text" id="nom" name="nom" required value="'.$_SESSION['texte_nom'].'" disabled>
<span> Nom </span>
</label>
</div>
<div class="textes">
<label for="text_fr_par" id="label_text_fr_par">
<textarea name="text_fr_par" id="text_fr_par" placeholder="Texte en français - particulier" required>'.$textes['fr_par'].'</textarea>
<span> Texte en français - particulier</span>
</label>
<label for="text_fr_pro" id="label_text_fr_pro">
<textarea name="text_fr_pro" id="text_fr_pro" placeholder="Texte en français - professionnel" required>'.$textes['fr_pro'].'</textarea>
<span> Texte en français - professionnel</span>
</label>
<label for="text_en_par" id="label_text_en_par">
<textarea name="text_en_par" id="text_en_par" placeholder="Texte en anglais - particulier" required>'.$textes['en_par'].'</textarea>
<span> Texte en anglais - particulier</span>
</label>
<label for="text_enpro" id="label_text_enpro">
<textarea name="text_en_pro" id="text_en_pro" placeholder="Texte en anglais - professionnel" required>'.$textes['en_pro'].'</textarea>
<span> Texte en anglais - professionnel</span>
</label>
</div>
<label for="chemin_acces" id="label_chemin_acces">
<textarea name="chemin_acces" disabled id="chemin_acces" required>$_SESSION[\'textes\'][\''.$_SESSION['texte_fichier'].'\'][\''.$_SESSION['texte_page'].'\'][\''.$_SESSION['texte_bloc'].'\'][\''.$_SESSION['texte_nom'].'\'] &#10;Recuperer_texte(\''.$_SESSION['texte_fichier'].'\',\''.$_SESSION['texte_page'].'\',\''.$_SESSION['texte_bloc'].'\',\''.$_SESSION['texte_nom'].'\') &#10;Ajouter_lien_modif(\''.$_SESSION['texte_fichier'].'\',\''.$_SESSION['texte_page'].'\',\''.$_SESSION['texte_bloc'].'\',\''.$_SESSION['texte_nom'].'\')&#10;Ajouter_lien_modif_buttons(\''.$_SESSION['texte_fichier'].'\',\''.$_SESSION['texte_page'].'\',\''.$_SESSION['texte_bloc'].'\',\''.$_SESSION['texte_nom'].'\')
</textarea>
<span> Chemin d\'accès </span>
</label>
<div class="boutons_bas_de_page">
<button class="Retour" title="Annuler..." type="submit" formnovalidate name="annuler_modification_texte">Annuler</button>
<button class="Suivant" title="Modifier le texte" type="submit" name="validation_modification_texte">Valider</button>
</div>
</form>
</div>';
}
echo '</div>';
break;
}
}
echo '</div>';
Pied_de_page();
?>
<script>
function generate_acces(){
textarea = document.getElementById('chemin_acces');
fichier = document.getElementById('fichier').value.toLowerCase();
page = document.getElementById('page').value.toLowerCase();
bloc = document.getElementById('bloc').value.toLowerCase();
nom = document.getElementById('nom').value.toLowerCase();
chemin="$_SESSION['textes']['"+fichier+"']['"+page+"']['"+bloc+"']['"+nom+"'] \nRecuperer_texte(\""+fichier+"\",\""+page+"\",\""+bloc+"\",\""+nom+"\")\nAjouter_lien_modif(\""+fichier+"\",\""+page+"\",\""+bloc+"\",\""+nom+"\")\nAjouter_lien_modif_buttons(\""+fichier+"\",\""+page+"\",\""+bloc+"\",\""+nom+"\")";
textarea.innerHTML = chemin;
}
</script>