63 lines
3.0 KiB
PHP
Executable File
63 lines
3.0 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
// -----------------------------------------------------
|
|
// Requete insert en DB pages
|
|
// -----------------------------------------------------
|
|
|
|
if ($theNomPage!="" && $theEmplacement !="") {
|
|
for ($i=0; $i<($nbLg); $i++) {
|
|
$_SESSION['lgCouranteCode']=$tableLangueCode[$i];
|
|
$lDesc=$tableLangueDesc[$i];
|
|
|
|
if (!empty($theDescPage)) $theDescPage = addslashes($theDescPage);
|
|
if (!empty($theNomPage)) $theNomPage = addslashes($theNomPage);
|
|
$theDescPage=htmlspecialchars($theDescPage, ENT_QUOTES,"UTF-8",false);
|
|
$theNomPage=htmlspecialchars($theNomPage, ENT_QUOTES,"UTF-8",false);
|
|
|
|
$theFicPage=$theNomPage;
|
|
$theFicPage=$theFicPage. '_' .$_SESSION['lgCouranteCode']. '.php';
|
|
|
|
// on rajoute la langue entre parenthese pour etre clair car ici pas de
|
|
// traduction pour la description, elle devrait etre generique, il faudrait une table
|
|
// de jointure pour bien faire, mais c'est lourd a faire pour le moment
|
|
// et pour pas rajouter 2 fois on passe par une variable ..2
|
|
$theDescPage2 =$theDescPage. ' (' .$lDesc. ')';
|
|
if (substr($theEmplacement,-1)!='/') {$theEmplacement=$theEmplacement. '/';}
|
|
// Absolu-----
|
|
// -------------- ce traitement est fait ici a la creation, comme ca on n'embete pas l'utilisateur avec ca
|
|
// cela ne concerne que les mails / news : il faut mettre tous les liens en absolu
|
|
// on test le mot mail dans emplacemnt
|
|
$pos='';
|
|
$pos = strpos( strtoupper ($theEmplacement),strtoupper ("Mail"));
|
|
if ($pos!='') {$absolu=1;}
|
|
else {
|
|
$pos = strpos( strtoupper ($theEmplacement),strtoupper ("newsLetter"));
|
|
if ($pos!='') {$absolu=1;}else {$absolu=0;}
|
|
}
|
|
|
|
$req="Insert into `pages` values (0, " .$theIdPage. ", '" .$theDescPage2. "', '" .$theNomPage. "', '" .$theFicPage. "', '" .$theEmplacement. "', '" .$_SESSION['lgCouranteCode']. "', " .$absolu. ", " .$isHtml. ");";
|
|
$resConn='';
|
|
$resConn=$idPdo->query($req) ;
|
|
if ($resConn) {
|
|
// $admMsg .= '<br>Création de la page pour la langue : ' .$lDesc. ' = ok !';$admMsgClass='ok';
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['req=' => $req], 'pageReqInsert.php');}
|
|
include ("./output/01-generationFichier.php");
|
|
if ($retour!='') {
|
|
$admMsg .= '<br>Création du fichier : ' .$theEmplacement .$theFicPage. ' pour la langue : ' .$lDesc. ' = ok !';$admMsgClass='ok';
|
|
}
|
|
else {
|
|
$admMsg .= '<br>Echec de la création du fichier : ' .$theEmplacement .$theFicPage. ' pour la langue : ' .$lDesc. ' !'; $admMsgClass='ko';
|
|
}
|
|
}
|
|
else {
|
|
$admMsg .= 'Erreur lors de la création de la page pour la langue : ' .$lDesc;
|
|
$erreur = $idPdo->errorInfo();
|
|
if (isset($debug[2]) && $debug[2] == '1') $debugMsg .= $monDebug(2,['Erreur mysql' => $erreur[2] ],'');
|
|
$admMsgClass='ko';
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{ $admMsg .= 'Nom ou emplacement vide, veuillez les renseigner'; $admMsgClass='ko';}
|
|
$_SESSION['lgCouranteCode']=$lg;
|
|
?>
|