alpha_full/_include/initSessLg.php
2026-04-06 22:58:51 +02:00

420 lines
18 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// echo 'refresh 1 dans initSession=>' .$refresh;
// ---------------------------------------------------
// Savoir si on est dans agencement pour activer MC
// ---------------------------------------------------
// le pb est que iFrame ne connait pas referer de son parent, donc a part la p^remier fois, apres pour chaque lien du site on a plus l'infos.
// Solution: dans frmAgencement je crée un fichier isAgencement dans admin
// Dans le site initSesslg (ici), avec js on sait si frame ou pas => window.self !== window.top;
// si pas iFrame et que le fichier existe on le delete ici, si on est dans agencement il sera recréé à nouveau.
// en plus paramètre get pour site de test pour la premiere fois, en effet memle si fichier deleté il a tendance a garer la session à 1 la premire fois.
// en fibal la session est up dans index ( pour laisser du temps de créer ou supp le fichier )
// ---------------------------------------------------
echo "<script type=\"text/javascript\">
// savoir si on est dans l'iframe ou pas
const isAgencement = window.self !== window.top;
// alert('isAgencement = '+isAgencement);
// si pas iFrame bloquer clic droit
if (!isAgencement) {
document.addEventListener('contextmenu', e => e.preventDefault());
// si pas agencement supprimer le fichier .txt par ajax
// le chemin du setAgencement.php sera faux si iFrame, vrai si site de test
fetch('setAgencement.php', { method: 'HEAD' })
.then(response => {
if (!response || !response.ok) {
console.log('Fichier setAgencement.php introuvable ou inaccessible');
return null;
}
if (response.ok) {
return fetch('setAgencement.php');
} else {
console.log('Le fichier agencement nexiste pas');
}
})
.then(res => {
if (!res) return;
if (res) { console.log('Fichier agencement.txt supprimé = ok (depuis initSessLg)');}
})
.catch(err => {
console.log('Fetch ignoré (probablement fichier absent)');
});
}
</script>";
// ---------------------------------------------------
// flag qui sert pour savoir si on est dans le backoffice
// ---------------------------------------------------
$test=false;
$_SESSION['isBackOffice']=false;
if (isset($_SERVER['REQUEST_URI'])) {
$test=strpos($_SERVER['REQUEST_URI'],"frmAdmin");
if ($test===false) $test=strpos($_SERVER['REQUEST_URI'],"admin");
}
if (isset($_SERVER['HTTP_REFERER']) && $test===false) $test=strpos($_SERVER['HTTP_REFERER'],"frmAdmin");
if (isset($_SERVER['HTTP_REFERER']) && $test===false) $test=strpos($_SERVER['HTTP_REFERER'],"frmModale");
// pour le lien depuis portail en local, ne pas activer MC
if ($test!==false) $_SESSION['isBackOffice']=true; else $_SESSION['isBackOffice']=false;
// echo 'Titi2025= $_SERVER[REQUEST_URI] = ' .$_SERVER['REQUEST_URI'];
// echo '<br>Titi2025= $_SERVER[HTTP_REFERER] = ' .$_SERVER['HTTP_REFERER'];
// ---------------------------------------------------
// Les Chemins
// ---------------------------------------------------
// pourquoi ces lignes, ne sont pas utilisées ?
// if ($_SESSION['jeviensDeIndex']==-1) {
// $includePath= $_SESSION['includePath']. "/include";
// $includePathCss= $_SESSION['includePa$_SESSION['jeviensDeIndex']==-1thCss']. "/Publication/_css";
// $includePathJs= $_SESSION['includePathJs']. "/include/_js";
// $includePathMenus= $_SESSION['includePathMenus']. "/menu";
// $includePathPublication=$_SESSION['includePathPublication']. "/Publication";
// $includePathCli= $_SESSION['includePathCli']. "/clients";
// $includePathCde= $_SESSION['includePathCde']. "/panier";
// $includePathDesign= $_SESSION['includePathDesign']. "/Design";
// $includePathCatalog= $_SESSION['includePathCatalog']. "/Catalogue";
// $includePathStructure= $_SESSION['includePathStructure']. "/structure";
// $includePathConf= $_SESSION['includePathConf']. "/_conf";
// $includePathVar= $_SESSION['includePathVar']. "/_var";
// }
if (!isset($_SESSION['jeviensDeIndex'])) $_SESSION['jeviensDeIndex']=1;
if ($_SESSION['jeviensDeIndex']==0) {
$includePath= "./_include";
$includePathCss= "./Publication/_css";
$includePathJs= "./_include/_js";
$includePathMenus= "./menu";
$includePathPublication= "./Publication";
$includePathCli= "./pages/clients";
$includePathCde= "./pages/panier";
$includePathDesign= "./Design";
$includePathCatalog= "./Catalogue";
$includePathStructure= "./structure";
$includePathConf="./_conf";
$includePathVar="./_var";
$includePathAdmin="./admin/adminInclude";
}
if ($_SESSION['jeviensDeIndex']==1) {
$includePath= "../_include";
$includePathCss= "../Publication/_css";
$includePathJs= "../_include/_js";
$includePathMenus= "../menu";
$includePathPublication= "../Publication";
$includePathCli= "../pages/clients";
$includePathCde= "../pages/panier";
$includePathDesign= "../Design";
$includePathCatalog= "../Catalogue";
$includePathStructure= "../structure";
$includePathConf="../_conf";
$includePathVar="../_var";
$includePathAdmin="../admin/adminInclude";
}
if ($_SESSION['jeviensDeIndex']==2) {
$includePath= "../../_include";
$includePathCss= "../Publication/_css";
$includePathJs= "../../_include/_js";
$includePathMenus= "../../menu";
$includePathPublication= "../../Publication";
$includePathCli= "../../pages/clients";
$includePathCde= "../../pages/panier";
$includePathDesign= "../../Design";
$includePathCatalog= "../Catalogue";
$includePathStructure= "../../structure";
$includePathConf="../../_conf";
$includePathVar="../../_var";
$includePathAdmin="../../admin/adminInclude";
}
// pour pages admin
if ($_SESSION['jeviensDeIndex']==3) {
$includePath= "../../../_include";
$includePathCss= "../../Publication/_css";
$includePathJs= "../../../_include/_js";
$includePathMenus= "../../../menu";
$includePathPublication= "../../../Publication";
$includePathCli= "../../../pages/clients";
$includePathCde= "../../../pages/panier";
$includePathDesign= "../../../Design";
$includePathCatalog= "../../Catalogue";
$includePathStructure= "../../../structure";
$includePathConf="../../../_conf";
$includePathVar="../../../_var";
$includePathAdmin="../../../admin/adminInclude";
}
// pour le cron stats qui charge initSessLg : chemin absolu
if ($_SESSION['jeviensDeIndex']==4) {
if(empty($siteTest)) $siteTest=$_SESSION['siteDossier'];
$includePath= "/datas/07Prod/wwwRoot/" .$siteTest. "/include/";
$includePathCss= "/datas/07Prod/wwwRoot/" .$siteTest. "/Publication/_css";
$includePathJs= "/datas/07Prod/wwwRoot/" .$siteTest. "/include/_js";
$includePathMenus= "/datas/07Prod/wwwRoot/" .$siteTest. "/menu";
$includePathPublication= "/datas/07Prod/wwwRoot/" .$siteTest. "/Publication";
$includePathCli= "/datas/07Prod/wwwRoot/" .$siteTest. "/clients";
$includePathCde= "/datas/07Prod/wwwRoot/" .$siteTest. "/panier";
$includePathDesign= "/datas/07Prod/wwwRoot/" .$siteTest. "/Design";
$includePathCatalog= "/datas/07Prod/wwwRoot/" .$siteTest. "/Catalogue";
$includePathStructure= "/datas/07Prod/wwwRoot/" .$siteTest. "/structure";
$includePathConf="/datas/07Prod/wwwRoot/" .$siteTest. "/_conf";
$includePathVar="/datas/07Prod/wwwRoot/" .$siteTest. "/_var";
$includePathAdmin="/datas/07Prod/wwwRoot/" .$siteTest. "/admin/adminInclude";
}
// pour preview agencement pages objets
if ($_SESSION['jeviensDeIndex']==5) {
$includePath= "./../../../../_include";
$includePathCss= "./../../../../Publication/_css";
$includePathJs= "./../../../../_include/_js";
$includePathMenus= "./../../../../menu";
$includePathPublication= "./../../../../Publication";
$includePathCli= "./../../../../pages/clients";
$includePathCde= "./../../../../pages/panier";
$includePathDesign= "./../../../../Design";
$includePathCatalog= "./../../../Catalogue";
$includePathStructure= "./../../../../structure";
$includePathConf="./../../../../_conf";
$includePathVar="./../../../../_var";
$includePathAdmin="./../../../../admin/adminInclude";
}
// ---------------------------------------------------
// Reglages PHP error/log
// ---------------------------------------------------
include ($includePath. "/initProjet.php");
// ---------------------------------------------------
// Fonction debug post
// ---------------------------------------------------
if (!isset($includeAdminJs)) $includeAdminJs = $includePathAdmin."/_js";
include_once ($includePathAdmin. "/debugPost.php");
// ---------------------------------------------------
// Connection a la base
// ---------------------------------------------------
require_once ("dataBaseConnect.php");
// ---------------------------------------------------
// Theme actif ou chaque theme si caroussel
// ---------------------------------------------------
if (isset($_GET['carrousselTheme']) &&!empty(isset($_GET['carrousselTheme'])) ) {
// recup du theme par nom
$carrousselTheme=$_GET['carrousselTheme'];
include ("req/reqSelectThemeFromName.php");
if (empty($carrousselTheme) && isset($_SESSION['nomThemeCss'])) $carrousselTheme=$_SESSION['nomThemeCss'];
}
else {
// recup du theme actif
// fonction comme ca pour les abonnements, sans include path
include ( "req/reqSelectThemeActif.php");
}
// ---------------------------------------------------
// Choix page : a clarifier avec appel : en utiliser qu'un
// ---------------------------------------------------
if (isset($_GET['affPageSite']))
{$affPageSite=$_GET['affPageSite']; $_SESSION['affPageSite']=$affPageSite; }
if (empty($affPageSite)) {$affPageSite=0; }
// ---------------------------------------------------
// Variables transverses
// ---------------------------------------------------
// flag edt pas ici
// ---------------------------------------------------
if (isset($_GET["affDetails"])) {$affDetails=($_GET["affDetails"]); }
if (!empty($_GET["idCdeAff"])) {$idCdeAff=($_GET["idCdeAff"]); }
if (isset($_GET['aff'])) {$aff=($_GET['aff']); }
// ---------------------------------------------------
// Forcer le requetage si refresh=Oui
// ---------------------------------------------------
if (isset($_POST['refresh'])) {$refresh=($_POST['refresh']); }
if (isset($_GET['refresh'])) {$refresh=($_GET['refresh']); }
// echo 'refresh dans initSession=>' .$refresh;
// cas particulier des mails
$_SESSION['refreshMail']='N';
// ---------------------------------------------------
// Recup env /variables generales
// ---------------------------------------------------
include ( "req/01-init.environnement.php");
include ( "req/02-init.variableGene.php");
// ---------------------------------------------------
// Codes langues
// ---------------------------------------------------
$lang='fr';
//premiere fois
if (null!==getenv('prefer_lang') ) {
$lang = getenv('prefer_lang'); // 'fr' ou 'en'
if ($lang=='fr') $lg="FRA";
if ($lang=='uk') $lg="ENG";
if ($lang=='it') $lg="ITA";
if ($lang=='es') $lg="ESP";
if ($lang=='de') $lg="DEU";
}
if (isset($_SESSION['lg'])) {$lg=$_SESSION['lg']; }
if (isset($_GET['lg'])) {$lg=$_GET['lg']; }
if (isset($_POST['lg'])) {$lg=$_POST['lg'];}
if ($lg=='FRA') {$lang='fr'; $isoLang='fr-FRA'; setlocale (LC_ALL, 'fr_FR.utf8','fra'); }
if ($lg=='ENG') {$lang='en'; $isoLang='en-GBR'; setlocale (LC_ALL, 'en_UK.UTF-8','UK'); }
if ($lg=='ITA') {$lang='it'; $isoLang='it-ITA'; setlocale (LC_ALL, 'it_IT.UTF-8','IT'); }
if ($lg=='ESP') {$lang='es'; $isoLang='es-ESP'; setlocale (LC_ALL, 'es_ESP.UTF-8','ESP'); }
if ($lg=='DEU') {$lang='de'; $isoLang='de-DEU'; setlocale (LC_ALL, 'de_DE.UTF-8','DEU'); }
if (empty($lg)) {$lg='FRA'; $lang='fr'; $isoLang='fr-FRA'; setlocale (LC_ALL, 'fr_FR.utf8','fra'); }
$_SESSION['lg']=$lg;
if (empty($tableLangueCode) or $refresh=='Oui') { include ($includePath. "/req/03-init.langueActives.php"); }
if (isset($debug[1]) && $debug[1] == '1') { $debugMsg .= monDebug(1, ['_POST-refresh' => $_POST['refresh']?? null, '$_SESSION[lg]' => $_SESSION['lg']?? null, '$_GET[lg]' => $_GET['lg']??null, '$_POST[lg]' => $_POST['lg']??null, 'lg' => $lg, 'lang' => $lang, 'Nombre de langues' => $_SESSION['nbLgActives'] ], 'initSessLg.php');}
// ---------------------------------------------------
// Connection utilisateur
// ---------------------------------------------------
if (isset($_SESSION['connected'])) {$connected=$_SESSION['connected']; }
// ---------------------------------------------------
// Pour reprise etapes panier
// ---------------------------------------------------
if (isset($_POST['etape'])) {$etape=$_POST['etape']; }
else {if (!empty($_GET['etape'])) {$etape=$_GET['etape']; }
else {if (isset($_SESSION['etape'])) {$etape=$_SESSION['etape']; }
}
}
// ---------------------------------------------------
// Pour redirection de pages entre elles
// ---------------------------------------------------
if (isset($_POST['appel'])) {$appel=$_POST['appel']; }
else {
if (isset($_GET['appel'])) {$appel=$_GET['appel']; }
else {
if (isset($_SESSION['appel'])) {$appel=$_SESSION['appel']; }
}
}
// ---------------------------------------------------
// idMail / pwd utilisateur
// ---------------------------------------------------
if (!empty($_SESSION['idMail'])) {$idMail=$_SESSION['idMail']; }
if (!empty($_GET['idMail'])) {$idMail=$_GET['idMail']; }
if (!empty($_POST['idMail'])) {$idMail=$_POST['idMail']; }
if (!empty($idMail)) $_SESSION['idMail']=$idMail;
// if (isset($debug[1]) && $debug[1] == '1' ) {echo 'idMail 3 =' .$idMail . ' | '; }
if (!empty($_SESSION['pwd'])) {$pwd=$_SESSION['pwd']; }
if (isset($_POST['pwd'])) {$pwd=$_POST['pwd']; $_SESSION['pwd']=$pwd; }
// ---------------------------------------------------
// Catalogue
// ---------------------------------------------------
include ("req/04-init.catMsgList.php");
// ---------------------------------------------------
// Navigation
// ---------------------------------------------------
include ("req/05-init.navMsgList.php");
// ---------------------------------------------------
// Client
// ---------------------------------------------------
include ("req/06-init.cliMsgList.php");
// ---------------------------------------------------
// Commandes
// ---------------------------------------------------
include ("req/07-init.cdeMsgList.php");
// ---------------------------------------------------
// Menus
// ---------------------------------------------------
include ("req/08-init.menuMsgList.php");
// ---------------------------------------------------
// Entete / titre du site
// ---------------------------------------------------
//
include ("req/09-init.enteteMsgList.php");
// ---------------------------------------------------
// Boutons
// ---------------------------------------------------
include ("req/10-init.btnList.php");
// ---------------------------------------------------
// Parametres affichages et options
// ---------------------------------------------------
include ("req/16-init.thmParam.php");
// ---------------------------------------------------
// Dimensions du site
// ---------------------------------------------------
include ("req/17-init.dimensions.php");
// ---------------------------------------------------
// REPERTOIRES // ancien acces // a voir comment on s'en sert maintenant
// ---------------------------------------------------
// include ("req/18-init.repertoires.php");
// ---------------------------------------------------
// ---------------------------------------------------
// Referencement balsies meta et canonique
// ---------------------------------------------------
include ("req/20-init.referencement.php");
// ---------------------------------------------------
// Debug
// ---------------------------------------------------
if (isset($debug[13]) && $debug[13] == '1') {include ($includePath. "/initSessLg.debug.php"); }
// ---------------------------------------------------
// LangueNav dynamiquement
// ---------------------------------------------------
if (isset($debug[9]) && $debug[9] == '1') {
$vars = ['nav', 'menu', 'titre', 'accueil', 'client', 'catalog', 'cde', 'contact', 'mail', 'quitter'];
foreach ($vars as $var) {
$debugArray = [];
$idVar = $var .'ID';
$msgVar = $var .'Msg';
$descVar = $var .'Desc';
$afficherVar = $var .'Afficher';
if (isset(${$idVar})) {
$count = count(${$idVar});
for ($n = 0; $n < $count; $n++) {
$debugArray["{$var}ID[$n]"] = ${$idVar}[$n];
$debugArray["Msg[$n]"] = ${$msgVar}[$n];
$debugArray["Aff[$n]"] = ${$afficherVar}[$n];
$debugArray["Desc[$n]"] = ${$descVar}[$n]. '<br>';
}
$debugMsg .= '<div style="cursor:pointer" onClick="if(document.getElementById(\'initSessDebug'.$n.'\')) {
if (document.getElementById(\'initSessDebug'.$n.'\').style.display==\'block\') document.getElementById(\'initSessDebug'.$n.'\').style.display=\'none\';
else document.getElementById(\'initSessDebug'.$n.'\').style.display=\'block\';
}
;" ><b><i class="fa-duotone fa-arrow-down"></i>' . $var. '</b>' ;
$debugMsg .= '<div id="initSessDebug'.$n.'" style="display:none">';
$debugMsg .= monDebug(1, $debugArray, 'debug from initSessLg ( lecture des variables dejà chargées ) => <b>' . $var. '</b>');
$debugMsg .= '</div >';
$debugMsg .= '</div >';
}
}
}
?>