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.
150 righe
7.3 KiB
150 righe
7.3 KiB
<? |
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "/public_html")) . "/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
$error_detail = ""; |
|
$id_modulo = "open"; |
|
$cmd_info = gara::getInfoModulo($id_modulo); |
|
if ( |
|
!empty($_SESSION["utente"]) |
|
&& ($_SESSION["utente"]->permission($cmd_info["modulo_riferimento"], $_POST["codice"], $id_modulo) |
|
|| (!empty($_POST["valutazione"])) |
|
) |
|
&& !empty($_POST["codice_round"]) |
|
&& !empty($_POST["partecipante"]) |
|
&& !empty($_POST["codice_lotto"]) |
|
&& !empty($_POST["richiesta"]) |
|
&& tokenVerify() |
|
) { |
|
|
|
$valutazione = (empty($_POST["valutazione"])) ? NULL : "commissione"; |
|
$codice_round = $_POST["codice_round"]; |
|
$gara = gara::init($_POST["codice"], $codice_round, $valutazione); |
|
if (!empty($gara) && $gara->setLotto($_POST["codice_lotto"])) { |
|
$record = $gara->info; |
|
$round = $gara->round; |
|
if ($gara->checkOpeningPermission($_POST["partecipante"], $_POST["richiesta"])) { |
|
$aggiuntive = false; |
|
$busta = $gara->getBusta($_POST["partecipante"], $_POST["richiesta"], $aggiuntive, true); |
|
if (!empty($busta)) { |
|
$richiesta = $gara->getRichiesta($busta["codice_richiesta"]); |
|
$partecipante = $gara->getPartecipante($busta["codice_partecipante"]); |
|
if ($busta["open"] == "S") { |
|
if ($gara->downloadBusta($busta,"busta")) { |
|
$gara->addToLog("DOWNLOAD", $richiesta["titolo"] . " - " . $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"]); |
|
$error = false; |
|
} |
|
} else { |
|
if (!empty($_POST["private"])) { |
|
$esito = $gara->decryptBusta($busta, $_POST["private"], "busta"); |
|
if ($esito === true) { |
|
$sendNotifica = false; |
|
$checkOpen = $pdo->go( |
|
"SELECT b_gare_buste.codice FROM b_gare_buste JOIN b_gare_richieste ON b_gare_buste.codice_richiesta = b_gare_richieste.codice WHERE |
|
b_gare_buste.codice_partecipante = :partecipante AND b_gare_richieste.busta = :busta AND b_gare_buste.open = 'S'", |
|
[":partecipante" => $partecipante["codice"], ":busta" => $richiesta["busta"]] |
|
); |
|
if (empty($checkOpen->rowCount())) { |
|
$sendNotifica = true; |
|
} |
|
if ($richiesta["locked"] == "S") { |
|
$sql = "SELECT codice FROM b_offerte_gare WHERE codice_partecipante = :codice_partecipante and tipo = :busta "; |
|
$ris = $pdo->go($sql, array(":codice_partecipante" => $_POST["partecipante"], ":busta" => $richiesta["busta"])); |
|
if ($ris->rowCount() === 1) { |
|
$offerta = $ris->fetch(PDO::FETCH_ASSOC); |
|
$sql = "SELECT * FROM b_offerte_gare WHERE codice = :codice "; |
|
$ris = $pdo->go($sql, array(":codice" => $offerta["codice"])); |
|
$offerta = $ris->fetch(PDO::FETCH_ASSOC); |
|
$key = openssl_pkey_get_private($_POST["private"]); |
|
if (@openssl_private_decrypt($offerta["salt"], $salt_offerta, $key)) { |
|
$addSalt = $config["simple_encrypt"]["offer"]; |
|
$offerta["content"] = openssl_decrypt($offerta["cryptedContent"], "AES128", $salt_offerta, OPENSSL_RAW_DATA, $addSalt); |
|
if ($offerta["content"] !== false) { |
|
$offerta["content"] = base64_encode($offerta["content"]); |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_offerte_gare"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = $offerta; |
|
$salva->expect = array("codice", "content", "utente_decrypt", "timestamp_decrypt"); |
|
$esito = $salva->save(); |
|
if ($esito > 0) { |
|
$sql = "SELECT * FROM b_dettaglio_offerte_gare WHERE codice_offerta = :codice_offerta AND codice_partecipante = :codice_partecipante "; |
|
$ris = $pdo->go($sql, array(":codice_offerta" => $offerta["codice"], ":codice_partecipante" => $_POST["partecipante"])); |
|
if ($ris->rowCount() > 0) { |
|
while ($dettaglio = $ris->fetch(PDO::FETCH_ASSOC)) { |
|
$dettaglio["offerta"] = openssl_decrypt($dettaglio["cryptedOffer"], "AES128", $salt_offerta, OPENSSL_RAW_DATA, $addSalt); |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_dettaglio_offerte_gare"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = $dettaglio; |
|
$salva->expect = array("codice", "offerta"); |
|
$salva->save(); |
|
} |
|
} |
|
$sql = "SELECT * FROM b_gare_form_data WHERE codice_offerta = :codice_offerta "; |
|
$ris = $pdo->go($sql, array(":codice_offerta" => $offerta["codice"])); |
|
if ($ris->rowCount() > 0) { |
|
while ($dettaglio = $ris->fetch(PDO::FETCH_ASSOC)) { |
|
$dettaglio["content"] = openssl_decrypt($dettaglio["cryptedContent"], "AES128", $salt_offerta, OPENSSL_RAW_DATA, $addSalt); |
|
$salva = new salva(); |
|
$salva->debug = false; |
|
|
|
$salva->nome_tabella = "b_gare_form_data"; |
|
$salva->operazione = "UPDATE"; |
|
$salva->oggetto = $dettaglio; |
|
$salva->expect = array("codice", "content"); |
|
$salva->save(); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$error = false; |
|
$gara->addToLog("OPEN", $richiesta["titolo"] . " - " . $partecipante["codice_fiscale"] . " " . $partecipante["ragione_sociale"]); |
|
?> |
|
$("#wait_div").show(); |
|
refreshModalHelper(); |
|
tabofferte.draw(); |
|
<? |
|
if ($sendNotifica) { |
|
$mailer = new Communicator(); |
|
$mailer->oggetto = __("Apertura Busta") . ": " . __($richiesta["busta"]); |
|
$mailer->corpo = __("Si comunica l'avvenuta apertura della busta in oggetto") . "<br>" . |
|
__("Gara") . ": <strong>{$gara->info["oggetto"]}</strong><br>" . |
|
__("Lotto") . ": <strong>{$gara->lotto["cig"]} - {$gara->lotto["oggetto"]}</strong>"; |
|
$mailer->codice_pec = $gara->info["codice_pec"]; |
|
$mailer->comunicazione = true; |
|
$mailer->coda = true; |
|
$mailer->sezione = "gare"; |
|
$mailer->codice_gara = $gara->info["codice"]; |
|
$mailer->destinatari = oeManager::getOE($partecipante["codice_operatore"])["pec"] ?? $partecipante["pec"]; |
|
$esito = $mailer->send(); |
|
} |
|
} else { |
|
$error_detail = $esito; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
if ($error) { |
|
if (empty($error_detail)) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
echo "<h1>FORBIDDEN</h1>"; |
|
} else { |
|
?> |
|
swal({title:js_dict.error,html:"<?= $error_detail ?>",type:"error"}); |
|
<? |
|
} |
|
die(); |
|
} |
|
?>
|