106 lines
4.9 KiB
PHP
Executable File
106 lines
4.9 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
|
|
// -----------------------------------------------------
|
|
// Requete UPDATE en DB boucle langue
|
|
// -----------------------------------------------------
|
|
// on ne mets pas a jour message car il faudrait le traduire
|
|
// plus tard proposer un google translate....automatique
|
|
if (empty($tableLangueCode) or $refresh=='Oui') { include ($includePath. "/req/03-init.langueActives.php"); }
|
|
|
|
// -----------------------------------------------------
|
|
// Formattage
|
|
// -----------------------------------------------------
|
|
if (!empty($theItemNom))$theItemNom = addslashes($theItemNom);
|
|
if (!empty($theStyle))$theStyle = addslashes($theStyle);
|
|
$theStyle = htmlspecialchars($theStyle, ENT_QUOTES,"UTF-8",false);
|
|
$theItemNom=htmlspecialchars($theItemNom, ENT_QUOTES,"UTF-8",false);
|
|
|
|
// -----------------------------------------------------
|
|
// Si theOrdre est vide on met le max de tabOrdre sinon 1
|
|
// -----------------------------------------------------
|
|
if ($theOrdre == '') {
|
|
if (isset($_SESSION['tabOrdre']))
|
|
{$theOrdre=count($_SESSION['tabOrdre']);}
|
|
else
|
|
{$theOrdre=1;}
|
|
}
|
|
|
|
// ----------------------------------------------------
|
|
// The class pas de #
|
|
// ----------------------------------------------------
|
|
if (substr ($theClasse,0,1)=='#') {$theClasse=substr($theClasse,1, strlen($theClasse) ); }
|
|
|
|
// -----------------------------------------------------
|
|
// ecrasera the lien
|
|
// -----------------------------------------------------
|
|
if (!empty($theLienExterne) && $theLienExterne!="-") $theLien=$theLienExterne;
|
|
|
|
// gestion des liens en absolu
|
|
$absolu=$_SESSION['absolu'];
|
|
|
|
if ($absolu==1) {
|
|
if (!empty($theLien) && $theLien!="-") $theLien=str_replace("./",$prodServer,$theLien);
|
|
if (!empty($theFichier)) $theFichier=str_replace("./",$prodServer,$theFichier);
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Boucle requetes sauf courante
|
|
// -----------------------------------------------------
|
|
for ($i=0; $i<($_SESSION['nbLgActives']); $i++) {
|
|
$reqUpdate="UPDATE `pagesitem` SET ordre=" .$theOrdre. ", classe='" .$theClasse. "', themeCss='" .$theVoletCss. "', type='" .$theType. "', fichier='" .$theFichier. "', style='" .$theStyle. "', lien='" .$theLien. "' WHERE idPage=" .$theIdPage. " and codeLangue='" .$tableLangueCode[$i]. "' and idItem=" .$theIdItem. ";";
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqUpdate' => $reqUpdate], 'itemReqUpdateAll.php');}
|
|
$resConn='';
|
|
try {
|
|
$resConn=$idPdo->query($reqUpdate);
|
|
if ($resConn) {
|
|
|
|
if ($resConn->rowCount() > 0) {
|
|
$admMsg .= '<br>Le contenu a bien été mis à jour pour la langue : ' .$tableLangueDesc[$i]. ''; $admMsgClass='ok';
|
|
} else {
|
|
$admMsg .= '<br>La requête à été effectuée, mais aucune donnée n\'a été modifiée.'; $admMsgClass='ok';
|
|
}
|
|
|
|
// -------------------------------
|
|
// bacule des ordres
|
|
// -------------------------------
|
|
if (isset($oldOrdre) && $oldOrdre!=$theOrdre) {
|
|
//retrouver l'item qui avant l'ordre
|
|
$reqSelect="SELECT ordre, idItem from `pagesitem` WHERE idPage=" .$theIdPage. " AND ordre=" .$theOrdre. " AND idItem!=" .$theIdItem. " AND codeLangue='" .$tableLangueCode[$i]. "' ;";
|
|
if (isset($debug[2]) && $debug[2] == '1') $debugMsg .= monDebug(2,['<br>reqSelect ancien item' => $reqSelect],'');
|
|
try {
|
|
$resConn3=$idPdo->query($reqSelect);
|
|
if ($resConn3) {
|
|
// si la requête a fonctionnée
|
|
if ($resConn3->rowCount()>0) {
|
|
// si la requête a retourné au moins un enregistrement
|
|
$tabResult = $resConn3->fetch(PDO::FETCH_ASSOC);
|
|
$oldIdItem=$tabResult['idItem'];
|
|
if(!empty($oldIdItem)) {
|
|
$reqUpdate2="UPDATE `pagesitem` SET ordre=" .$oldOrdre. " WHERE idPage=" .$theIdPage. " AND codeLangue='" .$tableLangueCode[$i]. "' AND idItem=" .$oldIdItem. ";";
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['<br>reqUpdate oldOrdre' => $reqUpdate2], '');}
|
|
$resConn2=$idPdo->query($reqUpdate2) ;
|
|
}
|
|
}
|
|
}
|
|
} catch (PDOException $e) {
|
|
//$admMsg .= "Erreur lors de l'exécution de la requête : " . $e->getMessage();
|
|
$admMsgClass = 'ko';
|
|
}
|
|
}
|
|
// Génération du fichier
|
|
$forceLg =1;
|
|
$underscorePos = strpos($theFicPage, '_');
|
|
$partBeforeUnderscore = substr($theFicPage, 0, $underscorePos + 1); // Récupère la partie avant et y compris le '_'
|
|
$theFicPage = $partBeforeUnderscore .$tableLangueCode[$i]. '.php';
|
|
//echo 'theFicPage='.$theFicPage;
|
|
include ("./agencement/blocDroit/pages/output/01-generationFichier.php");
|
|
}
|
|
} catch (Exception $e) {
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqInsert' => $reqInsert, 'Exception:' => $e->getMessage(),'N° :' => $idPdo->errorInfo()[1]], '');}
|
|
$admMsgClass='ko';
|
|
$erreurSQL=1;
|
|
}
|
|
}
|
|
$forceLg =0;
|
|
?>
|