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.
67 righe
2.6 KiB
67 righe
2.6 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$content = false; |
|
if (empty($_POST["codice_gara"]) && !empty($_GET["codice_gara"])) $_POST = $_GET; |
|
if (!empty($_SESSION["utente"]) && !empty($_POST["codice_richiesta"]) && !empty($_POST["codice_lotto"]) && tokenVerify($_POST["token"])) { |
|
$codice_round = $_POST["codice_round"] ?? NULL; |
|
$gara = publicGara::init($_POST["codice_gara"],$codice_round); |
|
if (!empty($gara)) { |
|
if ($gara->setLotto($_POST["codice_lotto"])) { |
|
$partecipante = $gara->miaPartecipazione(); |
|
if (!empty($partecipante)) { |
|
$busta = $gara->getBustaSecretata($partecipante["codice"],$_POST["codice_richiesta"],$_POST["derivazione"],true); |
|
if (!empty($busta)) { |
|
if ($busta["open"]=="S") { |
|
$content = $busta["content"]; |
|
} else { |
|
if (!empty($_SESSION["garesecrets"][$partecipante["codice"]][$busta["codice_richiesta"]])) { |
|
$_decrypSalt = $_SESSION["garesecrets"][$partecipante["codice"]][$busta["codice_richiesta"]]; |
|
} else if (!empty($_POST["salt"])) { |
|
$_decrypSalt = $_POST["salt"]; |
|
} |
|
if (isset($_decrypSalt)) { |
|
$imported = explode(".",$busta["nomeFile"]); |
|
$addSalt = $config["simple_encrypt"]["offer"]; |
|
if (is_array($imported)) { |
|
$imported = end($imported); |
|
if ($imported == "imported-offer") { |
|
$imported = true; |
|
} |
|
} else { |
|
$imported = false; |
|
} |
|
$content = openssl_decrypt($busta["content"],"AES128",$_decrypSalt,OPENSSL_RAW_DATA,$addSalt); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($content !== false) { |
|
if ($imported === true) { |
|
$fileInfo = getTypeAndExtension($busta["content"],true); |
|
$busta["mime"] = $fileInfo["type"]; |
|
$busta["nomeFile"] = str_replace(".imported-offer","",$busta["nomeFile"]) . $fileInfo["ext"]; |
|
} |
|
if (!empty($_POST["salt"])) { |
|
$_SESSION["garesecrets"][$partecipante["codice"]][$busta["codice_richiesta"]] = $_POST["salt"]; |
|
} |
|
if (P7Manager::bustaEstensioneSoloP7M($busta["nomeFile"])) { |
|
$ext = getTypeAndExtension($file_content,true); |
|
$busta["nomeFile"] = str_replace(".p7m", "{$ext["ext"]}", $busta["nomeFile"]); |
|
} |
|
header('Content-Type: ' . $busta["mime"]); |
|
header('Content-Disposition: attachment; filename='.str_replace("-",".",$busta["nomeFile"])); |
|
header('Content-Transfer-Encoding: binary'); |
|
header('Expires: 0'); |
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
header('Pragma: public'); |
|
echo $content; |
|
} else { |
|
header('HTTP/1.0 403 Forbidden'); |
|
echo __("Errore nella richiesta"); |
|
die(); |
|
} |
|
} |
|
?>
|
|
|