gestione gare pubbliche
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

60 righe
2.3 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$error = true;
if (!empty($_POST) && !empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_POST["codice_form"]) && tokenVerify()) {
$_POST["titolo"] = json_encode($_POST["titolo"]);
$_POST["descrizione"] = json_encode($_POST["descrizione"]);
if (!empty($_POST["input"])) { $inputArray = $_POST["input"]; unset($_POST["input"]); }
$salva = new salva();
$salva->debug = false;
$salva->nome_tabella = "b_form_group";
$salva->operazione = empty($_POST["codice"]) ? "INSERT" : "UPDATE";
$salva->oggetto = $_POST;
$codice = $salva->save();
if ($codice !== false) {
$error = false;
$inputError = array();
if (!empty($inputArray)) {
foreach($inputArray AS $input) {
$input["codice_gruppo"]=$codice;
$titoloInput = $input["titolo"][$_SESSION["language"]];
$input["titolo"] = json_encode($input["titolo"]);
$input["descrizione"] = json_encode($input["descrizione"]);
if (!empty($input["opzioni"])) {
$input["opzioni"] = json_encode($input["opzioni"]);
}
$salva = new salva();
$salva->debug = false;
$salva->nome_tabella = "b_form_input";
$salva->operazione = empty($input["codice"]) ? "INSERT" : "UPDATE";
$salva->oggetto = $input;
$codice_input = $salva->save();
if ($codice_input === false) { $inputError[] = $titoloInput; }
}
}
$href= "/backend/form/edit-group.php?codice_form=".$_POST["codice_form"] ."&codice=".$codice;
if (count($inputError) === 0) {
?>
swal({title:js_dict["success-msg"],type:"success"}).then(function(){ window.location.href="<?= $href ?>"; });
<?
} else {
$html = "";
foreach($inputError AS $errore) $html .= __("Errore") . " - " . $errore;
?>
swal({title:js_dict.attenzione,html:"<?= $html ?>",type:"warning"}).then(function(){ window.location.href="<?= $href ?>"; });
<?
}
} else {
?>
swal({title:js_dict.error,html:js_dict["error-generic"],type:"error"});
<?
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}
?>