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.
71 righe
2.5 KiB
71 righe
2.5 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_modello"]) && tokenVerify() && !empty($_POST["tipo"])) { |
|
$compilatore = Compilatore::init($_POST["codice_modello"]); |
|
if (!empty($compilatore->info)) { |
|
$continua = false; |
|
$error = false; |
|
if ($_POST["tipo"] == "paragrafo") { |
|
if (!empty(trim($_POST["contenuto"]))) { |
|
$continua = true; |
|
$_POST["avanzato"] = ""; |
|
} else { |
|
?> |
|
swal({title:js_dict.error,html:"<?= __("Contenuto è obbligatorio") ?>",type:"error"}); |
|
<? |
|
} |
|
} else if ($_POST["tipo"] == "ricorsivo") { |
|
if (!empty($_POST["ricorsivo"])) { |
|
$continua = true; |
|
$_POST["avanzato"] = $_POST["ricorsivo"]; |
|
$_POST["contenuto"] = ""; |
|
} else { |
|
?> |
|
swal({title:js_dict.error,html:"<?= __("Paragrafo è obbligatorio") ?>",type:"error"}); |
|
<? |
|
} |
|
} |
|
if ($continua) { |
|
$compilatore->edit = true; |
|
if (!empty($_POST["codice"])) { |
|
$continua = false; |
|
$paragrafo = $compilatore->paragrafi($_POST["codice"]); |
|
if (!empty($paragrafo)) { |
|
$continua = true; |
|
} |
|
} |
|
if ($continua) { |
|
if (empty($_POST["codice"])) { |
|
$updateOrdinamento = true; |
|
$_POST["ordinamento"] = $compilatore->getOrdinamento($_POST["after"] ?? null); |
|
} |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_compilatore_paragrafi"; |
|
$salva->operazione = empty($_POST["codice"]) ? "INSERT" : "UPDATE"; |
|
$salva->oggetto = $_POST; |
|
$codice = $salva->save(); |
|
if (!empty($codice)) { |
|
if (!empty($updateOrdinamento)) { |
|
$compilatore->updateOrdinamento($_POST["ordinamento"],$codice); |
|
} |
|
?> |
|
swal({title:js_dict["success-msg"],type:"success"}).then(function(){ window.location.href="/backend/compilatore/paragrafi/index.php?codice=<?= $compilatore->info["codice"] ?>#paragrafo-<?= $codice ?>"; }); |
|
<? |
|
} else { |
|
?> |
|
swal({title:js_dict.error,html:js_dict["error-generic"],type:"error"}); |
|
<? |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|