permission($radice) && !empty($_GET["tokenEsportazione"])) { if (!empty($_SESSION["exportoperatori"][$_GET["tokenEsportazione"]])) { $alloperatori = array_column($_SESSION["exportoperatori"][$_GET["tokenEsportazione"]], "codice"); } else if ($_SESSION["exportoperatoriRelazioni"][$_GET["tokenEsportazione"]]) { $alloperatori = array_column(json_decode(gzuncompress($_SESSION["exportoperatoriRelazioni"][$_GET["tokenEsportazione"]]),true),"codice_operatore"); } if (!empty($alloperatori)) { $error = false; session_write_close(); $manager = new oeManager; $manager->countInviti = true; $manager->countAggiudicato = true; $ooee = $manager->exportInfo($alloperatori, $_SESSION["ente"]->codice); if (!empty($ooee)) { $exportPath = sys_get_temp_dir() . "/export.zip"; $zip = new ZipArchive; if ($zip->open($exportPath, ZipArchive::CREATE) === TRUE) { $json = json_encode($ooee["data"], JSON_PRETTY_PRINT); $zip->addFromString("data.json", $json); if (!empty($ooee["allegati"])) { foreach ($ooee["allegati"] as $allegato) { $zip->addFromString($allegato["path"], $allegato["content"]); } } $zip->close(); header('Content-Type: application/zip'); header('Content-Length: ' . filesize($exportPath)); header('Content-Disposition: attachment; filename="exportFornitori.zip"'); readfile($exportPath); } else { $error = true; } } } } if ($error) { header('HTTP/1.0 403 Forbidden'); die(); }