alpha_full/admin/agencement/blocDroit/pages/items/reqItem/itemReqInsert.php
2026-04-06 22:58:51 +02:00

48 lines
2.4 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
// -----------------------------------------------------
// reqInsert
// -----------------------------------------------------
if (!empty($theItemNom))$theItemNom = addslashes($theItemNom);
if (!empty($theMsg)) $theMsg = addslashes($theMsg);
if (!empty($theStyle)) $theStyle = addslashes($theStyle);
$theItemNom=htmlspecialchars($theItemNom, ENT_QUOTES,"UTF-8",false);
$theMsg=htmlspecialchars($theMsg, ENT_QUOTES,"UTF-8",false);
$absolu=$_SESSION['absolu'];
if ($absolu==1) {
if (!empty($theLien) && $theLien!="-") $theLien=str_replace("./",$prodServer,$theLien);
// ecrasera the lien
if (!empty($theLienExterne) && $theLienExterne!="-") $theLien=str_replace("./",$prodServer,$theLien);
if (!empty($theFichier)) $theFichier=str_replace("./",$prodServer,$theFichier);
}
if ($theItemNom !='' && $theIdPage !='' && $theNewIdItem!='') {
$reqInsert="Insert into `pagesitem` values (0, " .$theIdPage. ", " .$theNewIdItem. ", '" .$theItemNom. "', " .$theOrdre. ", '" .$theVoletCss. "','" .$theClasse. "', '" .$theType. "', '" .$theFichier. "', '" .$theStyle. "', '" .$theMsg. "','" .$theLien. "', '" .$_SESSION['lgCouranteCode']. "' );";
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['reqInsert' => $reqInsert], 'itemReqInsert.php');}
$resConn='';
try {
$resConn=$idPdo->query($reqInsert);
} catch (Exception $e) {
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Erreur mysql :' => implode(' | ', $idPdo->errorInfo()), ' N° :' => $idPdo->errno, 'Exception:' => $e->getMessage()], 'itemReqInsert.php');}
$admMsgClass='ko';
$erreurSQL=1;
}
// recup du libelle langue pour le message
for ($i=0;$i<($nbLg);$i++) {
if ($_SESSION['lgCouranteCode']==$tableLangueCode[$i]) {$lDesc=$tableLangueDesc[$i];}
}
if ($resConn) {
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Le contenu' => $theItemNom, ' a bien été ajouté pour la langue :' => $lDesc], '');}
$admMsgClass='ok';
}
}
else {
if ($theItemNom =='') $admMsg .= 'Vous devez saisir le nom dans itemReqInsert.<br>'; $admMsgClass='ko'; $erreurSQL=1;
if ($theIdPage =='') $admMsg .= 'Le idPage vide dans itemReqInsert.<br>'; $admMsgClass='ko'; $erreurSQL=1;
if ($theNewIdItem =='') $admMsg .= 'theNewIdItem vide dans itemReqInsert.<br>'; $admMsgClass='ko'; $erreurSQL=1;
}
?>